User:Aktsu/mostm.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Aktsu/mostm. |
//The MMA WP:MOSTM fixer
//Changes capitalization to comply with WP:MOSTM for PRIDE, DREAM, SHOOTO, DEEP and HERO's
/*
To use add;
importScript('User:Aktsu/mostm.js');
to your monobook.js (http://en.wikipedia.org/wiki/Special:MyPage/monobook.js).
*/
//Always double check what the script does, and manually move pages not already moved.
//If you know what you're doing, you're welcome to improve the script. If you don't, message me with suggestions and I'll try to implement them.
//NOTES:
//- It DOES NOT differ between normal links and interwiki-links, so whose have to be changed back to how they were manually (unless you intend to move those pages as well).
function mostm(){
var txt=document.editform.wpTextbox1;
txt.value=txt.value.replace(/\[\[PRIDE\|PRIDE Fighting Championships\]\]/g, '[[Pride Fighting Championships]]');
txt.value=txt.value.replace(/\[\[PRIDE\|/g, '[[Pride Fighting Championships|');
txt.value=txt.value.replace(/\[\[DREAM\]\]/g, '[[Dream (mixed martial arts)|Dream]]');
txt.value=txt.value.replace(/\[\[PRIDE\]\]/g, '[[Pride Fighting Championships|Pride]]');
txt.value=txt.value.replace(/DREAM.1/g, 'Dream 1');
txt.value=txt.value.replace(/DREAM.2/g, 'Dream 2');
txt.value=txt.value.replace(/DREAM.3/g, 'Dream 3');
txt.value=txt.value.replace(/DREAM.4/g, 'Dream 4');
txt.value=txt.value.replace(/DREAM.5/g, 'Dream 5');
txt.value=txt.value.replace(/DREAM.6/g, 'Dream 6');
txt.value=txt.value.replace(/DREAM.7/g, 'Dream 7');
txt.value=txt.value.replace(/PRIDE/g, 'Pride');
txt.value=txt.value.replace(/DREAM/g, 'Dream');
txt.value=txt.value.replace(/HERO\'s/g, 'Hero\'s');
txt.value=txt.value.replace(/HERO\'S/g, 'Hero\'s');
txt.value=txt.value.replace(/HEROs/g, 'Hero\'s');
txt.value=txt.value.replace(/HEROS/g, 'Hero\'s');
txt.value=txt.value.replace(/SHOOTO/g, 'Shooto');
txt.value=txt.value.replace(/DEEP/g, 'Deep');
txt.value=txt.value.replace(/RINGS/g, 'Rings');
edit_summary_mostm()
}
//Stolen from User:Lightmouse/monobook.js/script.js
function edit_summary_mostm(){
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "[[User:Aktsu/mostm.js|script]]-assisted [[WP:MOSTM]] fixes; ";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
document.editform.wpDiff.click();
}
$(function () {
if(document.forms.editform) {
mw.util.addPortletLink('p-tb', 'javascript:mostm()', 'MMA MOSTM fixer', '', '', '', '');
}
});