MediaWiki:Common.js: Difference between revisions

From gDams Ngag mDzod
Jump to navigation Jump to search
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 1: Line 1:
mw.loader.load( 'https://use.fontawesome.com/bd289233d5.js' );
mw.loader.load( 'https://use.fontawesome.com/bd289233d5.js' );
// To change the site's favicon:
function change_favicon(img) {
    var favicon = document.querySelector('link[rel="shortcut icon"]');
   
    if (!favicon) {
        favicon = document.createElement('link');
        favicon.setAttribute('rel', 'shortcut icon');
        var head = document.querySelector('head');
        head.appendChild(favicon);
    }
   
   
    favicon.setAttribute('type', 'image/png');
    favicon.setAttribute('href', img);
}
change_favicon('/images/6/6b/Tsadra_Logo_Favicon_-_Jeremi.png');

Revision as of 16:46, 20 December 2017

mw.loader.load( 'https://use.fontawesome.com/bd289233d5.js' );

// To change the site's favicon:
function change_favicon(img) {
    var favicon = document.querySelector('link[rel="shortcut icon"]');
    
    if (!favicon) {
        favicon = document.createElement('link');
        favicon.setAttribute('rel', 'shortcut icon');
        var head = document.querySelector('head');
        head.appendChild(favicon);
    }
    
    
    favicon.setAttribute('type', 'image/png');
    favicon.setAttribute('href', img);
}
change_favicon('/images/6/6b/Tsadra_Logo_Favicon_-_Jeremi.png');