User:Frietjes/movelinks.js

jQuery(document).ready(function($) { if(mw.config.get('wgNamespaceNumber') != -1) { mw.loader.using(['mediawiki.util']).done( function { var portletlink = mw.util.addPortletLink('p-tb','#','move links','t-mvlks'); $(portletlink).click(function(e) {	 e.preventDefault;	  movelinksfunction;    }); }); } // // function movelinksfunction {  var myContent = document.getElementById('wpTextbox1').value;  myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*theatricalia_id[ ]*=[ ]*[\r\n](\||\}\})/gm, '$1$2');  myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*theatricalia_id[ ]*=[ ]*([a-z0-9][a-z0-9]*)[ ]*[\r\n]((?:[^{}]|[\r\n])*\}\}(?:.|[\r\n])*==[ ]*External links[ ]*==[\t ]*[\r\n])/gm, '$1$3* {' + '{Theatricalia|$2}}\n');  myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*iobdb_id[ ]*=[ ]*[\r\n](\||\}\})/gm, '$1$2');  myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*iobdb_id[ ]*=[ ]*([0-9][0-9]*)[ ]*[\r\n]((?:[^{}]|[\r\n])*\}\}(?:.|[\r\n])*==[ ]*External links[ ]*==[\t ]*[\r\n])/gm, '$1$3* {' + '{iobdb title|$2}}\n'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*ibdb_id[ ]*=[ ]*[\r\n](\||\}\})/gm, '$1$2'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*ibdb_id[ ]*=[ ]*([0-9][0-9]*)[ ]*[\r\n]((?:[^{}]|[\r\n])*\}\}(?:.|[\r\n])*==[ ]*External links[ ]*==[\t ]*[\r\n])/gm, '$1$3* {' + '{IBDB show|$2}}\n'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*playbill[ ]*=[ ]*[\r\n](\||\}\})/gm, '$1$2'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*playbill[ ]*=[ ]*([0-9][0-9]*)[ ]*[\r\n]((?:[^{}]|[\r\n])*\}\}(?:.|[\r\n])*==[ ]*External links[ ]*==[\t ]*[\r\n])/gm, '$1$3* {' + '{Playbill|$2}}\n'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*playbill_event[ ]*=[ ]*[\r\n](\||\}\})/gm, '$1$2'); myContent = myContent.replace(/(\{\{Infobox[_ ]+[Pp]lay(?:[^{}]|\{\{(?:[^{}]|\{\{[^{}]*\}\})*\}\}|[\r\n])*)\|[ ]*playbill_event[ ]*=[ ]*([0-9][0-9]*)[ ]*[\r\n]((?:[^{}]|[\r\n])*\}\}(?:.|[\r\n])*==[ ]*External links[ ]*==[\t ]*[\r\n])/gm, '$1$3* {' + '{Playbill|$2}}\n'); document.getElementById('wpTextbox1').value = myContent; document.getElementById('wpSummary').value = 'moving external links to the external links section'; } // // });