Skip to content

Commit

Permalink
Sync 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YanJi314 committed Aug 17, 2024
1 parent f40c3f8 commit c8da638
Show file tree
Hide file tree
Showing 13 changed files with 569 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@


/**************** 基础配置 ****************/
// ExtensionRuntime在加载时会自动添加json中的scheme字段到ExtensionConfig下,所以无需担心ExtensionConfig.xxx是否存在
ExtensionConfig.file.uiName = "本地";
// 当没有config.setItem时,调用config.getItem会返回defaultConfig中的值
defaultConfig["folderLists"] = [];

Expand Down Expand Up @@ -209,5 +207,9 @@ ExtensionConfig.file.search = async keyword => {
if (songInfoString.includes(keyword)) resultArray.push(file);
}
});
return {files: resultArray, menu: FileExtensionTools.fileMenuItem, hasMore: false};
return {
files: resultArray,
menu: FileExtensionTools.fileMenuItem,//.concat(DownloadController.getMenuItems()),
hasMore: false
};
}
6 changes: 4 additions & 2 deletions src/frontend/assets/components/PublicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ const defaultConfig = {
desktopLyricsProtection: true,
desktopLyricsAutoHide: true,
desktopLyricsColor: "#1E9FFF",
desktopLyricsStrokeEnabled: true,
desktopLyricsStroke: "#1672B8",
desktopLyricsSize: 30,
desktopLyricsWidth: 700,
desktopLyricsTop: screen.height - 300,
desktopLyricsLeft: screen.width / 2,
extensions: ["assets/extensions/local.json"],
extensionCache: {},
ext: {},
musicListSort: [1, 1],
parallelDownload: 3,
downloadFileName: "[title] - [artist]",
}

const configListeners = {};
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/assets/components/SimAP.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ body:not(.playing) #background>div{animation-play-state:paused;}
.controls .progressControl{display:flex;align-items:center;margin:10px 0;}
.controls .progressControl span{width:55px;font-size:.85em;opacity:.8;}
.controls .progressControl span:last-child{text-align:right;}
.musicLoading #progressBar>div,.musicLoading #bottomProgressBar>div{animation:progressLoading 1s linear infinite;background-image:linear-gradient(-45deg,rgba(0,0,0,.1) 25%,transparent 0,transparent 50%,rgba(0,0,0,.1) 0,rgba(0,0,0,.1) 75%,transparent 0,transparent)!important;background-repeat:repeat-x;background-size:25px 20px;}
.musicLoading #progressBar>div,.musicLoading #bottomProgressBar>div{animation:progressLoading 1s linear infinite;background-image:linear-gradient(-45deg,rgba(0,0,0,.05) 25%,transparent 0,transparent 50%,rgba(0,0,0,.05) 0,rgba(0,0,0,.05) 75%,transparent 0,transparent)!important;background-repeat:repeat-x;background-size:25px 20px;}
@keyframes progressLoading{to{background-position:25px 0;}}
/* 下方按钮 */
.controls .buttons,.bottom .center{align-items:center;margin-top:5px;display:flex;align-items:center;justify-content:center;}
Expand Down Expand Up @@ -56,7 +56,7 @@ body:not(.playing) #background>div{animation-play-state:paused;}
/* 3D特效 */
body:not(.hideLyrics.hideList) .playerContainer{transform:translateX(-25px);}
.threeEffect .controls{transform:perspective(900px) rotateY(10deg);}
.threeEffect .lyrics,.list{transform:perspective(900px) rotateY(-12.5deg);}
.threeEffect .lyrics,.threeEffect .list{transform:perspective(900px) rotateY(-12.5deg);}

