Browse Source

Added time and date

sisyphus
JezerM 4 years ago
parent
commit
2c5beb4d7a
No known key found for this signature in database
GPG Key ID: 66BBC5D01388C6B5
  1. 13
      themes/gruvbox/css/style.css
  2. 7
      themes/gruvbox/index.html
  3. 22
      themes/gruvbox/js/debug.js
  4. 12
      themes/gruvbox/js/index.js
  5. 26
      themes/gruvbox/js/time-date.js

13
themes/gruvbox/css/style.css vendored

@ -253,6 +253,19 @@ input:focus, input:focus-visible {
font-weight: bold; font-weight: bold;
} }
#time-date {
top: 0;
font-weight: bold;
font-size: calc(1em + 2px);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#time-date span {
display: block;
}
.label-bar { .label-bar {
position: absolute; position: absolute;
display: flex; display: flex;

7
themes/gruvbox/index.html vendored

@ -9,7 +9,7 @@
<script src="../_vendor/js/mock.js"></script> <script src="../_vendor/js/mock.js"></script>
<title>Gruvbox greeter</title> <title>Gruvbox theme</title>
</head> </head>
<body> <body>
<div id="background"></div> <div id="background"></div>
@ -67,6 +67,10 @@
<div id="lock-label" class="info hide"> <div id="lock-label" class="info hide">
Lock Lock
</div> </div>
<div id="time-date" class="info">
<span id="time-label">20:00</span>
<span id="date-label">12-07-21</span>
</div>
<div id="system-status" class="label-bar"> <div id="system-status" class="label-bar">
<div id="brightness-label"></div> <div id="brightness-label"></div>
@ -92,6 +96,7 @@
<script src="js/authenticate.js"></script> <script src="js/authenticate.js"></script>
<script src="js/accounts.js"></script> <script src="js/accounts.js"></script>
<script src="js/sessions.js"></script> <script src="js/sessions.js"></script>
<script src="js/time-date.js"></script>
<script src="js/power.js"></script> <script src="js/power.js"></script>
<script src="js/battery.js"></script> <script src="js/battery.js"></script>
<script src="js/brightness.js"></script> <script src="js/brightness.js"></script>

22
themes/gruvbox/js/debug.js vendored

@ -7,15 +7,23 @@ class Debug {
_init() { _init() {
console.log("DEBUG") console.log("DEBUG")
window.theme_utils = {} if (!window.theme_utils) {
window.theme_utils.dirlist = function(path) { window.theme_utils = {}
return false window.theme_utils.dirlist = function(path, mode, callback) {
callback([])
}
window.theme_utils.bind_this = function(context) {return context}
} }
window.greeter_config = { if (!window.greeter_config) {
greeter: { window.greeter_config = {
debug_mode: true, greeter: {
} debug_mode: true,
},
branding: {
background_images_dir: "",
}
}
} }
if (!window.lightdm) { if (!window.lightdm) {

12
themes/gruvbox/js/index.js vendored

@ -34,6 +34,8 @@ async function initGreeter() {
authenticate = new Authenticate() authenticate = new Authenticate()
time_date = new TimeDate()
power = new Power() power = new Power()
battery = new Battery() battery = new Battery()
@ -48,9 +50,9 @@ async function initGreeter() {
const notGreeter = false const notGreeter = false
if (notGreeter) { if (window._ready_event === undefined) {
debug = new Debug() _ready_event = new Event("GreeterReady")
initGreeter() window.dispatchEvent(_ready_event)
} else {
window.addEventListener("GreeterReady", initGreeter)
} }
window.addEventListener("GreeterReady", initGreeter)

26
themes/gruvbox/js/time-date.js vendored

@ -0,0 +1,26 @@
class TimeDate {
constructor() {
this._timeLabel = document.querySelector("#time-date #time-label")
this._dateLabel = document.querySelector("#time-date #date-label")
this._init()
}
_updateTimeDate() {
let date = theme_utils.get_current_localized_date()
let time = theme_utils.get_current_localized_time()
this._dateLabel.innerText = date
this._timeLabel.innerText = time
}
_setTimer() {
this._updateTimeDate()
setInterval(() => {
this._updateTimeDate()
}, 1000)
}
_init() {
this._setTimer()
}
}
Loading…
Cancel
Save