Jump to content
സഹായം

ಪ್ರವೇಶಿಸಿರಿ (ಸಹಾಯ)
உள்ளேற (உதவி)

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

1,344 ബൈറ്റുകൾ നീക്കംചെയ്തിരിക്കുന്നു ,  7 ജനുവരി
(ചെ.)
തിരുത്തലിനു സംഗ്രഹമില്ല
(ചെ.)No edit summary
(ചെ.)No edit summary
വരി 3: വരി 3:


document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function () {
     // Function to replace the marker URL
     // Find all images in the leaflet-marker-pane class and replace their src
    function replaceMarkerIcons() {
    const images = document.querySelectorAll('.leaflet-marker-pane img');
        // Select all img elements in the leaflet-marker-pane
    images.forEach(function (img) {
        const markerIcons = document.querySelectorAll('.leaflet-marker-pane img');
         img.src = "https://schoolwiki.in/extensions/Kartographer/lib/external/mapbox/images/marker-icon-2x.png";
        markerIcons.forEach(function (img) {
            if (img.src.includes("https://tile.openstreetmap.org/v4/marker/pin-m+7e7e7e@2x.png")) {
                img.src = "https://schoolwiki.in/extensions/Kartographer/lib/external/mapbox/images/marker-icon-2x.png";
            }
         });
    }
 
    // Initial replacement on page load
    replaceMarkerIcons();
 
    // MutationObserver to catch dynamically added markers
    const observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
            mutation.addedNodes.forEach(function (node) {
                // If a new img is added, check if it matches the target URL
                if (node.nodeType === 1 && node.matches && node.matches('.leaflet-marker-pane img')) {
                    if (node.src.includes("https://tile.openstreetmap.org/v4/marker/pin-m+7e7e7e@2x.png")) {
                        node.src = "https://schoolwiki.in/extensions/Kartographer/lib/external/mapbox/images/marker-icon-2x.png";
                    }
                }
            });
        });
     });
     });
    // Start observing the leaflet container for changes
    const mapContainer = document.querySelector('.leaflet-container');
    if (mapContainer) {
        observer.observe(mapContainer, {
            childList: true,
            subtree: true
        });
    } else {
        console.error("Leaflet map container not found.");
    }
});
});


"https://schoolwiki.in/പ്രത്യേകം:മൊബൈൽവ്യത്യാസം/2624652" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്