TIMBOVILL commited on
Commit
98dfbc2
·
verified ·
1 Parent(s): 2738bcb

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +13 -2
script.js CHANGED
@@ -1,5 +1,6 @@
1
  let showSeconds = false;
2
  let showAmPm = true;
 
3
 
4
  function showTime() {
5
  const date = new Date();
@@ -33,7 +34,9 @@ function showTime() {
33
  clockDisplay.innerText = time;
34
  clockDisplay.textContent = time;
35
 
36
- adjustFontSize(clockDisplay);
 
 
37
 
38
  setTimeout(showTime, 1000);
39
  }
@@ -73,8 +76,16 @@ function toggleAmPm() {
73
  showAmPm = !showAmPm;
74
  }
75
 
 
 
 
 
 
 
76
  function adjustSpacing(value) {
77
  document.querySelector('.clock').style.letterSpacing = value + 'px';
78
  }
79
 
80
- showTime();
 
 
 
1
  let showSeconds = false;
2
  let showAmPm = true;
3
+ let autoSize = true;
4
 
5
  function showTime() {
6
  const date = new Date();
 
34
  clockDisplay.innerText = time;
35
  clockDisplay.textContent = time;
36
 
37
+ if (autoSize) {
38
+ adjustFontSize(clockDisplay);
39
+ }
40
 
41
  setTimeout(showTime, 1000);
42
  }
 
76
  showAmPm = !showAmPm;
77
  }
78
 
79
+ function toggleAutoSize() {
80
+ autoSize = !autoSize;
81
+ const sizeSlider = document.getElementById('sizeSlider');
82
+ sizeSlider.disabled = autoSize;
83
+ }
84
+
85
  function adjustSpacing(value) {
86
  document.querySelector('.clock').style.letterSpacing = value + 'px';
87
  }
88
 
89
+ function adjustSize(value) {
90
+ if (!autoSize) {
91
+ document.querySelector('.clock').