Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

Difference between revisions of "MediaWiki:Common.js"

From NoSQLZoo
Jump to: navigation, search
m (test)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
+
function linkScript() {
function linkScript(){
+
    /* poor man's autoloader */
 
     "use strict";
 
     "use strict";
     const args = Array.prototype.slice.call(arguments, 0);
+
     Array.prototype.slice.call(arguments, 0).forEach(function (a) {
    args.forEach(function(a){
 
 
         var x = document.createElement("script");
 
         var x = document.createElement("script");
 
         x.async = false;
 
         x.async = false;
Line 14: Line 13:
 
     "use strict";
 
     "use strict";
 
     //CodeMirror.
 
     //CodeMirror.
     var cmVersion = "codemirror-5.39.0/";
+
     var cmVersion = "codemirror-5.49.2/";
 
     linkScript(
 
     linkScript(
         "jshint-2.9.5-min",
+
         "jshint-2.10.2-min",
 
         cmVersion + "lib/codemirror",
 
         cmVersion + "lib/codemirror",
 
         cmVersion + "mode/javascript/javascript",
 
         cmVersion + "mode/javascript/javascript",
Line 26: Line 25:
 
         cmVersion + "addon/fold/foldcode",
 
         cmVersion + "addon/fold/foldcode",
 
         cmVersion + "addon/fold/foldgutter",
 
         cmVersion + "addon/fold/foldgutter",
         cmVersion + "addon/fold/brace-fold",      
+
         cmVersion + "addon/fold/brace-fold",
 
         cmVersion + "addon/hint/show-hint",
 
         cmVersion + "addon/hint/show-hint",
 
         cmVersion + "addon/lint/lint",
 
         cmVersion + "addon/lint/lint",
Line 36: Line 35:
 
     //Question-related scripts.
 
     //Question-related scripts.
 
     linkScript("nosqlzoo", "beautify", "validator");
 
     linkScript("nosqlzoo", "beautify", "validator");
   
 
 
  
 
     //Google Analytics
 
     //Google Analytics
 
     var tag_manager = document.createElement("script");
 
     var tag_manager = document.createElement("script");
 
     tag_manager.async = true;
 
     tag_manager.async = true;
     tag_manager.src = "https://www.googletagmanager.com/gtag/js?id=UA-120387375-1";  
+
     tag_manager.src = "https://www.googletagmanager.com/gtag/js?id=UA-120387375-1";
 
     document.head.appendChild(tag_manager);
 
     document.head.appendChild(tag_manager);
  
 
     var google = document.createElement("script");
 
     var google = document.createElement("script");
     google.src = "/mw/scripts/google.js";
+
     google.src = "/mw/scripts/google.js";
 
     document.head.appendChild(google);
 
     document.head.appendChild(google);
 
});
 
 
/*
 
Tweek the Log in scheme
 
* */
 
$(function() {
 
    "use strict";
 
    $("#mw-user-domain-section").hide();
 
    $("#wpRemember").attr("checked", true);
 
 
});
 
});

Latest revision as of 15:23, 25 October 2020

function linkScript() {
    /* poor man's autoloader */
    "use strict";
    Array.prototype.slice.call(arguments, 0).forEach(function (a) {
        var x = document.createElement("script");
        x.async = false;
        x.src = "/mw/scripts/" + a + ".js";
        document.head.appendChild(x);
    });
}

$(function () {
    "use strict";
    //CodeMirror.
    var cmVersion = "codemirror-5.49.2/";
    linkScript(
        "jshint-2.10.2-min",
        cmVersion + "lib/codemirror",
        cmVersion + "mode/javascript/javascript",
        cmVersion + "mode/cypher/cypher",
        cmVersion + "addon/display/fullscreen",
        cmVersion + "addon/display/rulers",
        cmVersion + "addon/edit/closebrackets",
        cmVersion + "addon/edit/matchbrackets",
        cmVersion + "addon/fold/foldcode",
        cmVersion + "addon/fold/foldgutter",
        cmVersion + "addon/fold/brace-fold",
        cmVersion + "addon/hint/show-hint",
        cmVersion + "addon/lint/lint",
        cmVersion + "addon/lint/javascript-lint",
        cmVersion + "addon/lint/json-lint",
        cmVersion + "addon/edit/trailingspace"
    );

    //Question-related scripts.
    linkScript("nosqlzoo", "beautify", "validator");

    //Google Analytics
    var tag_manager = document.createElement("script");
    tag_manager.async = true;
    tag_manager.src = "https://www.googletagmanager.com/gtag/js?id=UA-120387375-1";
    document.head.appendChild(tag_manager);

    var google = document.createElement("script");
    google.src = "/mw/scripts/google.js";
    document.head.appendChild(google);
});