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

From Wikipedia, the free encyclopedia

Content deleted Content added


Line 54: Line 54:

});

});

});

});

importScript( ‘User:DVRTed/sandbox/temp.js’ ); // Backlink: [[User:DVRTed/sandbox/temp.js]]

importScript( ‘User:DVRTed/sandbox/temp.js’ ); // Backlink: [[User:DVRTed/sandbox/temp.js]]


Revision as of 11:41, 9 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=86400&smaxage=86400&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:Ingenuity/AbuseFilterContribs.js', // Backlink: [[User:Ingenuity/AbuseFilterContribs.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'
];

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'
    );
    
    document.getElementById('t-toggle-scripts').addEventListener('click', (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/PreviousDiscussions.js' ); // Backlink: [[User:Polygnotus/Scripts/PreviousDiscussions.js]]

Leave a Comment

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

Exit mobile version