+ 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) + ")";
+
+ // Update the "download original" link.
+ var original_url = window.location.origin + "/" + evt + "/original/" + filename;
+ document.getElementById("origdownload").href = original_url;
+
+ if (global_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) + ")";
+ } else {
+ var boximg = document.getElementById(element_id + "_box");
+ if (boximg !== null) {
+ boximg.parentNode.removeChild(boximg);
+ }
+ }