1$(function(){ 2 3 var windowOpened = false; 4 var openWindow = function(event){ 5 6 var $this = $(this); 7 var picturePath = $this.data("path"); 8 9 if(picturePath){ 10 11 $("#appZoomWindow").remove(); 12 13 var $body = $("body"); 14 var $appWindow = $("<div />", {id: "appZoomWindow"}); 15 var $appZoomContainer = $("<div />", {class: "appZoomContainer"}); 16 var $appZoomContainerImage = $("<img />", {class: "appZoomContainerImage", src: picturePath}); 17 var $appZoomContainerExit = $("<a />", {class: "appZoomContainerExit", href: "#"}); 18 19 $appWindow.css({ 20 background: "rgba(0, 0, 0, 0.4)", 21 overflow: "auto", 22 position: "fixed", 23 height: "100%", 24 width: "100%", 25 zIndex: "40", 26 left: "0px", 27 top: "0px" 28 }); 29 30 $appZoomContainer.css({ 31 boxShadow: "1px 1px 12px rgba(60, 60, 60, 0.3)", 32 transform: "translateY(-50%) translateX(-50%)", 33 backgroundColor: "#ffffff", 34 display: "inline-block", 35 position: "absolute", 36 textAlign: "center", 37 padding: "24px", 38 left: "50%", 39 top: "50%", 40 }); 41 42 $appZoomContainerImage.css({ 43 verticalAlign: "middle", 44 maxHeight: "85vh", 45 maxWidth: "85vw", 46 }); 47 48 $appZoomContainer.append($appZoomContainerExit).addClass("loading"); 49 $appWindow.append($appZoomContainer) 50 51 if(picturePath){ 52 var newImage = new Image(); 53 newImage.src = picturePath; 54 $(newImage).one("load", function(){ 55 $appZoomContainer.append($appZoomContainerImage).removeClass("loading"); 56 }); 57 } 58 59 $body.append($appWindow).on("keyup.zoomer", function(event){ 60 if(event.keyCode == 27){ 61 $("#appZoomWindow").remove(); 62 $body.off("keyup.zoomer"); 63 windowOpened = false; 64 } 65 }); 66 67 windowOpened = true; 68 69 }else{ 70 console.error("picture path is empty"); 71 } 72 73 return event.preventDefault(); 74 75 }; 76 77 var closeWindow = function(event){ 78 79 if(windowOpened){ 80 $("#appZoomWindow").remove(); 81 windowOpened = false; 82 } 83 84 }; 85 86 $(document).on("click", ".oZoomer", openWindow); 87 $(document).on("click", ".appZoomContainerImage, .oZoomer", function(event){event.stopImmediatePropagation();}); 88 $(document).on("click", "html", closeWindow); 89 90});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.