summaryrefslogtreecommitdiff
path: root/js/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-07-13 01:19:52 +0300
committerAndrew Dolgov <[email protected]>2015-07-13 01:19:52 +0300
commitac4c1383ae3b1af7be056b1f75c8125b272b0e5f (patch)
tree4f486c3bb2cd515311b0b252c2e23e8d371708c8 /js/viewfeed.js
parentf56e5a35041878b5ec827e96ce3ac78a0df944c8 (diff)
bring cdmFeedTitle style in line with the rest of the UI
send headline rows as separate JSON objects
Diffstat (limited to 'js/viewfeed.js')
-rw-r--r--js/viewfeed.js51
1 files changed, 40 insertions, 11 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index 1a45e8bb5..be30183be 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -86,8 +86,8 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
if (infscroll_req == false) {
loaded_article_ids = [];
- dijit.byId("headlines-frame").attr('content',
- reply['headlines']['content']);
+ /*dijit.byId("headlines-frame").attr('content',
+ reply['headlines']['content']);*/
//dijit.byId("headlines-toolbar").attr('content',
// reply['headlines']['toolbar']);
@@ -96,12 +96,28 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
reply['headlines']['toolbar'],
{parseContent: true});
- $$("#headlines-frame > div[id*=RROW]").each(function(row) {
+ /*$$("#headlines-frame > div[id*=RROW]").each(function(row) {
if (loaded_article_ids.indexOf(row.id) != -1) {
row.parentNode.removeChild(row);
} else {
loaded_article_ids.push(row.id);
}
+ });*/
+
+
+ dijit.byId("headlines-frame").attr("content", "");
+
+ reply['headlines']['content'].each(function(row) {
+ if (loaded_article_ids.indexOf(row.id) == -1) {
+ loaded_article_ids.push(row.id);
+ }
+
+ var tmp = new Element("div");
+ tmp.innerHTML = row.html;
+
+ dojo.parser.parse(tmp.firstChild);
+ dijit.byId("headlines-frame").domNode.appendChild(tmp.firstChild);
+
});
var hsp = $("headlines-spacer");
@@ -127,16 +143,16 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
var c = dijit.byId("headlines-frame");
var ids = getSelectedArticleIds2();
- var new_elems = [];
+ //var new_elems = [];
- $("headlines-tmp").innerHTML = reply['headlines']['content'];
+ //$("headlines-tmp").innerHTML = reply['headlines']['content'];
var hsp = $("headlines-spacer");
if (hsp)
c.domNode.removeChild(hsp);
- $$("#headlines-tmp > div").each(function(row) {
+ /*$$("#headlines-tmp > div").each(function(row) {
if (row.className == 'cdmFeedTitle') {
row.style.display = 'none';
c.domNode.appendChild(row);
@@ -149,18 +165,31 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
} else {
row.parentNode.removeChild(row);
}
+ });*/
+
+ reply['headlines']['content'].each(function(row) {
+ if (loaded_article_ids.indexOf(row.id) == -1 || row.kind == 'feed_title') {
+ loaded_article_ids.push(row.id);
+
+ var tmp = new Element("div");
+ tmp.innerHTML = row.html;
+
+ dojo.parser.parse(tmp.firstChild);
+ dijit.byId("headlines-frame").domNode.appendChild(tmp.firstChild);
+
+ }
});
+
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
// if (getInitParam("cdm_auto_catchup") == 1) {
c.domNode.appendChild(hsp);
// }
- console.log("added " + new_elems.size() + " headlines");
+ console.log("added " + reply['headlines']['content'].size() + " headlines");
- if (new_elems.size() == 0)
- _infscroll_disable = true;
+ if (reply['headlines']['content'].size() == 0) _infscroll_disable = true;
console.log("restore selected ids: " + ids);
@@ -170,12 +199,12 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
initHeadlinesMenu();
- new_elems.each(function(child) {
+ /*new_elems.each(function(child) {
dojo.parser.parse(child);
if (!Element.visible(child))
new Effect.Appear(child, { duration : 0.5 });
- });
+ });*/
if (_infscroll_disable) {
hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +