toggle hide/display only unread feeds, All feeds: button ops changed into selector

This commit is contained in:
Andrew Dolgov 2005-11-15 10:13:49 +01:00
parent aa5f9f5fec
commit 3745788e89
7 changed files with 133 additions and 14 deletions

View File

@ -135,7 +135,7 @@
<script type=\"text/javascript\" src=\"functions.js\"></script> <script type=\"text/javascript\" src=\"functions.js\"></script>
<script type=\"text/javascript\" src=\"feedlist.js\"></script> <script type=\"text/javascript\" src=\"feedlist.js\"></script>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
</head><body>"; </head><body onload=\"init()\">";
print "<ul class=\"feedList\" id=\"feedList\">"; print "<ul class=\"feedList\" id=\"feedList\">";
@ -147,7 +147,7 @@
FROM ttrss_entries WHERE marked = true AND unread = true"); FROM ttrss_entries WHERE marked = true AND unread = true");
$num_starred = db_fetch_result($result, 0, "num_starred"); $num_starred = db_fetch_result($result, 0, "num_starred");
$class = "odd"; $class = "virt";
if ($num_starred > 0) $class .= "Unread"; if ($num_starred > 0) $class .= "Unread";
@ -172,7 +172,7 @@
$count = db_fetch_result($tmp_result, 0, "count"); $count = db_fetch_result($tmp_result, 0, "count");
$class = "odd"; $class = "label";
if ($count > 0) { if ($count > 0) {
$class .= "Unread"; $class .= "Unread";
@ -215,7 +215,7 @@
// $class = ($lnum % 2) ? "even" : "odd"; // $class = ($lnum % 2) ? "even" : "odd";
$class = "odd"; $class = "feed";
if ($unread > 0) $class .= "Unread"; if ($unread > 0) $class .= "Unread";

View File

@ -88,4 +88,8 @@ function viewfeed(feed, skip, subop, doc) {
} }
function init() {
hideOrShowFeeds(document, getCookie("ttrss_vf_hreadf") == 1);
}

View File

@ -396,3 +396,24 @@ function popupHelp(tid) {
} }
} }
function hideOrShowFeeds(doc, hide) {
var css_rules = doc.styleSheets[0].cssRules;
for (i = 0; i < css_rules.length; i++) {
var rule = css_rules[i];
if (rule.selectorText == "ul.feedList li.feed") {
if (!hide) {
rule.style.display = "block";
} else {
rule.style.display = "none";
}
}
}
}

View File

@ -153,6 +153,31 @@ li.oddSelected a, li.evenSelected a,
color : #5050aa; color : #5050aa;
} }
ul.feedlist
li.virtSelected,
li.virtUnreadSelected,
li.feedSelected,
li.labelSelected,
li.feedUnreadSelected,
li.labelUnreadSelected {
background-color : white;
}
ul.feedlist
li.feedSelected a,
li.labelSelected a,
li.feedUnreadSelected a,
li.labelUnreadSelected a,
li.virtSelected a,
li.virtUnreadSelected a,
li.virtSelectedUnread a {
color : #5050aa;
}
ul.feedList li.feed {
display : block;
}
ul.feedList img { ul.feedList img {
margin : 0px 3px 0px 0px; margin : 0px 3px 0px 0px;
width : 16px; width : 16px;
@ -285,12 +310,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 { .oddUnreadSelected, .oddSelectedUnread, .feedSelectedUnread, {
background-color : #e0e0ff; background-color : #e0e0ff;
font-weight : bold; font-weight : bold;
} }
@ -303,6 +328,17 @@ a.button {
background-color : #e0e0ff; background-color : #e0e0ff;
} }
.feedUnreadSelected, .feedSelectedUnread,
.virtUnreadSelected, .virtSelectedUnread,
.labelUnreadSelected, .labelSelectedUnread {
background-color : #e0e0ff;
font-weight : bold;
}
.feedUnread, .labelUnread, .virtUnread {
font-weight : bold;
}
.disabledButton { .disabledButton {
border : 1px solid #c0c0c0; border : 1px solid #c0c0c0;
background-color : white; background-color : white;

View File

@ -12,6 +12,7 @@ var search_query = "";
var search_mode = ""; var search_mode = "";
var display_tags = false; var display_tags = false;
//var display_read_feeds = true;
var global_unread = 0; var global_unread = 0;
@ -524,3 +525,42 @@ function qfdDelete(feed_id) {
xmlhttp.send(null); xmlhttp.send(null);
} }
function allFeedsMenuGo() {
var chooser = document.getElementById("allFeedsChooser");
var opname = chooser[chooser.selectedIndex].text;
if (opname == "Update") {
scheduleFeedUpdate(true);
return;
}
if (opname == "Mark as read") {
catchupAllFeeds();
return;
}
if (opname == "Toggle display read") {
toggleDispRead();
return;
}
}
function toggleDispRead() {
var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
hide_read_feeds = !hide_read_feeds;
var feeds_doc = window.frames["feeds-frame"].document;
hideOrShowFeeds(feeds_doc, hide_read_feeds);
if (hide_read_feeds) {
setCookie("ttrss_vf_hreadf", 1);
} else {
setCookie("ttrss_vf_hreadf", 0);
}
}

View File

@ -62,15 +62,17 @@
src="backend.php?op=error&msg=Loading,%20please wait..." src="backend.php?op=error&msg=Loading,%20please wait..."
id="feeds-frame" name="feeds-frame" class="feedsFrame"> </iframe> id="feeds-frame" name="feeds-frame" class="feedsFrame"> </iframe>
<p align="center">All feeds: <div align="center">All feeds:
<input class="button" type="submit" <select id="allFeedsChooser">
onclick="javascript:scheduleFeedUpdate(true)" value="Update"> <option>Update</option>
<option>Mark as read</option>
<option>Toggle display read</option>
</select>
<input class="button" type="submit" <input type="submit" class="button" onclick="allFeedsMenuGo()" value="Go">
onclick="javascript:catchupAllFeeds()" value="Mark as read">
</p> </div>
</td> </td>
<td valign="top" class="headlinesToolbarBox"> <td valign="top" class="headlinesToolbarBox">

View File

@ -176,6 +176,10 @@ li.oddSelected a, li.evenSelected a,
font-size:8pt; font-size:8pt;
} }
ul.feedList li.even, li.odd {
display : block;
}
ul.feedList img { ul.feedList img {
margin : 0px 3px 0px 0px; margin : 0px 3px 0px 0px;
width : 16px; width : 16px;
@ -328,6 +332,18 @@ a.button {
background-color : #e0e0ff; background-color : #e0e0ff;
} }
.feedUnreadSelected, .feedSelectedUnread,
.virtUnreadSelected, .virtSelectedUnread,
.labelUnreadSelected, .labelSelectedUnread {
background-color : #e0e0ff;
font-weight : bold;
}
.feedUnread, .labelUnread, .virtUnread {
font-weight : bold;
}
.disabledButton { .disabledButton {
border : 1px solid #c0c0c0; border : 1px solid #c0c0c0;
background-color : white; background-color : white;