-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
118 lines (97 loc) · 3.11 KB
/
main.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
$('#86-widget').click(function (e) {
goForward( function () {
$('#86-box').fadeIn('fast');
});
});
$('#abp-widget').click(function (e) {
goForward( function () {
$('#abp-box').fadeIn('fast');
});
});
$('#brownless-widget').click(function (e) {
goForward( function () {
$('#brownless-box').fadeIn('fast');
});
});
$('#ge-widget').click(function (e) {
goForward(function () {
$('#ge-box').fadeIn('fast');
});
});
$('#law-widget').click(function (e) {
goForward(function () {
$('#law-box').fadeIn('fast');
});
});
$('#erc-widget').click(function (e) {
goForward(function () {
$('#erc-box').fadeIn('fast');
});
});
function goBack(e) {
$('.other-widget').fadeOut('fast', function () {
$('#all-box').fadeIn('fast');
});
}
function goForward(func){
$('#all-box').fadeOut('fast', func());
}
$('.back-btn').click(goBack);
$('header').click(goBack);
var hours_dict = {};
$(function(){
var week0 = new $.LibCalWeeklyGrid( $("#s-lc-whw0"), { iid: 855, lid: 0, weeks: 4, systemTime: true });
});
$("body").on('DOMSubtreeModified', "#s-lc-whw0", function() {
$("body").off("DOMSubtreeModified", "#s-lc-whw0");
getHours();
setHours();
});
function getHours() {
$("#s-lc-whw0")
.find("table tbody:first tr")
.find("td:eq(0)")
.map(function() {
hours_dict[this.innerText] = $(this)
.parent()
.find(".s-lc-whw-today")
.text();
});
}
function setHours(){
abp = hours_dict["Architecture, Building and Planning Library"];
bail = hours_dict["Baillieu Library"];
bailah = hours_dict["Baillieu Library After Hours Study Zone"];
brown = hours_dict["Brownless Biomedical Library"];
brownah = hours_dict["Brownless Biomedical Library After Hours Study Zone"];
erc = hours_dict["Eastern Resource Centre"];
ercah = hours_dict["Eastern Resource Centre After Hours Study Zone"];
ge = hours_dict["Giblin Eunson Library"];
geah = hours_dict["Giblin Eunson Library After Hours Study Zone"];
law = hours_dict["Law Library"]
$("#abp-widget .open").text(abp);
$("#86-widget .open").text(bail);
$("#86-widget .after").text(bailah);
$("#brownless-widget .open").text(brown);
$("#brownless-widget .after").text(brownah);
$("#erc-widget .open").text(erc);
$("#erc-widget .after").text(ercah);
$("#ge-widget .open").text(ge);
$("#ge-widget .after").text(geah);
$("#law-widget .open").text(law);
$("#abp-box .open").text(abp);
$("#86-box .open").text(bail);
$("#86-box .after").text(bailah);
$("#brownless-box .open").text(brown);
$("#brownless-box .after").text(brownah);
$("#erc-box .open").text(erc);
$("#erc-box .after").text(ercah);
$("#ge-box .open").text(ge);
$("#ge-box .after").text(geah);
$("#law-box .open").text(law);
}
const isInStandaloneMode = () =>
(window.matchMedia('(display-mode: standalone)').matches) || (window.navigator.standalone) || document.referrer.includes('android-app://');
if (isInStandaloneMode()) {
console.log("webapp is installed")
}