Bugfix in show and moved setup code to init method
This commit is contained in:
parent
29c275bb93
commit
f2ae33d47c
54
converse.js
54
converse.js
@ -540,7 +540,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
show: function () {
|
show: function () {
|
||||||
if (this.$el.is(':visible')) {
|
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
|
||||||
return this.focus();
|
return this.focus();
|
||||||
}
|
}
|
||||||
this.$el.css({'opacity': 0, 'display': 'inline'}) .animate({opacity: '1'}, 200);
|
this.$el.css({'opacity': 0, 'display': 'inline'}) .animate({opacity: '1'}, 200);
|
||||||
@ -1912,30 +1912,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Event handlers
|
xmppchat.init = function () {
|
||||||
// --------------
|
|
||||||
$(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.connection = connection;
|
this.connection = connection;
|
||||||
this.connection.xmlInput = function (body) { console.log(body); };
|
this.connection.xmlInput = function (body) { console.log(body); };
|
||||||
this.connection.xmlOutput = function (body) { console.log(body); };
|
this.connection.xmlOutput = function (body) { console.log(body); };
|
||||||
@ -1982,6 +1959,33 @@
|
|||||||
this.xmppstatus.initStatus();
|
this.xmppstatus.initStatus();
|
||||||
}, this));
|
}, this));
|
||||||
this.$feedback.text('Online Contacts');
|
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));
|
}, this));
|
||||||
}, xmppchat));
|
}, xmppchat));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user