From 66ee9fe3e85e10c9201659b9ae9b3032592f9a79 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 24 Aug 2017 12:33:18 -0400 Subject: #530 - allow you to customize timer for montage cycle --- www/js/MontageCtrl.js | 23 ++++++++++++++++++++--- www/lang/locale-en.json | 1 + www/templates/devoptions.html | 9 +++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) (limited to 'www') diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index d1185a8c..e2e26c00 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -365,8 +365,22 @@ angular.module('zmApp.controllers') function findNext (key,obj) { + console.log (" key is: "+ key); + console.log ("array is " + JSON.stringify (obj)); var keys = Object.keys(obj); - return keys[(keys.indexOf(key) + 1) % keys.length]; + + var len = keys.length; + var curindex = keys.indexOf(key); + var modulus = (curindex + 1) % len; + + console.log ("*********** len="+len+" curr="+curindex+" next="+modulus); + + //console.log ("Keys array "+ JSON.stringify(keys)); + + //console.log ("Current index: "+ keys.indexOf(key) ); + //console.log ("returning index of " + (keys.indexOf(key) + 1) % (keys.length)); + // console.log ("keys length is "+ keys.length); + return keys[modulus]; /* var size = Object.keys(obj).length; var i; @@ -503,7 +517,7 @@ angular.module('zmApp.controllers') function randEachTime() { $scope.randToAvoidCacheMem = new Date().getTime(); //$scope.randToAvoidCacheMem = "1"; - console.log ("Generating:"+$scope.randToAvoidCacheMem); + //console.log ("Generating:"+$scope.randToAvoidCacheMem); } //----------------------------------------------------------------------- @@ -514,7 +528,7 @@ angular.module('zmApp.controllers') { randEachTime(); - console.log ($scope.randToAvoidCacheMem); + //console.log ($scope.randToAvoidCacheMem); if ($scope.areImagesLoading) { @@ -612,6 +626,8 @@ angular.module('zmApp.controllers') ld.cycleMontageProfiles = !ld.cycleMontageProfiles; NVRDataModel.setLogin(ld); NVRDataModel.debug ("cycle="+ld.cycleMontageProfiles); + NVRDataModel.debug ("cycle interval="+ld.cycleMontageInterval); + }; @@ -1607,6 +1623,7 @@ angular.module('zmApp.controllers') // console.log ("Refreshing Image..."); }.bind(this), refreshSec * 1000); + NVRDataModel.debug ("Setting up cycle interval of:"+ NVRDataModel.getLogin().cycleMontageInterval* 1000); intervalHandleMontageCycle = $interval(function() { cycleMontageProfiles(); diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index 44481f5c..ffc5c5de 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -48,6 +48,7 @@ "kCustomRange" :"Custom Range", "kCycleMonitors" :"cycle monitors", "kCycleMonitorsInterval" :"monitor cycle interval", + "kCycleMontageInterval" :"montage cycle interval", "kDay" :"Day", "kDecreaseSize" :"decrease size", "kDelete" :"Delete", diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html index bc950d81..db1f8887 100644 --- a/www/templates/devoptions.html +++ b/www/templates/devoptions.html @@ -148,6 +148,15 @@ + +
+ {{'kCycleMontageInterval'|translate}}({{'kSec'|translate}}.)  + +
+ + -- cgit v1.2.3