User:Frietjes/unstyle.js

// jQuery(document).ready(function($) {

var myContent = document.getElementsByName('wpTextbox1')[0]; // //

if(mw.config.get('wgNamespaceNumber') != -1 && myContent && mw.config.get('wgUserName') == 'Frietjes') { mw.loader.using(['mediawiki.util']).done( function {	 var portletlink = mw.util.addPortletLink('p-tb', '#', 'Unstyle', 't-unstyle');	  $(portletlink).click(function(e) { e.preventDefault; wpUnStyle; });	}); } // // function wpUnStyle {	myContent.value = myContent.value.replace(/\|[ ]*(?:title|above|group|below|base)[0-9]*style[ ]*=(?:\{\{[^{}]*\}\}|[^{}\|])*/g, ''); myContent.value = myContent.value.replace(/\|[ ]*(?:title|above|group|below|base)[0-9]*style[ ]*=(?:\{\{[^{}]*\}\}|[^{}\|])*/g, ''); myContent.value = myContent.value.replace(/\{\{color[_ ]*\|[^{}\|]*\|([^{}]*)\}\}/g, '$1'); myContent.value = myContent.value.replace(/\{\{(?:white|black)[_ ]*\|([^{}]*)\}\}/g, '$1'); myContent.value = myContent.value.replace(/<\/*span[^<>]*>/g, ''); myContent.value = myContent.value.replace(/\{\{[_ ]*(?:link[_ ]*colou?r|colou?red[_ ]*link)[_ ]*\|[^{}\|]*\|([^{}]*)\}\}/g, '$1'); myContent.value = myContent.value.replace(/\[\[([^\[\]\|]*)\|\1\]\]/g, '$1'); } // // }); //