MediaWiki:Common.js: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:


/* For Favicon  */
/* For Favicon  */
window.$ = window.jQuery;
jQuery("<link>", {
$("<link>", {
rel: "shortcut icon",
rel: "shortcut icon",
type: "image/x-icon",
type: "image/x-icon",
href: "https://linguifex.com/assets/Linguifex4v1.png"
href: "https://linguifex.com/assets/Linguifex4v1.png"
}).appendTo("head");
}).appendTo("head");

Revision as of 18:49, 16 September 2025

// Gadgets

//syntax highlighter
 mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript'); 

 
/** 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 );
        };
})();

/* For Favicon  */
jQuery("<link>", {
	rel: "shortcut icon",
	type: "image/x-icon",
	href: "https://linguifex.com/assets/Linguifex4v1.png"
}).appendTo("head");