-
Notifications
You must be signed in to change notification settings - Fork 0
/
hurricanes.html
51 lines (43 loc) · 1.23 KB
/
hurricanes.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
<html>
<head>
<title>jsontest</title>
<style type="text/css">
body { background-color: #ddd; }
#container { height: 100%; width: 100%; display: table; }
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type='text/javascript'>
function NHLSeason(a_dDate)
{
var sYear1 = 1900 + (a_dDate.getMonth() < 7 ? (a_dDate.getYear()-1) : (a_dDate.getYear()));
var sYear2 = 1900 + (a_dDate.getMonth() < 7 ? (a_dDate.getYear()) : (a_dDate.getYear()+1));
return sYear1 +""+ sYear2;
}
function loadGames()
{
//https://www.reddit.com/r/nhl/comments/2i13xa/places_to_get_raw_statistics/
//http://live.nhl.com/GameData/SeasonSchedule-20162017.json
//http://live.nhl.com/GameData/SeasonSchedule-21162117.json
var sYears = NHLSeason(new Date());
var sSchedule = "http://live.nhl.com/GameData/SeasonSchedule-"+sYears+".json"
$( "<hr>" ).text( sSchedule ).appendTo( "#listOfGames" );
$.getJSON( sSchedule)
.done(function( data )
{
$.each( data.items, function( i, item )
{
$( "<hr>" ).text( item.a + " vs. " +item.h).appendTo( "#listOfGames" );
/*
if ( i === 3 )
{
return false;
}*/
});
});
}
</script>
</head>
<body onload="loadGames()">
<div id="listOfGames"></div>
</body>
</html>