From af9b5e283dea81085412d91cdfc1d275d822b440 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 24 Dec 2015 12:47:41 +0800 Subject: [PATCH] Reader/Feed.bjs Reader/Feed.js Reader/templates/Feed.html --- Reader/Feed.bjs | 2 +- Reader/Feed.js | 40 ++++++---------------------------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/Reader/Feed.bjs b/Reader/Feed.bjs index 9c0c43e..a5e9785 100644 --- a/Reader/Feed.bjs +++ b/Reader/Feed.bjs @@ -104,7 +104,7 @@ }, { "xtype" : "Container", - "| function loadArticle" : "function(pos) { \n \n\n if (pos < 0) {\n Roo.MessageBox.alert(\"error\", \"show article got < 0\");\n }\n \n // Roo.select('.hover-nav').show();\n _this.table.hide(); // hopefully...\n \n var sum = Roo.select('.rss-list',true).first();\n if (!sum) {\n return; // we are not on a show article page...\n \n }\n sum.setVisibilityMode(Roo.Element.DISPLAY);\n sum.hide()\n\n Roo.log('showArticle ' + pos);\n \n var art;\n if (this.pos !== false) {\n \n // feed or list..\n \n art = this.articles.elements[this.pos];\n art.hide();\n //this.showArticle(pos);\n //this.showArticle.defer(500,this,[pos]);\n //return;\n }\n \n \n this.pos = pos;\n var art = this.articles.elements[this.pos];\n art.show(true);\n var id = art.id.replace(/article\\-/,'');\n \n // load the body!?\n var abody = art.select('.rss-body-preview',true).first();\n Roo.select('.content').first().dom.scrollTop= 0;\n if (typeof(art.rss_body) == 'undefined') {\n \n Roo.Ajax.request({\n method: 'GET',\n mask : 'Fetching Article',\n url : baseURL + '/FeedBody/' + id,\n success : function(res) {\n art.rss_body = res.responseText;\n Rss.showArticle(pos);\n \n \n },\n scope : this\n });\n return;\n \n }\n \n abody.update(art.rss_body || \"Body has not been loaded\",false, function() {\n //Roo.log(\"body loaded\");\n (function() { \n var w = Roo.lib.Dom.getViewportWidth();\n \n Roo.select('img', true).each(function(im) {\n if (im.getWidth() > w) {\n var sf = w/im.getWidth() \n im.setSize(w, im.getHeight() * sf);\n }\n \n \n });\n }).defer(100);\n \n });\n // hide the summary...\n \n \n \n \n \n Roo.get(document.body).unmask();\n \n Roo.select('.rss-art-count').first().update((this.pos +1) +'/' + this.articles.elements.length);\n \n // flag it as read...\n \n Roo.Ajax.request({\n method: 'GET',\n url : baseURL + '/FeedBody/' + id,\n params : { flag_read : 1 }, \n success : function(res) { },\n scope : this\n });\n \n Roo.select('.rss-list-article-' +id +\n ' .count').first().dom.innerHTML = 'Read';\n\n Roo.select('.rss-list-article-' +id).addClass('rss-list-article-read-status-1');\n \n Roo.select('.rss-list-article-' +id +\n ' .count').show();\n \n Roo.select('.rss-list-article-' +id +\n ' .count').first().dom.innerHTML = 'Read';\n\n Roo.select('.rss-list-article-' +id +\n ' .chevron').first().hide();\n \n \n //Roo.select('header h2').first().dom.innerHTML = this.feed_title + ' - ' +\n // art.select('.rss-title').first().dom.innerH\n}", + "| function loadArticle" : "function(pos) { \n \n\n if (pos < 0) {\n Roo.MessageBox.alert(\"error\", \"show article got < 0\");\n }\n \n // Roo.select('.hover-nav').show();\n _this.table.hide(); // hopefully...\n this.show();\n \n var rec = _this.store.getAt(pos);\n if (typeof(rec.data.rss_body) == 'undefined') {\n\n \n new Pman.Request({\n method: 'GET',\n mask : 'Fetching Article',\n url : baseURL + '/FeedBody/' + id,\n success : function(res) {\n rec.data.rss_body = res.responseText;\n Rss.showArticle(pos);\n \n \n },\n scope : this\n });\n return;\n \n }\n \n abody.update(art.rss_body || \"Body has not been loaded\",false, function() {\n //Roo.log(\"body loaded\");\n (function() { \n var w = Roo.lib.Dom.getViewportWidth();\n \n Roo.select('img', true).each(function(im) {\n if (im.getWidth() > w) {\n var sf = w/im.getWidth() \n im.setSize(w, im.getHeight() * sf);\n }\n \n \n });\n }).defer(100);\n \n });\n // hide the summary...\n \n \n \n \n \n Roo.get(document.body).unmask();\n \n Roo.select('.rss-art-count').first().update((this.pos +1) +'/' + this.articles.elements.length);\n \n // flag it as read...\n \n Roo.Ajax.request({\n method: 'GET',\n url : baseURL + '/FeedBody/' + id,\n params : { flag_read : 1 }, \n success : function(res) { },\n scope : this\n });\n \n Roo.select('.rss-list-article-' +id +\n ' .count').first().dom.innerHTML = 'Read';\n\n Roo.select('.rss-list-article-' +id).addClass('rss-list-article-read-status-1');\n \n Roo.select('.rss-list-article-' +id +\n ' .count').show();\n \n Roo.select('.rss-list-article-' +id +\n ' .count').first().dom.innerHTML = 'Read';\n\n Roo.select('.rss-list-article-' +id +\n ' .chevron').first().hide();\n \n \n //Roo.select('header h2').first().dom.innerHTML = this.feed_title + ' - ' +\n // art.select('.rss-title').first().dom.innerH\n}", "$ xns" : "Roo.bootstrap", "Boolean hidden" : true } diff --git a/Reader/Feed.js b/Reader/Feed.js index e408e30..8640b5a 100644 --- a/Reader/Feed.js +++ b/Reader/Feed.js @@ -163,46 +163,18 @@ Feed = new Roo.XComponent({ // Roo.select('.hover-nav').show(); _this.table.hide(); // hopefully... - - var sum = Roo.select('.rss-list',true).first(); - if (!sum) { - return; // we are not on a show article page... - - } - sum.setVisibilityMode(Roo.Element.DISPLAY); - sum.hide() + this.show(); + + var rec = _this.store.getAt(pos); + if (typeof(rec.data.rss_body) == 'undefined') { - Roo.log('showArticle ' + pos); - - var art; - if (this.pos !== false) { - - // feed or list.. - - art = this.articles.elements[this.pos]; - art.hide(); - //this.showArticle(pos); - //this.showArticle.defer(500,this,[pos]); - //return; - } - - - this.pos = pos; - var art = this.articles.elements[this.pos]; - art.show(true); - var id = art.id.replace(/article\-/,''); - - // load the body!? - var abody = art.select('.rss-body-preview',true).first(); - Roo.select('.content').first().dom.scrollTop= 0; - if (typeof(art.rss_body) == 'undefined') { - Roo.Ajax.request({ + new Pman.Request({ method: 'GET', mask : 'Fetching Article', url : baseURL + '/FeedBody/' + id, success : function(res) { - art.rss_body = res.responseText; + rec.data.rss_body = res.responseText; Rss.showArticle(pos); -- 2.39.2