From c2ac88f9a4a1c945988acd89c45e394bde08529a Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Sat, 4 Jul 2015 16:56:53 -0400 Subject: improved input experience - urls copy from base url --- www/js/LoginCtrl.js | 19 +++++++++++++++++++ www/templates/login.html | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index c4192927..86da2e06 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -23,6 +23,25 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r ZMDataModel.setAwake(false); }); + + //------------------------------------------------------------------------------- + // Makes input easier + //------------------------------------------------------------------------------- + + $scope.portalKeypress = function(evt) + { + + // if ($scope.loginData.streamingurl.indexOf($scope.loginData.url) !=0) + $scope.loginData.streamingurl = $scope.loginData.url; + + if ($scope.loginData.streamingurl.slice(-3).toLowerCase() == '/zm') { + $scope.loginData.streamingurl = $scope.loginData.streamingurl.slice(0, -3); + } + + + // if ($scope.loginData.apiurl.indexOf($scope.loginData.url) !=0) + $scope.loginData.apiurl = $scope.loginData.url+"/api"; + }; //------------------------------------------------------------------------------- // Adds http to url if not present // http://stackoverflow.com/questions/11300906/check-if-a-string-starts-with-http-using-javascript diff --git a/www/templates/login.html b/www/templates/login.html index a9fc6ac9..7f89da7a 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -10,7 +10,7 @@ ZoneMinder Settings