-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
executable file
·118 lines (114 loc) · 2.25 KB
/
Copy pathoptions.js
File metadata and controls
executable file
·118 lines (114 loc) · 2.25 KB
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
function loadEvent(f)
{
var old = window.onload;
if (typeof window.onload != "function")
{
window.onload = f;
}
else
{
old();
f();
}
}
function changeEvent(f)
{
var old = window.onchange;
if (typeof window.onchange != "function")
{
window.onchange = f;
}
else
{
old();
f();
}
}
function checkStorage()
{
if (!localStorage.nbaCheck)
{
localStorage.nbaCheck = "true";
}
if (!localStorage.nflCheck)
{
localStorage.nflCheck = "true";
}
if (!localStorage.mlbCheck)
{
localStorage.mlbCheck = "true";
}
if (!localStorage.nhlCheck)
{
localStorage.nhlCheck = "true";
}
document.getElementById("nba").checked = (localStorage.nbaCheck === "true");
document.getElementById("nfl").checked = (localStorage.nflCheck === "true");
document.getElementById("mlb").checked = (localStorage.mlbCheck === "true");
document.getElementById("nhl").checked = (localStorage.nhlCheck === "true");
var list = ["nba","nfl","mlb","nhl"];
var listLength = list.length;
for (var i = 0; i < listLength; i++)
{
if (list[i] === localStorage.checked)
{
if (document.getElementById(localStorage.checked).checked === true)
{
document.getElementById(localStorage.checked).disabled = true;
}
}
else
{
document.getElementById(list[i]).disabled = false;
}
}
}
function displayChecked()
{
var leagues = document.getElementsByName("sport");
var numLeagues = leagues.length;
for (var i = 0; i < numLeagues; i++)
{
if (leagues[i].checked)
{
if (i == 0)
{
localStorage.nbaCheck = "true";
}
else if (i == 1)
{
localStorage.nflCheck = "true";
}
else if (i == 2)
{
localStorage.mlbCheck = "true";
}
else if (i == 3)
{
localStorage.nhlCheck = "true";
}
}
else
{
if (i == 0)
{
localStorage.nbaCheck = "false";
}
else if (i == 1)
{
localStorage.nflCheck = "false";
}
else if (i == 2)
{
localStorage.mlbCheck = "false";
}
else if (i == 3)
{
localStorage.nhlCheck = "false";
}
}
}
}
loadEvent(checkStorage);
setInterval(checkStorage,0);
document.getElementById("sports").addEventListener("onchange", changeEvent(displayChecked));