From 680548612c8e484ed28dae9bfd2ba809c5750504 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 23 Jan 2014 00:33:55 +0200 Subject: [PATCH] Make controlbox appear in a smoother fashion in webkit when clicking the controlbox toggle --- converse.js | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/converse.js b/converse.js index cec0cdc27..6819c3076 100644 --- a/converse.js +++ b/converse.js @@ -1631,7 +1631,6 @@ hide: function (callback) { this.$el.hide('fast', function () { converse.controlboxtoggle.show(function () { - converse.refresh(); if (typeof callback === "function") { callback(); } @@ -1640,23 +1639,21 @@ }, show: function () { - converse.controlboxtoggle.hide(); - if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { - return; - } - if (converse.animate) { - this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, function () { - converse.refresh(); - }); - } else { - this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refresh(); - } - if (converse.connection) { - // Without a connection, we haven't yet initialized - // localstorage - this.model.save(); - } - converse.emit('onControlBoxOpened', this); + converse.controlboxtoggle.hide($.proxy(function () { + if (converse.animate) { + this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, function () { + converse.refresh(); + }); + } else { + this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refresh(); + } + if (converse.connection) { + // Without a connection, we haven't yet initialized + // localstorage + this.model.save(); + } + converse.emit('onControlBoxOpened', this); + }, this)); return this; },