Commit 7903c036 authored by JC Brand's avatar JC Brand

Add a hide method and call that instead

Inside this method we can then check if animations are turned on.
parent 1cfbe0cc
...@@ -489,7 +489,7 @@ ...@@ -489,7 +489,7 @@
initialize: function (){ initialize: function (){
this.model.messages.on('add', this.showMessage, this); this.model.messages.on('add', this.showMessage, this);
this.model.on('show', this.show, this); this.model.on('show', this.show, this);
this.model.on('destroy', function (model, response, options) { this.$el.hide('fast'); }, this); this.model.on('destroy', this.hide, this);
this.model.on('change', this.onChange, this); this.model.on('change', this.onChange, this);
this.$el.appendTo(xmppchat.chatboxesview.$el); this.$el.appendTo(xmppchat.chatboxesview.$el);
...@@ -539,6 +539,14 @@ ...@@ -539,6 +539,14 @@
return this; return this;
}, },
hide: function () {
if (xmppchat.animate) {
this.$el.hide('fast');
} else {
this.$el.hide();
}
},
show: function () { show: function () {
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
return this.focus(); return this.focus();
...@@ -750,13 +758,8 @@ ...@@ -750,13 +758,8 @@
}, this)); }, this));
this.model.on('show', this.show, this); this.model.on('show', this.show, this);
this.model.on('destroy', $.proxy(function (model, response, options) { this.model.on('destroy', this.hide, this);
this.$el.hide('fast'); this.model.on('hide', this.hide, this);
}, this));
this.model.on('hide', $.proxy(function (model, response, options) {
this.$el.hide('fast');
}, this));
if (this.model.get('visible')) { if (this.model.get('visible')) {
this.show(); this.show();
} }
...@@ -1064,7 +1067,7 @@ ...@@ -1064,7 +1067,7 @@
xmppchat.getVCard( xmppchat.getVCard(
partner_jid, partner_jid,
$.proxy(function (jid, fullname, image, image_type, url) { $.proxy(function (jid, fullname, image, image_type, url) {
chatbox = this.create({ var chatbox = this.create({
'id': jid, 'id': jid,
'jid': jid, 'jid': jid,
'fullname': fullname, 'fullname': fullname,
...@@ -1093,7 +1096,7 @@ ...@@ -1093,7 +1096,7 @@
initialize: function () { initialize: function () {
// boxesviewinit // boxesviewinit
this.views = {}; this.views = {};
this.options.model.on("add", function (item) { this.model.on("add", function (item) {
var view = this.views[item.get('id')]; var view = this.views[item.get('id')];
if (!view) { if (!view) {
if (item.get('chatroom')) { if (item.get('chatroom')) {
......
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