View source for MediaWiki:ReplaceWordWithLink.js
From Tycoon Gaming
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
/*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;
var pattern = new RegExp(' ' + list[i] + ' ', 'gi');
console.log('Pattern: ' + pattern);
output = output.replace(pattern, ' ' + '<a href="/wiki/index.php/' + replacelist[i] + '">' + list[i] + '</a>' + ' ');
window.element.innerHTML = output;
}
} else {
}
}
000
1:0
Return to MediaWiki:ReplaceWordWithLink.js.