Bugfix in show and moved setup code to init method

This commit is contained in:
JC Brand 2013-04-14 00:47:18 +02:00
parent 29c275bb93
commit f2ae33d47c

View File

@ -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));