MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* Auto updating recent changes opt-in. See w:c:dev:AjaxRC for info & attribution */ AjaxRCRefreshText = 'Auto-Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = [ "Special:RecentChanges", "Special:WikiActivity", "Special:UncategorizedPages", "Special:AllPages", "Special:NewFiles" ];

/* Start --- importArticles coding */ importArticles({   type: 'script',    articles: [        'u:dev:AjaxRC/code.js',        'u:dev:DisplayClock/code.js', /* Wikia Clock */        'u:dev:DISPLAYTITLE/code.js',        'u:dev:ReferencePopups/code.js', /* Reference Pop-up tag */        'u:dev:Toggler.js'    ] }); /* End --- importArticles coding */

/* Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: User:Mike Dillon, User:R. Koot, User:SG */ var hasClass = (function {    var reCache = {};    return function (element, className) {        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);   }; });

function getElementsByClass (node, className, tagName) { if (node.getElementsByClassName && (tagName == undefined || tagName == null || tagName == '*')) return node.getElementsByClassName(className); var list = node.getElementsByTagName(tagName?tagName:'*'); var array = new Array; var i = 0; for (i in list) { if (hasClass(list[i], className)) array.push(list[i]); }	return array; } /* Creates the method getElementsByClass, if unsupported from the browser */ if(!document.getElementsByClass) document.getElementsByClass = function(className) { return getElementsByClass(document, className, '*'); }; function getElementsByName (name, root) { if (root == undefined) root = document; var e = root.getElementsByTagName('*'); var r = new Array; for (var i = 0; i < e.length; i++) { if (e[i].getAttribute('name') == name) r[r.length] = e[i]; }   return r; }