-
Notifications
You must be signed in to change notification settings - Fork 1
/
other.js
131 lines (115 loc) · 4.33 KB
/
other.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
const lionTigerBlockTitle = document.querySelector('.lion-tiger-block-title');
// Initial values
document.querySelector('.schedule-title').value = UserSettings.title;
document.querySelector('.use24h').checked = UserSettings.use24h;
document.querySelector('.north').checked = UserSettings.north;
lionTigerBlockTitle.innerHTML = UserSettings.north ? 'Tiger' : 'Lion';
document.querySelector('.useColors').checked = !UserSettings.useColors;
document.querySelector('.showTimes').checked = UserSettings.showTimes;
document.querySelector('.showNumbers').checked = UserSettings.showNumbers;
document.querySelector('.invert').checked = UserSettings.invert;
document.querySelector('.affirmation').value = UserSettings.affirmation;
document.querySelector('#size-format').value = SelectedSize;
document.querySelector('.schedule-title').addEventListener('input', () => {
UserSettings.title = document.querySelector('.schedule-title').value;
draw();
saveData();
});
document.querySelector('.use24h').addEventListener('change', () => {
UserSettings.use24h = document.querySelector('.use24h').checked;
updateClock();
draw();
saveData();
});
document.querySelector('.north').addEventListener('change', () => {
UserSettings.north = document.querySelector('.north').checked;
UserSettings.title = UserSettings.north ? 'NNHS Schedule' : 'NSHS Schedule';
document.querySelector('.schedule-title').value = UserSettings.title;
lionTigerBlockTitle.innerHTML = UserSettings.north ? 'Tiger' : 'Lion';
draw();
saveData();
});
document.querySelector('.useColors').addEventListener('change', () => {
UserSettings.useColors = !document.querySelector('.useColors').checked;
draw();
saveData();
});
document.querySelector('.showTimes').addEventListener('change', () => {
UserSettings.showTimes = document.querySelector('.showTimes').checked;
draw();
saveData();
});
document.querySelector('.showNumbers').addEventListener('change', () => {
UserSettings.showNumbers = document.querySelector('.showNumbers').checked;
draw();
saveData();
});
document.querySelector('.invert').addEventListener('change', () => {
UserSettings.invert = document.querySelector('.invert').checked;
draw();
saveData();
});
document.querySelector('.affirmation').addEventListener('input', () => {
UserSettings.affirmation = document.querySelector('.affirmation').value;
draw();
saveData();
});
document.querySelector('#size-format').addEventListener('input', () => {
SelectedSize = document.querySelector('#size-format').value;
draw();
});
// Buttons
document.querySelector('.save-button').addEventListener('click', () => {
saveBase64(canvasToBase64(), 'schedule.png');
});
document.querySelector('.print-button').addEventListener('click', () => {
printBase64(canvasToBase64());
});
document.querySelector('.mobile-save-button').addEventListener('click', () => {
shareCanvas('schedule.png');
});
document.querySelector('#clear-data').addEventListener('click', () => {
if (confirm('Are you sure you want to clear your data?')) {
resetData();
location.reload();
}
});
const affirmations = [
"You're doing amazing, have a great day!",
"You're doing great today!",
"You've got this!",
'Have a great day!',
"You're going to do great today!",
'This is your moment!',
'The sky is the limit!',
'You are unique and wonderful.',
'Make today your day!',
'Be yourself!',
'You are valid.',
'Every day is an opportunity!',
'You are amazing!',
'Follow your feelings.',
'Love yourself.',
'Make today go how you want it.',
'Have an amazing day!',
'You are awesome!',
'You are unstoppable!',
'Today is your day!',
"You're wonderful!",
"Show everyone what you're made of!",
'You are loved.',
'Take care of yourself.',
'Take care of yourself today.',
'You deserve the best.',
];
document.querySelector('.new-affirmation').addEventListener('click', () => {
UserSettings.affirmation =
affirmations[Math.floor(Math.random() * affirmations.length)];
document.querySelector('.affirmation').value = UserSettings.affirmation;
draw();
saveData();
});
if (isMobile()) {
document.querySelector('.mobile-share-buttons').style.display = 'block';
document.querySelector('.desktop-share-buttons').style.display = 'none';
}