Partial upload-202212140345
This commit is contained in:
parent
7d75fee86e
commit
be250008f2
@ -5,6 +5,8 @@
|
||||
|
||||
TODO:
|
||||
* [ ] 增加列表单次循环开关(或者尝试单曲循环???)
|
||||
* [x] 循环的时候如果在重新获得焦点后没多久就又失去焦点,滚动显示就变得异常的快,可以在控制台的Scroll输出中发现。(观察中)
|
||||
* [ ] 对于短的标题,它一样去scroll了,没有这个必要。
|
||||
* [ ] 需要修正:上传的列表应当是播放列表而不是历史记录
|
||||
* [x] 为历史记录列表增加删除按钮
|
||||
* [ ] 一键加入将查询结果歌曲加入播放列表(主要是历史记录和云列表)
|
||||
|
||||
45
js/main.js
45
js/main.js
@ -13,12 +13,12 @@ class TitleStat{
|
||||
GlobalInterval = null;
|
||||
originTitle = document.title;
|
||||
TargetTitle = "";
|
||||
TempTitle = ""; // Used to determine if the title has changed
|
||||
SCROLL_SPEED = 50;
|
||||
// TempTitle = ""; // Used to determine if the title has changed
|
||||
SCROLL_SPEED = 1000;
|
||||
|
||||
setTargetTitle( title ){
|
||||
this.TargetTitle = title;
|
||||
console.log( this );
|
||||
// console.log( this );
|
||||
}
|
||||
|
||||
setScrollSpeed( speed ){
|
||||
@ -32,6 +32,9 @@ class TitleStat{
|
||||
startLoop(){
|
||||
this.TempTitle = this.TargetTitle;
|
||||
this.GlobalInterval = setInterval(this.scorllTheTitle, this.SCROLL_SPEED);
|
||||
window.userdefines_title = {
|
||||
"TempTitle": this.TargetTitle,
|
||||
}
|
||||
}
|
||||
|
||||
stopLoop(){
|
||||
@ -40,33 +43,53 @@ class TitleStat{
|
||||
|
||||
reset(){
|
||||
this.stopLoop();
|
||||
delete window.userdefines_title;
|
||||
document.title = this.originTitle;
|
||||
}
|
||||
|
||||
scorllTheTitle() {
|
||||
console.log("Doing Someting...");
|
||||
if ( this.TempTitle == undefined ) {
|
||||
console.warn( "this.TempTitle undefined" );
|
||||
console.log( this );
|
||||
this.TempTitle = this.TargetTitle;
|
||||
// console.log("Title Scroll!"); //Debug
|
||||
// if ( this.TempTitle == undefined ) {
|
||||
// console.warn( "this.TempTitle undefined" );
|
||||
// console.log( this );
|
||||
// this.TempTitle = this.TargetTitle;
|
||||
// }
|
||||
if( document.getElementById("Player").paused == false ){
|
||||
document.title = "[▶] " + this.userdefines_title.TempTitle.substring(0,20);
|
||||
if ( this.userdefines_title.TempTitle.length > 10 ){
|
||||
document.title += "...";
|
||||
} else {
|
||||
document.title += "";
|
||||
}
|
||||
}else{
|
||||
document.title = "[||] " + this.userdefines_title.TempTitle.substring(0,20);
|
||||
if ( this.userdefines_title.TempTitle.length > 10 ){
|
||||
document.title += "...";
|
||||
} else {
|
||||
document.title += "";
|
||||
}
|
||||
}
|
||||
document.title = this.TempTitle;
|
||||
this.TempTitle = this.TempTitle.substring(1) + this.TempTitle.substring(0,1);
|
||||
|
||||
this.userdefines_title.TempTitle = this.userdefines_title.TempTitle.substring(1) + this.userdefines_title.TempTitle.substring(0,1);
|
||||
}
|
||||
}
|
||||
|
||||
// Title Control
|
||||
// var originTitle = document.title;
|
||||
let TitleControl = new TitleStat(document.title);
|
||||
TitleControl.setTargetTitle("Song!");
|
||||
// TitleControl.setTargetTitle("Song!");
|
||||
window.onblur = () => {
|
||||
// document.title = "Song!";
|
||||
// TitleControl.setTargetTitle("Song!")
|
||||
console.log("您已离开播放器!");
|
||||
TitleControl.setScrollSpeed(2000);
|
||||
TitleControl.setTargetTitle(document.getElementById("nowplay").innerHTML);
|
||||
TitleControl.startLoop();
|
||||
}
|
||||
|
||||
window.onfocus = () => {
|
||||
// document.title = originTitle;
|
||||
console.log("您已回到播放器!");
|
||||
TitleControl.reset();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user