Adjustable slideshow delay
This commit is contained in:
parent
701172c982
commit
bea8c7c44b
57
project.json
57
project.json
@ -1,10 +1,18 @@
|
||||
{
|
||||
"file" : "scene.html",
|
||||
"description" : "Storage limit: 10240 images because of windows max path and locastorage limits",
|
||||
"file" : "scene.html",
|
||||
"general" :
|
||||
{
|
||||
"properties" :
|
||||
{
|
||||
"dir" :
|
||||
{
|
||||
"index" : 2,
|
||||
"mode" : "fetchall",
|
||||
"order" : 102,
|
||||
"text" : "Wallpaper Dir",
|
||||
"type" : "directory"
|
||||
},
|
||||
"schemecolor" :
|
||||
{
|
||||
"order" : 0,
|
||||
@ -12,13 +20,38 @@
|
||||
"type" : "color",
|
||||
"value" : "0.8980392156862745 0.18823529411764706 0.9294117647058824"
|
||||
},
|
||||
"dir" :
|
||||
"systemid" :
|
||||
{
|
||||
"index" : 2,
|
||||
"order": 102,
|
||||
"mode" : "fetchall",
|
||||
"text" : "Wallpaper Dir",
|
||||
"type" : "directory"
|
||||
"index" : 0,
|
||||
"order" : 100,
|
||||
"text" : "PluralKit System ID",
|
||||
"type" : "textinput",
|
||||
"value" : ""
|
||||
},
|
||||
"timeout_m" :
|
||||
{
|
||||
"fraction" : false,
|
||||
"index" : 4,
|
||||
"max" : 1440,
|
||||
"min" : 0,
|
||||
"order" : 104,
|
||||
"step" : 1,
|
||||
"text" : "Change Every (minutes)",
|
||||
"type" : "slider",
|
||||
"value" : 0
|
||||
},
|
||||
"timeout_s" :
|
||||
{
|
||||
"fraction" : true,
|
||||
"index" : 3,
|
||||
"max" : 60,
|
||||
"min" : 0.1,
|
||||
"order" : 103,
|
||||
"precision" : 2,
|
||||
"step" : 0.1,
|
||||
"text" : "Change Every (seconds)",
|
||||
"type" : "slider",
|
||||
"value" : 30
|
||||
},
|
||||
"uri" :
|
||||
{
|
||||
@ -27,18 +60,10 @@
|
||||
"text" : "Socket URI",
|
||||
"type" : "textinput",
|
||||
"value" : ""
|
||||
},
|
||||
"systemid" :
|
||||
{
|
||||
"index" : 0,
|
||||
"order" : 100,
|
||||
"text" : "System ID",
|
||||
"type" : "textinput",
|
||||
"value" : ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "PluralKit",
|
||||
"type" : "scene",
|
||||
"type" : "web",
|
||||
"version" : 0
|
||||
}
|
||||
|
45
scene.json
45
scene.json
@ -1,45 +0,0 @@
|
||||
{
|
||||
"camera" :
|
||||
{
|
||||
"center" : "0.00000 0.00000 -1.00000",
|
||||
"eye" : "0.00000 0.00000 0.00000",
|
||||
"up" : "0.00000 1.00000 0.00000"
|
||||
},
|
||||
"general" :
|
||||
{
|
||||
"ambientcolor" : "0.30000 0.30000 0.30000",
|
||||
"bloom" : false,
|
||||
"bloomhdrfeather" : 0.1,
|
||||
"bloomhdriterations" : 8,
|
||||
"bloomhdrscatter" : 1.619,
|
||||
"bloomhdrstrength" : 2.0,
|
||||
"bloomhdrthreshold" : 1.0,
|
||||
"bloomstrength" : 2.0,
|
||||
"bloomthreshold" : 0.64999998,
|
||||
"camerafade" : true,
|
||||
"cameraparallax" : false,
|
||||
"cameraparallaxamount" : 0.5,
|
||||
"cameraparallaxdelay" : 0.1,
|
||||
"cameraparallaxmouseinfluence" : 0.5,
|
||||
"camerapreview" : true,
|
||||
"camerashake" : false,
|
||||
"camerashakeamplitude" : 0.5,
|
||||
"camerashakeroughness" : 1.0,
|
||||
"camerashakespeed" : 3.0,
|
||||
"clearcolor" : "0.70000 0.70000 0.70000",
|
||||
"clearenabled" : true,
|
||||
"farz" : 10000.0,
|
||||
"fov" : 50.0,
|
||||
"hdr" : false,
|
||||
"nearz" : 0.0099999998,
|
||||
"orthogonalprojection" :
|
||||
{
|
||||
"height" : 2160,
|
||||
"width" : 3840
|
||||
},
|
||||
"skylightcolor" : "0.30000 0.30000 0.30000",
|
||||
"zoom" : 1.0
|
||||
},
|
||||
"objects" : [],
|
||||
"version" : 1
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
// TODO:
|
||||
// - Add image fading
|
||||
// - Add adjustable timing
|
||||
// + Add adjustable timing
|
||||
// - Add random timing option
|
||||
|
||||
|
||||
let socket
|
||||
let socketStatus = false
|
||||
let mimes = {}
|
||||
let timer
|
||||
|
||||
let jsonValid = (json) => {
|
||||
try {
|
||||
@ -81,7 +81,7 @@ let preloadImage = (url, callback) => {
|
||||
header += "image/" + extension
|
||||
}
|
||||
header += ";base64,"
|
||||
console.log(("%c" + header + imageData), "color: #A3BE8C; font-family: monospace; font-size: 8px;")
|
||||
// console.log(("%c" + header + imageData), "color: #A3BE8C; font-family: monospace; font-size: 8px;")
|
||||
callback(header + imageData)
|
||||
}
|
||||
}else {
|
||||
@ -108,7 +108,9 @@ let dumpStorage = () => {
|
||||
// console.log(' Token' + localStorage.getItem('token'))
|
||||
console.log(' System:' + localStorage.getItem('systemId'))
|
||||
console.log(' Socket:' + localStorage.getItem('socket'))
|
||||
console.log(' Wallpapers:' + localStorage.getItem('wallpapers'))
|
||||
console.log(' Slide Delay:' + localStorage.getItem('timeout_m') + "m " + localStorage.getItem('timeout_s') + "s")
|
||||
console.log(' Wallpapers:')
|
||||
console.log(("%c "+localStorage.getItem('wallpapers')), "color: #A3BE8C; font-family: monospace; font-size: 8px;")
|
||||
}
|
||||
|
||||
let grabLatestFronter = () => {
|
||||
@ -153,10 +155,21 @@ let pickWallpaper = () => {
|
||||
}
|
||||
urlExists(wallpaper, (exists) => {
|
||||
if (exists) {
|
||||
let delay_s = localStorage.getItem('timeout_s')
|
||||
if (delay_s == null) {
|
||||
delay_s = 30
|
||||
localStorage.setItem('timeout_s', delay_s)
|
||||
}
|
||||
let delay_m = localStorage.getItem('timeout_m')
|
||||
if (delay_m == null) {
|
||||
delay_m = 0
|
||||
localStorage.setItem('timeout_m', delay_m)
|
||||
}
|
||||
let delay = (parseFloat(delay_s) * 1000) + (parseInt(delay_m) * 60000)
|
||||
setWallpaper(wallpaper)
|
||||
setTimeout(() => {
|
||||
timer = setTimeout(() => {
|
||||
pickWallpaper()
|
||||
}, 30000)
|
||||
}, delay)
|
||||
} else {
|
||||
console.log(`%c${wallpaper} does not exist`, 'color: #BF616A; font-size: 18px; font-family: monospace;')
|
||||
// Remove wallpaper from list
|
||||
@ -190,13 +203,10 @@ let loadSocket = () => {
|
||||
// e.data contains member ID
|
||||
// console.dir(e)
|
||||
localStorage.setItem('member', e.data)
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
pickWallpaper()
|
||||
|
||||
// Copilot-generated Code
|
||||
// let data = JSON.parse(e.data)
|
||||
// if (data.type === 'wallpaper') {
|
||||
// setWallpaper(data.path)
|
||||
// }
|
||||
}
|
||||
socket.onclose = (e) => {
|
||||
console.log('%cSocket Closed', 'color: #BF616A; font-size: 18px; font-family: serif;')
|
||||
@ -212,29 +222,28 @@ let loadSocket = () => {
|
||||
}
|
||||
|
||||
window.wallpaperPropertyListener = {
|
||||
applyUserProperties: function(properties) {
|
||||
// Grab PKit token, System ID, and Socket URI
|
||||
// if (properties.token) {
|
||||
// // config.token = properties.token.value
|
||||
// localStorage.setItem('token', properties.token.value)
|
||||
// }
|
||||
applyUserProperties: async (properties) => {
|
||||
if (properties.timeout_s) {
|
||||
localStorage.setItem('timeout_s', properties.timeout_s.value)
|
||||
}
|
||||
if (properties.timeout_m) {
|
||||
localStorage.setItem('timeout_m', properties.timeout_m.value)
|
||||
}
|
||||
if (properties.systemid) {
|
||||
// config.systemId = properties.systemid.value
|
||||
localStorage.setItem('systemId', properties.systemid.value)
|
||||
}
|
||||
if (properties.uri) {
|
||||
// config.socket = properties.uri.value
|
||||
localStorage.setItem('socket', properties.uri.value)
|
||||
}
|
||||
dumpStorage()
|
||||
// Reload Socket
|
||||
if (socketStatus) {
|
||||
socketStatus = false
|
||||
socket.close()
|
||||
}
|
||||
loadSocket()
|
||||
}
|
||||
dumpStorage()
|
||||
},
|
||||
userDirectoryFilesAddedOrChanged: function(propertyName, changedFiles) {
|
||||
userDirectoryFilesAddedOrChanged: async (propertyName, changedFiles) => {
|
||||
// Do something with the list of added files here
|
||||
// console.dir(propertyName)
|
||||
console.dir(changedFiles) // Array of filepaths added
|
||||
|
Loading…
Reference in New Issue
Block a user