User:ZooFari/sand.js

//

// NowCommonsReview tagger function NowCommonsReview (autosave){ var needAppend=document.editform.wpTextbox1.value; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/({{(N|n|db-n|Db-n)ow(C|c)ommons([^\}]*?))}}/g, '$1|reviewer=' + wgUserName + '}}');

document.editform.wpSummary.value = 'NowCommons review done (using nowcommonsreviewer)'; document.editform.wpMinoredit.checked = true; if (autosave) document.editform.submit; }

//stolen shamelessly and modified from the add 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 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 == 2, buttonLocation); }

addImageFunction("NowCommonsReview", "Review ok3", "top");

//Credits: Copy of http://commons.wikimedia.org/wiki/User:ZooFari/licensereviewer.js that credits: Flickrreview script was initially developed by Patstuart. Most portions of this script //are derived from the Flickreview script and template.

//