Jump to content

MediaWiki:Common.js: Difference between revisions

From OnTrackWorld
Created page with "Any JavaScript here will be loaded for all users on every page load.: mw.hook('wikipage.maps').add(function () { mw.util.addCSS('.leaflet-marker-icon { margin-left: initial !important; margin-top: initial !important; width: auto !important; height: auto !important; }'); new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { if (mutation.addedNodes.length) { mutation.addedNodes[0].src = "https://openlayers.org/api/img/marker.pn..."
 
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.maps').add(function () {
mw.hook('wikipage.maps').add(function () {
mw.util.addCSS('.leaflet-marker-icon { margin-left: initial !important; margin-top: initial !important; width: auto !important; height: auto !important; }');
mw.util.addCSS('.leaflet-marker-icon { margin-left:-16 !important; margin-top:-16 !important; width: 32px !important; height: 32px !important; clip-path: none !important}');
new MutationObserver(function (mutations) {
new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
mutations.forEach(function (mutation) {
if (mutation.addedNodes.length) {
if (mutation.addedNodes.length) {
mutation.addedNodes[0].src = "https://openlayers.org/api/img/marker.png";
mutation.addedNodes[0].src = "https://ontrackworld.com/w/images/8/8f/Marker.png";
}
}
});
});

Latest revision as of 19:46, 23 July 2026

/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.maps').add(function () {
	mw.util.addCSS('.leaflet-marker-icon { margin-left:-16 !important; margin-top:-16 !important; width: 32px !important; height: 32px !important; clip-path: none !important}');
	new MutationObserver(function (mutations) {
		mutations.forEach(function (mutation) {
			if (mutation.addedNodes.length) {
				mutation.addedNodes[0].src = "https://ontrackworld.com/w/images/8/8f/Marker.png";
			}
		});
	}).observe($('.leaflet-marker-pane').get(0), {
		childList: true,
	});
});