# HG changeset patch # User Emmanuel Gil Peyrot # Date 1316422272 25200 # Node ID f630f4b90564a69f88e70a1b212f909ee4ff7996 # Parent 2e2a2154efbb3a006826d7918d790b15e391d88b Remove the old log system and use console.log instead. diff --git a/blog.js b/blog.js --- a/blog.js +++ b/blog.js @@ -28,31 +28,9 @@ if (params.jid) if (params.node) node = params.node; -var logs = document.getElementById('log'); -if (params.debug) - logs.parentNode.hidden = false; - var received = {}; var messages = document.getElementById('messages'); -function log(msg, error) { - var p = document.createElementNS(ns.xhtml, 'p'); - p.appendChild(document.createTextNode(msg)); - - if (!error) - p.setAttributeNS(null, 'class', 'error'); - - logs.appendChild(p); -} - -function rawInput(data) { - log('RECV: ' + data, 1); -} - -function rawOutput(data) { - log('SENT: ' + data, 1); -} - var html = function(name, id) { return received[name][id].html; } @@ -174,7 +152,6 @@ var parsePubSubEvent = function(stanza) var onMessages = function(stanza) { conn.addHandler(onMessages, null, 'message', null, null, null); - log('message'); stanza = xml2json(stanza); var e = parsePubSubEvent(stanza); @@ -188,14 +165,13 @@ var onMessages = function(stanza) { } var onInfo = function(stanza) { - log('info'); + console.log('info'); // TODO! /*var query = stanza.getElementsByTagNameNS(ns.info, 'query')[0]; var x = query.getElementsByTagNameNS(ns.data, 'x')[0]; var form = forms.parse(x);*/ } var onSubscribed = function(stanza) { - log('subscribed'); var type = stanza.getAttribute('type'); if (type !== 'result') { messages.innerHTML = 'Error, impossible to retrieve messages.'; @@ -204,20 +180,15 @@ var onSubscribed = function(stanza) { } function onConnect(status) { - if (status == Strophe.Status.CONNECTING) { - log('Strophe is connecting.'); - } else if (status == Strophe.Status.CONNFAIL) { - log('Strophe failed to connect.'); - } else if (status == Strophe.Status.AUTHENTICATING) { - log('Strophe is authenticating.'); + if (status == Strophe.Status.CONNFAIL) { + console.log('Failed to connect.'); } else if (status == Strophe.Status.DISCONNECTING) { - log('Strophe is disconnecting.'); + console.log('Disconnecting.'); } else if (status == Strophe.Status.DISCONNECTED) { - log('Strophe is disconnected.'); + console.log('Disconnected.'); if (re) conn.connect(jid, password, onConnect); } else if (status == Strophe.Status.CONNECTED) { - log('Strophe is connected.'); conn.addHandler(onMessages, null, 'message', null, null, null); conn.send($pres().tree()); conn.pubsub.subscribe(jid, service, node, undefined, onMessages, onSubscribed); @@ -225,14 +196,11 @@ function onConnect(status) { conn.pubsub.items(jid, service, node, onMessages); conn.pubsub.info(jid, service, node, onInfo); } - } else - log('Strophe is '+status+'.'); + } } window.addEventListener('load', function () { conn = new Strophe.Connection(BOSH_SERVICE); - conn.rawInput = rawInput; - conn.rawOutput = rawOutput; conn.connect(jid, password, onConnect); }, false); diff --git a/index.xhtml b/index.xhtml --- a/index.xhtml +++ b/index.xhtml @@ -44,11 +44,6 @@
- -