diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | README.rst | 1 | ||||
-rw-r--r-- | js/app/app.coffee | 7 | ||||
-rw-r--r-- | js/app/directives/newsitemscroll.coffee | 21 | ||||
-rw-r--r-- | js/public/app.js | 22 |
5 files changed, 38 insertions, 14 deletions
@@ -1,5 +1,6 @@ ownCloud-news (1.0~beta) +* Prefer website favicon over channel image, fixes wordpress blog favicons * Add all businesslayer methods for the current API spec * API Specification Draft * Fix a bug that would cause words in the headlines to always be wrapped diff --git a/README.rst b/README.rst index 2e92c0126..9dcd2f831 100644 --- a/README.rst +++ b/README.rst @@ -18,6 +18,7 @@ Bugs ---- Before reporting bugs: +* We do not support Internet Explorer and Safari (Patches accepted though, except for IE < 10) * get the newest version of the App Framework * get the newest version of the News app * `check if they already have been reported <https://github.com/owncloud/news/issues?state=open>`_ diff --git a/js/app/app.coffee b/js/app/app.coffee index f9fe4b526..03497348d 100644 --- a/js/app/app.coffee +++ b/js/app/app.coffee @@ -28,10 +28,9 @@ angular.module('News', ['OC', 'ui']).config ($provide) -> scrollTimeout: 500 feedUpdateInterval: 1000*60*3 # miliseconds itemBatchSize: 20 - # the autoPageFactor defines how many heights of the box must be left - # before it starts autopaging e.g. if it was 2, then it will start - # to fetch new items if less than the height*2 px is left to scroll - autoPageFactor: 6 + # the autoPageFactor defines how many articles must be left + # before it starts autopaging + autoPageFactor: 10 angular.module('News').run ['Persistence', 'Config', diff --git a/js/app/directives/newsitemscroll.coffee b/js/app/directives/newsitemscroll.coffee index 619710bf3..5d8345999 100644 --- a/js/app/directives/newsitemscroll.coffee +++ b/js/app/directives/newsitemscroll.coffee @@ -57,10 +57,23 @@ angular.module('News').directive 'newsItemScroll', ['$rootScope', 'Config', , Config.MarkReadTimeout # autopaging - tolerance = elm.height() * Config.autoPageFactor - remaining = elm[0].scrollHeight - elm.scrollTop() - tolerance - if remaining <= 0 - $rootScope.$broadcast 'autoPage' + counter = 0 + + # run from the bottom up to be performant + for item in elm.find('.feed_item') by -1 + + # if the counter is 10 it means that it didnt break to auto + # page yet and that there are more than 10 items, so break + if counter >= Config.autoPageFactor + break + + # this is only reached when the item is not is below the top + # and we didnt hit the factor yet so autopage and break + if $(item).position().top < 0 + $rootScope.$broadcast 'autoPage' + break + + counter += 1 ] diff --git a/js/public/app.js b/js/public/app.js index 1ce79357b..ab12599c9 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -43,7 +43,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. scrollTimeout: 500, feedUpdateInterval: 1000 * 60 * 3, itemBatchSize: 20, - autoPageFactor: 6 + autoPageFactor: 10 }); }); @@ -277,7 +277,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. '$rootScope', 'Config', function($rootScope, Config) { return function(scope, elm, attr) { return elm.bind('scroll', function() { - var remaining, tolerance; + var counter, item, _i, _ref, _results; if (scrolling) { scrolling = false; @@ -305,11 +305,21 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return _results; }, Config.MarkReadTimeout); } - tolerance = elm.height() * Config.autoPageFactor; - remaining = elm[0].scrollHeight - elm.scrollTop() - tolerance; - if (remaining <= 0) { - return $rootScope.$broadcast('autoPage'); + counter = 0; + _ref = elm.find('.feed_item'); + _results = []; + for (_i = _ref.length - 1; _i >= 0; _i += -1) { + item = _ref[_i]; + if (counter >= Config.autoPageFactor) { + break; + } + if ($(item).position().top < 0) { + $rootScope.$broadcast('autoPage'); + break; + } + _results.push(counter += 1); } + return _results; } }); }; |