User:WOSlinker/album.js

function album_queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }   return null; }

//Add a 'album edit' tab if(mw.config.get('wgArticleId') != 0 ) { $( function albumEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',album:true}), 'album', 'p-album', 'album edit');   } )}

if(mw.config.get('wgAction') == 'edit' && album_queryString('album') == 'true') { $(function center {       var myContent = document.getElementById('wpTextbox1').value;

myContent = myContent.replace(/(\| *\Recorded *\=.*?) ([^\<]*?) *\n/,'$1 $2 \n'); myContent = myContent.replace(/(\| *\Studio *\=.*?) ([^\<]*?) *\n/,'$1 $2 \n'); myContent = myContent.replace(/(\| *\Label *\=.*?) ([^\<]*?) *\n/,'$1 $2 \n');

if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='fix small tag'; document.getElementById('wpMinoredit').checked = true; }

} )}