/* 歌词区域 */
.lyrics{position:absolute;left:410px;top:0;width:calc(100% - 410px);font-size:var(--lrcSize);height:100%;transform-origin:left center;transition:all .3s;mask:linear-gradient(180deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.6) 15%,#fff 25%,#fff 75%,hsla(0,0%,100%,.6) 85%,hsla(0,0%,100%,0));}
Expand Down
16 changes: 9 additions & 7 deletions src/frontend/assets/components/SimAP.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ const SimAPControls = {
audio[audio.paused ? "play" : "pause"]();
SimAPControls.loadAudioState();
},
prev() {this.switchIndex(-1);},
prev() {
const audio = document.getElementById("audio");
if (!config.getItem("fastPlayback") || audio.currentTime / audio.duration < .9) this.switchIndex(-1);
else audio.currentTime = 0;
},
next() {this.switchIndex(1);},
switchIndex(offset) {
const list = config.getItem("playList");
Expand Down Expand Up @@ -202,16 +206,14 @@ const SimAPControls = {
document.querySelector(".volBtnBottom i").innerHTML = icon;
},
toggleList(isShow = document.body.classList.contains("hideList")) {
document.body.classList[isShow ? "add" : "remove"]("hideList");
document.body.classList[isShow ? "remove" : "add"]("hideList");
if (isShow) document.body.classList.add("hideLyrics");
PlayerController.loadMusicListActive();
},
toggleLyrics() {
document.body.classList[document.body.classList.contains("hideLyrics") ? "add" : "remove"]("hideLyrics");
document.body.classList[document.body.classList.contains("hideLyrics") ? "remove" : "add"]("hideLyrics");
if (!document.body.classList.contains("hideLyrics")) document.body.classList.add("hideList");
config.setItem("lrcShow", !document.body.classList.contains("hideLyrics"));
toggleLyrics(isShow = document.body.classList.contains("hideLyrics")) {
document.body.classList[isShow ? "remove" : "add"]("hideLyrics");
if (isShow) document.body.classList.add("hideList");
config.setItem("lrcShow", isShow);
},
loadConfig() {
document.querySelector(".SimLRC").style.setProperty("--lineSpace", config.getItem("lyricSpace") + "em");
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/assets/components/SimLRC.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SimLRC {
container.style.setProperty("--lineSpace", options.lineSpace + "em");
// 监听事件
const refreshLrcProgress = forceScroll => {
const currentTime = audio.currentTime * 1000;
const currentTime = Math.round(audio.currentTime * 1000);
let lrcEles = Array.from(container.getElementsByTagName("div"));
for (let index in lrcEles) {
let div = lrcEles[index];
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/assets/components/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ const {ipcRenderer, shell} = require("electron");
const fs = require("fs");
const path = require("path");
const musicMetadata = require("music-metadata");
const nodeId3 = require("node-id3");
const nodeId3 = require("node-id3");
const fflate = require("fflate");
7 changes: 0 additions & 7 deletions src/frontend/assets/extensions/local.json

This file was deleted.

52 changes: 46 additions & 6 deletions src/frontend/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ input,select{background:rgba(0,0,0,.03);padding:8px 10px;border-radius:5px;borde



.left .leftBar div,.right .musicListTitle section b,.right .musicListTitle section .details,.bottom .info .musicInfoBottom,.controls .musicInfo,.list>div>div>*{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.left .leftBar div,.right .musicListTitle section b,
.right .musicListTitle section .details,
.bottom .info .musicInfoBottom,
.controls .musicInfo,.list>div>div>*,
.right #downloadContainer>div>.info>.music>b{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}


/* 主窗体 - 加载动画 */
Expand All @@ -39,12 +43,13 @@ header{position:fixed;top:0;height:35px;display:flex;justify-content:right;width
header i{font-family:"windowsicon";height:100%;width:40px;display:flex;align-items:center;justify-content:center;transition:background .2s,opacity .2s,color .2s;-webkit-app-region:no-drag;}
header i#lyricsBtn{font-size:.95em;padding-bottom:1px;font-family:"微软雅黑"!important;}
header i#miniBtn{transform:scaleY(-1);font-size:.95em;}
header i#devBtn{font-size:.95em;}
header i:hover{background:rgba(0,0,0,.05);}
header i:active{background:rgba(0,0,0,.1);opacity:.8;}
header i#closeBtn:hover{background:#E81123;color:white;}
header i#closeBtn:active{background:#E81123;color:rgba(252,252,252,.8);}
header i.active{color:#1E9FFF;}
.playerShown #miniBtn,.playerShown #desktopBtn,.playerShown #lyricsBtn{opacity:0;pointer-events:none;}
.playerShown #miniBtn,.playerShown #lyricsBtn,.playerShown #devBtn{opacity:0;pointer-events:none;}
header #hidePlayerBtn{opacity:0;position:absolute;right:120px;pointer-events:none;}
.playerShown header #hidePlayerBtn{opacity:1;pointer-events:all;}

Expand Down Expand Up @@ -113,13 +118,33 @@ header #hidePlayerBtn{opacity:0;position:absolute;right:120px;pointer-events:non
.right .searchTitle .inputGroup input{height:37px;margin-right:10px;max-width:500px;width:100%;border-radius:0 5px 5px 0;padding:0 10px;}
.right .searchTitle .inputGroup button{height:37px;font-size:1.05em;}
.right #searchBottomIndicator{text-align:center;opacity:.8;margin-top:50px;margin:30px 0 10px 0;font-size:.9em;}
/* 下载 */
.right #downloadContainer{padding-top:90px!important;}
.right #downloadContainer>div{background:white;width:100%;border-radius:5px;margin-bottom:5px;padding:10px 15px;position:relative;height:65px;overflow:hidden;transition:background .2s;}
.right #downloadContainer>div[data-status="success"]{background:#EFF6EF;}
.right #downloadContainer>div[data-status="error"]{background:#FCEFEF;}
.right #downloadContainer>div>.info{display:flex;align-items:center;white-space:nowrap;position:absolute;inset:0;z-index:5;padding:0 15px;}
.right #downloadContainer>div>.info>.music{display:flex;flex-direction:column;width:calc(100% - 150px);}
.right #downloadContainer>div>.info>.music>span{display:block;opacity:.8;font-size:.9em;margin-top:3px;}
.right #downloadContainer>div[data-status="pending"]>.info>.music>span>i::after{content:"\F337";}
.right #downloadContainer>div[data-status="download"]>.info>.music>span>i::after{content:"\EC5A";}
.right #downloadContainer>div[data-status="success"]>.info>.music>span>i::after{content:"\EB7B";}
.right #downloadContainer>div[data-status="error"]>.info>.music>span>i::after{content:"\F4C8";}
.right #downloadContainer>div>.info>.buttons{display:flex;justify-content:flex-end;width:150px;}
.right #downloadContainer>div>.info>.buttons>i{width:30px;height:30px;display:flex;align-items:center;justify-content:center;font-size:1.1em;border-radius:50%;transition:background .2s;}
.right #downloadContainer>div>.info>.buttons>i:hover{background:rgba(0,0,0,.05);}
.right #downloadContainer>div>.info>.buttons>i:active{background:rgba(0,0,0,.1);}
.right #downloadContainer>div:not([data-status="error"])>.info>.buttons>i.errorOnly{display:none;}
.right #downloadContainer>div:not([data-status="success"])>.info>.buttons>i.successOnly{display:none;}
.right #downloadContainer>div>.progressBar{transition:width .2s,opacity .2s;position:absolute;inset:0;right:unset;background:#DAEFFF;width:var(--progressWidth);}
.right #downloadContainer>div:not([data-status="download"])>.progressBar{opacity:0;}
/* 扩展 */
.right #extensionPage #extensionContainer{padding-top:90px!important;}
.right #extensionContainer{padding-top:90px!important;}
/* 设置 */
.right .page .header{padding:30px 30px 10px 30px;font-size:1.5em;border-bottom:1px solid rgba(0,0,0,.05);position:absolute;background:rgba(252,252,252,.9);backdrop-filter:blur(20px);width:100%;z-index:2;display:flex;align-items:center;}
.right .page .header i{margin-right:5px;}
.right .page .header button{margin-left:15px;}
.right #settingsPage #settingsContainer, .right #extensionPage #extensionContainer{position:absolute;z-index:1;padding:70px 27.5px 100px 27.5px;width:100%;height:100%;overflow-y:scroll;}
.right .page .header small{font-size:.6em;margin-left:15px;opacity:.8;}
.right #settingsPage #settingsContainer, .right #extensionContainer, .right #downloadContainer{position:absolute;z-index:1;padding:70px 27.5px 100px 27.5px;width:100%;height:100%;overflow-y:scroll;}
.right #settingsPage #settingsContainer .title{font-weight:bold;margin:20px 2.5px 5px 2.5px;}
.right #settingsPage #settingsContainer .block, .right #extensionPage #extensionContainer>div{background:white;width:100%;border-radius:5px;margin-bottom:5px;padding:10px 15px;display:flex;align-items:center;}
.right #settingsPage #settingsContainer .block section, .right #extensionPage #extensionContainer>div section{width:100%;margin-right:10px;}
Expand Down Expand Up @@ -192,4 +217,19 @@ header #hidePlayerBtn{opacity:0;position:absolute;right:120px;pointer-events:non

/* 主窗体 - 播放内页 */
#playPage{position:fixed;top:120vh;left:0;width:100%;height:100%;background:white;transition:top .3s;overflow:hidden;}
.playerShown #playPage{top:0;}
.playerShown #playPage{top:0;}


/* 主窗体 - 迷你模式 */
header{-webkit-app-region:no-drag;}
.miniMode .bottom{z-index:300;height:60px;background:white;}
.miniMode .bottom .progressBefore,.miniMode .bottom .progressAfter{display:none;}
.miniMode .bottom #bottomProgressBar{bottom:0;top:unset;width:100%;left:0;}
.miniMode .bottom #bottomProgressBar::after{display:none;}
.miniMode .bottom .info{right:0;zoom:.72;top:0px;width:230px;bottom:10px;-webkit-app-region:drag;}
.miniMode .bottom .info .musicInfoBottom{font-size:1.1em;max-width:160px;}
.miniMode .bottom .info .musicInfoBottom div{margin-top:-2px;}
.miniMode .bottom .center{right:15px;zoom:.7;bottom:10px;width:220px;left:unset;}
.miniMode .bottom .center .bottomListBtn{display:none;}
body:not(.miniMode) .bottom .center .miniModeBtn{display:none;}
.miniMode .bottom .volume{display:none;}
Loading

0 comments on commit c8da638

Please sign in to comment.