Jump to content

MediaWiki:Gadget-RegexMenuFramework.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TheDJ (talk | contribs) at 21:54, 23 August 2017 (add deprecation logging). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Script:  [[m:User:Pathoschild/Scripts/Regex menu framework]]
  * RegexMenuFramework: creates a sidebar menu of user-defined regex tools
  * Documentation: [[m:User:Pathoschild/Scripts/Regex menu framework]]
  * Written by: Pathoschild
  * 
  <source lang="javascript"><nowiki>
*/
// load script
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript');

// Add deprecation logging. Eventually move this into the meta script
var regexlib = {
	regexTool: window.regexTool,
	regsearch: window.regsearch,
	regex: window.regex,
	setreason: window.setreason,
	setoptions: window.setoptions,
	doaction: window.doaction,
	custom: window.custom,
	rfmenu: window.rfmenu
};

mw.log.deprecate( window, 'regexTool', regexLib.regexTool, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-regexTool' );
mw.log.deprecate( window, 'regsearch', regexLib.regsearch, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-regsearch' );
mw.log.deprecate( window, 'regex', regexLib.regex, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-regex' );
mw.log.deprecate( window, 'setreason', regexLib.setreason, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-setreason' );
mw.log.deprecate( window, 'setoptions', regexLib.setoptions, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-setoptions' );
mw.log.deprecate( window, 'doaction', regexLib.doaction, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-doaction' );
mw.log.deprecate( window, 'custom', regexLib.custom, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-custom' );
mw.log.deprecate( window, 'rfmenu', regexLib.rfmenu, 'RegexMenuFramework is deprecated, use Templates [[:mw:TemplateScript]] instead', 'userscript-regexf-rfmenu' );

// default menu links
function gadget_rmflinks() {
        regexTool('Custom regex','custom()'); // a default tool which performs regex input in a dynamic form
}
/* </nowiki></source> */