X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=files%2Fpr0n-fullscreen.js;h=181a82cb1e0745bde78677c7c02ca5ab16b6c74f;hb=a47ee01cd25f9917b6d8527d933c002f4bcd47ad;hp=1e2e8f0eec1615d8e6fe22716fd86c95bb82ee74;hpb=0737361d60ab3c2be28045ac522ce19722d2ffaf;p=pr0n
diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js
index 1e2e8f0..181a82c 100644
--- a/files/pr0n-fullscreen.js
+++ b/files/pr0n-fullscreen.js
@@ -70,7 +70,7 @@ function display_image(width, height, evt, filename, element_id)
var url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/" + filename;
var img = document.getElementById(element_id);
if (img != null) {
- img.src = "";
+ img.src = "data:";
img.parentNode.removeChild(img);
}
@@ -82,7 +82,7 @@ function display_image(width, height, evt, filename, element_id)
img.src = url;
}
- var main = document.getElementById("main");
+ var main = document.getElementById("iehack");
main.appendChild(img);
return img;
@@ -93,15 +93,17 @@ function prepare_preload(img, width, height, evt, filename)
// cancel any pending preload
var preload = document.getElementById("preload");
if (preload != null) {
- preload.src = "";
+ preload.src = "data:";
preload.parentNode.removeChild(preload);
}
-
- if (document.all) { // IE-specific
- img.onload = "display_image(" + width + "," + height + ",\"" + evt + "\",\"" + filename + "\",\"preload\");";
+
+ // grmf -- IE doesn't fire onload if the image was loaded from cache, so check for
+ // completeness first; should at least be _somewhat_ better
+ if (img.complete) {
+ display_image(width, height, evt, filename, "preload");
} else {
- img.onload = function() { display_image(width, height, evt, filename, "preload"); }
- }
+ img.onload = function() { display_image(width, height, evt, filename, "preload"); };
+ }
}
function relayout()
@@ -144,8 +146,13 @@ function set_opacity(id, amount)
elem.style.filter = "";
}
elem.style.filter += "alpha(opacity=" + (amount*100.0) + ")";
- } else {
- elem.filters.alpha.opacity = (amount * 100.0);
+ } else {
+ // ugh? this seems to break in color index mode...
+ if (typeof(elem.filters) == 'unknown') {
+ elem.style.filter = "alpha(opacity=" + (amount*100.0) + ")";
+ } else {
+ elem.filters.alpha.opacity = (amount * 100.0);
+ }
}
} else { // no alpha support
if (amount > 0.5) {
@@ -234,7 +241,7 @@ function key_up(which) {
} else if (which == 27) { // escape
set_opacity("close", 0.7);
do_close();
- } else if (which == 32) { // space
+ } else if (which == 32 && global_select) { // space
select_image(global_image_list[global_image_num]);
}
}
@@ -308,5 +315,8 @@ function ie_png_hack()
var previous = document.getElementById("previous");
previous.outerHTML = "";
+
+ var close = document.getElementById("close");
+ close.outerHTML = "";
}
}