Refactor player styles: move critical loading styles to player.css and remove inline styles from player.html

This commit is contained in:
developer
2025-06-18 14:10:30 +08:00
parent d86701fc4a
commit 4d2bcda420
2 changed files with 141 additions and 140 deletions

View File

@@ -5,16 +5,140 @@ body, html {
height: 100%;
background-color: #0f1622;
color: white;
padding-top: 72px;
}
/* Critical header and navigation styles */
.player-header {
position: relative;
z-index: 2147483647 !important;
pointer-events: auto !important;
}
.player-header-fixed {
position: fixed !important;
top: 0;
left: 0;
width: 100vw;
z-index: 9000 !important;
pointer-events: auto !important;
background: #111;
}
#homeButton {
pointer-events: auto !important;
}
/* Critical loading styles to prevent FOUC */
.player-placeholder {
width: 100% !important;
height: auto !important;
aspect-ratio: 16/9 !important;
background-color: #1f2937 !important;
position: relative !important;
display: block !important;
border-radius: 8px !important;
overflow: hidden !important;
}
.player-loading-container {
width: 100% !important;
height: 0 !important;
padding-bottom: 56.25% !important;
position: relative !important;
background-color: #1f2937 !important;
border-radius: 8px !important;
overflow: hidden !important;
display: block !important;
}
.player-loading-overlay {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: center !important;
background-color: rgba(17, 24, 39, 0.7) !important;
}
.player-loading-spinner {
width: 48px !important;
height: 48px !important;
border-radius: 50% !important;
position: relative !important;
margin-bottom: 16px !important;
}
/* Critical styles for loading text */
.player-loading-text,
.player-loading-overlay div:nth-child(2),
div.player-loading-text {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
color: #f9fafb !important;
font-size: 16px !important;
font-weight: 500 !important;
margin-bottom: 8px !important;
text-align: center !important;
font-family: system-ui, -apple-system, sans-serif !important;
line-height: 1.4 !important;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
pointer-events: none !important;
z-index: 100 !important;
background: transparent !important;
max-width: 90% !important;
}
@keyframes player-spinner-rotate {
to { transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* ArtPlayer specific styles */
.art-video-player, .art-video-player video {
width: 100% !important;
height: 100% !important;
min-height: 150px !important;
max-height: 100vh !important;
background: #000 !important;
object-fit: contain !important;
display: block !important;
}
/* Fix for Chrome-specific issues */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
.art-video-player video {
transform: translateZ(0) !important;
will-change: transform !important;
}
/* Force visibility of video element */
.art-video-player.art-playing video {
visibility: visible !important;
opacity: 1 !important;
}
}
.player-container {
width: 100%;
max-width: 1000px;
margin: 0 auto;
}
#player {
width: 100%;
height: 60vh; /* 视频播放器高度 */
}
.loading-container {
position: absolute;
top: 0;
@@ -29,6 +153,7 @@ body, html {
z-index: 100;
flex-direction: column;
}
.loading-spinner {
width: 50px;
height: 50px;
@@ -38,9 +163,7 @@ body, html {
animation: spin 1s ease-in-out infinite;
margin-bottom: 10px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.error-container {
position: absolute;
top: 0;
@@ -57,18 +180,22 @@ body, html {
text-align: center;
padding: 1rem;
}
.error-icon {
font-size: 48px;
margin-bottom: 10px;
}
.episode-active {
background-color: #3b82f6 !important;
border-color: #60a5fa !important;
}
.episode-grid {
max-height: 30vh;
overflow-y: auto;
}
/* 恢复播放位置提示样式 */
.position-restore-hint {
position: fixed;
@@ -83,25 +210,30 @@ body, html {
transition: transform 0.3s ease;
font-size: 14px;
}
.position-restore-hint.show {
transform: translateX(-50%) translateY(0);
}
.hint-content {
display: flex;
align-items: center;
justify-content: center;
}
.switch {
position: relative;
display: inline-block;
width: 46px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
@@ -113,6 +245,7 @@ body, html {
transition: .4s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
@@ -124,12 +257,15 @@ body, html {
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #00ccff;
}
input:checked + .slider:before {
transform: translateX(22px);
}
/* 添加快捷键提示样式 */
.shortcut-hint {
position: fixed;
@@ -148,6 +284,7 @@ input:checked + .slider:before {
opacity: 0;
transition: opacity 0.3s ease;
}
.shortcut-hint.show {
opacity: 1;
}
@@ -161,6 +298,7 @@ input:checked + .slider:before {
z-index: 10000;
background-color: #000;
}
.player-container:-webkit-full-screen #player,
.player-container:fullscreen #player {
width: 100%; height: 100%;
@@ -176,30 +314,23 @@ input:checked + .slider:before {
.resource-info-bar-left {
align-items: center;
font-size: 1.1rem;
/* 调整字体大小 */
font-weight: bold;
color: #fff;
/* 文字颜色改为白色 */
flex: 1;
}
.resource-info-bar-videos {
font-size: 1rem;
/* 调整字体大小 */
font-weight: normal;
margin-left: 10px;
color: #ccc;
/* 副文本颜色调亮 */
}
.resource-switch-btn {
align-items: center;
background: none;
/* 移除背景 */
border: none;
/* 移除边框 */
color: #a67c2d;
/* 恢复原图标颜色 */
font-weight: bold;
font-size: 1rem;
cursor: pointer;
@@ -211,21 +342,17 @@ input:checked + .slider:before {
.resource-switch-btn:hover {
background: #f5e9d7;
/* 调整悬停背景色 */
}
.resource-switch-btn:active {
background: #f5e9d7;
/* 调整点击背景色 */
}
.resource-switch-icon {
width: 20px;
height: 20px;
margin-right: 0;
/* 使用gap控制间距 */
color: #a67c2d;
/* 恢复原图标颜色 */
vertical-align: middle;
transition: transform 0.3s;
}

View File

@@ -16,132 +16,6 @@
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/player.css">
<!-- Add optimized player loading styles -->
<style>
/* Critical header and navigation styles */
.player-header {
position: relative;
z-index: 2147483647 !important;
pointer-events: auto !important;
}
/* Critical loading styles to prevent FOUC */
.player-placeholder {
width: 100% !important;
height: auto !important;
aspect-ratio: 16/9 !important;
background-color: #1f2937 !important;
position: relative !important;
display: block !important;
border-radius: 8px !important;
overflow: hidden !important;
}
.player-loading-container {
width: 100% !important;
height: 0 !important;
padding-bottom: 56.25% !important;
position: relative !important;
background-color: #1f2937 !important;
border-radius: 8px !important;
overflow: hidden !important;
display: block !important;
}
.player-loading-overlay {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: center !important;
background-color: rgba(17, 24, 39, 0.7) !important;
}
.player-loading-spinner {
width: 48px !important;
height: 48px !important;
border-radius: 50% !important;
position: relative !important;
margin-bottom: 16px !important;
}
/* Critical styles for loading text */
.player-loading-text,
.player-loading-overlay div:nth-child(2),
div.player-loading-text {
display: block !important;
visibility: visible !important;
opacity: 1 !important;
color: #f9fafb !important;
font-size: 16px !important;
font-weight: 500 !important;
margin-bottom: 8px !important;
text-align: center !important;
font-family: system-ui, -apple-system, sans-serif !important;
line-height: 1.4 !important;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
pointer-events: none !important;
z-index: 100 !important;
background: transparent !important;
max-width: 90% !important;
}
@keyframes player-spinner-rotate {
to { transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* ArtPlayer specific styles */
.art-video-player, .art-video-player video {
width: 100% !important;
height: 100% !important;
min-height: 150px !important;
max-height: 100vh !important;
background: #000 !important;
object-fit: contain !important;
/* position: relative !important; */
display: block !important;
}
/* Fix for Chrome-specific issues */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
.art-video-player video {
transform: translateZ(0) !important;
will-change: transform !important;
}
/* Force visibility of video element */
.art-video-player.art-playing video {
visibility: visible !important;
opacity: 1 !important;
}
}
.player-header-fixed {
position: fixed !important;
top: 0;
left: 0;
width: 100vw;
z-index: 9000 !important;
pointer-events: auto !important;
background: #111;
}
#homeButton { pointer-events: auto !important; }
body { padding-top: 72px; }
</style>
<!-- Loading indicator has been removed as requested -->
<script>
// Loading indicator initialization removed
</script>
<meta http-equiv="Cache-Control" content="no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">