diff options
| -rw-r--r-- | .DS_Store | bin | 14340 -> 14340 bytes | |||
| -rw-r--r-- | resources/.DS_Store | bin | 6148 -> 10244 bytes | |||
| -rw-r--r-- | www/js/DataModel.js | 12 | ||||
| -rw-r--r-- | www/js/TimelineCtrl.js | 14 | ||||
| -rw-r--r-- | www/js/app.js | 16 | ||||
| -rw-r--r-- | www/lib/ionic-content-banner/.bower.json | 12 | ||||
| -rw-r--r-- | www/lib/ionic-content-banner/bower.json | 4 | ||||
| -rw-r--r-- | www/lib/ionic-content-banner/dist/ionic.content.banner.js | 41 | ||||
| -rw-r--r-- | www/lib/ionic-content-banner/dist/ionic.content.banner.min.js | 2 |
9 files changed, 67 insertions, 34 deletions
| Binary files differ diff --git a/resources/.DS_Store b/resources/.DS_Store Binary files differindex baa751cc..a68b611d 100644 --- a/resources/.DS_Store +++ b/resources/.DS_Store diff --git a/www/js/DataModel.js b/www/js/DataModel.js index b584fc0c..44992a3f 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -48,13 +48,15 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion var contentBannerInstance = $ionicContentBanner.show({ text: mytext || 'no text', interval: myinterval || 2000, + autoClose: mytimer || 6000, type: mytype || 'info', - transition: 'vertical' + transition: 'vertical', + cancelOnStateChange: false }); - $timeout (function() { + /*$timeout (function() { contentBannerInstance(); - },mytimer || 6000); + },mytimer || 6000);*/ } @@ -330,7 +332,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion $ionicLoading.show({ - template: 'Loading Monitors...', + template: 'loading monitors...', animation: 'fade-in', showBackdrop: true, duration: zm.loadingTimeout, @@ -467,7 +469,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion console.log("ZMData getEvents called with ID=" + monitorId + "and Page=" + pageId); if (!loadingStr) { - loadingStr = "Loading Events..."; + loadingStr = "loading events..."; } //if (loadingStr) loa diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index f626ea32..894ce566 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -354,7 +354,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla - var maxItems = 200; // THAT magic # --> 300 and ZM on my m/c cries + var maxItems = zm.graphItemMax; // THAT magic # --> 300 and ZM on my m/c cries $scope.maxItems = maxItems; $scope.graphLoaded = false; @@ -575,7 +575,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla if (graphIndex > 200) { - ZMDataModel.zmLog ("Exiting page count graph - reached 200"); + ZMDataModel.zmLog ("Exiting page count graph - reached limit of " + zm.graphItemMax); break; } @@ -596,15 +596,15 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla myename: myevents[i].Event.Name, }); - console.log ("Added: Monitor:"+myevents[i].Event.MonitorId + - " Start:" + myevents[i].Event.StartTime + - " Stop:"+myevents[i].Event.EndTime); + //console.log ("Added: Monitor:"+myevents[i].Event.MonitorId + + // " Start:" + myevents[i].Event.StartTime + + // " Stop:"+myevents[i].Event.EndTime); graphIndex++; - if (graphIndex > 200) + if (graphIndex > zm.graphItemMax) { - ZMDataModel.zmLog ("Exiting event graph - reached 200"); + ZMDataModel.zmLog ("Exiting event graph - reached limit of " + zm.graphItemMax); break; } diff --git a/www/js/app.js b/www/js/app.js index 43873675..bbcc50a8 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -40,6 +40,7 @@ angular.module('zmApp', [ graphFillColor: 'rgba(151,187,205,0.5)', graphStrokeColor: 'rgba(151,187,205,0.8)', graphHighlightFill: 'rgba(0,163,124,0.5)', + graphItemMax: 200, monitorCheckingColor: '#03A9F4', monitorNotRunningColor: '#F44336', monitorPendingColor: '#FF9800', @@ -245,17 +246,10 @@ angular.module('zmApp', [ $rootScope.$on("auth-error", function () { console.log("**** ZM LOGIN ERROR INTERCEPT"); - - var contentBannerInstance = $ionicContentBanner.show({ - text: ['ZoneMinder authentication failed', 'Please check settings'], - interval: 2000, - type: 'error', - transition: 'vertical' - }); - - $timeout(function () { - contentBannerInstance(); - }, 6000); + + ZMDataModel.displayBanner ('error',['ZoneMinder authentication failed', 'Please check settings']); + + /*var alertPopup = $ionicPopup.alert( diff --git a/www/lib/ionic-content-banner/.bower.json b/www/lib/ionic-content-banner/.bower.json index d23a9107..1a29595f 100644 --- a/www/lib/ionic-content-banner/.bower.json +++ b/www/lib/ionic-content-banner/.bower.json @@ -1,6 +1,6 @@ { "name": "ionic-content-banner", - "version": "1.0.0", + "version": "1.0.1", "description": "A content banner directive for Ionic apps that animates in on the active ion-content", "author": "Devin Jett <djett41@gmail.com> (https://github.com/djett41)", "main": [ @@ -25,7 +25,7 @@ "dependencies": {}, "devDependencies": { "ionic": "^1.0.0-rc.0", - "angular-mocks": "1.3.13" + "angular-mocks": "1.4.3" }, "keywords": [ "mobile", @@ -42,14 +42,14 @@ "license": "MIT", "private": false, "homepage": "https://github.com/djett41/ionic-content-banner", - "_release": "1.0.0", + "_release": "1.0.1", "_resolution": { "type": "version", - "tag": "v1.0.0", - "commit": "08f9779e742299e7dbe17e8481450f2763a1f6f5" + "tag": "v1.0.1", + "commit": "79ce49f1df0b70079424f07e3c9940262cfe8123" }, "_source": "git://github.com/djett41/ionic-content-banner.git", - "_target": "~1.0.0", + "_target": "~1.0.1", "_originalSource": "ionic-content-banner", "_direct": true }
\ No newline at end of file diff --git a/www/lib/ionic-content-banner/bower.json b/www/lib/ionic-content-banner/bower.json index 10918b46..7e330544 100644 --- a/www/lib/ionic-content-banner/bower.json +++ b/www/lib/ionic-content-banner/bower.json @@ -1,6 +1,6 @@ { "name": "ionic-content-banner", - "version": "1.0.0", + "version": "1.0.1", "description": "A content banner directive for Ionic apps that animates in on the active ion-content", "author": "Devin Jett <djett41@gmail.com> (https://github.com/djett41)", "main": [ @@ -25,7 +25,7 @@ "dependencies": {}, "devDependencies": { "ionic": "^1.0.0-rc.0", - "angular-mocks": "1.3.13" + "angular-mocks": "1.4.3" }, "keywords": [ "mobile", diff --git a/www/lib/ionic-content-banner/dist/ionic.content.banner.js b/www/lib/ionic-content-banner/dist/ionic.content.banner.js index 0dec733b..e79f46ca 100644 --- a/www/lib/ionic-content-banner/dist/ionic.content.banner.js +++ b/www/lib/ionic-content-banner/dist/ionic.content.banner.js @@ -57,6 +57,36 @@ angular.module('jett.ionic.content.banner', ['ionic']); '$ionicPlatform', function ($document, $rootScope, $compile, $timeout, $ionicPlatform) { + function isActiveView (node) { + // walk up the child-parent node chain until we get to the root or the BODY + while (node !== null && node.nodeName !== 'BODY') { + var navView = node.getAttribute("nav-view"); + + // as soon as we encounter a cached (parent) view then we know the view can't be active + if (navView !== null && navView === 'cached') { + return false; + } + node = node.parentNode; + } + // no cached parent seen, the view must be really active + return true; + } + + function getActiveView (body) { + // get the candidate active views + var views = body.querySelectorAll('ion-view[nav-view="active"]'); + + // only one candidate, so we just take it + if (views.length === 1) { + return views[0]; + } + + // convert the NodeList to an array, filter it using 'isActiveView' and return the first element + return Array.prototype.slice.call(views).filter(function (view) { + return isActiveView(view); + })[0]; + } + /** * @ngdoc method * @name $ionicContentBanner#show @@ -72,7 +102,8 @@ angular.module('jett.ionic.content.banner', ['ionic']); interval: 7000, type: 'info', $deregisterBackButton: angular.noop, - closeOnStateChange: true + closeOnStateChange: true, + autoClose: null }, opts); // Compile the template @@ -115,11 +146,17 @@ angular.module('jett.ionic.content.banner', ['ionic']); return; } - body.querySelector('ion-view[nav-view="active"] .scroll-content').appendChild(element[0]); + getActiveView(body).querySelector('.scroll-content').appendChild(element[0]); ionic.requestAnimationFrame(function () { $timeout(function () { element.addClass('content-banner-in'); + //automatically close if autoClose is configured + if (scope.autoClose) { + $timeout(function () { + scope.close(); + }, scope.autoClose, false); + } }, 20, false); }); }; diff --git a/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js b/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js index d293e517..4fd070e9 100644 --- a/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js +++ b/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js @@ -1 +1 @@ -angular.module("jett.ionic.content.banner",["ionic"]),function(n){"use strict";n.module("jett.ionic.content.banner").directive("ionContentBanner",["$interval",function(n){return{restrict:"E",scope:!0,link:function(e,t){var o;e.currentIndex=0,e.text.length>1&&(o=n(function(){e.currentIndex=e.currentIndex<e.text.length-1?e.currentIndex+1:0},e.interval)),e.$on("$destroy",function(){t.remove(),o&&n.cancel(o)})},template:'<div class="content-banner-text-wrapper"><div ng-repeat="item in text track by $index" ng-class="{active: $index === currentIndex}" class="content-banner-text" ng-bind="item"></div></div><button class="content-banner-close button button-icon icon {{::icon}}" ng-click="close()"></button>'}}])}(angular),function(n,e){"use strict";n.module("jett.ionic.content.banner").factory("$ionicContentBanner",["$document","$rootScope","$compile","$timeout","$ionicPlatform",function(t,o,c,i,r){function a(a){var s=o.$new(!0);n.extend(s,{icon:"ion-ios-close-empty",transition:"vertical",interval:7e3,type:"info",$deregisterBackButton:n.noop,closeOnStateChange:!0},a);var u="content-banner "+s.type+" content-banner-transition-"+s.transition,l=s.element=c('<ion-content-banner class="'+u+'"></ion-content-banner>')(s),d=t[0].body,v=s.closeOnStateChange?o.$on("$stateChangeSuccess",function(){s.close()}):n.noop;return s.$deregisterBackButton=r.registerBackButtonAction(function(){i(s.close)},300),s.close=function(){s.removed||(s.removed=!0,e.requestAnimationFrame(function(){l.removeClass("content-banner-in"),i(function(){s.$destroy(),l.remove(),d=v=null},400)}),s.$deregisterBackButton(),v())},s.show=function(){s.removed||(d.querySelector('ion-view[nav-view="active"] .scroll-content').appendChild(l[0]),e.requestAnimationFrame(function(){i(function(){l.addClass("content-banner-in")},20,!1)}))},i(function(){s.show()},10,!1),s.close.$scope=s,s.close}return{show:a}}])}(angular,ionic);
\ No newline at end of file +angular.module("jett.ionic.content.banner",["ionic"]),function(n){"use strict";n.module("jett.ionic.content.banner").directive("ionContentBanner",["$interval",function(n){return{restrict:"E",scope:!0,link:function(e,t){var o;e.currentIndex=0,e.text.length>1&&(o=n(function(){e.currentIndex=e.currentIndex<e.text.length-1?e.currentIndex+1:0},e.interval)),e.$on("$destroy",function(){t.remove(),o&&n.cancel(o)})},template:'<div class="content-banner-text-wrapper"><div ng-repeat="item in text track by $index" ng-class="{active: $index === currentIndex}" class="content-banner-text" ng-bind="item"></div></div><button class="content-banner-close button button-icon icon {{::icon}}" ng-click="close()"></button>'}}])}(angular),function(n,e){"use strict";n.module("jett.ionic.content.banner").factory("$ionicContentBanner",["$document","$rootScope","$compile","$timeout","$ionicPlatform",function(t,o,c,r,i){function a(n){for(;null!==n&&"BODY"!==n.nodeName;){var e=n.getAttribute("nav-view");if(null!==e&&"cached"===e)return!1;n=n.parentNode}return!0}function u(n){var e=n.querySelectorAll('ion-view[nav-view="active"]');return 1===e.length?e[0]:Array.prototype.slice.call(e).filter(function(n){return a(n)})[0]}function l(a){var l=o.$new(!0);n.extend(l,{icon:"ion-ios-close-empty",transition:"vertical",interval:7e3,type:"info",$deregisterBackButton:n.noop,closeOnStateChange:!0,autoClose:null},a);var s="content-banner "+l.type+" content-banner-transition-"+l.transition,d=l.element=c('<ion-content-banner class="'+s+'"></ion-content-banner>')(l),f=t[0].body,v=l.closeOnStateChange?o.$on("$stateChangeSuccess",function(){l.close()}):n.noop;return l.$deregisterBackButton=i.registerBackButtonAction(function(){r(l.close)},300),l.close=function(){l.removed||(l.removed=!0,e.requestAnimationFrame(function(){d.removeClass("content-banner-in"),r(function(){l.$destroy(),d.remove(),f=v=null},400)}),l.$deregisterBackButton(),v())},l.show=function(){l.removed||(u(f).querySelector(".scroll-content").appendChild(d[0]),e.requestAnimationFrame(function(){r(function(){d.addClass("content-banner-in"),l.autoClose&&r(function(){l.close()},l.autoClose,!1)},20,!1)}))},r(function(){l.show()},10,!1),l.close.$scope=l,l.close}return{show:l}}])}(angular,ionic);
\ No newline at end of file |
