Fix the fullscreen mode for +all. Probably fixes some infobox+select bugs while
authorSteinar H. Gunderson <sesse@debian.org>
Tue, 24 Jul 2007 22:47:19 +0000 (00:47 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Tue, 24 Jul 2007 22:47:19 +0000 (00:47 +0200)
we're at it.

files/pr0n-fullscreen.js
perl/Sesse/pr0n/Index.pm
templates/default/fullscreen-footer

index 181a82cb1e0745bde78677c7c02ca5ab16b6c74f..001efc1c5e60d9f995546c3e7eccf907ad94a320 100644 (file)
@@ -67,7 +67,7 @@ function reduce_to_fixed_width(size)
        
 function display_image(width, height, evt, filename, element_id)
 {
-       var url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/" + filename;
+       var url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/" + global_infobox + filename;
        var img = document.getElementById(element_id);
        if (img != null) {
                img.src = "data:";
@@ -111,9 +111,9 @@ function relayout()
        var size = find_width();
        var adjusted_size = reduce_to_fixed_width(size);
 
-       var img = display_image(adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num], "image");
+       var img = display_image(adjusted_size[0], adjusted_size[1], global_image_list[global_image_num][0], global_image_list[global_image_num][1], "image");
        if (can_go_next()) {
-               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num + 1]);
+               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_image_list[global_image_num + 1][0], global_image_list[global_image_num + 1]);
        }
        
        // center the image on-screen
@@ -178,10 +178,10 @@ function go_previous()
 
        var adjusted_size = reduce_to_fixed_width(find_width());
 
-       var img = display_image(adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num], "image");
+       var img = display_image(adjusted_size[0], adjusted_size[1], global_image_list[global_image_num][0], global_image_list[global_image_num][1], "image");
        if (can_go_previous()) {
                set_opacity("previous", 0.7);
-               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num - 1]);
+               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_image_list[global_image_num - 1][0], global_image_list[global_image_num - 1][1]);
        } else {
                set_opacity("previous", 0.1);
        }
@@ -202,10 +202,10 @@ function go_next()
 
        var adjusted_size = reduce_to_fixed_width(find_width());
 
-       var img = display_image(adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num], "image");
+       var img = display_image(adjusted_size[0], adjusted_size[1], global_image_list[global_image_num][0], global_image_list[global_image_num][1], "image");
        if (can_go_next()) {
                set_opacity("next", 0.7);
-               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_evt, global_image_list[global_image_num + 1]);
+               prepare_preload(img, adjusted_size[0], adjusted_size[1], global_image_list[global_image_num + 1][0], global_image_list[global_image_num + 1][1]);
        } else {
                set_opacity("next", 0.1);
        }
@@ -242,11 +242,11 @@ function key_up(which) {
                set_opacity("close", 0.7);
                do_close();
        } else if (which == 32 && global_select) {   // space
-               select_image(global_image_list[global_image_num]);
+               select_image(global_image_list[global_image_num][0], global_image_list[global_image_num][1]);
        }
 }
 
-function select_image(filename)
+function select_image(evt, filename)
 {
        if (!req)
                return;
@@ -255,7 +255,7 @@ function select_image(filename)
        
        req.open("POST", "http://" + global_vhost + "/select", false);
        req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-       req.send("mode=single&event=" + global_evt + "&filename=" + filename);
+       req.send("mode=single&event=" + evt + "&filename=" + filename);
 
        setTimeout("fade_text(0.99)", 30);
 }
index 005c55d9d570b78c3c67f4eefcf7ca2063c20c31..39a8b21ba50d251aff274d3ad76215c2b432a74f 100644 (file)
@@ -147,7 +147,7 @@ sub handler {
                $r->content_type("text/html; charset=utf-8");
                Sesse::pr0n::Templates::print_template($r, "fullscreen-header", { title => "$name [$event]" });
                while (my $ref = $q->fetchrow_hashref()) {
-                       $r->print("        \"" . $infobox . $ref->{'filename'} . "\",\n");
+                       $r->print("        [ \"" . $ref->{'event'} . "\", \"" . $ref->{'filename'} . "\" ],\n");
                }
 
                my %settings_no_fullscreen = %settings;
@@ -161,10 +161,10 @@ sub handler {
 
                Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
                        vhost => $r->get_server_name,
-                       event => $event,
                        start => $settings{'start'} - 1,
                        returnurl => $returnurl,
                        sel => $settings{'sel'},
+                       infobox => $infobox
                });
        } else {
                Sesse::pr0n::Common::header($r, "$name [$event]");
index bd569d8d6201f28a3c379d5834065a47f1193e2e..1f67de3db38a70fe4f9bc214e68fdd9f9c336761 100644 (file)
@@ -1,6 +1,6 @@
 ];
 var global_vhost = "%VHOST%";
-var global_evt = "%EVENT%";
+var global_infobox = "%INFOBOX%";
 var global_return_url = "%RETURNURL%";
 var global_image_num = %START%;
 var global_select = %SEL%;