Adjustable Fade Delay

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

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)
}