diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-02-24 09:33:18 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-02-24 09:33:18 +0100 |
commit | ffc2d09cb4b739e77579cc172adcf859df12f4ab (patch) | |
tree | 392fdb55be67d66e425d03e8241aa7af36391b37 /program/js | |
parent | 63cf4fc823b10212663361d2ede0a82f3ccc8e30 (diff) |
Remove UI messages from the DOM after hide/fadeOut
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/program/js/app.js b/program/js/app.js index 65ad8a3c3..8992c7975 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -5567,14 +5567,15 @@ function rcube_webmail() if (!this.gui_objects.message) return; - var k, n, i, msg, m = this.messages; + var k, n, i, o, m = this.messages; // Hide message by object, don't use for 'loading'! if (typeof obj === 'object') { - $(obj)[fade?'fadeOut':'hide'](); - msg = $(obj).data('key'); - if (this.messages[msg]) - delete this.messages[msg]; + o = $(obj); + k = o.data('key'); + this.hide_message_object(o, fade); + if (m[k]) + delete m[k]; } // Hide message by id else { @@ -5584,7 +5585,7 @@ function rcube_webmail() m[k].elements.splice(n, 1); // hide DOM element if last instance is removed if (!m[k].elements.length) { - m[k].obj[fade?'fadeOut':'hide'](); + this.hide_message_object(m[k].obj, fade); delete m[k]; } // set pending action label for 'loading' message @@ -5605,6 +5606,15 @@ function rcube_webmail() } }; + // hide message object and remove from the DOM + this.hide_message_object = function(o, fade) + { + if (fade) + o.fadeOut(600, function() {$(this).remove(); }); + else + o.hide().remove(); + }; + // remove all messages immediately this.clear_messages = function() { @@ -5617,7 +5627,7 @@ function rcube_webmail() for (k in m) for (n in m[k].elements) if (m[k].obj) - m[k].obj.hide(); + this.hide_message_object(m[k].obj); this.messages = {}; }; |