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
|
var NavView = View.extend({
el: ".menu",
events: {
"click li": "click",
},
initialize: function(){
},
click: function(e){
var id = $(e.target).data("id")
this.pick(id)
},
pick: function(id){
var view = app.lookup[ id ]
this.swap( view, "down" )
},
previous: function(){
if ($('body').hasClass('navopen')) {
$('body').removeClass('navopen')
return
}
var index = Math.max( app.view.page_number - 1, 0 )
var view = app.projects[ index ]
this.swap( view, "up" )
},
next: function(){
if ($('body').hasClass('navopen')) {
$('body').removeClass('navopen')
return
}
var index = Math.min( app.view.page_number + 1, app.projects.length - 1 )
var view = app.projects[ index ]
this.swap( view, "down" )
},
swap: function(view, direction) {
if (view && ! app.view) {
app.view = view
app.view.show()
return
}
if (! view || app.view == view || app.view.showing) {
return
}
console.log(view.page_number, view.project_id)
direction = direction || "down"
addClassForPeriod( document.body, direction, app.navigation_delay )
app.view.hide()
view.show()
app.view = view
},
})
|