summaryrefslogtreecommitdiffstats
path: root/js/build/app.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-15 15:37:43 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-15 15:37:43 +0200
commitad701076c12795609d0c6ae0cb9b40a001726dea (patch)
treeb62e13494391520956add5f783e994a7c4aa0f34 /js/build/app.js
parentce118f2a97d49d218afed33ef7029ce09b95c044 (diff)
add pull to refresh
Diffstat (limited to 'js/build/app.js')
-rw-r--r--js/build/app.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/js/build/app.js b/js/build/app.js
index 9ca4def23..442f2095e 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -2019,6 +2019,33 @@ app.directive('newsFocus', ["$timeout", "$interpolate", function ($timeout, $int
};
}]);
+app.directive('newsPullToRefresh', ["$route", "$rootScope", function ($route, $rootScope) {
+ 'use strict';
+
+ var scrolled = false;
+
+ return {
+ restrict: 'A',
+ scope: {
+ 'newsTimeout': '&'
+ },
+ link: function (scope, element) {
+
+ // change in the route means the content is refreshed
+ // so reset the var
+ $rootScope.$on('$routeChangeStart', function () {
+ scrolled = false;
+ });
+
+ element.on('scroll', function () {
+ if (element.scrollTop() === 0 && scrolled) {
+ $route.reload();
+ }
+ scrolled = true;
+ });
+ }
+ };
+}]);
app.directive('newsReadFile', function () {
'use strict';
@@ -2180,7 +2207,8 @@ app.directive('newsTimeout', ["$timeout", "$rootScope", function ($timeout, $roo
$timeout.cancel(timer);
});
- // route change also triggers the timeout
+ // also delete the entry if undo is ignored and the url
+ // is changed
$rootScope.$on('$locationChangeStart', function () {
element.remove();
});