Adjustable Fade Delay

This commit is contained in:
Elizabeth Cray 2023-06-23 17:12:10 -04:00
parent bea8c7c44b
commit 14ee21c931
2 changed files with 36 additions and 8 deletions

View File

@ -32,11 +32,10 @@
{
"fraction" : false,
"index" : 4,
"max" : 1440,
"max" : 120,
"min" : 0,
"order" : 104,
"step" : 1,
"text" : "Change Every (minutes)",
"text" : "Duration (m)",
"type" : "slider",
"value" : 0
},
@ -44,15 +43,26 @@
{
"fraction" : true,
"index" : 3,
"max" : 60,
"min" : 0.1,
"max" : 59,
"min" : 0.5,
"order" : 103,
"precision" : 2,
"step" : 0.1,
"text" : "Change Every (seconds)",
"step" : 0.5,
"text" : "Duration (s)",
"type" : "slider",
"value" : 30
},
"transition_time" :
{
"fraction" : false,
"index" : 5,
"max" : 60,
"min" : 0,
"order" : 105,
"text" : "Fade Delay (s)",
"type" : "slider",
"value" : 5
},
"uri" :
{
"index" : 1,

View File

@ -1,5 +1,4 @@
// TODO:
// + Add adjustable timing
// - Add random timing option
@ -46,6 +45,20 @@ let loadMime = () => {
})
}
let adjustTransition = () => {
let transition = localStorage.getItem('transition_time')
console.log(`%cTransition Time: ${transition}s`, 'color: #EBCB8B; font-family: monospace;')
if (transition == null) {
transition = 5
}
let wallpaper = document.getElementById('wallpaper')
wallpaper.style.transition = `background ${transition}s linear`
wallpaper.style.webkitTransition = `background ${transition}s linear`
wallpaper.style.mozTransition = `background ${transition}s linear`
wallpaper.style.oTransition = `background ${transition}s linear`
wallpaper.style.msTransition = `background ${transition}s linear`
}
let urlExists = (url, callback) => {
var request = new XMLHttpRequest()
request.open('GET', url, true)
@ -109,6 +122,7 @@ let dumpStorage = () => {
console.log(' System:' + localStorage.getItem('systemId'))
console.log(' Socket:' + localStorage.getItem('socket'))
console.log(' Slide Delay:' + localStorage.getItem('timeout_m') + "m " + localStorage.getItem('timeout_s') + "s")
console.log(' Fade Delay:' + localStorage.getItem('transition_time'))
console.log(' Wallpapers:')
console.log(("%c "+localStorage.getItem('wallpapers')), "color: #A3BE8C; font-family: monospace; font-size: 8px;")
}
@ -229,6 +243,10 @@ window.wallpaperPropertyListener = {
if (properties.timeout_m) {
localStorage.setItem('timeout_m', properties.timeout_m.value)
}
if (properties.transition_time) {
localStorage.setItem('transition_time', properties.transition_time.value)
adjustTransition()
}
if (properties.systemid) {
localStorage.setItem('systemId', properties.systemid.value)
}