X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=pr0n-fullscreen.js;h=468f249c0c6c780b30c87eed132d5923f8ec8968;hb=dbef44dee55e1aebc0a1ee9bc88e9a7466b43633;hp=f087a8f185f8f953cd7f8cb935f6da4b272e41c8;hpb=84b16cfb3e4428c4b07dddd8e4c5aa1f2aa1b6d7;p=pr0n diff --git a/pr0n-fullscreen.js b/pr0n-fullscreen.js index f087a8f..468f249 100644 --- a/pr0n-fullscreen.js +++ b/pr0n-fullscreen.js @@ -5,12 +5,12 @@ function find_width() return [window.innerWidth, window.innerHeight]; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { // IE 6+ in 'standards compliant mode' - return [document.documentElement.clientWidth, document.documentElement.clientHeight - 42]; + return [document.documentElement.clientWidth, document.documentElement.clientHeight]; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { // IE 4-compatible return [document.body.clientWidth, document.body.clientHeight]; } - return (null,null); + return [null,null]; } /* @@ -70,8 +70,11 @@ function prepare_preload(img, width, height, evt, filename) preload.parentNode.removeChild(preload); } -// img.onload = function() { display_image(width, height, evt, filename, "preload"); } - img.onload = "display_image(" + width + "," + height + ",\"" + evt + "\",\"" + filename + "\",\"preload\");"; + if (document.all) { // IE-specific + img.onload = "display_image(" + width + "," + height + ",\"" + evt + "\",\"" + filename + "\",\"preload\");"; + } else { + img.onload = function() { display_image(width, height, evt, filename, "preload"); } + } } function relayout() @@ -92,12 +95,10 @@ function relayout() main.style.width = adjusted_size[0] + "px"; main.style.height = adjusted_size[1] + "px"; main.style.lineHeight = adjusted_size[1] + "px"; - if (document.all) { // IE-specific - main.style.fontSize = adjusted_size[1] + "px"; - } 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) @@ -187,6 +188,8 @@ function key_down(which) if (can_go_previous()) { set_opacity("previous", 0.99); } + } else if (which == 27) { // escape + set_opacity("close", 0.99); } } @@ -201,9 +204,17 @@ function key_up(which) { set_opacity("previous", 0.7); go_previous(); } + } else if (which == 27) { // escape + set_opacity("close", 0.7); + do_close(); } } +function do_close() +{ + window.location = global_return_url; +} + // enable the horrible horrible IE PNG hack function ie_png_hack() {