Jump to content

User:Techie3/common.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Techie3 (talk | contribs) at 01:07, 22 October 2020. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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.
var AutoEd_baseurl = 'http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Wikipedia:AutoEd/';
if (location.protocol === 'https:') {
  AutoEd_baseurl = 'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Wikipedia:AutoEd/';
}
autoEdMinor = false;

//Sets variable configuration
//autoEdTag = "Adjacent Stations using [[WP:AutoEd|AutoEd]]"; //Tweaks edit summary
autoEdTag = "Auto Fixing Archive using [[WP:AutoEd|AutoEd]]";
autoEdLinkName = "Adjacent Stations"; //Changes the link name at the top of the page

function adjacentStation(str){
	test = '$1\n{{subst:'+'#invoke:Adjacent stations|convert|$2}}'
	str = str.replace(/(\| *(?:services|other_services) *=)((?:\s*\{\{.+\}\})+)/,test);
	return str;
} 
function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
    var $textbox = $( '#wpTextbox1' );
    var txt = $textbox.textSelection('getContents');
    //txt = txt.replace(/\|\s*system\s*=\s*Victoria/g,"|system = V/Line")
    //txt = adjacentStation(txt);
    var pattern = /(\[\[Wikipedia:WikiProject Articles for creation\/Help desk\/Archives\/\d*) (.*?)\|.*<\/strong>]]/g;
    txt = txt.replace(pattern,"$1 $2|$2]]");
    $textbox.textSelection('setContents', txt);
}

$.when( $.ready, mw.loader.using( 'jquery.textSelection' ) ).then(function() {
importScriptURI(AutoEd_baseurl + 'core.js'); //Imports the "framework" script needed to make this function
});
importScript('User:Jackmcbarn/advancedtemplatesandbox.js'); // Backlink: [[User:Jackmcbarn/advancedtemplatesandbox.js]]