-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·145 lines (131 loc) · 4.83 KB
/
index.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
"use strict";
window.addEventListener('load', onLoaded, false);
//change background color depending on time of day
var weather = 0;
var today = new Date();
//sky color var stuff here
let hourlyColors = [
'#080f44',
'#071042',
'#000e4a',
'#000b4a',
'#183058',
'#2c5478',
'#578f92',
'#94baf1',
'#78abff',
'#53a6ff',
'#65bcff',
'#60b9ff',
'#499aff',
'#4694ff',
'#4897ff',
'#88baff',
'#99d2ff',
'#a4aeff',
'#db887d',
'#002063',
'#032167',
'#01104a',
'#0f184a',
'#080c42'
]
/* for weather:
0 is sunny / clear
1 is cloudy
2 is rainy
3 is snowy */
if (weather == 0) {
var bgcolor = hourlyColors[today.getHours()]
} else if (weather == 1) {
//todo
};
document.body.style.backgroundColor = bgcolor;
//document.getElementById("test").innerHTML = bgcolor;
document.getElementById("tnd").innerHTML = "Catch for ".concat(today.getMonth()+1,"/",today.getDate(),"/",today.getFullYear());
//--------------seperator :)---------------\\
function onLoaded(_event)
{
fixedFish.forEach( item => document.body.appendChild(makeItemDisplay(item)) );
//change 'fixedFish' in above line to 'fish' to see all fish for debugging or the like
function makeItemDisplay(data)
{
let src = document.getElementById('fishTemplate');
let newFish = src.content.cloneNode(true);
let file = "icons/fish/".concat(data.File);
if (data.Hours.length == 24) {
var lastHour = "All day";
} else if (data.Hours.slice(-1) > 12) { //24-to-12hr conversion
var lastHour = "Until " + (data.Hours.slice(-1)-12)+ "pm"; //if past 12 (ex 14hr), subtract 12, add pm (2pm)
} else if (data.Hours.slice(-1) == 0) { //if 0hr, make 12am
var lastHour = "Until 12am";
} else if (data.Hours.slice(-1) == 12) { //if 12hr, make 12pm
var lastHour = "Until 12pm";
} else { //if it is between 1-11hr, append "am"
var lastHour = "Until " + (data.Hours.slice(-1)) + "am";
}
newFish.querySelector('.fishname').textContent = data.Type;
newFish.querySelector('.fishico').src = file;
newFish.querySelector('.fishuntil').textContent = lastHour;
newFish.querySelector('.fishloc').textContent = data.Location;
return newFish;
}
};
//--------------seperator :)---------------\\
var toggled = 1
var listSelect = "#F68900" //highlighted color, orange
var prefSelect = "#F5F0C2" //nonhighlighted color, tan-ish
var infoSelect = "#F5F0C2"
function currentHighlightedAction() {
document.getElementById("list").style.color = listSelect;
document.getElementById("pref").style.color = prefSelect;
document.getElementById("info").style.color = infoSelect;
}
function list() {
listSelect = "#F68900";
prefSelect = "#F5F0C2";
infoSelect = "#F5F0C2";
currentHighlightedAction();
document.getElementById("pill").innerHTML = "Collection";
document.getElementById("pill").style.transform = "translate(-55px, 55px)";
document.getElementById("listSection").style.transform = "translateY(130px)";
document.getElementById("prefSection").style.transform = "translateY(-2000px)";
document.getElementById("infoSection").style.transform = "translateY(-2000px)";
}
function pref() {
listSelect = "#F5F0C2";
prefSelect = "#F68900";
infoSelect = "#F5F0C2";
currentHighlightedAction();
document.getElementById("pill").innerHTML = "Preferences";
document.getElementById("pill").style.transform = "translate(0px, 55px)";
document.getElementById("listSection").style.transform = "translateY(-2000px)";
document.getElementById("prefSection").style.transform = "translateY(0px)";
document.getElementById("infoSection").style.transform = "translateY(-2000px)";
}
function info() {
listSelect = "#F5F0C2";
prefSelect = "#F5F0C2";
infoSelect = "#F68900";
currentHighlightedAction();
document.getElementById("pill").innerHTML = "About";
document.getElementById("pill").style.transform = "translate(54px, 55px)";
document.getElementById("listSection").style.transform = "translateY(-2000px)";
document.getElementById("prefSection").style.transform = "translateY(-2000px)";
document.getElementById("infoSection").style.transform = "translateY(-200px)";
}
//------------------------:)
function toggleNav() {
if (toggled == 0) {
document.getElementById("mySidenav").style.height = "95%";
document.getElementById("wipbadge").style.opacity = "1";
document.getElementById("mySidenav").style.boxShadow = "0px 0px 0px 58px rgba(0,0,0,0.4)";
list()
toggled = 1;
} else {
document.getElementById("mySidenav").style.height = "0px";
document.getElementById("wipbadge").style.opacity = "0";
document.getElementById("mySidenav").style.boxShadow = "none";
toggled = 0
}
}