Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
76 lines (68 loc) · 2.26 KB
/
Copy pathapp.js
File metadata and controls
76 lines (68 loc) · 2.26 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
/*global Ext: false, DFST: false */
//FOR DEBUG PURPOSES, LET EXTJS FIGURE OUT WHERE SCRIPTS ARE AND LOAD THEM
Ext.Loader.setConfig({
enabled: true,
disableCaching: false,
paths: {
Ext: 'resources/js/extjs'
}
});
Ext.application({
name: 'DFST',
// All controllers that should initialize
controllers: [
'Stats',
'Filters',
'Rosters'
],
//automatically load and instantiate DFST.view.Viewport
autoCreateViewport: true,
init : function(application) { // configure for sport
var provider = Ext.supports.LocalStorage ?
new Ext.state.LocalStorageProvider()
: new Ext.state.CookieProvider();
Ext.state.Manager.setProvider(provider);
var siteId = 1; //default to DK
var urlArgs = document.location.search.replace('?', '').split('&');
for (var i=0; i<urlArgs.length; i++)
{
var arg = urlArgs[i].split('=');
var argName = arg[0];
var argValue = arg[1];
if (argName === 'sport') {
var sport = argValue;
if (sport === "nba" || sport === "mlb" || sport === "nfl" || sport === "nhl" || sport === "nas" || sport === 'golf') { //supported sports
DFST.AppSettings.sport = sport;
}
}
if (argName === 'site') {
switch (argValue) {
case 'fanduel':
siteId = 2;
break;
case 'fantasydraft':
siteId = 7;
break;
case 'yahoo':
siteId = 6;
break;
case 'draftkings':
default:
siteId = 1;
break;
}
}
}
DFST.AppSettings.siteId = siteId;
}
});
/* Fix for ajax requests not sending json request header in Firefox */
Ext.Ajax.defaultHeaders = {
'Accept' : 'application/json',
'Content-Type' : 'application/json'
};
/* override date encoding to include time zone */
Ext.JSON.encodeDate = function(o)
{
return '"' + Ext.Date.format(o, 'c') + '"';
};