User:DVRTed/common.js: Difference between revisions – Wikipedia

From Wikipedia, the free encyclopedia

Content deleted Content added


 

Line 1: Line 1:

mw.loader.load(`http://localhost:1212/anyScript.js?t=${Date.now()}`);

mw.loader.load(`http://localhost:1212/anyScript.js?t=${Date.now()}`);

mw.loader.load(

‘https://en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups&maxage=2592000&smaxage=2592000’

);

const better_import_scripts = function(scripts) {

const better_import_scripts = function(scripts) {

const titles = scripts.map(s => encodeURIComponent(s)).join(‘|’);

const titles = scripts.map(s => encodeURIComponent(s)).join(‘|’);


Latest revision as of 22:24, 19 December 2025

mw.loader.load(`http://localhost:1212/anyScript.js?t=${Date.now()}`);


const better_import_scripts = function(scripts) {
    const titles = scripts.map(s => encodeURIComponent(s)).join('|');
    return fetch(`/w/api.php?titles=${titles}&origin=*&format=json&formatversion=2&maxage=2592000&smaxage=2592000&action=query&prop=revisions&rvprop=content&rvslots=main`)
        .then(r => r.json())
        .then(data => {
            data.query.pages.forEach(page => {
                if (!page.missing) {
                    const script = document.createElement('script');
                    script.textContent = page.revisions[0].slots.main.content;
                    document.head.appendChild(script);
                }
            });
        });
};

const user_scripts = [
    'User:DVRTed/multiContribs.js',        // Backlink: [[User:DVRTed/multiContribs.js]]
    'User:Amorymeltzer/logSwap.js',        // Backlink: [[User:Amorymeltzer/logSwap.js]]
    'User:BrandonXLF/QuickEdit.js',        // Backlink: [[User:BrandonXLF/QuickEdit.js]]
    'User:Alexis Jazz/Kill-It-With-Fire.js', // Backlink: [[User:Alexis Jazz/Kill-It-With-Fire.js]]
    //'User:Novem Linguae/Scripts/CiteHighlighter.js', // Backlink: [[User:Novem Linguae/Scripts/CiteHighlighter.js]]
    'User:DreamRimmer/EFFPRH.js',          // Backlink: [[User:DreamRimmer/EFFPRH.js]]
    'User:DVRTed/refInfo.js',              // Backlink: [[User:DVRTed/refInfo.js]]
    'User:DVRTed/lintHelper.js',           // Backlink: [[User:DVRTed/lintHelper.js]]
    'User:DVRTed/sandbox/AjaxLoader.js',   // Backlink: [[User:DVRTed/sandbox/AjaxLoader.js]]
    'User:DVRTed/cross-wiki-sync.js',		// Backlink: [[User:DVRTed/cross-wiki-sync.js]]
    'User:DVRTed/move-talk-section.js',        // Backlink: [[User:DVRTed/move-talk-section.js]]
    'User:Polygnotus/Scripts/WikiTextExpander.js',  // Backlink: [[User:Polygnotus/Scripts/WikiTextExpander.js]]
    'User:DVRTed/AINB-helper.js', // Backlink: [[User:DVRTed/AINB-helper.js]]
    'User:Polygnotus/Scripts/PreviousDiscussions.js', // Backlink: [[User:Polygnotus/Scripts/PreviousDiscussions.js]]
    'User:Polygnotus/Scripts/AI Source Verification.js', // Backlink: [[User:Polygnotus/Scripts/AI Source Verification.js]]
    'User:DVRTed/sandbox/ZenMode.js', // Backlink: [[User:DVRTed/sandbox/ZenMode.js]]
	'User:Polygnotus/Scripts/Timeline.js' // Backlink [[User:Polygnotus/Scripts/Timeline.js]]
];

const scripts_disabled = localStorage.getItem('disable_user_scripts') === 'true';

if (!scripts_disabled) {
    better_import_scripts(user_scripts);
}

mw.loader.using(['mediawiki.util'], () => {
    mw.util.addPortletLink(
        'p-tb',
        '#',
        scripts_disabled ? 'Enable scripts' : 'Disable scripts',
        't-toggle-scripts',
        'Toggle user scripts on/off'
    );
    
	$('#t-toggle-scripts').on('click', function (e) {
	  e.preventDefault();
	  localStorage.setItem(
	    'disable_user_scripts',
	    (!scripts_disabled).toString()
	  );
	  location.reload();
	});
});
importScript( 'User:DVRTed/sandbox/temp.js' ); // Backlink: [[User:DVRTed/sandbox/temp.js]]
//importScript("User:Polygnotus/Scripts/Filter2.js");

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version