digest: article display tweaks

This commit is contained in:
Andrew Dolgov 2010-09-12 19:36:59 +04:00
parent 6eed9e8071
commit 41de958121
1 changed files with 27 additions and 10 deletions

View File

@ -5,6 +5,14 @@ var _active_feed_offset = false;
var _update_timeout = false; var _update_timeout = false;
var _feedlist_expanded = false; var _feedlist_expanded = false;
function article_appear(article_id) {
try {
new Effect.Appear('A-' + article_id);
} catch (e) {
exception_error("article_appear", e);
}
}
function catchup_feed(feed_id, callback) { function catchup_feed(feed_id, callback) {
try { try {
@ -165,7 +173,7 @@ function view(article_id, dismiss_only) {
catchup_article(article_id, catchup_article(article_id,
function() { function() {
viewfeed(_active_feed_id, _active_feed_offset); viewfeed(_active_feed_id, _active_feed_offset, false, true);
update(); update();
}); });
@ -175,7 +183,7 @@ function view(article_id, dismiss_only) {
} }
} }
function viewfeed(feed_id, offset) { function viewfeed(feed_id, offset, replace, no_effects) {
try { try {
if (!feed_id) feed_id = _active_feed_id; if (!feed_id) feed_id = _active_feed_id;
@ -186,6 +194,8 @@ function viewfeed(feed_id, offset) {
offset = _active_feed_offset + offset; offset = _active_feed_offset + offset;
} }
if (replace == undefined) replace = (offset == 0);
var query = "backend.php?op=rpc&subop=digest-update&feed_id=" + var query = "backend.php?op=rpc&subop=digest-update&feed_id=" +
param_escape(feed_id) + "&offset=" + offset; param_escape(feed_id) + "&offset=" + offset;
@ -195,7 +205,7 @@ function viewfeed(feed_id, offset) {
parameters: query, parameters: query,
onComplete: function(transport) { onComplete: function(transport) {
fatal_error_check(transport); fatal_error_check(transport);
parse_headlines(transport, offset == 0); parse_headlines(transport, replace, no_effects);
set_selected_feed(feed_id); set_selected_feed(feed_id);
_active_feed_offset = offset; _active_feed_offset = offset;
} }); } });
@ -285,7 +295,7 @@ function add_feed_entry(feed) {
} }
} }
function add_headline_entry(article, feed) { function add_headline_entry(article, feed, no_effects) {
try { try {
var icon_part = ""; var icon_part = "";
@ -321,8 +331,11 @@ function add_headline_entry(article, feed) {
else else
publ_part = "<img title='"+__("Publish article")+"' onclick=\"toggle_pub(this, "+article.id+")\" src='images/pub_unset.png'>"; publ_part = "<img title='"+__("Publish article")+"' onclick=\"toggle_pub(this, "+article.id+")\" src='images/pub_unset.png'>";
var style = "";
var tmp_html = "<li id=\"A-"+article.id+"\">" + if (!no_effects) style = "style=\"display : none\"";
var tmp_html = "<li id=\"A-"+article.id+"\" "+style+">" +
icon_part + icon_part +
"<div class='digest-check'>" + "<div class='digest-check'>" +
mark_part + mark_part +
@ -344,6 +357,9 @@ function add_headline_entry(article, feed) {
$("headlines-content").innerHTML += tmp_html; $("headlines-content").innerHTML += tmp_html;
if (!no_effects)
window.setTimeout('article_appear(' + article.id + ')', 100);
} catch (e) { } catch (e) {
exception_error("add_headline_entry", e); exception_error("add_headline_entry", e);
} }
@ -423,7 +439,7 @@ function parse_feeds(transport) {
} }
} }
function parse_headlines(transport, replace) { function parse_headlines(transport, replace, no_effects) {
try { try {
if (!transport.responseXML) return; if (!transport.responseXML) return;
@ -452,7 +468,7 @@ function parse_headlines(transport, replace) {
if (!$('A-' + headlines[i].id)) { if (!$('A-' + headlines[i].id)) {
add_headline_entry(headlines[i], add_headline_entry(headlines[i],
find_feed(last_feeds, headlines[i].feed_id)); find_feed(last_feeds, headlines[i].feed_id), !no_effects);
inserted = $("A-" + headlines[i].id); inserted = $("A-" + headlines[i].id);
} }
@ -460,7 +476,7 @@ function parse_headlines(transport, replace) {
if (pr) { if (pr) {
$('headlines-content').appendChild(pr); $('headlines-content').appendChild(pr);
new Effect.ScrollTo(inserted); if (!no_effects) new Effect.ScrollTo(inserted);
} else { } else {
$('headlines-content').innerHTML += "<li id='H-MORE-PROMPT'>" + $('headlines-content').innerHTML += "<li id='H-MORE-PROMPT'>" +
"<div class='body'>" + "<div class='body'>" +
@ -471,7 +487,8 @@ function parse_headlines(transport, replace) {
"</div></li>"; "</div></li>";
} }
if (replace) new Effect.Appear('headlines-content', {duration : 0.3}); if (replace && !no_effects)
new Effect.Appear('headlines-content', {duration : 0.3});
//new Effect.Appear('headlines-content'); //new Effect.Appear('headlines-content');
} }