more digest page improvements
This commit is contained in:
parent
b41c254984
commit
1ca8997bcc
|
@ -156,6 +156,7 @@ a:hover {
|
|||
#headlines ul#headlines-content li {
|
||||
margin : 0px 0px 10px 0px;
|
||||
color : #909090;
|
||||
clear : left;
|
||||
}
|
||||
|
||||
#headlines ul#headlines-content a.title {
|
||||
|
@ -164,12 +165,16 @@ a:hover {
|
|||
}
|
||||
|
||||
#headlines ul#headlines-content div.excerpt {
|
||||
margin-left : 22px;
|
||||
color : #404040;
|
||||
}
|
||||
|
||||
#headlines ul#headlines-content div.body {
|
||||
margin-left : 21px;
|
||||
}
|
||||
|
||||
#headlines ul#headlines-content div.info {
|
||||
margin-left : 22px;
|
||||
margin-top : 2px;
|
||||
font-size : 11px;
|
||||
}
|
||||
|
||||
#headlines ul#headlines-content div.info a {
|
||||
|
|
45
digest.js
45
digest.js
|
@ -1,12 +1,29 @@
|
|||
var last_feeds = [];
|
||||
|
||||
function view(feed_id) {
|
||||
var _active_feed_id = false;
|
||||
var _active_feed_offset = false;
|
||||
|
||||
function viewfeed(feed_id, offset) {
|
||||
try {
|
||||
|
||||
if (!feed_id) feed_id = _active_feed_id;
|
||||
|
||||
if (!offset)
|
||||
offset = 0;
|
||||
else
|
||||
offset = _active_feed_offset + offset;
|
||||
|
||||
var query = "backend.php?op=rpc&subop=digest-update&feed_id=" + feed_id +
|
||||
"&offset=" + offset;
|
||||
|
||||
console.log(query);
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "backend.php?op=rpc&subop=digest-init&feed_id=" + feed_id,
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
digest_update(transport);
|
||||
_active_feed_id = feed_id;
|
||||
_active_feed_offset = offset;
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
|
@ -61,7 +78,7 @@ function add_feed_entry(feed) {
|
|||
|
||||
var tmp_html = "<li>" +
|
||||
icon_part +
|
||||
"<a href=\"#\" onclick=\"view("+feed.id+")\">" + feed.title +
|
||||
"<a href=\"#\" onclick=\"viewfeed("+feed.id+")\">" + feed.title +
|
||||
"<div class='unread-ctr'>" + feed.unread + "</div>" +
|
||||
"</li>";
|
||||
|
||||
|
@ -89,15 +106,15 @@ function add_headline_entry(article, feed) {
|
|||
var icon_part = "";
|
||||
|
||||
if (article.has_icon)
|
||||
icon_part = "<img alt='zz' src='icons/" + article.feed_id + ".ico'/>";
|
||||
icon_part = "<img src='icons/" + article.feed_id + ".ico'/>";
|
||||
|
||||
var tmp_html = "<li>" +
|
||||
icon_part +
|
||||
"<a class='title'>" + article.title + "</a>" +
|
||||
"<div class='excerpt'>" + article.excerpt + "</div>" +
|
||||
"<div class='body'><div class='excerpt'>" + article.excerpt + "</div>" +
|
||||
"<div class='info'><a>" + feed.title + "</a> " + " @ " +
|
||||
new Date(article.updated * 1000) + "</div>" +
|
||||
"</li>";
|
||||
"</div></li>";
|
||||
|
||||
$("headlines-content").innerHTML += tmp_html;
|
||||
|
||||
|
@ -112,15 +129,17 @@ function digest_update(transport) {
|
|||
var headlines = transport.responseXML.getElementsByTagName('headlines')[0];
|
||||
|
||||
if (feeds) {
|
||||
last_feeds = feeds;
|
||||
|
||||
feeds = eval("(" + feeds.firstChild.nodeValue + ")");
|
||||
|
||||
last_feeds = feeds;
|
||||
|
||||
$('feeds-content').innerHTML = "";
|
||||
|
||||
for (var i = 0; i < feeds.length; i++) {
|
||||
add_feed_entry(feeds[i]);
|
||||
}
|
||||
} else {
|
||||
feeds = last_feeds;
|
||||
}
|
||||
|
||||
if (headlines) {
|
||||
|
@ -128,11 +147,18 @@ function digest_update(transport) {
|
|||
|
||||
$('headlines-content').innerHTML = "";
|
||||
|
||||
Element.hide('headlines-content');
|
||||
|
||||
for (var i = 0; i < headlines.length; i++) {
|
||||
add_headline_entry(headlines[i], find_feed(feeds, headlines[i].feed_id));
|
||||
}
|
||||
|
||||
$('headlines-content').innerHTML += "<li><a>More articles...</a></li>";
|
||||
$('headlines-content').innerHTML += "<li>" +
|
||||
"<div class='body'><a href=\"#\" onclick=\"viewfeed(false, 10)\">" +
|
||||
__("More articles...") + "</a></div></li>";
|
||||
|
||||
new Effect.Appear('headlines-content');
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
@ -147,6 +173,7 @@ function digest_init() {
|
|||
parameters: "backend.php?op=rpc&subop=digest-init",
|
||||
onComplete: function(transport) {
|
||||
digest_update(transport);
|
||||
window.setTimeout('viewfeed(-4)', 100);
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
|
|
|
@ -978,11 +978,29 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if ($subop == "digest-init") {
|
||||
if ($subop == "digest-update") {
|
||||
$feed_id = db_escape_string($_REQUEST['feed_id']);
|
||||
$offset = db_escape_string($_REQUEST['offset']);
|
||||
|
||||
if (!$feed_id) $feed_id = -4;
|
||||
if (!$offset) $offset = 0;
|
||||
|
||||
|
||||
print "<rpc-reply>";
|
||||
|
||||
$headlines = api_get_headlines($link, $feed_id, 10, $offset,
|
||||
'', ($feed_id == -4), true, false, "unread", "updated DESC");
|
||||
|
||||
//function api_get_headlines($link, $feed_id, $limit, $offset,
|
||||
// $filter, $is_cat, $show_excerpt, $show_content, $view_mode) {
|
||||
|
||||
print "<headlines><![CDATA[" . json_encode($headlines) . "]]></headlines>";
|
||||
|
||||
print "</rpc-reply>";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($subop == "digest-init") {
|
||||
print "<rpc-reply>";
|
||||
|
||||
$tmp_feeds = api_get_feeds($link, false, true, false, 0);
|
||||
|
@ -1007,13 +1025,6 @@
|
|||
|
||||
print "<feeds><![CDATA[" . json_encode($feeds) . "]]></feeds>";
|
||||
|
||||
$headlines = api_get_headlines($link, $feed_id, 10, 0,
|
||||
'', ($feed_id == -4), true, false, "all_articles", "updated DESC");
|
||||
|
||||
//function api_get_headlines($link, $feed_id, $limit, $offset,
|
||||
// $filter, $is_cat, $show_excerpt, $show_content, $view_mode) {
|
||||
|
||||
print "<headlines><![CDATA[" . json_encode($headlines) . "]]></headlines>";
|
||||
print "</rpc-reply>";
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue