]> git.sesse.net Git - pr0n/blobdiff - files/pr0n-fullscreen.js
Remove the unused icon.
[pr0n] / files / pr0n-fullscreen.js
index 79c174b72c35f36c0918bc8a0ec1f073c56f6c5b..d4af19f1d1397978ad94c859f398f7bfdfc12e82 100644 (file)
@@ -151,7 +151,7 @@ function rename_element(old_name, new_name)
 
 function display_image(width, height, evt, filename, element_id)
 {
-       var url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/nobox/" + filename;
+       var url = window.location.origin + "/" + evt + "/" + width + "x" + height + "/nobox/" + filename;
        var main = document.getElementById("iehack");
        var preload = document.getElementById("preload");
        var dpr = find_dpr();
@@ -169,21 +169,20 @@ function display_image(width, height, evt, filename, element_id)
        img.style.transformOrigin = "top left";
        img.style.transform = "scale(" + (1.0 / dpr) + ")";
 
-       if (global_infobox != 'nobox/') {
-               var url;
-               if (dpr == 1) {
-                       url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/box/" + filename;
-               } else {
-                       url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "@" + dpr + "/box/" + filename;
-               }
-               var boximg = replace_image_element(url, element_id + "_box", main);
-
-               boximg.style.position = "absolute";
-               boximg.style.left = "0px";
-               boximg.style.bottom = "-1px";
-               boximg.style.transformOrigin = "bottom left";
-               boximg.style.transform = "scale(" + (1.0 / dpr) + ")";
+       // Infobox.
+       var url;
+       if (dpr == 1) {
+               url = window.location.origin + "/" + evt + "/" + width + "x" + height + "/box/" + filename;
+       } else {
+               url = window.location.origin + "/" + evt + "/" + width + "x" + height + "@" + dpr.toFixed(2) + "/box/" + filename;
        }
+       var boximg = replace_image_element(url, element_id + "_box", main);
+
+       boximg.style.position = "absolute";
+       boximg.style.left = "0px";
+       boximg.style.bottom = "-1px";
+       boximg.style.transformOrigin = "bottom left";
+       boximg.style.transform = "scale(" + (1.0 / dpr) + ")";
 
        return img;
 }
@@ -409,7 +408,7 @@ function select_image(evt, filename, selected)
                draw_text("Unselecting " + filename + "...");
        }
        
-       req.open("POST", "http://" + global_vhost + "/select", false);
+       req.open("POST", window.location.origin + "/select", false);
        req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        req.send("event=" + evt + "&filename=" + filename + "&selected=" + selected);