Skip to content

一分钟搭建影视站,支持Docker等部署方式

将返回首页改为返回上一页

WLongbe3f63b819fe
diff --git a/js/app.js b/js/app.js
index 292c424..3eab011 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1004,7 +1004,25 @@ function playVideo(url, vod_name, sourceCode, episodeIndex = 0) {
const playerUrl = `player.html?url=${encodeURIComponent(url)}&title=${encodeURIComponent(videoTitle)}&index=${episodeIndex}&source=${encodeURIComponent(sourceName)}&source_code=${encodeURIComponent(sourceCode)}`;
// 在当前标签页中打开播放页面
- window.location.href = playerUrl;
+ //window.location.href = playerUrl;
+
+ // 临时隐藏搜索结果,防止高度超出播放器而出现滚动条
+ document.getElementById('resultsArea').classList.add('hidden');
+ // 在框架中打开播放页面
+ videoPlayerFrame = document.createElement('iframe');
+ videoPlayerFrame.id = 'VideoPlayerFrame';
+ videoPlayerFrame.className = 'fixed w-full h-screen z-40';
+ videoPlayerFrame.src = playerUrl;
+ document.body.appendChild(videoPlayerFrame);
+}
+
+// 关闭播放器页面
+function closeVideoPlayer() {
+ videoPlayerFrame = document.getElementById('VideoPlayerFrame');
+ if (videoPlayerFrame) {
+ videoPlayerFrame.remove();
+ document.getElementById('resultsArea').classList.remove('hidden');
+ }
}
// 播放上一集
diff --git a/player.html b/player.html
index a8cb07e..58e0d51 100644
--- a/player.html
+++ b/player.html
@@ -211,12 +211,12 @@
</a>
</div>
<h2 id="videoTitle" class="text-xl font-semibold flex-1 text-center overflow-x-auto whitespace-nowrap truncate custom-title-scroll"></h2>
- <a href="/" class="px-4 py-2 bg-[#222] hover:bg-[#333] border border-[#333] rounded-lg transition-colors flex items-center min-w-0 home-btn">
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 mr-1" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
- <path d="M19 21V9.5l-7-5-7 5V21a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2z" />
- <path d="M9 22V12h6v10" />
+ <a href="#" onclick="goBack()" class="px-4 py-2 bg-[#222] hover:bg-[#333] border border-[#333] rounded-lg transition-colors flex items-center min-w-0 home-btn">
+ <svg class="w-5 h-5 mr-1" viewBox="0 0 24 24" fill="#ffffff" xmlns="http://www.w3.org/2000/svg">
+ <path d="M5.25 11h15a1.5 1.5 0 1 1 0 3H5.25a1.5 1.5 0 0 1 0-3z"/>
+ <path d="M5.55 12 11.3 17.3a1.5 1.5 0 1 1-2.12 2.12L3 12l6.18-6.18a1.5 1.5 0 1 1 2.12 2.12L5.55 12z"/>
</svg>
- <span class="home-btn-text">返回首页</span>
+ <span class="home-btn-text">上一页</span>
</a>
</header>
@@ -1681,6 +1681,12 @@
? '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d=\"M12 15v2m0-8V7a4 4 0 00-8 0v2m8 0H4v8h16v-8H6v-6z\"/>'
: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d=\"M15 11V7a3 3 0 00-6 0v4m-3 4h12v6H6v-6z\"/>';
}
+
+ // 返回上一页
+ function goBack() {
+ const parentWindow = window.parent;
+ parentWindow.closeVideoPlayer();
+ }
</script>
</body>
</html>