-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
151 lines (131 loc) · 4.55 KB
/
app.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
146
147
148
149
150
151
Ext.Loader.setConfig(
{
enabled: true,
disableCaching: true
}
);
Ext.Loader.setPath('Ext.ux', './ux');
Ext.application({
name: 'NerdyKaraoke',
requires: [
'Ext.MessageBox'
],
stores: [
'Alphabet',
'Category',
'Karaoke',
'NewKaraoke'
],
models: [
'Songs',
'NewSongs',
'RequestForm'
],
controllers: [
'EventController'
],
views: [
'Main',
'CategoryContainer',
'Category',
'CategoryLyrics',
'WhatsNewContainer',
'WhatsNew',
'WhatsNewLyrics',
'TrackContainer',
'TrackSearch',
'TrackList',
'TrackLyrics',
'Submit',
'Issues'
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/[email protected]',
'144': 'resources/icons/[email protected]'
},
isIconPrecomposed: true,
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('NerdyKaraoke.view.Main'));
Ext.Viewport.show({ type: 'fade' });
Ext.Viewport.setMasked({ xtype:'loadmask', message:'Loading...'} );
Ext.override(Ext.MessageBox, {
hide: function() {
if (this.activeAnimation && this.activeAnimation._onEnd) {
this.activeAnimation._onEnd();
}
return this.callParent(arguments);
}
});
Ext.override(Ext.util.SizeMonitor, {
constructor: function(config) {
var namespace = Ext.util.sizemonitor;
if (Ext.browser.is.Firefox) {
return new namespace.OverflowChange(config);
} else if (Ext.browser.is.WebKit) {
if (!Ext.browser.is.Silk && Ext.browser.engineVersion.gtEq('535') && !Ext.browser.engineVersion.ltEq('537.36')) {
return new namespace.OverflowChange(config);
} else {
return new namespace.Scroll(config);
}
} else if (Ext.browser.is.IE11) {
return new namespace.Scroll(config);
} else {
return new namespace.Scroll(config);
}
}
});
Ext.override(Ext.util.PaintMonitor, {
constructor: function(config) {
if (Ext.browser.is.Firefox || (Ext.browser.is.WebKit && Ext.browser.engineVersion.gtEq('536') && !Ext.browser.engineVersion.ltEq('537.36') && !Ext.os.is.Blackberry)) {
return new Ext.util.paintmonitor.OverflowChange(config);
}
else {
return new Ext.util.paintmonitor.CssAnimation(config);
}
}
});
Ext.getStore('Alphabet').load();
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});
//Let people use their mousewheel or trackpad to scroll
if(Ext.os.deviceType === 'Desktop') {
document.addEventListener('mousewheel', function(e){
var el = e.target;
var offset, scroller, _results;
_results = [];
while (el !== document.body) {
if (el && el.className && el.className.indexOf('x-container') >= 0) {
var cmp = Ext.getCmp(el.id);
if (cmp && typeof cmp.getScrollable == 'function' && cmp.getScrollable()){
scroller = cmp.getScrollable().getScroller();
if (scroller) {
offset = {x:0, y: -e.wheelDelta*0.5};
scroller.fireEvent('scrollstart', scroller, scroller.position.x, scroller.position.y, e);
scroller.scrollBy(offset.x, offset.y);
scroller.snapToBoundary();
scroller.fireEvent('scrollend', scroller, scroller.position.x, scroller.position.y-offset.y);
break;
}
}
}
_results.push(el = el.parentNode);
}
return _results;
}, false);
}