v1.1
This commit is contained in:
+38
-2
@@ -598,16 +598,29 @@
|
||||
|
||||
this.state.isAutoplay = this.config.autoplay !== false;
|
||||
|
||||
// Sync UI based on loaded stated
|
||||
if (this.dom.muteBtn) {
|
||||
const iconName = this.state.isMuted ? 'volume-x' : 'volume-2';
|
||||
const iconColor = this.state.isMuted ? 'text-secondary' : 'stroke-white';
|
||||
this.dom.muteBtn.innerHTML = `<div class="w-12 h-12 flex items-center justify-center"><i data-lucide="${iconName}" class="${iconColor} w-6 h-6 drop-shadow-md"></i></div>`;
|
||||
}
|
||||
if (this.dom.scaleBtn) {
|
||||
this.dom.scaleBtn.innerHTML = `<div class="w-12 h-12 flex items-center justify-center"><i data-lucide="${this.state.isScaleFill ? 'maximize-2' : 'minimize-2'}" class="stroke-white w-6 h-6 drop-shadow-md"></i></div>`;
|
||||
}
|
||||
|
||||
const viewBtn = this.dom.viewModeBtn;
|
||||
viewBtn.innerHTML = `<i data-lucide="gallery-vertical" class="stroke-current w-5 h-5"></i>`;
|
||||
|
||||
const playBtn = this.dom.playModeBtn;
|
||||
playBtn.innerHTML = `<i data-lucide="${this.state.isAutoplay ? 'repeat' : 'repeat-1'}" class="stroke-current w-5 h-5"></i>`;
|
||||
// If random mode is saved, show shuffle icon. Otherwise show repeat/repeat-1 based on isAutoplay
|
||||
const isSeq = this.state.playMode === 'sequence';
|
||||
const playIcon = isSeq ? (this.state.isAutoplay ? 'repeat' : 'repeat-1') : 'shuffle';
|
||||
playBtn.innerHTML = `<i data-lucide="${playIcon}" class="stroke-current w-5 h-5"></i>`;
|
||||
|
||||
lucide.createIcons();
|
||||
|
||||
if (this.config.server && this.config.token) {
|
||||
this.fetchVideos();
|
||||
this.fetchVideos(this.state.currentLibraryId);
|
||||
} else {
|
||||
setTimeout(() => this.toggleModal('profilePage', true), 500);
|
||||
}
|
||||
@@ -636,6 +649,22 @@
|
||||
this.config.autoplay = localStorage.getItem('emby_autoplay') !== 'false';
|
||||
this.config.deleteMode = localStorage.getItem('emby_delete_mode') === 'true';
|
||||
|
||||
const savedScale = localStorage.getItem('emby_is_scale_fill');
|
||||
if (savedScale !== null) this.state.isScaleFill = savedScale === 'true';
|
||||
|
||||
const savedMute = localStorage.getItem('emby_is_muted');
|
||||
if (savedMute !== null) this.state.isMuted = savedMute === 'true';
|
||||
|
||||
const savedPlayMode = localStorage.getItem('emby_play_mode');
|
||||
if (savedPlayMode !== null) this.state.playMode = savedPlayMode;
|
||||
|
||||
const savedLibId = localStorage.getItem('emby_lib_id');
|
||||
const savedLibType = localStorage.getItem('emby_lib_type');
|
||||
if (savedLibId) {
|
||||
this.state.currentLibraryId = savedLibId;
|
||||
this.state.currentLibraryType = savedLibType || 'library';
|
||||
}
|
||||
|
||||
if (this.dom.configServer) this.dom.configServer.value = this.config.server;
|
||||
if (this.dom.configUser) this.dom.configUser.value = this.config.user;
|
||||
if (this.dom.configPwd && this.config.token) {
|
||||
@@ -1592,6 +1621,8 @@
|
||||
div.onclick = () => {
|
||||
this.state.currentLibraryId = pl.Id;
|
||||
this.state.currentLibraryType = 'playlist';
|
||||
localStorage.setItem('emby_lib_id', pl.Id);
|
||||
localStorage.setItem('emby_lib_type', 'playlist');
|
||||
this.state.currentTab = 'home';
|
||||
this.updateTabHighlight();
|
||||
this.fetchVideos(pl.Id);
|
||||
@@ -1616,6 +1647,8 @@
|
||||
div.onclick = () => {
|
||||
this.state.currentLibraryId = lib.Id;
|
||||
this.state.currentLibraryType = 'library';
|
||||
localStorage.setItem('emby_lib_id', lib.Id);
|
||||
localStorage.setItem('emby_lib_type', 'library');
|
||||
this.state.currentTab = 'home';
|
||||
this.updateTabHighlight();
|
||||
this.fetchVideos(lib.Id);
|
||||
@@ -1781,6 +1814,7 @@
|
||||
togglePlayMode() {
|
||||
const isSeq = this.state.playMode === 'sequence';
|
||||
this.state.playMode = isSeq ? 'random' : 'sequence';
|
||||
localStorage.setItem('emby_play_mode', this.state.playMode);
|
||||
|
||||
const btn = this.dom.playModeBtn;
|
||||
btn.innerHTML = `<i data-lucide="${isSeq ? 'shuffle' : 'repeat'}" class="stroke-current w-5 h-5"></i>`;
|
||||
@@ -1848,6 +1882,7 @@
|
||||
|
||||
toggleScaleMode() {
|
||||
this.state.isScaleFill = !this.state.isScaleFill;
|
||||
localStorage.setItem('emby_is_scale_fill', this.state.isScaleFill);
|
||||
const videos = document.querySelectorAll('.video-fullscreen');
|
||||
videos.forEach((v, index) => {
|
||||
v.classList.remove('object-cover', 'object-contain');
|
||||
@@ -1991,6 +2026,7 @@
|
||||
this.dom.muteBtn.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
this.state.isMuted = !this.state.isMuted;
|
||||
localStorage.setItem('emby_is_muted', this.state.isMuted);
|
||||
|
||||
const slideIdx = (this.state.currentIndex % 3 + 3) % 3;
|
||||
const v = document.getElementById(`video-p${slideIdx}`);
|
||||
|
||||
+46
-5
@@ -629,22 +629,35 @@
|
||||
this.loadFavorites();
|
||||
this.bindEvents();
|
||||
|
||||
// 根据配置设置自动连播状态(只影响视频自动播放,不隐藏界面)
|
||||
this.state.isAutoplay = this.config.autoplay !== false;
|
||||
|
||||
// 根据持久化状态同步 UI 图标
|
||||
if (this.dom.muteBtn) {
|
||||
const iconName = this.state.isMuted ? 'volume-x' : 'volume-2';
|
||||
const iconColor = this.state.isMuted ? 'text-secondary' : 'stroke-white';
|
||||
this.dom.muteBtn.innerHTML = `<div class="w-12 h-12 flex items-center justify-center"><i data-lucide="${iconName}" class="${iconColor} w-6 h-6 drop-shadow-md"></i></div>`;
|
||||
}
|
||||
if (this.dom.scaleBtn) {
|
||||
this.dom.scaleBtn.innerHTML = `<div class="w-12 h-12 flex items-center justify-center"><i data-lucide="${this.state.isScaleFill ? 'maximize-2' : 'minimize-2'}" class="stroke-white w-6 h-6 drop-shadow-md"></i></div>`;
|
||||
}
|
||||
|
||||
// 初始化视图模式按钮图标(默认竖版,显示gallery-vertical)
|
||||
const viewBtn = this.dom.viewModeBtn;
|
||||
viewBtn.innerHTML = `<i data-lucide="gallery-vertical" class="stroke-current w-5 h-5"></i>`;
|
||||
|
||||
// 初始化播放模式按钮图标(根据自动连播配置)
|
||||
// 初始化播放模式按钮图标
|
||||
const playBtn = this.dom.playModeBtn;
|
||||
playBtn.innerHTML = `<i data-lucide="${this.state.isAutoplay ? 'repeat' : 'repeat-1'}" class="stroke-current w-5 h-5"></i>`;
|
||||
// 若为随机模式,显示 shuffle;否则根据是否自动连播显示 repeat 或 repeat-1
|
||||
const isSeq = this.state.playMode === 'sequence';
|
||||
const playIcon = isSeq ? (this.state.isAutoplay ? 'repeat' : 'repeat-1') : 'shuffle';
|
||||
playBtn.innerHTML = `<i data-lucide="${playIcon}" class="stroke-current w-5 h-5"></i>`;
|
||||
|
||||
lucide.createIcons();
|
||||
|
||||
// 检查配置并启动
|
||||
if (this.config.server && this.config.token) {
|
||||
this.fetchVideos();
|
||||
// 若存在上次保存的库/播放列表,优先加载
|
||||
this.fetchVideos(this.state.currentLibraryId);
|
||||
} else {
|
||||
setTimeout(() => this.toggleModal('profilePage', true), 500);
|
||||
}
|
||||
@@ -674,6 +687,23 @@
|
||||
this.config.autoplay = localStorage.getItem('emby_autoplay') !== 'false';
|
||||
this.config.deleteMode = localStorage.getItem('emby_delete_mode') === 'true';
|
||||
|
||||
// 读取高频交互状态
|
||||
const savedScale = localStorage.getItem('emby_is_scale_fill');
|
||||
if (savedScale !== null) this.state.isScaleFill = savedScale === 'true';
|
||||
|
||||
const savedMute = localStorage.getItem('emby_is_muted');
|
||||
if (savedMute !== null) this.state.isMuted = savedMute === 'true';
|
||||
|
||||
const savedPlayMode = localStorage.getItem('emby_play_mode');
|
||||
if (savedPlayMode !== null) this.state.playMode = savedPlayMode;
|
||||
|
||||
const savedLibId = localStorage.getItem('emby_lib_id');
|
||||
const savedLibType = localStorage.getItem('emby_lib_type');
|
||||
if (savedLibId) {
|
||||
this.state.currentLibraryId = savedLibId;
|
||||
this.state.currentLibraryType = savedLibType || 'library';
|
||||
}
|
||||
|
||||
// 填充 UI
|
||||
if (this.dom.configServer) this.dom.configServer.value = this.config.server;
|
||||
if (this.dom.configUser) this.dom.configUser.value = this.config.user;
|
||||
@@ -1691,12 +1721,14 @@
|
||||
favDiv.innerHTML = `<i data-lucide="folder-heart" class="w-4 h-4"></i><span class="flex-1 truncate">收藏夹</span>${isFavSelected ? '<i data-lucide="check" class="w-3.5 h-3.5"></i>' : ''}`;
|
||||
favDiv.onclick = () => {
|
||||
this.state.currentLibraryId = 'favorites';
|
||||
this.state.currentLibraryType = 'favorites';
|
||||
localStorage.setItem('emby_lib_id', 'favorites');
|
||||
localStorage.setItem('emby_lib_type', 'favorites');
|
||||
this.state.currentTab = 'favorites';
|
||||
if (this.state.favorites.size === 0) {
|
||||
this.showToast('暂无收藏');
|
||||
return;
|
||||
}
|
||||
this.state.currentLibraryType = 'favorites';
|
||||
this.fetchVideos();
|
||||
this.toggleModal('libraryModal', false);
|
||||
};
|
||||
@@ -1717,6 +1749,8 @@
|
||||
div.onclick = () => {
|
||||
this.state.currentLibraryId = pl.Id;
|
||||
this.state.currentLibraryType = 'playlist';
|
||||
localStorage.setItem('emby_lib_id', pl.Id);
|
||||
localStorage.setItem('emby_lib_type', 'playlist');
|
||||
this.state.currentTab = 'home';
|
||||
this.updateTabHighlight();
|
||||
this.fetchVideos(pl.Id);
|
||||
@@ -1741,6 +1775,8 @@
|
||||
div.onclick = () => {
|
||||
this.state.currentLibraryId = lib.Id;
|
||||
this.state.currentLibraryType = 'library';
|
||||
localStorage.setItem('emby_lib_id', lib.Id);
|
||||
localStorage.setItem('emby_lib_type', 'library');
|
||||
this.state.currentTab = 'home';
|
||||
this.updateTabHighlight();
|
||||
this.fetchVideos(lib.Id);
|
||||
@@ -1767,6 +1803,8 @@
|
||||
}
|
||||
this.state.currentLibraryId = 'favorites';
|
||||
this.state.currentLibraryType = 'favorites';
|
||||
localStorage.setItem('emby_lib_id', 'favorites');
|
||||
localStorage.setItem('emby_lib_type', 'favorites');
|
||||
this.fetchVideos();
|
||||
this.toggleModal('libraryModal', false);
|
||||
};
|
||||
@@ -1922,6 +1960,7 @@
|
||||
togglePlayMode() {
|
||||
const isSeq = this.state.playMode === 'sequence';
|
||||
this.state.playMode = isSeq ? 'random' : 'sequence';
|
||||
localStorage.setItem('emby_play_mode', this.state.playMode);
|
||||
|
||||
const btn = this.dom.playModeBtn;
|
||||
btn.innerHTML = `<i data-lucide="${isSeq ? 'shuffle' : 'repeat'}" class="stroke-current w-5 h-5"></i>`;
|
||||
@@ -1997,6 +2036,7 @@
|
||||
|
||||
toggleScaleMode() {
|
||||
this.state.isScaleFill = !this.state.isScaleFill;
|
||||
localStorage.setItem('emby_is_scale_fill', this.state.isScaleFill);
|
||||
const videos = document.querySelectorAll('.video-fullscreen');
|
||||
videos.forEach((v, index) => {
|
||||
v.classList.remove('object-cover', 'object-contain');
|
||||
@@ -2146,6 +2186,7 @@
|
||||
this.dom.muteBtn.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
this.state.isMuted = !this.state.isMuted;
|
||||
localStorage.setItem('emby_is_muted', this.state.isMuted);
|
||||
|
||||
const slideIdx = (this.state.currentIndex % 3 + 3) % 3;
|
||||
const v = document.getElementById(`video-p${slideIdx}`);
|
||||
|
||||
Reference in New Issue
Block a user