diff --git a/index.html b/index.html
index 7d8ee55..939f395 100755
--- a/index.html
+++ b/index.html
@@ -15,7 +15,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -457,4 +468,4 @@ Preferences
-
\ No newline at end of file
+
diff --git a/js/index.js b/js/index.js
index 2912105..c4fe9a3 100644
--- a/js/index.js
+++ b/js/index.js
@@ -1,9 +1,11 @@
var camera_ip = "192.168.0.190";
+var camera_name = "PTZ Optics";
var base_url = "http://" + camera_ip + "/cgi-bin";
// config defaults
var defaults = {
ip: camera_ip,
+ name: camera_name,
flip: 1,
mirror: 1,
invertcontrols: 1,
@@ -18,6 +20,7 @@ var defaults = {
};
var config = defaults;
config.ip = camera_ip;
+config.name = camera_name;
function get_config () {
var result = localStorage.getItem('configStorage');
@@ -40,7 +43,7 @@ function run_action (action_url) {
type: 'GET',
})
.done(function() {
- // console.log("success");
+ document.getElementById("camName").innerHTML = setCamName();
})
.fail(function(jqXHR, responseText, errorThrown) {
// console.log("error");
@@ -60,6 +63,9 @@ function config_init () {
$("#cam_ip").val(config.ip);
base_url = "http://" + config.ip + "/cgi-bin";
+ // set the inital name for the camera.
+ $("#cam_name").val(config.name)
+
// set the camera's initial configuration for each value in the saved config object
config_setting("flip", config.flip);
config_setting("mirror", config.mirror);
@@ -166,6 +172,7 @@ function update_labels () {
}
config.ip = $('#cam_ip').val();
+ config.name = $('#cam_name').val();
}
function reload_cam () {
@@ -184,6 +191,14 @@ function reload_cam () {
}
}
+function reload_name () {
+ config.name = $('#cam_name').val();
+ config.name = config.name;
+ save_config();
+ document.getElementById("camName").innerHTML = setCamName();
+ alert("Name Saved.");
+}
+
function adjust_setting (action) {
switch (action) {
@@ -554,6 +569,12 @@ function clear_active_preset () {
$('.preset_button').removeClass("active");
}
+function setCamName() {
+ return config.name;
+}
+
+document.getElementById("camName").innerHTML = setCamName();
+
$('body').on('click', '.autopan', function(e) {
e.preventDefault();
clear_active_preset();
@@ -616,6 +637,12 @@ $('body').on('click', '.reload_cam', function(e) {
return false;
});
+$('body').on('click', '.reload_name', function(e) {
+ e.preventDefault();
+ reload_name();
+ return false;
+});
+
$('body').on('mousedown', '.adjust_pantilt', function(e) {
e.preventDefault();
stop_autopan();
@@ -793,4 +820,4 @@ const {app} = remote;
app.on('before-quit', () => {
// reset the camera to home position before closing the application
cam_pantilt(1, 'home');
-})
\ No newline at end of file
+})