X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit-ng%2Fstatic%2Fjs%2Fmain.js;h=943d7519fdddc5f987664f3e39015de4fae73c83;hb=c2f152e55bce8c5df5e6b57953e602f6cd25d636;hp=cea3df2bde11240d943bb6378e203619aea66025;hpb=44bf4aea855a2526a34fbfc5f431acc748e93ee4;p=citadel.git diff --git a/webcit-ng/static/js/main.js b/webcit-ng/static/js/main.js index cea3df2bd..943d7519f 100644 --- a/webcit-ng/static/js/main.js +++ b/webcit-ng/static/js/main.js @@ -34,12 +34,11 @@ function _(x) { // function randomString(length) { var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz'.split(''); + var str = ''; - if (! length) { + if (!length) { length = Math.floor(Math.random() * chars.length); } - - var str = ''; for (var i = 0; i < length; i++) { str += chars[Math.floor(Math.random() * chars.length)]; } @@ -50,35 +49,35 @@ function randomString(length) { // string escape for html display // function escapeHTML(text) { - 'use strict'; - return text.replace(/[\"&<>]/g, function (a) { - return { - '"': '"', - '&': '&', - '<': '<', - '>': '>' - }[a]; - }); + 'use strict'; + return text.replace(/[\"&<>]/g, function (a) { + return { + '"': '"', + '&': '&', + '<': '<', + '>': '>' + }[a]; + }); } // string escape for html display // function escapeHTMLURI(text) { - 'use strict'; - return text.replace(/./g, function (a) { - return '%' + a.charCodeAt(0).toString(16); - }); + 'use strict'; + return text.replace(/./g, function (a) { + return '%' + a.charCodeAt(0).toString(16); + }); } // string escape for JavaScript string // function escapeJS(text) { - 'use strict'; - return text.replace(/[\"\']/g, function (a) { - return '\\' + a ; - }); + 'use strict'; + return text.replace(/[\"\']/g, function (a) { + return '\\' + a ; + }); } @@ -96,6 +95,7 @@ function ctdl_startup() { request = null; } + // Continuation of ctdl_startup() after serv_info is retrieved // function ctdl_startup_2(data) { @@ -112,6 +112,7 @@ function ctdl_startup_2(data) { display_room_list(); } + // Display a room list in the main div. // function display_room_list() { @@ -128,6 +129,7 @@ function display_room_list() { request = null; } + // Renderer for display_room_list() // function display_room_list_renderer(data) { @@ -151,8 +153,10 @@ function display_room_list_renderer(data) { } new_roomlist_text = new_roomlist_text + "
  • " + + (data[i].hasnewmsgs ? "" : "") + "" + escapeHTML(data[i].name) + + (data[i].hasnewmsgs ? "" : "") + "
  • " ; } @@ -160,6 +164,7 @@ function display_room_list_renderer(data) { document.getElementById("roomlist").innerHTML = new_roomlist_text ; } + // Update the "banner" div with all relevant info. // function update_banner() { @@ -207,8 +212,10 @@ function gotoroom_2(data) { // Goto next room with unread messages +// which_oper is 0=ungoto, 1=skip, 2=goto // -function gotonext() { +function gotonext(which_oper) { + if (which_oper != 2) return; // FIXME implement the other two if (march_list.length == 0) { load_new_march_list(); // we will recurse back here }