var ASEN_Seconds_MYKEY_toolnotes = 12; var ASEN_CountdownSeconds_MYKEY_toolnotes = 0; var ASEN_CountdownTimer_MYKEY_toolnotes = false; function ASEN_DisplayStatus_MYKEY_toolnotes(which) { let d = document.getElementById("auto-save_notepad-status_area_N1741"); switch(which) { case "saving" : d.src="https://tools.bontragerconnection.com/notepad/NOTES-Saving.png"; break; case "saved" : d.src="https://tools.bontragerconnection.com/notepad/NOTES-Saved.png"; break; case "save" : d.src="https://tools.bontragerconnection.com/notepad/NOTES-SAVE.png"; break; default: d.src="https://tools.bontragerconnection.com/notepad/NOTES-blank.png"; } } function ASEN_OneLineRequestGETorPOST_MYKEY_toolnotes() { var http = new XMLHttpRequest(); if(! http) { alert("Something is awry at the destination server. We hope this is temporary."); return; } var params = new Array(); params.push( "PokeDiv=" + encodeURIComponent("N1741") ); params.push( "bbcolor=" + encodeURIComponent("#ccc") ); params.push( "act=" + encodeURIComponent("MYKEY") ); params.push( "pad=" + encodeURIComponent("toolnotes") ); params.push( "div=" + encodeURIComponent("N1741") ); params.push( "url=" + encodeURIComponent(document.URL) ); params.push( "ip=" + encodeURIComponent("18.117.137.117") ); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { document.getElementById("N1741").innerHTML=http.responseText; setTimeout(ASEN_GetNotepadContent_MYKEY_toolnotes,500); } else { alert("Something is awry at the destination server -- we hope this is temporary. Status code: "+http.status+" "+http.statusText); } } } http.open("POST","https://tools.bontragerconnection.com/notepad/bcnotepad.php",true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.send(params.join("&")); } function ASEN_PostStatus_MYKEY_toolnotes(s) { document.getElementById("auto-save_notepad-status_area_N1741").innerHTML = s; } function ASEN_FormatText_MYKEY_toolnotes(cmd,value) { document.execCommand(cmd,false,value); ASEN_StartCountdown_MYKEY_toolnotes(); } function ASEN_StartCountdown_MYKEY_toolnotes() { ASEN_DisplayStatus_MYKEY_toolnotes("save"); if(ASEN_CountdownTimer_MYKEY_toolnotes) { clearInterval(ASEN_CountdownTimer_MYKEY_toolnotes); } ASEN_CountdownSeconds_MYKEY_toolnotes = ASEN_Seconds_MYKEY_toolnotes; ASEN_CountdownTimer_MYKEY_toolnotes = setInterval(ASEN_AdjustCountdown_MYKEY_toolnotes,1000); ASEN_PostStatus_MYKEY_toolnotes('
'+ASEN_CountdownSeconds_MYKEY_toolnotes+'
'); } function ASEN_AdjustCountdown_MYKEY_toolnotes() { if(ASEN_CountdownSeconds_MYKEY_toolnotes>0) { ASEN_CountdownSeconds_MYKEY_toolnotes--; ASEN_PostStatus_MYKEY_toolnotes('
'+ASEN_CountdownSeconds_MYKEY_toolnotes+'
'); } if(ASEN_CountdownSeconds_MYKEY_toolnotes<1) { ASEN_SaveNotes_MYKEY_toolnotes(); } } function ASEN_SaveNotes_MYKEY_toolnotes() { clearInterval(ASEN_CountdownTimer_MYKEY_toolnotes); if(ASEN_CountdownSeconds_MYKEY_toolnotes<0) { return; } ASEN_CountdownSeconds_MYKEY_toolnotes = -1; var http = new XMLHttpRequest(); if(! http) { alert("Something went awry, probably temporarily."); return; } ASEN_DisplayStatus_MYKEY_toolnotes("saving"); var params = new Array(); params.push( "note=" + encodeURIComponent(document.getElementById("auto-save_notepad-content_N1741").innerHTML) ); params.push( "act=" + encodeURIComponent("MYKEY") ); params.push( "pad=" + encodeURIComponent("toolnotes") ); params.push( "div=" + encodeURIComponent("N1741") ); params.push( "url=" + encodeURIComponent(document.URL) ); params.push( "ip=" + encodeURIComponent("18.117.137.117") ); ASEN_PostStatus_MYKEY_toolnotes('
saving…
'); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { ASEN_DisplayStatus_MYKEY_toolnotes("saved"); } else { alert("Unable to save note. We hope this is temporary.\n"+http.statusText); } } } http.open("POST","https://tools.bontragerconnection.com/notepad/bcnotepad.php",true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.send(params.join("&")); } function ASEN_GetNotepadContent_MYKEY_toolnotes() { var http = new XMLHttpRequest(); if(! http) { alert("Something is awry at the destination server; we hope this is temporary."); return; } var params = new Array(); params.push( "content=1"); params.push( "act=" + encodeURIComponent("MYKEY") ); params.push( "pad=" + encodeURIComponent("toolnotes") ); params.push( "div=" + encodeURIComponent("N1741") ); params.push( "url=" + encodeURIComponent(document.URL) ); params.push( "ip=" + encodeURIComponent("18.117.137.117") ); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { document.getElementById("auto-save_notepad-content_N1741").innerHTML = http.responseText; } else { alert("Unable to find previously-saved note.\n"+http.statusText); } } } http.open("POST","https://tools.bontragerconnection.com/notepad/bcnotepad.php",true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.send(params.join("&")); } ASEN_OneLineRequestGETorPOST_MYKEY_toolnotes();