Revision f63a4593
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
js/kivi.ActionBar.js | ||
---|---|---|
1 |
namespace('kivi', function(k){ |
|
1 |
namespace('kivi.ActionBar', function(k){
|
|
2 | 2 |
'use strict'; |
3 | 3 |
|
4 | 4 |
var CLASSES = { |
... | ... | |
9 | 9 |
combobox: 'layout-actionbar-combobox', |
10 | 10 |
}; |
11 | 11 |
|
12 |
k.ActionBarCombobox = function(e) {
|
|
12 |
k.Combobox = function(e) { |
|
13 | 13 |
this.combobox = e; |
14 | 14 |
this.head = e.childNodes[0]; |
15 | 15 |
this.topAction = this.head.childNodes[0]; |
... | ... | |
18 | 18 |
this.init(); |
19 | 19 |
}; |
20 | 20 |
|
21 |
k.ActionBarCombobox.prototype = {
|
|
21 |
k.Combobox.prototype = { |
|
22 | 22 |
init: function() { |
23 | 23 |
var obj = this; |
24 | 24 |
var toggler = function(event){ |
... | ... | |
35 | 35 |
} |
36 | 36 |
}; |
37 | 37 |
|
38 |
k.ActionBarAccesskeys = {
|
|
38 |
k.Accesskeys = { |
|
39 | 39 |
known_keys: { |
40 | 40 |
'enter': 13, |
41 | 41 |
'esc': 27, |
... | ... | |
93 | 93 |
|| (e.target.tagName == 'SELECT'))) |
94 | 94 |
return true; |
95 | 95 |
|
96 |
if ((target in k.ActionBarAccesskeys.actions) && (accesskey in k.ActionBarAccesskeys.actions[target])) {
|
|
96 |
if ((target in kivi.ActionBar.Accesskeys.actions) && (accesskey in kivi.ActionBar.Accesskeys.actions[target])) {
|
|
97 | 97 |
e.stopPropagation(); |
98 |
k.ActionBarAccesskeys.actions[target][accesskey].click();
|
|
98 |
kivi.ActionBar.Accesskeys.actions[target][accesskey].click();
|
|
99 | 99 |
|
100 | 100 |
// and another special case. |
101 | 101 |
// if the form contains submit buttons the default action will click them instead. |
... | ... | |
106 | 106 |
} |
107 | 107 |
}; |
108 | 108 |
|
109 |
k.ActionBarAction = function(e) {
|
|
109 |
k.setupAction = function(e) {
|
|
110 | 110 |
var data = $(e).data('action'); |
111 | 111 |
if (undefined === data) return; |
112 | 112 |
|
... | ... | |
118 | 118 |
|
119 | 119 |
if (data.accesskey) { |
120 | 120 |
if (data.submit) { |
121 |
k.ActionBarAccesskeys.add_accesskey(data.submit[0], data.accesskey, $(e));
|
|
121 |
kivi.ActionBar.Accesskeys.add_accesskey(data.submit[0], data.accesskey, $(e));
|
|
122 | 122 |
} |
123 | 123 |
if (data.call) { |
124 |
k.ActionBarAccesskeys.add_accesskey(undefined, data.accesskey, $(e));
|
|
124 |
kivi.ActionBar.Accesskeys.add_accesskey(undefined, data.accesskey, $(e));
|
|
125 | 125 |
} |
126 | 126 |
} |
127 | 127 |
|
... | ... | |
179 | 179 |
|
180 | 180 |
$(function(){ |
181 | 181 |
$('div.layout-actionbar .layout-actionbar-action').each(function(_, e) { |
182 |
kivi.ActionBarAction(e) |
|
182 |
kivi.ActionBar.setupAction(e)
|
|
183 | 183 |
}); |
184 | 184 |
$('div.layout-actionbar-combobox').each(function(_, e) { |
185 |
$(e).data('combobox', new kivi.ActionBarCombobox(e)); |
|
185 |
$(e).data('combobox', new kivi.ActionBar.Combobox(e));
|
|
186 | 186 |
}); |
187 | 187 |
$(document).click(function() { |
188 | 188 |
$('div.layout-actionbar-combobox').removeClass('active'); |
189 | 189 |
}); |
190 |
kivi.ActionBarAccesskeys.bind_targets(); |
|
190 |
kivi.ActionBar.Accesskeys.bind_targets();
|
|
191 | 191 |
}); |
Auch abrufbar als: Unified diff
ActionBar: Objekte & Funktionen in Namespace kivi.ActionBar verschoben