~qeef/damn-client.js

54fd1f4352f452d3d04ebe3bc6c36887ba207bdc — Jiri Vlasak 3 months ago f33dba2
Fix aid in url
2 files changed, 22 insertions(+), 19 deletions(-)

M static/chat.js
M static/index.html
M static/chat.js => static/chat.js +20 -18
@@ 33,32 33,34 @@ function html_chat()
    ih += "<input id='chat_msg' type='text' onkeypress='send_msg(event)' />";
    return ih;
}
function update_chat_nav(li)
function update_chat_nav(aid)
{
    var nl = {};
    nl["all"] = 0;
    for (var k in li) {
        nl[li[k]["aid"] + ": " + li[k]["tags"]] = li[k]["aid"];
    return function(li) {
        var nl = {};
        nl["all"] = 0;
        for (var k in li) {
            nl[li[k]["aid"] + ": " + li[k]["tags"]] = li[k]["aid"];
        }
        var nav_links = {
            "&lt;- list": "javascript:go_to(\"list\")",
        };
        if (!api.token()) nav_links["authenticate"] = "javascript:api.auth()";
        var ih = "";
        ih += html_menu(nav_links);
        ih += "chat within area ";
        ih += html_option_list(nl, "chat_within", null);
        up("chat_nav", ih);
        if (aid) {
            document.getElementById("chat_within").value = aid;
        }
    }
    var nav_links = {
        "&lt;- list": "javascript:go_to(\"list\")",
    };
    if (!api.token()) nav_links["authenticate"] = "javascript:api.auth()";
    var ih = "";
    ih += html_menu(nav_links);
    ih += "chat within area ";
    ih += html_option_list(nl, "chat_within", null);
    up("chat_nav", ih);
}
function show_chat(aid=false)
{
    up("damn_main", html_chat());
    api.get_areas(update_chat_nav),
    api.get_areas(update_chat_nav(aid)),
    add_hist("chat", link_to("chat", aid));
    chat_size();
    if (aid) {
        document.getElementById("chat_within").value = aid;
    }
}
function chat_size()
{

M static/index.html => static/index.html +2 -1
@@ 89,7 89,8 @@ SOFTWARE.
            else
                return go_to("stats", sp.get("stats"));
        } else if (sp.has("chat")) {
            return go_to("chat", (sp.get("chat")==="") ? false : sp.get("chat"));
            var aid = (sp.get("chat")==="") ? false : sp.get("chat");
            return go_to("chat", aid);
        }
        return go_to("list");
    }