mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
FIX: Support pausing inline animated images (#13033)
This commit is contained in:
parent
f9bb6399e0
commit
b0d66b4b2f
@ -20,8 +20,10 @@ function _pauseAnimation(img, opts = {}) {
|
||||
}
|
||||
|
||||
function _resumeAnimation(img) {
|
||||
img.previousSibling.remove();
|
||||
img.parentNode.classList.remove("paused-animated-image", "manually-paused");
|
||||
if (img.previousSibling && img.previousSibling.nodeName === "CANVAS") {
|
||||
img.previousSibling.remove();
|
||||
}
|
||||
img.parentNode.classList.remove("paused-animated-image");
|
||||
}
|
||||
|
||||
function animatedImgs() {
|
||||
@ -83,13 +85,18 @@ export default {
|
||||
img.addEventListener("load", _handleEvent, false);
|
||||
}
|
||||
|
||||
img.parentNode.classList.add("pausable-animated-image");
|
||||
const overlay = document.createElement("div");
|
||||
const wrapper = document.createElement("div"),
|
||||
overlay = document.createElement("div");
|
||||
|
||||
img.parentNode.insertBefore(wrapper, img);
|
||||
wrapper.classList.add("pausable-animated-image");
|
||||
wrapper.appendChild(img);
|
||||
|
||||
overlay.classList.add("animated-image-overlay");
|
||||
overlay.setAttribute("aria-hidden", "true");
|
||||
overlay.setAttribute("role", "presentation");
|
||||
overlay.innerHTML = `${iconHTML("pause")}${iconHTML("play")}`;
|
||||
img.parentNode.appendChild(overlay);
|
||||
wrapper.appendChild(overlay);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user