early title work
This commit is contained in:
parent
0e091d38cf
commit
76798ff3f2
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
$lnum = 0;
|
$lnum = 0;
|
||||||
|
|
||||||
|
$total_unread = 0;
|
||||||
|
|
||||||
while ($line = pg_fetch_assoc($result)) {
|
while ($line = pg_fetch_assoc($result)) {
|
||||||
|
|
||||||
$feed = $line["title"];
|
$feed = $line["title"];
|
||||||
|
@ -40,6 +42,8 @@
|
||||||
|
|
||||||
if ($unread > 0) $class .= "Unread";
|
if ($unread > 0) $class .= "Unread";
|
||||||
|
|
||||||
|
$total_unread += $unread;
|
||||||
|
|
||||||
print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
|
print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
|
||||||
|
|
||||||
$feed = "<a href=\"javascript:viewfeed($feed_id, 0);\">$feed</a>";
|
$feed = "<a href=\"javascript:viewfeed($feed_id, 0);\">$feed</a>";
|
||||||
|
@ -58,6 +62,8 @@
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print "<div class=\"invisible\" id=\"FEEDTU\">$total_unread</div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($op == "view") {
|
if ($op == "view") {
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) > " .
|
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) > " .
|
||||||
MIN_UPDATE_TIME);
|
MIN_UPDATE_TIME);
|
||||||
|
|
||||||
|
$num_unread = 0;
|
||||||
|
|
||||||
while ($line = pg_fetch_assoc($result)) {
|
while ($line = pg_fetch_assoc($result)) {
|
||||||
update_rss_feed($link, $line["feed_url"], $line["id"]);
|
$num_unread += update_rss_feed($link, $line["feed_url"], $line["id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +20,8 @@
|
||||||
|
|
||||||
$rss = fetch_rss($feed_url);
|
$rss = fetch_rss($feed_url);
|
||||||
|
|
||||||
|
$num_unread = 0;
|
||||||
|
|
||||||
if ($rss) {
|
if ($rss) {
|
||||||
|
|
||||||
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'");
|
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'");
|
||||||
|
@ -80,7 +84,9 @@
|
||||||
'$entry_timestamp', '$entry_content', '$feed',
|
'$entry_timestamp', '$entry_content', '$feed',
|
||||||
'$content_md5')";
|
'$content_md5')";
|
||||||
|
|
||||||
pg_query($link, $query);
|
$result = pg_query($link, $query);
|
||||||
|
|
||||||
|
if ($result) ++$num_unread;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -110,15 +116,15 @@
|
||||||
|
|
||||||
$result = pg_query($link, $query);
|
$result = pg_query($link, $query);
|
||||||
|
|
||||||
|
if ($result) ++$num_unread;
|
||||||
// print "$entry_guid - $entry_timestamp - $entry_title -
|
|
||||||
// $entry_link - $entry_id<br>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = pg_query($link, "UPDATE ttrss_feeds SET last_updated = NOW()");
|
if ($result) {
|
||||||
|
$result = pg_query($link, "UPDATE ttrss_feeds SET last_updated = NOW()");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
tt-rss.js
27
tt-rss.js
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
var xmlhttp = false;
|
var xmlhttp = false;
|
||||||
|
|
||||||
|
var total_unread = 0;
|
||||||
|
|
||||||
/*@cc_on @*/
|
/*@cc_on @*/
|
||||||
/*@if (@_jscript_version >= 5)
|
/*@if (@_jscript_version >= 5)
|
||||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||||
|
@ -28,6 +30,13 @@ function feedlist_callback() {
|
||||||
var container = document.getElementById('feeds');
|
var container = document.getElementById('feeds');
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
container.innerHTML=xmlhttp.responseText;
|
container.innerHTML=xmlhttp.responseText;
|
||||||
|
|
||||||
|
var feedtu = document.getElementById("FEEDTU");
|
||||||
|
|
||||||
|
if (feedtu) {
|
||||||
|
total_unread = feedtu.innerHTML;
|
||||||
|
update_title();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +121,10 @@ function view(id,feed_id) {
|
||||||
var feedr = document.getElementById("FEEDR-" + feed_id);
|
var feedr = document.getElementById("FEEDR-" + feed_id);
|
||||||
feedr.className = feedr.className.replace("Unread", "");
|
feedr.className = feedr.className.replace("Unread", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
total_unread--;
|
||||||
|
|
||||||
|
update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('content').innerHTML='Loading, please wait...';
|
document.getElementById('content').innerHTML='Loading, please wait...';
|
||||||
|
@ -144,11 +157,11 @@ function search(feed, sender) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function update_title() {
|
||||||
|
//document.title = "Tiny Tiny RSS (" + total_unread + " unread)";
|
||||||
update_feed_list(false, false);
|
}
|
||||||
|
|
||||||
setTimeout("timeout()", 1800*1000);
|
function init() {
|
||||||
|
update_feed_list(false, false);
|
||||||
|
setTimeout("timeout()", 1800*1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue