fix cookie
authorgc <gc>
Mon, 18 Apr 2005 21:36:14 +0000 (21:36 +0000)
committergc <gc>
Mon, 18 Apr 2005 21:36:14 +0000 (21:36 +0000)
README
bin/booh
lib/booh/html-merges.rb

diff --git a/README b/README
index fdc586a..7a42a70 100644 (file)
--- a/README
+++ b/README
@@ -10,6 +10,7 @@
   US-ASCII characters (even if I _don't_ advice you to store
   files with these)
 - clever use of the whole space of a typical browser window
+- cookie to remember the preferred size of thumbnails accross sub-albums
 - subalbums support (images in any subdirectory depth)
 
         frontend
index baed847..5adf087 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -462,8 +462,6 @@ def walk_source_dir
                     type = images.include?(file) ? 'image' : videos.include?(file) ? 'video' : nil
                     if type
                         html_thumbnails += run_iterations(iterations)
-                        html_thumbnails.gsub!(/~~theme~~/, $theme)
-                        html_thumbnails.gsub!(/~~current_size~~/, sizeobj['name'])
                         if type == 'image'
                             index = images.index(file)
                             html_thumbnails.gsub!(/~~image_iteration~~/,
@@ -492,6 +490,8 @@ def walk_source_dir
                 html_thumbnails += close_iterations(iterations)
                 for i in html
                     i.sub!(/~~thumbnails~~/, html_thumbnails)
+                    i.gsub!(/~~theme~~/, $theme)
+                    i.gsub!(/~~current_size~~/, sizeobj['name'])
                 end
                 ios = File.open("#{dest_dir}/thumbnails-#{sizeobj['name']}.html", "w")
                 ios.write(html)
index 4ea0da4..23b1d4f 100644 (file)
@@ -99,6 +99,11 @@ function preload() {
 
 function init() {
 
+    var expires = new Date(new Date().getTime() + (30 * 86400000));  // 30 days
+    document.cookie = 'booh-preferred-size-~~theme~~=~~current_size~~'
+                      + '; expires=' + expires.toGMTString()
+                      + '; path=/';
+
     /* retrieve GET parameters */
     all_params = location.href.split("?")
     if (all_params.length > 1) {