diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/tt-rss.js | 2 | ||||
-rw-r--r-- | js/viewfeed.js | 48 |
2 files changed, 48 insertions, 2 deletions
diff --git a/js/tt-rss.js b/js/tt-rss.js index eaa1f3daf..54ac077f4 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -447,7 +447,7 @@ function parse_runtime_info(data) { } if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { - if (parseInt(getInitParam("dep_ts")) < parseInt(v)) { + if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { window.location.reload(); } } diff --git a/js/viewfeed.js b/js/viewfeed.js index 485ee3606..0e2e9e3fa 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -13,6 +13,8 @@ var catchup_timeout_id = false; var cids_requested = []; var loaded_article_ids = []; +var _post_preview_timeout = false; + var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null; function headlines_callback2(transport, offset, background, infscroll_req) { @@ -1166,17 +1168,61 @@ function getActiveArticleId() { return _active_article_id; } -function postMouseIn(id) { +function postMouseIn(e, id) { post_under_pointer = id; + + if (_post_preview_timeout) window.clearTimeout(_post_preview_timeout); + + if (!getInitParam("cdm_expanded")) { + _post_preview_timeout = window.setTimeout(function() { + displaySmallArticlePreview(e, id); + }, 1000); + } +} + +function displaySmallArticlePreview(e, id) { + try { + var query = "?op=rpc&method=cdmarticlepreview&id=" + id; + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + cexc = $("CEXC-" + id); + preview = $("small_article_preview"); + row = $("RROW-" + id); + + if (id != getActiveArticleId() && (!isCdmMode() || (cexc && Element.visible(cexc))) && row && preview) { + preview.innerHTML = transport.responseText; + new Effect.Appear(preview, {duration:0.2}); + + preview.setStyle({ + left: (e.clientX + 20) + 'px', + top: (Element.cumulativeOffset(row)[1] + row.offsetHeight + 10) + 'px' }); + + } + + } }); + + + } catch (e) { + exception_error("displaySmallArticlePreview", e); + } } function postMouseOut(id) { post_under_pointer = false; + + if (_post_preview_timeout) window.clearTimeout(_post_preview_timeout); + + if (Element.visible("small_article_preview")) + Element.hide("small_article_preview"); } function unpackVisibleHeadlines() { try { + if (!isCdmMode()) return; + $$("#headlines-frame > div[id*=RROW]").each( function(child) { if (child.offsetTop <= $("headlines-frame").scrollTop + |