- var img = replace_image_element(url, element_id, main);
-
- if (global_infobox != 'nobox') {
- var url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/box/" + filename;
+ var preload = document.getElementById("preload");
+ var dpr = find_dpr();
+ var img;
+ // See if we have a preload going on that we can reuse.
+ if (element_id == "image" && preload !== null && preload.src == url) {
+ rename_element("preload_box", "image_box");
+ img = rename_element("preload", "image");
+ } else {
+ img = replace_image_element(url, element_id, main);
+ }
+ img.style.position = "absolute";
+ img.style.left = "0px";
+ img.style.top = "0px";
+ img.style.transformOrigin = "top left";
+ img.style.transform = "scale(" + (1.0 / dpr) + ")";
+
+ if (global_infobox != 'nobox/') {
+ 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;
+ }