Difference between revisions of "MediaWiki:Common.js"

From CRIU
Jump to navigation Jump to search
(created)
 
(rm as we have mw-collapsible now in 1.19)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
 
  
/** 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 );
 
        };
 
})();
 
 
// Import some more scripts
 
importScript('MediaWiki:Common.js/Collapsible.js');
 

Latest revision as of 17:04, 12 April 2013