X-Git-Url: http://cgit.babelmonkeys.de/?p=adhocweb.git;a=blobdiff_plain;f=js%2Fmain.js;h=188dfc762eda4af93e1ac45659c9671bf8046d5f;hp=4db92c80f4e46782625b3601869a4e202f667de9;hb=e3f2eb03a5f4dc014e034cdfc65a572544421336;hpb=35279be3c7092dd6dc33e03ca5f09c01670a581e diff --git a/js/main.js b/js/main.js index 4db92c8..188dfc7 100644 --- a/js/main.js +++ b/js/main.js @@ -1,5 +1,5 @@ var BOSH_SERVICE = 'http://localhost:5280/http-bind/'; -var show_log = false; +var show_log = true; Strophe.addNamespace("ADHOC", "http://jabber.org/protocol/commands"); @@ -88,7 +88,7 @@ function addForm(elem, x) { item = $("").attr("readonly",true); break; case "jid-multi": - item = $(""); + item = $(""); break; case "jid-single": item = $(""); @@ -143,7 +143,7 @@ function addForm(elem, x) { } function serializeToDataform(form, st) { - st.c("x", {"xmlns":"jabber:x:data", "type": "submit"}); + st.c("x", {"xmlns": "jabber:x:data", "type": "submit"}); $(form).find(".df-item").each(function(){ st.c("field", {"var": $(this).attr("name")}); if (this.nodeName.toLowerCase() == "select" && this.multiple) { @@ -260,15 +260,20 @@ function getCommandNodes() { function checkFeatures() { featureIQ = $iq({ type: "get", to: queryJID, id: "features1" }).c("query", {xmlns: Strophe.NS.DISCO_INFO}); - connection.sendIQ(featureIQ, function(result) { - if ($(result).find("feature[var='" + Strophe.NS.ADHOC + "']").length > 0) { - $('#output').append("
This entitiy does support AdHoc commands
"); - } else { - $('#output').append("This entitiy does NOT support AdHoc commands
"); - } - }); $('#output').empty(); - getCommandNodes(); + connection.sendIQ(featureIQ, + function(result) { /* Callback */ + if ($(result).find("feature[var='" + Strophe.NS.ADHOC + "']").length > 0) { + $('#output').append("This entitiy does support AdHoc commands
"); + getCommandNodes(); + } else { + $('#output').append("This entitiy does NOT support AdHoc commands
"); + } + }, + function(result) { /* Errback */ + $('#output').append("Couldn't get list of supported features
"); + } + ); } function showConnect() { @@ -334,9 +339,8 @@ $(document).ready(function () { }); }); -onunload = function() { +window.onunload = window.onbeforeunload = function() { if (connection) { connection.disconnect(); } } -