-
Notifications
You must be signed in to change notification settings - Fork 0
/
scores.js
40 lines (40 loc) · 1.19 KB
/
scores.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
$.ajax({
dataType: "json",
url: "http://www.nfl.com/liveupdate/scorestrip/ss.json",
jsonpCallback: "loadScoreboard",
success: function(data) {
var text = data["gms"];
var str = "";
var textsearch = "Packers";
String.prototype.capitalize = function() {
return this.replace(/(?:^|\s)\S/g, function(a) {
return a.toUpperCase();
});
};
if (textsearch != null) {
str = "";
for (var key in text) {
if (text[key].hasOwnProperty("hnn") && text[key].hasOwnProperty("hs")) {
if (
text[key]["hnn"].toLowerCase().indexOf(textsearch.toLowerCase()) !=
-1
) {
var homet = text[key]["h"].capitalize();
var hometsc = text[key]["hs"];
var awayt = text[key]["v"].capitalize();
var awayts = text[key]["vs"];
}
if (
text[key]["vnn"].toLowerCase().indexOf(textsearch.toLowerCase()) !=
-1
) {
var awayt = text[key]["v"].capitalize();
var awayts = text[key]["vs"];
var homet = text[key]["h"].capitalize();
var hometsc = text[key]["hs"];
}
}
}
}
}
});