User:WOSlinker/replaceimage.js

function musartist_queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }   return null; } if(mw.config.get('wgNamespaceNumber') != -1 && mw.config.get('wgArticleId') != 0) { $( function musartistEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',musartist:true}), 'musartist', 'p-musartist', 'MusArtist edit this page');   } )} String.prototype.trim = function { return this.replace(/^\s+|\s+$/g,""); }

if(mw.config.get('wgAction') == 'edit' && musartist_queryString('musartist') == 'true') { $(function rugbyEdit {

var sep = '\n';

var idx_start; var idx_end; var removed;

var myContent = document.getElementById('wpTextbox1').value; myContent = myContent.replace(/\[\[Image\:Replace this image male.svg\|150px\]\]/,''); myContent = myContent.replace(/\[\[Image\:Replace this image male.svg\]\]/,''); myContent = myContent.replace(/\[\[Image\:Replace this image female.svg\|150px\]\]/,''); myContent = myContent.replace(/\[\[Image\:Replace this image female.svg\]\]/,''); myContent = myContent.replace(/Replace this image male.svg\|150px/,'|'); myContent = myContent.replace(/Replace this image male.svg/,''); myContent = myContent.replace(/Replace this image female.svg\|150px/,'|'); myContent = myContent.replace(/Replace this image female.svg/,'');

if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='remove placeholder image'; document.getElementById('wpMinoredit').checked = true; };

} )}