amaury feature: when returning from images to thumbnail, use an anchor to go to the...
authorgc <gc>
Wed, 20 Apr 2005 19:54:00 +0000 (19:54 +0000)
committergc <gc>
Wed, 20 Apr 2005 19:54:00 +0000 (19:54 +0000)
bin/booh
lib/booh/html-merges.rb

index 5adf08713f549cb01b03c69e829b5f9a98732ae0..00459eaee5b97af6bdea210db15a5a45075bd5aa 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -465,7 +465,8 @@ def walk_source_dir
                         if type == 'image'
                             index = images.index(file)
                             html_thumbnails.gsub!(/~~image_iteration~~/,
-                                                  '<a href="image-' + sizeobj['name'] + '.html?current=' + fullscreen_images[sizeobj['name']][index] + '">' +
+                                                  '<a href="image-' + sizeobj['name'] + '.html?current=' + fullscreen_images[sizeobj['name']][index] +
+                                                      '" name="' + fullscreen_images[sizeobj['name']][index] + '">' +
                                                       img_element("#{dest_dir}/#{thumbnail_images[sizeobj['name']][index]}") + '</a>')
                             html_thumbnails.gsub!(/~~caption_iteration~~/,
                                                   find_caption_value(xmldir, images[index]) || utf8(images[index]))
@@ -505,8 +506,7 @@ def walk_source_dir
 
             #- generate image.html (page with fullscreen images)
             if images.size > 0
-                #- don't ask me why I need so many backslashes... the aim is to print \\\" for each " in the javascript source
-                captions4js = find_captions(xmldir, images).collect { |e| e ? '"' + e.gsub('"', '\\\\\\\\\\\\\\\\\"' ) + '"' : '""' }.join(', ')
+                captions4js = find_captions(xmldir, images).collect { |e| e ? '"' + e.gsub('"', '\"' ) + '"' : '""' }.join(', ')
                 for sizeobj in $images_size
                     html = $html_images.collect { |l| l.clone }
                     images4js = fullscreen_images[sizeobj['name']].collect { |e| "\"#{e}\"" }.join(', ')
@@ -519,14 +519,14 @@ def walk_source_dir
                         end
                     end
                     for i in html
-                        i.sub!(/~~images~~/, images4js)
-                        i.sub!(/~~other_images~~/, otherimages4js)
-                        i.sub!(/~~other_sizes~~/, othersizes.join(', '))
-                        i.sub!(/~~captions~~/, captions4js)
-                        i.sub!(/~~title~~/, xmldir.attributes['thumbnails-caption'] || utf8(File.basename(dir)))
-                        i.sub!(/~~thumbnails~~/, '<a href="thumbnails-' + sizeobj['name'] + '.html">' + utf8(_('Return to thumbnails')) + '</a>')
-                        i.sub!(/~~theme~~/, $theme)
-                        i.sub!(/~~current_size~~/, sizeobj['name'])
+                        i.gsub!(/~~images~~/, images4js)
+                        i.gsub!(/~~other_images~~/, otherimages4js)
+                        i.gsub!(/~~other_sizes~~/, othersizes.join(', '))
+                        i.gsub!(/~~captions~~/, captions4js)
+                        i.gsub!(/~~title~~/, xmldir.attributes['thumbnails-caption'] || utf8(File.basename(dir)))
+                        i.gsub!(/~~thumbnails~~/, '<a href="thumbnails-' + sizeobj['name'] + '.html" id="thumbnails">' + utf8(_('Return to thumbnails')) + '</a>')
+                        i.gsub!(/~~theme~~/, $theme)
+                        i.gsub!(/~~current_size~~/, sizeobj['name'])
                         for sizeobj2 in $images_size
                             if sizeobj != sizeobj2
                                 i.sub!(/~~size_#{sizeobj2['name']}~~/,
index 23b1d4fc4e097d1a54ff3a57e05a87649607fb46..6ab890240f3379d848e40ace9fca25211b4657a1 100644 (file)
@@ -174,14 +174,13 @@ function show_current_text() {
     /* don't show text if image not yet loaded because navigator
      * won't refresh it during load */
     if (images_loaded[current] == 2) {
-        eval("document.getElementById('image_counter')" +
-                     ".firstChild.data = '" + ( current + 1 ) + "/" + images.length + "'");
-        eval("document.getElementById('main_text')" +
-                     ".firstChild.data = \"" + ( captions[current] || images[current] ) + "\"");
+        document.getElementById('image_counter').firstChild.data = ( current + 1 ) + "/" + images.length;
+        document.getElementById('main_text').firstChild.data = captions[current] || images[current];
         for (i = 0; i < other_sizes.length; i++) { 
-            eval("linkelems = document.getElementById('link" + other_sizes[i] + "').href.split('?');" +
-                 "document.getElementById('link" + other_sizes[i] + "').href = linkelems[0] + '?current=" + eval("images_" + other_sizes[i] + "[current]") + "'");
+            linkelems = document.getElementById('link' + other_sizes[i]).href.split('?');
+            document.getElementById('link' + other_sizes[i]).href = linkelems[0] + '?current=' + eval("images_" + other_sizes[i] + "[current]");
         }
+        document.getElementById('thumbnails').href = 'thumbnails-~~current_size~~.html#' + images[current];
         set_cursor("default");
     } else {
         setTimeout("show_current_text()", 100);