diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-01 20:46:34 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-03-01 20:57:11 +0100 |
commit | 642ccd27ab9ce3bfcc5d0bbec4910268b4cadb28 (patch) | |
tree | ec6fb89bd249fe15be726da8f8cf38f4fcfe82bf /apps/bookmarks/js/bookmarks.js | |
parent | 6ecbaf0041034d77ba0878467b4e369b18dc77e7 (diff) | |
download | nextcloud-server-642ccd27ab9ce3bfcc5d0bbec4910268b4cadb28.tar.gz nextcloud-server-642ccd27ab9ce3bfcc5d0bbec4910268b4cadb28.zip |
Bookmarks: fix loading and displaying of the bookmarks
Diffstat (limited to 'apps/bookmarks/js/bookmarks.js')
-rw-r--r-- | apps/bookmarks/js/bookmarks.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index 7317a154a76..fa5adde2545 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -5,7 +5,11 @@ var bookmarks_sorting = 'bookmarks_sorting_recent'; $(document).ready(function() { $('#bookmark_add_submit').click(addOrEditBookmark); - $(window).scroll(updateOnBottom); + $(window).resize(function () { + fillWindow($('.bookmarks_list')); + }); + $(window).resize(); + $($('.bookmarks_list')).scroll(updateOnBottom); $('.bookmarks_list').empty(); getBookmarks(); @@ -21,7 +25,9 @@ function getBookmarks() { url: 'ajax/updateList.php', data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting, success: function(bookmarks){ - bookmarks_page += 1; + if (bookmarks.data.length) { + bookmarks_page += 1; + } $('.bookmark_link').unbind('click', recordClick); $('.bookmark_delete').unbind('click', delBookmark); $('.bookmark_edit').unbind('click', showBookmark); @@ -39,6 +45,9 @@ function getBookmarks() { $('.bookmark_edit').click(showBookmark); bookmarks_loading = false; + if (bookmarks.data.length) { + updateOnBottom() + } } }); } @@ -146,7 +155,11 @@ function updateBookmarksList(bookmark) { function updateOnBottom() { //check wether user is on bottom of the page - if ($('body').height() <= ($(window).height() + $(window).scrollTop())) { + var top = $('.bookmarks_list>:last-child').position().top; + var height = $('.bookmarks_list').height(); + // use a bit of margin to begin loading before we are really at the + // bottom + if (top < height * 1.2) { getBookmarks(); } } |