WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 678b91a

Browse files
committed
refactor: 调整工具方法位置
1 parent cdcbfcf commit 678b91a

File tree

1 file changed

+34
-34
lines changed
  • src/components/BootstrapBlazor.HikVision/wwwroot

1 file changed

+34
-34
lines changed

src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,6 @@ const hackJSResize = function () {
5050
}
5151
}
5252

53-
const checkVisibility = el => {
54-
if (el.checkVisibility) {
55-
return el.checkVisibility();
56-
}
57-
else {
58-
return isVisible(el);
59-
}
60-
}
61-
62-
const isVisible = (element) => {
63-
if (!element) return false;
64-
65-
const style = window.getComputedStyle(element);
66-
if (style.display === 'none' || style.visibility === 'hidden' || parseFloat(style.opacity) < 0.01) {
67-
return false;
68-
}
69-
70-
const rect = element.getBoundingClientRect();
71-
if (rect.width === 0 || rect.height === 0) {
72-
return false;
73-
}
74-
75-
let parent = element.parentElement;
76-
while (parent) {
77-
const parentStyle = window.getComputedStyle(parent);
78-
if (parentStyle.display === 'none' || parentStyle.visibility === 'hidden') {
79-
return false;
80-
}
81-
parent = parent.parentElement;
82-
}
83-
84-
return true;
85-
}
86-
8753
const hackJSShowWnd = function () {
8854
const originalShowWnd = JSVideoPlugin.prototype.JS_ShowWnd;
8955
JSVideoPlugin.prototype.JS_ShowWnd = function () {
@@ -402,3 +368,37 @@ const getTagNameFirstValue = (xmlDoc, tagName, defaultValue = '0') => {
402368
const getTagNameValues = (xmlDoc, tagName) => {
403369
return xmlDoc.getElementsByTagName(tagName);
404370
}
371+
372+
const checkVisibility = el => {
373+
if (el.checkVisibility) {
374+
return el.checkVisibility();
375+
}
376+
else {
377+
return isVisible(el);
378+
}
379+
}
380+
381+
const isVisible = (element) => {
382+
if (!element) return false;
383+
384+
const style = window.getComputedStyle(element);
385+
if (style.display === 'none' || style.visibility === 'hidden' || parseFloat(style.opacity) < 0.01) {
386+
return false;
387+
}
388+
389+
const rect = element.getBoundingClientRect();
390+
if (rect.width === 0 || rect.height === 0) {
391+
return false;
392+
}
393+
394+
let parent = element.parentElement;
395+
while (parent) {
396+
const parentStyle = window.getComputedStyle(parent);
397+
if (parentStyle.display === 'none' || parentStyle.visibility === 'hidden') {
398+
return false;
399+
}
400+
parent = parent.parentElement;
401+
}
402+
403+
return true;
404+
}

0 commit comments

Comments
 (0)