User:Rutilant/Sandbox/Tests.js

function purgeUserpage{ new mw.Api.postWithToken("csrf", {action: 'edit', title: 'User:RainFall', text: '', summary: "Auto purge"}); logs.innerHTML="Re-adding content in 5 secs... Clearing userpage... "+logs.innerHTML; setTimeout('continuePurge',5000);} function continuePurge{ new mw.Api.postWithToken("csrf", {action: 'edit', title: 'User:RainFall', text: '\n\n', summary: "Auto purge"}); logs.innerHTML="Content added. "+logs.innerHTML; } function showit{ $("#RainFallHiddenstuff").fadeToggle(400); } addOnloadHook(function {    mw.util.addPortletLink("p-cactions", "javascript:showit", "Show stuffs"); });

function clearSandbox{ value=""; new mw.Api.postWithToken("csrf", {action: 'edit', title: 'Wikipedia:Sandbox', text: value, summary: "Clearing the sandbox (UserScript)"}); logs.innerHTML="Sandbox cleared! "+logs.innerHTML; } function editpagea{ var radios="none"; if (NameA.value==""){ alert("Empty article name!\n Stoping..."); }else{ var tr=document.getElementById("1c"); if (tr.checked){ radios="one";} var tr2=document.getElementById("2c"); if (tr2.checked){ radios="two";} if (radios=="none"){ alert("No option selected!\n Stoping..."); }else{ if (radios=="one"){ if (confirm('Sure to edit/create "'+NameA.value+'" with '+Values.value+'?')){ new mw.Api.postWithToken("csrf", {action: 'edit', title: NameA.value, text: Values.value, summary: "Edited - (using a UserScript)"}); mw.notify('ScriptEditor - Completed'); logs.innerHTML="Edited "+NameA.value+"... "+logs.innerHTML; }	}else{ /////////////////////Testing/////////////////////////// if (confirm('Sure to add '+Values.value+' at the last of the page "'+NameA.value+'"?')){ // There's an easier way to do it; I'd done it on test.wikipedia.org and soon will bring 'em... // //	new mw.Api.postWithToken("csrf", {action: 'edit', title: NameA.value, text: Values.value, summary: "Edited - (using a UserScript)"}); mw.notify('ScriptEditor - Failed');

}	} } }}

function UpdateNew(whatnew){ status(whatnew); logs.innerHTML="Status updated - "+whatnew+" "+logs.innerHTML; } if (location.href=="https://en.wikipedia.org/wiki/User:RainFall/Sandbox/ScriptArea"){ if (wgUserName=="RainFall"){ plus=" Edit   Caution! You take full responsibility for your actions done from here!  "; plus=plus+"Article name -  Text -  Replace All  Add at last "; plus=plus+" "; plus=plus+" "; Texts.innerHTML="Welcome RainFall! Status     Other  "+plus+"  Logs  "; }}