mirror of
https://github.com/owncloud/bookmarks.git
synced 2024-11-30 05:24:09 +01:00
Bookmarks: fix loading and displaying of the bookmarks
This commit is contained in:
parent
b69f6654f2
commit
e931a70d3f
@ -17,7 +17,9 @@
|
||||
}
|
||||
|
||||
.bookmarks_list {
|
||||
margin-top: 36px;
|
||||
overflow: auto;
|
||||
position: fixed;
|
||||
top: 6.5em;
|
||||
}
|
||||
|
||||
.bookmarks_addBml {
|
||||
|
@ -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){
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user