BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8d397706
Commit
8d397706
authored
Nov 20, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continue to auto-load content while the window is not scrollable
parent
283bca3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
pager.js.es6
app/assets/javascripts/pager.js.es6
+16
-5
No files found.
app/assets/javascripts/pager.js.es6
View file @
8d397706
...
...
@@ -20,10 +20,17 @@
type: 'GET',
url: $('.content_list').data('href') || window.location.href,
data: `limit=${this.limit}&offset=${this.offset}`,
complete
: () => this.loading.hide(),
error
: () => this.loading.hide(),
success: (data) => {
Pager.append(data.count, data.html);
Pager.callback();
this.append(data.count, data.html);
this.callback();
// keep loading until we've filled the viewport height
if (!this.isScrollable()) {
this.getOld();
} else {
this.loading.hide();
}
},
dataType: 'json',
});
...
...
@@ -38,17 +45,21 @@
}
},
isScrollable() {
return $(document).height() > $(window).height() + $(window).scrollTop() + 400;
},
initLoadMore() {
$(document).unbind('scroll');
$(document).endlessScroll({
bottomPixels: 400,
fireDelay: 1000,
fireOnce: true,
ceaseFire: () =>
Pager.disable !
== true,
ceaseFire: () =>
this.disable =
== true,
callback: () => {
if (!this.loading.is(':visible')) {
this.loading.show();
Pager
.getOld();
this
.getOld();
}
},
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment