Jump to content

User:Aktsu/championship.js

From Wikipedia, the free encyclopedia
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.
function cs(){
 var txt=document.editform.wpTextbox1;
 txt.value=txt.value.replace(/\[\[List_of_UFC_champions#Light_heavyweight_championship_.28205_lbs.2C_93_kg.29\|UFC Light Heavyweight Championship\]\]/gi, '[[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Middleweight championship\|UFC Middleweight Champion\]\]/gi, '[[UFC Middleweight Championship|UFC Middleweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Middleweight championship\|UFC Middleweight Championship\]\]/gi, '[[UFC Middleweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Lightweight championship\|UFC Lightweight Championship\]\]/gi, '[[UFC Lightweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Lightweight championship\|UFC Lightweight Champion\]\]/gi, '[[UFC Lightweight Championship|UFC Lightweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Lightweight Championship \(Bantamweight championship before UFC 31\)\|UFC Lightweight Championship\]\]/gi, '[[UFC Lightweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship\|UFC Heavyweight Champion\]\]/gi, '[[UFC Heavyweight Championship|UFC Heavyweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship\|UFC Heavyweight Championship\]\]/gi, '[[UFC Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[UFC\]\] \[\[Heavyweight\]\] title/gi, '[[UFC Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Welterweight Championship \(formerly Lightweight\)\|UFC Welterweight Championship\]\]/gi, '[[UFC Welterweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Welterweight championship\|UFC Welterweight Champion\]\]/gi, '[[UFC Welterweight Championship|UFC Welterweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Welterweight championship\|UFC Welterweight Championship\]\]/gi, '[[UFC Welterweight Championship]]');
 txt.value=txt.value.replace(/\[\[UFC\]\] \[\[Middleweight\]\] title/gi, '[[UFC Middleweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Lightweight championship\|UFC lightweight title\]\]/gi, '[[UFC Lightweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light heavyweight championship\|UFC Light Heavyweight Championship\]\]/gi, '[[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Middleweight championship .28185 lb.2C 84 kg.29\|UFC Middleweight Championship\]\]/gi, '[[UFC Middleweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light heavyweight championship\|UFC Light-heavyweight Champion\]\]/gi, '[[UFC Light Heavyweight Championship|UFC Light Heavyweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light heavyweight championship\|UFC Light-heavyweight Championship\]\]/gi, '[[UFC Light Heavyweight Championship|UFC Light Heavyweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light heavyweight championship .28205 lbs.2C 93 kg.29\|UFC Light Heavyweight Championship\]\]/gi, '[[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship\|UFC heavyweight title\]\]/gi, '[[UFC Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light Heavyweight championship\|UFC light heavyweight title\]\]/gi, '[[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship \(295 lb, 134 kg\)\|UFC Heavyweight Champion\]\]/gi, '[[UFC Heavyweight Championship|UFC Heavyweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship \(295 lb, 134 kg\)\|UFC Heavyweight Championship\]\]/gi, '[[UFC Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship \(265 lb, 120 kg\)\|UFC Heavyweight Championship\]\]/gi, '[[UFC Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship\|UFC interim heavyweight champion\]\]/gi, '[[UFC Heavyweight Championship|UFC Interim Heavyweight Champion]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Heavyweight championship\|UFC interim heavyweight championship\]\]/gi, '[[UFC Heavyweight Championship|UFC Interim Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light Heavyweight championship\|For UFC light heavyweight title]]/gi, 'For [[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light Heavyweight championship\|Defended UFC light heavyweight title]]/gi, 'Defended [[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light Heavyweight championship\|Won UFC light heavyweight title]]/gi, 'Won [[UFC Light Heavyweight Championship]]');
 txt.value=txt.value.replace(/\[\[List of UFC champions#Light Heavyweight championship\|UFC light heavyweight champion]]/gi, '[[UFC Light Heavyweight Championship|UFC Light Heavyweight Champion]]');


 edit_summary_cs()
}

//Stolen from User:Lightmouse/monobook.js/script.js
function edit_summary_cs(){
// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "[[User:Aktsu/championship.js|script]]-assisted wikilinks 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:cs()', 'MMA wikilinks fixer', '', '', '', '');
  }
});