Commit f2ae33d4 authored by JC Brand's avatar JC Brand

Bugfix in show and moved setup code to init method

parent 29c275bb
......@@ -540,7 +540,7 @@
},
show: function () {
if (this.$el.is(':visible')) {
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
return this.focus();
}
this.$el.css({'opacity': 0, 'display': 'inline'}) .animate({opacity: '1'}, 200);
......@@ -1912,30 +1912,7 @@
}
};
// Event handlers
// --------------
$(document).ready($.proxy(function () {
var chatdata = $('div#collective-xmpp-chat-data'),
$toggle = $('a#toggle-online-users');
this.$feedback = $('.conn-feedback');
this.fullname = chatdata.attr('fullname');
this.prebind = chatdata.attr('prebind');
this.auto_subscribe = chatdata.attr('auto_subscribe') === "True" || false;
this.chatboxes = new this.ChatBoxes();
this.chatboxesview = new this.ChatBoxesView({model: this.chatboxes});
$toggle.bind('click', $.proxy(function (e) { e.preventDefault(); this.toggleControlBox(); }, this));
$(document).bind('jarnxmpp.connecting', $.proxy(function (ev, conn) {
this.$feedback.text('Connecting to chat...');
}, this));
$(document).bind('jarnxmpp.disconnected', $.proxy(function (ev, conn) {
this.$feedback.text('Unable to communicate with chat server').css('background-image', "url(images/error_icon.png)");
console.log("Connection Failed :(");
}, this));
$(document).unbind('jarnxmpp.connected');
$(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) {
xmppchat.init = function () {
this.connection = connection;
this.connection.xmlInput = function (body) { console.log(body); };
this.connection.xmlOutput = function (body) { console.log(body); };
......@@ -1982,6 +1959,33 @@
this.xmppstatus.initStatus();
}, this));
this.$feedback.text('Online Contacts');
};
// Event handlers
// --------------
$(document).ready($.proxy(function () {
var chatdata = $('div#collective-xmpp-chat-data'),
$toggle = $('a#toggle-online-users');
this.$feedback = $('.conn-feedback');
this.fullname = chatdata.attr('fullname');
this.prebind = chatdata.attr('prebind');
this.auto_subscribe = chatdata.attr('auto_subscribe') === "True" || false;
this.chatboxes = new this.ChatBoxes();
this.chatboxesview = new this.ChatBoxesView({model: this.chatboxes});
$toggle.bind('click', $.proxy(function (e) { e.preventDefault(); this.toggleControlBox(); }, this));
$(document).bind('jarnxmpp.connecting', $.proxy(function (ev, conn) {
this.$feedback.text('Connecting to chat...');
}, this));
$(document).bind('jarnxmpp.disconnected', $.proxy(function (ev, conn) {
this.$feedback.text('Unable to communicate with chat server').css('background-image', "url(images/error_icon.png)");
console.log("Connection Failed :(");
}, this));
$(document).unbind('jarnxmpp.connected');
$(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) {
this.init();
}, this));
}, xmppchat));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment