Adjustable slideshow delay
This commit is contained in:
parent
701172c982
commit
bea8c7c44b
57
project.json
57
project.json
@ -1,10 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"description" : "Storage limit: 10240 images because of windows max path and locastorage limits",
|
||||||
"file" : "scene.html",
|
"file" : "scene.html",
|
||||||
"description": "Storage limit: 10240 images because of windows max path and locastorage limits",
|
|
||||||
"general" :
|
"general" :
|
||||||
{
|
{
|
||||||
"properties" :
|
"properties" :
|
||||||
{
|
{
|
||||||
|
"dir" :
|
||||||
|
{
|
||||||
|
"index" : 2,
|
||||||
|
"mode" : "fetchall",
|
||||||
|
"order" : 102,
|
||||||
|
"text" : "Wallpaper Dir",
|
||||||
|
"type" : "directory"
|
||||||
|
},
|
||||||
"schemecolor" :
|
"schemecolor" :
|
||||||
{
|
{
|
||||||
"order" : 0,
|
"order" : 0,
|
||||||
@ -12,13 +20,38 @@
|
|||||||
"type" : "color",
|
"type" : "color",
|
||||||
"value" : "0.8980392156862745 0.18823529411764706 0.9294117647058824"
|
"value" : "0.8980392156862745 0.18823529411764706 0.9294117647058824"
|
||||||
},
|
},
|
||||||
"dir" :
|
"systemid" :
|
||||||
{
|
{
|
||||||
"index" : 2,
|
"index" : 0,
|
||||||
"order": 102,
|
"order" : 100,
|
||||||
"mode" : "fetchall",
|
"text" : "PluralKit System ID",
|
||||||
"text" : "Wallpaper Dir",
|
"type" : "textinput",
|
||||||
"type" : "directory"
|
"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" :
|
"uri" :
|
||||||
{
|
{
|
||||||
@ -27,18 +60,10 @@
|
|||||||
"text" : "Socket URI",
|
"text" : "Socket URI",
|
||||||
"type" : "textinput",
|
"type" : "textinput",
|
||||||
"value" : ""
|
"value" : ""
|
||||||
},
|
|
||||||
"systemid" :
|
|
||||||
{
|
|
||||||
"index" : 0,
|
|
||||||
"order" : 100,
|
|
||||||
"text" : "System ID",
|
|
||||||
"type" : "textinput",
|
|
||||||
"value" : ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"title" : "PluralKit",
|
"title" : "PluralKit",
|
||||||
"type" : "scene",
|
"type" : "web",
|
||||||
"version" : 0
|
"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:
|
// TODO:
|
||||||
// - Add image fading
|
// + Add adjustable timing
|
||||||
// - Add adjustable timing
|
|
||||||
// - Add random timing option
|
// - Add random timing option
|
||||||
|
|
||||||
|
|
||||||
let socket
|
let socket
|
||||||
let socketStatus = false
|
let socketStatus = false
|
||||||
let mimes = {}
|
let mimes = {}
|
||||||
|
let timer
|
||||||
|
|
||||||
let jsonValid = (json) => {
|
let jsonValid = (json) => {
|
||||||
try {
|
try {
|
||||||
@ -81,7 +81,7 @@ let preloadImage = (url, callback) => {
|
|||||||
header += "image/" + extension
|
header += "image/" + extension
|
||||||
}
|
}
|
||||||
header += ";base64,"
|
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)
|
callback(header + imageData)
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@ -108,7 +108,9 @@ let dumpStorage = () => {
|
|||||||
// console.log(' Token' + localStorage.getItem('token'))
|
// console.log(' Token' + localStorage.getItem('token'))
|
||||||
console.log(' System:' + localStorage.getItem('systemId'))
|
console.log(' System:' + localStorage.getItem('systemId'))
|
||||||
console.log(' Socket:' + localStorage.getItem('socket'))
|
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 = () => {
|
let grabLatestFronter = () => {
|
||||||
@ -153,10 +155,21 @@ let pickWallpaper = () => {
|
|||||||
}
|
}
|
||||||
urlExists(wallpaper, (exists) => {
|
urlExists(wallpaper, (exists) => {
|
||||||
if (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)
|
setWallpaper(wallpaper)
|
||||||
setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
pickWallpaper()
|
pickWallpaper()
|
||||||
}, 30000)
|
}, delay)
|
||||||
} else {
|
} else {
|
||||||
console.log(`%c${wallpaper} does not exist`, 'color: #BF616A; font-size: 18px; font-family: monospace;')
|
console.log(`%c${wallpaper} does not exist`, 'color: #BF616A; font-size: 18px; font-family: monospace;')
|
||||||
// Remove wallpaper from list
|
// Remove wallpaper from list
|
||||||
@ -190,13 +203,10 @@ let loadSocket = () => {
|
|||||||
// e.data contains member ID
|
// e.data contains member ID
|
||||||
// console.dir(e)
|
// console.dir(e)
|
||||||
localStorage.setItem('member', e.data)
|
localStorage.setItem('member', e.data)
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer)
|
||||||
|
}
|
||||||
pickWallpaper()
|
pickWallpaper()
|
||||||
|
|
||||||
// Copilot-generated Code
|
|
||||||
// let data = JSON.parse(e.data)
|
|
||||||
// if (data.type === 'wallpaper') {
|
|
||||||
// setWallpaper(data.path)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
socket.onclose = (e) => {
|
socket.onclose = (e) => {
|
||||||
console.log('%cSocket Closed', 'color: #BF616A; font-size: 18px; font-family: serif;')
|
console.log('%cSocket Closed', 'color: #BF616A; font-size: 18px; font-family: serif;')
|
||||||
@ -212,29 +222,28 @@ let loadSocket = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.wallpaperPropertyListener = {
|
window.wallpaperPropertyListener = {
|
||||||
applyUserProperties: function(properties) {
|
applyUserProperties: async (properties) => {
|
||||||
// Grab PKit token, System ID, and Socket URI
|
if (properties.timeout_s) {
|
||||||
// if (properties.token) {
|
localStorage.setItem('timeout_s', properties.timeout_s.value)
|
||||||
// // config.token = properties.token.value
|
}
|
||||||
// localStorage.setItem('token', properties.token.value)
|
if (properties.timeout_m) {
|
||||||
// }
|
localStorage.setItem('timeout_m', properties.timeout_m.value)
|
||||||
|
}
|
||||||
if (properties.systemid) {
|
if (properties.systemid) {
|
||||||
// config.systemId = properties.systemid.value
|
|
||||||
localStorage.setItem('systemId', properties.systemid.value)
|
localStorage.setItem('systemId', properties.systemid.value)
|
||||||
}
|
}
|
||||||
if (properties.uri) {
|
if (properties.uri) {
|
||||||
// config.socket = properties.uri.value
|
|
||||||
localStorage.setItem('socket', properties.uri.value)
|
localStorage.setItem('socket', properties.uri.value)
|
||||||
|
// Reload Socket
|
||||||
|
if (socketStatus) {
|
||||||
|
socketStatus = false
|
||||||
|
socket.close()
|
||||||
|
}
|
||||||
|
loadSocket()
|
||||||
}
|
}
|
||||||
dumpStorage()
|
dumpStorage()
|
||||||
// Reload Socket
|
|
||||||
if (socketStatus) {
|
|
||||||
socketStatus = false
|
|
||||||
socket.close()
|
|
||||||
}
|
|
||||||
loadSocket()
|
|
||||||
},
|
},
|
||||||
userDirectoryFilesAddedOrChanged: function(propertyName, changedFiles) {
|
userDirectoryFilesAddedOrChanged: async (propertyName, changedFiles) => {
|
||||||
// Do something with the list of added files here
|
// Do something with the list of added files here
|
||||||
// console.dir(propertyName)
|
// console.dir(propertyName)
|
||||||
console.dir(changedFiles) // Array of filepaths added
|
console.dir(changedFiles) // Array of filepaths added
|
||||||
|
Loading…
Reference in New Issue
Block a user