diff --git a/public_html/index.html b/public_html/index.html
index 1f50295f..7d3fd308 100644
--- a/public_html/index.html
+++ b/public_html/index.html
@@ -106,6 +106,7 @@
+
diff --git a/public_html/js/PresenterManager.js b/public_html/js/PresenterManager.js
index 921363fc..a1e98f54 100644
--- a/public_html/js/PresenterManager.js
+++ b/public_html/js/PresenterManager.js
@@ -1,6 +1,6 @@
var App = App || {};
-App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboard, nprogress) {
+App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboard, progress) {
var lastContentPresenter = null;
@@ -15,7 +15,7 @@ App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboar
}
function switchContentPresenter(presenter, args) {
- nprogress.start();
+ progress.start();
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
if (lastContentPresenter !== null && lastContentPresenter.deinit) {
@@ -24,10 +24,10 @@ App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboar
keyboard.reset();
topNavigationPresenter.changeTitle(null);
topNavigationPresenter.focus();
- presenter.init.call(presenter, args, nprogress.done);
+ presenter.init.call(presenter, args, progress.done);
lastContentPresenter = presenter;
} else if (lastContentPresenter.reinit) {
- lastContentPresenter.reinit.call(lastContentPresenter, args, nprogress.done);
+ lastContentPresenter.reinit.call(lastContentPresenter, args, progress.done);
}
}
@@ -54,4 +54,4 @@ App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboar
};
-App.DI.registerSingleton('presenterManager', ['jQuery', 'promise', 'topNavigationPresenter', 'keyboard', 'nprogress'], App.PresenterManager);
+App.DI.registerSingleton('presenterManager', ['jQuery', 'promise', 'topNavigationPresenter', 'keyboard', 'progress'], App.PresenterManager);
diff --git a/public_html/js/Presenters/PagerPresenter.js b/public_html/js/Presenters/PagerPresenter.js
index 970ff22a..58d1fe26 100644
--- a/public_html/js/Presenters/PagerPresenter.js
+++ b/public_html/js/Presenters/PagerPresenter.js
@@ -11,7 +11,7 @@ App.Presenters.PagerPresenter = function(
pager,
messagePresenter,
browsingSettings,
- nprogress) {
+ progress) {
var $target;
var $pageList;
@@ -85,11 +85,12 @@ App.Presenters.PagerPresenter = function(
function retrieve() {
messagePresenter.hideMessages($messages);
- nprogress.start();
+ progress.start();
return promise.make(function(resolve, reject) {
promise.wait(pager.retrieve())
.then(function(response) {
+ progress.done();
updateCallback(response, forceClear || !endlessScroll);
forceClear = false;
if (!response.entities.length) {
@@ -107,12 +108,11 @@ App.Presenters.PagerPresenter = function(
attachNextPageLoader();
}
refreshPageList();
- nprogress.done();
resolve();
}).fail(function(response) {
+ progress.done();
clearContent();
hidePageList();
- nprogress.done();
messagePresenter.showError($messages, response.json && response.json.error || response);
reject();
@@ -223,4 +223,4 @@ App.Presenters.PagerPresenter = function(
};
-App.DI.register('pagerPresenter', ['_', 'jQuery', 'util', 'promise', 'keyboard', 'router', 'pager', 'messagePresenter', 'browsingSettings', 'nprogress'], App.Presenters.PagerPresenter);
+App.DI.register('pagerPresenter', ['_', 'jQuery', 'util', 'promise', 'keyboard', 'router', 'pager', 'messagePresenter', 'browsingSettings', 'progress'], App.Presenters.PagerPresenter);
diff --git a/public_html/js/Presenters/ProgressPresenter.js b/public_html/js/Presenters/ProgressPresenter.js
new file mode 100644
index 00000000..11f4ec2b
--- /dev/null
+++ b/public_html/js/Presenters/ProgressPresenter.js
@@ -0,0 +1,31 @@
+var App = App || {};
+App.Controls = App.Controls || {};
+
+App.Presenters.ProgressPresenter = function(nprogress) {
+ var nesting = 0;
+
+ function start() {
+ nesting ++;
+
+ if (nesting === 1) {
+ nprogress.start();
+ }
+ }
+
+ function done() {
+ nesting --;
+
+ if (nesting === 0) {
+ nprogress.done();
+ } else {
+ nprogress.inc();
+ }
+ }
+
+ return {
+ start: start,
+ done: done,
+ };
+}
+
+App.DI.registerSingleton('progress', ['nprogress'], App.Presenters.ProgressPresenter);