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 07:49, 11 December 2020 (Installing User:Evad37/Watchlist-openUnread.js (script-installer)). 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;
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 adjacentStationsServices(str){
	pattern = /(\| *(?:services|other_services) *=)((?:\s*\{\{.+\}\})+)/;

	replace = '$1\n{{subst:'+'#invoke:Adjacent stations|convert|$2}}';
	
	str = str.replace(pattern,replace);
	return str;
} 

function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
    var $textbox = $( '#wpTextbox1' );
    var txt = $textbox.textSelection('getContents');
    txt=adjacentStationsServices(txt);
    txt=adjacentStationsServices(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:Enterprisey/reply-link.js'); // Backlink: [[User:Enterprisey/reply-link.js]]
importScript('User:RedWarn/.js'); // Backlink: [[User:RedWarn/.js]]
importScript('User:Awesome Aasim/xfdvote.js'); // Backlink: [[User:Awesome Aasim/xfdvote.js]]
//importScript('User:Joeytje50/JWB.js/load.js'); // Backlink: [[User:Joeytje50/JWB.js/load.js]]
importScript('User:Evad37/Watchlist-openUnread.js'); // Backlink: [[User:Evad37/Watchlist-openUnread.js]]