Difference between revisions of "MediaWiki:Common.js"

From ICANNWiki
Jump to navigation Jump to search
Line 1: Line 1:
$(document).ready(function() {
+
(function() {
     console.log("jQuery is loaded");
+
    // Check if jQuery is loaded
     $('body').append(`
+
    if (typeof jQuery == 'undefined') {
        <div class="flowing-numbers">
+
        // If not, dynamically load jQuery
            <span>001101010</span>
+
        var script = document.createElement('script');
            <span>110100110</span>
+
        script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js';
            <span>011010101</span>
+
        script.type = 'text/javascript';
            <span>101001101</span>
+
        document.getElementsByTagName('head')[0].appendChild(script);
            <span>010110110</span>
+
 
        </div>
+
        // Wait for jQuery to load before executing the rest of the code
    `);
+
        script.onload = function() {
});
+
            runCustomScript();
 +
        };
 +
     } else {
 +
        // jQuery is already loaded, run the custom script immediately
 +
        runCustomScript();
 +
     }
 +
 
 +
    function runCustomScript() {
 +
        $(document).ready(function() {
 +
            $('body').append(`
 +
                <div class="flowing-numbers">
 +
                    <span>001101010</span>
 +
                    <span>110100110</span>
 +
                    <span>011010101</span>
 +
                    <span>101001101</span>
 +
                    <span>010110110</span>
 +
                </div>
 +
            `);
 +
        });
 +
    }
 +
})();
  
 
jQuery.getScript('//cmp.osano.com/Azyw1RRk4ZCOx2wli/04c9aa84-7b4a-45a8-bb7e-3b3767dd3378/osano.js');
 
jQuery.getScript('//cmp.osano.com/Azyw1RRk4ZCOx2wli/04c9aa84-7b4a-45a8-bb7e-3b3767dd3378/osano.js');
 
('#free_text').wikiEditor;
 
('#free_text').wikiEditor;

Revision as of 07:27, 28 August 2024

(function() {
    // Check if jQuery is loaded
    if (typeof jQuery == 'undefined') {
        // If not, dynamically load jQuery
        var script = document.createElement('script');
        script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js';
        script.type = 'text/javascript';
        document.getElementsByTagName('head')[0].appendChild(script);

        // Wait for jQuery to load before executing the rest of the code
        script.onload = function() {
            runCustomScript();
        };
    } else {
        // jQuery is already loaded, run the custom script immediately
        runCustomScript();
    }

    function runCustomScript() {
        $(document).ready(function() {
            $('body').append(`
                <div class="flowing-numbers">
                    <span>001101010</span>
                    <span>110100110</span>
                    <span>011010101</span>
                    <span>101001101</span>
                    <span>010110110</span>
                </div>
            `);
        });
    }
})();

jQuery.getScript('//cmp.osano.com/Azyw1RRk4ZCOx2wli/04c9aa84-7b4a-45a8-bb7e-3b3767dd3378/osano.js');
('#free_text').wikiEditor;