Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.0.0-beta06</Version>
<Version>10.0.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
16 changes: 15 additions & 1 deletion src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ const hackJSDestroyPlugin = function () {
return origianlSendRequestProxy.call(this, r);
}
}
return this.oPlugin.JS_DestroyPlugin(true);
this.oPlugin.JS_DestroyPlugin(true);

JSVideoPlugin = null;
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempting to set JSVideoPlugin = null in local scope has no effect on the global JSVideoPlugin. Since JSVideoPlugin is a global constructor, you should use window.JSVideoPlugin = null instead for proper cleanup.

Suggested change
JSVideoPlugin = null;
window.JSVideoPlugin = null;

Copilot uses AI. Check for mistakes.
delete window.JSVideoPlugin;
removePlugin();
}
}

const removePlugin = () => {
const scripts = [...document.head.querySelectorAll('script')]
const nodes = scripts.filter(function (link) {
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded filename '/jsVideoPlugin-1.0.0.min.js' makes this function fragile. If the plugin version changes, this cleanup won't work. Consider extracting this as a constant or making it more flexible (e.g., using a pattern like /jsVideoPlugin.*\.js).

Suggested change
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
return /\/jsVideoPlugin.*\.js$/.test(link.src);

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +58
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name link in the filter callback is misleading since the elements being filtered are <script> elements, not <link> elements. Consider renaming to script for clarity.

Suggested change
const nodes = scripts.filter(function (link) {
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
const nodes = scripts.filter(function (script) {
return script.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1

Copilot uses AI. Check for mistakes.
})
Comment on lines +56 to +59
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolons after statements on lines 56 and 57. Consider adding semicolons for consistency with the rest of the codebase (lines 47, 49, 50, 51, etc.).

Suggested change
const scripts = [...document.head.querySelectorAll('script')]
const nodes = scripts.filter(function (link) {
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
})
const scripts = [...document.head.querySelectorAll('script')];
const nodes = scripts.filter(function (link) {
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
});

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon after the closing brace. Consider adding a semicolon for consistency with the rest of the codebase.

Suggested change
})
});

Copilot uses AI. Check for mistakes.
for (let index = 0; index < nodes.length; index++) {
document.head.removeChild(nodes[index])
Comment on lines +60 to +61
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A standard for-of loop would be more idiomatic and readable here: for (const node of nodes) { document.head.removeChild(node) }.

Suggested change
for (let index = 0; index < nodes.length; index++) {
document.head.removeChild(nodes[index])
for (const node of nodes) {
document.head.removeChild(node);

Copilot uses AI. Check for mistakes.
}
}

Expand Down
Loading