Jump to content

User:Techie3/common.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
adjcaent Stations
Line 7: Line 7:


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


Line 19: Line 19:
var $textbox = $( '#wpTextbox1' );
var $textbox = $( '#wpTextbox1' );
var txt = $textbox.textSelection('getContents');
var txt = $textbox.textSelection('getContents');
//txt = txt.replace(/\|\s*system\s*=\s*Victoria/g,"|system = V/Line")
txt = txt.replace(/\|\s*system\s*=\s*Victoria/g,"|system = V/Line")
//txt = adjacentStation(txt);
txt = adjacentStation(txt);
var pattern = /(\[\[Wikipedia:WikiProject Articles for creation\/Help desk\/Archives\/\d*) (.*?)\|.*>]]/g;
txt = txt.replace(pattern,"$1 $2|$2]]");
$textbox.textSelection('setContents', txt);
$textbox.textSelection('setContents', txt);
}
}
function afcHelp(txt){

var pattern = /(\[\[Wikipedia:WikiProject Articles for creation\/Help desk\/Archives\/\d*) (.*?)\|.*>]]/g;
txt = txt.replace(pattern,"$1 $2|$2]]");
}
$.when( $.ready, mw.loader.using( 'jquery.textSelection' ) ).then(function() {
$.when( $.ready, mw.loader.using( 'jquery.textSelection' ) ).then(function() {
importScriptURI(AutoEd_baseurl + 'core.js'); //Imports the "framework" script needed to make this function
importScriptURI(AutoEd_baseurl + 'core.js'); //Imports the "framework" script needed to make this function

Revision as of 06:28, 24 October 2020

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;
autoEdClick = false;

//Sets variable configuration
autoEdTag = "Adjacent Stations using [[WP:AutoEd|AutoEd]]"; //Tweaks edit summary
//autoEdTag = "Automatically 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);
 
    $textbox.textSelection('setContents', txt);
}
function afcHelp(txt){
	  var pattern = /(\[\[Wikipedia:WikiProject Articles for creation\/Help desk\/Archives\/\d*) (.*?)\|.*>]]/g;
      txt = txt.replace(pattern,"$1 $2|$2]]");
}
$.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]]