-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlegend.bind.js
70 lines (55 loc) · 1.72 KB
/
legend.bind.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
(function () {
var keys = $$legend.keys;
var setPairs = function (pairs) {
_.each(pairs, function (value, key) {
keys[key](value);
});
}
Backbone.Epoxy.binding.addHandler("legend", {
init: function( $element, value, bindings, context ) {
var pairs = _.foldl(value.split(/\s*,\s*/), function (result, pair) {
var splt = pair.split(/\s*:\s*/);
result[splt[0]] = splt[1];
return result;
}, {});
var $current = $$nav.current();
if ($current && $.contains($element[0], $current[0])) {
setPairs(pairs)
}
$element.on({
'nav_focus': function (e) {
setPairs(pairs);
},
'nav_blur': function (e) {
_.each(pairs, function (value, key) {
keys[key](0);
});
}
});
},
get: function( $element, value, event ) {
},
set: function( $element, value ) {
},
clean: function() {
// Cleanup the binding handler...
}
});
$(function () {
var $body = $('body');
$body.on('nav_focus', '#keyboard_popup', function () {
keys.enter('Input');
keys.number('Num input');
keys.red('Remove symbol');
keys.green('Complete');
keys.ret('Hide keyboard');
});
$body.on('nav_blur', '#keyboard_popup', function () {
keys.enter('');
keys.number('');
keys.red('');
keys.green('');
keys.ret('');
});
});
}());