Add a close button to get out of fullscreen.
authorSteinar H. Gunderson <sesse@debian.org>
Mon, 31 Jul 2006 17:31:34 +0000 (19:31 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Mon, 31 Jul 2006 17:31:34 +0000 (19:31 +0200)
close.png [new file with mode: 0644]
perl/Sesse/pr0n/Index.pm
perl/Sesse/pr0n/pr0n.pm
pr0n-fullscreen.css
pr0n-fullscreen.js
templates/default/fullscreen-footer

diff --git a/close.png b/close.png
new file mode 100644 (file)
index 0000000..721ad2c
Binary files /dev/null and b/close.png differ
index 52766ab3a435513cbf568ba3401bd65391e2fdd5..c0c89a7f5d94d7cb6bd3c23d76845c232fb2d26a 100644 (file)
@@ -42,6 +42,7 @@ sub handler {
                infobox => 1,
                rot => 0,
                sel => 0,
+               fullscreen => 0,
        );
        
        # Reduce the front page load when in overload mode.
@@ -50,9 +51,8 @@ sub handler {
        }
                
        my %settings = %defsettings;
-       my $fullscreen = (defined($apr->param('fullscreen')) && $apr->param('fullscreen') eq '1');
 
-       for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel) {
+       for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen) {
                my $val = $apr->param($s);
                if (defined($val) && $val =~ /^(\d+)$/) {
                        $settings{$s} = $val;
@@ -103,13 +103,25 @@ sub handler {
                or dberror($r, "image enumeration");
 
        # Print the page itself
-       if ($fullscreen) {
+       if ($settings{'fullscreen'}) {
                $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("        \"" . $ref->{'filename'} . "\",\n");
                }
-               Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", { vhost => $r->get_server_name, event => $event, start => $settings{'start'} - 1 });
+
+               my %settings_no_fullscreen = %settings;
+               $settings_no_fullscreen{'fullscreen'} = 0;
+
+               my $returnurl = "http://" . $r->get_server_name . "/" . $event . "/" .
+                       Sesse::pr0n::Common::get_query_string(\%settings_no_fullscreen, \%defsettings);
+
+               Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
+                       vhost => $r->get_server_name,
+                       event => $event,
+                       start => $settings{'start'} - 1,
+                       returnurl => $returnurl
+               });
        } else {
                Sesse::pr0n::Common::header($r, "$name [$event]");
                Sesse::pr0n::Templates::print_template($r, "date", { date => $date });
index 487a01a1398827cfb86e1e49ecf567c962ff00df..1471074560ad6f355ea80fdbb14c2b8d27020d16 100644 (file)
@@ -26,6 +26,7 @@ sub handler {
                 $uri eq '/pr0n-fullscreen.js' ||
                 $uri eq '/previous.png' ||
                 $uri eq '/next.png' ||
+                $uri eq '/close.png' ||
                 $uri =~ m#^/usage/([a-zA-Z0-9_.]+)$#) {
                $uri =~ s#^/##;
                $r->content_type(Sesse::pr0n::Common::get_mimetype_from_filename($uri));
index 9aab84d9b252a063a2a3b6f7da166ee9d1658fed..390ffdcb7d4ce4ad6c2027384b32b8b0dc20dc97 100644 (file)
@@ -26,6 +26,13 @@ img {
        right: 0px;
        z-index: 1;
 }
+#close {
+       position: absolute;
+       top: 0px;
+       right: 0px;
+       z-index: 1;
+}
+
 #preload {
        position: absolute;
        left: -2000px;
index 31b51ec3d4470b4ff3c9ed5ff16fbd4290016ff4..4092ea235ac69f50e1072950e436f0d5118d94ca 100644 (file)
@@ -98,6 +98,7 @@ function relayout()
 
        set_opacity("previous", can_go_previous() ? 0.7 : 0.1);
        set_opacity("next", can_go_next() ? 0.7 : 0.1);
+       set_opacity("close", 0.7);
 }
 
 function set_opacity(id, amount)
@@ -204,6 +205,11 @@ function key_up(which) {
        }
 }
 
+function do_close()
+{
+       window.location = global_return_url;
+}
+
 // enable the horrible horrible IE PNG hack
 function ie_png_hack()
 {
index d49d733b518e5426d9474462ead90f5ccffaf81d..98df35c65c20287585f9db1e5d6ee16610a2bcd1 100644 (file)
@@ -1,6 +1,7 @@
 ];
 var global_vhost = "%VHOST%";
 var global_evt = "%EVENT%";
+var global_return_url = "%RETURNURL%";
 var global_image_num = %START%;
 //-->
     </script>
@@ -10,6 +11,7 @@ var global_image_num = %START%;
     <div class="container" id="main"></div>
     <img id="previous" src="/previous.png" alt="&lt;-" onmousedown="if (can_go_previous()) set_opacity('previous', 1.0)" onmouseup="if (can_go_previous()) { set_opacity('previous', 0.7); go_previous(); }" onmouseout="if (can_go_previous()) { set_opacity('previous', 0.7); }" />
     <img id="next" src="/next.png" alt="-&gt;" onmousedown="if (can_go_next()) set_opacity('next', 1.0)" onmouseup="if (can_go_next()) { set_opacity('next', 0.7); go_next(); }" onmouseout="if (can_go_next()) { set_opacity('next', 0.7); }" />
+    <img id="close" src="/close.png" alt="x" onmousedown="set_opacity('close', 1.0)" onmouseup="set_opacity('close', 0.7); do_close();" onmouseout="set_opacity('close', 0.7);" />
   </body>
 </html>