Difference between revisions of "MediaWiki:Common.js"

(wikiEditor initialization removed)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
jQuery.getScript('('#free_text').wikiEditor;
+
// Ensure everything loads properly
 
+
mw.loader.using(['jquery.ui'], function() {
document.addEventListener('DOMContentLoaded', function() {
+
  $.getScript('//cmp.osano.com/Azyw1RRk4ZCOx2wli/04c9aa84-7b4a-45a8-bb7e-3b3767dd3378/osano.js', function() {
    console.log("Script running...");
+
    console.log("Osano script loaded.");
    var links = document.querySelectorAll('a[href*="https://ntldstats.com/tld/"]');
+
  });
    console.log("Links found: ", links.length);
 
    links.forEach(function(link) {
 
        console.log("Original href: ", link.href);
 
        var url = new URL(link.href);
 
        var paths = url.pathname.split('/');
 
        var lastSegment = paths[paths.length - 1];
 
        if (lastSegment.startsWith('.')) {
 
            lastSegment = lastSegment.substring(1); // Remove the leading dot
 
            paths[paths.length - 1] = lastSegment;
 
            url.pathname = paths.join('/');
 
            link.href = url.toString();
 
            console.log("Modified href: ", link.href);
 
        }
 
    });
 
 
});
 
});

Latest revision as of 01:24, 30 August 2024

// Ensure everything loads properly
mw.loader.using(['jquery.ui'], function() {
  $.getScript('//cmp.osano.com/Azyw1RRk4ZCOx2wli/04c9aa84-7b4a-45a8-bb7e-3b3767dd3378/osano.js', function() {
    console.log("Osano script loaded.");
  });
});