User:Luk/prodExpired.js

//This file is released under GFDL.

addOnloadHook(function { //check if called from deletion request  if (wgAction == "delete")  {    if (document.URL.lastIndexOf("&fakeaction=expiredprod") == -1)      return; // grab reason   var reason = getURLParam("prodreason");      var t = document.getElementById('wpReason');      t.value = reason;  }

if (document.getElementById("raw-delete-reason")) { addPortletLink("p-cactions", "javascript:prodTab", "Delete prod", "prod0", "prod an expired article", ""); } }); function prodTab { var reason = document.getElementById("raw-delete-reason").innerHTML;  var title = wgPageName.replace("&", "%26").replace("+", "%2B").replace("?", "%3F").replace("=", "%3D");  location.assign("/w/index.php?title=" + title+ "&action=delete&fakeaction=expiredprod&prodreason="+escape(reason)); }

function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; }   }  }  return unescape(strReturn); }

//End db script //