forked from nathanathan/Interview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interviewerMain.js
56 lines (52 loc) · 1.51 KB
/
interviewerMain.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
require.config({
'paths': {
"underscore": "libs/underscore-min",
"backbone": "libs/backbone-min",
"backboneqp": "libs/backbone.queryparams",
"backbonels": "libs/backbone-localstorage",
"sfsf": "libs/sfsf/sfsf",
"Popcorn": "libs/popcorn-complete.min"
},
'shim':
{
underscore: {
'exports': '_'
},
backbone: {
'deps': ['jquery', 'underscore'],
'exports': 'Backbone'
}
}
});
require([
'underscore',
'backbone',
'interviewer/router',
'mixins'
],
function(_, Backbone, router){
var onReady = function() {
$(function() {
//This is a patch to make it so form submission puts the params after
//the hash so they can be picked up by Backboneqp.
$(document).submit(function(e) {
e.preventDefault();
window.location = $(e.target).attr('action') + '?' + $(e.target).serialize();
});
document.addEventListener("backbutton", function() {
//disable back presses.
}, false);
new router();
});
};
if ('cordova' in window) {
//No need to worry about timing. From cordova docs:
//This event behaves differently from others in that any event handler
//registered after the event has been fired will have its callback
//function called immediately.
document.addEventListener("deviceready", onReady);
}
else {
onReady();
}
});