User:Lucasbfr/prodExpired.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//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 //