User:GeorgeMoney/TEMP/Rpotd.js

//security risk. Delete when done using!!!

//Prefix to use when automatically moving var movevar='rpotdmove=1'; var moveenabled = 1; var movesummary='Moving RPOTD pages to a new userspace, per the TfD.'; var movenp = 'User:Presidentman/potd'; var moveoldprefix = /^(?:User\:GeorgeMoney\/potd(\/.+)?|Template\:RPOTD(\/.+)?)$/i; var movenewprefix = movenp+'$1$2';

//Prefix to use when fixing references to GM/potd var fixvar='rpotdfix=1'; var fixenabled = 1; var fixsummary='Preparing pages for move.';

//Prefix to use when autodeleting the old Template:Rpotd var delvar='rpotddel=1'; var delenabled = 1; var delsummary = 'Deleting old pages, per the TfD and per CSD G6.';

if(moveenabled && wgPageName=='Special:MovePage' && window.location.href.indexOf(movevar) != -1) {

document.getElementById('wpReason').value=movesummary;

var newtitle; var oldtitle=-1; var tds = document.getElementsByTagName('td'); len = tds.length; for(i=0; i<len; i++) { if(tds[i].className=='mw-input') { oldtitle = tds[i].getElementsByTagName('strong')[0].getElementsByTagName('a')[0].innerHTML; break; } } if(oldtitle != -1) { newtitle = oldtitle.replace(moveoldprefix, movenewprefix); document.getElementById('wpNewTitle').value=newtitle; document.getElementsByName('wpMove')[0].click; }

}

if(wgPageName.indexOf(movenp)==0 && window.location.href.indexOf(fixvar) != -1) {

document.getElementById('wpSummary').value=fixsummary;

}