User:JJPMaster/superCoordInserterPref.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes.A guideto help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at theappropriate village pump. This codewillbe executed when previewing this page. |
Documentation for thisuser scriptcan be added atUser:JJPMaster/superCoordInserterPref. |
mw.loader.load(`/w/index.php?title=User:${mw.config.get("wgUserName")}/SCIpref.js&action=raw&ctype=text/javascript`);
$(function(){
if(mw.config.get("wgPageName").toLowerCase()=="user:jjpmaster/supercoordinserter/preferences"){
document.title="SuperCoordInserter Preferences -"+mw.config.get("wgSiteName");
document.getElementById("firstHeading").innerText="SuperCoordInserter Preferences";
document.getElementById("bodyContent").innerHTML="<p>Loading...</p>"
setTimeout(()=>{
document.getElementById("bodyContent").innerHTML=`<p>Below, enter the amount of time (in seconds) that you want the script to wait before updating the page. <br/><b>Current:${myDelay}</b></p>
<form id= "SCIform" >
<label for= "fname" ></label><br>
<input type= "text" id= "delay" name= "delay" value= "${myDelay}"><br>
<input type= "submit" value= "Submit" >
</form>
`;
document.getElementById("SCIform").addEventListener("submit",(e)=>{
e.preventDefault();
vartime=document.getElementById("delay").value;
varparams={
action:'edit',
title:`User:${mw.config.get("wgUserName")}/SCIpref.js`,
text:`var myDelay =${time};`,
summary:'Set [[User:JJPMaster/superCoordInserter]] preferences',
format:'json'
},
api=newmw.Api();
api.postWithToken('csrf',params).done(function(data){
console.log(data);
});
});
},2000);
}
});