User:Ohconfucius/test/formatgeneral.js

/**

* 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 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', , );

}

});