Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:HashJona/common.js: Difference between revisions

From Growtopia Wiki
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, updated);
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);
		}
	});
});