summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-22 16:15:54 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-22 16:15:54 +0000
commit0c7942918f8944b784470e2e507239773b1d2065 (patch)
treee341b91b8ac2ef060f9ba019830bd1b993c25838
parent7fcf1f86588c0738b0f97a79a6daa7993b445fb4 (diff)
Wrap unread count in <span> for more flexible styling
git-svn-id: https://svn.roundcube.net/trunk@4445 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/js/app.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index e78ac2715..c81212fb5 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -4914,11 +4914,14 @@ function rcube_webmail()
// update the mailbox count display
this.set_unread_count_display = function(mbox, set_title)
{
- var reg, text_obj, item, mycount, childcount, div;
+ var reg, link, text_obj, item, mycount, childcount, div;
if (item = this.get_folder_li(mbox)) {
mycount = this.env.unread_counts[mbox] ? this.env.unread_counts[mbox] : 0;
- text_obj = item.getElementsByTagName('a')[0];
+ link = $(item).children('a').eq(0);
+ text_obj = link.children('span.unreadcount');
+ if (!text_obj.length && mycount)
+ text_obj = $('<span>').addClass('unreadcount').appendTo(link);
reg = /\s+\([0-9]+\)$/i;
childcount = 0;
@@ -4930,12 +4933,10 @@ function rcube_webmail()
childcount += this.env.unread_counts[k];
}
- if (mycount && text_obj.innerHTML.match(reg))
- text_obj.innerHTML = text_obj.innerHTML.replace(reg, ' ('+mycount+')');
- else if (mycount)
- text_obj.innerHTML += ' ('+mycount+')';
- else
- text_obj.innerHTML = text_obj.innerHTML.replace(reg, '');
+ if (mycount && text_obj.length)
+ text_obj.html(' ('+mycount+')');
+ else if (text_obj.length)
+ text_obj.remove();
// set parent's display
reg = new RegExp(RegExp.escape(this.env.delimiter) + '[^' + RegExp.escape(this.env.delimiter) + ']+$');