MediaWiki:Vector.js: Difference between revisions
No edit summary |
(test loading from jsdelivr for faster loading) |
||
Line 6: | Line 6: | ||
function () { | function () { | ||
console.log("Custom CSS Styling loaded!") | console.log("Custom CSS Styling loaded!") | ||
mw.loader.load( '/index.php?title=MediaWiki:DarkReader.js&action=raw&ctype=text/javascript' ) // -> Now load DarkReader to refine our custom dark css styling | // mw.loader.load( '/index.php?title=MediaWiki:DarkReader.js&action=raw&ctype=text/javascript' ) // -> Now load DarkReader to refine our custom dark css styling | ||
mw.loader.getScript('https://cdn.jsdelivr.net/npm/darkreader@4/darkreader.min.js').then( | |||
function () { | |||
DarkReader.setFetchMethod(window.fetch); | |||
DarkReader.enable({ | |||
}, { | |||
ignoreInlineStyle: ['.mediaContainer', '.mediaContainer *', '.TemplateRevision', '.TemplateRevision *', '#homeButtonNav', '#homeButtonNav *', '.mw-wiki-logo', 'img', '#siteNotice *', '.sitenoticestyling'], | |||
css: ` | |||
.sitenoticestyling { | |||
border-color: rgb(48, 52, 54) !important; | |||
border: 2px solid rgb(48, 52, 54) !important; | |||
} | |||
`, | |||
ignoreImageAnalysis: [".mw-wiki-logo", "img"], | |||
invert: [] | |||
}); | |||
console.log("Darkreader Enabled!"); | |||
}, function( e ) { | |||
mw.log.error( e.message ); // => "Failed to load script" | |||
}) | |||
}, | }, | ||
function ( e ) { | function ( e ) { |
Revision as of 21:37, 19 November 2022
/* All JavaScript here will be loaded for users of the Vector skin */ // Load Scripts mw.loader.getScript( '/index.php?title=MediaWiki:Dark.css&action=raw&ctype=text/css', 'text/css' ).then( // -> Load custom dark css styling first function () { console.log("Custom CSS Styling loaded!") // mw.loader.load( '/index.php?title=MediaWiki:DarkReader.js&action=raw&ctype=text/javascript' ) // -> Now load DarkReader to refine our custom dark css styling mw.loader.getScript('https://cdn.jsdelivr.net/npm/darkreader@4/darkreader.min.js').then( function () { DarkReader.setFetchMethod(window.fetch); DarkReader.enable({ }, { ignoreInlineStyle: ['.mediaContainer', '.mediaContainer *', '.TemplateRevision', '.TemplateRevision *', '#homeButtonNav', '#homeButtonNav *', '.mw-wiki-logo', 'img', '#siteNotice *', '.sitenoticestyling'], css: ` .sitenoticestyling { border-color: rgb(48, 52, 54) !important; border: 2px solid rgb(48, 52, 54) !important; } `, ignoreImageAnalysis: [".mw-wiki-logo", "img"], invert: [] }); console.log("Darkreader Enabled!"); }, function( e ) { mw.log.error( e.message ); // => "Failed to load script" }) }, function ( e ) { mw.log.error( e.message ); // => "Failed to load darkreader!" } )