From 4f3a84f4d336a6d9bb1172873a063ff8a8b390ec Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 25 Nov 2005 16:38:08 +0100 Subject: [PATCH] cleaned up unread/selected style mess --- backend.php | 8 ++++---- feedlist.js | 2 +- functions.js | 18 ++++++++++++++---- prefs.js | 35 ++++++++--------------------------- tt-rss.css | 26 +++++++++++++++++++++++--- 5 files changed, 50 insertions(+), 39 deletions(-) diff --git a/backend.php b/backend.php index aa0c271a1..977f3fd83 100644 --- a/backend.php +++ b/backend.php @@ -592,7 +592,7 @@ print ""; print ""; } @@ -954,7 +954,7 @@ print ""; if ($addheader) { @@ -1389,9 +1389,9 @@ if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) { print " + onclick=\"javascript:readSelectedFeeds(true)\" value=\"Mark as read\">  "; } diff --git a/feedlist.js b/feedlist.js index 133125635..e8d79c6ba 100644 --- a/feedlist.js +++ b/feedlist.js @@ -84,7 +84,7 @@ function viewfeed(feed, skip, subop, doc) { cleanSelectedList("feedList"); var feedr = document.getElementById("FEEDR-" + feed); - if (feedr) { + if (feedr) { feedr.className = feedr.className + "Selected"; } diff --git a/functions.js b/functions.js index c03e623f2..83246bfda 100644 --- a/functions.js +++ b/functions.js @@ -328,11 +328,11 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') { xmlhttp_rpc = new XMLHttpRequest(); } -function label_counters_callback() { +function all_counters_callback() { if (xmlhttp_rpc.readyState == 4) { if (!xmlhttp_rpc.responseXML) { - notify("label_counters_callback: backend did not return valid XML"); + notify("[all_counters_callback] backend did not return valid XML"); return; } @@ -355,7 +355,17 @@ function label_counters_callback() { if (ctr > 0) { feedctr.className = "odd"; if (!feedr.className.match("Unread")) { + var is_selected = feedr.className.match("Selected"); + + feedr.className = feedr.className.replace("Selected", ""); + feedr.className = feedr.className.replace("Unread", ""); + feedr.className = feedr.className + "Unread"; + + if (is_selected) { + feedr.className = feedr.className + "Selected"; + } + } } else { feedctr.className = "invisible"; @@ -366,7 +376,7 @@ function label_counters_callback() { } } -function update_label_counters(feed) { +function update_all_counters(feed) { if (xmlhttp_ready(xmlhttp_rpc)) { var query = "backend.php?op=rpc&subop=getAllCounters"; @@ -375,7 +385,7 @@ function update_label_counters(feed) { } xmlhttp_rpc.open("GET", query, true); - xmlhttp_rpc.onreadystatechange=label_counters_callback; + xmlhttp_rpc.onreadystatechange=all_counters_callback; xmlhttp_rpc.send(null); } } diff --git a/prefs.js b/prefs.js index c000ca19b..04dd88c7e 100644 --- a/prefs.js +++ b/prefs.js @@ -448,7 +448,7 @@ function getSelectedFeedCats() { } -function readSelectedFeeds() { +function readSelectedFeeds(read) { if (!xmlhttp_ready(xmlhttp)) { printLockingError(); @@ -459,34 +459,15 @@ function readSelectedFeeds() { if (sel_rows.length > 0) { - notify("Marking selected feeds as read..."); + if (!read) { + op = "unread"; + } else { + op = "read"; + } - xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ - param_escape(sel_rows.toString()), true); - xmlhttp.onreadystatechange=notify_callback; - xmlhttp.send(null); + notify("Marking selected feeds as " + op + "..."); - } else { - - notify("Please select some feeds first."); - - } -} - -function unreadSelectedFeeds() { - - if (!xmlhttp_ready(xmlhttp)) { - printLockingError(); - return - } - - var sel_rows = getSelectedFeeds(); - - if (sel_rows.length > 0) { - - notify("Marking selected feeds as unread..."); - - xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ + xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+ param_escape(sel_rows.toString()), true); xmlhttp.onreadystatechange=notify_callback; xmlhttp.send(null); diff --git a/tt-rss.css b/tt-rss.css index d32a39088..1d92d0b57 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -163,6 +163,7 @@ ul.feedList li { margin : 0px; } +/* li.oddSelected, li.evenSelected { background-color : white; } @@ -200,6 +201,24 @@ ul.feedlist li.virtUnreadSelected a, li.virtSelectedUnread a { color : #5050aa; +} */ + +ul.feedlist li.feedSelected a, +ul.feedlist li.labelSelected a, +ul.feedlist li.virtSelected a { + color : #5050aa; +} + +ul.feedlist li.feedUnreadSelected a, +ul.feedlist li.labelUnreadSelected a, +ul.feedlist li.virtUnreadSelected a { + color : #5050aa; +} + +ul.feedlist li.feedUnreadSelected , +ul.feedlist li.labelUnreadSelected, +ul.feedlist li.virtUnreadSelected{ + font-weight : bold; } ul.feedList li.feed { @@ -346,12 +365,12 @@ a.button { font-size : small; } -.evenUnreadSelected, .evenSelectedUnread, { +.evenUnreadSelected, .evenSelectedUnread { background-color : #e0e0ff; font-weight : bold; } -.oddUnreadSelected, .oddSelectedUnread, .feedSelectedUnread, { +.oddUnreadSelected, .oddSelectedUnread { background-color : #e0e0ff; font-weight : bold; } @@ -364,12 +383,13 @@ a.button { background-color : #e0e0ff; } +/* .feedUnreadSelected, .feedSelectedUnread, .virtUnreadSelected, .virtSelectedUnread, .labelUnreadSelected, .labelSelectedUnread { background-color : #e0e0ff; font-weight : bold; -} +} */ .feedUnread, .labelUnread, .virtUnread { font-weight : bold;