一分钟搭建影视站,支持Docker等部署方式
修复清空按钮某些情况不显示的问题
WLong907d291c7c45
diff --git a/js/app.js b/js/app.jsindex 6b9cd9c..987c80e 100644--- a/js/app.js+++ b/js/app.js@@ -892,7 +892,7 @@ async function search() {function toggleClearButton() {const searchInput = document.getElementById('searchInput');const clearButton = document.getElementById('clearSearchInput');- if (searchInput.value.trim() !== '') {+ if (searchInput.value !== '') {clearButton.classList.remove('hidden');} else {clearButton.classList.add('hidden');@@ -907,6 +907,31 @@ function clearSearchInput() {clearButton.classList.add('hidden');}+// 劫持搜索框的value属性以检测外部修改+function hookInput() {+ const input = document.getElementById('searchInput');+ const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');++ // 重写 value 属性的 getter 和 setter+ Object.defineProperty(input, 'value', {+ get: function() {+ // 确保读取时返回字符串(即使原始值为 undefined/null)+ const originalValue = descriptor.get.call(this);+ return originalValue != null ? String(originalValue) : '';+ },+ set: function(value) {+ // 显式将值转换为字符串后写入+ const strValue = String(value);+ descriptor.set.call(this, strValue);+ this.dispatchEvent(new Event('input', { bubbles: true }));+ }+ });++ // 初始化输入框值为空字符串(避免初始值为 undefined)+ input.value = '';+}+document.addEventListener('DOMContentLoaded', hookInput);+// 显示详情 - 修改为支持自定义APIasync function showDetails(id, vod_name, sourceCode) {// 密码保护校验