User:Abigor/sandbox.js

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// nld tagger
// Code by [[User:Animum]] (copyvio tagger), adapted by [[user:Pathoschild]]
 
var UrlParameters = new Array ();
 
 function readparams() {
  var asReadInUrlParameters;
  var asReadInUrlParameter;
 
  // Get URL parameters
  asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
  for (i = 0; i < asReadInUrlParameters.length; i++) {
    asReadInUrlParameter = asReadInUrlParameters[i].split("=");
    UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
  }
 }
 
 readparams();
 
if(UrlParameters["action"] == "edit" && UrlParameters["nldtag"] == 1) {
    addOnloadHook(function() {
        document.forms["editform"].wpTextbox1.value += '\{\{subst:nld\}\}';
        document.forms["editform"].wpSummary.value = 'Tagged as missing [[Commons:Licensing|license information]] (using [[User:Foxj/copyvio.js|copyvio]] script)';
        document.forms["editform"].wpMinoredit.checked = true;
        document.forms["editform"].submit();
        if(typeof(user) != 'undefined') window.setTimeout(function() { location.href = wgScript + "?title=User_talk:" + user + "&action=edit&nldtag=1&imagetitle=" + wgPageName; }, 1000);
    });
}
 
if(UrlParameters["action"] == "edit" && UrlParameters["nldtag"] == 1 && wgNamespaceNumber == 3) {
    addOnloadHook(function() {
    	var imagetitle = decodeURIComponent(UrlParameters["imagetitle"].replace(/_/g, " "));
        document.forms["editform"].wpTextbox1.value += "{{subst:Image copyright|" + imagetitle + "|—<small>[[User talk:Pathoschild/s|Pathoschild]] 21:12:46, 10 January 2009 (UTC)</small> 21:12, 10 January 2009 (UTC)}}";
        document.forms["editform"].wpSummary.value = 'note: page tagged as missing [[Commons:Licensing|license information]] (using [[User:Foxj/copyvio.js|copyvio]] script)';
        document.forms["editform"].wpMinoredit.checked = true;
        document.forms["editform"].submit();
    });
}
 
$(function() {
    if(wgNamespaceNumber == 6 && !UrlParameters["nldtag"]) mw.util.addPortletLink("p-cactions", wgScript + "?title=" + wgPageName + "&action=edit&nldtag=1", "nld", "ca-nld");
});
 
//<nowiki>