1console.log("WZ zoom 1.2123"); 2 3function imageZoom(imgID, resultID, lensID) { 4 var img, lens, result, cx, cy; 5 img = document.getElementById(imgID); 6 result = document.getElementById(resultID); 7 lens = document.getElementById(lensID); 8 9 scaler = 1.5; 10 /* Calculate the ratio between result DIV and lens: */ 11 cx = result.offsetWidth / lens.offsetWidth; 12 cy = result.offsetHeight / lens.offsetHeight; 13 /* Set background properties for the result DIV */ 14 result.style.backgroundImage = "url('" + img.src + "')"; 15 result.style.backgroundSize = (img.width * cx) + "px " + (img.height * cy) + "px"; 16 /* Execute a function when someone moves the cursor over the image, or the lens: */ 17 lens.addEventListener("mousemove", moveLens); 18 img.addEventListener("mousemove", moveLens); 19 /* And also for touch screens: */ 20 lens.addEventListener("touchmove", moveLens); 21 img.addEventListener("touchmove", moveLens); 22 function moveLens(e) { 23 var pos, x, y; 24 /* Prevent any other actions that may occur when moving over the image */ 25 e.preventDefault(); 26 /* Get the cursor's x and y positions: */ 27 pos = getCursorPos(e); 28 /* Calculate the position of the lens: */ 29 x = pos.x - (lens.offsetWidth / 2); 30 y = pos.y - (lens.offsetHeight / 2); 31 /* Prevent the lens from being positioned outside the image: */ 32 if (x > img.width - lens.offsetWidth) {x = img.width - lens.offsetWidth;} 33 if (x < 0) {x = 0;} 34 if (y > img.height - lens.offsetHeight) {y = img.height - lens.offsetHeight;} 35 if (y < 0) {y = 0;} 36 /* Set the position of the lens: */ 37 lens.style.left = x + "px"; 38 lens.style.top = y + "px"; 39 /* Display what the lens "sees": */ 40 console.log((x) + ":" + (y) + " " + cx + ":" + cy); 41 result.style.backgroundPosition = "-" + (x) + "px -" + (y) + "px"; 42 } 43 function getCursorPos(e) { 44 var a, x = 0, y = 0; 45 e = e || window.event; 46 /* Get the x and y positions of the image: */ 47 a = img.getBoundingClientRect(); 48 /* Calculate the cursor's x and y coordinates, relative to the image: */ 49 x = e.pageX - a.left; 50 y = e.pageY - a.top; 51 /* Consider any page scrolling: */ 52 x = x - window.pageXOffset; 53 y = y - window.pageYOffset; 54 return {x : x, y : y}; 55 } 56}
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.