X-Git-Url: http://cgit.babelmonkeys.de/?p=adhocweb.git;a=blobdiff_plain;f=js%2Fmain.js;h=4cff25caf4b3a5e62fc7acbf1ae133f656cb383e;hp=2cf542ec2cadb8c251f54a8fa790a6c945b68b7b;hb=eab81f9e4afd38c8390745449865185e9637c830;hpb=1886915ac6353cf32210666f69ef4a8ede39a04c diff --git a/js/main.js b/js/main.js index 2cf542e..4cff25c 100644 --- a/js/main.js +++ b/js/main.js @@ -1,9 +1,13 @@ var BOSH_SERVICE = 'http://localhost:5280/http-bind/'; +var show_log = false; Strophe.addNamespace("ADHOC", "http://jabber.org/protocol/commands"); var localJID = null; var connection = null; +var sessionid = null; +var cmdNode = null; +var queryJID = null; function log(msg) { var entry = $('
').append(document.createTextNode(msg)); @@ -36,59 +40,200 @@ function onConnect(status) { } } else if (status == Strophe.Status.CONNECTED) { log('Strophe is connected.'); + queryJID = connection.domain; + $('#query').show(); checkFeatures(); } } +function addNote(elem, text, type) { + if (!type) { + type = "info"; + } + $(elem).append("

" + text + "

"); +} + +function addForm(elem, x) { + var form = $("
"); + form.submit(function(event){event.preventDefault();}); + var fieldset = $("
"); + form.append(fieldset); + if ($(x).find("title").length > 0) + $("").text($(x).find("title").text()).appendTo(fieldset); + if ($(x).find("instructions").length > 0) + $("

").text($(x).find("instructions").text()).appendTo(fieldset); + $(x).find("field").each(function(){ + var item = null; + var type = $(this).attr("type"); + if($(this).attr("label")) { + $("