Update script.js
Browse files
script.js
CHANGED
|
@@ -70,16 +70,21 @@ function changeFont(font) {
|
|
| 70 |
|
| 71 |
function toggleSeconds() {
|
| 72 |
showSeconds = !showSeconds;
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
function toggleAmPm() {
|
| 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) {
|
|
@@ -88,4 +93,31 @@ function adjustSpacing(value) {
|
|
| 88 |
|
| 89 |
function adjustSize(value) {
|
| 90 |
if (!autoSize) {
|
| 91 |
-
document.querySelector('.clock').
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
function toggleSeconds() {
|
| 72 |
showSeconds = !showSeconds;
|
| 73 |
+
showTime();
|
| 74 |
}
|
| 75 |
|
| 76 |
function toggleAmPm() {
|
| 77 |
showAmPm = !showAmPm;
|
| 78 |
+
showTime();
|
| 79 |
}
|
| 80 |
|
| 81 |
function toggleAutoSize() {
|
| 82 |
autoSize = !autoSize;
|
| 83 |
const sizeSlider = document.getElementById('sizeSlider');
|
| 84 |
sizeSlider.disabled = autoSize;
|
| 85 |
+
if (autoSize) {
|
| 86 |
+
showTime();
|
| 87 |
+
}
|
| 88 |
}
|
| 89 |
|
| 90 |
function adjustSpacing(value) {
|
|
|
|
| 93 |
|
| 94 |
function adjustSize(value) {
|
| 95 |
if (!autoSize) {
|
| 96 |
+
document.querySelector('.clock').style.fontSize = value + 'px';
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
function changeBackground(background) {
|
| 101 |
+
document.body.style.background = background;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
function resetDefaults() {
|
| 105 |
+
showSeconds = false;
|
| 106 |
+
showAmPm = true;
|
| 107 |
+
autoSize = true;
|
| 108 |
+
document.getElementById('toggleSeconds').checked = false;
|
| 109 |
+
document.getElementById('toggleAmPm').checked = true;
|
| 110 |
+
document.getElementById('toggleAutoSize').checked = true;
|
| 111 |
+
document.getElementById('spacingSlider').value = 7;
|
| 112 |
+
document.getElementById('sizeSlider').value = 180;
|
| 113 |
+
document.querySelector('.clock').style.color = '#73b66f';
|
| 114 |
+
document.querySelector('.clock').style.fontFamily = 'Stencil';
|
| 115 |
+
document.querySelector('.clock').style.letterSpacing = '7px';
|
| 116 |
+
document.querySelector('.clock').style.fontSize = '180px';
|
| 117 |
+
document.body.style.background = 'black';
|
| 118 |
+
showTime();
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
document.addEventListener('DOMContentLoaded', (event) => {
|
| 122 |
+
showTime();
|
| 123 |
+
});
|