changeset 128:3f48c23c7987

Fix the handling of link arguments.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 13 Jul 2018 01:06:18 +0300
parents 4cebbee4b29b
children 146879c896b9
files mpui.js
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpui.js	Thu Jul 12 22:33:07 2018 +0300
+++ b/mpui.js	Fri Jul 13 01:06:18 2018 +0300
@@ -1,4 +1,5 @@
 var mpMachine = 0;
+var mpURL;
 
 var mpMachines =
 {
@@ -139,7 +140,7 @@
   var mpCanvas = stGE("mpCanvas");
   mpCanvas.style.display = "block";
 
-  window.location.href = window.location.href +"?"+ mpMachine.toString();
+  window.location.href = mpURL +"?"+ mpMachine.toString();
 
   mpRunSketch(mpCanvas);
 }
@@ -156,6 +157,8 @@
   if ((spos = slink.indexOf("?")) >= 0)
   {
     var tmp = parseInt(unescape(slink.substr(spos + 1)));
+    mpURL = slink.substr(0, spos);
+
     for (var key in mpMachines)
     {
       if (key == tmp)
@@ -166,6 +169,8 @@
       }
     }
   }
+  else
+    mpURL = slink;
 
   if (found)
   {