1
0
Fork 0

Merge pull request #3568 from stweedo/boxclk

Update boxclk to v0.10
master
thyttan 2024-09-22 10:32:12 +02:00 committed by GitHub
commit c5fbfa4482
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 13 deletions

View File

@ -12,4 +12,5 @@
- [+] Fixed optional seconds not displaying in time
- [+] Fixed drag handler by adding E.stopEventPropagation()
- [+] General code optimization and cleanup
0.09: Revised event handler code
0.09: Revised event handler code
0.10: Revised suffix formatting in getDate function

View File

@ -208,12 +208,23 @@
// 7. String forming helper functions
let getDate = function(short, shortMonth, disableSuffix) {
const date = new Date();
const dayOfMonth = date.getDate();
const day = date.getDate();
const month = shortMonth ? locale.month(date, 1) : locale.month(date, 0);
const year = date.getFullYear();
let suffix = ["st", "nd", "rd"][(dayOfMonth - 1) % 10] || "th";
let dayOfMonthStr = disableSuffix ? dayOfMonth : `${dayOfMonth}${suffix}`;
return `${month} ${dayOfMonthStr}${short ? '' : `, ${year}`}`;
const getSuffix = (day) => {
if (day >= 11 && day <= 13) return 'th';
const lastDigit = day % 10;
switch (lastDigit) {
case 1: return 'st';
case 2: return 'nd';
case 3: return 'rd';
default: return 'th';
}
};
const dayStr = disableSuffix ? day : `${day}${getSuffix(day)}`;
return `${month} ${dayStr}${short ? '' : `, ${year}`}`; // not including year for short version
};
let getDayOfWeek = function(date, short) {

View File

@ -11,14 +11,14 @@
"xOffset": 3,
"yOffset": 0,
"boxPos": {
"x": "0.494",
"x": "0.5",
"y": "0.739"
}
},
"dow": {
"font": "6x8",
"fontSize": 3,
"outline": 1,
"outline": 2,
"color": "bgH",
"outlineColor": "fg",
"border": "#f0f",
@ -27,7 +27,7 @@
"xOffset": 2,
"yOffset": 0,
"boxPos": {
"x": "0.421",
"x": "0.5",
"y": "0.201"
},
"short": false
@ -35,7 +35,7 @@
"date": {
"font": "6x8",
"fontSize": 2,
"outline": 1,
"outline": 2,
"color": "bgH",
"outlineColor": "fg",
"border": "#f0f",
@ -44,7 +44,7 @@
"xOffset": 1,
"yOffset": 0,
"boxPos": {
"x": "0.454",
"x": "0.5",
"y": "0.074"
},
"shortMonth": false,
@ -62,7 +62,7 @@
"xOffset": 2,
"yOffset": 1,
"boxPos": {
"x": "0.494",
"x": "0.5",
"y": "0.926"
},
"prefix": "Steps: "
@ -79,7 +79,7 @@
"xOffset": 2,
"yOffset": 2,
"boxPos": {
"x": "0.805",
"x": "0.8",
"y": "0.427"
},
"suffix": "%"

View File

@ -1,7 +1,7 @@
{
"id": "boxclk",
"name": "Box Clock",
"version": "0.09",
"version": "0.10",
"description": "A customizable clock with configurable text boxes that can be positioned to show your favorite background",
"icon": "app.png",
"dependencies" : { "clockbg":"module" },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB