User:Peterxy12/AdvancedRollback/auto.js: Difference between revisions

From Test Wiki
Jump to navigation Jump to search
Content deleted Content added
Created page with "/* * Advanced Rollback script for rollbackers (Automatic language selection) * * This script asks the user to supply an optional rollback summary. * After the rollback is complete, the user is taken to the diff page. * The diff page will open in a new window if the user is on Special:RecentChanges. * * Add the following line to your common.js or global.js to load this script: * mw.loader.load( "https://zh.wikipedia.org/w/index.php?title=User:1F616EMO/AdvancedRo..."
Tags: Mobile edit Mobile web edit
 
No edit summary
Tags: Mobile edit Mobile web edit
 
Line 25: Line 25:
wgContentLanguage.startsWith('zh-')) {
wgContentLanguage.startsWith('zh-')) {
scriptLanguage = 'zh';
scriptLanguage = 'zh';
}
if (wgContentLanguage === 'es') {
scriptLanguage = 'es'
}
}



Latest revision as of 06:30, 11 January 2026

/*
 * Advanced Rollback script for rollbackers (Automatic language selection)
 * 
 * This script asks the user to supply an optional rollback summary.
 * After the rollback is complete, the user is taken to the diff page.
 * The diff page will open in a new window if the user is on Special:RecentChanges.
 * 
 * Add the following line to your common.js or global.js to load this script:
 * mw.loader.load( "https://zh.wikipedia.org/w/index.php?title=User:1F616EMO/AdvancedRollback/auto.js&action=raw&ctype=text/javascript" );
 * 
 * This script is made by 1F616EMO on zhwiki, licensed under CC BY-SA 4.0.
 * 
 */
// <nowiki>

(() => {
    const wgContentLanguage = mw.config.get('wgContentLanguage');
    let scriptLanguage = 'en';

    if (wgContentLanguage === 'yue') {
        scriptLanguage = 'yue'
    } else if (
        wgContentLanguage === 'zh' ||
        wgContentLanguage === 'lzh' ||
        wgContentLanguage.startsWith('zh-')) {
        scriptLanguage = 'zh';
    }
    
 if (wgContentLanguage === 'es') {
        scriptLanguage = 'es'
    }

    mw.loader.load(`https://zh.wikipedia.org/w/index.php?title=User:1F616EMO/AdvancedRollback/${scriptLanguage}.js&action=raw&ctype=text/javascript`);
})();

// </nowiki> Nya~