From 0170128d6abb193db01f37962d9aa51c2e39bad1 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 7 Sep 2020 07:45:14 -0400 Subject: make sure pullup directive cleans up resize listern --- www/external/js/ion-pullup.min.js | 2 +- www/js/EventCtrl.js | 4 +++- www/js/MontageHistoryCtrl.js | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'www') diff --git a/www/external/js/ion-pullup.min.js b/www/external/js/ion-pullup.min.js index efbcc552..5cd85289 100644 --- a/www/external/js/ion-pullup.min.js +++ b/www/external/js/ion-pullup.min.js @@ -1 +1 @@ -angular.module("ionic-pullup",[]).constant("ionPullUpFooterState",{COLLAPSED:"COLLAPSED",MINIMIZED:"MINIMIZED",EXPANDED:"EXPANDED"}).constant("ionPullUpFooterBehavior",{HIDE:"HIDE",EXPAND:"EXPAND"}).directive("ionPullUpFooter",[function(){return{restrict:"AE",scope:{state:"=?",onExpand:"&",onCollapse:"&",onMinimize:"&",allowMidRange:"="},controller:["$scope","$element","$attrs","$timeout","$rootScope","$window","$ionicPlatform","ionPullUpFooterState","ionPullUpFooterBehavior",function(t,e,o,n,i,a,s,r,l){function c(){var t=e[0];f=t.closest("ion-tabs"),g=f&&f.classList.contains("tabs-bottom"),E=document.querySelector("ion-nav-bar .nav-bar-block[nav-bar=entering] > .bar-header"),D=f?f.querySelector(".tabs").offsetHeight:0,I=E?E.offsetHeight:0}function u(){n(function(){m.height=m.maxHeight>0?m.maxHeight:a.innerHeight-I-P-D,m.height-=50,"ios"==i.platformOS&&(m.height-=30),e.css({height:m.height+"px"}),m.initialState==r.MINIMIZED?d():p()},300),e.css({transition:"none",padding:0})}function h(){c(),m.height=m.maxHeight>0?m.maxHeight:a.innerHeight-I-P-D,m.height-=50,"ios"==i.platformOS&&(m.height-=30),m.lastPosY=0,e.css({height:m.height+"px","-webkit-transform":"translate3d(0, 0, 0)",transform:"translate3d(0, 0, 0)"}),e.css({transition:"300ms ease-in-out",padding:0}),t.onExpand(),t.state=r.EXPANDED}function p(){m.lastPosY=f?m.height-D:m.height-m.defaultHeight,e.css({"-webkit-transform":"translate3d(0, "+m.lastPosY+"px, 0)",transform:"translate3d(0, "+m.lastPosY+"px, 0)"}),t.onCollapse(),t.state=r.COLLAPSED}function d(){m.lastPosY=m.height,e.css({"-webkit-transform":"translate3d(0, "+m.lastPosY+"px, 0)",transform:"translate3d(0, "+m.lastPosY+"px, 0)"}),t.onMinimize(),t.state=r.MINIMIZED}var f,g,E,D,I,P=0,m={height:0,posY:0,lastPosY:0,defaultHeight:e[0].offsetHeight,maxHeight:parseInt(o.maxHeight,10)||0,initialState:o.initialState?o.initialState.toUpperCase():r.COLLAPSED,defaultBehavior:o.defaultBehavior?o.defaultBehavior.toUpperCase():l.EXPAND};this.$onInit=function(){n(function(){c(),e.css({transition:"300ms ease-in-out",padding:0}),f&&g&&e.css("bottom",D+"px")}),u()},this.setHandleHeight=function(t){P=t},this.getHeight=function(){return e[0].offsetHeight},this.getBackground=function(){return a.getComputedStyle(e[0]).background},this.getInitialState=function(){return m.initialState},this.getDefaultBehavior=function(){return m.defaultBehavior},this.onTap=function(e){e.gesture.srcEvent.preventDefault(),e.gesture.preventDefault(),n(function(){t.state==r.COLLAPSED?m.defaultBehavior==l.HIDE?t.state=r.MINIMIZED:t.state=r.EXPANDED:t.state==r.MINIMIZED?m.defaultBehavior==l.HIDE?t.state=r.COLLAPSED:t.state=r.EXPANDED:t.state=m.initialState==r.MINIMIZED?r.MINIMIZED:r.COLLAPSED})},this.onDrag=function(o){switch(o.gesture.srcEvent.preventDefault(),o.gesture.preventDefault(),o.type){case"dragstart":e.css("transition","none");break;case"drag":if(m.posY=Math.round(o.gesture.deltaY)+m.lastPosY,m.posY<0||m.posY>m.height)return;e.css({"-webkit-transform":"translate3d(0, "+m.posY+"px, 0)",transform:"translate3d(0, "+m.posY+"px, 0)"});break;case"dragend":e.css({transition:"300ms ease-in-out"}),t.allowMidRange?m.lastPosY=m.posY:n(function(){m.lastPosY>m.posY?t.state=r.EXPANDED:m.lastPosY"),this.$onInit=function(){var t=this.FooterController;a.on("tap",t.onTap,e),a.on("drag dragstart dragend",t.onDrag,e),t.setHandleHeight(h);c(t.getInitialState(),t.getDefaultBehavior()),u()},t.$on("ionPullUp:tap",function(t,e,o){c(e,o)}),s.ready(function(){l.addEventListener("orientationchange",u),s.on("resume",u)})}]}); +angular.module("ionic-pullup",[]).constant("ionPullUpFooterState",{COLLAPSED:"COLLAPSED",MINIMIZED:"MINIMIZED",EXPANDED:"EXPANDED"}).constant("ionPullUpFooterBehavior",{HIDE:"HIDE",EXPAND:"EXPAND"}).directive("ionPullUpFooter",[function(){return{restrict:"AE",scope:{state:"=?",onExpand:"&",onCollapse:"&",onMinimize:"&",allowMidRange:"="},controller:["$scope","$element","$attrs","$timeout","$rootScope","$window","$ionicPlatform","ionPullUpFooterState","ionPullUpFooterBehavior",function(t,e,n,o,i,a,r,s,l){var c,u,h,p,d,f=0,g={height:0,posY:0,lastPosY:0,defaultHeight:e[0].offsetHeight,maxHeight:parseInt(n.maxHeight,10)||0,initialState:n.initialState?n.initialState.toUpperCase():s.COLLAPSED,defaultBehavior:n.defaultBehavior?n.defaultBehavior.toUpperCase():l.EXPAND};function E(){var t=e[0];c=t.closest("ion-tabs"),u=c&&c.classList.contains("tabs-bottom"),h=document.querySelector("ion-nav-bar .nav-bar-block[nav-bar=entering] > .bar-header"),p=c?c.querySelector(".tabs").offsetHeight:0,d=h?h.offsetHeight:0}function D(){o((function(){g.height=g.maxHeight>0?g.maxHeight:a.innerHeight-d-f-p,g.height-=50,"ios"==i.platformOS&&(g.height-=30),e.css({height:g.height+"px"}),g.initialState==s.MINIMIZED?m():P()}),300),e.css({transition:"none",padding:0})}function I(){E(),g.height=g.maxHeight>0?g.maxHeight:a.innerHeight-d-f-p,g.height-=50,"ios"==i.platformOS&&(g.height-=30),g.lastPosY=0,e.css({height:g.height+"px","-webkit-transform":"translate3d(0, 0, 0)",transform:"translate3d(0, 0, 0)"}),e.css({transition:"300ms ease-in-out",padding:0}),t.onExpand(),t.state=s.EXPANDED}function P(){g.lastPosY=c?g.height-p:g.height-g.defaultHeight,e.css({"-webkit-transform":"translate3d(0, "+g.lastPosY+"px, 0)",transform:"translate3d(0, "+g.lastPosY+"px, 0)"}),t.onCollapse(),t.state=s.COLLAPSED}function m(){g.lastPosY=g.height,e.css({"-webkit-transform":"translate3d(0, "+g.lastPosY+"px, 0)",transform:"translate3d(0, "+g.lastPosY+"px, 0)"}),t.onMinimize(),t.state=s.MINIMIZED}this.$onInit=function(){o((function(){E(),e.css({transition:"300ms ease-in-out",padding:0}),c&&u&&e.css("bottom",p+"px")})),D()},this.setHandleHeight=function(t){f=t},this.getHeight=function(){return e[0].offsetHeight},this.getBackground=function(){return a.getComputedStyle(e[0]).background},this.getInitialState=function(){return g.initialState},this.getDefaultBehavior=function(){return g.defaultBehavior},this.onTap=function(e){e.gesture.srcEvent.preventDefault(),e.gesture.preventDefault(),o((function(){t.state==s.COLLAPSED?g.defaultBehavior==l.HIDE?t.state=s.MINIMIZED:t.state=s.EXPANDED:t.state==s.MINIMIZED?g.defaultBehavior==l.HIDE?t.state=s.COLLAPSED:t.state=s.EXPANDED:t.state=g.initialState==s.MINIMIZED?s.MINIMIZED:s.COLLAPSED}))},this.onDrag=function(n){switch(n.gesture.srcEvent.preventDefault(),n.gesture.preventDefault(),n.type){case"dragstart":e.css("transition","none");break;case"drag":if(g.posY=Math.round(n.gesture.deltaY)+g.lastPosY,g.posY<0||g.posY>g.height)return;e.css({"-webkit-transform":"translate3d(0, "+g.posY+"px, 0)",transform:"translate3d(0, "+g.posY+"px, 0)"});break;case"dragend":e.css({transition:"300ms ease-in-out"}),t.allowMidRange?g.lastPosY=g.posY:o((function(){g.lastPosY>g.posY?t.state=s.EXPANDED:g.lastPosY"),this.$onInit=function(){var t=this.FooterController;a.on("tap",t.onTap,e),a.on("drag dragstart dragend",t.onDrag,e),t.setHandleHeight(c),d(t.getInitialState(),t.getDefaultBehavior()),f()},t.$on("ionPullUp:tap",(function(t,e,n){d(e,n)})),r.ready((function(){l.addEventListener("orientationchange",f),r.on("resume",f)}))}]}); diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 75576a0f..502a568d 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -32,7 +32,7 @@ angular.module('zmApp.controllers') }) - .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVR', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', '$ionicListDelegate', 'ionPullUpFooterState', 'SecuredPopups', function ($scope, $rootScope, zm, NVR, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile, $ionicListDelegate, ionPullUpFooterState,SecuredPopups) { + .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVR', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', '$ionicListDelegate', 'ionPullUpFooterState', 'SecuredPopups', '$window', function ($scope, $rootScope, zm, NVR, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile, $ionicListDelegate, ionPullUpFooterState,SecuredPopups, $window) { // events in last 5 minutes // TODO https://server/zm/api/events/consoleEvents/5%20minute.json @@ -182,6 +182,8 @@ angular.module('zmApp.controllers') $scope.$on('$ionicView.beforeLeave', function () { + //$window.removeEventListener('orientationchange', updateUI); + if ($stateParams.lastCheckTime != undefined && $stateParams.lastCheckTime != '' && moment($stateParams.lastCheckTime).isValid()) { NVR.debug ("removing montage temporary filter"); $rootScope.isEventFilterOn = false; diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index 8915799e..501c0f48 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -1116,6 +1116,8 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc viewCleanup(); viewCleaned = true; + //$window.removeEventListener('orientationchange', updateUI); + document.removeEventListener("pause", onPause, false); document.removeEventListener("resume", onResume, false); -- cgit v1.2.3