Difference between revisions of "MediaWiki:Common.js"
From Tycoon Gaming
Line 1: | Line 1: | ||
− | / | + | mw.loader.load( '/wiki/index.php?title=MediaWiki:ServerList.js&action=raw&ctype=text/javascript'); |
− | var | + | |
− | var | + | var list = ['Job Center', 'Grand Exchange', 'ATC', 'car dealership', 'job', 'skill', 'trucker']; |
− | var | + | var replacelist = ['Job_Center', 'Grand_Exchange', 'Airline_Pilot#ATC_.28Air_Traffic_Control.29', 'Car_Dealer', 'Job_Center', 'Skill_Level_Tokens', 'Trucking']; |
− | window. | + | var edit = -1; |
− | + | function Replace(){ | |
− | + | var path = window.location.search; | |
− | + | edit = path.search('&action=edit'); | |
− | + | console.log(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; | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | window.element.innerHTML = | ||
− | } | ||
} else { | } else { | ||
− | console.log(' | + | console.log('Is in Editor'); |
} | } | ||
} | } | ||
− | + | Replace(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 19:46, 9 October 2019
mw.loader.load( '/wiki/index.php?title=MediaWiki:ServerList.js&action=raw&ctype=text/javascript'); var list = ['Job Center', 'Grand Exchange', 'ATC', 'car dealership', 'job', 'skill', 'trucker']; var replacelist = ['Job_Center', 'Grand_Exchange', 'Airline_Pilot#ATC_.28Air_Traffic_Control.29', 'Car_Dealer', 'Job_Center', 'Skill_Level_Tokens', 'Trucking']; var edit = -1; function Replace(){ var path = window.location.search; edit = path.search('&action=edit'); console.log(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 { console.log('Is in Editor'); } } Replace();