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
|
var IntroView = View.extend({
el: "#intro",
events: {
"click .store": "store",
"click .hub": "hub",
"click .story": "story",
"click .archive": "archive",
},
initialize: function(){
this.$alert = this.$(".alert")
this.compass = this.$("#compass").get(0)
this.orient = this.deviceorientation.bind(this)
this.$alert.hide()
},
show: function(){
document.body.className = "intro"
window.addEventListener("deviceorientation", this.orient)
app.footer.hide()
this.orient({ alpha: 0 })
},
hide: function(){
window.removeEventListener("deviceorientation", this.orient)
this.$alert.hide()
},
deviceorientation: function(e){
var heading
if ('webkitCompassHeading' in e) {
heading = e.webkitCompassHeading || 0
}
else {
heading = e.alpha || 0
}
heading = - heading
this.compass.style[transformProp] = "translateZ(0) translateX(-50%) translateY(-50%) rotate(" + heading + "deg)"
},
store: function(e){
e.preventDefault()
e.stopPropagation()
app.router.go("store")
},
hub: function(e){
e.preventDefault()
e.stopPropagation()
app.router.go("hub")
},
story: function(e){
e.preventDefault()
e.stopPropagation()
app.router.go("story")
},
archive: function(e){
e.preventDefault()
e.stopPropagation()
app.router.go("archive")
},
})
|