-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
345 lines (339 loc) · 16.3 KB
/
index.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="LCHS Go - Bell Schedule App">
<link rel="apple-touch-icon" href="/faviconAppIcon.png">
<meta name="theme-color" content="#333">
<script src="https://unpkg.com/petite-vue" defer></script>
<!-- <script src="https://unpkg.com/moment@2.29.1/moment.js"></script> -->
<script src="https://unpkg.com/dayjs@1.10.8/dayjs.min.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/isBetween.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/advancedFormat.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/customParseFormat.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/localeData.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/utc.js"></script>
<script src="https://unpkg.com/dayjs@1.10.8/plugin/timezone.js"></script>
<script>
dayjs.extend(window.dayjs_plugin_isBetween);
dayjs.extend(window.dayjs_plugin_advancedFormat);
dayjs.extend(window.dayjs_plugin_customParseFormat);
dayjs.extend(window.dayjs_plugin_localeData);
dayjs.extend(window.dayjs_plugin_utc);
dayjs.extend(window.dayjs_plugin_timezone);
</script>
<script type="module" src="scheduleFormatting.js"></script>
<script type="module" src="script.js"></script>
<link rel="stylesheet" href="styles.css" />
<link rel="manifest" href="/manifest.json">
<link href="https://fonts.googleapis.com/css?family=Niramit:300,regular,500,600" rel="stylesheet" />
<title>LCHS Go</title>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-18JESF2TEP"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-18JESF2TEP');
</script>
<body class="body" id="body" v-scope v-effect="startTimer()">
<!-- Background - Used to do the color -->
<div class="background" id="background" v-bind:class="{ 'animated': settings.themeAnimation }"></div>
<div class="app-container">
<div class="header">
<!-- Navigation - Holds the page buttons -->
<div class="navigation">
<button @click="switchPage('now')" class="nav-button" v-bind:class="{'selected': currentPage == 'now'}">
{{ translate("NOW") }}
</button>
<button @click="switchPage('calendar')" class="nav-button"
v-bind:class="{'selected': currentPage == 'calendar'}">
{{ translate("CALENDAR") }}
</button>
<button @click="switchPage('settings')" class="nav-button"
v-bind:class="{'selected': currentPage == 'settings'}">
{{ translate("SETTINGS") }}
</button>
</div>
</div>
<!-- Now Page - Has the period list and the times -->
<div id="now-page" v-if="currentPage == 'now' && updatePage">
<div class="todays-schedule" v-effect="$el.textContent = todaysGreeting">
Hello. Things are broken.
</div>
<div class="schedule-container">
<div class="period-information" v-scope="PeriodInformationComponent()"></div>
<div class="all-periods" v-scope="periodListComponent">
<div style="margin-bottom: 30px;" class="period-details-small" v-scope="PeriodInformationComponent()"
v-if="!settings.inlinePeriodDetails"></div>
</div>
</div>
<div class="todays-events" v-scope="{ 'eventD': getEvent(dayjs()) }">
<div class="cd-tag" style="padding: 10px;" v-if="eventD != undefined">
{{ eventD }}
</div>
</div>
</div>
<!-- Calendar Page - Calendar pulled from the events.json -->
<div id="calendar-page" v-if="currentPage == 'calendar'">
<div class="calendar-title" v-if="popupDate == null">
<div class="month-select-left"
@click="monthOffset--; calendarToggle=false; setTimeout( () => { calendarToggle = true; }, 10);" tabindex="0">
⇦</div>
<div class="calendar-month"
v-effect="$el.textContent = getMonthText(dayjs().month() + monthOffset) + ' ' + Math.floor((dayjs().year() + (dayjs().month() + monthOffset) / 12))">
{{ translate("CALENDAR_TITLE")}}
</div>
<div class="month-select-right"
@click="monthOffset++; calendarToggle = false; setTimeout( () => { calendarToggle = true; }, 10)"
tabindex="0">⇨</div>
</div>
<div class="calendar-container" v-if="calendarToggle">
<button class="calendar-day-wrap" v-for="day in 35" v-scope="CalendarDay(day, monthOffset)"
@click="if (popupDate == null) {popupDate = date;} else {popupDate = null;}">
<div class="calendar-day" v-if="popupDate == null"
v-bind:class="{ 'today': date.date() == dayjs().date() && date.month() == dayjs().month() && date.year() == dayjs().year(), 'outside': date.month() !== mod(dayjs().month() + monthOffset,12) }">
<div class="cd-number">
{{ date.date() }}
</div>
<div class="cd-tag">
{{ translate(schedule.scheduleType) }}
</div>
<div class="cd-tag" v-if="event != null">
{{ event }}
</div>
</div>
<div class="schedule-popup" v-if="popupDate == date" style="opacity: 200%;">
<div class="cd-tag" v-if="event != null" style="margin-bottom: 10px; padding: 10px;">
{{ event }}
</div>
<div v-scope="PeriodListComponent(schedule, true)"></div>
<div class="credits">
<a href="https://forms.gle/BgFW4MgL9RGpezdw7" class="credits" target="_blank">Submit a missing event</a>
</div>
</div>
</button>
</div>
</div>
<!-- Settings Page - All of the user settings generated from settings.js -->
<div id="settings-page" v-if="currentPage == 'settings'">
<div class="todays-schedule">
{{ translate("SETTINGS_TITLE") }}
</div>
<div class="settings-row" v-for="setting in settingsMenu">
<div class="sr-head">
<div class="sr-badge-group">
<span class="sr-badge" v-if="setting.experimental">!</span>
<span class="sr-badge" v-if="setting.new">NEW</span>
</div>
<b class="sr-title">{{ translate("SETTINGS_" + setting.key + "_TITLE") }}</b>
<span class="sr-desc">{{ translate("SETTINGS_" + setting.key + "_DESC") }}</span>
</div>
<div class="sr-option">
<div class="sr-selector" v-if="setting.mode == 'toggle'" v-scope="{ value: settings[setting.setting] }">
<div class="sr-selector-option" v-for="option in setting.options" tabindex="0" v-effect="
if(value == option[0]) {
$el.className = 'sr-selector-option selected';
} else {
$el.className = 'sr-selector-option';
}"
@click="changeSetting(setting.setting, option[0]); value = option[0]; if(setting.reload) location.reload();"
v-bind:class="{ 'selected': settings[setting.setting] == option[0] }">
{{ translate(option[1]) }}
</div>
</div>
<select class="sr-select" v-if="setting.mode == 'dropdown'"
v-effect="$el.selectedIndex = setting.options.indexOf(settings[setting.setting])"
@change="changeSetting(setting.setting, setting.options[$el.selectedIndex]); if(setting.reload) location.reload();">
<option class="sr-select-item" v-for="option in setting.options">{{ translate(option) }}</option>
</select>
<div v-if="setting.mode == 'color-slider'">
<input class="sr-color-slider" :id="setting.key" type="range" :max="setting.max" :min="setting.min"
:value="settings[setting.setting]" v-on:input="changeHue($el.value)" @click="themeChange()"
v-on:change="changeSetting(setting.setting, $el.value)" />
</div>
<div v-if="setting.mode == 'slider'">
<input class="sr-slider" :id="setting.key" type="range" :max="setting.max" :min="setting.min"
:value="settings[setting.setting]" v-on:change="changeSetting(setting.setting, $el.value)" />
</div>
</div>
</div>
<div class="settings-row">
<div class="sr-head">
<b class="sr-title">{{ translate("SETTINGS_CLASS_NAMES_TITLE") }}</b>
<span class="sr-desc">{{ translate("SETTINGS_CLASS_NAMES_DESC") }}</span>
</div>
<div class="sr-option">
<div class="sr-selector">
<div class="sr-selector-option" @click="switchPage('classNames')" tabindex="0">{{ translate("CONFIGURE") }}
</div>
</div>
</div>
</div>
<div class="settings-row">
<div class="sr-head">
<b class="sr-title">{{ translate("SETTINGS_SHARE_TITLE") }}</b>
<span class="sr-desc">{{ translate("SETTINGS_SHARE_DESC") }}</span>
</div>
<div class="sr-option">
<div class="sr-selector">
<div class="sr-selector-option" @click="shareSettings()" tabindex="0">{{ translate("SHARE_SETTINGS") }}
</div>
</div>
<div class="sr-selector">
<div class="sr-selector-option" @click="shareClassNames()" tabindex="0">{{ translate("SHARE_CLASS_NAMES") }}
</div>
</div>
<div class="share-link" v-effect="$el.textContent = shareLink" @click="$el.focus(); $el.select();"
tabindex="0"></div>
</div>
</div>
<div class="settings-row" style="position: relative; z-index: 999;">
<div class="sr-head">
<b class="sr-title">Reset</b>
<span class="sr-desc">Reset any of the data stored in your local storage. Try using this if the page isn't
working. (Try reloading first)</span>
</div>
<div class="sr-option">
<div class="sr-selector">
<div class="sr-selector-option" onclick="localStorage.removeItem('settings'); location.reload()"
tabindex="0">Reset Settings</div>
</div>
<div class="sr-selector">
<div class="sr-selector-option" onclick="localStorage.removeItem('customNamesJSON'); location.reload()"
tabindex="0">Reset Class Names</div>
</div>
<div class="sr-selector">
<div class="sr-selector-option"
onclick="localStorage.removeItem('scheduleJSON'); localStorage.removeItem('eventsJSON'); localStorage.removeItem('languageJSON'); location.reload()"
tabindex="0">Reset Local Storage</div>
</div>
</div>
</div>
</div>
<!-- Class Names Page - All of the class names generated from classNames.js -->
<div id="names-page" v-if="currentPage == 'classNames'">
<div class="todays-schedule">
{{ translate("CLASS_NAMES_TITLE") }}
</div>
<div class="settings-row" v-for="periodId in namesMenu">
<div class="sr-head">
<b class="sr-title">{{ translateNoCustom(periodId) }}</b>
</div>
<div class="sr-option">
<input class="sr-text" v-effect="$el.value = translate(periodId)" @change="changeClassName(periodId, $el);">
</input>
</div>
</div>
<div class="settings-row">
<div class="sr-head">
<b class="sr-title">{{ translate("RETURN_SETTINGS") }}</b>
</div>
<div class="sr-option">
<div class="sr-selector">
<div class="sr-selector-option" @click="switchPage('settings')" tabindex="0">{{ translate("RETURN") }}</div>
</div>
</div>
</div>
</div>
<!-- End of Pages -->
<div id="data-page" v-if="currentPage == 'data'">
<div id="hoursLeft">{{ Math.trunc(minutesLeft / 60) }}</div>
<div id="minutesLeft">{{ minutesLeft % 60 }}</div>
<div id="minutesLeftTotal">{{ minutesLeft }}</div>
<div id="percentComplete">{{ percentCompleted }}</div>
<div id="periodName">{{ currentPeriod.getName() }}</div>
<div id="periodStart">{{ currentPeriod.getStart() }}</div>
<div id="periodEnd">{{ currentPeriod.getEnd() }}</div>
<div id="isPassing">{{ currentPeriod.passing }}</div>
</div>
<div class="credits" v-if="popupDate == null">
Made with ❤️ by the <a href="https://lciteam.club" class="credits" target="_blank">LC iTeam</a>
<br>
<a href="https://forms.gle/BgFW4MgL9RGpezdw7" class="credits" target="_blank">Report a bug</a>
<br>
<a href="https://chrome.google.com/webstore/detail/lchs-go-beta/bddnpkadgjcbafnmbampfbaiijafealk" class="credits"
target="_blank">Install the Extension</a>
</div>
</div>
<!-- Templates Section - These are templates because they are used in multiple areas -->
<!-- Period Information Template - Holds the time left -->
<template id="period-information-template">
<div class="progress-bar">
<div class="circle"></div><!-- percent max min min-->
<div class="moving-time" v-bind:style="{ top: percentCompleted * (85 - 12) / 100 + 12 + '%' }"
><span v-effect="$el.textContent = currentTime"></span></div>
<!--12 - 85-->
<div class="vertical-bar"></div>
<div class="circle"></div>
</div>
<div class="period-information-content">
<div class="start-end-time" v-effect="currentPeriod">{{ currentPeriod.getStart() }}</div>
<div class="time-left">
<div class="divider-bar" style="margin-bottom: 10px;"></div>
<div class="time-left-group">
<div class="details-name">{{ currentPeriod.getName() }}</div>
<div class="time-left-text">
<div style="display: inline-flex; justify-content: center; flex-wrap: wrap;">
<div style="margin-right: 5px;" v-if="Math.trunc(minutesLeft / 60) > 0">
<span class="time-left-number">{{ Math.trunc(minutesLeft / 60) }}</span>
{{ translate("HOUR_ABBREVIATION") }}
</div>
<div style="margin-right: 5px;">
<span class="time-left-number">{{ minutesLeft % 60 }}</span>
{{ translate("MINUTE_ABBREVIATION") }}
</div>
</div>
{{ translate('UNITL_END') }}
</div>
<div class="time-left-percent">{{ percentCompletedText }}</div>
</div>
<div class="divider-bar" style="margin-top: 20px;"></div>
</div>
<div class="start-end-time">{{ currentPeriod.getEnd() }}</div>
</div>
</template>
<!-- Period List Template - Holds the list of periods -->
<template id="period-list-template">
<div class="periods-header">
<div class="period-name">
<div class="period-header-text">{{ translate("PERIOD_NAME") }}</div>
</div>
<div class="period-header-text">{{ translate("PERIOD_START") }}</div>
<div class="period-header-text">{{ translate("PERIOD_END") }}</div>
</div>
<div v-for="period in listPeriod">
<div class="period" v-bind:class="{ current: period.isCurrent() && !isCalendar, 'list-odd': getListCount() }"
v-if="period.isVisible()">
<div class="period-name">
<label>
<input class="period-details" v-effect="$el.value = period.getName()" @click="$el.focus(); $el.select();"
@blur="changeClassName(period.name, $el)" />
</label>
</div>
<div class="period-details">{{ period.getStart() }}</div>
<div class="period-details">{{ period.getEnd() }}</div>
</div>
<div class="period-details-small" v-scope="PeriodInformationComponent()"
v-if="period.isCurrent() && !isCalendar && settings.inlinePeriodDetails"></div>
</div>
</template>
<!-- Service Worker Startup -->
<script>
console.log("Hello, please work.");
localStorage.removeItem("isExtension")
localStorage.removeItem("changelog")
if (JSON.parse(localStorage.settings).hasOwnProperty("numberOfClicks")) localStorage.removeItem("settings");
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceWorker.js', { scope: '/' })
.then(function (registration) {
// idk what to put here but it is needed for a pwa
});
navigator.serviceWorker.ready.then(function (registration) { });
}
</script>
</body>
</html>