function ASEN_OneLineRequestGETorPOST()
{
var http = new XMLHttpRequest();
if(! http) { alert("Something went awry"); return; }
var params = new Array();
params.push( "PokeDiv=" + encodeURIComponent("myTestDiv") );
params.push( "bbcolor=" + encodeURIComponent("#cccccc") );
http.onreadystatechange = function()
{
if(http.readyState == 4)
{
if(http.status == 200)
{
document.getElementById("myTestDiv").innerHTML=http.responseText;
setTimeout(ASEN_GetNotepadContent,1000);
}
else { alert("Something went awry. Status code: "+http.status+" "+http.statusText); }
}
}
http.open("POST","https://www.willmaster.com/possibilities/testing/notepad.php",true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send(params.join("&"));
} // function ASEN_OneLineRequestGETorPOST()
var ASEN_Seconds = 7;
var ASEN_CountdownSeconds = 0;
var ASEN_CountdownTimer = false;
function ASEN_PostStatus(s) { document.getElementById("auto-save_notepad-status_area").innerHTML = s; }
function ASEN_FormatText(cmd,value) { document.execCommand(cmd,false,value); }
function ASEN_StartCountdown()
{
if(ASEN_CountdownTimer) { clearInterval(ASEN_CountdownTimer); }
ASEN_CountdownSeconds = ASEN_Seconds;
ASEN_CountdownTimer = setInterval(ASEN_AdjustCountdown,1000);
ASEN_PostStatus('
'+ASEN_CountdownSeconds+'
');
}
function ASEN_AdjustCountdown()
{
if(ASEN_CountdownSeconds>0)
{
ASEN_CountdownSeconds--;
ASEN_PostStatus(''+ASEN_CountdownSeconds+'
');
}
if(ASEN_CountdownSeconds<1) { ASEN_SaveNotes(); }
}
function ASEN_SaveNotes()
{
clearInterval(ASEN_CountdownTimer);
if(ASEN_CountdownSeconds<0) { return; }
ASEN_CountdownSeconds = -1;
var http = new XMLHttpRequest();
if(! http) { alert("Something went awry, probably temporarily."); return; }
ASEN_PostStatus('saving…
');
http.onreadystatechange = function()
{
if(http.readyState == 4)
{
if(http.status == 200) { ASEN_PostStatus('saved
'); }
else { alert("Unable to save note.\n"+http.statusText); }
}
}
http.open("POST","https://www.willmaster.com/possibilities/testing/notepad.php",true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send("note="+encodeURIComponent(document.getElementById("auto-save_notepad-content").innerHTML));
}
function ASEN_GetNotepadContent()
{
var http = new XMLHttpRequest();
if(! http) { alert("Something went awry, probably temporarily."); return; }
http.onreadystatechange = function()
{
if(http.readyState == 4)
{
if(http.status == 200) { document.getElementById("auto-save_notepad-content").innerHTML = http.responseText; }
else { alert("Unable to find previously-saved note.\n"+http.statusText); }
}
}
http.open("GET","https://www.willmaster.com/possibilities/testing/notepad.php?content=1",true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send("");
}
ASEN_OneLineRequestGETorPOST();