Difference between revisions of "MediaWiki:Common.js"

From Path of Diablo Wiki
Jump to: navigation, search
 
(12 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
  *
 
  *
 
  * Last updated: 2020-04-24
 
  * Last updated: 2020-04-24
*/
+
 
  
 
// Load dependencies (remove when loading through ResourceLoader).
 
// Load dependencies (remove when loading through ResourceLoader).
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Volker_E._(WMF)/dark-mode.css&action=raw&ctype=text/css', 'text/css' );
+
mw.loader.load( 'https://pathofdiablo.com/wiki/dark-mode.css', 'text/css' );
 
// User has dark color scheme preference set in operating system.
 
// User has dark color scheme preference set in operating system.
 
//if ( window.matchMedia( '( prefers-color-scheme: dark )' ).matches || mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) {
 
//if ( window.matchMedia( '( prefers-color-scheme: dark )' ).matches || mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) {
Line 20: Line 20:
 
$( function () {
 
$( function () {
 
// Fix logos.
 
// Fix logos.
$( '#p-logo' ).clone().addClass( 'mw-no-invert' ).insertAfter( '#p-logo' );
+
//$( '#p-logo' ).clone().addClass( 'mw-no-invert' ).insertAfter( '#p-logo' );
 
 
 
mw.util.addPortletLink( 'p-personal', '#', 'Dark mode', 'pt-darkmode', '', 'np', '#pt-watchlist' );
 
mw.util.addPortletLink( 'p-personal', '#', 'Dark mode', 'pt-darkmode', '', 'np', '#pt-watchlist' );
Line 35: Line 35:
 
     } );
 
     } );
 
} );
 
} );
 +
*/
 +
 +
// install [[:Wikipedia:User:Cacycle/wikEd]] in-browser text editor
 +
(function ()
 +
{
 +
var script = document.createElement('script');
 +
script.src = 'https://pathofdiablo.com/wiki/index.php?title=User_talk:GreenDude&action=raw&ctype=text/javascript';
 +
script.async = true;
 +
document.getElementsByTagName('head')[0].appendChild(script);
 +
}
 +
) ();

Latest revision as of 14:15, 18 November 2024

/* 
 * WikimediaUI Dark Mode
 *
 * Original authors:
 * - Volker E. (Wikimedia Foundation Product Design)
 * - Alex Hollender  (Wikimedia Foundation Product Design)
 * - Ed Sanders
 * - MusikAnimal
 *
 * Last updated: 2020-04-24


// Load dependencies (remove when loading through ResourceLoader).
mw.loader.load( 'https://pathofdiablo.com/wiki/dark-mode.css', 'text/css' );
// User has dark color scheme preference set in operating system.
//if ( window.matchMedia( '( prefers-color-scheme: dark )' ).matches || mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) {
//	document.documentElement.className = 'client-dark-mode';
//}

$( function () {
	// Fix logos.
	//$( '#p-logo' ).clone().addClass( 'mw-no-invert' ).insertAfter( '#p-logo' );
	
	mw.util.addPortletLink( 'p-personal', '#', 'Dark mode', 'pt-darkmode', '', 'np', '#pt-watchlist' );

    $( '#pt-darkmode' ).on( 'click', function( e ) {
    	var $html = $( 'html' );
        e.preventDefault();
        
        $html.toggleClass( 'client-dark-mode' );
        mw.storage.set(
			'client-dark-mode-toggle',
			String( Number( $html.hasClass( 'client-dark-mode' ) ) )
		);
    } );
} );
 */

// install [[:Wikipedia:User:Cacycle/wikEd]] in-browser text editor
(function ()
{
	var script = document.createElement('script');
	script.src = 'https://pathofdiablo.com/wiki/index.php?title=User_talk:GreenDude&action=raw&ctype=text/javascript';
	script.async = true;
	document.getElementsByTagName('head')[0].appendChild(script);
 }
) ();