"മീഡിയവിക്കി:Common.js" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

No edit summary
No edit summary
 
(ഒരേ ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള 5 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല)
വരി 1: വരി 1:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');
/* ============================================================
/* ============================================================
   OpenStreetMap marker URL fix
   OpenStreetMap marker URL fix
   ============================================================ */
   ============================================================ */
mw.hook('wikipage.content').add(function () {
window.onload = function () {
     function replaceOSMMarkers(root) {
    var images = document.querySelectorAll('img');
         var images = root.querySelectorAll('img[src*="tile.openstreetmap.org/v4/marker/"]');
     for (var i = 0; i < images.length; i++) {
 
         var img = images[i];
         images.forEach(function (img) {
        if (
            img.src &&
            img.src.startsWith("https://tile.openstreetmap.org/v4/marker/")
         ) {
             img.src = img.src.replace(
             img.src = img.src.replace(
                 'https://tile.openstreetmap.org/v4/marker/',
                 'https://tile.openstreetmap.org/v4/marker/',
                 'https://maps.wikimedia.org/v4/marker/'
                 'https://maps.wikimedia.org/v4/marker/'
             );
             );
         });
         }
    }
};
 
};
    // Initial pass
    replaceOSMMarkers(document);
 
    // Watch for dynamically added images
    var observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
            mutation.addedNodes.forEach(function (node) {
                if (node.nodeType === 1) {
                    replaceOSMMarkers(node);
                }
            });
        });
    });
 
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
});
 


/* ============================================================
/* ============================================================
"https://schoolwiki.in/മീഡിയവിക്കി:Common.js" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്