summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]hooks/README.md0
-rwxr-xr-xhooks/after_prepare/uglify.js182
-rwxr-xr-x[-rw-r--r--]hooks/uglify-config.json9
-rw-r--r--package.json1
-rw-r--r--www/css/style.css30
-rw-r--r--www/js/EventModalCtrl.js26
-rw-r--r--www/templates/events-modal.html20
7 files changed, 164 insertions, 104 deletions
diff --git a/hooks/README.md b/hooks/README.md
index d2563eab..d2563eab 100644..100755
--- a/hooks/README.md
+++ b/hooks/README.md
diff --git a/hooks/after_prepare/uglify.js b/hooks/after_prepare/uglify.js
index 3b11bc90..7364dd93 100755
--- a/hooks/after_prepare/uglify.js
+++ b/hooks/after_prepare/uglify.js
@@ -3,60 +3,64 @@
/*jshint latedef:nofunc, node:true*/
// Modules
-var fs = require('fs');
-var path = require('path');
-var UglifyJS = require('uglify-js');
-var CleanCSS = require('clean-css');
-var ngAnnotate = require('ng-annotate');
+var fs = require('fs');
+var path = require('path');
+var cwd = process.cwd();
+var dependencyPath = path.join(cwd, 'node_modules', 'cordova-uglify', 'node_modules');
+// cordova-uglify module dependencies
+var UglifyJS = require(path.join(dependencyPath, 'uglify-js'));
+var CleanCSS = require(path.join(dependencyPath, 'clean-css'));
+var ngAnnotate = require(path.join(dependencyPath, 'ng-annotate'));
// Process
-var rootDir = process.argv[2];
+var rootDir = process.argv[2];
var platformPath = path.join(rootDir, 'platforms');
-var platforms = process.env.CORDOVA_PLATFORMS.split(',');
-var cliCommand = process.env.CORDOVA_CMDLINE;
+var platforms = process.env.CORDOVA_PLATFORMS.split(',');
+var cliCommand = process.env.CORDOVA_CMDLINE;
// Hook configuration
-var configFilePath = path.join(rootDir, 'hooks/uglify-config.json');
-var hookConfig = JSON.parse(fs.readFileSync(configFilePath));
-var isRelease = hookConfig.alwaysRun || (cliCommand.indexOf('--release') > -1);
+var configFilePath = path.join(rootDir, 'hooks/uglify-config.json');
+var hookConfig = JSON.parse(fs.readFileSync(configFilePath));
+var isRelease = hookConfig.alwaysRun || (cliCommand.indexOf('--release') > -1);
var recursiveFolderSearch = hookConfig.recursiveFolderSearch; // set this to false to manually indicate the folders to process
-var foldersToProcess = hookConfig.foldersToProcess; // add other www folders in here if needed (ex. js/controllers)
-var cssMinifier = new CleanCSS(hookConfig.cleanCssOptions);
+var foldersToProcess = hookConfig.foldersToProcess; // add other www folders in here if needed (ex. js/controllers)
+var cssMinifier = new CleanCSS(hookConfig.cleanCssOptions);
// Exit
if (!isRelease) {
- return;
+ return;
}
// Run uglifier
-// PP disabled on Jul 10 2016 - something is going wrong
-//run();
+run();
/**
* Run compression for all specified platforms.
* @return {undefined}
*/
function run() {
- platforms.forEach(function(platform) {
- var wwwPath;
-
- switch (platform) {
- case 'android':
- wwwPath = path.join(platformPath, platform, 'assets', 'www');
- break;
-
- case 'ios':
- case 'browser':
- wwwPath = path.join(platformPath, platform, 'www');
- break;
-
- default:
- console.log('this hook only supports android, ios, and browser currently');
- return;
- }
-
- processFolders(wwwPath);
- });
+ platforms.forEach(function(platform) {
+ var wwwPath;
+
+ switch (platform) {
+ case 'android':
+ wwwPath = path.join(platformPath, platform, 'assets', 'www');
+ break;
+
+ case 'ios':
+ case 'browser':
+ case 'wp8':
+ case 'windows':
+ wwwPath = path.join(platformPath, platform, 'www');
+ break;
+
+ default:
+ console.log('this hook only supports android, ios, wp8, windows, and browser currently');
+ return;
+ }
+
+ processFolders(wwwPath);
+ });
}
/**
@@ -65,9 +69,9 @@ function run() {
* @return {undefined}
*/
function processFolders(wwwPath) {
- foldersToProcess.forEach(function(folder) {
- processFiles(path.join(wwwPath, folder));
- });
+ foldersToProcess.forEach(function(folder) {
+ processFiles(path.join(wwwPath, folder));
+ });
}
/**
@@ -76,31 +80,31 @@ function processFolders(wwwPath) {
* @return {undefined}
*/
function processFiles(dir) {
- fs.readdir(dir, function (err, list) {
- if (err) {
- console.log('processFiles err: ' + err);
-
- return;
+ fs.readdir(dir, function(err, list) {
+ if (err) {
+ console.log('processFiles err: ' + err);
+
+ return;
+ }
+
+ list.forEach(function(file) {
+ file = path.join(dir, file);
+
+ fs.stat(file, function(err, stat) {
+ if (stat.isFile()) {
+ compress(file);
+
+ return;
+ }
+
+ if (recursiveFolderSearch && stat.isDirectory()) {
+ processFiles(file);
+
+ return;
}
-
- list.forEach(function(file) {
- file = path.join(dir, file);
-
- fs.stat(file, function(err, stat) {
- if (stat.isFile()) {
- compress(file);
-
- return;
- }
-
- if (recursiveFolderSearch && stat.isDirectory()) {
- processFiles(file);
-
- return;
- }
- });
- });
+ });
});
+ });
}
/**
@@ -109,30 +113,32 @@ function processFiles(dir) {
* @return {undefined}
*/
function compress(file) {
- var ext = path.extname(file),
- res,
- source,
- result;
-
- switch (ext) {
- case '.js':
- console.log('uglifying js file ' + file);
-
- res = ngAnnotate(String(fs.readFileSync(file)), { add: true });
- result = UglifyJS.minify(res.src, hookConfig.uglifyJsOptions);
- fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file
- break;
-
- case '.css':
- console.log('minifying css file ' + file);
-
- source = fs.readFileSync(file, 'utf8');
- result = cssMinifier.minify(source);
- fs.writeFileSync(file, result, 'utf8'); // overwrite the original unminified file
- break;
-
- default:
- console.log('encountered a ' + ext + ' file, not compressing it');
- break;
- }
+ var ext = path.extname(file),
+ res,
+ source,
+ result;
+
+ switch (ext) {
+ case '.js':
+ console.log('uglifying js file ' + file);
+
+ res = ngAnnotate(String(fs.readFileSync(file)), {
+ add: true
+ });
+ result = UglifyJS.minify(res.src, hookConfig.uglifyJsOptions);
+ fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file
+ break;
+
+ case '.css':
+ console.log('minifying css file ' + file);
+
+ source = fs.readFileSync(file, 'utf8');
+ result = cssMinifier.minify(source);
+ fs.writeFileSync(file, result.styles, 'utf8'); // overwrite the original unminified file
+ break;
+
+ default:
+ console.log('encountered a ' + ext + ' file, not compressing it');
+ break;
+ }
}
diff --git a/hooks/uglify-config.json b/hooks/uglify-config.json
index de85bb2a..e285cd2d 100644..100755
--- a/hooks/uglify-config.json
+++ b/hooks/uglify-config.json
@@ -3,16 +3,19 @@
"recursiveFolderSearch": true,
"foldersToProcess": [
"js",
- "css"
+ "css",
+ "img",
+ "build"
],
"uglifyJsOptions": {
"compress": {
"drop_console": true
},
- "fromString": true
+ "fromString": true,
+ "mangle": false
},
"cleanCssOptions": {
"noAdvanced": true,
"keepSpecialComments": 0
}
-} \ No newline at end of file
+}
diff --git a/package.json b/package.json
index 499aea0b..6cc15e6d 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"devDependencies": {
"bower": "^1.3.3",
"clean-css": "^3.4.0",
+ "cordova-uglify": "^0.2.6",
"gulp-angular-templatecache": "^1.6.0",
"gulp-util": "^2.2.14",
"jshint": "^2.8.0",
diff --git a/www/css/style.css b/www/css/style.css
index 950a9e0d..260a3afe 100644
--- a/www/css/style.css
+++ b/www/css/style.css
@@ -686,19 +686,41 @@ input[type=range]::-webkit-slider-thumb {
}
/* This is for quick scrub for H264 */
+
+
.videogular-container {
height: 260px;
margin: auto;
overflow: hidden;
float: left;
+
+}
+
+
+.videogular-container-modal-width {
+ height: auto;
+ width:100%;
+ margin: auto;
+ overflow: hidden;
}
-.videogular-full-container {
- height: 80%;
- z-index: 100;
- float: center;
+
+.videogular-container-modal-height {
+ height: 40%;
margin: auto;
overflow: hidden;
}
+
+
+videogular div.event-time {
+ position: absolute;
+ display: block;
+ z-index: 9999;
+ bottom: 10%;
+ background: rgba(255,0,0,0.5);
+}
+
+
+
#full-screen-event {
-webkit-animation-duration: 200ms;
}
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js
index abdf5052..628cc1ff 100644
--- a/www/js/EventModalCtrl.js
+++ b/www/js/EventModalCtrl.js
@@ -6,7 +6,7 @@
-angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$rootScope', 'zm', 'NVRDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', '$ionicPopup', '$translate', function ($scope, $rootScope, zm, NVRDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils, $ionicPopup, $translate) {
+angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$rootScope', 'zm', 'NVRDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', '$ionicPopup', '$translate', '$filter', function ($scope, $rootScope, zm, NVRDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils, $ionicPopup, $translate, $filter) {
// from parent scope
@@ -775,7 +775,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.scaleImage = function () {
$scope.imageFit = !$scope.imageFit;
- // console.log("Switching image style to " + $scope.imageFit);
+ console.log("Switching image style to " + $scope.imageFit);
};
$scope.$on('$ionicView.enter', function () {
@@ -791,6 +791,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
return;
+ $scope.videoDynamicTime = "";
$scope.videoIsReady = false;
var ld = NVRDataModel.getLogin();
$scope.loginData = NVRDataModel.getLogin();
@@ -907,6 +908,25 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
});
}
+ $scope.videoTime = function(s,c)
+ {
+ var a,o;
+ if (NVRDataModel.getLogin().useLocalTimeZone)
+ {
+ a = moment.tz(s, NVRDataModel.getTimeZoneNow()).tz(moment.tz.guess());
+
+ }
+ else
+ {
+ a = moment(s);
+ }
+ a.add(c);
+
+ o = a.format("MMM Do "+NVRDataModel.getTimeFormatSec());
+ $scope.videoDynamicTime = o;
+ //return a.format("MMM Do "+o);
+
+ };
$scope.$on('modal.removed', function (e, m) {
console.log ("************* REMOVE CALLED");
@@ -1467,6 +1487,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.videoObject = {
config: {
autoPlay: true,
+ responsive:true,
+ nativeControls:false,
playsInline:true,
sources: [
diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html
index 58573026..24078df7 100644
--- a/www/templates/events-modal.html
+++ b/www/templates/events-modal.html
@@ -4,6 +4,8 @@
<ion-content style="background-color:#444444" ng-cloak>
<ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; " delegate-handle="imgscroll" on-swipe-left="onSwipeEvent(nextId,1)" on-swipe-right="onSwipeEvent(prevId,-1)" overflow-scroll="false">
<div id="full-screen-event" style="height: 100vh;">
+ <!--<div>-->
+
<!-- route via ZMS -->
<div ng-if="( (defaultVideo=='') || (loginData.enableh264==false)) && (loginData.useNphZmsForEvents==true)">
<!--<div style="color:white">connkey:{{connKey}}</div>-->
@@ -17,17 +19,21 @@
<!-- no default video -->
<div ng-if="defaultVideo!==undefined && defaultVideo!='' && loginData.enableh264 == true">
<!--<div ng-if="videoIsReady" class="videogular-full-container">-->
- <div ng-if="videoIsReady" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}" >
+ <!--<div ng-if="videoIsReady" ng-class="{'videogular-container-modal-width':imageFit==true, 'videogular-container-modal-height':imageFit==false}" >-->
+
+ <div ng-if="videoIsReady" ng-class="imageFit?'videogular-container-modal-width':'videogular-container-modal-height'">
<!--<video width="320" height="240" controls>
<source src="" dynamic-url dynamic-url-src="{{video_url}}">
</video>-->
- <videogular vg-error="onVideoError($event)" vg-can-play = "onCanPlay()" vg-player-ready="onPlayerReady($API)" vg-plays-inline="videoObject.config.playsInline" vg-theme="videoObject.config.theme" vg-complete="playbackFinished()" on-double-tap="closeModal();" vg-autoplay="videoObject.config.autoPlay" vg-responsive="true" >
- <<vg-media vg-src="videoObject.config.sources" vg-native-controls="false">
- </vg-media>-
+
+ <videogular vg-error="onVideoError($event)" vg-can-play = "onCanPlay()" vg-player-ready="onPlayerReady($API)" vg-plays-inline="videoObject.config.playsInline" vg-theme="videoObject.config.theme" vg-complete="playbackFinished()" on-double-tap="closeModal();" vg-autoplay="videoObject.config.autoPlay" vg-responsive="videoObject.config.responsive" vg-update-time="videoTime(event.Event.StartTime,$currentTime)" >
+ <vg-media vg-src="videoObject.config.sources" vg-native-controls="videoObject.config.nativeControls">
+ </vg-media>
<vg-controls>
<vg-play-pause-button></vg-play-pause-button>
+ <vg-time-display>{{ videoTime(event.Event.StartTime, currentTime ); }}</vg-time-display>
<vg-scrub-bar>
<vg-scrub-bar-current-time></vg-scrub-bar-current-time>
</vg-scrub-bar>
@@ -40,9 +46,9 @@
<!--<vg-buffering></vg-buffering>-->
</videogular>
</div>
- <div id="event_canvas_video">
+ <!--<div id="event_canvas_video">
<canvas id="eventchart" width="100%" height="20px"></canvas>
- </div>
+ </div>-->
</div>
</div>
<!-- 100vh -->
@@ -75,7 +81,7 @@
<a mfb-button icon="ion-play" label="{{'kNormalPlay'|translate}}" ng-click="adjustSpeed('np');"></a>
<a mfb-button icon="ion-pause" label="{{'kPause'|translate}}" ng-click="adjustSpeed('p');"> </a>
</nav>
- <div class="events-range-modal-text">{{mName}}&nbsp;<i class="ion-arrow-right-b"></i>&nbsp;{{humanizeTime}} ({{d_eventId}}) </div>
+ <div class="events-range-modal-text">{{mName}}&nbsp;<i class="ion-arrow-right-b"></i>&nbsp;{{videoDynamicTime}} ({{humanizeTime}}) [{{d_eventId}}] </div>
<div id="flyoutmenu" style="position:absolute;bottom:100px;left:10px">
<ul>
<li ng-if="defaultVideo==''">