uki 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/uki +1 -1
- data/frameworks/uki/README.rdoc +1 -1
- data/frameworks/uki/examples/core-examples/controls/controls.js +6 -6
- data/frameworks/uki/examples/core-examples/flow/flow.js +4 -4
- data/frameworks/uki/examples/core-examples/linearGradient/gradient.svg +11 -0
- data/frameworks/uki/examples/core-examples/linearGradient/linearGradient.js +87 -0
- data/frameworks/uki/examples/core-examples/popup/popup.js +23 -10
- data/frameworks/uki/examples/core-examples/resizeToContents/resizeToContents.js +12 -1
- data/frameworks/uki/examples/core-examples/slider/slider.js +1 -1
- data/frameworks/uki/examples/core-examples/splitPaneExtended/splitPaneExtended.js +1 -1
- data/frameworks/uki/examples/core-examples/table/table.js +19 -2
- data/frameworks/uki/examples/core-examples/wave/wave-theme.js +1 -1
- data/frameworks/uki/examples/core-examples/wave/wave.js +1 -1
- data/frameworks/uki/examples/more-examples/radioButton/radioButton.js +3 -3
- data/frameworks/uki/examples/more-examples/select/select.js +35 -0
- data/frameworks/uki/examples/touch-examples/scrollPane/scrollPane.js +53 -0
- data/frameworks/uki/spec/unit/background.spec.js +1 -1
- data/frameworks/uki/spec/unit/selector.spec.js +28 -12
- data/frameworks/uki/spec/unit/utils.spec.js +14 -0
- data/frameworks/uki/src/uki-core.js +3 -1
- data/frameworks/uki/src/uki-core/after.js +57 -0
- data/frameworks/uki/src/uki-core/attachment.js +15 -6
- data/frameworks/uki/src/uki-core/background.js +4 -3
- data/frameworks/uki/src/uki-core/background/css.js +1 -0
- data/frameworks/uki/src/uki-core/background/cssBox.js +5 -3
- data/frameworks/uki/src/uki-core/background/linearGradient.js +112 -0
- data/frameworks/uki/src/uki-core/background/multi.js +2 -2
- data/frameworks/uki/src/uki-core/background/rows.js +1 -0
- data/frameworks/uki/src/uki-core/background/sliced9.js +5 -2
- data/frameworks/uki/src/uki-core/builder.js +5 -4
- data/frameworks/uki/src/uki-core/collection.js +18 -13
- data/frameworks/uki/src/uki-core/dom/browser.js +114 -0
- data/frameworks/uki/src/uki-core/dom/event.js +3 -0
- data/frameworks/uki/src/uki-core/image.js +1 -26
- data/frameworks/uki/src/uki-core/selector.js +5 -0
- data/frameworks/uki/src/uki-core/theme.js +24 -23
- data/frameworks/uki/src/uki-core/theme/template.js +1 -1
- data/frameworks/uki/src/uki-core/uki.js +7 -4
- data/frameworks/uki/src/uki-core/utils.js +51 -26
- data/frameworks/uki/src/uki-core/view.js +6 -3
- data/frameworks/uki/src/uki-core/view/base.js +16 -1
- data/frameworks/uki/src/uki-core/view/container.js +15 -5
- data/frameworks/uki/src/uki-core/view/focusable.js +17 -4
- data/frameworks/uki/src/uki-core/view/observable.js +15 -2
- data/frameworks/uki/src/uki-core/view/styleable.js +4 -11
- data/frameworks/uki/src/uki-data/ajax.js +4 -30
- data/frameworks/uki/src/uki-data/json.js +191 -0
- data/frameworks/uki/src/uki-data/localStore.js +37 -0
- data/frameworks/uki/src/uki-data/model.js +1 -1
- data/frameworks/uki/src/uki-more.js +4 -0
- data/frameworks/uki/src/uki-more/more/background.js +2 -0
- data/frameworks/uki/src/uki-more/more/color.js +168 -0
- data/frameworks/uki/src/uki-more/more/utils.js +5 -12
- data/frameworks/uki/src/uki-more/more/view.js +3 -1
- data/frameworks/uki/src/uki-more/more/view/form.js +30 -0
- data/frameworks/uki/src/uki-more/more/view/hTile.js +59 -0
- data/frameworks/uki/src/uki-more/more/view/nativeButton.js +3 -0
- data/frameworks/uki/src/uki-more/more/view/nativeCheckbox.js +38 -0
- data/frameworks/uki/src/uki-more/more/view/nativeControl.js +40 -0
- data/frameworks/uki/src/uki-more/more/view/nativeInput.js +78 -0
- data/frameworks/uki/src/uki-more/more/view/nativeSelect.js +29 -0
- data/frameworks/uki/src/uki-more/more/view/radioButton.js +1 -1
- data/frameworks/uki/src/uki-more/more/view/select-theme.js +55 -0
- data/frameworks/uki/src/uki-more/more/view/select.js +208 -0
- data/frameworks/uki/src/uki-theme/airport.js +145 -88
- data/frameworks/uki/src/uki-theme/airport/i/table/a-down.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/table/a-up.png +0 -0
- data/frameworks/uki/src/uki-touch.js +2 -0
- data/frameworks/uki/src/uki-touch/touch.js +1 -0
- data/frameworks/uki/src/uki-touch/touch/const.js +24 -0
- data/frameworks/uki/src/uki-touch/touch/setup.js +52 -0
- data/frameworks/uki/src/uki-touch/touch/view.js +4 -0
- data/frameworks/uki/src/uki-touch/touch/view/scrollPane.js +505 -0
- data/frameworks/uki/src/uki-touch/touch/view/scrollableList.js +27 -0
- data/frameworks/uki/src/uki-view/view/box.js +9 -0
- data/frameworks/uki/src/uki-view/view/button.js +36 -1
- data/frameworks/uki/src/uki-view/view/checkbox.js +32 -3
- data/frameworks/uki/src/uki-view/view/flow.js +37 -9
- data/frameworks/uki/src/uki-view/view/image.js +14 -1
- data/frameworks/uki/src/uki-view/view/label.js +72 -11
- data/frameworks/uki/src/uki-view/view/list.js +143 -13
- data/frameworks/uki/src/uki-view/view/list/render.js +1 -0
- data/frameworks/uki/src/uki-view/view/popup.js +46 -2
- data/frameworks/uki/src/uki-view/view/radio.js +19 -4
- data/frameworks/uki/src/uki-view/view/scrollPane.js +91 -33
- data/frameworks/uki/src/uki-view/view/slider.js +67 -54
- data/frameworks/uki/src/uki-view/view/splitPane.js +102 -9
- data/frameworks/uki/src/uki-view/view/table.js +59 -2
- data/frameworks/uki/src/uki-view/view/table/column.js +45 -17
- data/frameworks/uki/src/uki-view/view/table/header.js +40 -12
- data/frameworks/uki/src/uki-view/view/table/render.js +4 -0
- data/frameworks/uki/src/uki-view/view/textField.js +75 -21
- data/frameworks/uki/src/uki-view/view/toolbar.js +16 -0
- data/lib/uki/builder.rb +1 -1
- data/lib/uki/include_js.rb +2 -2
- data/lib/uki/project.rb +14 -14
- data/templates/index.html.erb +2 -2
- data/templates/myapp.js.erb +2 -2
- data/uki.gemspec +34 -48
- metadata +44 -47
- data/frameworks/uki/src/uki-core/dom/nativeLayout.js +0 -18
- data/frameworks/uki/src/uki-theme/airport/i/button/down-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/popup/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/handle.gif +0 -0
@@ -1,50 +1,60 @@
|
|
1
1
|
(function() {
|
2
|
-
var defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;font-family:Arial,Helvetica,sans-serif;'
|
3
|
-
|
2
|
+
var defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;font-family:Arial,Helvetica,sans-serif;',
|
3
|
+
reflex = '<div style="position:absolute;z-index:1;left:1px;bottom:0px;right:1px;height:1px;overflow:hidden;background:rgba(255,255,255,0.4)"></div>';
|
4
|
+
|
4
5
|
uki.theme.airport = uki.extend({}, uki.theme.Base, {
|
5
6
|
imagePath: '/src/uki-theme/airport/i/',
|
6
7
|
|
7
8
|
backgrounds: {
|
8
9
|
// basic button
|
9
10
|
'button-normal': function() {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
return new uki.background.LinearGradient({
|
12
|
+
startColor: '#FDFEFF',
|
13
|
+
stops: [
|
14
|
+
{ pos: 0.15, color: '#F5F7FD' },
|
15
|
+
{ pos: 0.8, color: '#C9CACF' }
|
16
|
+
],
|
17
|
+
endColor: '#C7CBD2',
|
18
|
+
innerHTML: reflex,
|
19
|
+
css: 'border:1px solid #666;border-radius:3px;box-shadow:0 1px 0 rgba(255,255,255,0.5);'
|
20
|
+
});
|
17
21
|
},
|
18
22
|
|
19
23
|
'button-hover': function() {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
return new uki.background.LinearGradient({
|
25
|
+
startColor: '#FFFFFF',
|
26
|
+
stops: [
|
27
|
+
{ pos: 0.7, color: '#D7DAE4' }
|
28
|
+
],
|
29
|
+
endColor: '#D9DEE6',
|
30
|
+
innerHTML: reflex,
|
31
|
+
css: 'border:1px solid #666;border-radius:3px;box-shadow:0 1px 0 rgba(255,255,255,0.5);'
|
32
|
+
});
|
27
33
|
},
|
28
34
|
|
29
35
|
'button-down': function() {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
return new uki.background.LinearGradient({
|
37
|
+
startColor: '#9C9DA1',
|
38
|
+
stops: [
|
39
|
+
{ pos: 0.6, color: '#C5C7CD' }
|
40
|
+
],
|
41
|
+
endColor: '#CCCFD6',
|
42
|
+
css: 'border:1px solid #666;border-radius:3px;box-shadow:inset 0 1px 3px rgba(0,0,0,0.5);'
|
43
|
+
});
|
37
44
|
},
|
38
45
|
|
39
46
|
'button-focus': function() {
|
40
|
-
if (uki.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
if (uki.browser.cssBoxShadow() == 'unsupported') {
|
48
|
+
return new uki.background.CssBox(
|
49
|
+
'background:#7594D2;' + (uki.browser.cssFilter() && uki.image.needAlphaFix ? 'filter:Alpha(opacity=70);' : 'opacity:0.7;'),
|
50
|
+
{ inset: '-2 -2', zIndex: -2 }
|
51
|
+
);
|
52
|
+
}
|
53
|
+
return new uki.background.Css({
|
54
|
+
// WebkitTransition: '-webkit-box-shadow 0.2s linear',
|
55
|
+
boxShadow: '0 0 6px #0244D4',
|
56
|
+
borderRadius: '3px'
|
57
|
+
});
|
48
58
|
},
|
49
59
|
|
50
60
|
'button-disabled': function() {
|
@@ -81,10 +91,15 @@
|
|
81
91
|
},
|
82
92
|
|
83
93
|
'checkbox-focus': function() {
|
84
|
-
|
94
|
+
if (uki.image.needAlphaFix) {
|
95
|
+
return new uki.background.CssBox('',
|
96
|
+
{ innerHTML: '<div style="position:absolute;left:50%;top:50%;width:19px;height:19px;overflow:hidden;' +
|
97
|
+
'margin:-10px 0 0 -10px;background:#7594D2;filter:Alpha(opacity=70);"></div>', zIndex: -2 }
|
98
|
+
);
|
99
|
+
}
|
85
100
|
return new uki.background.CssBox('',
|
86
101
|
{ innerHTML: '<div style="position:absolute;left:50%;top:50%;width:24px;height:24px;overflow:hidden;' +
|
87
|
-
'margin:-12px 0 0 -12px; background: url(' +
|
102
|
+
'margin:-12px 0 0 -12px; background: url(' + uki.theme.imageSrc('checkbox-focus') + ') 0 0"></div>', zIndex: -2 }
|
88
103
|
);
|
89
104
|
},
|
90
105
|
|
@@ -115,6 +130,7 @@
|
|
115
130
|
},
|
116
131
|
|
117
132
|
'radio-focus': function() {
|
133
|
+
if (uki.image.needAlphaFix) return uki.theme.airport.background('checkbox-focus');
|
118
134
|
var src = uki.theme.imageSrc('radio-focus');
|
119
135
|
return new uki.background.CssBox('',
|
120
136
|
{ innerHTML: '<div style="position:absolute;left:50%;top:50%;width:24px;height:24px;overflow:hidden;' +
|
@@ -150,80 +166,116 @@
|
|
150
166
|
},
|
151
167
|
|
152
168
|
'toolbar-popup-button-hover': function() {
|
153
|
-
return new uki.background.Css({ background: '#4086FF', color: '#FFF', textAlign: 'left' });
|
169
|
+
return new uki.background.Css({ background: '#4086FF', color: '#FFF', textAlign: 'left', textShadow: 'none' });
|
154
170
|
},
|
155
171
|
|
156
172
|
|
157
173
|
// panel
|
158
174
|
'popup-normal': function() {
|
159
|
-
return new uki.background.
|
160
|
-
new uki.background.CssBox('opacity:0.95;background:#ECEDEE;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #CCC'),
|
161
|
-
uki.theme.background('shadow-medium')
|
162
|
-
);
|
175
|
+
return new uki.background.CssBox('background:#ECEDEE;border-radius:5px;border:1px solid #CCC;box-shadow:0 3px 8px rgba(0,0,0,0.6)');
|
163
176
|
},
|
164
177
|
|
165
178
|
'panel': function() {
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
179
|
+
return new uki.background.LinearGradient({
|
180
|
+
startColor: '#DEDEDF',
|
181
|
+
stops: [
|
182
|
+
{ pos: 0.2, color: '#D4D4D5' },
|
183
|
+
{ pos: 0.9, color: '#989899' }
|
184
|
+
],
|
185
|
+
endColor: '#989899',
|
186
|
+
css: 'box-shadow:0 1px 0 rgba(0,0,0,0.5);'
|
187
|
+
});
|
171
188
|
},
|
172
189
|
|
173
190
|
// text field
|
174
191
|
'input': function() {
|
175
192
|
return new uki.background.CssBox(
|
176
|
-
'background:white;border: 1px solid #999;border-top-color:#
|
177
|
-
{ inset: '0 0 0 0' }
|
193
|
+
'background:white;border: 1px solid #999;border-top-color:#777;box-shadow:0 1px 0 rgba(255, 255, 255, 0.4), inset 0 1px 2px rgba(0,0,0,0.2);'
|
178
194
|
);
|
179
195
|
},
|
180
196
|
|
197
|
+
'input-focus': function() {
|
198
|
+
if (uki.browser.cssBoxShadow() == 'unsupported') {
|
199
|
+
return new uki.background.CssBox(
|
200
|
+
'background:#7594D2;' + (uki.browser.cssFilter() && uki.image.needAlphaFix ? 'filter:Alpha(opacity=70);' : 'opacity:0.7;'),
|
201
|
+
{ inset: '-2 -2', zIndex: -2 }
|
202
|
+
);
|
203
|
+
}
|
204
|
+
return new uki.background.Css({
|
205
|
+
// WebkitTransition: '-webkit-box-shadow 0.2s linear',
|
206
|
+
boxShadow: '0 0 6px #0244D4'
|
207
|
+
});
|
208
|
+
},
|
209
|
+
|
210
|
+
|
211
|
+
|
181
212
|
// slider
|
213
|
+
'slider-handle-normal': function() {
|
214
|
+
return new uki.background.LinearGradient({
|
215
|
+
startColor: '#FFFFFF',
|
216
|
+
endColor: '#B1CEEA',
|
217
|
+
innerHTML: sliderPin(),
|
218
|
+
css: 'border:1px solid #8393A6;border-bottom-color:#687482;box-shadow:0 0 2px rgba(0,0,0,0.5);'
|
219
|
+
});
|
220
|
+
},
|
221
|
+
|
222
|
+
'slider-handle-hover': function() {
|
223
|
+
return new uki.background.LinearGradient({
|
224
|
+
startColor: '#DFF6FF',
|
225
|
+
endColor: '#8AC5F3',
|
226
|
+
innerHTML: sliderPin(),
|
227
|
+
css: 'border:1px solid #8393A6;border-bottom-color:#687482;box-shadow:0 0 2px rgba(0,0,0,0.5);'
|
228
|
+
});
|
229
|
+
},
|
230
|
+
|
231
|
+
'slider-handle-focus': function() {
|
232
|
+
if (uki.browser.cssBoxShadow() == 'unsupported') {
|
233
|
+
return new uki.background.CssBox(
|
234
|
+
'background:#7594D2;' + (uki.browser.cssFilter() && uki.image.needAlphaFix ? 'filter:Alpha(opacity=70);' : 'opacity:0.7;'),
|
235
|
+
{ inset: '-2 -2', zIndex: -2 }
|
236
|
+
);
|
237
|
+
}
|
238
|
+
return new uki.background.CssBox(
|
239
|
+
'box-shadow: 0 0 6px #0244D4;',
|
240
|
+
{ zIndex: 2, inset: '1' }
|
241
|
+
);
|
242
|
+
},
|
243
|
+
|
182
244
|
'slider-bar': function() {
|
183
|
-
|
184
|
-
return new uki.background.
|
185
|
-
|
186
|
-
|
187
|
-
|
245
|
+
uki.dom.offset.initializeBoxModel();
|
246
|
+
return new uki.background.CssBox(
|
247
|
+
'overflow:visible;',
|
248
|
+
{
|
249
|
+
inset: uki.dom.offset.boxModel ? '0 2 0 0' : '0 0',
|
250
|
+
innerHTML: '<div style="' + uki.browser.css('position:absolute;left:0;overflow:hidden;width:100%;top:50%;height:3px;margin-top:-2px;background:#C6C7CD;border:1px solid #777;border-radius:3px;box-shadow:0 1px 0 rgba(255,255,255,0.5),inset 0 1px 1px rgba(0,0,0,0.2)') + '"></div>'
|
251
|
+
}
|
252
|
+
);
|
188
253
|
},
|
189
254
|
|
190
255
|
// list
|
191
256
|
list: function(rowHeight) {
|
192
257
|
return new uki.background.Rows(rowHeight, '#EDF3FE');
|
193
258
|
},
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
259
|
+
|
260
|
+
// table
|
261
|
+
'table-header': function() {
|
262
|
+
return new uki.background.LinearGradient({
|
263
|
+
startColor: '#FFFFFF',
|
264
|
+
stops: [
|
265
|
+
{ pos: 0.8, color: '#e0e0e0' }
|
266
|
+
],
|
267
|
+
endColor: '#EEEEEE',
|
268
|
+
css: 'border-bottom:1px solid #CCC;'
|
269
|
+
});
|
200
270
|
}
|
201
271
|
},
|
202
272
|
|
203
273
|
images: {
|
204
|
-
'slider-handle': function() {
|
205
|
-
return uki.image(u("slider/handle.gif"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAkCAYAAACwlKv7AAABcUlEQVQ4T7WSy0sCYRRH758b0aKFCwmjB1kwlGEIJQiVvRe6iajIVpGbJArKjWK0GCgq7DE2muJt7kf3cmeaBlz0wVl8Z34Dw3AAvLNbqmIUtIHNo2sk/jr8HNb2K/jV60dCG8gVy9jq9IThsXmDdrQxw2arKySzRYN2mcIpQma7hE/vHYHuYQ5SG8doN9sC3cMcWKsHeP/sCnQPc5BcKWDtoSXwN/qct4GZzA5WbUcgSWhHG5hczP+SwZdpAwkrhxeNN2EivWXQjjYQn13Gcu1VSKTWDdrRBmJTS/6h9zahHW1gdHwBT25fIqENjMTnkND/TcPPTWpDsWmMAgY+AxXedZxQfIXffWIkUriWXLh2UvjlIwpcj3ZSuE/+FB50pvAzGwUuPOhM4aVGX+DCg84UfljvCvyNPseFF6oocOHaSeF7N22BC9dOCs9fuQIXrp0Unq24AheunRSeLjsCF66dFG6df0TiK7xid0L5v8K/AYNKQJdGv2S4AAAAAElFTkSuQmCC");
|
206
|
-
},
|
207
|
-
'slider-focus': function() {
|
208
|
-
if (uki.image.needAlphaFix) {
|
209
|
-
var i = new uki.createElement('div', 'width:12px;height:18px;filter:progid:DXImageTransform.Microsoft.Blur(pixelradius=4);background:#7594D2;');
|
210
|
-
i.width = 20;
|
211
|
-
i.height = 28;
|
212
|
-
return i;
|
213
|
-
}
|
214
|
-
return uki.image(u("slider/focus.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAZCAYAAAA8CX6UAAABUUlEQVQ4y+2VsUoDQRCGVxRFRLQRGxUJETmyd4292IoQm1wRwuVuWx/BxjewDHmGPIAgFkFJvL23cr45MVhli20EFxaW2f//b+afvV1jVmPD3My3evls+yT/3D0uXvcu+4v9Tv52wGRNjD0wYJXza+Szze7tyw7grvs46o0XZ0nlL2xRJ0mxtExdS4w9MIoVDtyfTAicV/ND695P7dhnabm8tmVzlzk/yFwzbKcfENM9wYCFo2KamaSIOhtp6a9S5++zyj/YqnlKXf0sIhMma2LsgQELB66WSb2kqpmoSPNo1gwwYOGoFXim5kndpMzXTODQzIQDFw1DJ9RYqZ/UQ4XAwoGLhlF/pCOYiQ+hQq1/0gDhqk+cEdr73Z1JcGltE4Zw0VChtuX1SAychmfkp3Dg/gv9aaEo5yjayY72r0X7+6PdR9FuyHh3dsRXJMq79gUgPopCCBOTpwAAAABJRU5ErkJggg==");
|
215
|
-
},
|
216
274
|
checkbox: function() {
|
217
275
|
var prefix = "checkbox/normal";
|
218
276
|
return uki.image(u(prefix + ".png"), "data:image/png;base64,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", u(prefix + ".gif"));
|
219
277
|
},
|
220
278
|
'checkbox-focus': function() {
|
221
|
-
if (uki.image.needAlphaFix) {
|
222
|
-
var i = new uki.createElement('div', 'width:18px;height:18px;filter:progid:DXImageTransform.Microsoft.Blur(pixelradius=3);background:#7594D2;');
|
223
|
-
i.width = 26;
|
224
|
-
i.height = 26;
|
225
|
-
return i;
|
226
|
-
}
|
227
279
|
return uki.image(u("checkbox/focus.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABdklEQVRIie2Wv0rDUBSHUxRFRHQRFxWRioTeZHEXVxHqYgaRNrmrj+Ai+AAdi6trH0AQh6K05uYpfBQ934m0EnHQcIuDB+5y7/l9J+dPchMEU2sER8P5VjJY2ExeljY6D8v77dHKbvK4+t3iHD/80aFXzhdLBnPN4/tFBE37vN7qjrbDzO2ZTh6GnbExXRdXl+5zLn74o1O9cOB9xjfY3MmGa8Y+bSGO0vGhSYuT2Lqz2BbnUZpfVBf7nOOn/gQWPRwNMslE0iIyh1HqDiLrTuPMXZqsuI5s3hNQX/Zuq6vcz3v44Y8OPRx4H+UKAmpHevrkCi+ubu5e33660KGHo2WmJ5g2SGpImjzJb+DTIJKJcODB1QBMgTZUakm6dQKghwMPrgbQ+ss00DBqWidA2TNpvPC0DxjzzMiVU1H0a5VI9HDgwZ0EKEdTxk+mo14GMmHCgfcf4I8F8DpF3t8D72+y92+R96+p9/vA/402gzt5Bn8VHu0d2HhIetPffvAAAAAASUVORK5CYII=");
|
228
280
|
},
|
229
281
|
radio: function() {
|
@@ -231,7 +283,6 @@
|
|
231
283
|
return uki.image(u(prefix + ".png"), "data:image/png;base64,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", u(prefix + ".gif"));
|
232
284
|
},
|
233
285
|
'radio-focus': function() {
|
234
|
-
if (uki.image.needAlphaFix) return uki.theme.airport.image('checkbox-focus');
|
235
286
|
return uki.image(u("radio/focus.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABcElEQVRIx92VP0oEMRTGt9ADeAERq21E8ACLNp7AUrRbWdzdDDa6IBhnM5YqaCPCiiewyPzBA1gK1oIsHsNCNL9owBl1HYWM6MBjSPK+7+W99yWp1X7jm5dyrLUVTwTyYqotdb0dJjOdUM86Y8w86/jhX5q82TwZF1JPrkd6rtNPF40tiTBb7qps1Rlj5lnHD39wpchbMp4WKmmIKF0x/+0gSg8DlZ0KlZ05Y8w8669+DXAjgzjy7m68IPrJmoiS/Y29S907vr7fGdw+hOfDJ2eMmWcdP/zBfRqEGpKm3TnkKj3aPLi6kYO7x7fERWMdP/xfcAZveN71hEbZWpKu2RGgUcRFs0HIxODhgS8XADXQMGpK2l/t/KNMbLkMHh74cgGQHKqgcdT2O+TOwIGHB758AKNrpIc6ig0ta+Cs2gwPfLkAHB6rbyPBn5A7Aw8PfP8sgPceeFeR93Pg/SR7v4u836aVvAeVvGiVvMl/7nsGaBHOn+3vxvEAAAAASUVORK5CYII=");
|
236
287
|
}
|
237
288
|
},
|
@@ -251,7 +302,7 @@
|
|
251
302
|
templates: {
|
252
303
|
'table-header-cell': function() {
|
253
304
|
return new uki.theme.Template(
|
254
|
-
'<div style="position:relative;border:1px solid #CCC;
|
305
|
+
'<div style="position:relative;border-right:1px solid #CCC;'+
|
255
306
|
'${style}" class="${className}">${data}</div>');
|
256
307
|
},
|
257
308
|
|
@@ -259,6 +310,18 @@
|
|
259
310
|
return new uki.theme.Template(
|
260
311
|
'<div style="position:relative;border-right:1px solid #CCC;height:100%;'+
|
261
312
|
'${style}" class="${className}">${data}</div>');
|
313
|
+
},
|
314
|
+
|
315
|
+
'table-header-cell-asc': function() {
|
316
|
+
return new uki.theme.Template(
|
317
|
+
'<div style="position:relative;border-right:1px solid #CCC;background: rgba(0,0,128,0.1);'+
|
318
|
+
'${style}" class="${className}"><div style="padding-right:7px">${data}</div><span style="position:absolute;right:0;top:50%;margin-top:-7px;">↓</span></div>');
|
319
|
+
},
|
320
|
+
|
321
|
+
'table-header-cell-desc': function() {
|
322
|
+
return new uki.theme.Template(
|
323
|
+
'<div style="position:relative;border-right:1px solid #CCC;background: rgba(0,0,128,0.1);'+
|
324
|
+
'${style}" class="${className}"><div style="padding-right:7px">${data}</div><span style="position:absolute;right:0;top:50%;margin-top:-7px;">↑</span></div>');
|
262
325
|
}
|
263
326
|
},
|
264
327
|
|
@@ -313,10 +376,10 @@
|
|
313
376
|
return 'font-size:12px;';
|
314
377
|
},
|
315
378
|
'button': function() {
|
316
|
-
return 'color:#333;text-align:center;font-weight:bold;';
|
379
|
+
return 'color:#333;text-align:center;font-weight:bold;text-shadow:0 1px 0 rgba(255,255,255,0.6);';
|
317
380
|
},
|
318
381
|
'input': function() {
|
319
|
-
return 'font-size:
|
382
|
+
return 'font-size:12px;';
|
320
383
|
}
|
321
384
|
}
|
322
385
|
});
|
@@ -341,17 +404,11 @@
|
|
341
404
|
);
|
342
405
|
}
|
343
406
|
|
344
|
-
function
|
345
|
-
|
346
|
-
|
347
|
-
c: [u(prefix + "c.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAYAAABXuSs3AAACzklEQVRo3t2a63KiUBCEPYCX1U2Ixvd/Qm/kYjRBWd2aTjW950CS3fyYtaprULl8p2kGAcMg/QqR6SDTsXk/8moi041Mx+bt3WAKVDVIDOQj0ArcROCbFHzoAGbYTICzLwygC/jc8T62bGccFDKLKLUXeH2625sIpCo2mBa8bkiBWbkpo5oaQMrxFPCJ6ikxkNYAQg90Tiqk5h0DiDmeAoZqqTqIFrxuSB0uSENTQVUHkHJdnVbgN6qYrmkQ6n7U6VygRwY6Eg1pHiyDdcQcx0YZGLCvInxWyx44q+Nwi6Hh8Ng0kTqieTQ2QcCbSDzeCPB40UHqUfYAlvu9Lu0aDD0i0B+iiQnup1wfdLgNdw+mFxEG8CrwZziuB6JCT00zqQyfcn3Q4TZD7y96lrqPwL9HJkiLKygecPcK+tN0Y3VG348lMlnC8bNE5EjuXmGfLnq0+mSf4fujuh6kM8DtCUHfmG6pMry63uc4u83QDwaO+kjwB3U9SD45InD61lSS4PzU4GNxUXCNyYvFAU5XpAcTnOfI/AFeiNuIxhX0TgT3pxKXoge8lpjsyeWdqKLosOs1wIcEzgck3L6Czk0Le1/ad7O/BH826MpgNxdtTTtynQ/UFngh4DNym6HvbfqO4oKcfwYc+UZMdga7FviKss7gdbB45NJNAA637wl8QXFBzsfSz7vAccLZ00EJt9dU4TofpOgup0AbLKSbICYAZiEu3NM/6zh6NmKyFm0oLtxdWo5z/8ZJpiTwpYDPxfGvgsPxrUCvCLyik9J7P1dw7igAB+zStDDw8h+BVwa+MeAVDQDg3FmS4NxR5gTN9TvA1wS9opxrZ+kFL6mbLEnfDb6iqGzJ8f8f3F1UXB6cLtuhyxOQy1O+2x9Zbn/Wur2QcHvp5vZi2e3tCbc3hNzegnN709P1bWaXN/bdPkpx/fDK9eNCtw9oXT8Sd/MnhF+iLpLibpmRrgAAAABJRU5ErkJggg==", u(prefix + "c.gif")],
|
348
|
-
v: [u(prefix + "v.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAECAYAAADxjg1nAAAAWklEQVQYGdXBWwpAQAAAwLEeSUqy9z/hSkpSnh9OsTMFGlSo0aJDjwEjJkREREwYMaBHhxY1KpQIKPxePLhx4cSBHRtWLJiRkJAwY8GKDTsOnLiCTAWZCjL1AeihFg5/1kytAAAAAElFTkSuQmCC", u(prefix + "v.gif")],
|
349
|
-
h: [u(prefix + "h.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAuCAYAAAAPxrguAAAAe0lEQVQoz5XSWwtAQBCG4XEMOST+/y8kOYScKRe8WzZbc7FPX7PNtLaIuPI49l0vUBIewT/LuO/7BRETMRMpExkh/w9KD+WVhBASAu20jnZjFsEkGAQh7ISNsBIWwkwYCT2hI9SEilASiv+g9KgEH6ZhomVi0E47fW7sAEmnGr/QVlzBAAAAAElFTkSuQmCC", u(prefix + "h.gif")],
|
350
|
-
m: [u(prefix + "m.png"), "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAEUlEQVQIHWNgYGD4i4ZJFQAAAkoP0RsgosoAAAAASUVORK5CYII=", u(prefix + "m.gif"), true]
|
351
|
-
};
|
352
|
-
};
|
407
|
+
function sliderPin () {
|
408
|
+
return '<div style="' + uki.browser.css('position:absolute;overflow:hidden;z-index:10;left:50%;top:50%;width:2px;height:11px;margin:-6px 0 0 -1px;background:#8599AE;border-top:1px solid #6A7A8C;') + '"></div>';
|
409
|
+
}
|
353
410
|
|
354
|
-
uki.theme.airport.backgrounds['
|
411
|
+
uki.theme.airport.backgrounds['slider-handle-down'] = uki.theme.airport.backgrounds['slider-handle-hover'];
|
355
412
|
uki.theme.airport.backgrounds['toolbar-popup'] = uki.theme.airport.backgrounds['popup-normal'];
|
356
413
|
uki.theme.airport.backgrounds['toolbar-popup-button-disabled'] = uki.theme.airport.backgrounds['toolbar-popup-button-normal'];
|
357
414
|
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
uki.touch = {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
include('../../uki-core/const.js');
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Global uki constants, for speed optimization and better merging
|
5
|
+
*/
|
6
|
+
/** @ignore */
|
7
|
+
|
8
|
+
// Device sniffing
|
9
|
+
var isWebkit = /webkit/i.test(ua),
|
10
|
+
isIphone = /iphone/i.test(ua)
|
11
|
+
isIpad = /ipad/i.test(ua),
|
12
|
+
isAndroid = /android/i.test(ua),
|
13
|
+
isTouch = isIphone || isIpad || isAndroid,
|
14
|
+
isStandalone = nav.standalone,
|
15
|
+
|
16
|
+
// Event sniffing
|
17
|
+
touchStart = isTouch ? 'touchstart' : 'mousedown',
|
18
|
+
touchMove = isTouch ? 'touchmove' : 'mousemove',
|
19
|
+
touchEnd = isTouch ? 'touchend' : 'mouseup',
|
20
|
+
|
21
|
+
// CSS3 Translate3d helper
|
22
|
+
cssHas3d = ('WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix()),
|
23
|
+
cssTranslateOpen = 'translate' + (cssHas3d ? '3d(' : '('),
|
24
|
+
cssTranslateClose = cssHas3d ? ',0)' : ')';
|
@@ -0,0 +1,52 @@
|
|
1
|
+
include('../touch.js');
|
2
|
+
include('const.js');
|
3
|
+
|
4
|
+
uki.touch.setup = function(config) {
|
5
|
+
if (config && isTouch) {
|
6
|
+
var viewport = uki.createElement('meta');
|
7
|
+
var app = uki.createElement('meta');
|
8
|
+
var statusBar = uki.createElement('meta');
|
9
|
+
var startupScreen = uki.createElement('link');
|
10
|
+
var appIcon = uki.createElement('link');
|
11
|
+
|
12
|
+
var head = document.getElementsByTagName('head')[0];
|
13
|
+
|
14
|
+
viewport.name = 'viewport';
|
15
|
+
viewport.content = 'width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;';
|
16
|
+
|
17
|
+
app.name = 'apple-mobile-web-app-capable'
|
18
|
+
app.content = 'yes';
|
19
|
+
|
20
|
+
if (config.statusBarStyle) {
|
21
|
+
statusBar.name = 'apple-mobile-web-app-status-bar-style'
|
22
|
+
statusBar.content = config.statusBarStyle;
|
23
|
+
}
|
24
|
+
|
25
|
+
if (config.tabletStartupScreen && isIpad) {
|
26
|
+
startupScreen.rel = 'apple-touch-startup-image';
|
27
|
+
startupScreen.href = config.tabletStartupScreen;
|
28
|
+
} else if (config.phoneStartupScreen && isIphone) {
|
29
|
+
startupScreen.rel = 'apple-touch-startup-image';
|
30
|
+
startupScreen.href = config.phoneStartupScreen;
|
31
|
+
}
|
32
|
+
|
33
|
+
if (config.icon) {
|
34
|
+
config.phoneIcon = config.tabletIcon = config.icon;
|
35
|
+
}
|
36
|
+
|
37
|
+
var precomposed = (config.glossOnIcon == false) ? '-precomposed' : '';
|
38
|
+
if (config.tabletIcon && isIpad) {
|
39
|
+
appIcon.rel = 'apple-touch-icon' + precomposed;
|
40
|
+
appIcon.href = config.tabletIcon;
|
41
|
+
} else if (config.phoneIcon && isIphone) {
|
42
|
+
appIcon.rel = 'apple-touch-icon' + precomposed;
|
43
|
+
appIcon.href = config.phoneIcon;
|
44
|
+
}
|
45
|
+
|
46
|
+
head.appendChild(viewport);
|
47
|
+
head.appendChild(app);
|
48
|
+
if (statusBar.getAttribute('name')) head.appendChild(statusBar);
|
49
|
+
if (appIcon.getAttribute('href')) head.appendChild(appIcon);
|
50
|
+
if (startupScreen.getAttribute('href')) head.appendChild(startupScreen);
|
51
|
+
}
|
52
|
+
};
|
@@ -0,0 +1,505 @@
|
|
1
|
+
include('../view.js');
|
2
|
+
include('../const.js');
|
3
|
+
|
4
|
+
// Scroll implementation based on iScroll, http://cubiq.org/iscroll (by Matteo Spinelli)
|
5
|
+
// uki-adapted by rsaccon
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
var TouchScrollBar = function (dir, parent, fade, shrink) {
|
9
|
+
this.dir = dir;
|
10
|
+
this.fade = fade;
|
11
|
+
this.shrink = shrink;
|
12
|
+
this.uid = ++uki.guid;
|
13
|
+
|
14
|
+
// Create main scrollbar
|
15
|
+
this.bar = document.createElement('div');
|
16
|
+
|
17
|
+
var style = 'position:absolute;top:0;left:0;-webkit-transition-timing-function:cubic-bezier(0,0,0.25,1);pointer-events:none;-webkit-transition-duration:0;-webkit-transition-delay:0;-webkit-transition-property:-webkit-transform;z-index:100;background:rgba(0,0,0,0.5);' +
|
18
|
+
'-webkit-transform:' + cssTranslateOpen + '0,0' + cssTranslateClose + ';' +
|
19
|
+
(dir == 'horizontal' ? '-webkit-border-radius:3px 2px;min-width:6px;min-height:5px' : '-webkit-border-radius:2px 3px;min-width:5px;min-height:6px'),
|
20
|
+
size, ctx;
|
21
|
+
|
22
|
+
this.bar.setAttribute('style', style);
|
23
|
+
|
24
|
+
// Create scrollbar wrapper
|
25
|
+
this.wrapper = document.createElement('div');
|
26
|
+
style = '-webkit-mask:-webkit-canvas(scrollbar' + this.uid + this.dir + ');position:absolute;z-index:100;pointer-events:none;overflow:hidden;opacity:0;-webkit-transition-duration:' + (fade ? '300ms' : '0') + ';-webkit-transition-delay:0;-webkit-transition-property:opacity;' +
|
27
|
+
(this.dir == 'horizontal' ? 'bottom:2px;left:1px;right:7px;height:5px' : 'top:1px;right:2px;bottom:7px;width:5px;');
|
28
|
+
this.wrapper.setAttribute('style', style);
|
29
|
+
|
30
|
+
// Add scrollbar to the DOM
|
31
|
+
this.wrapper.appendChild(this.bar);
|
32
|
+
parent.appendChild(this.wrapper);
|
33
|
+
};
|
34
|
+
|
35
|
+
TouchScrollBar.prototype = {
|
36
|
+
init: function (scroll, size) {
|
37
|
+
var ctx, sbSize;
|
38
|
+
|
39
|
+
// Create scrollbar mask
|
40
|
+
if (this.dir == 'horizontal') {
|
41
|
+
sbSize = this.wrapper.offsetWidth;
|
42
|
+
ctx = document.getCSSCanvasContext("2d", "scrollbar" + this.uid + this.dir, sbSize, 5);
|
43
|
+
ctx.fillStyle = "rgb(0,0,0)";
|
44
|
+
ctx.beginPath();
|
45
|
+
ctx.arc(2.5, 2.5, 2.5, Math.PI/2, -Math.PI/2, false);
|
46
|
+
ctx.lineTo(sbSize-2.5, 0);
|
47
|
+
ctx.arc(sbSize-2.5, 2.5, 2.5, -Math.PI/2, Math.PI/2, false);
|
48
|
+
ctx.closePath();
|
49
|
+
ctx.fill();
|
50
|
+
} else {
|
51
|
+
sbSize = this.wrapper.offsetHeight;
|
52
|
+
ctx = document.getCSSCanvasContext("2d", "scrollbar" + this.uid + this.dir, 5, sbSize);
|
53
|
+
ctx.fillStyle = "rgb(0,0,0)";
|
54
|
+
ctx.beginPath();
|
55
|
+
ctx.arc(2.5, 2.5, 2.5, Math.PI, 0, false);
|
56
|
+
ctx.lineTo(5, sbSize-2.5);
|
57
|
+
ctx.arc(2.5, sbSize-2.5, 2.5, 0, Math.PI, false);
|
58
|
+
ctx.closePath();
|
59
|
+
ctx.fill();
|
60
|
+
}
|
61
|
+
|
62
|
+
this.maxSize = this.dir == 'horizontal' ? this.wrapper.clientWidth : this.wrapper.clientHeight;
|
63
|
+
this.size = Math.round(this.maxSize * this.maxSize / size);
|
64
|
+
this.maxScroll = this.maxSize - this.size;
|
65
|
+
this.toWrapperProp = this.maxScroll / (scroll - size);
|
66
|
+
this.bar.style[this.dir == 'horizontal' ? 'width' : 'height'] = this.size + 'px';
|
67
|
+
},
|
68
|
+
|
69
|
+
setPosition: function (pos, hidden) {
|
70
|
+
var p1 = pos;
|
71
|
+
if (!hidden && this.wrapper.style.opacity != '1') {
|
72
|
+
this.show();
|
73
|
+
}
|
74
|
+
|
75
|
+
pos = this.toWrapperProp * pos;
|
76
|
+
|
77
|
+
if (pos < 0) {
|
78
|
+
pos = this.shrink ? pos + pos*3 : 0;
|
79
|
+
if (this.size + pos < 5) {
|
80
|
+
pos = -this.size+5;
|
81
|
+
}
|
82
|
+
} else if (pos > this.maxScroll) {
|
83
|
+
pos = this.shrink ? pos + (pos-this.maxScroll)*3 : this.maxScroll;
|
84
|
+
if (this.size + this.maxScroll - pos < 5) {
|
85
|
+
pos = this.size + this.maxScroll - 5;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
pos = this.dir == 'horizontal'
|
90
|
+
? cssTranslateOpen + Math.round(pos) + 'px,0' + cssTranslateClose
|
91
|
+
: cssTranslateOpen + '0,' + Math.round(pos) + 'px' + cssTranslateClose;
|
92
|
+
|
93
|
+
this.bar.style.webkitTransform = pos;
|
94
|
+
},
|
95
|
+
|
96
|
+
show: function () {
|
97
|
+
if (cssHas3d) {
|
98
|
+
this.wrapper.style.webkitTransitionDelay = '0';
|
99
|
+
}
|
100
|
+
this.wrapper.style.opacity = '1';
|
101
|
+
},
|
102
|
+
|
103
|
+
hide: function () {
|
104
|
+
if (cssHas3d) {
|
105
|
+
this.wrapper.style.webkitTransitionDelay = '200ms';
|
106
|
+
}
|
107
|
+
this.wrapper.style.opacity = '0';
|
108
|
+
},
|
109
|
+
|
110
|
+
remove: function () {
|
111
|
+
this.wrapper.parentNode.removeChild(this.wrapper);
|
112
|
+
return null;
|
113
|
+
}
|
114
|
+
};
|
115
|
+
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Touch scroll pane.
|
119
|
+
* Optimized for webkit browsers.
|
120
|
+
*
|
121
|
+
* @author voloko, rsaccon
|
122
|
+
* @name uki.touch.view.TouchScrollPane
|
123
|
+
* @class
|
124
|
+
* @extends uki.view.Container
|
125
|
+
*/
|
126
|
+
uki.view.declare('uki.touch.view.ScrollPane', uki.view.ScrollPane, function(Base) {
|
127
|
+
|
128
|
+
this._touch = isTouch;
|
129
|
+
|
130
|
+
this._setup = function() {
|
131
|
+
Base._setup.call(this);
|
132
|
+
|
133
|
+
// touch properties
|
134
|
+
this._bounce = cssHas3d;
|
135
|
+
this._momentum = cssHas3d;
|
136
|
+
this._hScrollbar = cssHas3d;
|
137
|
+
this._vScrollbar = cssHas3d;
|
138
|
+
this._fadeScrollBar = isIphone || isIpad || !isTouch;
|
139
|
+
this._shrinkScrollBar = isIphone || isIpad;
|
140
|
+
};
|
141
|
+
|
142
|
+
uki.addProps(this, ['touch']);
|
143
|
+
|
144
|
+
/**
|
145
|
+
* @function
|
146
|
+
* @param {Number} dx
|
147
|
+
* @param {Number} dy
|
148
|
+
* @param {Boolean} runtime
|
149
|
+
* @name uki.view.ScrollPane#scroll
|
150
|
+
*/
|
151
|
+
this.scroll = function(dx, dy, runtime) {
|
152
|
+
if (!this._touch) return Base.scroll.call(this, dx, dy, runtime);
|
153
|
+
|
154
|
+
return this._touchScrollTo(dx, dy, runtime);
|
155
|
+
};
|
156
|
+
|
157
|
+
/**
|
158
|
+
* @function
|
159
|
+
* @name uki.view.ScrollPane#scrollTop
|
160
|
+
*/
|
161
|
+
/**
|
162
|
+
* @function
|
163
|
+
* @name uki.view.ScrollPane#scrollLeft
|
164
|
+
*/
|
165
|
+
uki.each(['scrollTop', 'scrollLeft'], function(i, name) {
|
166
|
+
this[name] = function(v) {
|
167
|
+
if (!this._touch) return Base[name].call(this, v);
|
168
|
+
|
169
|
+
if (v === undefined) return ((name == 'scrollLeft') ? this._x : this._y) || 0;
|
170
|
+
this._touchScrollTo((name == 'scrollTop') ? v : 0, (name == 'scrollLeft') ? v : 0);
|
171
|
+
this.trigger('scroll', { source: this });
|
172
|
+
return this;
|
173
|
+
};
|
174
|
+
}, this);
|
175
|
+
|
176
|
+
this._createDom = function() {
|
177
|
+
Base._createDom.call(this);
|
178
|
+
|
179
|
+
this._touch = this._touch && this._dom.addEventListener; // won't work without it
|
180
|
+
|
181
|
+
if (this._touch) {
|
182
|
+
this._dom.style.overflow = 'hidden';
|
183
|
+
this._scroller = uki.createElement("div", 'z-index:100;-moz-user-focus:none;');
|
184
|
+
this._scroller.className = 'uki-touch-view-ScrollPane__scroller';
|
185
|
+
this._scroller.style.webkitTransitionProperty = '-webkit-transform';
|
186
|
+
this._scroller.style.webkitTransitionTimingFunction = 'cubic-bezier(0,0,0.25,1)';
|
187
|
+
this._scroller.style.webkitTransitionDuration = '0';
|
188
|
+
this._scroller.style.webkitTransform = cssTranslateOpen + '0,0' + cssTranslateClose;
|
189
|
+
this._dom.appendChild(this._scroller);
|
190
|
+
|
191
|
+
this._scroller.addEventListener(touchStart, uki.proxy(this._onTouchStart, this), false);
|
192
|
+
this._scroller.addEventListener(touchMove, uki.proxy(this._onTouchMove, this), false);
|
193
|
+
this._scroller.addEventListener(touchEnd, uki.proxy(this._onTouchEnd, this), false);
|
194
|
+
|
195
|
+
if (!isTouch) {
|
196
|
+
uki.dom.bind(this._scroller, 'click', function(e) {
|
197
|
+
if (!e._fake) e.stopPropagation();
|
198
|
+
});
|
199
|
+
}
|
200
|
+
}
|
201
|
+
};
|
202
|
+
|
203
|
+
this.domForChild = function(child) {
|
204
|
+
return this._touch ? this._scroller : this._dom;
|
205
|
+
};
|
206
|
+
|
207
|
+
this._updateClientRects = function() {
|
208
|
+
if (!this._touch) return Base._updateClientRects.call(this);
|
209
|
+
|
210
|
+
var oldClientRect = this._clientRect;
|
211
|
+
Base._recalcClientRects.call(this);
|
212
|
+
this._scroller.style.width = this.contentsWidth() + 'px';
|
213
|
+
this._scroller.style.height = this.contentsHeight() + 'px';
|
214
|
+
};
|
215
|
+
|
216
|
+
this._layoutDom = function(rect) {
|
217
|
+
if (!this._touch) return Base._layoutDom.call(this, rect);
|
218
|
+
|
219
|
+
this._updateClientRects();
|
220
|
+
uki.view.Container.prototype._layoutDom.call(this, rect);
|
221
|
+
this._refresh();
|
222
|
+
};
|
223
|
+
|
224
|
+
this._onTouchStart = function(e) {
|
225
|
+
var matrix;
|
226
|
+
|
227
|
+
this._isScrolling = true;
|
228
|
+
|
229
|
+
e.preventDefault();
|
230
|
+
e.stopPropagation();
|
231
|
+
|
232
|
+
this._touchMoved = false;
|
233
|
+
this._touchDist = 0;
|
234
|
+
|
235
|
+
this._setTransitionTime('0');
|
236
|
+
|
237
|
+
// Check if the scroller is really where it should be
|
238
|
+
if (this._momentum) {
|
239
|
+
matrix = new WebKitCSSMatrix(window.getComputedStyle(this._scroller).webkitTransform);
|
240
|
+
if (matrix.e != this._x || matrix.f != this._y) {
|
241
|
+
this._scroller.removeEventListener('webkitTransitionEnd', this._onTransitionEnd, false);
|
242
|
+
this._setPosition(matrix.e, matrix.f);
|
243
|
+
this._touchMoved = true;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
this._touchStartX = isTouch ? e.changedTouches[0].pageX : e.pageX;
|
248
|
+
this._scrollStartX = this._x;
|
249
|
+
|
250
|
+
this._touchStartY = isTouch ? e.changedTouches[0].pageY : e.pageY;
|
251
|
+
this._scrollStartY = this._y;
|
252
|
+
|
253
|
+
this._scrollStartTime = e.timeStamp;
|
254
|
+
};
|
255
|
+
|
256
|
+
this._onTouchMove = function(e) {
|
257
|
+
var pageX = isTouch ? e.changedTouches[0].pageX : e.pageX,
|
258
|
+
pageY = isTouch ? e.changedTouches[0].pageY : e.pageY,
|
259
|
+
leftDelta = this._scrollX ? pageX - this._touchStartX : 0,
|
260
|
+
topDelta = this._scrollY ? pageY - this._touchStartY: 0,
|
261
|
+
newX = this._x + leftDelta,
|
262
|
+
newY = this._y + topDelta;
|
263
|
+
|
264
|
+
if (!this._isScrolling) {
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
|
268
|
+
this._touchDist+= Math.abs(this._touchStartX - pageX) + Math.abs(this._touchStartY - pageY);
|
269
|
+
|
270
|
+
this._touchStartX = pageX;
|
271
|
+
this._touchStartY = pageY;
|
272
|
+
|
273
|
+
// Slow down if outside of the boundaries
|
274
|
+
if (newX > 0 || newX < this._maxScrollX) {
|
275
|
+
newX = this._bounce ? Math.round(this._x + leftDelta / 3) : newX >= 0 ? 0 : this._maxScrollX;
|
276
|
+
}
|
277
|
+
if (newY > 0 || newY < this._maxScrollY) {
|
278
|
+
newY = this._bounce ? Math.round(this._y + topDelta / 3) : newY >= 0 ? 0 : this._maxScrollY;
|
279
|
+
}
|
280
|
+
|
281
|
+
if (this._touchDist > 5) { // 5 pixels threshold is needed on Android, but also on iPhone looks more natural
|
282
|
+
this._setPosition(newX, newY);
|
283
|
+
this._touchMoved = true;
|
284
|
+
}
|
285
|
+
};
|
286
|
+
|
287
|
+
this._onTouchEnd = function(e) {
|
288
|
+
var time = e.timeStamp - this._scrollStartTime,
|
289
|
+
target, ev,
|
290
|
+
momentumX, momentumY, newDuration, newPositionX, newPositionY;
|
291
|
+
|
292
|
+
if (!this._isScrolling) {
|
293
|
+
return;
|
294
|
+
}
|
295
|
+
|
296
|
+
this._isScrolling = false;
|
297
|
+
|
298
|
+
if (!this._touchMoved) {
|
299
|
+
this._resetPosition();
|
300
|
+
|
301
|
+
// Find the last touched element
|
302
|
+
target = isTouch ? e.changedTouches[0].target : e.target;
|
303
|
+
while (target.nodeType != 1) {
|
304
|
+
target = target.parentNode;
|
305
|
+
}
|
306
|
+
|
307
|
+
// Create the fake event
|
308
|
+
ev = document.createEvent('Event');
|
309
|
+
ev.initEvent('focus', true, true);
|
310
|
+
target.dispatchEvent(ev);
|
311
|
+
|
312
|
+
ev = document.createEvent('MouseEvents');
|
313
|
+
ev.initMouseEvent("click", true, true, e.view, 1,
|
314
|
+
target.screenX, target.screenY, target.clientX, target.clientY,
|
315
|
+
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
316
|
+
0, null);
|
317
|
+
ev._fake = true;
|
318
|
+
target.dispatchEvent(ev);
|
319
|
+
|
320
|
+
return;
|
321
|
+
}
|
322
|
+
|
323
|
+
if (!this._momentum || time > 250) { // Prevent slingshot effetct
|
324
|
+
this._resetPosition();
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
|
328
|
+
momentumX = this._scrollX === true
|
329
|
+
? this._calcMomentum(this._x - this._scrollStartX,
|
330
|
+
time,
|
331
|
+
this._bounce ? -this._x + this._scrollWidth/5 : -this._x,
|
332
|
+
this._bounce ? this._x + this._scrollerWidth - this._scrollWidth + this._scrollWidth/5 : this._x + this._scrollerWidth - this._scrollWidth)
|
333
|
+
: { dist: 0, time: 0 };
|
334
|
+
|
335
|
+
momentumY = this._scrollY === true
|
336
|
+
? this._calcMomentum(this._y - this._scrollStartY,
|
337
|
+
time,
|
338
|
+
this._bounce ? -this._y + this._scrollHeight/5 : -this._y,
|
339
|
+
this._bounce ? (this._maxScrollY < 0 ? this._y + this._scrollerHeight - this._scrollHeight : 0) + this._scrollHeight/5 : this._y + this._scrollerHeight - this._scrollHeight)
|
340
|
+
: { dist: 0, time: 0 };
|
341
|
+
|
342
|
+
if (!momentumX.dist && !momentumY.dist) {
|
343
|
+
this._resetPosition();
|
344
|
+
return false;
|
345
|
+
}
|
346
|
+
|
347
|
+
newDuration = Math.max(Math.max(momentumX.time, momentumY.time), 1); // The minimum animation length must be 1ms
|
348
|
+
newPositionX = this._x + momentumX.dist;
|
349
|
+
newPositionY = this._y + momentumY.dist;
|
350
|
+
|
351
|
+
this._touchScrollTo(newPositionX, newPositionY, newDuration + 'ms');
|
352
|
+
};
|
353
|
+
|
354
|
+
this._onTransitionEnd = function () {
|
355
|
+
this._scroller.removeEventListener('webkitTransitionEnd', this._onTransitionEnd, false);
|
356
|
+
this._resetPosition();
|
357
|
+
};
|
358
|
+
|
359
|
+
this._refresh = function () {
|
360
|
+
var resetX = this._x, resetY = this._y;
|
361
|
+
|
362
|
+
this._scrollWidth = this._rect.width;
|
363
|
+
this._scrollHeight = this._rect.height;
|
364
|
+
this._scrollerWidth = this.contentsWidth();
|
365
|
+
this._scrollerHeight = this.contentsHeight();
|
366
|
+
this._maxScrollX = this._scrollWidth - this._scrollerWidth;
|
367
|
+
this._maxScrollY = this._scrollHeight - this._scrollerHeight;
|
368
|
+
|
369
|
+
if (this._scrollX) {
|
370
|
+
if (this._maxScrollX >= 0) {
|
371
|
+
resetX = 0;
|
372
|
+
} else if (this._x < this._maxScrollX) {
|
373
|
+
resetX = this._maxScrollX;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
if (this._scrollY) {
|
377
|
+
if (this._maxScrollY >= 0) {
|
378
|
+
resetY = 0;
|
379
|
+
} else if (this._y < this._maxScrollY) {
|
380
|
+
resetY = this._maxScrollY;
|
381
|
+
}
|
382
|
+
}
|
383
|
+
if (resetX!=this._x || resetY!=this._y) {
|
384
|
+
this._setTransitionTime('0');
|
385
|
+
this._setPosition(resetX, resetY, true);
|
386
|
+
}
|
387
|
+
|
388
|
+
this._scrollX = this._scrollerWidth > this._scrollWidth;
|
389
|
+
this._scrollY = !this._scrollX || this._scrollerHeight > this._scrollHeight;
|
390
|
+
|
391
|
+
// Update horizontal scrollbar
|
392
|
+
if (this._hScrollbar && this._scrollX) {
|
393
|
+
this._touchScrollBarH = (this._touchScrollBarH instanceof TouchScrollBar)
|
394
|
+
? this._touchScrollBarH
|
395
|
+
: new TouchScrollBar('horizontal', this._dom, this._fadeScrollBar, this._shrinkScrollBar);
|
396
|
+
this._touchScrollBarH.init(this._scrollWidth, this._scrollerWidth);
|
397
|
+
} else if (this._touchScrollBarH) {
|
398
|
+
this._touchScrollBarH = this._touchScrollBarH.remove();
|
399
|
+
}
|
400
|
+
|
401
|
+
// Update vertical scrollbar
|
402
|
+
if (this._vScrollbar && this._scrollY && this._scrollerHeight > this._scrollHeight) {
|
403
|
+
this._touchScrollBarV = (this._touchScrollBarV instanceof TouchScrollBar)
|
404
|
+
? this._touchScrollBarV
|
405
|
+
: new TouchScrollBar('vertical', this._dom, this._fadeScrollBar, this._shrinkScrollBar);
|
406
|
+
this._touchScrollBarV.init(this._scrollHeight, this._scrollerHeight);
|
407
|
+
} else if (this._touchScrollBarV) {
|
408
|
+
this._touchScrollBarV = this._touchScrollBarV.remove();
|
409
|
+
}
|
410
|
+
};
|
411
|
+
|
412
|
+
this._setPosition = function (x, y, hideScrollBars) {
|
413
|
+
this._x = x;
|
414
|
+
this._y = y;
|
415
|
+
|
416
|
+
this._scroller.style.webkitTransform = cssTranslateOpen + this._x + 'px,' + this._y + 'px' + cssTranslateClose;
|
417
|
+
|
418
|
+
// Move the scrollbars
|
419
|
+
if (!hideScrollBars) {
|
420
|
+
if (this._touchScrollBarH) {
|
421
|
+
this._touchScrollBarH.setPosition(this._x);
|
422
|
+
}
|
423
|
+
if (this._touchScrollBarV) {
|
424
|
+
this._touchScrollBarV.setPosition(this._y);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
};
|
428
|
+
|
429
|
+
this._setTransitionTime = function(time) {
|
430
|
+
time = time || '0';
|
431
|
+
this._scroller.style.webkitTransitionDuration = time;
|
432
|
+
|
433
|
+
if (this._touchScrollBarH) {
|
434
|
+
this._touchScrollBarH.bar.style.webkitTransitionDuration = time;
|
435
|
+
this._touchScrollBarH.wrapper.style.webkitTransitionDuration = cssHas3d && this._fadeScrollBar ? '300ms' : '0';
|
436
|
+
}
|
437
|
+
if (this._touchScrollBarV) {
|
438
|
+
this._touchScrollBarV.bar.style.webkitTransitionDuration = time;
|
439
|
+
this._touchScrollBarV.wrapper.style.webkitTransitionDuration = cssHas3d && this._fadeScrollBar ? '300ms' : '0';
|
440
|
+
}
|
441
|
+
};
|
442
|
+
|
443
|
+
this._resetPosition = function (time) {
|
444
|
+
var resetX = this._x,
|
445
|
+
resetY = this._y,
|
446
|
+
time = time || '500ms';
|
447
|
+
|
448
|
+
if (this._x >= 0) {
|
449
|
+
resetX = 0;
|
450
|
+
} else if (this._x < this._maxScrollX) {
|
451
|
+
resetX = this._maxScrollX;
|
452
|
+
}
|
453
|
+
|
454
|
+
if (this._y >= 0 || this._maxScrollY > 0) {
|
455
|
+
resetY = 0;
|
456
|
+
} else if (this._y < this._maxScrollY) {
|
457
|
+
resetY = this._maxScrollY;
|
458
|
+
}
|
459
|
+
|
460
|
+
if (resetX != this._x || resetY !=this._y) {
|
461
|
+
this._touchScrollTo (resetX, resetY, time);
|
462
|
+
} else {
|
463
|
+
if (this._touchScrollBarH) {
|
464
|
+
this._touchScrollBarH.hide();
|
465
|
+
}
|
466
|
+
if (this._touchScrollBarV) {
|
467
|
+
this._touchScrollBarV.hide();
|
468
|
+
}
|
469
|
+
}
|
470
|
+
};
|
471
|
+
|
472
|
+
this._touchScrollTo = function (destX, destY, runtime) {
|
473
|
+
this._setTransitionTime(runtime || '450ms');
|
474
|
+
this._setPosition(destX, destY);
|
475
|
+
|
476
|
+
if (runtime==='0' || runtime=='0s' || runtime=='0ms') {
|
477
|
+
this._resetPosition();
|
478
|
+
} else {
|
479
|
+
this._scroller.addEventListener('webkitTransitionEnd', uki.proxy(this._onTransitionEnd, this), false);
|
480
|
+
}
|
481
|
+
};
|
482
|
+
|
483
|
+
this._calcMomentum = function (dist, time, maxDistUpper, maxDistLower) {
|
484
|
+
var friction = 2.5,
|
485
|
+
deceleration = 1.2,
|
486
|
+
speed = Math.abs(dist) / time * 1000,
|
487
|
+
newDist = speed * speed / friction / 1000,
|
488
|
+
newTime = 0;
|
489
|
+
|
490
|
+
// Proportinally reduce speed if we are outside of the boundaries
|
491
|
+
if (dist > 0 && newDist > maxDistUpper) {
|
492
|
+
speed = speed * maxDistUpper / newDist / friction;
|
493
|
+
newDist = maxDistUpper;
|
494
|
+
} else if (dist < 0 && newDist > maxDistLower) {
|
495
|
+
speed = speed * maxDistLower / newDist / friction;
|
496
|
+
newDist = maxDistLower;
|
497
|
+
}
|
498
|
+
|
499
|
+
newDist = newDist * (dist < 0 ? -1 : 1);
|
500
|
+
newTime = speed / deceleration;
|
501
|
+
|
502
|
+
return { dist: Math.round(newDist), time: Math.round(newTime) };
|
503
|
+
};
|
504
|
+
});
|
505
|
+
})();
|