一分钟搭建影视站,支持Docker等部署方式
fix:b update go back button visibility logic
developer782996aeeafd
diff --git a/js/app.js b/js/app.jsindex 11308bd..e9a06e2 100644--- a/js/app.js+++ b/js/app.js@@ -1,5 +1,5 @@// 全局变量-let selectedAPIs = JSON.parse(localStorage.getItem('selectedAPIs') || '["tyyszy","xiaomaomi","dyttzy", "bfzy", "ruyi"]'); // 默认选中天涯资源、暴风资源和如意资源+let selectedAPIs = JSON.parse(localStorage.getItem('selectedAPIs') || '["tyyszy","dyttzy", "bfzy", "ruyi"]'); // 默认选中天涯资源、暴风资源和如意资源let customAPIs = JSON.parse(localStorage.getItem('customAPIs') || '[]'); // 存储自定义API列表// 添加当前播放的集数索引@@ -28,7 +28,7 @@ document.addEventListener('DOMContentLoaded', function() {// 设置默认API选择(如果是第一次加载)if (!localStorage.getItem('hasInitializedDefaults')) {// 仅选择天涯资源、暴风资源和如意资源- selectedAPIs = ["tyyszy","xiaomaomi", "bfzy","dyttzy", "ruyi"];+ selectedAPIs = ["tyyszy","bfzy","dyttzy", "ruyi"];localStorage.setItem('selectedAPIs', JSON.stringify(selectedAPIs));// 默认选中过滤开关diff --git a/player.html b/player.htmlindex 453013d..31f5ff9 100644--- a/player.html+++ b/player.html@@ -442,6 +442,7 @@}initializePageContent();+ updateGoBackButtonVisibility();});// 监听密码验证成功事件@@ -454,13 +455,47 @@// 判断是否再框架中打开function inIframe() {try {- // 如果当前窗口的顶层窗口不是自身,说明在框架中return window.self !== window.top;} catch (e) {- // 跨域访问会抛出错误,此时也说明在框架中return true;}}++ // 判断父页面是否有选集弹窗且内容区包含当前视频标题+ function parentHasEpisodeModal() {+ try {+ if (!inIframe()) return false;+ const parentDoc = window.parent.document;+ const modal = parentDoc.getElementById('modal');+ const modalTitle = parentDoc.getElementById('modalTitle');+ // 判断弹窗可见且标题与当前视频标题相同+ if (+ modal &&+ modal.style.display !== 'none' &&+ modalTitle &&+ modalTitle.textContent &&+ currentVideoTitle &&+ modalTitle.textContent.trim().replace(/\s+/g, '') === currentVideoTitle.trim().replace(/\s+/g, '')+ ) {+ return true;+ }+ } catch (e) {+ // 跨域或异常时忽略+ }+ return false;+ }++ // 控制上一页按钮显示+ function updateGoBackButtonVisibility() {+ const goBackBtn = document.getElementById('goBack');+ // 如果不是iframe,或者父页面有选集弹窗,则隐藏+ if (!inIframe() || parentHasEpisodeModal()) {+ goBackBtn.style.display = 'none';+ } else {+ goBackBtn.style.display = '';+ }+ }+// 如果播放器不是在框架中打开,则隐藏上一页按钮if (!inIframe()) {goBack = document.getElementById('goBack');@@ -581,6 +616,7 @@// 设置页面标题document.title = currentVideoTitle + ' - LibreTV播放器';document.getElementById('videoTitle').textContent = currentVideoTitle;+ updateGoBackButtonVisibility();// 初始化播放器if (videoUrl) {