Difference between revisions of "MediaWiki:Common.js"

From Tycoon Gaming
m
m
Line 4: Line 4:
 
mw.loader.load( '/wiki/index.php?title=MediaWiki:MainMenu.js&action=raw&ctype=text/javascript');
 
mw.loader.load( '/wiki/index.php?title=MediaWiki:MainMenu.js&action=raw&ctype=text/javascript');
 
mw.loader.load( '/wiki/index.php?title=MediaWiki:PageSpecific.js&action=raw&ctype=text/javascript');
 
mw.loader.load( '/wiki/index.php?title=MediaWiki:PageSpecific.js&action=raw&ctype=text/javascript');
 
mw.loader.using(['https://unpkg.com/[email protected]/darkreader.js']).then(function() {
 
    DarkReader.enable();
 
}).catch(function(error) {
 
    console.log('An error occurred while loading DarkReader:', error);
 
});
 
 
  
  
Line 19: Line 12:
 
}
 
}
 
});
 
});
 +
 +
 +
// Create a new script element
 +
var darkReaderScript = document.createElement('script');
 +
 +
// Set the source of the script to the DarkReader URL
 +
darkReaderScript.src = 'https://unpkg.com/[email protected]/darkreader.js';
 +
 +
// Define what to do once the script has loaded
 +
darkReaderScript.onload = function() {
 +
    // Check if DarkReader is defined and enable it
 +
    if (typeof DarkReader !== 'undefined') {
 +
        DarkReader.enable();
 +
    } else {
 +
        console.error('DarkReader failed to load');
 +
    }
 +
};
 +
 +
// Handle any errors that occur during script loading
 +
darkReaderScript.onerror = function() {
 +
    console.error('An error occurred while loading DarkReader');
 +
};
 +
 +
// Append the script element to the document head
 +
document.head.appendChild(darkReaderScript);

Revision as of 15:45, 29 December 2023

mw.loader.load( '/wiki/index.php?title=Mediawiki:Middleclick.js&action=raw&ctype=text/javascript');
mw.loader.load( '/wiki/index.php?title=MediaWiki:LastPage.js&action=raw&ctype=text/javascript');
mw.loader.load( '/wiki/index.php?title=MediaWiki:MoveTOC.js&action=raw&ctype=text/javascript');
mw.loader.load( '/wiki/index.php?title=MediaWiki:MainMenu.js&action=raw&ctype=text/javascript');
mw.loader.load( '/wiki/index.php?title=MediaWiki:PageSpecific.js&action=raw&ctype=text/javascript');


$(document).ready(function() {
	if ( window.location !== window.parent.location ) { 
		const elem = document.getElementById('p-personal-container');
		elem.style.display = 'none';
	}
});


// Create a new script element
var darkReaderScript = document.createElement('script');

// Set the source of the script to the DarkReader URL
darkReaderScript.src = 'https://unpkg.com/[email protected]/darkreader.js';

// Define what to do once the script has loaded
darkReaderScript.onload = function() {
    // Check if DarkReader is defined and enable it
    if (typeof DarkReader !== 'undefined') {
        DarkReader.enable();
    } else {
        console.error('DarkReader failed to load');
    }
};

// Handle any errors that occur during script loading
darkReaderScript.onerror = function() {
    console.error('An error occurred while loading DarkReader');
};

// Append the script element to the document head
document.head.appendChild(darkReaderScript);