Remember the image sizes in the javascript Rename the videos_heights and videos_width...
authorBenoit Dien <benoit.dien@gmail.com>
Sat, 30 Jul 2011 21:23:58 +0000 (23:23 +0200)
committerGuillaume Cottenceau <gcottenc@gmail.com>
Wed, 3 Aug 2011 11:47:33 +0000 (13:47 +0200)
bin/booh-backend
data/booh/themes/cardu/root/booh.js
data/booh/themes/dark/root/booh.js
data/booh/themes/gradient/root/booh.js
data/booh/themes/sbs/root/booh.js
data/booh/themes/simple/root/booh.js
lib/booh/html-merges.rb

index ed4b7e9..1dbc88c 100755 (executable)
@@ -1378,26 +1378,32 @@ def walk_source_dir
 
             for sizeobj in $images_size
                 elements4js = []
-                videoswidths4js = []
-                videosheights4js = []
+                elemswidths4js = []
+                elemsheights4js = []
                 for file in entries
                     type = images.include?(file) ? 'image' : videos.include?(file) ? 'video' : nil
                     if type
                         if type == 'image'
                             index = images.index(file)
                             elements4js << '"' + fullscreen_images[sizeobj['name']][index] + '"'
-                            videoswidths4js << "''"
-                            videosheights4js << "''"
+                            size = get_image_size("#{dest_dir}/#{fullscreen_images[sizeobj['name']][index]}")
+                            if size
+                                elemswidths4js << size[:x].to_s
+                                elemsheights4js << size[:y].to_s
+                            else
+                                elemswidths4js << "''"
+                                elemsheights4js << "''"
+                            end
                         else
                             index = videos.index(file)
                             elements4js << '"' + fullscreen_videos[sizeobj['name']][index] + '"'
                             size = get_image_size("#{dest_dir}/#{fullscreen_videos[sizeobj['name']][index]}")
                             if size
-                                videoswidths4js << size[:x].to_s
-                                videosheights4js << size[:y].to_s
+                                elemswidths4js << size[:x].to_s
+                                elemsheights4js << size[:y].to_s
                             else
-                                videoswidths4js << "''"
-                                videosheights4js << "''"
+                                elemswidths4js << "''"
+                                elemsheights4js << "''"
                             end
                         end
                     end
@@ -1430,8 +1436,8 @@ def walk_source_dir
                     i.gsub!(/~~images~~/, elements4js.join(', '))
                     i.gsub!(/~~types~~/, types4js.join(', '))
                     i.gsub!(/~~videos~~/, videos4js.join(', '))
-                    i.gsub!(/~~videos_widths~~/, videoswidths4js.join(', '))
-                    i.gsub!(/~~videos_heights~~/, videosheights4js.join(', '))
+                    i.gsub!(/~~widths~~/, elemswidths4js.join(', '))
+                    i.gsub!(/~~heights~~/, elemsheights4js.join(', '))
                     i.gsub!(/~~hidden_images_for_remotes~~/, hiddenimages4remotes)
                     i.gsub!(/~~other_images~~/, otherelements4js)
                     i.gsub!(/~~thumbnailspages~~/, element2thumbnailpage4js.collect { |e| "\"#{e}\"" }.join(', '))
