Last active
August 1, 2022 07:39
-
-
Save McbeEringi/37d413e6710c3c4e085068975b51c5a1 to your computer and use it in GitHub Desktop.
Scriptable.app sky:CotL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cfx=t=>{ | |
let s=[Math.floor((t.getTime()-new Date('2020/11/4 00:00').getTime())/864e5)%5]; | |
s[1]=Math.floor((t.getDate()-1)/5)%[3,3,2,3,2][s[0]]; | |
return s.join(''); | |
}, | |
ofx=t=>['Doom','Worker','Pizza','Vase','Cat','Space','Stroll'][(t.getDate()-1)%7]; | |
let t=new Date(); | |
const y=t.getFullYear(),dt=t.getTimezoneOffset()*6e4; | |
t=new Date(Date.now()+dt-8*36e5); | |
const dst=new Date(y,2,15-new Date(y,2,1).getDay(),2,0).getTime()<=t&&t<new Date(y,10,8-new Date(y,10,1).getDay(),2,0).getTime(); | |
if(dst)t=new Date(Date.now()+dt-7*36e5); | |
let w=new ListWidget();w.addSpacer(); | |
w.backgroundImage=(await new Request(`https://mcbeeringi.github.io/sky/img/tc/${cfx(t)}.webp`).loadImage()); | |
Object.assign(w.addText(`Office: ${ofx(t)}\n${dst?'PDT':'PST'}: ${t.toLocaleTimeString()}`),{font:new Font('',9),textColor:new Color('fff',1)}); | |
w.presentSmall();Script.setWidget(w);Script.complete(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment