User:HashJona/common.js: Difference between revisions
From Growtopia Wiki
More actions
mNo edit summary |
mNo edit summary |
||
| Line 13: | Line 13: | ||
if (!value) continue; | if (!value) continue; | ||
const updatedValue = value.replace(/\/scale-to-width(?:-down)?\/\d+/g, '/scale-to-width-down/1200'); | const updatedValue = value.replace(/\/scale-to-width(?:-down)?\/\d+/g, '/scale-to-width-down/1200'); | ||
if (updatedValue !== value) this.setAttribute(a, | if (updatedValue !== value) this.setAttribute(a, updatedValue); | ||
} | } | ||
}); | }); | ||
}); | }); | ||
Revision as of 14:11, 1 September 2025
$(function() {
$("span.no-blank-target").each(function() {
$(this).closest("a").removeAttr("target");
});
});
mw.hook('wikipage.content').add(($content) => {
const slides = $content.find('.mainpage .gtw-slider .fandom-slider .gallerybox img');
slides.each(function () {
const attrs = ['src','srcset','data-src','data-srcset'];
for (const a of attrs) {
const value = this.getAttribute(a);
if (!value) continue;
const updatedValue = value.replace(/\/scale-to-width(?:-down)?\/\d+/g, '/scale-to-width-down/1200');
if (updatedValue !== value) this.setAttribute(a, updatedValue);
}
});
});