index 0846de3..94da498 100644 (file)
@@ -258,9 +258,9 @@ function display_current() {
         main_img.innerHTML = '<div class="fullscreen_image"><img src="' + images[current] + '"/></div>';
     } else {
         main_img.innerHTML = '<a class="fullscreenvideolink" href="' + videos[current] + '" '
-                           + '   style="display:block;width:' + videos_widths[current] + 'px;height:' + (videos_heights[current] + 24) + 'px" id="player">'
+                           + '   style="display:block;width:' + widths[current] + 'px;height:' + (heights[current] + 24) + 'px" id="player">'
                            + '  <div class="fullscreen_video"><img src="' + images[current] + '"/></div>'
-                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (videos_heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
+                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
                            + '</a>';
         if (dbltilda_flowplayer_active == 'true') {
             flowplayer("player", dbltilda_pathtobase + "flowplayer-3.2.7.swf");
index ee23dd4..dae62b5 100644 (file)
@@ -249,9 +249,9 @@ function display_current() {
         main_img.innerHTML = '<img src="' + images[current] + '"/>';
     } else {
         main_img.innerHTML = '<a class="fullscreenvideolink" href="' + videos[current] + '" '
-                           + '   style="display:block;width:' + videos_widths[current] + 'px;height:' + (videos_heights[current] + 24) + 'px" id="player">'
+                           + '   style="display:block;width:' + widths[current] + 'px;height:' + (heights[current] + 24) + 'px" id="player">'
                            + '  <img src="' + images[current] + '"/>'
-                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (videos_heights[current] + 48)/2 + 'px;border:0"/>'
+                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (heights[current] + 48)/2 + 'px;border:0"/>'
                            + '</a>';
         if (dbltilda_flowplayer_active == 'true') {
             flowplayer("player", dbltilda_pathtobase + "flowplayer-3.2.7.swf");
index 33e96db..5158919 100644 (file)
@@ -266,9 +266,9 @@ function display_current() {
         main_img.innerHTML = '<div class="fullscreen_image"><img src="' + images[current] + '"/></div>';
     } else {
         main_img.innerHTML = '<a class="fullscreenvideolink" href="' + videos[current] + '" '
-                           + '   style="display:block;width:' + videos_widths[current] + 'px;height:' + (videos_heights[current] + 24) + 'px" id="player">'
+                           + '   style="display:block;width:' + widths[current] + 'px;height:' + (heights[current] + 24) + 'px" id="player">'
                            + '  <div class="fullscreen_video"><img src="' + images[current] + '"/></div>'
-                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (videos_heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
+                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
                            + '</a>';
         if (dbltilda_flowplayer_active == 'true') {
             flowplayer("player", dbltilda_pathtobase + "flowplayer-3.2.7.swf");
index a964fc7..2fe3eaf 100644 (file)
@@ -249,9 +249,9 @@ function display_current() {
         main_img.innerHTML = '<div class="fullscreen_image"><img src="' + images[current] + '"/></div>';
     } else {
         main_img.innerHTML = '<a class="fullscreenvideolink" href="' + videos[current] + '" '
-                           + '   style="display:block;width:' + videos_widths[current] + 'px;height:' + (videos_heights[current] + 24) + 'px" id="player">'
+                           + '   style="display:block;width:' + widths[current] + 'px;height:' + (heights[current] + 24) + 'px" id="player">'
                            + '  <div class="fullscreen_video"><img src="' + images[current] + '"/></div>'
-                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (videos_heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
+                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (heights[current] + 48)/2 + 'px;border:0;background-color:transparent"/>'
                            + '</a>';
         if (dbltilda_flowplayer_active == 'true') {
             flowplayer("player", dbltilda_pathtobase + "flowplayer-3.2.7.swf");
index ee23dd4..dae62b5 100644 (file)
@@ -249,9 +249,9 @@ function display_current() {
         main_img.innerHTML = '<img src="' + images[current] + '"/>';
     } else {
         main_img.innerHTML = '<a class="fullscreenvideolink" href="' + videos[current] + '" '
-                           + '   style="display:block;width:' + videos_widths[current] + 'px;height:' + (videos_heights[current] + 24) + 'px" id="player">'
+                           + '   style="display:block;width:' + widths[current] + 'px;height:' + (heights[current] + 24) + 'px" id="player">'
                            + '  <img src="' + images[current] + '"/>'
-                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (videos_heights[current] + 48)/2 + 'px;border:0"/>'
+                           + '  <img src="' + dbltilda_pathtobase + 'play_video.png" style="position:relative;top:-' + (heights[current] + 48)/2 + 'px;border:0"/>'
                            + '</a>';
         if (dbltilda_flowplayer_active == 'true') {
             flowplayer("player", dbltilda_pathtobase + "flowplayer-3.2.7.swf");
index 018d4df..f0fe439 100644 (file)
@@ -34,8 +34,8 @@ $image_head_code = '<meta name="generator" content="Booh-' + $VERSION + <<'EOF'
 var images = new Array(~~images~~);
 var types = new Array(~~types~~);
 var videos = new Array(~~videos~~);
-var videos_widths = new Array(~~videos_widths~~);
-var videos_heights = new Array(~~videos_heights~~);
+var widths = new Array(~~widths~~);
+var heights = new Array(~~heights~~);
 ~~other_images~~
 var thumbnailspages = new Array(~~thumbnailspages~~);
 var other_sizes = new Array(~~other_sizes~~);