MediaWiki:Gadget-floodstyle.js
Jump to navigation
Jump to search
Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences. — More skins
try { // containerize gadget, to protect other gadgets if this one goes wrong
/**
* This gadget checks to see if the current user is a member of the flood group.
* If they are, the gadget modifies the save button to read something other than
* normal, and adds a link in the corner of the screen linking to the page used
* to turn flood rights back off again.
*
* It also loads some custom CSS: ideally this would be pure CSS to avoid the
* flash of unstyled page that happens as the JavaScript loads, but at the time
* of gadget creation there is no obvious way to discover the user's current
* groups in a pure CSS solution.
*
* This gadget also uses [[MediaWiki:Gadget-floodstyle.css]], and is released
* into the public domain by the author. Where this is not legally possible,
* they grant anyone the right to use this work for any purpose, without any
* conditions, unless such conditions are required by law.
*/
if (mw.config.get('wgUserGroups') && mw.config.get('wgUserGroups').indexOf( 'flood' ) !== -1) {
mw.loader.load( '//en.wikinews.org/w/index.php?title=MediaWiki:Gadget-floodstyle.css&action=raw&ctype=text/css', 'text/css' );
mw.util.addPortletLink( 'p-personal', '/wiki/Special:Userrights/' + encodeURIComponent(mw.config.get('wgUserName')), '(flood mode)', 'pt-flood' );
document.getElementById( 'wpSave' ).setAttribute( "value", "Stealthily save page" );
}
} catch (e) { // containerize gadget, to protect other gadgets if this one goes wrong
// ignore
}