From 36d146f8e234bf0b74f3d937fa4e1b47b9b58935 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Feb 2010 23:33:15 +0300 Subject: [PATCH] notifier: fix icons; support single-user mode --- utils/notifier/background.html | 21 +++++++++++++++------ utils/notifier/images/alert.png | Bin 477 -> 1097 bytes utils/notifier/images/alert2.png | Bin 263 -> 0 bytes utils/notifier/images/error.png | Bin 496 -> 1112 bytes utils/notifier/manifest.json | 2 +- utils/notifier/options.html | 20 ++++++++++++++++++++ 6 files changed, 36 insertions(+), 7 deletions(-) mode change 100644 => 100755 utils/notifier/images/alert.png delete mode 100644 utils/notifier/images/alert2.png mode change 100644 => 100755 utils/notifier/images/error.png diff --git a/utils/notifier/background.html b/utils/notifier/background.html index fdca37e9..bee00560 100644 --- a/utils/notifier/background.html +++ b/utils/notifier/background.html @@ -14,6 +14,9 @@ function param_escape(arg) { function update() { var d = new Date(); var login = localStorage["login"]; + var single_user = localStorage["single_user"]; + + if (single_user == "1") login = "admin"; var requestUrl = localStorage["site_url"] + "/backend.php"; var params = "op=getUnread&fresh=1&login=" + param_escape(login); @@ -33,6 +36,12 @@ function update() { var badge = new Object(); var badge_color = new Object(); + // init stuff + icon.path = "images/normal.png"; + title.title = ""; + badge.text = ""; + badge_color.color = [0, 0, 0, 0]; + var show_badge = localStorage["show_badge"] == "1"; var show_fresh = localStorage["show_fresh"] == "1"; @@ -41,21 +50,24 @@ function update() { var unread = parseInt(response[0]); - var fresh; + if (isNaN(unread)) unread = 0; + var fresh; + if (response.length == 2) fresh = parseInt(response[1]); else fresh = 0; + if (isNaN(fresh)) fresh = 0; + if (unread > 0) { icon.path = "images/alert.png"; title.title = "You have %s unread articles.".replace("%s", unread); - if (show_fresh) { + if (show_fresh && fresh > 0) { badge.text = fresh + ""; badge_color.color = [0, 200, 0, 255]; - } else { badge.text = unread + ""; badge_color.color = [255, 0, 0, 255]; @@ -67,12 +79,9 @@ function update() { var errorMsg = xhr.responseText.split(";")[1]; title.title = "Error: %s.".replace("%s", errorMsg.trim()); - badge.text = ""; } else { - icon.path = "images/normal.png"; title.title = "You have no unread articles."; - badge.text = ""; } localStorage["last_updated"] = d.getTime(); diff --git a/utils/notifier/images/alert.png b/utils/notifier/images/alert.png old mode 100644 new mode 100755 index 7922898fb5282eeadd2dab3ecf08123ab9de2cc8..f021b76fc2bf852a7acadecdc7d0b2a37936b2b4 GIT binary patch literal 1097 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NSs56Z83KGlT>nqv{6A0S-_hFN@9zJ8`{4IGAbRxs{o_CH9{hR#==X;wzdt3q#vp*l7{{eD8z4-I#<)6>5{(OG@=gX@WXh(>Vixj>;N1rdjf>WMQ`rLvX;%o6z> zpCtbKl=b5Vb{5s!DmS06f5YzdzLb%}n?q=E%YhumWz#i87ccs0$;f~H*Q|>7jL$6^ z%!|%3Dyw=twqRmbP1wQDoUrySl>BR1)X-iUO4in?||jD zmQ+!p_ZV7Ce*(@v!*kFADLn@vkb$W{P*mtWGKg+AP@JGR$u28Su;;5>{q8vkq!oHK zY|G6)+;k#0n`m*MC50~U2d%2*lACho)eP|RJ9-P= zOUzNxvVv{-utIT?tKYi}1DX#B2i^shD*=^)$svV{db+4)87IgqBd+;VTxug^33@rY*;>J1Gm$K?QXE0&LdN0RQ~G%VB>M0|6gA=S<&pptc5%P0000< LMNUMn143Ye5^cqZ diff --git a/utils/notifier/images/alert2.png b/utils/notifier/images/alert2.png deleted file mode 100644 index 450c8eed02c86f9ec3b98de3e1133ea9ae962a0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3y=napU%7MffQ$fM`SSr z1Gg{;GcwGYBLNg-FY)wsWxvMB&CM@pd_UO^C^W^>#WBRNSs56Z83KGlT>tZP{?}Ih+f@Ji{{7z%AN_v#`1j){zaKyS{q)(N2ao&(==q;#FMhvx{^!MuKQCVXdGYGc>sNnXz5e_9&EMB=|Gatg=gr%{Z{PiS_wMie z4}U+r|MTI)-;baEe*W_J%jdsezyAC7?eDkmf4~3u`{Vn+A3*Zw-=Dw!{`&dv*RQ|7 zfB*mgALzVMFd72%4}oU8=QDt|au#?*7Bet#3xP1>rMq>1fP(BLp1!W^*EqS^b>u`Y ze^><+k}q+MC<)F_D=AMbN@WO0%*-p%^K%VRum=MLV?9$nqsn#D4gr-e_H=O!(Fl$` z_gbh)L4ftaR2I|CXEaz?bxn7D_;>#L!n&t36WQ!;#A-ygPP!gHNnYSn&2iZS_xCOr zI8nXdM(lu%V6vjY6SK1ouN!{nXUMoU6lXLDKbpfFk^P%v?pv$d%sqxyO&6mwnJu)h zGTm_9`bvedRQEN<3&p2`7eahnHx`~+XT|U>b>{K@2Z3?V8hlcmjxgQgn#gE2=d;Pv fJqNtF4`|7=s0dblcbj4ebS{IZtDnm{r-UW|2w3vZ delta 488 zcmV>u^TBxAOwS(xKiV%aFus3A;}Y5I9CQiAmC?k;a3U-RcewnF47nzr$~0^PqC-F zTb-mLZj1+xo12;Y_n-M^;i;Rg9ZgU5D4_Ym07m_wzRv#->}=Zlqd~UE(_W5?l>fR1 z3z&8{Q!;clf5p}X?|G75Zi9cG4VZdW zBjvr#YVT}0HEI}0_`8pU+nd44=-VQz4EtwD`~zXslUVr0d;H=<7EQ|kOHGOL3he?M ey*=mo7TZ6pvft9I)CIBt0000 +
+ + +
+
-- 2.39.5