Revision as of 22:57, 11 October 2019 by BelgianCat (talk | contribs) (Garage; Strength)

MediaWiki:ReplaceWordWithLink.js

From Tycoon Gaming

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/*Search Word*/
var list = ['Job Center', 'Grand Exchange', 'ATC',  'car dealership', 'job', 'skill', 'trucker', 'garage', 'strength'];
/*Replace Word (Link)*/
var replacelist = ['Job_Center', 'Grand_Exchange', 'Airline_Pilot#ATC_.28Air_Traffic_Control.29', 'Car_Dealer', 'Job_Center', 'Skill_Level_Tokens', 'Trucking', 'Garage', 'Strength'];
var edit = -1;
function Replace(){
	var path = window.location.search;
	edit = path.search('&action=edit');
	if (edit == -1){
		for (var i = 0; i < list.length; i++){
			var output;
			window.element = document.getElementById("bodyContent");
			var save = window.element.innerHTML;
			output = save.replace(' ' + list[i] + ' ', ' ' + '<a href="/wiki/index.php/' + replacelist[i] + '">' + list[i] + '</a>' + ' ');
			window.element.innerHTML = output;
		}
	} else {
	}
}
Replace();