Skip to content
Snippets Groups Projects
Commit 9ac4bcaa authored by echicken's avatar echicken
Browse files

Asynchronously load onelinerz so that bbs-scene slowness won't affect the...

Asynchronously load onelinerz so that bbs-scene slowness won't affect the loading of the rest of the page.
(Updated documentation; name of sidebar module script must be supplied for this to work.)
parent 3263a8f2
No related branches found
No related tags found
No related merge requests found
// bbs-scene.org global onelinerz for ecweb
// echicken -at- bbs.electronicchicken.com
var scriptname = "onelinerz.ssjs";
if(http_request.query.hasOwnProperty('action') && http_request.query.action == 'showOnelinerz') {
load("http.js"); load("http.js");
var f = new File(system.ctrl_dir + "modopts.ini"); var f = new File(system.ctrl_dir + "modopts.ini");
...@@ -23,10 +28,22 @@ print("<b>BBS-Scene.org Global Onelinerz</b><br><br>"); ...@@ -23,10 +28,22 @@ print("<b>BBS-Scene.org Global Onelinerz</b><br><br>");
var n = 0; var n = 0;
for(var o in onelinerz) { for(var o in onelinerz) {
if(n % 2 == 0) if(n % 2 == 0)
print("<div style='padding:5px;background-color:#585858;color:#FFFFFF;'>"); print("<div style='padding:5px;background-color:#000060;color:#FFFFFF;word-wrap:break-word;'>");
else else
print("<div style='padding:5px;background-color:#2E2E2E;color:#FFFFFF;'>"); print("<div style='padding:5px;background-color:#000080;color:#FFFFFF;word-wrap:break-word;'>");
print("<b>" + onelinerz[o].alias + "@" + onelinerz[o].bbsname + "</b>:<br>" + onelinerz[o].oneliner); print("<b>" + onelinerz[o].alias + "@" + onelinerz[o].bbsname + "</b>:<br>" + onelinerz[o].oneliner);
print("</div>"); print("</div>");
n++; n++;
} }
} else {
print("<div id='bbssceneonelinerz'></div>");
print("<script type='text/javascript'>");
print("function xhrbbssceneonelinerz() {");
print("var XMLReq = new XMLHttpRequest();");
print("XMLReq.open('GET', './sidebar/" + scriptname + "?action=showOnelinerz', true);");
print("XMLReq.send(null);");
print("XMLReq.onreadystatechange = function() { if(XMLReq.readyState == 4) { document.getElementById('bbssceneonelinerz').innerHTML = XMLReq.responseText; } }");
print("}");
print("xhrbbssceneonelinerz();");
print("</script>");
}
\ No newline at end of file
...@@ -96,7 +96,8 @@ onelinerz.ssjs ...@@ -96,7 +96,8 @@ onelinerz.ssjs
Users of ecWeb can copy 'onelinerz.ssjs' into the sidebar/ directory of their Users of ecWeb can copy 'onelinerz.ssjs' into the sidebar/ directory of their
ecWeb installation. Prepending a string of digits to the filename (eg. ecWeb installation. Prepending a string of digits to the filename (eg.
renaming it to "005-onelinerz.ssjs") will affect the order in which it is renaming it to "005-onelinerz.ssjs") will affect the order in which it is
loaded into the sidebar. loaded into the sidebar. If you rename the file, edit the "scriptname"
variable at the top of the script to reflect the new filename.
Users of the default or custom web interfaces may be able to add the command: Users of the default or custom web interfaces may be able to add the command:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment