Jump to content

User:Smalleditor/vector.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
// <nowiki>
importScript("User:PleaseStand/segregate-refs.js");
importScript("User:Ohconfucius/test/EngvarB.js");	//Engvar
//importScript("User:Symplectic_Map/spell.js");
importScript("User:GregU/dashes.js");
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript');
 
importScript("User:Ohconfucius/script/formatgeneral.js"); 
//importScript("User:Smalleditor/test.js");  //Currently Engvar
importScript("User:Ohconfucius/script/formatgeneral.js"); 
importScript("User:Ohconfucius/test/MOSNUM dates.js");
importScript("User:Ohconfucius/script/foreigndates.js");

importScript("User:Ohconfucius/script/Common Terms.js");
importScript("User:Smalleditor/script/Sources.js");
/**** dyk ****/
// [[User:Dr pda/prosesize.js]]
importScript('User:Dr pda/prosesize.js'); //[[User:Dr pda/prosesize.js]]

/**** navpop ****/
// [[User:Lupin/popups.js]]
 
importScript('User:Lupin/popups.js');

// Add [[WP:Reflinks]] launcher in the toolbox on left
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName 
   + "?client=script&citeweb=on&overwrite=simple&limit=200&lang=" + wgContentLanguage,
  "Reflinks Citeweb"  // link label
)});
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName 
   + "?client=script&overwrite=simple&limit=200&lang=" + wgContentLanguage,
  "Reflinks plain"  // link label
)});

/** ------------------------------------------------------------------------- */
function Ohc_edit_summary1(){
	//Add a tag to the summary box
//	setoptions(minor='true'); 		//removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('[[WP:MOS|style]] fixes, incl. [[WP:MOSDATES|align dates]], [[MOS:LINK|links]] and [[MOS:TEXT|italics]]', 'appendonce');
	doaction('diff');
}

function Ohc_edit_summary2(){
	//Add a tag to the summary box
	setoptions(minor='false',watch='false'); 		
	setreason('[[WP:MOS|style]] fixes, incl. [[WP:ENGVAR|British spelling]], [[WP:MOSDATES|align dates]], [[MOS:LINK|links]] and [[MOS:TEXT|italics]]', 'appendonce');
	doaction('diff');
}
 

function Ohc_insert_tag(){
 var txt=document.editform.wpTextbox1;
// current month-year
    var currentDate = new Date();
    var currmonth = currentDate.getMonth();
    var curryear  = currentDate.getFullYear();
    var myMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var curryyyymm = myMonths[currmonth] + ' ' + curryear;
 
// insert 'use British English' template
    txt.value=txt.value.replace(/\{\{(?:use British (?:\(Oxford\) |)English|Engvar[ABC])(\|[^}]*)?\}\}/gi, '{{Use British English|date='+curryyyymm+'}}');
    txt.value=txt.value.replace(/\{\{(Use (Australian|Indian|Irish|Pakistani|South African) English)(\|[^}]*)?\}\}/gi, '{{Use British English|date='+curryyyymm+'}}');
 
    var rxpdd = new RegExp("{{Use British English\\|date="+curryyyymm+"}}", "gi");
    var dflagfound = txt.value.search(rxpdd);
    if (dflagfound == -1)
    {
        txt.value='{{Use British English|date='+curryyyymm+'}}\r\n'+txt.value;
    }
}
function ONETOUCH_ENG() {
 var txt=document.editform.wpTextbox1;
	autoEdFunctions(); //dashes
	Ohc_formatgeneral();
	Ohc_news_sources();
	Ohc_CommonTerms();

	ohc_ISO_to_dmy_in_citations();
//	ohc_protect_strings();
	ohc_protect_dates();
	ohc_fix_unambiguous_dates();
	ohc_body_dates_to_dmy();
	ohc_delink_year_in_X();
//		ohc_customize_all_to_dmy();
		ohc_customize_body_to_dmy();
	ohc_unprotect_dates();
	ohc_delink_ISO_to_dmy();

	ohc_protect_global();
	Ohc_ENGVARSimple();
	zwords();
	ohc_unprotect_global();
	Ohc_insert_tag();

	Ohc_edit_summary2();
}
 
function ONETOUCH_DMY(){
// Add a tag to the summary box
 var txt=document.editform.wpTextbox1;
	autoEdFunctions(); //dashes
	Ohc_formatgeneral();
	Ohc_news_sources();
	Ohc_CommonTerms();
 
//	ohc_protect_strings();
	ohc_protect_dates();
	ohc_fix_unambiguous_dates();
	ohc_body_dates_to_dmy();
	ohc_delink_year_in_X();
//		ohc_customize_all_to_dmy();
		ohc_customize_body_to_dmy();
	ohc_unprotect_dates();
//	ohc_unprotect_strings();
	ohc_publication_dates();
 
	Ohc_edit_summary1();
}
 
function ONETOUCH_MDY(){
// Add a tag to the summary box
 var txt=document.editform.wpTextbox1;
	autoEdFunctions(); //dashes
	Ohc_formatgeneral();
	Ohc_news_sources();
	Ohc_CommonTerms();
 
//	ohc_protect_strings();
	ohc_protect_dates();
	ohc_fix_unambiguous_dates();
	ohc_body_dates_to_mdy();
	ohc_delink_year_in_X();
//		ohc_customize_all_to_mdy();
		ohc_customize_body_to_mdy();
	ohc_unprotect_dates();
//	ohc_unprotect_strings();
	ohc_publication_dates();
 
Ohc_edit_summary1();
}

function ONETOUCH_FMT(){
// Add a tag to the summary box
 var txt=document.editform.wpTextbox1;
	autoEdFunctions(); //dashes
	Ohc_formatgeneral();
	Ohc_news_sources();
	Ohc_CommonTerms();
//	Ohc_edit_summary1();
}
function ohc_publication_dates_driver(){
// Add a tag to the summary box
 var txt=document.editform.wpTextbox1;
	 ohc_publication_dates();
}

// Add [[WP:Reflinks]] launcher in the toolbox on left
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName 
   + "?client=script&citeweb=on&overwrite=simple&limit=200&lang=" + wgContentLanguage,
  "Reflinks Citeweb"  // link label
)});
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName 
   + "?client=script&overwrite=simple&limit=200&lang=" + wgContentLanguage,
  "Reflinks plain"  // link label
)});

$(function () {
 if(document.forms.editform) {
  mw.util.addPortletLink('p-tb', 'javascript:ONETOUCH_ENG()', 'One Touch: ENGVAR', 't-eng', 'Engvar + all', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ONETOUCH_DMY()', 'One Touch: DMY', 't-dmy', 'day month + CT', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ONETOUCH_MDY()', 'One Touch: MDY', 't-mdy', 'month day + CT', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ohc_dmy_publication_dates()', 'Publication dates', 't-mdy', 'Remove ISO publication dates', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ONETOUCH_FMT()', 'One Touch: FMT', 't-fmt', 'general fmt, CT + cites', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ohc_ISO_to_dmy_anywhere()', 'ALL ISO DMY', 't-dmy', 'day month', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:ohc_ISO_to_mdy_anywhere()', 'ALL ISO MDY', 't-mdy', 'month day', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_access_dates_to_ISO()', 'ACCESS dates to ISO', 't-ISO', 'ISO day month', '', '');
 mw.util.addPortletLink('p-tb', 'javascript:ohc_protect_dates()', 'protect strings', 't-dmy', 'day month', '', '');
  }
});
// </nowiki>