User:Ohconfucius/test/formatgeneral.js

From Wikipedia, the free encyclopedia
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.
/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 * @update-token [[File:pathoschild/templatescript.js]]
 */
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js');
importScript("User:Ohconfucius/test/formatgeneral.js/core.js");
importScript("User:Ohconfucius/script/tometricunits.js");

function Ohc_formatgeneral() {
	ohc_change_type();
	ohc_protect_fmt();
	Ohc_formats();
	ohc_unprotect_fmt();
	ohc_downcase_CEO();
	ohc_linkspam();
	Ohc_final_cleanup();

}

function Ohc_formatgeneralbis() {  //for Tony - "bis" designates no hash conversion
	ohc_change_type();
	ohc_protect_fmt();
	Ohc_formatsbis();
	ohc_unprotect_fmt();
	ohc_downcase_CEO();
	ohc_linkspam();
	Ohc_final_cleanup();
}

function Ohc_run_formatgeneral() {
	Ohc_formatgeneral();
	Ohc_formatgen_edit_summary();

}

function Ohc_formatgen_edit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); 		
	setreason('General [[WP:MOS|formatting]]', 'append');
//	doaction('save');
}

$(function () {
 if(document.forms.editform) {
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_run_formatgeneral()', 'General formatting', 't-addmetric', 'Fixes some unit formatting', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_downcase_headings()', 'Downcase_HEADINGS', 'MOSHEAD', 'Fix headings and downcase', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_Sundry()', 'Sundry', 'formatting', 'Eject zh-language clutter from lead', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_MOSCAPS()', 'MOSCAPS', 'formatting', 'Eject zh-language clutter from lead', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_MOSFLAG()', 'MOSFLAG', 'formatting', 'Eject zh-language clutter from lead', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_MOSPUNCT()', 'MOSPUNCT', 'formatting', 'Eject zh-language clutter from lead', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_MOSHASH()', 'MOSHASH', 'formatting', 'Eject zh-language clutter from lead', '', '');
//	mw.util.addPortletLink('p-tb', 'javascript:Ohc_format_COMMONALITY()', 'COMMON', 'formatting', 'Eject zh-language clutter from lead', '', '');

  }
});