User:Ohconfucius/test/MOSNUM dates.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. |
![]() | This user script seems to have a documentation page at User:Ohconfucius/test/MOSNUM dates. |
importScript("User:Ohconfucius/test/MOSNUM_dates_code.js");
/** ------------------------------------------------------------------------ **/
/// CUSTOMIZATION POINTS
function ohc_customize_all_to_dmy() {
ohc_customize_all();
}
function ohc_customize_all_to_mdy() {
ohc_customize_all();
}
function ohc_customize_body_to_dmy() {
ohc_customize_all();
}
function ohc_customize_body_to_mdy() {
ohc_customize_all();
}
function ohc_customize_ISO_to_dmy() {
ohc_customize_all();
}
function ohc_customize_ISO_to_mdy() {
ohc_customize_all();
}
function ohc_customize_all() {
regex(/(\d(?:st|nd|rd|th) )C(entur(?:ies|y))(?![ -]*(?:Fox|[A-Z]\w*|''))/g, '$1c$2');
}
/** ------------------------------------------------------------------------ **/
/// DRIVER FUNCTIONS
function ohc_all_to_dmy_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_fix_unambiguous_dates();
ohc_body_dates_to_dmy();
ohc_delink_ISO_to_dmy();
ohc_delink_year_in_X();
ohc_customize_all_to_dmy();
ohc_unprotect_dates();
ohc_ISO_to_dmy_in_citations();
ohc_MOSNUM_edit_summary();
}
function ohc_all_to_mdy_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_fix_unambiguous_dates();
ohc_body_dates_to_mdy();
ohc_delink_ISO_to_mdy();
ohc_delink_year_in_X();
ohc_customize_all_to_mdy();
ohc_unprotect_dates();
ohc_ISO_to_mdy_in_citations();
ohc_MOSNUM_edit_summary();
}
function ohc_dmy_publication_dates_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_body_dates_to_dmy();
ohc_customize_body_to_dmy();
ohc_unprotect_dates();
ohc_dmy_publication_dates();
ohc_MOSNUM_edit_summary();
}
function ohc_mdy_publication_dates_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_body_dates_to_mdy();
ohc_customize_body_to_mdy();
ohc_unprotect_dates();
ohc_mdy_publication_dates();
ohc_MOSNUM_edit_summary();
}
function ohc_body_to_dmy_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_body_dates_to_dmy();
ohc_customize_body_to_dmy();
ohc_unprotect_dates();
ohc_MOSNUM_edit_summary();
}
function ohc_body_to_mdy_driver()
{
ohc_delink_dates();
ohc_protect_dates();
ohc_body_dates_to_mdy();
ohc_customize_body_to_mdy();
ohc_unprotect_dates();
ohc_MOSNUM_edit_summary();
}
function ohc_ISO_to_dmy_driver()
{
ohc_protect_dates();
ohc_delink_ISO_to_dmy();
ohc_customize_ISO_to_dmy();
ohc_unprotect_dates();
// ohc_MOSNUM_edit_summary();
}
function ohc_ISO_to_mdy_driver()
{
ohc_protect_dates();
ohc_delink_ISO_to_mdy();
ohc_customize_ISO_to_mdy();
ohc_unprotect_dates();
// ohc_MOSNUM_edit_summary();
}
function ohc_delink_year_in_X_driver()
{
ohc_delink_year_in_X();
}
function ohc_ISO_access_dates_driver(){
// Add a tag to the summary box
var txt=document.editform.wpTextbox1;
ohc_ISO_access_dates();
}
function ohc_unambiguous_dates_driver()
{
ohc_protect_dates();
ohc_fix_unambiguous_dates();
ohc_unprotect_dates();
ohc_slash_edit_summary();
}
function ohc_US_slash_dates_driver()
{
ohc_protect_dates();
ohc_US_slash_dates_to_mdy();
ohc_unprotect_dates();
ohc_slash_edit_summary();
}
function ohc_UK_slash_dates_driver()
{
ohc_protect_dates();
ohc_UK_slash_dates_to_dmy();
ohc_unprotect_dates();
ohc_slash_edit_summary();
}
function ohc_expand_ref_dates_driver()
{
ohc_protect_dates();
ohc_expand_ref_dates();
ohc_unprotect_dates();
ohc_expand_edit_summary();
}
function ohc_expand_all_dates_driver()
{
ohc_protect_dates();
ohc_expand_ref_dates();
ohc_expand_all_dates();
ohc_unprotect_dates();
ohc_expand_edit_summary();
}
function ohc_abbrev_ref_dates_driver()
{
ohc_protect_dates();
ohc_abbrev_ref_dates();
ohc_unprotect_dates();
ohc_abbrev_edit_summary();
}
function Ohc_abbrev_all_dates_driver()
{
ohc_protect_dates();
ohc_abbrev_ref_dates();
ohc_abbrev_all_dates();
ohc_unprotect_dates();
ohc_abbrev_edit_summary();
}
addOnloadHook(function () {
if(document.forms.editform) {
addPortletLink('p-tb', 'javascript:ohc_all_to_dmy_driver()', 'ALL dates to dmy', 'ca-unitfixer', 'Align all dates to dmy', '', '');
addPortletLink('p-tb', 'javascript:ohc_all_to_mdy_driver()', 'ALL dates to mdy', 'ca-unitfixer', 'Align all dates to mdy', '', '');
addPortletLink('p-tb', 'javascript:ohc_body_to_dmy_driver()', 'Body dates to dmy', 't-dmy', 'day month', '', '');
addPortletLink('p-tb', 'javascript:ohc_body_to_mdy_driver()', 'Body dates to mdy', 't-mdy', 'month day', '', '');
addPortletLink('p-tb', 'javascript:ohc_dmy_publication_dates_driver()', 'Body+pub dates to dmy', 't-dmy', 'Body and publication dates to dmy', '', '');
addPortletLink('p-tb', 'javascript:ohc_mdy_publication_dates_driver()', 'Body+pub dates to mdy', 't-mdy', 'Body and publication dates to mdy', '', '');
addPortletLink('p-tb', 'javascript:ohc_ISO_to_dmy_driver()', 'ISO to dmy', 't-ISOdmy', 'ISO day month', '', '');
addPortletLink('p-tb', 'javascript:ohc_ISO_to_mdy_driver()', 'ISO to mdy', 't-ISOmdy', 'ISO month day', '', '');
addPortletLink('p-tb', 'javascript:ohc_ISO_access_dates()', 'access 2 ISO', 't-ISOmdy', 'access dates to ISO', '', '');
addPortletLink('p-tb', 'javascript:ohc_delink_year_in_X_driver()' , 'Del year-in-X dates', 't-yearinX', 'Year in X', '', '');
addPortletLink('p-tb', 'javascript:ohc_expand_ref_dates_driver()', 'Expand ref dates', 't-expand', 'Expand month names within refs', '', '');
addPortletLink('p-tb', 'javascript:ohc_expand_all_dates_driver()', 'Expand all dates', 't-expand', 'Expand month names throughout', '', '');
addPortletLink('p-tb', 'javascript:ohc_abbrev_ref_dates_driver()', 'Abbrev ref dates', 't-expand', 'Abbreviate month names within refs', '', '');
addPortletLink('p-tb', 'javascript:ohc_abbrev_all_dates_driver()', 'Abbrev all dates', 't-expand', 'Abbreviate month names throughout', '', '');
// addPortletLink('p-tb', 'javascript:ohc_unambiguous_dates_driver()', 'unambiguous dates', 't-slash', 'resolves slash date format', '', '');
addPortletLink('p-tb', 'javascript:ohc_US_slash_dates_driver()', 'US-slash dates', 't-US', 'US-slash', '', '');
addPortletLink('p-tb', 'javascript:ohc_UK_slash_dates_driver()', 'UK-slash dates', 't-UK', 'UK-slash', '', '');
}
});