一分钟搭建影视站,支持Docker等部署方式
添加搜索框清空按钮
WLonge9c552eca9df
diff --git a/index.html b/index.htmlindex 7005296..75ff94b 100644--- a/index.html+++ b/index.html@@ -211,7 +211,18 @@class="flex-1 bg-[#111] border-y border-[#333] text-white px-6 py-0 focus:outline-none transition-colors"placeholder="搜索你喜欢的视频..."autocomplete="off"- aria-label="视频搜索框">+ aria-label="视频搜索框"+ oninput="toggleClearButton()">+ <!-- 清空按钮 -->+ <button id="clearSearchInput"+ class="flex pr-2 bg-[#111] border-y border-[#333] items-center justify-center text-gray-400 hover:text-white hidden"+ onclick="clearSearchInput()"+ aria-label="清空搜索框"+ title="清空搜索框">+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>+ </svg>+ </button><!-- 搜索按钮 --><button onclick="search()"class="w-20 sm:w-24 flex items-center justify-center bg-white text-black font-medium hover:bg-gray-200 transition-colors"diff --git a/js/app.js b/js/app.jsindex 8954edd..6b9cd9c 100644--- a/js/app.js+++ b/js/app.js@@ -888,6 +888,25 @@ async function search() {}}+// 切换清空按钮的显示状态+function toggleClearButton() {+ const searchInput = document.getElementById('searchInput');+ const clearButton = document.getElementById('clearSearchInput');+ if (searchInput.value.trim() !== '') {+ clearButton.classList.remove('hidden');+ } else {+ clearButton.classList.add('hidden');+ }+}++// 清空搜索框内容+function clearSearchInput() {+ const searchInput = document.getElementById('searchInput');+ searchInput.value = '';+ const clearButton = document.getElementById('clearSearchInput');+ clearButton.classList.add('hidden');+}+// 显示详情 - 修改为支持自定义APIasync function showDetails(id, vod_name, sourceCode) {// 密码保护校验diff --git a/js/index-page.js b/js/index-page.jsindex 0d3a127..e88d63e 100644--- a/js/index-page.js+++ b/js/index-page.js@@ -35,6 +35,8 @@ document.addEventListener('DOMContentLoaded', function() {if (keyword) {// 设置搜索框的值document.getElementById('searchInput').value = keyword;+ // 显示清空按钮+ toggleClearButton();// 执行搜索setTimeout(() => {// 使用setTimeout确保其他DOM加载和初始化完成