cleaned up unread/selected style mess

This commit is contained in:
Andrew Dolgov 2005-11-25 16:38:08 +01:00
parent 35f3c923c4
commit 4f3a84f4d3
5 changed files with 50 additions and 39 deletions

View File

@ -592,7 +592,7 @@
print "</div>"; print "</div>";
print "<script type=\"text/javascript\"> print "<script type=\"text/javascript\">
update_label_counters('$feed_id'); update_all_counters('$feed_id');
</script>"; </script>";
} }
@ -954,7 +954,7 @@
print "<script type=\"text/javascript\"> print "<script type=\"text/javascript\">
document.onkeydown = hotkey_handler; document.onkeydown = hotkey_handler;
update_label_counters('$feed'); update_all_counters('$feed');
</script>"; </script>";
if ($addheader) { if ($addheader) {
@ -1389,9 +1389,9 @@
if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) { if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) {
print " print "
<input type=\"submit\" class=\"button\" <input type=\"submit\" class=\"button\"
onclick=\"javascript:readSelectedFeeds()\" value=\"Mark as read\"> onclick=\"javascript:readSelectedFeeds(true)\" value=\"Mark as read\">
<input type=\"submit\" class=\"button\" <input type=\"submit\" class=\"button\"
onclick=\"javascript:unreadSelectedFeeds()\" onclick=\"javascript:readSelectedFeeds(false)\"
value=\"Mark as unread\">&nbsp;"; value=\"Mark as unread\">&nbsp;";
} }

View File

@ -328,11 +328,11 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
xmlhttp_rpc = new XMLHttpRequest(); xmlhttp_rpc = new XMLHttpRequest();
} }
function label_counters_callback() { function all_counters_callback() {
if (xmlhttp_rpc.readyState == 4) { if (xmlhttp_rpc.readyState == 4) {
if (!xmlhttp_rpc.responseXML) { 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; return;
} }
@ -355,7 +355,17 @@ function label_counters_callback() {
if (ctr > 0) { if (ctr > 0) {
feedctr.className = "odd"; feedctr.className = "odd";
if (!feedr.className.match("Unread")) { 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"; feedr.className = feedr.className + "Unread";
if (is_selected) {
feedr.className = feedr.className + "Selected";
}
} }
} else { } else {
feedctr.className = "invisible"; 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)) { if (xmlhttp_ready(xmlhttp_rpc)) {
var query = "backend.php?op=rpc&subop=getAllCounters"; 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.open("GET", query, true);
xmlhttp_rpc.onreadystatechange=label_counters_callback; xmlhttp_rpc.onreadystatechange=all_counters_callback;
xmlhttp_rpc.send(null); xmlhttp_rpc.send(null);
} }
} }

View File

@ -448,7 +448,7 @@ function getSelectedFeedCats() {
} }
function readSelectedFeeds() { function readSelectedFeeds(read) {
if (!xmlhttp_ready(xmlhttp)) { if (!xmlhttp_ready(xmlhttp)) {
printLockingError(); printLockingError();
@ -459,34 +459,15 @@ function readSelectedFeeds() {
if (sel_rows.length > 0) { if (sel_rows.length > 0) {
notify("Marking selected feeds as read..."); if (!read) {
op = "unread";
xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+
param_escape(sel_rows.toString()), true);
xmlhttp.onreadystatechange=notify_callback;
xmlhttp.send(null);
} else { } else {
op = "read";
notify("Please select some feeds first.");
}
} }
function unreadSelectedFeeds() { notify("Marking selected feeds as " + op + "...");
if (!xmlhttp_ready(xmlhttp)) { xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
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="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
xmlhttp.onreadystatechange=notify_callback; xmlhttp.onreadystatechange=notify_callback;
xmlhttp.send(null); xmlhttp.send(null);

View File

@ -163,6 +163,7 @@ ul.feedList li {
margin : 0px; margin : 0px;
} }
/*
li.oddSelected, li.evenSelected { li.oddSelected, li.evenSelected {
background-color : white; background-color : white;
} }
@ -200,6 +201,24 @@ ul.feedlist
li.virtUnreadSelected a, li.virtUnreadSelected a,
li.virtSelectedUnread a { li.virtSelectedUnread a {
color : #5050aa; 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 { ul.feedList li.feed {
@ -346,12 +365,12 @@ a.button {
font-size : small; font-size : small;
} }
.evenUnreadSelected, .evenSelectedUnread, { .evenUnreadSelected, .evenSelectedUnread {
background-color : #e0e0ff; background-color : #e0e0ff;
font-weight : bold; font-weight : bold;
} }
.oddUnreadSelected, .oddSelectedUnread, .feedSelectedUnread, { .oddUnreadSelected, .oddSelectedUnread {
background-color : #e0e0ff; background-color : #e0e0ff;
font-weight : bold; font-weight : bold;
} }
@ -364,12 +383,13 @@ a.button {
background-color : #e0e0ff; background-color : #e0e0ff;
} }
/*
.feedUnreadSelected, .feedSelectedUnread, .feedUnreadSelected, .feedSelectedUnread,
.virtUnreadSelected, .virtSelectedUnread, .virtUnreadSelected, .virtSelectedUnread,
.labelUnreadSelected, .labelSelectedUnread { .labelUnreadSelected, .labelSelectedUnread {
background-color : #e0e0ff; background-color : #e0e0ff;
font-weight : bold; font-weight : bold;
} } */
.feedUnread, .labelUnread, .virtUnread { .feedUnread, .labelUnread, .virtUnread {
font-weight : bold; font-weight : bold;