@@ -6,7 +6,7 @@ class AnalogClock extends HTMLElement {
66 } ;
77
88 if ( ! this . content ) {
9- console . info ( `%c ANALOG-CLOCK v3.0 ` , 'color: white; font-weight: bold; background: black' ) ;
9+ console . info ( `%c ANALOG-CLOCK v3.2 ` , 'color: white; font-weight: bold; background: black' ) ;
1010 var config = this . config ;
1111 const card = document . createElement ( 'ha-card' ) ;
1212 this . content = document . createElement ( 'div' ) ;
@@ -45,6 +45,34 @@ class AnalogClock extends HTMLElement {
4545 layerMinSecCtx . textBaseline = 'middle' ;
4646 layerMinSecCtx . translate ( canvas . width / 2 , canvas . height / 2 ) ;
4747
48+ var color_Background = getComputedStyle ( document . documentElement ) . getPropertyValue ( '--primary-background-color' ) ;
49+ var color_Ticks = 'Silver' ;
50+ var hide_MinorTicks = false ;
51+ var hide_MajorTicks = false ;
52+ var color_FaceDigits = 'Silver' ;
53+ var locale = hass . language ;
54+ var color_DigitalTime = 'red' ;
55+ var color_HourHand = '#CCCCCC' ;
56+ var color_MinuteHand = '#EEEEEE' ;
57+ var color_SecondHand = 'Silver' ;
58+ var color_Time = 'Silver' ;
59+ var color_Text = 'Silver' ;
60+ var timezone = Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone ;
61+ var timezonedisplayname = "" ;
62+ var showtimezone = false ;
63+ var hide_WeekNumber = true ;
64+ var hide_FaceDigits = false ;
65+ var hide_Date = false ;
66+ var hide_WeekDay = false ;
67+ var hide_DigitalTime = false ;
68+ var hide_SecondHand = false ;
69+ var style_HourHand = 1 ;
70+ var style_MinuteHand = 1 ;
71+ var style_SecondHand = 3 ;
72+ var dateMask = "" ;
73+ var timeFormat = "" ;
74+ var demo = false ;
75+
4876 var layerCachedForMinute = - 1 ;
4977 getConfig ( ) ;
5078
@@ -456,128 +484,101 @@ class AnalogClock extends HTMLElement {
456484 }
457485
458486 function getConfig ( ) {
459- globalThis . color_Background = getComputedStyle ( document . documentElement ) . getPropertyValue ( '--primary-background-color' ) ;
460487 if ( config . color_Background ) color_Background = config . color_Background ;
461488 if ( config . color_background ) color_Background = config . color_background ;
462489 if ( color_Background . startsWith ( '--' ) ) {
463490 color_Background = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_Background ) ;
464491 }
465492
466- globalThis . color_Ticks = 'Silver' ;
467493 if ( config . color_Ticks ) color_Ticks = config . color_Ticks ;
468494 if ( config . color_ticks ) color_Ticks = config . color_ticks ;
469495 if ( color_Ticks . startsWith ( '--' ) ) {
470496 color_Ticks = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_Ticks ) ;
471497 }
472498
473- globalThis . hide_MinorTicks = false ;
474499 if ( config . hide_minorticks == true ) hide_MinorTicks = config . hide_minorticks ;
475500
476- globalThis . hide_MajorTicks = false ;
477501 if ( config . hide_majorticks == true ) hide_MajorTicks = config . hide_majorticks ;
478502
479- globalThis . color_FaceDigits = 'Silver' ;
480503 if ( config . color_FaceDigits ) color_FaceDigits = config . color_FaceDigits ;
481504 if ( config . color_facedigits ) color_FaceDigits = config . color_facedigits ;
482505 if ( color_FaceDigits . startsWith ( '--' ) ) {
483506 color_FaceDigits = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_FaceDigits ) ;
484507 }
485508
486- globalThis . locale = hass . language ;
487509 if ( config . locale ) locale = config . locale ;
488510
489- globalThis . color_DigitalTime = 'red' ;
490511 if ( config . color_DigitalTime ) color_DigitalTime = config . color_DigitalTime ;
491512 if ( config . color_digitaltime ) color_DigitalTime = config . color_digitaltime ;
492513 if ( color_DigitalTime . startsWith ( '--' ) ) {
493514 color_DigitalTime = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_DigitalTime ) ;
494515 }
495516
496- globalThis . color_HourHand = '#CCCCCC' ;
497517 if ( config . color_HourHand ) color_HourHand = config . color_HourHand ;
498518 if ( config . color_hourhand ) color_HourHand = config . color_hourhand ;
499519 if ( color_HourHand . startsWith ( '--' ) ) {
500520 color_HourHand = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_HourHand ) ;
501521 }
502522
503- globalThis . color_MinuteHand = '#EEEEEE' ;
504523 if ( config . color_MinuteHand ) color_MinuteHand = config . color_MinuteHand ;
505524 if ( config . color_minutehand ) color_MinuteHand = config . color_minutehand ;
506525 if ( color_MinuteHand . startsWith ( '--' ) ) {
507526 color_MinuteHand = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_MinuteHand ) ;
508527 }
509528
510- globalThis . color_SecondHand = 'Silver' ;
511529 if ( config . color_SecondHand ) color_SecondHand = config . color_SecondHand ;
512530 if ( config . color_secondhand ) color_SecondHand = config . color_secondhand ;
513531 if ( color_SecondHand . startsWith ( '--' ) ) {
514532 color_SecondHand = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_SecondHand ) ;
515533 }
516534
517- globalThis . color_Time = 'Silver' ;
518535 if ( config . color_Time ) color_Time = config . color_Time ;
519536 if ( config . color_time ) color_Time = config . color_time ;
520537 if ( color_Time . startsWith ( '--' ) ) {
521538 color_Time = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_Time ) ;
522539 }
523540
524- globalThis . color_Text = 'Silver' ;
525541 if ( config . color_Text ) color_Text = config . color_Text ;
526542 if ( config . color_text ) color_Text = config . color_text ;
527543 if ( color_Text . startsWith ( '--' ) ) {
528544 color_Text = getComputedStyle ( document . documentElement ) . getPropertyValue ( color_Text ) ;
529545 }
530546
531- globalThis . timezone = Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone ;
532547 if ( config . timezone ) timezone = config . timezone ;
533548
534- globalThis . timezonedisplayname = "" ;
535549 if ( config . timezonedisplayname ) timezonedisplayname = config . timezonedisplayname ;
536550
537- globalThis . showtimezone = false ;
538551 if ( config . showtimezone == true ) showtimezone = true ;
539552 if ( config . show_timezone == true ) showtimezone = true ;
540553
541- globalThis . hide_WeekNumber = true ;
542554 if ( config . hide_WeekNumber == false ) hide_WeekNumber = false ;
543555 if ( config . hide_weeknumber == false ) hide_WeekNumber = false ;
544556
545- globalThis . hide_FaceDigits = false ;
546557 if ( config . hide_FaceDigits == true ) hide_FaceDigits = true ;
547558 if ( config . hide_facedigits == true ) hide_FaceDigits = true ;
548559
549- globalThis . hide_Date = false ;
550560 if ( config . hide_Date == true ) hide_Date = true ;
551561 if ( config . hide_date == true ) hide_Date = true ;
552562
553- globalThis . hide_WeekDay = false ;
554563 if ( config . hide_WeekDay == true ) hide_WeekDay = true ;
555564 if ( config . hide_weekday == true ) hide_WeekDay = true ;
556565
557- globalThis . hide_DigitalTime = false ;
558566 if ( config . hide_DigitalTime == true ) hide_DigitalTime = true ;
559567 if ( config . hide_digitaltime == true ) hide_DigitalTime = true ;
560568
561- globalThis . hide_SecondHand = false ;
562569 if ( config . hide_SecondHand == true ) hide_SecondHand = true ;
563570 if ( config . hide_secondhand == true ) hide_SecondHand = true ;
564571
565- globalThis . style_HourHand = 1 ;
566572 if ( config . style_hourhand ) style_HourHand = config . style_hourhand ;
567573
568- globalThis . style_MinuteHand = 1 ;
569574 if ( config . style_minutehand ) style_MinuteHand = config . style_minutehand ;
570575
571- globalThis . style_SecondHand = 3 ;
572576 if ( config . style_secondhand ) style_SecondHand = config . style_secondhand ;
573577
574- globalThis . dateMask = "" ;
575578 if ( config . dateformat ) dateMask = config . dateformat ;
576579
577- globalThis . timeFormat = "" ;
578580 if ( config . timeformat ) timeFormat = config . timeformat ;
579581
580- globalThis . demo = false ;
581582 if ( config . demo == true ) demo = true ;
582583
583584 var themes = config . themes ;
0 commit comments