Skip to content

Commit

Permalink
Hide reddit mail count when zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromakode committed Sep 25, 2009
1 parent bc3f82c commit 35f89a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
15 changes: 7 additions & 8 deletions content/reddit/redditSiteInfo.xml
Expand Up @@ -12,25 +12,21 @@
<xul:columns>
<xul:column/>
<xul:column/>
<xul:column/>
</xul:columns>
<xul:rows>
<xul:row>
<xul:label anonid="labelUsername" class="socialite-site-info-username">&siteInfo.loadingtext;</xul:label>
<xul:spacer flex="1"/>
<xul:hbox align="center" pack="end">
<xul:image anonid="imageMailIcon" src="chrome://socialite/content/reddit/mailgray.png" class="mail-icon"/>
<xul:label anonid="labelMailCount" class="reddit-mail-count">?</xul:label>
<xul:hbox class="reddit-mail-box" align="center" pack="center">
<xul:image anonid="imageMailIcon" src="chrome://socialite/content/reddit/mailgray.png" class="reddit-mail-icon"/>
<xul:label anonid="labelMailCount" class="reddit-mail-count" hidden="true">?</xul:label>
</xul:hbox>
</xul:row>
<xul:row class="reddit-karma-info">
<xul:label>&linkKarma.label;</xul:label>
<xul:spacer flex="1"/>
<xul:label anonid="labelLinkKarma" class="socialite-site-info-data reddit-link-karma">...</xul:label>
</xul:row>
<xul:row class="reddit-karma-info">
<xul:label>&commentKarma.label;</xul:label>
<xul:spacer flex="1"/>
<xul:label anonid="labelCommentKarma" class="socialite-site-info-data reddit-comment-karma">...</xul:label>
</xul:row>
</xul:rows>
Expand All @@ -55,6 +51,7 @@
function setLabel(anonid, value) {
var label = document.getAnonymousElementByAttribute(self, "anonid", anonid);
label.value = value;
return label;
}

this.site.API.auth.getAuthInfo(function(authInfo) {
Expand All @@ -63,12 +60,14 @@
setLabel("labelUsername", authInfo.username);

var messageCount = self.site.newMessages.length;
setLabel("labelMailCount", messageCount);
var labelMailCount = setLabel("labelMailCount", messageCount);
var imageMailIcon = document.getAnonymousElementByAttribute(self, "anonid", "imageMailIcon");
if (messageCount > 0) {
imageMailIcon.src = "chrome://socialite/content/reddit/mail.png";
labelMailCount.hidden = false;
} else {
imageMailIcon.src = "chrome://socialite/content/reddit/mailgray.png";
labelMailCount.hidden = true;
}

self.site.cached.myuserinfo(
Expand Down
13 changes: 11 additions & 2 deletions skin/reddit.css
Expand Up @@ -26,9 +26,18 @@
}

.reddit-site-info .socialite-site-info-username {
margin-right: 1em !important;
margin-right: 7px !important;
}

.reddit-site-info .reddit-mail-box {
margin: 0px 6px;
}

.reddit-site-info .reddit-mail-count {
-moz-margin-start: 6px;
-moz-margin-end: 0px !important;
}

.reddit-site-info[showkarma="false"] .reddit-karma-info {
display:none;
}
}

0 comments on commit 35f89a1

Please sign in to comment.