Files
trpic/web/scripts/mess.js

27 lines
629 B
JavaScript

if (history.scrollRestoration) {
history.scrollRestoration = "manual";
}
document.addEventListener("error", (e) => {
let target = e.target;
const tagName = target.tagName || "";
const curTimes = Number(target.dataset.retryTimes) || 0;
if (tagName.toLowerCase() === "img") {
if (curTimes >= 5) {
target.alt = "loading failed";
} else {
setTimeout(() => {
target.dataset.retryTimes = curTimes + 1;
target.src = target.src;
}, 10000);
}
} else {
target = null;
}
}, true);
document.ondblclick = function (e) {
e.preventDefault();
};