]> git.sesse.net Git - pr0n/commitdiff
In fullscreen mode, crop the image div to the screen. This makes sure the
authorSteinar H. Gunderson <sesse@debian.org>
Sat, 25 Aug 2007 01:02:17 +0000 (03:02 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Sat, 25 Aug 2007 01:02:17 +0000 (03:02 +0200)
new "oversized"-image code doesn't make a div that is too high and allows
the user to scroll by accident.

files/pr0n-fullscreen.js

index 37fd67367cf1034c53ca9b58519745b0594b06c2..db9d434cb5b222e17cbb5ae06b328ee68bc11f2a 100644 (file)
@@ -221,6 +221,14 @@ function center_image(num)
                adjusted_size = pick_image_size(screen_size, [ global_image_list[num][2], global_image_list[num][3] ]);
        }
 
+       // crop the div to the screen
+       if (adjusted_size[0] > screen_size[0]) {
+               adjusted_size[0] = screen_size[0];
+       }
+       if (adjusted_size[1] > screen_size[1]) {
+               adjusted_size[1] = screen_size[1];
+       }
+
        // center the image on-screen
        var main = document.getElementById("main");
        main.style.position = "absolute";