Jump to content

User:AZPR/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//following variables for peer reviewing script
select_PR = true;
allSpaces_PR = true;
spellcheck_PR = false; // true
showHeading_PR = true;
noXHR_PR = true; // false
// Script from [[User:AndyZ/peerreviewer.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:AndyZ/peerreviewer.js' 
             + '&action=raw&ctype=text/javascript');

// Script from [[User:AZPR/personalredirect.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:AZPR/personalredirect.js' 
             + '&action=raw&ctype=text/javascript');

importScript('User:Omegatron/monobook.js/addlink.js'); //[[User:Omegatron/monobook.js/addlink.js]]

if((wgNamespaceNumber == 0) && (document.location.href.indexOf("action")==-1)){
document.location.href = "http://en.wikipedia.org/w/index.php?title="+document.title.split(" - ")[0].replace(/\s/, "_")+"&action=edit"
}

function addMsg(num,num2){
// if(wgNamespaceNumber == 4 && wgTitle == "Peer review"){
  var list = document.getElementById('wpTextbox1').value.match(/review\|.*?\|/g);
  var f = new Array();
  for(i=num;i<num2+1;i++){
   list[i] = list[i]
//   .replace(/(\{\{|\}\})/g,"");
//   .replace(/(review|\|)/g,"");
     .substring(7,list[i].length-1);
   f[i]=document.createElement("IFRAME");
   f[i].src=mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"/index.php?title=Wikipedia:Peer review/"+list[i]+"&action=edit";
//   alert(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"/index.php?title=Wikipedia:Peer review/"+list[i]+"&action=edit"); //debugging temporary
   document.body.appendChild(f[i]);
  }
// }
}

function askAddMsg(){
	x = prompt("Indicate range of PRs to add message, using comma, like 1,20", "1,10");
        x = x.split(",");
	addMsg(parseInt(x[0]),parseInt(x[1]));
}
addOnloadHook(function () {
        if(wgPageName == "Wikipedia:Peer_review" && document.location.href.indexOf("action=edit") != -1)
     mw.util.addPortletLink("p-cactions", "javascript:askAddMsg()", "Add notices", "ca-addMsg", "Goes through articles, add little notices regarding auto-PRs", "", "");
});