summaryrefslogtreecommitdiff
path: root/web/kbn_assets
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-02-18 01:35:57 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-02-18 01:35:57 +0300
commit42155370475b1f6619498ec2c43c1c7f328ce1a1 (patch)
treeaa7a708bb94362e0c79d7f3678d07883baa4ba76 /web/kbn_assets
parent70b4a4f044cac8052bb0af7c585572e54489ea2f (diff)
lws: wip
Diffstat (limited to 'web/kbn_assets')
-rw-r--r--web/kbn_assets/app.css37
-rw-r--r--web/kbn_assets/app.js79
2 files changed, 93 insertions, 23 deletions
diff --git a/web/kbn_assets/app.css b/web/kbn_assets/app.css
index 1a4697a..ee0aa3e 100644
--- a/web/kbn_assets/app.css
+++ b/web/kbn_assets/app.css
@@ -173,3 +173,40 @@
.camfeeds.is_mobile > .video-container {
max-width: 100%;
}
+
+
+/* index page */
+.camzones {
+ display: flex;
+ flex-wrap: wrap;
+ margin: 5px -5px 0;
+}
+.camzones::after {
+ content: "";
+ flex: 0 0 50%;
+}
+a.camzone {
+ display: block;
+ text-decoration: none;
+ color: var(--bs-dark);
+ flex: 0 0 calc(50% - 10px);
+ height: 100px;
+ box-sizing: border-box;
+ padding: 10px;
+ margin: 5px;
+ /*border: 1px solid #ccc;*/
+ background: #f0f2f4;
+ border-radius: 4px;
+ word-wrap: break-word;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ position: relative;
+}
+.camzone_text {
+ position: absolute;
+ bottom: 5px;
+ left: 8px;
+ right: 8px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+} \ No newline at end of file
diff --git a/web/kbn_assets/app.js b/web/kbn_assets/app.js
index d575a5a..6081681 100644
--- a/web/kbn_assets/app.js
+++ b/web/kbn_assets/app.js
@@ -1,7 +1,6 @@
-(function() {
var RE_WHITESPACE = /[\t\r\n\f]/g
-window.ajax = {
+var ajax = {
get: function(url, data) {
if (typeof data == 'object') {
var index = 0;
@@ -38,35 +37,37 @@ window.ajax = {
}
};
-window.extend = function(a, b) {
+function extend(a, b) {
return Object.assign(a, b);
}
-window.ge = function(id) {
+function ge(id) {
return document.getElementById(id);
}
-var ua = navigator.userAgent.toLowerCase();
-window.browserInfo = {
- version: (ua.match(/.+(?:me|ox|on|rv|it|ra|ie)[\/: ]([\d.]+)/) || [0,'0'])[1],
- //opera: /opera/i.test(ua),
- msie: (/msie/i.test(ua) && !/opera/i.test(ua)) || /trident/i.test(ua),
- mozilla: /firefox/i.test(ua),
- android: /android/i.test(ua),
- mac: /mac/i.test(ua),
- samsungBrowser: /samsungbrowser/i.test(ua),
- chrome: /chrome/i.test(ua),
- safari: /safari/i.test(ua),
- mobile: /iphone|ipod|ipad|opera mini|opera mobi|iemobile|android/i.test(ua),
- operaMini: /opera mini/i.test(ua),
- ios: /iphone|ipod|ipad|watchos/i.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1),
-};
+(function() {
+ var ua = navigator.userAgent.toLowerCase();
+ window.browserInfo = {
+ version: (ua.match(/.+(?:me|ox|on|rv|it|ra|ie)[\/: ]([\d.]+)/) || [0,'0'])[1],
+ //opera: /opera/i.test(ua),
+ msie: (/msie/i.test(ua) && !/opera/i.test(ua)) || /trident/i.test(ua),
+ mozilla: /firefox/i.test(ua),
+ android: /android/i.test(ua),
+ mac: /mac/i.test(ua),
+ samsungBrowser: /samsungbrowser/i.test(ua),
+ chrome: /chrome/i.test(ua),
+ safari: /safari/i.test(ua),
+ mobile: /iphone|ipod|ipad|opera mini|opera mobi|iemobile|android/i.test(ua),
+ operaMini: /opera mini/i.test(ua),
+ ios: /iphone|ipod|ipad|watchos/i.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1),
+ };
+})();
-window.isTouchDevice = function() {
+function isTouchDevice() {
return 'ontouchstart' in window || navigator.msMaxTouchPoints;
}
-window.hasClass = function(el, name) {
+function hasClass(el, name) {
if (!el)
throw new Error('hasClass: invalid element')
@@ -80,7 +81,7 @@ window.hasClass = function(el, name) {
}
}
-window.addClass = function(el, name) {
+function addClass(el, name) {
if (!hasClass(el, name)) {
el.className = (el.className ? el.className + ' ' : '') + name;
return true
@@ -88,6 +89,39 @@ window.addClass = function(el, name) {
return false
}
+function removeClass(el, name) {
+ if (!el)
+ throw new Error('removeClass: invalid element')
+
+ if (Array.isArray(name)) {
+ for (var i = 0; i < name.length; i++)
+ removeClass(el, name[i]);
+ return;
+ }
+ el.className = ((el.className || '').replace((new RegExp('(\\s|^)' + name + '(\\s|$)')), ' ')).trim()
+}
+
+function indexInit() {
+ var blocks = ['zones', 'all'];
+ for (var i = 0; i < blocks.length; i++) {
+ var button = ge('cam_'+blocks[i]+'_btn');
+ button.addEventListener('click', function(e) {
+ var selected = e.target.getAttribute('data-id');
+ for (var j = 0; j < blocks.length; j++) {
+ var button = ge('cam_'+blocks[j]+'_btn');
+ var content = ge('cam_'+blocks[j]);
+ if (blocks[j] === selected) {
+ addClass(button, 'active');
+ content.style.display = '';
+ } else {
+ removeClass(button, 'active');
+ content.style.display = 'none';
+ }
+ }
+ });
+ }
+}
+
window.Cameras = {
hlsOptions: null,
h265webjsOptions: null,
@@ -316,7 +350,6 @@ window.Cameras = {
return video.canPlayType('application/vnd.apple.mpegurl');
},
};
-})();
class ModemStatusUpdater {