Initial commit
This commit is contained in:
commit
744e2063ae
22 changed files with 666 additions and 0 deletions
24
js/class/data.js
Normal file
24
js/class/data.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const ANIMUS_DATA = "animusData";
|
||||
|
||||
class Data {
|
||||
constructor() {
|
||||
this.theme = "melanosis";
|
||||
}
|
||||
|
||||
load() {
|
||||
const data = window.localStorage.getItem(ANIMUS_DATA);
|
||||
if(!data) return;
|
||||
const obj = JSON.parse(data);
|
||||
|
||||
this.theme = obj.theme ?? "melanosis";
|
||||
}
|
||||
|
||||
save() {
|
||||
const data = JSON.stringify(this);
|
||||
window.localStorage.setItem(ANIMUS_DATA, data);
|
||||
}
|
||||
}
|
||||
|
||||
const themeData = new Data();
|
||||
themeData.load();
|
||||
themeData.save();
|
1
js/class/util.js
Normal file
1
js/class/util.js
Normal file
|
@ -0,0 +1 @@
|
|||
function $(c) { return document.querySelector(c); }
|
14
js/clock.js
Normal file
14
js/clock.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
function updateTime() {
|
||||
const now = new Date(),
|
||||
hours = now.getHours(),
|
||||
minutes = now.getMinutes(),
|
||||
day = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][now.getDay()],
|
||||
date = now.getDate(),
|
||||
month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][now.getMonth()],
|
||||
year = now.getFullYear();
|
||||
|
||||
$("#time-label").textContent = ((hours < 10 ? "0" : "") + hours) + ":" + ((minutes < 10 ? "0" : "") + minutes);
|
||||
$("#date-label").textContent = day + " " + date + ", " + month + " " + year;
|
||||
}
|
||||
|
||||
setInterval(updateTime, 500);
|
3
js/hostname.js
Normal file
3
js/hostname.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
function setHostname() {
|
||||
$("#hostname-label").textContent = lightdm.hostname;
|
||||
}
|
23
js/idle-hide.js
Normal file
23
js/idle-hide.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
let hideInterval = 1;
|
||||
|
||||
setInterval(() => {
|
||||
if(hideInterval > 8){
|
||||
document.querySelectorAll(".hideable").forEach(el => {
|
||||
el.classList.add("hidden")
|
||||
});
|
||||
hideInterval = 1;
|
||||
return;
|
||||
}
|
||||
hideInterval += 1;
|
||||
}, 1000);
|
||||
|
||||
function showHiddenElements() {
|
||||
document.querySelectorAll(".hideable").forEach(el => {
|
||||
el.classList.remove("hidden")
|
||||
});
|
||||
hideInterval = 1;
|
||||
}
|
||||
|
||||
document.body.onclick = showHiddenElements;
|
||||
document.body.onmousemove = showHiddenElements;
|
||||
document.body.onkeydown = showHiddenElements;
|
11
js/index.js
Normal file
11
js/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
async function initGreeter(){
|
||||
if (window.greeter_config?.greeter.debug_mode){
|
||||
// debug
|
||||
}
|
||||
setHostname();
|
||||
connectPowerActions();
|
||||
}
|
||||
|
||||
window.addEventListener("GreeterReady", () => {
|
||||
initGreeter();
|
||||
});
|
4
js/power-actions.js
Normal file
4
js/power-actions.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
function connectPowerActions() {
|
||||
$("#poweroff-button").onclick = () => { lightdm.shutdown(); }
|
||||
$("#restart-button").onclick = () => { lightdm.restart(); }
|
||||
}
|
7
js/theme.js
Normal file
7
js/theme.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
function changeTheme(name) {
|
||||
themeData.theme = name;
|
||||
themeData.save();
|
||||
$("#theme-stylesheet").href = "css/themes/" + name + ".css"
|
||||
}
|
||||
|
||||
changeTheme(themeData.theme);
|
Loading…
Add table
Add a link
Reference in a new issue