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

From Test Wiki
Jump to navigation Jump to search
Content deleted Content added
No edit summary
mNo edit summary
 
Line 31: Line 31:
}
}


mw.loader.load(`https://testwiki.wiki/index.php?title=User:Peterxy12/AdvancedRollback/${scriptLanguage}.js&action=raw&ctype=text/javascript`);
mw.loader.load(`https://testwiki.wiki/wiki/index.php?title=User:Peterxy12/AdvancedRollback/${scriptLanguage}.js&action=raw&ctype=text/javascript`);
})();
})();



Latest revision as of 06:22, 22 February 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 wgUserLanguage = mw.config.get('wgUserLanguage');
    let scriptLanguage = 'en';

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

    mw.loader.load(`https://testwiki.wiki/wiki/index.php?title=User:Peterxy12/AdvancedRollback/${scriptLanguage}.js&action=raw&ctype=text/javascript`);
})();

// </nowiki> Nya~