summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-07-13 18:38:39 +0300
committerAndrew Dolgov <[email protected]>2015-07-13 18:38:39 +0300
commit57c521df912d562b06cdb32c1c2ef5b3e9978c79 (patch)
tree7d72bd26eb98550f7adb8128aed14840023f6232 /js
parent9f5eca992b116e7c5944d41826d2c25e742b185c (diff)
maybe speedup headline adding a bit, maybe not
Diffstat (limited to 'js')
-rw-r--r--js/viewfeed.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index 522952304..8254e86b6 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -92,19 +92,19 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
dijit.byId("headlines-frame").attr("content", "");
+ var tmp = new Element("div");
+
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);
-
+ tmp.innerHTML += row.html;
});
+ dojo.parser.parse(tmp);
+ dijit.byId("headlines-frame").attr("content", tmp.innerHTML);
+
var hsp = $("headlines-spacer");
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
dijit.byId('headlines-frame').domNode.appendChild(hsp);
@@ -134,25 +134,26 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
if (hsp)
c.domNode.removeChild(hsp);
+ var tmp = new Element("div");
+
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);
+ tmp.innerHTML += row.html;
}
});
+ dojo.parser.parse(tmp);
+
+ while (tmp.hasChildNodes()) {
+ dijit.byId("headlines-frame").domNode.appendChild(tmp.removeChild(tmp.firstChild));
+ }
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
c.domNode.appendChild(hsp);
- console.log("added " + reply['headlines']['content'].size() + " headlines");
-
if (reply['headlines']['content'].size() == 0) _infscroll_disable = true;
console.log("restore selected ids: " + ids);