Skip to content

Commit 29894c7

Browse files
committed
added stacked date style
cleaned up clock style name fixed WE date conditions
1 parent 2f71d57 commit 29894c7

3 files changed

Lines changed: 84 additions & 49 deletions

File tree

SucroseProperties.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@
239239
"items": [
240240
"None",
241241
"Horizontal",
242-
"Vertical (2*2)",
243-
"Vertical (1*4)"
242+
"Stacked",
243+
"Vertical"
244244
]
245245
},
246246
"ui_clock_24hourformat": {
@@ -372,6 +372,16 @@
372372
"type": "checkbox",
373373
"value": false
374374
},
375+
"ui_date_style": {
376+
"text": "Style",
377+
"type": "dropdown",
378+
"value": 0,
379+
"items": [
380+
"Horizontal",
381+
"Stacked",
382+
"Vertical"
383+
]
384+
},
375385
"ui_date_delimiter": {
376386
"type": "dropdown",
377387
"text": "Date Delimiter",
@@ -384,11 +394,6 @@
384394
"/"
385395
]
386396
},
387-
"ui_date_orientation": {
388-
"text": "Vertical Orientation",
389-
"type": "checkbox",
390-
"value": false
391-
},
392397
"ui_date_scale": {
393398
"max": 10,
394399
"min": 0,

js/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ window.onload = function () {
6363
ui_day_positionX: 0,
6464
ui_day_positionY: 0,
6565
ui_date_date: "0",
66-
ui_date_orientation: false,
66+
ui_date_style: "0",
6767
ui_date_year: "2",
6868
ui_date_order: "0",
6969
ui_date_monthName: false,
@@ -202,7 +202,7 @@ window.onload = function () {
202202
dateFolder.add(options, "ui_date_monthName").name("Month Name").onChange(updateMask);
203203
dateFolder.add(options, "ui_date_allCaps").name("All CAPS").onChange(updateMask);
204204
dateFolder.add(options, "ui_date_delimiter", optionsToDict(config.general.properties.ui_date_delimiter.options)).name("Delimiter").onChange(updateMask);
205-
dateFolder.add(options, "ui_date_orientation").name("Vertical Orientation").onChange(updateMask);
205+
dateFolder.add(options, "ui_date_style", optionsToDict(config.general.properties.ui_date_style.options)).name("Style").onChange(updateMask);
206206
dateFolder.add(options, "ui_date_scale").min(0).max(10).step(1).name("Scale").onChange(updateMask);
207207
const datePositionFolder = dateFolder.addFolder("Position");
208208
datePositionFolder.add(options, "ui_date_positionX").min(-100).max(100).step(1).name("X").onChange(updateMask);
@@ -346,8 +346,8 @@ window.onload = function () {
346346
options.ui_date_date = properties.ui_date_date.value;
347347
updateTime();
348348
}
349-
if (properties.ui_date_orientation)
350-
options.ui_date_orientation = properties.ui_date_orientation.value;
349+
if (properties.ui_date_style)
350+
options.ui_date_style = properties.ui_date_style.value;
351351
if (properties.ui_date_year)
352352
options.ui_date_year = properties.ui_date_year.value;
353353
if (properties.ui_date_order)
@@ -364,7 +364,7 @@ window.onload = function () {
364364
options.ui_date_positionX = properties.ui_date_positionx.value;
365365
if (properties.ui_date_positiony)
366366
options.ui_date_positionY = properties.ui_date_positiony.value;
367-
if (properties.ui_date_date || properties.ui_date_orientation || properties.ui_date_year ||
367+
if (properties.ui_date_date || properties.ui_date_style || properties.ui_date_year ||
368368
properties.ui_date_order || properties.ui_date_monthname || properties.ui_date_allcaps ||
369369
properties.ui_date_delimiter || properties.ui_date_scale || properties.ui_date_positionx
370370
|| properties.ui_date_positiony)
@@ -541,8 +541,8 @@ window.onload = function () {
541541
updateTime();
542542
updateMask();
543543
break;
544-
case "ui_date_orientation":
545-
options.ui_date_orientation = val.value;
544+
case "ui_date_style":
545+
options.ui_date_style = val.value;
546546
updateMask();
547547
break;
548548
case "ui_date_year":
@@ -806,33 +806,48 @@ window.onload = function () {
806806
}
807807

808808
if (options.ui_date_date != "0") {
809-
var dateText = date.toString(), monthText, yearText = "", completeDate;
810-
if (dateText.length < 2)
811-
dateText = "0" + dateText;
809+
var text3 = date.toString(), text2, text1 = "", completeDate;
810+
if (text3.length < 2)
811+
text3 = "0" + text3;
812812
if (options.ui_date_monthName) {
813-
monthText = months[parseInt(options.ui_date_date) - 1][month - 1];
813+
text2 = months[parseInt(options.ui_date_date) - 1][month - 1];
814814
if (options.ui_date_allCaps)
815-
monthText = monthText.toUpperCase();
815+
text2 = text2.toUpperCase();
816816
} else {
817-
monthText = month.toString();
818-
if (monthText.length < 2)
819-
monthText = "0" + monthText;
817+
text2 = month.toString();
818+
if (text2.length < 2)
819+
text2 = "0" + text2;
820820
}
821821
switch (options.ui_date_year) {
822822
case "1": {
823-
yearText = year.toString().substring(2, 4);
823+
text1 = year.toString().substring(2, 4);
824824
break;
825825
}
826826
case "2": {
827-
yearText = year.toString();
827+
text1 = year.toString();
828828
break;
829829
}
830830
}
831831

832-
let delimiter = options.ui_date_orientation ? "" : dateDelimiters[parseInt(options.ui_date_delimiter)];
833-
completeDate = yearText + (yearText.length > 0 ? delimiter : "") + (options.ui_date_order == "0" ? monthText + delimiter + dateText : dateText + delimiter + monthText);
834-
if (options.ui_date_orientation)
835-
completeDate = completeDate.split("").join("\\n");
832+
if(options.ui_date_order == 1){
833+
let tmp = text2;
834+
text2 = text3;
835+
text3 = tmp;
836+
}
837+
838+
let delimiter = dateDelimiters[parseInt(options.ui_date_delimiter)];
839+
840+
switch (options.ui_date_style) {
841+
case "0":
842+
completeDate = (text1.length > 0 ? [text1, text2, text3] : [text2, text3]).join(delimiter);
843+
break;
844+
case "1":
845+
completeDate = (text1.length > 0 ? [text1, text2, text3] : [text2, text3]).join("\\n");
846+
break;
847+
case "2":
848+
completeDate = (text1 + text2 + text3).split("").join("\\n");
849+
break;
850+
}
836851

837852
if (options.ui_date_scale > 0) {
838853
let bb = getTextBoundingBox(completeDate, options.ui_date_scale);

project.json

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@
502502
"value" : "1"
503503
},
504504
{
505-
"label" : "Vertical (2*2)",
505+
"label" : "Stacked",
506506
"value" : "2"
507507
},
508508
{
509-
"label" : "Vertical (1*4)",
509+
"label" : "Vertical",
510510
"value" : "3"
511511
}
512512
],
@@ -692,7 +692,7 @@
692692
},
693693
"ui_date_year" :
694694
{
695-
"condition" : "ui_date_date.value",
695+
"condition" : "ui_date_date.value != 0",
696696
"index" : 45,
697697
"options" :
698698
[
@@ -716,7 +716,7 @@
716716
},
717717
"ui_date_order" :
718718
{
719-
"condition" : "ui_date_date.value",
719+
"condition" : "ui_date_date.value != 0",
720720
"index" : 46,
721721
"options" :
722722
[
@@ -735,25 +735,49 @@
735735
"value" : "0"
736736
},
737737
"ui_date_monthname" : {
738-
"condition" : "ui_date_date.value",
738+
"condition" : "ui_date_date.value != 0",
739739
"index" : 47,
740740
"order" : 147,
741741
"text" : "Month Name",
742742
"type" : "bool",
743743
"value": false
744744
},
745745
"ui_date_allcaps" : {
746-
"condition" : "ui_date_date.value",
746+
"condition" : "ui_date_date.value != 0",
747747
"index" : 48,
748748
"order" : 148,
749749
"text" : "All CAPS",
750750
"type" : "bool",
751751
"value": false
752752
},
753-
"ui_date_delimiter" :
753+
"ui_date_style" :
754754
{
755+
"condition" : "ui_date_date.value != 0",
755756
"index" : 49,
756-
"condition" : "ui_date_date.value && !ui_date_orientation.value",
757+
"order" : 149,
758+
"options" :
759+
[
760+
{
761+
"label" : "Horizontal",
762+
"value" : "0"
763+
},
764+
{
765+
"label" : "Stacked",
766+
"value" : "1"
767+
},
768+
{
769+
"label" : "Vertical",
770+
"value" : "2"
771+
}
772+
],
773+
"text" : "Style",
774+
"type" : "combo",
775+
"value" : "0"
776+
},
777+
"ui_date_delimiter" :
778+
{
779+
"index" : 50,
780+
"condition" : "ui_date_date.value != 0 && ui_date_orientation.value == 0",
757781
"options" :
758782
[
759783
{
@@ -777,23 +801,14 @@
777801
"value" : "4"
778802
}
779803
],
780-
"order" : 149,
804+
"order" : 150,
781805
"text" : "Date Delimiter",
782806
"type" : "combo",
783807
"value" : "0"
784808
},
785-
"ui_date_orientation" :
786-
{
787-
"condition" : "ui_date_date.value",
788-
"index" : 50,
789-
"order" : 150,
790-
"text" : "Vertical Orientation",
791-
"type" : "bool",
792-
"value" : false
793-
},
794809
"ui_date_scale" :
795810
{
796-
"condition" : "ui_date_date.value",
811+
"condition" : "ui_date_date.value != 0",
797812
"fraction" : false,
798813
"index" : 51,
799814
"max" : 10,
@@ -805,7 +820,7 @@
805820
},
806821
"ui_date_positionx" :
807822
{
808-
"condition" : "ui_date_date.value",
823+
"condition" : "ui_date_date.value != 0",
809824
"fraction" : false,
810825
"index" : 52,
811826
"max" : 100,
@@ -817,7 +832,7 @@
817832
},
818833
"ui_date_positiony" :
819834
{
820-
"condition" : "ui_date_date.value",
835+
"condition" : "ui_date_date.value != 0",
821836
"fraction" : false,
822837
"index" : 53,
823838
"max" : 100,

0 commit comments

Comments
 (0)