Replace the link-background hack by a much neater one, inspired by
authorSteinar H. Gunderson <sesse@debian.org>
Wed, 28 Nov 2007 22:47:33 +0000 (23:47 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Wed, 28 Nov 2007 22:47:33 +0000 (23:47 +0100)
PicasaWeb's handling of the issue. No non-pr0n source code was harmed
(ie. read) during the production of this feature. :-)

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

index 8ea24bfbc384a096388de9dce8aae5f6c8fdd685..145dd9dc138ede207c3f328491561a18087a7c93 100644 (file)
@@ -14,9 +14,6 @@ body {
 img, #text {
        vertical-align: middle;
 }
-img {
-       z-index: 1;
-}
 
 #previous {
        position: absolute;
@@ -36,17 +33,6 @@ img {
        right: 0px;
        z-index: 2;
 }
-#linkbg1, #linkbg2, #linkbg3 {
-       display: block;
-       position: absolute;
-       top: 0px;
-       right: 0px;
-       width: 100%;
-       height: 100%;
-       background-color: black;
-}
-#linkbg2 { z-index: -1; }
-#linkbg3 { z-index: -1; }
 
 #preload {
        position: absolute;
index efacecc4364aec3c78b4a233a8ba2907f9ed174c..95829951dfc8f0cd530b58ef102c76d95fba32f1 100644 (file)
@@ -40,6 +40,20 @@ function find_width()
        return [null,null];
 }
 
+function parse_image_num(url, default_value) {
+       var url_array = (window.location.toString().split("#"));
+       if (url_array.length != 2) {
+               return default_value;
+       }
+
+       var num = parseInt(url_array[1]);
+       if (num > 1 && num <= global_image_list.length) {  // and then num != NaN
+               return (num - 1);
+       } else {
+               return default_value;
+       }
+}
+
 /*
  * pr0n can resize to any size we'd like, but we're much more likely
  * to have this set of fixed-resolution screens cached, so to increase
@@ -148,9 +162,9 @@ function display_image_num(num, element_id)
                // size of the image
                center_image(num);
                
-               document.getElementById('linkbg1').href = global_bookmark_url_base + (num+1);
-               document.getElementById('linkbg2').href = global_bookmark_url_base + (num+1);
-               document.getElementById('linkbg3').href = global_bookmark_url_base + (num+1);
+               // replace the anchor part (if any) with the image number
+               var baseurl = (window.location.toString().split("#"))[0];
+               window.location = baseurl + "#" + (num+1);
        }
 
        return img;
index 4a993b1d2d50badf5e02c6b6b37a50412a7c19fc..ec28b7288cd914b685439adedf2c878b4cf8884b 100644 (file)
@@ -213,26 +213,13 @@ sub handler {
                my $returnurl = "http://" . $r->get_server_name . "/" . $event . "/" .
                        Sesse::pr0n::Common::get_query_string(\%settings_no_fullscreen, \%defsettings);
                
-               my %settings_bookmark = %settings;
-               $settings_bookmark{'start'} = $defsettings{'start'};
-               my $bookmark_url_base = "http://" . $r->get_server_name . "/" . $event . "/" .
-                       Sesse::pr0n::Common::get_query_string(\%settings_bookmark, \%defsettings);
-
-               if ($bookmark_url_base =~ /\?/) {
-                       $bookmark_url_base .= ';start=';
-               } else {
-                       $bookmark_url_base .= '?start=';
-               }
-
                # *whistle*
                $returnurl =~ s/&amp;/&/g;
-               $bookmark_url_base =~ s/&amp;/&/g;
 
                Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
                        vhost => $r->get_server_name,
-                       start => $settings{'start'} - 1,
                        returnurl => $returnurl,
-                       bookmarkurlbase => $bookmark_url_base,
+                       start => $settings{'start'} - 1,
                        sel => $settings{'sel'},
                        infobox => $infobox
                });
index 04ed5c1c9ea9739abe986950a5c8bcc334357bbf..f4430855791f64e924ebfea9febb7315ce05b1b0 100644 (file)
@@ -2,17 +2,14 @@
 var global_vhost = "%VHOST%";
 var global_infobox = "%INFOBOX%";
 var global_return_url = "%RETURNURL%";
-var global_bookmark_url_base = "%BOOKMARKURLBASE%";
-var global_image_num = %START%;
+var global_image_num = parse_image_num(window.location, %START%);
 var global_select = %SEL%;
 // end generated
     </script>
-    <script type="text/JavaScript" src="/pr0n-fullscreen.js"></script>
   </head>
   <body onresize="relayout();" onload="init_ajax(); relayout();" onkeydown="key_down(event.keyCode);" onkeyup="key_up(event.keyCode);">
     <div>
-      <a id="linkbg1"></a>
-      <div class="container" id="main"><a id="linkbg2"></a><div id="iehack"><a id="linkbg3"></a></div></div>
+      <div class="container" id="main"><div id="iehack"></div></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);" />
index 0a77d72f21086383da23731137a18666636c9f1d..680f841272a6c06f4f5339bb7b19ddfa401aaaae 100644 (file)
@@ -8,6 +8,7 @@
     <!--[if IE]>
     <link rel="stylesheet" href="/pr0n-fullscreen-ie.css" type="text/css" />
     <![endif]-->
+    <script type="text/JavaScript" src="/pr0n-fullscreen.js"></script>
     <script type="text/JavaScript">
 // the following code snippet is generated by the server
 var global_image_list = [