uikit-sass-rails 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -12
- data/lib/uikit/sass/rails/engine.rb +1 -1
- data/lib/uikit/sass/rails/version.rb +1 -1
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +30 -3
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
- data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
- data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
- data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
- data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
- data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
- data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
- data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
- data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
- data/vendor/assets/javascripts/uikit/components/search.js +19 -16
- data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
- data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
- data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
- data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/button.js +154 -0
- data/vendor/assets/javascripts/uikit/core/core.js +717 -0
- data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
- data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
- data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
- data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
- data/vendor/assets/stylesheets/uikit.scss +22 -1
- data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
- data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
- data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
- data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
- data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
- data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
- metadata +92 -7
- data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
- data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
- data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
@@ -0,0 +1,323 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var active = false, $html = UI.$html, body;
|
7
|
+
|
8
|
+
UI.component('modal', {
|
9
|
+
|
10
|
+
defaults: {
|
11
|
+
keyboard: true,
|
12
|
+
bgclose: true,
|
13
|
+
minScrollHeight: 150,
|
14
|
+
center: false
|
15
|
+
},
|
16
|
+
|
17
|
+
scrollable: false,
|
18
|
+
transition: false,
|
19
|
+
|
20
|
+
init: function() {
|
21
|
+
|
22
|
+
if (!body) body = UI.$('body');
|
23
|
+
|
24
|
+
if (!this.element.length) return;
|
25
|
+
|
26
|
+
var $this = this;
|
27
|
+
|
28
|
+
this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
|
29
|
+
this.dialog = this.find(".uk-modal-dialog");
|
30
|
+
|
31
|
+
// Update ARIA
|
32
|
+
this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
|
33
|
+
|
34
|
+
this.on("click", ".uk-modal-close", function(e) {
|
35
|
+
e.preventDefault();
|
36
|
+
$this.hide();
|
37
|
+
}).on("click", function(e) {
|
38
|
+
|
39
|
+
var target = UI.$(e.target);
|
40
|
+
|
41
|
+
if (target[0] == $this.element[0] && $this.options.bgclose) {
|
42
|
+
$this.hide();
|
43
|
+
}
|
44
|
+
});
|
45
|
+
},
|
46
|
+
|
47
|
+
toggle: function() {
|
48
|
+
return this[this.isActive() ? "hide" : "show"]();
|
49
|
+
},
|
50
|
+
|
51
|
+
show: function() {
|
52
|
+
|
53
|
+
if (!this.element.length) return;
|
54
|
+
|
55
|
+
var $this = this;
|
56
|
+
|
57
|
+
if (this.isActive()) return;
|
58
|
+
if (active) active.hide(true);
|
59
|
+
|
60
|
+
this.element.removeClass("uk-open").show();
|
61
|
+
this.resize();
|
62
|
+
active = this;
|
63
|
+
|
64
|
+
this.element.addClass("uk-open");
|
65
|
+
|
66
|
+
$html.addClass("uk-modal-page").height(); // force browser engine redraw
|
67
|
+
|
68
|
+
// Update ARIA
|
69
|
+
this.element.attr('aria-hidden', 'false');
|
70
|
+
|
71
|
+
this.element.trigger("show.uk.modal");
|
72
|
+
|
73
|
+
UI.Utils.checkDisplay(this.dialog, true);
|
74
|
+
|
75
|
+
return this;
|
76
|
+
},
|
77
|
+
|
78
|
+
hide: function(force) {
|
79
|
+
|
80
|
+
if (!this.isActive()) return;
|
81
|
+
|
82
|
+
if (!force && UI.support.transition) {
|
83
|
+
|
84
|
+
var $this = this;
|
85
|
+
|
86
|
+
this.one(UI.support.transition.end, function() {
|
87
|
+
$this._hide();
|
88
|
+
}).removeClass("uk-open");
|
89
|
+
|
90
|
+
} else {
|
91
|
+
|
92
|
+
this._hide();
|
93
|
+
}
|
94
|
+
|
95
|
+
return this;
|
96
|
+
},
|
97
|
+
|
98
|
+
resize: function() {
|
99
|
+
|
100
|
+
var bodywidth = body.width();
|
101
|
+
|
102
|
+
this.scrollbarwidth = window.innerWidth - bodywidth;
|
103
|
+
|
104
|
+
body.css(this.paddingdir, this.scrollbarwidth);
|
105
|
+
|
106
|
+
this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
|
107
|
+
|
108
|
+
if (!this.updateScrollable() && this.options.center) {
|
109
|
+
|
110
|
+
var dh = this.dialog.outerHeight(),
|
111
|
+
pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
|
112
|
+
|
113
|
+
if ((dh + pad) < window.innerHeight) {
|
114
|
+
this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
|
115
|
+
} else {
|
116
|
+
this.dialog.css({'top': ''});
|
117
|
+
}
|
118
|
+
}
|
119
|
+
},
|
120
|
+
|
121
|
+
updateScrollable: function() {
|
122
|
+
|
123
|
+
// has scrollable?
|
124
|
+
var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
|
125
|
+
|
126
|
+
if (scrollable.length) {
|
127
|
+
|
128
|
+
scrollable.css("height", 0);
|
129
|
+
|
130
|
+
var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
|
131
|
+
dh = this.dialog.outerHeight(),
|
132
|
+
wh = window.innerHeight,
|
133
|
+
h = wh - 2*(offset < 20 ? 20:offset) - dh;
|
134
|
+
|
135
|
+
scrollable.css("height", h < this.options.minScrollHeight ? "":h);
|
136
|
+
|
137
|
+
return true;
|
138
|
+
}
|
139
|
+
|
140
|
+
return false;
|
141
|
+
},
|
142
|
+
|
143
|
+
_hide: function() {
|
144
|
+
|
145
|
+
this.element.hide().removeClass("uk-open");
|
146
|
+
|
147
|
+
// Update ARIA
|
148
|
+
this.element.attr('aria-hidden', 'true');
|
149
|
+
|
150
|
+
$html.removeClass("uk-modal-page");
|
151
|
+
|
152
|
+
body.css(this.paddingdir, "");
|
153
|
+
|
154
|
+
if(active===this) active = false;
|
155
|
+
|
156
|
+
this.trigger("hide.uk.modal");
|
157
|
+
},
|
158
|
+
|
159
|
+
isActive: function() {
|
160
|
+
return (active == this);
|
161
|
+
}
|
162
|
+
|
163
|
+
});
|
164
|
+
|
165
|
+
UI.component('modalTrigger', {
|
166
|
+
|
167
|
+
boot: function() {
|
168
|
+
|
169
|
+
// init code
|
170
|
+
UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
|
171
|
+
|
172
|
+
var ele = UI.$(this);
|
173
|
+
|
174
|
+
if (ele.is("a")) {
|
175
|
+
e.preventDefault();
|
176
|
+
}
|
177
|
+
|
178
|
+
if (!ele.data("modalTrigger")) {
|
179
|
+
var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
|
180
|
+
modal.show();
|
181
|
+
}
|
182
|
+
|
183
|
+
});
|
184
|
+
|
185
|
+
// close modal on esc button
|
186
|
+
UI.$html.on('keydown.modal.uikit', function (e) {
|
187
|
+
|
188
|
+
if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
|
189
|
+
e.preventDefault();
|
190
|
+
active.hide();
|
191
|
+
}
|
192
|
+
});
|
193
|
+
|
194
|
+
UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
|
195
|
+
if (active) active.resize();
|
196
|
+
}, 150));
|
197
|
+
},
|
198
|
+
|
199
|
+
init: function() {
|
200
|
+
|
201
|
+
var $this = this;
|
202
|
+
|
203
|
+
this.options = UI.$.extend({
|
204
|
+
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
205
|
+
}, this.options);
|
206
|
+
|
207
|
+
this.modal = UI.modal(this.options.target, this.options);
|
208
|
+
|
209
|
+
this.on("click", function(e) {
|
210
|
+
e.preventDefault();
|
211
|
+
$this.show();
|
212
|
+
});
|
213
|
+
|
214
|
+
//methods
|
215
|
+
this.proxy(this.modal, "show hide isActive");
|
216
|
+
}
|
217
|
+
});
|
218
|
+
|
219
|
+
UI.modal.dialog = function(content, options) {
|
220
|
+
|
221
|
+
var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
|
222
|
+
|
223
|
+
modal.on("hide.uk.modal", function(){
|
224
|
+
if (modal.persist) {
|
225
|
+
modal.persist.appendTo(modal.persist.data("modalPersistParent"));
|
226
|
+
modal.persist = false;
|
227
|
+
}
|
228
|
+
modal.element.remove();
|
229
|
+
});
|
230
|
+
|
231
|
+
setContent(content, modal);
|
232
|
+
|
233
|
+
return modal;
|
234
|
+
};
|
235
|
+
|
236
|
+
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
237
|
+
|
238
|
+
UI.modal.alert = function(content, options) {
|
239
|
+
|
240
|
+
UI.modal.dialog(([
|
241
|
+
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
242
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
|
243
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options)).show();
|
244
|
+
};
|
245
|
+
|
246
|
+
UI.modal.confirm = function(content, onconfirm, options) {
|
247
|
+
|
248
|
+
onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
|
249
|
+
|
250
|
+
var modal = UI.modal.dialog(([
|
251
|
+
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
252
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary js-modal-confirm">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
|
253
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options));
|
254
|
+
|
255
|
+
modal.element.find(".js-modal-confirm").on("click", function(){
|
256
|
+
onconfirm();
|
257
|
+
modal.hide();
|
258
|
+
});
|
259
|
+
|
260
|
+
modal.show();
|
261
|
+
};
|
262
|
+
|
263
|
+
UI.modal.prompt = function(text, value, onsubmit, options) {
|
264
|
+
|
265
|
+
onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
|
266
|
+
|
267
|
+
var modal = UI.modal.dialog(([
|
268
|
+
text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
|
269
|
+
'<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
|
270
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary js-modal-ok">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
|
271
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options)),
|
272
|
+
input = modal.element.find("input[type='text']").val(value || '');
|
273
|
+
|
274
|
+
modal.element.find(".js-modal-ok").on("click", function(){
|
275
|
+
if (onsubmit(input.val())!==false){
|
276
|
+
modal.hide();
|
277
|
+
}
|
278
|
+
});
|
279
|
+
modal.show();
|
280
|
+
setTimeout(function(){ input.focus(); }, 100);
|
281
|
+
};
|
282
|
+
|
283
|
+
UI.modal.blockUI = function(content, options) {
|
284
|
+
|
285
|
+
var modal = UI.modal.dialog(([
|
286
|
+
'<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
|
287
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options));
|
288
|
+
|
289
|
+
modal.content = modal.element.find('.uk-modal-content:first');
|
290
|
+
modal.show();
|
291
|
+
|
292
|
+
return modal;
|
293
|
+
};
|
294
|
+
|
295
|
+
|
296
|
+
// helper functions
|
297
|
+
function setContent(content, modal){
|
298
|
+
|
299
|
+
if(!modal) return;
|
300
|
+
|
301
|
+
if (typeof content === 'object') {
|
302
|
+
|
303
|
+
// convert DOM object to a jQuery object
|
304
|
+
content = content instanceof jQuery ? content : UI.$(content);
|
305
|
+
|
306
|
+
if(content.parent().length) {
|
307
|
+
modal.persist = content;
|
308
|
+
modal.persist.data("modalPersistParent", content.parent());
|
309
|
+
}
|
310
|
+
}else if (typeof content === 'string' || typeof content === 'number') {
|
311
|
+
// just insert the data as innerHTML
|
312
|
+
content = UI.$('<div></div>').html(content);
|
313
|
+
}else {
|
314
|
+
// unsupported data type!
|
315
|
+
content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
|
316
|
+
}
|
317
|
+
|
318
|
+
content.appendTo(modal.element.find('.uk-modal-dialog'));
|
319
|
+
|
320
|
+
return modal;
|
321
|
+
}
|
322
|
+
|
323
|
+
})(UIkit);
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
UI.component('nav', {
|
7
|
+
|
8
|
+
defaults: {
|
9
|
+
"toggle": ">li.uk-parent > a[href='#']",
|
10
|
+
"lists": ">li.uk-parent > ul",
|
11
|
+
"multiple": false
|
12
|
+
},
|
13
|
+
|
14
|
+
boot: function() {
|
15
|
+
|
16
|
+
// init code
|
17
|
+
UI.ready(function(context) {
|
18
|
+
|
19
|
+
UI.$("[data-uk-nav]", context).each(function() {
|
20
|
+
var nav = UI.$(this);
|
21
|
+
|
22
|
+
if (!nav.data("nav")) {
|
23
|
+
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
|
24
|
+
}
|
25
|
+
});
|
26
|
+
});
|
27
|
+
},
|
28
|
+
|
29
|
+
init: function() {
|
30
|
+
|
31
|
+
var $this = this;
|
32
|
+
|
33
|
+
this.on("click.uikit.nav", this.options.toggle, function(e) {
|
34
|
+
e.preventDefault();
|
35
|
+
var ele = UI.$(this);
|
36
|
+
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
|
37
|
+
});
|
38
|
+
|
39
|
+
this.find(this.options.lists).each(function() {
|
40
|
+
var $ele = UI.$(this),
|
41
|
+
parent = $ele.parent(),
|
42
|
+
active = parent.hasClass("uk-active");
|
43
|
+
|
44
|
+
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
|
45
|
+
parent.data("list-container", $ele.parent());
|
46
|
+
|
47
|
+
// Init ARIA
|
48
|
+
parent.attr('aria-expanded', parent.hasClass("uk-open"));
|
49
|
+
|
50
|
+
if (active) $this.open(parent, true);
|
51
|
+
});
|
52
|
+
|
53
|
+
},
|
54
|
+
|
55
|
+
open: function(li, noanimation) {
|
56
|
+
|
57
|
+
var $this = this, element = this.element, $li = UI.$(li);
|
58
|
+
|
59
|
+
if (!this.options.multiple) {
|
60
|
+
|
61
|
+
element.children(".uk-open").not(li).each(function() {
|
62
|
+
|
63
|
+
var ele = UI.$(this);
|
64
|
+
|
65
|
+
if (ele.data("list-container")) {
|
66
|
+
ele.data("list-container").stop().animate({height: 0}, function() {
|
67
|
+
UI.$(this).parent().removeClass("uk-open");
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
$li.toggleClass("uk-open");
|
74
|
+
|
75
|
+
// Update ARIA
|
76
|
+
$li.attr('aria-expanded', $li.hasClass("uk-open"));
|
77
|
+
|
78
|
+
if ($li.data("list-container")) {
|
79
|
+
|
80
|
+
if (noanimation) {
|
81
|
+
$li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
|
82
|
+
this.trigger("display.uk.check");
|
83
|
+
} else {
|
84
|
+
$li.data('list-container').stop().animate({
|
85
|
+
height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
|
86
|
+
}, function() {
|
87
|
+
$this.trigger("display.uk.check");
|
88
|
+
});
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
});
|
93
|
+
|
94
|
+
|
95
|
+
// helper
|
96
|
+
|
97
|
+
function getHeight(ele) {
|
98
|
+
var $ele = UI.$(ele), height = "auto";
|
99
|
+
|
100
|
+
if ($ele.is(":visible")) {
|
101
|
+
height = $ele.outerHeight();
|
102
|
+
} else {
|
103
|
+
var tmp = {
|
104
|
+
position: $ele.css("position"),
|
105
|
+
visibility: $ele.css("visibility"),
|
106
|
+
display: $ele.css("display")
|
107
|
+
};
|
108
|
+
|
109
|
+
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
110
|
+
|
111
|
+
$ele.css(tmp); // reset element
|
112
|
+
}
|
113
|
+
|
114
|
+
return height;
|
115
|
+
}
|
116
|
+
|
117
|
+
})(UIkit);
|
@@ -0,0 +1,178 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var scrollpos = {x: window.scrollX, y: window.scrollY},
|
7
|
+
$win = UI.$win,
|
8
|
+
$doc = UI.$doc,
|
9
|
+
$html = UI.$html,
|
10
|
+
Offcanvas = {
|
11
|
+
|
12
|
+
show: function(element) {
|
13
|
+
|
14
|
+
element = UI.$(element);
|
15
|
+
|
16
|
+
if (!element.length) return;
|
17
|
+
|
18
|
+
var $body = UI.$('body'),
|
19
|
+
bar = element.find(".uk-offcanvas-bar:first"),
|
20
|
+
rtl = (UI.langdirection == "right"),
|
21
|
+
flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
|
22
|
+
dir = flip * (rtl ? -1 : 1);
|
23
|
+
|
24
|
+
scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
|
25
|
+
|
26
|
+
element.addClass("uk-active");
|
27
|
+
|
28
|
+
$body.css({"width": window.innerWidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
|
29
|
+
$body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
|
30
|
+
|
31
|
+
$html.css('margin-top', scrollpos.y * -1);
|
32
|
+
|
33
|
+
bar.addClass("uk-offcanvas-bar-show");
|
34
|
+
|
35
|
+
this._initElement(element);
|
36
|
+
|
37
|
+
bar.trigger('show.uk.offcanvas', [element, bar]);
|
38
|
+
|
39
|
+
// Update ARIA
|
40
|
+
element.attr('aria-hidden', 'false');
|
41
|
+
},
|
42
|
+
|
43
|
+
hide: function(force) {
|
44
|
+
|
45
|
+
var $body = UI.$('body'),
|
46
|
+
panel = UI.$(".uk-offcanvas.uk-active"),
|
47
|
+
rtl = (UI.langdirection == "right"),
|
48
|
+
bar = panel.find(".uk-offcanvas-bar:first"),
|
49
|
+
finalize = function() {
|
50
|
+
$body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
|
51
|
+
panel.removeClass("uk-active");
|
52
|
+
|
53
|
+
bar.removeClass("uk-offcanvas-bar-show");
|
54
|
+
$html.css('margin-top', '');
|
55
|
+
window.scrollTo(scrollpos.x, scrollpos.y);
|
56
|
+
bar.trigger('hide.uk.offcanvas', [panel, bar]);
|
57
|
+
|
58
|
+
// Update ARIA
|
59
|
+
panel.attr('aria-hidden', 'true');
|
60
|
+
};
|
61
|
+
|
62
|
+
if (!panel.length) return;
|
63
|
+
|
64
|
+
if (UI.support.transition && !force) {
|
65
|
+
|
66
|
+
$body.one(UI.support.transition.end, function() {
|
67
|
+
finalize();
|
68
|
+
}).css((rtl ? "margin-right" : "margin-left"), "");
|
69
|
+
|
70
|
+
setTimeout(function(){
|
71
|
+
bar.removeClass("uk-offcanvas-bar-show");
|
72
|
+
}, 0);
|
73
|
+
|
74
|
+
} else {
|
75
|
+
finalize();
|
76
|
+
}
|
77
|
+
},
|
78
|
+
|
79
|
+
_initElement: function(element) {
|
80
|
+
|
81
|
+
if (element.data("OffcanvasInit")) return;
|
82
|
+
|
83
|
+
element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) {
|
84
|
+
|
85
|
+
var target = UI.$(e.target);
|
86
|
+
|
87
|
+
if (!e.type.match(/swipe/)) {
|
88
|
+
|
89
|
+
if (!target.hasClass("uk-offcanvas-close")) {
|
90
|
+
if (target.hasClass("uk-offcanvas-bar")) return;
|
91
|
+
if (target.parents(".uk-offcanvas-bar:first").length) return;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
e.stopImmediatePropagation();
|
96
|
+
Offcanvas.hide();
|
97
|
+
});
|
98
|
+
|
99
|
+
element.on("click", "a[href^='#']", function(e){
|
100
|
+
|
101
|
+
var link = UI.$(this),
|
102
|
+
href = link.attr("href");
|
103
|
+
|
104
|
+
if (href == "#") {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
|
108
|
+
UI.$doc.one('hide.uk.offcanvas', function() {
|
109
|
+
|
110
|
+
var target;
|
111
|
+
|
112
|
+
try {
|
113
|
+
target = UI.$(href);
|
114
|
+
} catch (e){
|
115
|
+
target = ""
|
116
|
+
}
|
117
|
+
|
118
|
+
if (!target.length) {
|
119
|
+
target = UI.$('[name="'+href.replace('#','')+'"]');
|
120
|
+
}
|
121
|
+
|
122
|
+
if (target.length && link.attr('data-uk-smooth-scroll') && UI.Utils.scrollToElement) {
|
123
|
+
UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
|
124
|
+
} else {
|
125
|
+
window.location.href = href;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
|
129
|
+
Offcanvas.hide();
|
130
|
+
});
|
131
|
+
|
132
|
+
element.data("OffcanvasInit", true);
|
133
|
+
}
|
134
|
+
};
|
135
|
+
|
136
|
+
UI.component('offcanvasTrigger', {
|
137
|
+
|
138
|
+
boot: function() {
|
139
|
+
|
140
|
+
// init code
|
141
|
+
$html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
|
142
|
+
|
143
|
+
e.preventDefault();
|
144
|
+
|
145
|
+
var ele = UI.$(this);
|
146
|
+
|
147
|
+
if (!ele.data("offcanvasTrigger")) {
|
148
|
+
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
|
149
|
+
ele.trigger("click");
|
150
|
+
}
|
151
|
+
});
|
152
|
+
|
153
|
+
$html.on('keydown.uk.offcanvas', function(e) {
|
154
|
+
|
155
|
+
if (e.keyCode === 27) { // ESC
|
156
|
+
Offcanvas.hide();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
},
|
160
|
+
|
161
|
+
init: function() {
|
162
|
+
|
163
|
+
var $this = this;
|
164
|
+
|
165
|
+
this.options = UI.$.extend({
|
166
|
+
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
167
|
+
}, this.options);
|
168
|
+
|
169
|
+
this.on("click", function(e) {
|
170
|
+
e.preventDefault();
|
171
|
+
Offcanvas.show($this.options.target);
|
172
|
+
});
|
173
|
+
}
|
174
|
+
});
|
175
|
+
|
176
|
+
UI.offcanvas = Offcanvas;
|
177
|
+
|
178
|
+
})(UIkit);
|