MediaWiki:Common.js
From NoSQLZoo
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
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.39.0/";
linkScript(
"jshint-2.9.5-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);
});