diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-06-02 15:45:41 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-06-02 15:45:41 +0200 |
commit | cf22cea74a79cb443e36ccb8b21355f4725c5cfd (patch) | |
tree | b9c5243131aefa712d7fe132e92e916c72ec498f /program/js/app.js | |
parent | 5c1bbffd7229ff27bf41f2568d0b46cc5a93c461 (diff) |
Code improvements, removed redundant hasClass() calls
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/program/js/app.js b/program/js/app.js index cd0737e6d..d2bd0aa29 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2634,16 +2634,10 @@ function rcube_webmail() if (flag == 'unread') { if (row.unread != status) this.update_thread_root(uid, status ? 'unread' : 'read'); - row.unread = status; } - else if(flag == 'deleted') - row.deleted = status; - else if (flag == 'replied') - row.replied = status; - else if (flag == 'forwarded') - row.forwarded = status; - else if (flag == 'flagged') - row.flagged = status; + + if ($.inArray(flag, ['unread', 'deleted', 'replied', 'forwarded', 'flagged']) > -1) + row[flag] = status; }; // set message row status, class and icon @@ -2657,22 +2651,8 @@ function rcube_webmail() if (flag) this.set_message_status(uid, flag, status); - var rowobj = $(row.obj); - - if (row.unread && !rowobj.hasClass('unread')) - rowobj.addClass('unread'); - else if (!row.unread && rowobj.hasClass('unread')) - rowobj.removeClass('unread'); - - if (row.deleted && !rowobj.hasClass('deleted')) - rowobj.addClass('deleted'); - else if (!row.deleted && rowobj.hasClass('deleted')) - rowobj.removeClass('deleted'); - - if (row.flagged && !rowobj.hasClass('flagged')) - rowobj.addClass('flagged'); - else if (!row.flagged && rowobj.hasClass('flagged')) - rowobj.removeClass('flagged'); + if ($.inArray(flag, ['unread', 'deleted', 'flagged']) > -1) + $(row.obj)[row[flag] ? 'addClass' : 'removeClass'](flag); this.set_unread_children(uid); this.set_message_icon(uid); |