|
|
|
@@ -84,8 +84,8 @@ String.prototype.hasPrefix = function (prefix) { |
|
|
|
function imageFocusSetup() { |
|
|
|
if (typeof GW.imageFocus == "undefined") |
|
|
|
GW.imageFocus = { |
|
|
|
contentImagesSelector: "article img, .gallery img", |
|
|
|
focusedImageSelector: "article img.focused, .gallery img.focused", |
|
|
|
contentImagesSelector: ".gallery img", |
|
|
|
focusedImageSelector: ".gallery img.focused", |
|
|
|
shrinkRatio: 0.975, |
|
|
|
hideUITimerDuration: 1500, |
|
|
|
hideUITimerExpired: () => { |
|
|
|
@@ -118,16 +118,13 @@ function imageFocusSetup() { |
|
|
|
image.addEventListener("click", GW.imageClickedToFocus); |
|
|
|
}); |
|
|
|
|
|
|
|
// Wrap all images in a span. |
|
|
|
// Add image wrapper class. |
|
|
|
document.querySelectorAll(GW.imageFocus.contentImagesSelector).forEach(image => { |
|
|
|
let wrapper = document.createElement("span"); |
|
|
|
wrapper.classList.add("image-wrapper", "img"); |
|
|
|
image.parentElement.insertBefore(wrapper, image); |
|
|
|
wrapper.appendChild(image); |
|
|
|
wrapper.classList.add(...image.classList); |
|
|
|
image.classList.remove(...image.classList); |
|
|
|
}); |
|
|
|
|
|
|
|
let wrapper = image.closest(".img"); |
|
|
|
if (wrapper) |
|
|
|
wrapper.classList.add("image-wrapper"); |
|
|
|
}); |
|
|
|
|
|
|
|
// Create the image focus overlay. |
|
|
|
let imageFocusOverlay = addUIElement("<div id='image-focus-overlay'>" + |
|
|
|
`<div class='help-overlay'> |
|
|
|
@@ -603,10 +600,3 @@ function focusImageSpecifiedByURL() { |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/******************/ |
|
|
|
/* INITIALIZATION */ |
|
|
|
/******************/ |
|
|
|
|
|
|
|
imageFocusSetup(); |
|
|
|
focusImageSpecifiedByURL(); |