User:Bosco/HRT.js

From Test Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// From https://zh.wikipedia.org/wiki/User:Xiplus/js/HRTProtectLink.js
// CC BY SA 4.0
mw.loader.load('//unbooks.miraheze.org/w/index.php?title=User:PB2008/HRT-en.js&bcache=1&maxage=259200&action=raw&ctype=text/javascript');
if (mw.config.get("wgNamespaceNumber") == 10 || mw.config.get("wgNamespaceNumber") == 828) {
	mw.loader.using(['mediawiki.util']).done(function(){
		mw.util.addPortletLink(
			'p-cactions',
			mw.config.get("wgServer")+mw.config.get("wgScriptPath")+'/index.php?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=protect&mwProtect-level-edit=bureaucrat&mwProtect-level-move=bureaucrat&mwProtect-level-delete=bureaucrat&mwProtect-level-protect=bureaucrat&mwProtect-reason=High-risk template ([[User:PB2008/HRT.js|HRT.js]])',
			'High-risk template (Bcrat protection)'
		);
		mw.util.addPortletLink(
			'p-cactions',
			mw.config.get("wgServer")+mw.config.get("wgScriptPath")+'/index.php?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=protect&mwProtect-level-edit=steward&mwProtect-level-move=steward&mwProtect-level-delete=steward&mwProtect-level-protect=steward&mwProtect-reason=High-risk template ([[User:PB2008/HRT.js|HRT.js]])',
			'High-risk template (Steward protection)'
		);
	});
}