add default loop mode option
This commit is contained in:
parent
6aad3e583e
commit
504f7ab0e7
2 changed files with 36 additions and 10 deletions
|
@ -100,6 +100,14 @@ And that's it! you can upload the files to your website, or zip them up and uplo
|
||||||
`theme` (optional)
|
`theme` (optional)
|
||||||
> An object containing theme settings and colors
|
> An object containing theme settings and colors
|
||||||
|
|
||||||
|
\
|
||||||
|
`loopModeDefault` (optional)
|
||||||
|
> The type of loop mode to start with.
|
||||||
|
> Can be set to one of:
|
||||||
|
> - `"none"` (no looping) (default)
|
||||||
|
> - `"playlist"` (after the last track ends, start playing the first track)
|
||||||
|
> - `"track"` (loop the same selected track repeatedly)
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
**media entry options**
|
**media entry options**
|
||||||
|
|
28
index.html
28
index.html
|
@ -911,6 +911,14 @@
|
||||||
descriptionEl.innerHTML = description;
|
descriptionEl.innerHTML = description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function updateLoopMode(mode){
|
||||||
|
if(mode === undefined || mode === ''){
|
||||||
|
config.loopModeDefault = 'none';
|
||||||
|
} else {
|
||||||
|
config.loopModeDefault = mode;
|
||||||
|
}
|
||||||
|
loopSwitch(config.loopModeDefault);
|
||||||
|
}
|
||||||
|
|
||||||
function localStorageSet(key, value){
|
function localStorageSet(key, value){
|
||||||
try {
|
try {
|
||||||
|
@ -945,6 +953,7 @@
|
||||||
loadContent(data);
|
loadContent(data);
|
||||||
updateTitle(title)
|
updateTitle(title)
|
||||||
updateDescription(description);
|
updateDescription(description);
|
||||||
|
updateLoopMode(data.loopModeDefault)
|
||||||
updateTheme(theme);
|
updateTheme(theme);
|
||||||
|
|
||||||
updateTrackPreview();
|
updateTrackPreview();
|
||||||
|
@ -1453,22 +1462,31 @@
|
||||||
loadEntry(entry);
|
loadEntry(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function loopSwitch(){
|
function loopSwitch(mode){
|
||||||
loopSwitchEl.classList.remove('icon-loop', 'icon-loop-1');
|
loopSwitchEl.classList.remove('icon-loop', 'icon-loop-1');
|
||||||
loopSwitchEl.style.opacity = 1;
|
loopSwitchEl.style.opacity = 1;
|
||||||
|
if(mode){
|
||||||
|
loopMode = mode;
|
||||||
|
} else {
|
||||||
if(loopMode === "none"){
|
if(loopMode === "none"){
|
||||||
loopMode = "playlist";
|
loopMode = "playlist";
|
||||||
loopSwitchEl.classList.add('icon-loop');
|
|
||||||
loopSwitchEl.setAttribute('title', 'loop playlist');
|
|
||||||
} else if(loopMode === "playlist"){
|
} else if(loopMode === "playlist"){
|
||||||
loopMode = "track";
|
loopMode = "track";
|
||||||
loopSwitchEl.classList.add('icon-loop-1');
|
|
||||||
loopSwitchEl.setAttribute('title', 'loop track');
|
|
||||||
} else {
|
} else {
|
||||||
loopMode = "none";
|
loopMode = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(loopMode === "none"){
|
||||||
loopSwitchEl.classList.add('icon-loop');
|
loopSwitchEl.classList.add('icon-loop');
|
||||||
loopSwitchEl.style.opacity = 0.5;
|
loopSwitchEl.style.opacity = 0.5;
|
||||||
loopSwitchEl.setAttribute('title', 'loop off');
|
loopSwitchEl.setAttribute('title', 'loop off');
|
||||||
|
} else if(loopMode === "playlist"){
|
||||||
|
loopSwitchEl.classList.add('icon-loop');
|
||||||
|
loopSwitchEl.setAttribute('title', 'loop playlist');
|
||||||
|
} else {
|
||||||
|
loopSwitchEl.classList.add('icon-loop-1');
|
||||||
|
loopSwitchEl.setAttribute('title', 'loop track');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue