User:Ohconfucius/test/formatgeneral.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Ohconfucius/test/formatgeneral. |
/**
* 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', '', '');
}
});