一分钟搭建影视站,支持Docker等部署方式
add 黄色内容过滤开关
developer029e4219a937
diff --git a/css/styles.css b/css/styles.cssindex 19cff2b..04bc359 100644--- a/css/styles.css+++ b/css/styles.css@@ -208,3 +208,29 @@ body {border-color: var(--primary-color);box-shadow: 0 0 8px rgba(0, 204, 255, 0.3);}++#yellowFilterToggle:checked + .toggle-bg {+ background-color: var(--primary-color);+}++#yellowFilterToggle:checked ~ .toggle-dot {+ transform: translateX(1.5rem);+}++#yellowFilterToggle:focus + .toggle-bg,+#yellowFilterToggle:hover + .toggle-bg {+ box-shadow: 0 0 0 2px rgba(0, 204, 255, 0.3);+}++.toggle-dot {+ transition: transform 0.3s ease-in-out;+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);+}++.toggle-bg {+ transition: background-color 0.3s ease-in-out;+}++#yellowFilterToggle:checked ~ .toggle-dot {+ box-shadow: 0 2px 4px rgba(0, 204, 255, 0.3);+}diff --git a/index.html b/index.htmlindex af06868..396e21e 100644--- a/index.html+++ b/index.html@@ -79,6 +79,18 @@<p class="text-xs text-gray-500 mt-1">格式: https://example.com (不含最后的斜杠)</p></div>+ <div>+ <div class="flex items-center justify-between">+ <label class="text-sm font-medium text-gray-400">黄色内容过滤</label>+ <div class="relative inline-block w-12 align-middle select-none">+ <input type="checkbox" id="yellowFilterToggle" class="opacity-0 absolute w-full h-full cursor-pointer z-10">+ <div class="toggle-bg bg-[#333] w-12 h-6 rounded-full transition-colors duration-300 ease-in-out"></div>+ <div class="toggle-dot absolute w-5 h-5 bg-white rounded-full top-0.5 left-0.5 transition-transform duration-300 ease-in-out"></div>+ </div>+ </div>+ <p class="text-xs text-gray-500 mt-1">过滤分类包含"伦理片"、"色情片"等成人内容</p>+ </div>+<div class="mt-4"><p class="text-xs text-gray-500">当前站点代码:<span id="currentCode" class="text-white"></span>diff --git a/js/app.js b/js/app.jsindex 6654a4d..49183d2 100644--- a/js/app.js+++ b/js/app.js@@ -30,6 +30,12 @@ document.addEventListener('DOMContentLoaded', function() {// 渲染搜索历史renderSearchHistory();+ // 设置黄色内容过滤开关初始状态+ const yellowFilterToggle = document.getElementById('yellowFilterToggle');+ if (yellowFilterToggle) {+ yellowFilterToggle.checked = localStorage.getItem('yellowFilterEnabled') === 'true';+ }+// 设置事件监听器setupEventListeners();});@@ -141,6 +147,14 @@ function setupEventListeners() {panel.classList.remove('show');}});++ // 新增:黄色内容过滤开关事件绑定+ const yellowFilterToggle = document.getElementById('yellowFilterToggle');+ if (yellowFilterToggle) {+ yellowFilterToggle.addEventListener('change', function(e) {+ localStorage.setItem('yellowFilterEnabled', e.target.checked);+ });+ }}// 重置搜索区域@@ -196,6 +210,17 @@ async function search() {// 保存搜索历史saveSearchHistory(query);+ // 处理搜索结果过滤:如果启用了黄色内容过滤,则过滤掉分类含有“伦理片”或“色情片”的项目+ const yellowFilterEnabled = localStorage.getItem('yellowFilterEnabled') === 'true';+ let results = data.list;+ if (yellowFilterEnabled) {+ const banned = ['伦理片', '色情片','福利视频','福利片'];+ results = results.filter(item => {+ const typeName = item.type_name || '';+ return !banned.some(keyword => typeName.includes(keyword));+ });+ }+// 显示结果区域,调整搜索区域document.getElementById('searchArea').classList.remove('flex-1');document.getElementById('searchArea').classList.add('mb-8');@@ -204,7 +229,7 @@ async function search() {const resultsDiv = document.getElementById('results');// 添加XSS保护,使用textContent和属性转义- resultsDiv.innerHTML = data.list.map(item => {+ resultsDiv.innerHTML = results.map(item => {const safeId = item.vod_id ? item.vod_id.toString().replace(/[^\w-]/g, '') : '';const safeName = (item.vod_name || '').toString().replace(/</g, '<')