//<nowiki>
// addPDrOK tagger (initially developed by Rambo's Revenge)
function PDrOK (autosave){
var needAppend=document.editform.wpTextbox1.value;
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/([[Category:PD files for review]])/g, '{{PDreview|' + wgUserName + '|{{subst:#time:Y-m-d}}}}');
if (needAppend==document.editform.wpTextbox1.value)
document.editform.wpTextbox1.value+='{{flickrreview|' + wgUserName + '|{{subst:#time:Y-m-d}}}}'
document.editform.wpSummary.value = '[[Commons:PD files|PD review]] passed (using [[Commons:PD files/reviewers|PDreview script]])';
document.editform.wpMinoredit.checked = true;
if (autosave)
document.editform.submit();
}
// PD _copyvio tagger (initially developed by Rambo's Revenge)
function PD _copyvio(autosave){
document.editform.wpTextbox1.value = "{{Copyvio|PD review NOT passed: Image is not in public domain.}} ~~~~\n" + document.editform.wpTextbox1.value.replace(/([[Category:PD files for review]])/g, "");
document.editform.wpSummary.value = '[[Commons:PD files|PD review]] failed; marked as copyvio (using [[Commons:PD files/reviewers|PDreview script]])';
document.editform.wpMinoredit.checked = false;
if (autosave)
document.editform.submit();
}
//stolen shamelessly and modified from the add {{information}} template text
function add_toolbox_button(text, _href)
{
var toolbox = document.getElementById ( "p-tb" ) ;
if ( !toolbox )
return ;
var ul = toolbox.getElementsByTagName ( "UL" ) [0] ;
var li = document.createElement ( "LI" ) ;
var a = document.createElement ( "A" ) ;
a.appendChild (document.createTextNode(text));
a.href = _href;
a.className = "external" ;
li.appendChild ( a ) ;
ul.appendChild ( li ) ;
}
//stolen shamelessly and modified from the add {{information}} template text
function add_topbar_button(text, _href)
{
mw.util.addPortletLink("p-cactions", _href, text, "");
}
function addFunction(functionNameString, buttonDisplayName, checkNameSpaceFlag, whereAdd)
{
checkNameSpaceFlag|= (wgPageName=="Commons:Sandbox");
if (!checkNameSpaceFlag)
return;
if (getParamValue('functionName')==functionNameString)
{
addOnloadHook
(
function ()
{
eval(functionNameString+"(true)")
}
);
}
var _href;
if (wgAction=="edit")
_href = "javascript:"+functionNameString+"(true)";
else
_href = wgScript + "?title="+encodeURIComponent(mw.config.get('wgPageName'))+ "&action=edit&functionName="+functionNameString;
if (whereAdd=="top")
addOnloadHook(function (){add_topbar_button(buttonDisplayName, _href);})
else if (whereAdd=="toolbox")
addOnloadHook(function (){add_toolbox_button(buttonDisplayName, _href);})
}
function addImageFunction(functionNameString, buttonDisplayName, buttonLocation)
{
addFunction(functionNameString, buttonDisplayName, wgNamespaceNumber == 6, buttonLocation);
}
addImageFunction("PDrOK", "PD passed", "top");
addImageFunction("PD_copyvio", "PD cv", "top");
//</nowiki>