allow to change the number of seconds of pause in the slideshow, and keep it in a...
authorgc <gc>
Thu, 5 May 2005 21:28:32 +0000 (21:28 +0000)
committergc <gc>
Thu, 5 May 2005 21:28:32 +0000 (21:28 +0000)
data/booh/themes/simple/skeleton_image.html
lib/booh/html-merges.rb

index 1e703b37143222f17632e9e9102e51f9749c4264..f46342a9d3a99f04e7c6817308a1159c5ed566a0 100644 (file)
@@ -68,8 +68,9 @@ input {
 <tr>
     <td colspan="9" align="center">
         ~~~button_slideshow~~~
+        ~~~pause_slideshow~~~
+        <br/>
         <font size="-1">~~thumbnails~~</font>
-    </td>
 </tr>
 </table>
 </html>
index 5b8a0a48070d2ceefeb2d28ac3b8837e37963de7..23c724d54670deacb6e7f0d14fc9e158decd0abd 100644 (file)
@@ -40,7 +40,7 @@ var images_ary = new Array();
 var images_loaded = new Array();
 var current = 0;
 var slideshow = 0;
-var slideshow_pause = 3;
+var slideshow_pause = null;
 var slideshow_timer = null;
 
 for (i = 0; i < images.length; i++) { 
@@ -97,12 +97,31 @@ function preload() {
     setTimeout("preload()", 500);
 }
 
-function init() {
-
+function add_cookie(val) {
     var expires = new Date(new Date().getTime() + (30 * 86400000));  // 30 days
-    document.cookie = 'booh-preferred-size-~~theme~~=~~current_size~~'
+    document.cookie = val
                       + '; expires=' + expires.toGMTString()
                       + '; path=/';
+}
+
+function get_cookie(key) {
+    if (document.cookie) {
+        var index = document.cookie.indexOf(key);
+        if (index != -1) {
+            var oleft = (document.cookie.indexOf('=', index) + 1);
+            var oright = document.cookie.indexOf(';', index);
+            if (oright == -1) {
+                oright = document.cookie.length;
+            }
+            return document.cookie.substring(oleft, oright);
+        }
+    }
+    return null;
+}
+
+function init() {
+
+    add_cookie('booh-preferred-size-~~theme~~=~~current_size~~')
 
     /* retrieve GET parameters */
     all_params = location.href.split("?")
@@ -110,9 +129,6 @@ function init() {
         params = all_params[1].split("&");
         for (i = 0; i < params.length; i++) {
             keyvalue = params[i].split("=");
-            if (keyvalue[0] == "slideshow_pause") {
-                slideshow_pause = keyvalue[1];
-            }
             if (keyvalue[0] == "run_slideshow") {
                 toggle_slideshow();
             }
@@ -132,6 +148,11 @@ function init() {
     if (images.length == 1) {
         document.getElementById("b_slideshow").disabled = true;
     }
+
+    preferred_pause = get_cookie('booh-slideshow-pause-~~theme~~');
+    if (preferred_pause != null) {
+        document.getElementById('secs').value = preferred_pause;
+    }
 }
 
 function update_sensibilities() {
@@ -239,6 +260,8 @@ function last() {
 
 function toggle_slideshow(now) {
     if (slideshow == 0) {
+        slideshow_pause = document.getElementById('secs').value;
+        add_cookie('booh-slideshow-pause-~~theme~~=' + slideshow_pause)
         document.getElementById("b_slideshow").value = "~~stop_slideshow~~";
         slideshow = 1;
         if (current == images.length - 1) {
@@ -287,32 +310,35 @@ $button_first = '
     <form><input type="button"
                  onclick="first()"
                  value="' + utf8(_('<<- First')) + '"
-                 id="b_first"></form>';
+                 id="b_first"/></form>'
 
 $button_previous = '
     <form><input type="button"
                  onclick="previous()"
                  value="' + utf8(_('<- Previous')) + '"
-                 id="b_previous"></form>';
+                 id="b_previous"/></form>'
 
 $button_next = '
     <form><input type="button"
                  onclick="next()"
                  value="' + utf8(_('Next ->')) + '"
-                 id="b_next"></form>';
+                 id="b_next"/></form>'
 
 $button_last = '
     <form><input type="button"
                  onclick="last()"
                  value="' + utf8(_('Last ->>')) + '"
-                 id="b_last"></form>';
+                 id="b_last"/></form>'
 
 $button_slideshow = '
-  <form><input type="button"
-               onclick="toggle_slideshow(true)"
-               value="' + utf8(_('Run slideshow!')) + '"
-               id="b_slideshow">
-  </form>';
+    <input type="button"
+           onclick="toggle_slideshow(true)"
+           value="' + utf8(_('Run slideshow!')) + '"
+           id="b_slideshow"/>'
+
+$pause_slideshow = '
+    <font size="-2">' + utf8(_('pause:')) + '<input type="text" id="secs" size="1" value="3"/>' + utf8(_('secs')) + '</font>'
+
 
 $image = <<'EOF'
   <img name="main_img">