blob: 842e87158eafc971fec3b2adde8df0dc4169a6a6 (
plain)
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
|
var HelpCursor = View.extend({
el: "#helpCursor",
messages: {
start: "Welcome to Vvalls!",
move: "Use the up and down keys to move around. Use left and right to pivot. WASD works too.",
},
shown: {},
initialize: function(){
$(window).mousemove(function(e){
this.el.style.left = e.pageX + "px"
this.el.style.top = e.pageY + "px"
}.bind(this))
this.show("start")
},
show: function(name){
if (name) this.showMessage(name)
this.$el.show()
},
hide: function(){
this.$el.hide()
},
showMessage: function(name){
if (+(this.shown[name] || 0) < 2) {
this.$el.html(this.messages[name])
this.shown[name] = (+this.shown[name] || 0) + 1
}
else {
this.$el.html("")
}
},
})
|