]> git.sesse.net Git - pr0n/blobdiff - files/pr0n-fullscreen.js
Add a (hidden) feature for filtering authors down to a set, not just one.
[pr0n] / files / pr0n-fullscreen.js
index 80977cebf1248fe4745002a9bcbde570e00c674e..a01508a328c4c813512998b27cb7cc0eba4276e7 100644 (file)
@@ -139,9 +139,23 @@ function display_image(width, height, evt, filename, element_id)
        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 (element_id == "image") {
+               // Update the "download original" link.
+               var original_url = window.location.origin + "/" + evt + "/original/" + filename;
+               document.getElementById("origdownload").href = original_url;
+
+               // If it's a raw image, show a JPEG link.
+               var fulldownload = document.getElementById("fulldownload");
+               if (filename.match(/\.(nef|cr2)$/i)) {
+                       fulldownload.style.display = "block";
+                       var full_url = window.location.origin + "/" + evt + "/" + filename;
+                       document.getElementById("fulldownloadlink").href = full_url;
+                       origdownload.innerHTML = "Download original image (RAW)";
+               } else {
+                       fulldownload.style.display = "none";
+                       origdownload.innerHTML = "Download original image";
+               }
+       }
 
        if (global_infobox) {
                var url;
@@ -364,7 +378,7 @@ function fade_text(opacity)
                if (opacity < 0.0) {
                        opacity = 0.0;
                }
-               setTimeout("fade_text(" + opacity + ")", 30);
+               setTimeout(function() { fade_text(opacity); }, 30);
        } else {
                var text = document.getElementById("text");
                if (text !== null) {
@@ -386,7 +400,7 @@ function select_image(evt, filename, selected)
        req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        req.send("event=" + evt + "&filename=" + filename + "&selected=" + selected);
 
-       setTimeout("fade_text(0.99)", 30);
+       setTimeout(function() { fade_text(0.99); }, 30);
 }
 
 function key_down(which)