Commits

Christian Krebs  committed 673c04b Merge

Synced with bitbucket.

  • Participants
  • Parent commits f110623, 9a51602

Comments (0)

Files changed (1)

File tests/add-remove-runtime/index.html

 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 	<title>Add-Remove-Runtime</title>
 	<style>
+	  html {
+	    height: 100%;
+    }
+    
 	  body {
       font-family: Arial, Helvetica, sans-serif;
+      position: relative;
+      margin: 0;
+      padding: 10px;
+      height: 100%;
+      box-sizing: border-box;
     }
 
 	  .container {
       color: rgb(255, 0, 94);
       text-decoration: none;
     }
+
+    .permalink_container {
+      position: fixed;
+      bottom: 0;
+      left: 0;
+      z-index: 2;
+      box-sizing: border-box;
+      width: 100%;
+      padding: 10px;
+      background-color: #FFF;
+      box-shadow: 0 0 1em #bababa;
+      display: none;
+    }
+
+    #permalink {
+      width: 100%;
+    }
+
 	</style>
 </head>
 <body>
     <input type="submit" value="Add"></input>
   </form>
   <div class="log"></div>
+  <div class="permalink_container">
+    <p>Permalink</p>
+    <input type="text" name="permalink" id="permalink">
+  </div>
   <script src="http://jquery.com/src/jquery-latest.js"></script>
   <script>
     $(function(){
-      
+
       var add_iframe = function(evt_or_url)
       {
         var url = $("#iframesrc").val();
+        var permalink = $("#permalink");
         if (evt_or_url.preventDefault)
         {
           evt_or_url.preventDefault();
                 function(container) {
                   return function(evt) {
                     container.remove();
+                    // Remove from permalink, first instance of url only, will break order
+                    permalink.val(permalink.val().replace(url + ",", ""));
                     evt.preventDefault();
                   }
                 }
           {
             $("#iframesrc").val(url);
           }
+
+          // Make a permalink for all iframes
+          $(".permalink_container").css({"display": "block"});
+          if (!permalink.val())
+          {
+            // Put current location href, but without query
+            permalink.val(location.href.replace(location.search, ""));
+          }
+
+          // Add "?open=" (once)
+          if (permalink.val().indexOf("?open=") == -1)
+          {
+            permalink.val(permalink.val() + "?open="); // +=
+          }
+          permalink.val(permalink.val() + url + ","); // +=
         }
       }
 
-      // $(".add").click(add_iframe);
+      $("#iframesrc").bind("input", function(evt){
+        localStorage.last_url = $(this).val();
+      });
+      if (localStorage.last_url)
+      {
+        $("#iframesrc").val(localStorage.last_url);
+      }
+
       $("form").submit(
         function(evt)
         {
           evt.preventDefault();
         }
       );
+
+      $("#permalink").click(function(){
+        $(this).select();
+      });
+
       var open_via_query = location.search.replace("?open=","").split(",")
       if (open_via_query.length)
       {