mirror of
https://github.com/owncloud/bookmarks.git
synced 2025-02-28 00:54:31 +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 {
|
.bookmarks_list {
|
||||||
margin-top: 36px;
|
overflow: auto;
|
||||||
|
position: fixed;
|
||||||
|
top: 6.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks_addBml {
|
.bookmarks_addBml {
|
||||||
|
@ -5,7 +5,11 @@ var bookmarks_sorting = 'bookmarks_sorting_recent';
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#bookmark_add_submit').click(addOrEditBookmark);
|
$('#bookmark_add_submit').click(addOrEditBookmark);
|
||||||
$(window).scroll(updateOnBottom);
|
$(window).resize(function () {
|
||||||
|
fillWindow($('.bookmarks_list'));
|
||||||
|
});
|
||||||
|
$(window).resize();
|
||||||
|
$($('.bookmarks_list')).scroll(updateOnBottom);
|
||||||
|
|
||||||
$('.bookmarks_list').empty();
|
$('.bookmarks_list').empty();
|
||||||
getBookmarks();
|
getBookmarks();
|
||||||
@ -21,7 +25,9 @@ function getBookmarks() {
|
|||||||
url: 'ajax/updateList.php',
|
url: 'ajax/updateList.php',
|
||||||
data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
data: 'tag=' + encodeURI($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
||||||
success: function(bookmarks){
|
success: function(bookmarks){
|
||||||
|
if (bookmarks.data.length) {
|
||||||
bookmarks_page += 1;
|
bookmarks_page += 1;
|
||||||
|
}
|
||||||
$('.bookmark_link').unbind('click', recordClick);
|
$('.bookmark_link').unbind('click', recordClick);
|
||||||
$('.bookmark_delete').unbind('click', delBookmark);
|
$('.bookmark_delete').unbind('click', delBookmark);
|
||||||
$('.bookmark_edit').unbind('click', showBookmark);
|
$('.bookmark_edit').unbind('click', showBookmark);
|
||||||
@ -39,6 +45,9 @@ function getBookmarks() {
|
|||||||
$('.bookmark_edit').click(showBookmark);
|
$('.bookmark_edit').click(showBookmark);
|
||||||
|
|
||||||
bookmarks_loading = false;
|
bookmarks_loading = false;
|
||||||
|
if (bookmarks.data.length) {
|
||||||
|
updateOnBottom()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -146,7 +155,11 @@ function updateBookmarksList(bookmark) {
|
|||||||
|
|
||||||
function updateOnBottom() {
|
function updateOnBottom() {
|
||||||
//check wether user is on bottom of the page
|
//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();
|
getBookmarks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user