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,157 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var stacks = [];
|
7
|
+
|
8
|
+
UI.component('stackMargin', {
|
9
|
+
|
10
|
+
defaults: {
|
11
|
+
'cls': 'uk-margin-small-top'
|
12
|
+
},
|
13
|
+
|
14
|
+
boot: function() {
|
15
|
+
|
16
|
+
// init code
|
17
|
+
UI.ready(function(context) {
|
18
|
+
|
19
|
+
UI.$("[data-uk-margin]", context).each(function() {
|
20
|
+
|
21
|
+
var ele = UI.$(this), obj;
|
22
|
+
|
23
|
+
if (!ele.data("stackMargin")) {
|
24
|
+
obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
},
|
29
|
+
|
30
|
+
init: function() {
|
31
|
+
|
32
|
+
var $this = this;
|
33
|
+
|
34
|
+
this.columns = this.element.children();
|
35
|
+
|
36
|
+
if (!this.columns.length) return;
|
37
|
+
|
38
|
+
UI.$win.on('resize orientationchange', (function() {
|
39
|
+
|
40
|
+
var fn = function() {
|
41
|
+
$this.process();
|
42
|
+
};
|
43
|
+
|
44
|
+
UI.$(function() {
|
45
|
+
fn();
|
46
|
+
UI.$win.on("load", fn);
|
47
|
+
});
|
48
|
+
|
49
|
+
return UI.Utils.debounce(fn, 20);
|
50
|
+
})());
|
51
|
+
|
52
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
53
|
+
$this.columns = $this.element.children();
|
54
|
+
$this.process();
|
55
|
+
});
|
56
|
+
|
57
|
+
this.on("display.uk.check", function(e) {
|
58
|
+
$this.columns = $this.element.children();
|
59
|
+
if (this.element.is(":visible")) this.process();
|
60
|
+
}.bind(this));
|
61
|
+
|
62
|
+
stacks.push(this);
|
63
|
+
},
|
64
|
+
|
65
|
+
process: function() {
|
66
|
+
|
67
|
+
var $this = this;
|
68
|
+
|
69
|
+
UI.Utils.stackMargin(this.columns, this.options);
|
70
|
+
|
71
|
+
return this;
|
72
|
+
},
|
73
|
+
|
74
|
+
revert: function() {
|
75
|
+
this.columns.removeClass(this.options.cls);
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
});
|
79
|
+
|
80
|
+
// responsive iframes
|
81
|
+
UI.ready((function(){
|
82
|
+
|
83
|
+
var iframes = [], check = function() {
|
84
|
+
|
85
|
+
iframes.forEach(function(iframe){
|
86
|
+
|
87
|
+
if (!iframe.is(':visible')) return;
|
88
|
+
|
89
|
+
var width = iframe.parent().width(),
|
90
|
+
iwidth = iframe.data('width'),
|
91
|
+
ratio = (width / iwidth),
|
92
|
+
height = Math.floor(ratio * iframe.data('height'));
|
93
|
+
|
94
|
+
iframe.css({'height': (width < iwidth) ? height : iframe.data('height')});
|
95
|
+
});
|
96
|
+
};
|
97
|
+
|
98
|
+
UI.$win.on('resize', UI.Utils.debounce(check, 15));
|
99
|
+
|
100
|
+
return function(context){
|
101
|
+
|
102
|
+
UI.$('iframe.uk-responsive-width', context).each(function(){
|
103
|
+
|
104
|
+
var iframe = UI.$(this);
|
105
|
+
|
106
|
+
if (!iframe.data('responsive') && iframe.attr('width') && iframe.attr('height')) {
|
107
|
+
|
108
|
+
iframe.data('width' , iframe.attr('width'));
|
109
|
+
iframe.data('height' , iframe.attr('height'));
|
110
|
+
iframe.data('responsive', true);
|
111
|
+
iframes.push(iframe);
|
112
|
+
}
|
113
|
+
});
|
114
|
+
|
115
|
+
check();
|
116
|
+
};
|
117
|
+
|
118
|
+
})());
|
119
|
+
|
120
|
+
|
121
|
+
// helper
|
122
|
+
|
123
|
+
UI.Utils.stackMargin = function(elements, options) {
|
124
|
+
|
125
|
+
options = UI.$.extend({
|
126
|
+
'cls': 'uk-margin-small-top'
|
127
|
+
}, options);
|
128
|
+
|
129
|
+
options.cls = options.cls;
|
130
|
+
|
131
|
+
elements = UI.$(elements).removeClass(options.cls);
|
132
|
+
|
133
|
+
var skip = false,
|
134
|
+
firstvisible = elements.filter(":visible:first"),
|
135
|
+
offset = firstvisible.length ? (firstvisible.position().top + firstvisible.outerHeight()) - 1 : false; // (-1): weird firefox bug when parent container is display:flex
|
136
|
+
|
137
|
+
if (offset === false) return;
|
138
|
+
|
139
|
+
elements.each(function() {
|
140
|
+
|
141
|
+
var column = UI.$(this);
|
142
|
+
|
143
|
+
if (column.is(":visible")) {
|
144
|
+
|
145
|
+
if (skip) {
|
146
|
+
column.addClass(options.cls);
|
147
|
+
} else {
|
148
|
+
|
149
|
+
if (column.position().top >= offset) {
|
150
|
+
skip = column.addClass(options.cls);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
});
|
155
|
+
};
|
156
|
+
|
157
|
+
})(UIkit);
|
@@ -1,10 +1,10 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(core) {
|
3
3
|
|
4
4
|
if (typeof define == "function" && define.amd) { // AMD
|
5
5
|
define("uikit", function(){
|
6
6
|
|
7
|
-
var uikit = core(window, window.jQuery, window.document);
|
7
|
+
var uikit = window.UIkit || core(window, window.jQuery, window.document);
|
8
8
|
|
9
9
|
uikit.load = function(res, req, onload, config) {
|
10
10
|
|
@@ -41,33 +41,31 @@
|
|
41
41
|
|
42
42
|
"use strict";
|
43
43
|
|
44
|
-
var UI =
|
44
|
+
var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
|
45
45
|
|
46
|
-
|
47
|
-
return UI;
|
48
|
-
}
|
49
|
-
|
50
|
-
UI.version = '2.11.1';
|
51
|
-
UI.$doc = $doc;
|
52
|
-
UI.$win = $win;
|
53
|
-
UI.$html = $html;
|
54
|
-
|
55
|
-
UI.fn = function(command, options) {
|
56
|
-
|
57
|
-
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
|
46
|
+
UI.version = '2.20.3';
|
58
47
|
|
59
|
-
|
60
|
-
|
61
|
-
|
48
|
+
UI.noConflict = function() {
|
49
|
+
// restore UIkit version
|
50
|
+
if (_UI) {
|
51
|
+
global.UIkit = _UI;
|
52
|
+
$.UIkit = _UI;
|
53
|
+
$.fn.uk = _UI.fn;
|
62
54
|
}
|
63
55
|
|
64
|
-
return
|
65
|
-
var $this = $(this), data = $this.data(component);
|
66
|
-
if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
|
67
|
-
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
|
68
|
-
});
|
56
|
+
return UI;
|
69
57
|
};
|
70
58
|
|
59
|
+
UI.prefix = function(str) {
|
60
|
+
return str;
|
61
|
+
};
|
62
|
+
|
63
|
+
// cache jQuery
|
64
|
+
UI.$ = $;
|
65
|
+
|
66
|
+
UI.$doc = UI.$(document);
|
67
|
+
UI.$win = UI.$(window);
|
68
|
+
UI.$html = UI.$('html');
|
71
69
|
|
72
70
|
UI.support = {};
|
73
71
|
UI.support.transition = (function() {
|
@@ -76,10 +74,10 @@
|
|
76
74
|
|
77
75
|
var element = doc.body || doc.documentElement,
|
78
76
|
transEndEventNames = {
|
79
|
-
WebkitTransition: 'webkitTransitionEnd',
|
80
|
-
MozTransition: 'transitionend',
|
81
|
-
OTransition: 'oTransitionEnd otransitionend',
|
82
|
-
transition: 'transitionend'
|
77
|
+
WebkitTransition : 'webkitTransitionEnd',
|
78
|
+
MozTransition : 'transitionend',
|
79
|
+
OTransition : 'oTransitionEnd otransitionend',
|
80
|
+
transition : 'transitionend'
|
83
81
|
}, name;
|
84
82
|
|
85
83
|
for (name in transEndEventNames) {
|
@@ -96,10 +94,10 @@
|
|
96
94
|
|
97
95
|
var element = doc.body || doc.documentElement,
|
98
96
|
animEndEventNames = {
|
99
|
-
WebkitAnimation: 'webkitAnimationEnd',
|
100
|
-
MozAnimation: 'animationend',
|
101
|
-
OAnimation: 'oAnimationEnd oanimationend',
|
102
|
-
animation: 'animationend'
|
97
|
+
WebkitAnimation : 'webkitAnimationEnd',
|
98
|
+
MozAnimation : 'animationend',
|
99
|
+
OAnimation : 'oAnimationEnd oanimationend',
|
100
|
+
animation : 'animationend'
|
103
101
|
}, name;
|
104
102
|
|
105
103
|
for (name in animEndEventNames) {
|
@@ -110,18 +108,56 @@
|
|
110
108
|
return animationEnd && { end: animationEnd };
|
111
109
|
})();
|
112
110
|
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
// requestAnimationFrame polyfill
|
112
|
+
// https://gist.github.com/paulirish/1579671
|
113
|
+
(function(){
|
114
|
+
|
115
|
+
var lastTime = 0;
|
116
|
+
|
117
|
+
global.requestAnimationFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || function(callback, element) {
|
118
|
+
var currTime = new Date().getTime();
|
119
|
+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
120
|
+
var id = global.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
|
121
|
+
lastTime = currTime + timeToCall;
|
122
|
+
return id;
|
123
|
+
};
|
124
|
+
|
125
|
+
if (!global.cancelAnimationFrame) {
|
126
|
+
|
127
|
+
global.cancelAnimationFrame = function(id) {
|
128
|
+
clearTimeout(id);
|
129
|
+
};
|
130
|
+
}
|
131
|
+
|
132
|
+
})();
|
133
|
+
|
134
|
+
UI.support.touch = (
|
135
|
+
('ontouchstart' in document) ||
|
116
136
|
(global.DocumentTouch && document instanceof global.DocumentTouch) ||
|
117
|
-
(global.navigator
|
118
|
-
(global.navigator
|
137
|
+
(global.navigator.msPointerEnabled && global.navigator.msMaxTouchPoints > 0) || //IE 10
|
138
|
+
(global.navigator.pointerEnabled && global.navigator.maxTouchPoints > 0) || //IE >=11
|
119
139
|
false
|
120
140
|
);
|
141
|
+
|
121
142
|
UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || null);
|
122
143
|
|
123
144
|
UI.Utils = {};
|
124
145
|
|
146
|
+
UI.Utils.str2json = function(str, notevil) {
|
147
|
+
try {
|
148
|
+
if (notevil) {
|
149
|
+
return JSON.parse(str
|
150
|
+
// wrap keys without quote with valid double quote
|
151
|
+
.replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';})
|
152
|
+
// replacing single quote wrapped ones to double quote
|
153
|
+
.replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
|
154
|
+
);
|
155
|
+
} else {
|
156
|
+
return (new Function("", "var json = " + str + "; return JSON.parse(JSON.stringify(json));"))();
|
157
|
+
}
|
158
|
+
} catch(e) { return false; }
|
159
|
+
};
|
160
|
+
|
125
161
|
UI.Utils.debounce = function(func, wait, immediate) {
|
126
162
|
var timeout;
|
127
163
|
return function() {
|
@@ -170,20 +206,48 @@
|
|
170
206
|
return false;
|
171
207
|
}
|
172
208
|
|
173
|
-
var window_left =
|
209
|
+
var window_left = UI.$win.scrollLeft(), window_top = UI.$win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
|
174
210
|
|
175
211
|
options = $.extend({topoffset:0, leftoffset:0}, options);
|
176
212
|
|
177
|
-
if (top + $element.height() >= window_top && top - options.topoffset <= window_top +
|
178
|
-
left + $element.width() >= window_left && left - options.leftoffset <= window_left +
|
213
|
+
if (top + $element.height() >= window_top && top - options.topoffset <= window_top + UI.$win.height() &&
|
214
|
+
left + $element.width() >= window_left && left - options.leftoffset <= window_left + UI.$win.width()) {
|
179
215
|
return true;
|
180
216
|
} else {
|
181
217
|
return false;
|
182
218
|
}
|
183
219
|
};
|
184
220
|
|
185
|
-
UI.Utils.checkDisplay = function(context) {
|
186
|
-
|
221
|
+
UI.Utils.checkDisplay = function(context, initanimation) {
|
222
|
+
|
223
|
+
var elements = UI.$('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document), animated;
|
224
|
+
|
225
|
+
if (context && !elements.length) {
|
226
|
+
elements = $(context);
|
227
|
+
}
|
228
|
+
|
229
|
+
elements.trigger('display.uk.check');
|
230
|
+
|
231
|
+
// fix firefox / IE animations
|
232
|
+
if (initanimation) {
|
233
|
+
|
234
|
+
if (typeof(initanimation)!='string') {
|
235
|
+
initanimation = '[class*="uk-animation-"]';
|
236
|
+
}
|
237
|
+
|
238
|
+
elements.find(initanimation).each(function(){
|
239
|
+
|
240
|
+
var ele = UI.$(this),
|
241
|
+
cls = ele.attr('class'),
|
242
|
+
anim = cls.match(/uk\-animation\-(.+)/);
|
243
|
+
|
244
|
+
ele.removeClass(anim[0]).width();
|
245
|
+
|
246
|
+
ele.addClass(anim[0]);
|
247
|
+
});
|
248
|
+
}
|
249
|
+
|
250
|
+
return elements;
|
187
251
|
};
|
188
252
|
|
189
253
|
UI.Utils.options = function(string) {
|
@@ -194,13 +258,34 @@
|
|
194
258
|
|
195
259
|
if (start != -1) {
|
196
260
|
try {
|
197
|
-
options = (
|
261
|
+
options = UI.Utils.str2json(string.substr(start));
|
198
262
|
} catch (e) {}
|
199
263
|
}
|
200
264
|
|
201
265
|
return options;
|
202
266
|
};
|
203
267
|
|
268
|
+
UI.Utils.animate = function(element, cls) {
|
269
|
+
|
270
|
+
var d = $.Deferred();
|
271
|
+
|
272
|
+
element = UI.$(element);
|
273
|
+
cls = cls;
|
274
|
+
|
275
|
+
element.css('display', 'none').addClass(cls).one(UI.support.animation.end, function() {
|
276
|
+
element.removeClass(cls);
|
277
|
+
d.resolve();
|
278
|
+
}).width();
|
279
|
+
|
280
|
+
element.css('display', '');
|
281
|
+
|
282
|
+
return d.promise();
|
283
|
+
};
|
284
|
+
|
285
|
+
UI.Utils.uid = function(prefix) {
|
286
|
+
return (prefix || 'id') + (new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
|
287
|
+
};
|
288
|
+
|
204
289
|
UI.Utils.template = function(str, data) {
|
205
290
|
|
206
291
|
var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
|
@@ -250,59 +335,45 @@
|
|
250
335
|
i = i + 1;
|
251
336
|
}
|
252
337
|
|
253
|
-
fn = [
|
338
|
+
fn = new Function('$data', [
|
254
339
|
'var __ret = [];',
|
255
340
|
'try {',
|
256
341
|
'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
|
257
342
|
'}catch(e){__ret = [e.message];}',
|
258
343
|
'return __ret.join("").replace(/\\n\\n/g, "\\n");',
|
259
344
|
"function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}"
|
260
|
-
].join("\n");
|
345
|
+
].join("\n"));
|
261
346
|
|
262
|
-
|
263
|
-
return data ? func(data) : func;
|
347
|
+
return data ? fn(data) : fn;
|
264
348
|
};
|
265
349
|
|
266
350
|
UI.Utils.events = {};
|
267
351
|
UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
|
268
352
|
|
269
|
-
|
270
|
-
$.fn.uk = UI.fn;
|
271
|
-
|
272
|
-
$.UIkit.langdirection = $html.attr("dir") == "rtl" ? "right" : "left";
|
273
|
-
|
274
|
-
|
275
|
-
// DOM mutation save ready helper function
|
276
|
-
|
277
|
-
UI.domObservers = [];
|
278
|
-
|
279
|
-
UI.domObserve = function(selector, fn) {
|
280
|
-
|
281
|
-
if(!UI.support.mutationobserver) return;
|
282
|
-
|
283
|
-
$(selector).each(function() {
|
353
|
+
global.UIkit = UI;
|
284
354
|
|
285
|
-
|
355
|
+
// deprecated
|
286
356
|
|
287
|
-
|
357
|
+
UI.fn = function(command, options) {
|
288
358
|
|
289
|
-
|
290
|
-
fn.apply(element, []);
|
291
|
-
$(element).trigger('uk.dom.changed');
|
292
|
-
}, 50));
|
359
|
+
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
|
293
360
|
|
294
|
-
|
295
|
-
|
361
|
+
if (!UI[component]) {
|
362
|
+
$.error("UIkit component [" + component + "] does not exist.");
|
363
|
+
return this;
|
364
|
+
}
|
296
365
|
|
297
|
-
|
366
|
+
return this.each(function() {
|
367
|
+
var $this = $(this), data = $this.data(component);
|
368
|
+
if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
|
369
|
+
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
|
298
370
|
});
|
299
371
|
};
|
300
372
|
|
301
|
-
|
302
|
-
|
303
|
-
UI.domObservers.push(fn);
|
304
|
-
};
|
373
|
+
$.UIkit = UI;
|
374
|
+
$.fn.uk = UI.fn;
|
305
375
|
|
376
|
+
UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left";
|
306
377
|
|
307
378
|
UI.components = {};
|
308
379
|
|
@@ -312,7 +383,8 @@
|
|
312
383
|
|
313
384
|
var $this = this;
|
314
385
|
|
315
|
-
this.
|
386
|
+
this.UIkit = UI;
|
387
|
+
this.element = element ? UI.$(element) : null;
|
316
388
|
this.options = $.extend(true, {}, this.defaults, options);
|
317
389
|
this.plugins = {};
|
318
390
|
|
@@ -331,7 +403,9 @@
|
|
331
403
|
|
332
404
|
});
|
333
405
|
|
334
|
-
this.trigger('init', [this]);
|
406
|
+
this.trigger('init.uk.component', [name, this]);
|
407
|
+
|
408
|
+
return this;
|
335
409
|
};
|
336
410
|
|
337
411
|
fn.plugins = {};
|
@@ -340,26 +414,27 @@
|
|
340
414
|
|
341
415
|
defaults : {plugins: []},
|
342
416
|
|
417
|
+
boot: function(){},
|
343
418
|
init: function(){},
|
344
419
|
|
345
|
-
on: function(){
|
346
|
-
return
|
420
|
+
on: function(a1,a2,a3){
|
421
|
+
return UI.$(this.element || this).on(a1,a2,a3);
|
347
422
|
},
|
348
423
|
|
349
|
-
one: function(){
|
350
|
-
return
|
424
|
+
one: function(a1,a2,a3){
|
425
|
+
return UI.$(this.element || this).one(a1,a2,a3);
|
351
426
|
},
|
352
427
|
|
353
428
|
off: function(evt){
|
354
|
-
return
|
429
|
+
return UI.$(this.element || this).off(evt);
|
355
430
|
},
|
356
431
|
|
357
432
|
trigger: function(evt, params) {
|
358
|
-
return
|
433
|
+
return UI.$(this.element || this).trigger(evt, params);
|
359
434
|
},
|
360
435
|
|
361
436
|
find: function(selector) {
|
362
|
-
return this.element ? this.element.find(selector)
|
437
|
+
return UI.$(this.element ? this.element: []).find(selector);
|
363
438
|
},
|
364
439
|
|
365
440
|
proxy: function(obj, methods) {
|
@@ -380,6 +455,15 @@
|
|
380
455
|
});
|
381
456
|
},
|
382
457
|
|
458
|
+
option: function() {
|
459
|
+
|
460
|
+
if (arguments.length == 1) {
|
461
|
+
return this.options[arguments[0]] || undefined;
|
462
|
+
} else if (arguments.length == 2) {
|
463
|
+
this.options[arguments[0]] = arguments[1];
|
464
|
+
}
|
465
|
+
}
|
466
|
+
|
383
467
|
}, def);
|
384
468
|
|
385
469
|
this.components[name] = fn;
|
@@ -388,7 +472,8 @@
|
|
388
472
|
|
389
473
|
var element, options;
|
390
474
|
|
391
|
-
if(arguments.length) {
|
475
|
+
if (arguments.length) {
|
476
|
+
|
392
477
|
switch(arguments.length) {
|
393
478
|
case 1:
|
394
479
|
|
@@ -414,6 +499,10 @@
|
|
414
499
|
return (new UI.components[name](element, options));
|
415
500
|
};
|
416
501
|
|
502
|
+
if (UI.domready) {
|
503
|
+
UI.component.boot(name);
|
504
|
+
}
|
505
|
+
|
417
506
|
return fn;
|
418
507
|
};
|
419
508
|
|
@@ -421,49 +510,157 @@
|
|
421
510
|
this.components[component].plugins[name] = def;
|
422
511
|
};
|
423
512
|
|
513
|
+
UI.component.boot = function(name) {
|
424
514
|
|
425
|
-
|
426
|
-
|
515
|
+
if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) {
|
516
|
+
UI.components[name].prototype.boot.apply(UI, []);
|
517
|
+
UI.components[name].booted = true;
|
518
|
+
}
|
519
|
+
};
|
520
|
+
|
521
|
+
UI.component.bootComponents = function() {
|
522
|
+
|
523
|
+
for (var component in UI.components) {
|
524
|
+
UI.component.boot(component);
|
525
|
+
}
|
526
|
+
};
|
527
|
+
|
528
|
+
|
529
|
+
// DOM mutation save ready helper function
|
530
|
+
|
531
|
+
UI.domObservers = [];
|
532
|
+
UI.domready = false;
|
533
|
+
|
534
|
+
UI.ready = function(fn) {
|
535
|
+
|
536
|
+
UI.domObservers.push(fn);
|
537
|
+
|
538
|
+
if (UI.domready) {
|
427
539
|
fn(document);
|
540
|
+
}
|
541
|
+
};
|
542
|
+
|
543
|
+
UI.on = function(a1,a2,a3){
|
544
|
+
|
545
|
+
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
546
|
+
a2.apply(UI.$doc);
|
547
|
+
}
|
548
|
+
|
549
|
+
return UI.$doc.on(a1,a2,a3);
|
550
|
+
};
|
551
|
+
|
552
|
+
UI.one = function(a1,a2,a3){
|
553
|
+
|
554
|
+
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
555
|
+
a2.apply(UI.$doc);
|
556
|
+
return UI.$doc;
|
557
|
+
}
|
558
|
+
|
559
|
+
return UI.$doc.one(a1,a2,a3);
|
560
|
+
};
|
561
|
+
|
562
|
+
UI.trigger = function(evt, params) {
|
563
|
+
return UI.$doc.trigger(evt, params);
|
564
|
+
};
|
565
|
+
|
566
|
+
UI.domObserve = function(selector, fn) {
|
567
|
+
|
568
|
+
if(!UI.support.mutationobserver) return;
|
569
|
+
|
570
|
+
fn = fn || function() {};
|
571
|
+
|
572
|
+
UI.$(selector).each(function() {
|
573
|
+
|
574
|
+
var element = this,
|
575
|
+
$element = UI.$(element);
|
576
|
+
|
577
|
+
if ($element.data('observer')) {
|
578
|
+
return;
|
579
|
+
}
|
580
|
+
|
581
|
+
try {
|
582
|
+
|
583
|
+
var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
|
584
|
+
fn.apply(element, []);
|
585
|
+
$element.trigger('changed.uk.dom');
|
586
|
+
}, 50));
|
587
|
+
|
588
|
+
// pass in the target node, as well as the observer options
|
589
|
+
observer.observe(element, { childList: true, subtree: true });
|
590
|
+
|
591
|
+
$element.data('observer', observer);
|
592
|
+
|
593
|
+
} catch(e) {}
|
594
|
+
});
|
595
|
+
};
|
596
|
+
|
597
|
+
UI.init = function(root) {
|
598
|
+
|
599
|
+
root = root || document;
|
600
|
+
|
601
|
+
UI.domObservers.forEach(function(fn){
|
602
|
+
fn(root);
|
428
603
|
});
|
429
|
-
|
604
|
+
};
|
605
|
+
|
606
|
+
UI.on('domready.uk.dom', function(){
|
607
|
+
|
608
|
+
UI.init();
|
609
|
+
|
610
|
+
if (UI.domready) UI.Utils.checkDisplay();
|
430
611
|
});
|
431
612
|
|
432
613
|
$(function(){
|
433
614
|
|
615
|
+
UI.$body = UI.$('body');
|
616
|
+
|
617
|
+
UI.ready(function(context){
|
618
|
+
UI.domObserve('[data-uk-observe]');
|
619
|
+
});
|
620
|
+
|
621
|
+
UI.on('changed.uk.dom', function(e) {
|
622
|
+
UI.init(e.target);
|
623
|
+
UI.Utils.checkDisplay(e.target);
|
624
|
+
});
|
625
|
+
|
626
|
+
UI.trigger('beforeready.uk.dom');
|
627
|
+
|
628
|
+
UI.component.bootComponents();
|
629
|
+
|
434
630
|
// custom scroll observer
|
435
631
|
setInterval((function(){
|
436
632
|
|
437
|
-
var memory = {x: window.pageXOffset, y:window.pageYOffset};
|
633
|
+
var memory = {x: window.pageXOffset, y:window.pageYOffset}, dir;
|
438
634
|
|
439
635
|
var fn = function(){
|
440
636
|
|
441
637
|
if (memory.x != window.pageXOffset || memory.y != window.pageYOffset) {
|
442
|
-
|
443
|
-
|
638
|
+
|
639
|
+
dir = {x: 0 , y: 0};
|
640
|
+
|
641
|
+
if (window.pageXOffset != memory.x) dir.x = window.pageXOffset > memory.x ? 1:-1;
|
642
|
+
if (window.pageYOffset != memory.y) dir.y = window.pageYOffset > memory.y ? 1:-1;
|
643
|
+
|
644
|
+
memory = {
|
645
|
+
"dir": dir, "x": window.pageXOffset, "y": window.pageYOffset
|
646
|
+
};
|
647
|
+
|
648
|
+
UI.$doc.trigger('scrolling.uk.document', [memory]);
|
444
649
|
}
|
445
650
|
};
|
446
651
|
|
447
|
-
if (
|
448
|
-
|
652
|
+
if (UI.support.touch) {
|
653
|
+
UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn);
|
449
654
|
}
|
450
655
|
|
451
|
-
if(memory.x || memory.y) fn();
|
656
|
+
if (memory.x || memory.y) fn();
|
452
657
|
|
453
658
|
return fn;
|
454
659
|
|
455
660
|
})(), 15);
|
456
661
|
|
457
|
-
//
|
458
|
-
UI.
|
459
|
-
|
460
|
-
var ele = this;
|
461
|
-
|
462
|
-
UI.domObservers.forEach(function(fn){
|
463
|
-
fn(ele);
|
464
|
-
});
|
465
|
-
});
|
466
|
-
|
662
|
+
// run component init functions on dom
|
663
|
+
UI.trigger('domready.uk.dom');
|
467
664
|
|
468
665
|
if (UI.support.touch) {
|
469
666
|
|
@@ -485,27 +682,34 @@
|
|
485
682
|
})(), 100));
|
486
683
|
}
|
487
684
|
}
|
685
|
+
|
686
|
+
UI.trigger('afterready.uk.dom');
|
687
|
+
|
688
|
+
// mark that domready is left behind
|
689
|
+
UI.domready = true;
|
488
690
|
});
|
489
691
|
|
490
692
|
// add touch identifier class
|
491
|
-
|
693
|
+
UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
|
492
694
|
|
493
695
|
// add uk-hover class on tap to support overlays on touch devices
|
494
696
|
if (UI.support.touch) {
|
495
697
|
|
496
|
-
var hoverset = false, selector = '.uk-overlay, .uk-overlay-toggle, .uk-has-hover'
|
698
|
+
var hoverset = false, exclude, hovercls = 'uk-hover', selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover';
|
497
699
|
|
498
|
-
|
700
|
+
UI.$html.on('touchstart MSPointerDown pointerdown', selector, function() {
|
499
701
|
|
500
|
-
if(hoverset) $('.
|
702
|
+
if (hoverset) $('.'+hovercls).removeClass(hovercls);
|
501
703
|
|
502
|
-
hoverset = $(this).addClass(
|
704
|
+
hoverset = $(this).addClass(hovercls);
|
503
705
|
|
504
|
-
}).on('touchend MSPointerUp', function(e) {
|
706
|
+
}).on('touchend MSPointerUp pointerup', function(e) {
|
505
707
|
|
506
708
|
exclude = $(e.target).parents(selector);
|
507
709
|
|
508
|
-
if (hoverset)
|
710
|
+
if (hoverset) {
|
711
|
+
hoverset.not(exclude).removeClass(hovercls);
|
712
|
+
}
|
509
713
|
});
|
510
714
|
}
|
511
715
|
|
@@ -517,10 +721,13 @@
|
|
517
721
|
// Zepto.js may be freely distributed under the MIT license.
|
518
722
|
|
519
723
|
;(function($){
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
724
|
+
|
725
|
+
if ($.fn.swipeLeft) {
|
726
|
+
return;
|
727
|
+
}
|
728
|
+
|
729
|
+
|
730
|
+
var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
|
524
731
|
|
525
732
|
function swipeDirection(x1, x2, y1, y2) {
|
526
733
|
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
|
@@ -561,7 +768,8 @@
|
|
561
768
|
}
|
562
769
|
|
563
770
|
$(document)
|
564
|
-
.
|
771
|
+
.on('MSGestureEnd gestureend', function(e){
|
772
|
+
|
565
773
|
var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
|
566
774
|
|
567
775
|
if (swipeDirectionFromVelocity) {
|
@@ -569,11 +777,13 @@
|
|
569
777
|
touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
|
570
778
|
}
|
571
779
|
})
|
572
|
-
|
780
|
+
// MSPointerDown: for IE10
|
781
|
+
// pointerdown: for IE11
|
782
|
+
.on('touchstart MSPointerDown pointerdown', function(e){
|
573
783
|
|
574
784
|
if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
|
575
785
|
|
576
|
-
firstTouch = e.type == 'MSPointerDown' ? e : e.originalEvent.touches[0];
|
786
|
+
firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
|
577
787
|
|
578
788
|
now = Date.now();
|
579
789
|
delta = now - (touch.last || now);
|
@@ -590,13 +800,18 @@
|
|
590
800
|
longTapTimeout = setTimeout(longTap, longTapDelay);
|
591
801
|
|
592
802
|
// adds the current touch contact for IE gesture recognition
|
593
|
-
if (gesture && e.type == 'MSPointerDown'
|
803
|
+
if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
|
804
|
+
gesture.addPointer(e.originalEvent.pointerId);
|
805
|
+
}
|
806
|
+
|
594
807
|
})
|
595
|
-
|
808
|
+
// MSPointerMove: for IE10
|
809
|
+
// pointermove: for IE11
|
810
|
+
.on('touchmove MSPointerMove pointermove', function(e){
|
596
811
|
|
597
|
-
if(e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
|
812
|
+
if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
|
598
813
|
|
599
|
-
firstTouch = e.type == 'MSPointerMove' ? e : e.originalEvent.touches[0];
|
814
|
+
firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
|
600
815
|
|
601
816
|
cancelLongTap();
|
602
817
|
touch.x2 = firstTouch.pageX;
|
@@ -605,9 +820,11 @@
|
|
605
820
|
deltaX += Math.abs(touch.x1 - touch.x2);
|
606
821
|
deltaY += Math.abs(touch.y1 - touch.y2);
|
607
822
|
})
|
608
|
-
|
823
|
+
// MSPointerUp: for IE10
|
824
|
+
// pointerup: for IE11
|
825
|
+
.on('touchend MSPointerUp pointerup', function(e){
|
609
826
|
|
610
|
-
if(e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
|
827
|
+
if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
|
611
828
|
|
612
829
|
cancelLongTap();
|
613
830
|
|
@@ -671,7 +888,8 @@
|
|
671
888
|
$.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
|
672
889
|
});
|
673
890
|
})(jQuery);
|
674
|
-
|
891
|
+
|
892
|
+
(function(UI) {
|
675
893
|
|
676
894
|
"use strict";
|
677
895
|
|
@@ -683,6 +901,22 @@
|
|
683
901
|
'cls': 'uk-margin-small-top'
|
684
902
|
},
|
685
903
|
|
904
|
+
boot: function() {
|
905
|
+
|
906
|
+
// init code
|
907
|
+
UI.ready(function(context) {
|
908
|
+
|
909
|
+
UI.$("[data-uk-margin]", context).each(function() {
|
910
|
+
|
911
|
+
var ele = UI.$(this), obj;
|
912
|
+
|
913
|
+
if (!ele.data("stackMargin")) {
|
914
|
+
obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
|
915
|
+
}
|
916
|
+
});
|
917
|
+
});
|
918
|
+
},
|
919
|
+
|
686
920
|
init: function() {
|
687
921
|
|
688
922
|
var $this = this;
|
@@ -697,22 +931,22 @@
|
|
697
931
|
$this.process();
|
698
932
|
};
|
699
933
|
|
700
|
-
|
934
|
+
UI.$(function() {
|
701
935
|
fn();
|
702
936
|
UI.$win.on("load", fn);
|
703
937
|
});
|
704
938
|
|
705
|
-
return UI.Utils.debounce(fn,
|
939
|
+
return UI.Utils.debounce(fn, 20);
|
706
940
|
})());
|
707
941
|
|
708
|
-
UI.$html.on("uk.dom
|
942
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
709
943
|
$this.columns = $this.element.children();
|
710
944
|
$this.process();
|
711
945
|
});
|
712
946
|
|
713
|
-
this.on("uk.check
|
947
|
+
this.on("display.uk.check", function(e) {
|
714
948
|
$this.columns = $this.element.children();
|
715
|
-
if(this.element.is(":visible")) this.process();
|
949
|
+
if (this.element.is(":visible")) this.process();
|
716
950
|
}.bind(this));
|
717
951
|
|
718
952
|
stacks.push(this);
|
@@ -722,30 +956,7 @@
|
|
722
956
|
|
723
957
|
var $this = this;
|
724
958
|
|
725
|
-
this.
|
726
|
-
|
727
|
-
var skip = false,
|
728
|
-
firstvisible = this.columns.filter(":visible:first"),
|
729
|
-
offset = firstvisible.length ? firstvisible.offset().top : false;
|
730
|
-
|
731
|
-
if (offset === false) return;
|
732
|
-
|
733
|
-
this.columns.each(function() {
|
734
|
-
|
735
|
-
var column = $(this);
|
736
|
-
|
737
|
-
if (column.is(":visible")) {
|
738
|
-
|
739
|
-
if (skip) {
|
740
|
-
column.addClass($this.options.cls);
|
741
|
-
} else {
|
742
|
-
if (column.offset().top != offset) {
|
743
|
-
column.addClass($this.options.cls);
|
744
|
-
skip = true;
|
745
|
-
}
|
746
|
-
}
|
747
|
-
}
|
748
|
-
});
|
959
|
+
UI.Utils.stackMargin(this.columns, this.options);
|
749
960
|
|
750
961
|
return this;
|
751
962
|
},
|
@@ -756,140 +967,251 @@
|
|
756
967
|
}
|
757
968
|
});
|
758
969
|
|
759
|
-
//
|
760
|
-
UI.ready(function(
|
970
|
+
// responsive iframes
|
971
|
+
UI.ready((function(){
|
761
972
|
|
762
|
-
|
763
|
-
var ele = $(this), obj;
|
973
|
+
var iframes = [], check = function() {
|
764
974
|
|
765
|
-
|
766
|
-
obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
|
767
|
-
}
|
768
|
-
});
|
769
|
-
});
|
975
|
+
iframes.forEach(function(iframe){
|
770
976
|
|
771
|
-
|
772
|
-
(function($, UI) {
|
977
|
+
if (!iframe.is(':visible')) return;
|
773
978
|
|
774
|
-
|
979
|
+
var width = iframe.parent().width(),
|
980
|
+
iwidth = iframe.data('width'),
|
981
|
+
ratio = (width / iwidth),
|
982
|
+
height = Math.floor(ratio * iframe.data('height'));
|
775
983
|
|
776
|
-
|
984
|
+
iframe.css({'height': (width < iwidth) ? height : iframe.data('height')});
|
985
|
+
});
|
986
|
+
};
|
777
987
|
|
778
|
-
|
779
|
-
duration: 1000,
|
780
|
-
transition: 'easeOutExpo',
|
781
|
-
offset: 0,
|
782
|
-
complete: function(){}
|
783
|
-
},
|
988
|
+
UI.$win.on('resize', UI.Utils.debounce(check, 15));
|
784
989
|
|
785
|
-
|
990
|
+
return function(context){
|
786
991
|
|
787
|
-
|
992
|
+
UI.$('iframe.uk-responsive-width', context).each(function(){
|
788
993
|
|
789
|
-
|
994
|
+
var iframe = UI.$(this);
|
790
995
|
|
791
|
-
|
792
|
-
var ele = ($(this.hash).length ? $(this.hash) : $("body")),
|
793
|
-
target = ele.offset().top - $this.options.offset,
|
794
|
-
docheight = UI.$doc.height(),
|
795
|
-
winheight = UI.$win.height();
|
996
|
+
if (!iframe.data('responsive') && iframe.attr('width') && iframe.attr('height')) {
|
796
997
|
|
797
|
-
|
798
|
-
|
998
|
+
iframe.data('width' , iframe.attr('width'));
|
999
|
+
iframe.data('height' , iframe.attr('height'));
|
1000
|
+
iframe.data('responsive', true);
|
1001
|
+
iframes.push(iframe);
|
799
1002
|
}
|
800
|
-
|
801
|
-
// animate to target, fire callback when done
|
802
|
-
$("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition).promise().done($this.options.complete);
|
803
|
-
|
804
|
-
// cancel default click action
|
805
|
-
return false;
|
806
1003
|
});
|
807
1004
|
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
if (!$.easing['easeOutExpo']) {
|
812
|
-
$.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
813
|
-
}
|
1005
|
+
check();
|
1006
|
+
};
|
814
1007
|
|
815
|
-
|
816
|
-
UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
|
817
|
-
var ele = $(this);
|
1008
|
+
})());
|
818
1009
|
|
819
|
-
if (!ele.data("smoothScroll")) {
|
820
|
-
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
|
821
|
-
ele.trigger("click");
|
822
|
-
}
|
823
1010
|
|
824
|
-
|
825
|
-
});
|
1011
|
+
// helper
|
826
1012
|
|
827
|
-
|
828
|
-
(function($, UI) {
|
1013
|
+
UI.Utils.stackMargin = function(elements, options) {
|
829
1014
|
|
830
|
-
|
1015
|
+
options = UI.$.extend({
|
1016
|
+
'cls': 'uk-margin-small-top'
|
1017
|
+
}, options);
|
831
1018
|
|
832
|
-
|
833
|
-
$doc = UI.$doc,
|
834
|
-
scrollspies = [],
|
835
|
-
checkScrollSpy = function() {
|
836
|
-
for(var i=0; i < scrollspies.length; i++) {
|
837
|
-
UI.support.requestAnimationFrame.apply(window, [scrollspies[i].check]);
|
838
|
-
}
|
839
|
-
};
|
1019
|
+
options.cls = options.cls;
|
840
1020
|
|
841
|
-
|
1021
|
+
elements = UI.$(elements).removeClass(options.cls);
|
842
1022
|
|
843
|
-
|
844
|
-
"
|
845
|
-
|
846
|
-
"topoffset" : 0,
|
847
|
-
"leftoffset" : 0,
|
848
|
-
"repeat" : false,
|
849
|
-
"delay" : 0
|
850
|
-
},
|
1023
|
+
var skip = false,
|
1024
|
+
firstvisible = elements.filter(":visible:first"),
|
1025
|
+
offset = firstvisible.length ? (firstvisible.position().top + firstvisible.outerHeight()) - 1 : false; // (-1): weird firefox bug when parent container is display:flex
|
851
1026
|
|
852
|
-
|
1027
|
+
if (offset === false) return;
|
853
1028
|
|
854
|
-
|
855
|
-
fn = function(){
|
1029
|
+
elements.each(function() {
|
856
1030
|
|
857
|
-
|
1031
|
+
var column = UI.$(this);
|
858
1032
|
|
859
|
-
|
1033
|
+
if (column.is(":visible")) {
|
860
1034
|
|
861
|
-
|
1035
|
+
if (skip) {
|
1036
|
+
column.addClass(options.cls);
|
1037
|
+
} else {
|
862
1038
|
|
863
|
-
|
864
|
-
|
865
|
-
|
1039
|
+
if (column.position().top >= offset) {
|
1040
|
+
skip = column.addClass(options.cls);
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
});
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
})(UIkit);
|
1048
|
+
|
1049
|
+
(function(UI) {
|
1050
|
+
|
1051
|
+
"use strict";
|
1052
|
+
|
1053
|
+
UI.component('smoothScroll', {
|
1054
|
+
|
1055
|
+
boot: function() {
|
1056
|
+
|
1057
|
+
// init code
|
1058
|
+
UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
|
1059
|
+
var ele = UI.$(this);
|
1060
|
+
|
1061
|
+
if (!ele.data("smoothScroll")) {
|
1062
|
+
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
|
1063
|
+
ele.trigger("click");
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
return false;
|
1067
|
+
});
|
1068
|
+
},
|
1069
|
+
|
1070
|
+
init: function() {
|
1071
|
+
|
1072
|
+
var $this = this;
|
1073
|
+
|
1074
|
+
this.on("click", function(e) {
|
1075
|
+
e.preventDefault();
|
1076
|
+
scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
|
1077
|
+
});
|
1078
|
+
}
|
1079
|
+
});
|
1080
|
+
|
1081
|
+
function scrollToElement(ele, options) {
|
1082
|
+
|
1083
|
+
options = UI.$.extend({
|
1084
|
+
duration: 1000,
|
1085
|
+
transition: 'easeOutExpo',
|
1086
|
+
offset: 0,
|
1087
|
+
complete: function(){}
|
1088
|
+
}, options);
|
1089
|
+
|
1090
|
+
// get / set parameters
|
1091
|
+
var target = ele.offset().top - options.offset,
|
1092
|
+
docheight = UI.$doc.height(),
|
1093
|
+
winheight = window.innerHeight;
|
1094
|
+
|
1095
|
+
if ((target + winheight) > docheight) {
|
1096
|
+
target = docheight - winheight;
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
// animate to target, fire callback when done
|
1100
|
+
UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
UI.Utils.scrollToElement = scrollToElement;
|
1104
|
+
|
1105
|
+
if (!UI.$.easing.easeOutExpo) {
|
1106
|
+
UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
})(UIkit);
|
1110
|
+
|
1111
|
+
(function(UI) {
|
1112
|
+
|
1113
|
+
"use strict";
|
1114
|
+
|
1115
|
+
var $win = UI.$win,
|
1116
|
+
$doc = UI.$doc,
|
1117
|
+
scrollspies = [],
|
1118
|
+
checkScrollSpy = function() {
|
1119
|
+
for(var i=0; i < scrollspies.length; i++) {
|
1120
|
+
window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
|
1121
|
+
}
|
1122
|
+
};
|
1123
|
+
|
1124
|
+
UI.component('scrollspy', {
|
1125
|
+
|
1126
|
+
defaults: {
|
1127
|
+
"target" : false,
|
1128
|
+
"cls" : "uk-scrollspy-inview",
|
1129
|
+
"initcls" : "uk-scrollspy-init-inview",
|
1130
|
+
"topoffset" : 0,
|
1131
|
+
"leftoffset" : 0,
|
1132
|
+
"repeat" : false,
|
1133
|
+
"delay" : 0
|
1134
|
+
},
|
1135
|
+
|
1136
|
+
boot: function() {
|
1137
|
+
|
1138
|
+
// listen to scroll and resize
|
1139
|
+
$doc.on("scrolling.uk.document", checkScrollSpy);
|
1140
|
+
$win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
|
1141
|
+
|
1142
|
+
// init code
|
1143
|
+
UI.ready(function(context) {
|
1144
|
+
|
1145
|
+
UI.$("[data-uk-scrollspy]", context).each(function() {
|
1146
|
+
|
1147
|
+
var element = UI.$(this);
|
1148
|
+
|
1149
|
+
if (!element.data("scrollspy")) {
|
1150
|
+
var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
|
1151
|
+
}
|
1152
|
+
});
|
1153
|
+
});
|
1154
|
+
},
|
1155
|
+
|
1156
|
+
init: function() {
|
1157
|
+
|
1158
|
+
var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
|
1159
|
+
|
1160
|
+
var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
|
1161
|
+
delayIdx = elements.length === 1 ? 1 : 0,
|
1162
|
+
toggleclsIdx = 0;
|
1163
|
+
|
1164
|
+
elements.each(function(idx){
|
1165
|
+
|
1166
|
+
var element = UI.$(this),
|
1167
|
+
inviewstate = element.data('inviewstate'),
|
1168
|
+
inview = UI.Utils.isInView(element, $this.options),
|
1169
|
+
toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
|
1170
|
+
|
1171
|
+
if (inview && !inviewstate && !element.data('scrollspy-idle')) {
|
1172
|
+
|
1173
|
+
if (!initinview) {
|
1174
|
+
element.addClass($this.options.initcls);
|
1175
|
+
$this.offset = element.offset();
|
866
1176
|
initinview = true;
|
867
1177
|
|
868
|
-
|
1178
|
+
element.trigger("init.uk.scrollspy");
|
869
1179
|
}
|
870
1180
|
|
871
|
-
idle
|
1181
|
+
element.data('scrollspy-idle', setTimeout(function(){
|
872
1182
|
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
1183
|
+
element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
|
1184
|
+
element.trigger("inview.uk.scrollspy");
|
1185
|
+
|
1186
|
+
element.data('scrollspy-idle', false);
|
1187
|
+
element.data('inviewstate', true);
|
877
1188
|
|
878
|
-
|
879
|
-
|
1189
|
+
}, $this.options.delay * delayIdx));
|
1190
|
+
|
1191
|
+
delayIdx++;
|
880
1192
|
}
|
881
1193
|
|
882
1194
|
if (!inview && inviewstate && $this.options.repeat) {
|
883
|
-
$this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
|
884
|
-
inviewstate = false;
|
885
1195
|
|
886
|
-
|
1196
|
+
if (element.data('scrollspy-idle')) {
|
1197
|
+
clearTimeout(element.data('scrollspy-idle'));
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
|
1201
|
+
element.data('inviewstate', false);
|
1202
|
+
|
1203
|
+
element.trigger("outview.uk.scrollspy");
|
887
1204
|
}
|
888
|
-
|
1205
|
+
|
1206
|
+
toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
|
1207
|
+
|
1208
|
+
});
|
1209
|
+
};
|
889
1210
|
|
890
1211
|
fn();
|
891
1212
|
|
892
1213
|
this.check = fn;
|
1214
|
+
|
893
1215
|
scrollspies.push(this);
|
894
1216
|
}
|
895
1217
|
});
|
@@ -898,7 +1220,7 @@
|
|
898
1220
|
var scrollspynavs = [],
|
899
1221
|
checkScrollSpyNavs = function() {
|
900
1222
|
for(var i=0; i < scrollspynavs.length; i++) {
|
901
|
-
|
1223
|
+
window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
|
902
1224
|
}
|
903
1225
|
};
|
904
1226
|
|
@@ -912,17 +1234,40 @@
|
|
912
1234
|
"smoothscroll" : false
|
913
1235
|
},
|
914
1236
|
|
1237
|
+
boot: function() {
|
1238
|
+
|
1239
|
+
// listen to scroll and resize
|
1240
|
+
$doc.on("scrolling.uk.document", checkScrollSpyNavs);
|
1241
|
+
$win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
|
1242
|
+
|
1243
|
+
// init code
|
1244
|
+
UI.ready(function(context) {
|
1245
|
+
|
1246
|
+
UI.$("[data-uk-scrollspy-nav]", context).each(function() {
|
1247
|
+
|
1248
|
+
var element = UI.$(this);
|
1249
|
+
|
1250
|
+
if (!element.data("scrollspynav")) {
|
1251
|
+
var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
|
1252
|
+
}
|
1253
|
+
});
|
1254
|
+
});
|
1255
|
+
},
|
1256
|
+
|
915
1257
|
init: function() {
|
916
1258
|
|
917
1259
|
var ids = [],
|
918
|
-
links = this.find("a[href^='#']").each(function(){ ids.push(
|
919
|
-
targets =
|
1260
|
+
links = this.find("a[href^='#']").each(function(){ ids.push(UI.$(this).attr("href")); }),
|
1261
|
+
targets = UI.$(ids.join(",")),
|
1262
|
+
|
1263
|
+
clsActive = this.options.cls,
|
1264
|
+
clsClosest = this.options.closest || this.options.closest;
|
920
1265
|
|
921
1266
|
var $this = this, inviews, fn = function(){
|
922
1267
|
|
923
1268
|
inviews = [];
|
924
1269
|
|
925
|
-
for(var i=0 ; i < targets.length ; i++) {
|
1270
|
+
for (var i=0 ; i < targets.length ; i++) {
|
926
1271
|
if (UI.Utils.isInView(targets.eq(i), $this.options)) {
|
927
1272
|
inviews.push(targets.eq(i));
|
928
1273
|
}
|
@@ -943,16 +1288,17 @@
|
|
943
1288
|
if (!target) return;
|
944
1289
|
|
945
1290
|
if ($this.options.closest) {
|
946
|
-
|
1291
|
+
links.closest(clsClosest).removeClass(clsActive);
|
1292
|
+
navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
|
947
1293
|
} else {
|
948
|
-
navitems = links.removeClass(
|
1294
|
+
navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
|
949
1295
|
}
|
950
1296
|
|
951
|
-
$this.element.trigger("uk.scrollspynav
|
1297
|
+
$this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
|
952
1298
|
}
|
953
1299
|
};
|
954
1300
|
|
955
|
-
if(this.options.smoothscroll && UI
|
1301
|
+
if (this.options.smoothscroll && UI.smoothScroll) {
|
956
1302
|
links.each(function(){
|
957
1303
|
UI.smoothScroll(this, $this.options.smoothscroll);
|
958
1304
|
});
|
@@ -968,103 +1314,126 @@
|
|
968
1314
|
}
|
969
1315
|
});
|
970
1316
|
|
1317
|
+
})(UIkit);
|
971
1318
|
|
972
|
-
|
973
|
-
checkScrollSpy();
|
974
|
-
checkScrollSpyNavs();
|
975
|
-
};
|
976
|
-
|
977
|
-
// listen to scroll and resize
|
978
|
-
$doc.on("uk-scroll", fnCheck);
|
979
|
-
$win.on("resize orientationchange", UI.Utils.debounce(fnCheck, 50));
|
980
|
-
|
981
|
-
// init code
|
982
|
-
UI.ready(function(context) {
|
1319
|
+
(function(UI){
|
983
1320
|
|
984
|
-
|
1321
|
+
"use strict";
|
985
1322
|
|
986
|
-
|
1323
|
+
var toggles = [];
|
987
1324
|
|
988
|
-
|
989
|
-
var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
|
990
|
-
}
|
991
|
-
});
|
1325
|
+
UI.component('toggle', {
|
992
1326
|
|
993
|
-
|
1327
|
+
defaults: {
|
1328
|
+
target : false,
|
1329
|
+
cls : 'uk-hidden',
|
1330
|
+
animation : false,
|
1331
|
+
duration : 200
|
1332
|
+
},
|
994
1333
|
|
995
|
-
|
1334
|
+
boot: function(){
|
996
1335
|
|
997
|
-
|
998
|
-
|
999
|
-
}
|
1000
|
-
});
|
1001
|
-
});
|
1336
|
+
// init code
|
1337
|
+
UI.ready(function(context) {
|
1002
1338
|
|
1003
|
-
|
1339
|
+
UI.$("[data-uk-toggle]", context).each(function() {
|
1340
|
+
var ele = UI.$(this);
|
1004
1341
|
|
1005
|
-
(
|
1342
|
+
if (!ele.data("toggle")) {
|
1343
|
+
var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
|
1344
|
+
}
|
1345
|
+
});
|
1006
1346
|
|
1007
|
-
|
1347
|
+
setTimeout(function(){
|
1008
1348
|
|
1009
|
-
|
1349
|
+
toggles.forEach(function(toggle){
|
1350
|
+
toggle.getToggles();
|
1351
|
+
});
|
1010
1352
|
|
1011
|
-
|
1012
|
-
|
1013
|
-
cls: 'uk-hidden'
|
1353
|
+
}, 0);
|
1354
|
+
});
|
1014
1355
|
},
|
1015
1356
|
|
1016
1357
|
init: function() {
|
1017
1358
|
|
1018
1359
|
var $this = this;
|
1019
1360
|
|
1020
|
-
this.
|
1361
|
+
this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
|
1362
|
+
|
1363
|
+
this.getToggles();
|
1021
1364
|
|
1022
1365
|
this.on("click", function(e) {
|
1023
1366
|
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
1024
1367
|
$this.toggle();
|
1025
1368
|
});
|
1026
1369
|
|
1027
|
-
|
1370
|
+
toggles.push(this);
|
1028
1371
|
},
|
1029
1372
|
|
1030
1373
|
toggle: function() {
|
1031
1374
|
|
1032
1375
|
if(!this.totoggle.length) return;
|
1033
1376
|
|
1034
|
-
|
1377
|
+
if (this.options.animation && UI.support.animation) {
|
1035
1378
|
|
1036
|
-
|
1037
|
-
UI.Utils.checkDisplay(this.totoggle);
|
1038
|
-
}
|
1039
|
-
},
|
1379
|
+
var $this = this, animations = this.options.animation.split(',');
|
1040
1380
|
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1381
|
+
if (animations.length == 1) {
|
1382
|
+
animations[1] = animations[0];
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
animations[0] = animations[0].trim();
|
1386
|
+
animations[1] = animations[1].trim();
|
1387
|
+
|
1388
|
+
this.totoggle.css('animation-duration', this.options.duration+'ms');
|
1045
1389
|
|
1046
|
-
|
1047
|
-
UI.ready(function(context) {
|
1390
|
+
if (this.totoggle.hasClass(this.options.cls)) {
|
1048
1391
|
|
1049
|
-
|
1050
|
-
|
1392
|
+
this.totoggle.toggleClass(this.options.cls);
|
1393
|
+
|
1394
|
+
this.totoggle.each(function(){
|
1395
|
+
UI.Utils.animate(this, animations[0]).then(function(){
|
1396
|
+
UI.$(this).css('animation-duration', '');
|
1397
|
+
UI.Utils.checkDisplay(this);
|
1398
|
+
});
|
1399
|
+
});
|
1400
|
+
|
1401
|
+
} else {
|
1402
|
+
|
1403
|
+
this.totoggle.each(function(){
|
1404
|
+
UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
|
1405
|
+
UI.$(this).toggleClass($this.options.cls).css('animation-duration', '');
|
1406
|
+
UI.Utils.checkDisplay(this);
|
1407
|
+
}.bind(this));
|
1408
|
+
});
|
1409
|
+
}
|
1051
1410
|
|
1052
|
-
|
1053
|
-
|
1411
|
+
} else {
|
1412
|
+
this.totoggle.toggleClass(this.options.cls);
|
1413
|
+
UI.Utils.checkDisplay(this.totoggle);
|
1054
1414
|
}
|
1055
|
-
});
|
1056
1415
|
|
1057
|
-
|
1416
|
+
this.updateAria();
|
1058
1417
|
|
1059
|
-
|
1060
|
-
toggler.getTogglers();
|
1061
|
-
});
|
1418
|
+
},
|
1062
1419
|
|
1063
|
-
|
1420
|
+
getToggles: function() {
|
1421
|
+
this.totoggle = this.options.target ? UI.$(this.options.target):[];
|
1422
|
+
this.updateAria();
|
1423
|
+
},
|
1424
|
+
|
1425
|
+
updateAria: function() {
|
1426
|
+
if (this.aria && this.totoggle.length) {
|
1427
|
+
this.totoggle.each(function(){
|
1428
|
+
UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
|
1429
|
+
});
|
1430
|
+
}
|
1431
|
+
}
|
1064
1432
|
});
|
1065
1433
|
|
1066
|
-
})(
|
1067
|
-
|
1434
|
+
})(UIkit);
|
1435
|
+
|
1436
|
+
(function(UI) {
|
1068
1437
|
|
1069
1438
|
"use strict";
|
1070
1439
|
|
@@ -1076,6 +1445,25 @@
|
|
1076
1445
|
"trigger": ".uk-alert-close"
|
1077
1446
|
},
|
1078
1447
|
|
1448
|
+
boot: function() {
|
1449
|
+
|
1450
|
+
// init code
|
1451
|
+
UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
|
1452
|
+
|
1453
|
+
var ele = UI.$(this);
|
1454
|
+
|
1455
|
+
if (!ele.data("alert")) {
|
1456
|
+
|
1457
|
+
var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
|
1458
|
+
|
1459
|
+
if (UI.$(e.target).is(alert.options.trigger)) {
|
1460
|
+
e.preventDefault();
|
1461
|
+
alert.close();
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
});
|
1465
|
+
},
|
1466
|
+
|
1079
1467
|
init: function() {
|
1080
1468
|
|
1081
1469
|
var $this = this;
|
@@ -1088,46 +1476,30 @@
|
|
1088
1476
|
|
1089
1477
|
close: function() {
|
1090
1478
|
|
1091
|
-
var element
|
1479
|
+
var element = this.trigger("close.uk.alert"),
|
1480
|
+
removeElement = function () {
|
1481
|
+
this.trigger("closed.uk.alert").remove();
|
1482
|
+
}.bind(this);
|
1092
1483
|
|
1093
1484
|
if (this.options.fade) {
|
1094
1485
|
element.css("overflow", "hidden").css("max-height", element.height()).animate({
|
1095
|
-
"height": 0,
|
1096
|
-
"opacity": 0,
|
1097
|
-
"padding-top": 0,
|
1098
|
-
"padding-bottom": 0,
|
1099
|
-
"margin-top": 0,
|
1100
|
-
"margin-bottom": 0
|
1486
|
+
"height" : 0,
|
1487
|
+
"opacity" : 0,
|
1488
|
+
"padding-top" : 0,
|
1489
|
+
"padding-bottom" : 0,
|
1490
|
+
"margin-top" : 0,
|
1491
|
+
"margin-bottom" : 0
|
1101
1492
|
}, this.options.duration, removeElement);
|
1102
1493
|
} else {
|
1103
1494
|
removeElement();
|
1104
1495
|
}
|
1105
|
-
|
1106
|
-
function removeElement() {
|
1107
|
-
element.trigger("uk.alert.closed").remove();
|
1108
|
-
}
|
1109
1496
|
}
|
1110
1497
|
|
1111
1498
|
});
|
1112
1499
|
|
1113
|
-
|
1114
|
-
UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
|
1115
|
-
|
1116
|
-
var ele = $(this);
|
1117
|
-
|
1118
|
-
if (!ele.data("alert")) {
|
1119
|
-
|
1120
|
-
var alert = UI.alert(ele, UI.Utils.options(ele.data("uk-alert")));
|
1121
|
-
|
1122
|
-
if ($(e.target).is(ele.data("alert").options.trigger)) {
|
1123
|
-
e.preventDefault();
|
1124
|
-
alert.close();
|
1125
|
-
}
|
1126
|
-
}
|
1127
|
-
});
|
1500
|
+
})(UIkit);
|
1128
1501
|
|
1129
|
-
|
1130
|
-
(function($, UI) {
|
1502
|
+
(function(UI) {
|
1131
1503
|
|
1132
1504
|
"use strict";
|
1133
1505
|
|
@@ -1137,16 +1509,46 @@
|
|
1137
1509
|
"target": ".uk-button"
|
1138
1510
|
},
|
1139
1511
|
|
1512
|
+
boot: function() {
|
1513
|
+
|
1514
|
+
// init code
|
1515
|
+
UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
|
1516
|
+
|
1517
|
+
var ele = UI.$(this);
|
1518
|
+
|
1519
|
+
if (!ele.data("buttonRadio")) {
|
1520
|
+
|
1521
|
+
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
|
1522
|
+
target = UI.$(e.target);
|
1523
|
+
|
1524
|
+
if (target.is(obj.options.target)) {
|
1525
|
+
target.trigger("click");
|
1526
|
+
}
|
1527
|
+
}
|
1528
|
+
});
|
1529
|
+
},
|
1530
|
+
|
1140
1531
|
init: function() {
|
1141
1532
|
|
1142
1533
|
var $this = this;
|
1143
1534
|
|
1535
|
+
// Init ARIA
|
1536
|
+
this.find($this.options.target).attr('aria-checked', 'false').filter(".uk-active").attr('aria-checked', 'true');
|
1537
|
+
|
1144
1538
|
this.on("click", this.options.target, function(e) {
|
1145
1539
|
|
1146
|
-
|
1540
|
+
var ele = UI.$(this);
|
1541
|
+
|
1542
|
+
if (ele.is('a[href="#"]')) e.preventDefault();
|
1543
|
+
|
1544
|
+
$this.find($this.options.target).not(ele).removeClass("uk-active").blur();
|
1545
|
+
ele.addClass("uk-active");
|
1546
|
+
|
1547
|
+
// Update ARIA
|
1548
|
+
$this.find($this.options.target).not(ele).attr('aria-checked', 'false');
|
1549
|
+
ele.attr('aria-checked', 'true');
|
1147
1550
|
|
1148
|
-
$this.
|
1149
|
-
$this.trigger("uk.button.change", [$(this).addClass("uk-active")]);
|
1551
|
+
$this.trigger("change.uk.button", [ele]);
|
1150
1552
|
});
|
1151
1553
|
|
1152
1554
|
},
|
@@ -1162,15 +1564,41 @@
|
|
1162
1564
|
"target": ".uk-button"
|
1163
1565
|
},
|
1164
1566
|
|
1567
|
+
boot: function() {
|
1568
|
+
|
1569
|
+
UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
|
1570
|
+
var ele = UI.$(this);
|
1571
|
+
|
1572
|
+
if (!ele.data("buttonCheckbox")) {
|
1573
|
+
|
1574
|
+
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
|
1575
|
+
target = UI.$(e.target);
|
1576
|
+
|
1577
|
+
if (target.is(obj.options.target)) {
|
1578
|
+
target.trigger("click");
|
1579
|
+
}
|
1580
|
+
}
|
1581
|
+
});
|
1582
|
+
},
|
1583
|
+
|
1165
1584
|
init: function() {
|
1166
1585
|
|
1167
1586
|
var $this = this;
|
1168
1587
|
|
1588
|
+
// Init ARIA
|
1589
|
+
this.find($this.options.target).attr('aria-checked', 'false').filter(".uk-active").attr('aria-checked', 'true');
|
1590
|
+
|
1169
1591
|
this.on("click", this.options.target, function(e) {
|
1592
|
+
var ele = UI.$(this);
|
1593
|
+
|
1594
|
+
if (ele.is('a[href="#"]')) e.preventDefault();
|
1595
|
+
|
1596
|
+
ele.toggleClass("uk-active").blur();
|
1170
1597
|
|
1171
|
-
|
1598
|
+
// Update ARIA
|
1599
|
+
ele.attr('aria-checked', ele.hasClass("uk-active"));
|
1172
1600
|
|
1173
|
-
$this.trigger("uk.button
|
1601
|
+
$this.trigger("change.uk.button", [ele]);
|
1174
1602
|
});
|
1175
1603
|
|
1176
1604
|
},
|
@@ -1185,65 +1613,47 @@
|
|
1185
1613
|
|
1186
1614
|
defaults: {},
|
1187
1615
|
|
1616
|
+
boot: function() {
|
1617
|
+
|
1618
|
+
UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
|
1619
|
+
var ele = UI.$(this);
|
1620
|
+
|
1621
|
+
if (!ele.data("button")) {
|
1622
|
+
|
1623
|
+
var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
|
1624
|
+
ele.trigger("click");
|
1625
|
+
}
|
1626
|
+
});
|
1627
|
+
},
|
1628
|
+
|
1188
1629
|
init: function() {
|
1189
1630
|
|
1190
1631
|
var $this = this;
|
1191
1632
|
|
1633
|
+
// Init ARIA
|
1634
|
+
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
1635
|
+
|
1192
1636
|
this.on("click", function(e) {
|
1193
1637
|
|
1194
1638
|
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
1195
1639
|
|
1196
1640
|
$this.toggle();
|
1197
|
-
$this.trigger("uk.button
|
1641
|
+
$this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
|
1198
1642
|
});
|
1199
1643
|
|
1200
1644
|
},
|
1201
1645
|
|
1202
1646
|
toggle: function() {
|
1203
1647
|
this.element.toggleClass("uk-active");
|
1204
|
-
}
|
1205
|
-
});
|
1206
|
-
|
1207
|
-
|
1208
|
-
// init code
|
1209
|
-
UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
|
1210
|
-
var ele = $(this);
|
1211
|
-
|
1212
|
-
if (!ele.data("buttonRadio")) {
|
1213
|
-
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
|
1214
|
-
|
1215
|
-
if ($(e.target).is(obj.options.target)) {
|
1216
|
-
$(e.target).trigger("click");
|
1217
|
-
}
|
1218
|
-
}
|
1219
|
-
});
|
1220
|
-
|
1221
|
-
UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
|
1222
|
-
var ele = $(this);
|
1223
|
-
|
1224
|
-
if (!ele.data("buttonCheckbox")) {
|
1225
|
-
|
1226
|
-
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), target=$(e.target);
|
1227
1648
|
|
1228
|
-
|
1229
|
-
|
1230
|
-
}
|
1231
|
-
}
|
1232
|
-
});
|
1233
|
-
|
1234
|
-
UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
|
1235
|
-
var ele = $(this);
|
1236
|
-
|
1237
|
-
if (!ele.data("button")) {
|
1238
|
-
|
1239
|
-
var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
|
1240
|
-
ele.trigger("click");
|
1649
|
+
// Update ARIA
|
1650
|
+
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
1241
1651
|
}
|
1242
1652
|
});
|
1243
1653
|
|
1244
|
-
})(
|
1654
|
+
})(UIkit);
|
1245
1655
|
|
1246
|
-
(function(
|
1656
|
+
(function(UI) {
|
1247
1657
|
|
1248
1658
|
"use strict";
|
1249
1659
|
|
@@ -1256,43 +1666,72 @@
|
|
1256
1666
|
'remaintime' : 800,
|
1257
1667
|
'justify' : false,
|
1258
1668
|
'boundary' : UI.$win,
|
1259
|
-
'delay' : 0
|
1669
|
+
'delay' : 0,
|
1670
|
+
'hoverDelayIdle' : 250
|
1260
1671
|
},
|
1261
1672
|
|
1262
1673
|
remainIdle: false,
|
1263
1674
|
|
1675
|
+
boot: function() {
|
1676
|
+
|
1677
|
+
var triggerevent = UI.support.touch ? "click" : "mouseenter";
|
1678
|
+
|
1679
|
+
// init code
|
1680
|
+
UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
|
1681
|
+
|
1682
|
+
var ele = UI.$(this);
|
1683
|
+
|
1684
|
+
if (!ele.data("dropdown")) {
|
1685
|
+
|
1686
|
+
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
|
1687
|
+
|
1688
|
+
if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
|
1689
|
+
dropdown.element.trigger(triggerevent);
|
1690
|
+
}
|
1691
|
+
|
1692
|
+
if (dropdown.element.find('.uk-dropdown').length) {
|
1693
|
+
e.preventDefault();
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
});
|
1697
|
+
},
|
1698
|
+
|
1264
1699
|
init: function() {
|
1265
1700
|
|
1266
1701
|
var $this = this;
|
1267
1702
|
|
1268
|
-
this.dropdown
|
1703
|
+
this.dropdown = this.find('.uk-dropdown');
|
1269
1704
|
|
1270
|
-
this.centered = this.dropdown.hasClass(
|
1271
|
-
this.justified = this.options.justify ?
|
1705
|
+
this.centered = this.dropdown.hasClass('uk-dropdown-center');
|
1706
|
+
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
1272
1707
|
|
1273
|
-
this.boundary =
|
1708
|
+
this.boundary = UI.$(this.options.boundary);
|
1274
1709
|
this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
|
1275
1710
|
|
1276
1711
|
if (!this.boundary.length) {
|
1277
1712
|
this.boundary = UI.$win;
|
1278
1713
|
}
|
1279
1714
|
|
1715
|
+
// Init ARIA
|
1716
|
+
this.element.attr('aria-haspopup', 'true');
|
1717
|
+
this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
|
1718
|
+
|
1280
1719
|
if (this.options.mode == "click" || UI.support.touch) {
|
1281
1720
|
|
1282
|
-
this.on("click", function(e) {
|
1721
|
+
this.on("click.uikit.dropdown", function(e) {
|
1283
1722
|
|
1284
|
-
var $target =
|
1723
|
+
var $target = UI.$(e.target);
|
1285
1724
|
|
1286
1725
|
if (!$target.parents(".uk-dropdown").length) {
|
1287
1726
|
|
1288
|
-
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
|
1727
|
+
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
|
1289
1728
|
e.preventDefault();
|
1290
1729
|
}
|
1291
1730
|
|
1292
1731
|
$target.blur();
|
1293
1732
|
}
|
1294
1733
|
|
1295
|
-
if (!$this.element.hasClass(
|
1734
|
+
if (!$this.element.hasClass('uk-open')) {
|
1296
1735
|
|
1297
1736
|
$this.show();
|
1298
1737
|
|
@@ -1316,7 +1755,21 @@
|
|
1316
1755
|
clearTimeout(hoverIdle);
|
1317
1756
|
}
|
1318
1757
|
|
1319
|
-
|
1758
|
+
if (active && active == $this) {
|
1759
|
+
return;
|
1760
|
+
}
|
1761
|
+
|
1762
|
+
// pseudo manuAim
|
1763
|
+
if (active && active != $this) {
|
1764
|
+
|
1765
|
+
hoverIdle = setTimeout(function() {
|
1766
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
1767
|
+
}, $this.options.hoverDelayIdle);
|
1768
|
+
|
1769
|
+
} else {
|
1770
|
+
|
1771
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
1772
|
+
}
|
1320
1773
|
|
1321
1774
|
}).on("mouseleave", function() {
|
1322
1775
|
|
@@ -1325,12 +1778,12 @@
|
|
1325
1778
|
}
|
1326
1779
|
|
1327
1780
|
$this.remainIdle = setTimeout(function() {
|
1328
|
-
$this.hide();
|
1781
|
+
if (active && active == $this) $this.hide();
|
1329
1782
|
}, $this.options.remaintime);
|
1330
1783
|
|
1331
1784
|
}).on("click", function(e){
|
1332
1785
|
|
1333
|
-
var $target =
|
1786
|
+
var $target = UI.$(e.target);
|
1334
1787
|
|
1335
1788
|
if ($this.remainIdle) {
|
1336
1789
|
clearTimeout($this.remainIdle);
|
@@ -1349,8 +1802,8 @@
|
|
1349
1802
|
|
1350
1803
|
UI.$html.off("click.outer.dropdown");
|
1351
1804
|
|
1352
|
-
if (active && active
|
1353
|
-
active.
|
1805
|
+
if (active && active != this) {
|
1806
|
+
active.hide();
|
1354
1807
|
}
|
1355
1808
|
|
1356
1809
|
if (hoverIdle) {
|
@@ -1358,20 +1811,34 @@
|
|
1358
1811
|
}
|
1359
1812
|
|
1360
1813
|
this.checkDimensions();
|
1361
|
-
this.element.addClass(
|
1362
|
-
this.trigger('uk.dropdown.show', [this]);
|
1814
|
+
this.element.addClass('uk-open');
|
1363
1815
|
|
1364
|
-
|
1365
|
-
|
1816
|
+
// Update ARIA
|
1817
|
+
this.element.attr('aria-expanded', 'true');
|
1366
1818
|
|
1367
|
-
this.
|
1368
|
-
|
1819
|
+
this.trigger('show.uk.dropdown', [this]);
|
1820
|
+
|
1821
|
+
UI.Utils.checkDisplay(this.dropdown, true);
|
1822
|
+
active = this;
|
1823
|
+
|
1824
|
+
this.registerOuterClick();
|
1825
|
+
},
|
1369
1826
|
|
1370
1827
|
hide: function() {
|
1371
|
-
this.element.removeClass(
|
1828
|
+
this.element.removeClass('uk-open');
|
1829
|
+
|
1830
|
+
if (this.remainIdle) {
|
1831
|
+
clearTimeout(this.remainIdle);
|
1832
|
+
}
|
1833
|
+
|
1372
1834
|
this.remainIdle = false;
|
1373
1835
|
|
1374
|
-
|
1836
|
+
// Update ARIA
|
1837
|
+
this.element.attr('aria-expanded', 'false');
|
1838
|
+
|
1839
|
+
this.trigger('hide.uk.dropdown', [this]);
|
1840
|
+
|
1841
|
+
if (active == this) active = false;
|
1375
1842
|
},
|
1376
1843
|
|
1377
1844
|
registerOuterClick: function(){
|
@@ -1388,9 +1855,9 @@
|
|
1388
1855
|
clearTimeout(hoverIdle);
|
1389
1856
|
}
|
1390
1857
|
|
1391
|
-
var $target =
|
1858
|
+
var $target = UI.$(e.target);
|
1392
1859
|
|
1393
|
-
if (active
|
1860
|
+
if (active == $this && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
|
1394
1861
|
$this.hide();
|
1395
1862
|
UI.$html.off("click.outer.dropdown");
|
1396
1863
|
}
|
@@ -1407,7 +1874,7 @@
|
|
1407
1874
|
}
|
1408
1875
|
|
1409
1876
|
var $this = this,
|
1410
|
-
dropdown = this.dropdown.css("margin-" +
|
1877
|
+
dropdown = this.dropdown.css("margin-" + UI.langdirection, ""),
|
1411
1878
|
offset = dropdown.show().offset(),
|
1412
1879
|
width = dropdown.outerWidth(),
|
1413
1880
|
boundarywidth = this.boundary.width(),
|
@@ -1415,12 +1882,12 @@
|
|
1415
1882
|
|
1416
1883
|
// centered dropdown
|
1417
1884
|
if (this.centered) {
|
1418
|
-
dropdown.css("margin-" +
|
1885
|
+
dropdown.css("margin-" + UI.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
|
1419
1886
|
offset = dropdown.offset();
|
1420
1887
|
|
1421
1888
|
// reset dropdown
|
1422
1889
|
if ((width + offset.left) > boundarywidth || offset.left < 0) {
|
1423
|
-
dropdown.css("margin-" +
|
1890
|
+
dropdown.css("margin-" + UI.langdirection, "");
|
1424
1891
|
offset = dropdown.offset();
|
1425
1892
|
}
|
1426
1893
|
}
|
@@ -1432,7 +1899,7 @@
|
|
1432
1899
|
|
1433
1900
|
dropdown.css("min-width", jwidth);
|
1434
1901
|
|
1435
|
-
if (
|
1902
|
+
if (UI.langdirection == 'right') {
|
1436
1903
|
|
1437
1904
|
var right1 = boundarywidth - (this.justified.offset().left + jwidth),
|
1438
1905
|
right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
|
@@ -1448,7 +1915,7 @@
|
|
1448
1915
|
}
|
1449
1916
|
|
1450
1917
|
if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
|
1451
|
-
dropdown.addClass(
|
1918
|
+
dropdown.addClass('uk-dropdown-flip');
|
1452
1919
|
offset = dropdown.offset();
|
1453
1920
|
}
|
1454
1921
|
|
@@ -1456,23 +1923,23 @@
|
|
1456
1923
|
|
1457
1924
|
dropdown.addClass("uk-dropdown-stack");
|
1458
1925
|
|
1459
|
-
if (dropdown.hasClass(
|
1926
|
+
if (dropdown.hasClass('uk-dropdown-flip')) {
|
1460
1927
|
|
1461
1928
|
if (!this.flipped) {
|
1462
|
-
dropdown.removeClass(
|
1929
|
+
dropdown.removeClass('uk-dropdown-flip');
|
1463
1930
|
offset = dropdown.offset();
|
1464
|
-
dropdown.addClass(
|
1931
|
+
dropdown.addClass('uk-dropdown-flip');
|
1465
1932
|
}
|
1466
1933
|
|
1467
1934
|
setTimeout(function(){
|
1468
1935
|
|
1469
1936
|
if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
|
1470
|
-
dropdown.removeClass(
|
1937
|
+
dropdown.removeClass('uk-dropdown-flip');
|
1471
1938
|
}
|
1472
1939
|
}, 0);
|
1473
1940
|
}
|
1474
1941
|
|
1475
|
-
this.trigger('uk.dropdown
|
1942
|
+
this.trigger('stack.uk.dropdown', [this]);
|
1476
1943
|
}
|
1477
1944
|
|
1478
1945
|
dropdown.css("display", "");
|
@@ -1480,30 +1947,9 @@
|
|
1480
1947
|
|
1481
1948
|
});
|
1482
1949
|
|
1483
|
-
|
1484
|
-
|
1485
|
-
// init code
|
1486
|
-
UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
|
1950
|
+
})(UIkit);
|
1487
1951
|
|
1488
|
-
|
1489
|
-
|
1490
|
-
if (!ele.data("dropdown")) {
|
1491
|
-
|
1492
|
-
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
|
1493
|
-
|
1494
|
-
if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
|
1495
|
-
dropdown.element.trigger(triggerevent);
|
1496
|
-
}
|
1497
|
-
|
1498
|
-
if(dropdown.element.find('.uk-dropdown').length) {
|
1499
|
-
e.preventDefault();
|
1500
|
-
}
|
1501
|
-
}
|
1502
|
-
});
|
1503
|
-
|
1504
|
-
})(jQuery, jQuery.UIkit);
|
1505
|
-
|
1506
|
-
(function($, UI) {
|
1952
|
+
(function(UI) {
|
1507
1953
|
|
1508
1954
|
"use strict";
|
1509
1955
|
|
@@ -1516,6 +1962,21 @@
|
|
1516
1962
|
"row" : true
|
1517
1963
|
},
|
1518
1964
|
|
1965
|
+
boot: function() {
|
1966
|
+
|
1967
|
+
// init code
|
1968
|
+
UI.ready(function(context) {
|
1969
|
+
|
1970
|
+
UI.$("[data-uk-grid-match]", context).each(function() {
|
1971
|
+
var grid = UI.$(this), obj;
|
1972
|
+
|
1973
|
+
if (!grid.data("gridMatchHeight")) {
|
1974
|
+
obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
|
1975
|
+
}
|
1976
|
+
});
|
1977
|
+
});
|
1978
|
+
},
|
1979
|
+
|
1519
1980
|
init: function() {
|
1520
1981
|
|
1521
1982
|
var $this = this;
|
@@ -1525,27 +1986,24 @@
|
|
1525
1986
|
|
1526
1987
|
if (!this.columns.length) return;
|
1527
1988
|
|
1528
|
-
UI.$win.on('resize orientationchange', (function() {
|
1989
|
+
UI.$win.on('load resize orientationchange', (function() {
|
1529
1990
|
|
1530
1991
|
var fn = function() {
|
1531
1992
|
$this.match();
|
1532
1993
|
};
|
1533
1994
|
|
1534
|
-
|
1535
|
-
fn();
|
1536
|
-
UI.$win.on("load", fn);
|
1537
|
-
});
|
1995
|
+
UI.$(function() { fn(); });
|
1538
1996
|
|
1539
1997
|
return UI.Utils.debounce(fn, 50);
|
1540
1998
|
})());
|
1541
1999
|
|
1542
|
-
UI.$html.on("uk.dom
|
2000
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
1543
2001
|
$this.columns = $this.element.children();
|
1544
2002
|
$this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
|
1545
2003
|
$this.match();
|
1546
2004
|
});
|
1547
2005
|
|
1548
|
-
this.on("uk.check
|
2006
|
+
this.on("display.uk.check", function(e) {
|
1549
2007
|
if(this.element.is(":visible")) this.match();
|
1550
2008
|
}.bind(this));
|
1551
2009
|
|
@@ -1554,121 +2012,128 @@
|
|
1554
2012
|
|
1555
2013
|
match: function() {
|
1556
2014
|
|
1557
|
-
this.revert();
|
1558
|
-
|
1559
2015
|
var firstvisible = this.columns.filter(":visible:first");
|
1560
2016
|
|
1561
2017
|
if (!firstvisible.length) return;
|
1562
2018
|
|
1563
|
-
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100
|
1564
|
-
max = 0,
|
1565
|
-
$this = this;
|
1566
|
-
|
1567
|
-
if (stacked) return;
|
2019
|
+
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
|
1568
2020
|
|
1569
|
-
if(
|
2021
|
+
if (stacked) {
|
2022
|
+
this.revert();
|
2023
|
+
} else {
|
2024
|
+
UI.Utils.matchHeights(this.elements, this.options);
|
2025
|
+
}
|
1570
2026
|
|
1571
|
-
|
2027
|
+
return this;
|
2028
|
+
},
|
1572
2029
|
|
1573
|
-
|
2030
|
+
revert: function() {
|
2031
|
+
this.elements.css('min-height', '');
|
2032
|
+
return this;
|
2033
|
+
}
|
2034
|
+
});
|
1574
2035
|
|
1575
|
-
|
2036
|
+
UI.component('gridMargin', {
|
1576
2037
|
|
1577
|
-
|
1578
|
-
|
2038
|
+
defaults: {
|
2039
|
+
"cls": "uk-grid-margin"
|
2040
|
+
},
|
1579
2041
|
|
1580
|
-
|
2042
|
+
boot: function() {
|
1581
2043
|
|
1582
|
-
|
1583
|
-
|
1584
|
-
offset = ele.offset().top;
|
1585
|
-
}
|
2044
|
+
// init code
|
2045
|
+
UI.ready(function(context) {
|
1586
2046
|
|
1587
|
-
|
1588
|
-
|
1589
|
-
});
|
2047
|
+
UI.$("[data-uk-grid-margin]", context).each(function() {
|
2048
|
+
var grid = UI.$(this), obj;
|
1590
2049
|
|
1591
|
-
if(
|
1592
|
-
|
2050
|
+
if (!grid.data("gridMargin")) {
|
2051
|
+
obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
|
1593
2052
|
}
|
2053
|
+
});
|
2054
|
+
});
|
2055
|
+
},
|
1594
2056
|
|
1595
|
-
|
2057
|
+
init: function() {
|
1596
2058
|
|
1597
|
-
|
2059
|
+
var stackMargin = UI.stackMargin(this.element, this.options);
|
2060
|
+
}
|
2061
|
+
});
|
1598
2062
|
|
1599
|
-
|
1600
|
-
}
|
2063
|
+
// helper
|
1601
2064
|
|
1602
|
-
|
1603
|
-
},
|
2065
|
+
UI.Utils.matchHeights = function(elements, options) {
|
1604
2066
|
|
1605
|
-
|
1606
|
-
|
1607
|
-
return this;
|
1608
|
-
},
|
2067
|
+
elements = UI.$(elements).css('min-height', '');
|
2068
|
+
options = UI.$.extend({ row : true }, options);
|
1609
2069
|
|
1610
|
-
matchHeights
|
2070
|
+
var matchHeights = function(group){
|
1611
2071
|
|
1612
|
-
if(
|
2072
|
+
if(group.length < 2) return;
|
1613
2073
|
|
1614
2074
|
var max = 0;
|
1615
2075
|
|
1616
|
-
|
1617
|
-
max = Math.max(max,
|
1618
|
-
}).each(function(
|
2076
|
+
group.each(function() {
|
2077
|
+
max = Math.max(max, UI.$(this).outerHeight());
|
2078
|
+
}).each(function() {
|
2079
|
+
|
2080
|
+
var element = UI.$(this),
|
2081
|
+
height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
|
1619
2082
|
|
1620
|
-
var element = $(this),
|
1621
|
-
height = max - (element.outerHeight() - element.height());
|
1622
2083
|
|
1623
2084
|
element.css('min-height', height + 'px');
|
1624
2085
|
});
|
1625
|
-
}
|
1626
|
-
});
|
2086
|
+
};
|
1627
2087
|
|
1628
|
-
|
2088
|
+
if(options.row) {
|
1629
2089
|
|
1630
|
-
|
1631
|
-
"cls": "uk-grid-margin"
|
1632
|
-
},
|
2090
|
+
elements.first().width(); // force redraw
|
1633
2091
|
|
1634
|
-
|
2092
|
+
setTimeout(function(){
|
1635
2093
|
|
1636
|
-
|
2094
|
+
var lastoffset = false, group = [];
|
1637
2095
|
|
1638
|
-
|
1639
|
-
}
|
1640
|
-
});
|
2096
|
+
elements.each(function() {
|
1641
2097
|
|
2098
|
+
var ele = UI.$(this), offset = ele.offset().top;
|
1642
2099
|
|
1643
|
-
|
1644
|
-
UI.ready(function(context) {
|
2100
|
+
if(offset != lastoffset && group.length) {
|
1645
2101
|
|
1646
|
-
|
1647
|
-
|
2102
|
+
matchHeights(UI.$(group));
|
2103
|
+
group = [];
|
2104
|
+
offset = ele.offset().top;
|
2105
|
+
}
|
1648
2106
|
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
2107
|
+
group.push(ele);
|
2108
|
+
lastoffset = offset;
|
2109
|
+
});
|
1652
2110
|
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
2111
|
+
if(group.length) {
|
2112
|
+
matchHeights(UI.$(group));
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
}, 0);
|
2116
|
+
|
2117
|
+
} else {
|
2118
|
+
matchHeights(elements);
|
2119
|
+
}
|
2120
|
+
};
|
2121
|
+
|
2122
|
+
})(UIkit);
|
1658
2123
|
|
1659
|
-
|
1660
|
-
(function($, UI) {
|
2124
|
+
(function(UI) {
|
1661
2125
|
|
1662
2126
|
"use strict";
|
1663
2127
|
|
1664
|
-
var active = false, $html =
|
2128
|
+
var active = false, $html = UI.$html, body;
|
1665
2129
|
|
1666
2130
|
UI.component('modal', {
|
1667
2131
|
|
1668
2132
|
defaults: {
|
1669
2133
|
keyboard: true,
|
1670
2134
|
bgclose: true,
|
1671
|
-
minScrollHeight: 150
|
2135
|
+
minScrollHeight: 150,
|
2136
|
+
center: false
|
1672
2137
|
},
|
1673
2138
|
|
1674
2139
|
scrollable: false,
|
@@ -1676,21 +2141,24 @@
|
|
1676
2141
|
|
1677
2142
|
init: function() {
|
1678
2143
|
|
1679
|
-
if (!body) body =
|
2144
|
+
if (!body) body = UI.$('body');
|
2145
|
+
|
2146
|
+
if (!this.element.length) return;
|
1680
2147
|
|
1681
2148
|
var $this = this;
|
1682
2149
|
|
1683
|
-
this.transition = UI.support.transition;
|
1684
2150
|
this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
|
1685
2151
|
this.dialog = this.find(".uk-modal-dialog");
|
1686
2152
|
|
2153
|
+
// Update ARIA
|
2154
|
+
this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
|
2155
|
+
|
1687
2156
|
this.on("click", ".uk-modal-close", function(e) {
|
1688
2157
|
e.preventDefault();
|
1689
2158
|
$this.hide();
|
1690
|
-
|
1691
2159
|
}).on("click", function(e) {
|
1692
2160
|
|
1693
|
-
var target =
|
2161
|
+
var target = UI.$(e.target);
|
1694
2162
|
|
1695
2163
|
if (target[0] == $this.element[0] && $this.options.bgclose) {
|
1696
2164
|
$this.hide();
|
@@ -1704,6 +2172,8 @@
|
|
1704
2172
|
|
1705
2173
|
show: function() {
|
1706
2174
|
|
2175
|
+
if (!this.element.length) return;
|
2176
|
+
|
1707
2177
|
var $this = this;
|
1708
2178
|
|
1709
2179
|
if (this.isActive()) return;
|
@@ -1711,13 +2181,18 @@
|
|
1711
2181
|
|
1712
2182
|
this.element.removeClass("uk-open").show();
|
1713
2183
|
this.resize();
|
1714
|
-
|
1715
2184
|
active = this;
|
2185
|
+
|
2186
|
+
this.element.addClass("uk-open");
|
2187
|
+
|
1716
2188
|
$html.addClass("uk-modal-page").height(); // force browser engine redraw
|
1717
2189
|
|
1718
|
-
|
2190
|
+
// Update ARIA
|
2191
|
+
this.element.attr('aria-hidden', 'false');
|
2192
|
+
|
2193
|
+
this.element.trigger("show.uk.modal");
|
1719
2194
|
|
1720
|
-
UI.Utils.checkDisplay(this.dialog);
|
2195
|
+
UI.Utils.checkDisplay(this.dialog, true);
|
1721
2196
|
|
1722
2197
|
return this;
|
1723
2198
|
},
|
@@ -1752,40 +2227,55 @@
|
|
1752
2227
|
|
1753
2228
|
this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
|
1754
2229
|
|
1755
|
-
this.updateScrollable()
|
2230
|
+
if (!this.updateScrollable() && this.options.center) {
|
1756
2231
|
|
2232
|
+
var dh = this.dialog.outerHeight(),
|
2233
|
+
pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
|
2234
|
+
|
2235
|
+
if ((dh + pad) < window.innerHeight) {
|
2236
|
+
this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
|
2237
|
+
} else {
|
2238
|
+
this.dialog.css({'top': ''});
|
2239
|
+
}
|
2240
|
+
}
|
1757
2241
|
},
|
1758
2242
|
|
1759
2243
|
updateScrollable: function() {
|
1760
2244
|
|
1761
2245
|
// has scrollable?
|
1762
|
-
|
1763
2246
|
var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
|
1764
2247
|
|
1765
|
-
if (scrollable) {
|
2248
|
+
if (scrollable.length) {
|
1766
2249
|
|
1767
2250
|
scrollable.css("height", 0);
|
1768
2251
|
|
1769
2252
|
var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
2253
|
+
dh = this.dialog.outerHeight(),
|
2254
|
+
wh = window.innerHeight,
|
2255
|
+
h = wh - 2*(offset < 20 ? 20:offset) - dh;
|
1773
2256
|
|
1774
2257
|
scrollable.css("height", h < this.options.minScrollHeight ? "":h);
|
2258
|
+
|
2259
|
+
return true;
|
1775
2260
|
}
|
2261
|
+
|
2262
|
+
return false;
|
1776
2263
|
},
|
1777
2264
|
|
1778
2265
|
_hide: function() {
|
1779
2266
|
|
1780
2267
|
this.element.hide().removeClass("uk-open");
|
1781
2268
|
|
2269
|
+
// Update ARIA
|
2270
|
+
this.element.attr('aria-hidden', 'true');
|
2271
|
+
|
1782
2272
|
$html.removeClass("uk-modal-page");
|
1783
2273
|
|
1784
2274
|
body.css(this.paddingdir, "");
|
1785
2275
|
|
1786
2276
|
if(active===this) active = false;
|
1787
2277
|
|
1788
|
-
this.trigger("uk.modal
|
2278
|
+
this.trigger("hide.uk.modal");
|
1789
2279
|
},
|
1790
2280
|
|
1791
2281
|
isActive: function() {
|
@@ -1796,11 +2286,43 @@
|
|
1796
2286
|
|
1797
2287
|
UI.component('modalTrigger', {
|
1798
2288
|
|
2289
|
+
boot: function() {
|
2290
|
+
|
2291
|
+
// init code
|
2292
|
+
UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
|
2293
|
+
|
2294
|
+
var ele = UI.$(this);
|
2295
|
+
|
2296
|
+
if (ele.is("a")) {
|
2297
|
+
e.preventDefault();
|
2298
|
+
}
|
2299
|
+
|
2300
|
+
if (!ele.data("modalTrigger")) {
|
2301
|
+
var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
|
2302
|
+
modal.show();
|
2303
|
+
}
|
2304
|
+
|
2305
|
+
});
|
2306
|
+
|
2307
|
+
// close modal on esc button
|
2308
|
+
UI.$html.on('keydown.modal.uikit', function (e) {
|
2309
|
+
|
2310
|
+
if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
|
2311
|
+
e.preventDefault();
|
2312
|
+
active.hide();
|
2313
|
+
}
|
2314
|
+
});
|
2315
|
+
|
2316
|
+
UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
|
2317
|
+
if (active) active.resize();
|
2318
|
+
}, 150));
|
2319
|
+
},
|
2320
|
+
|
1799
2321
|
init: function() {
|
1800
2322
|
|
1801
2323
|
var $this = this;
|
1802
2324
|
|
1803
|
-
this.options =
|
2325
|
+
this.options = UI.$.extend({
|
1804
2326
|
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
1805
2327
|
}, this.options);
|
1806
2328
|
|
@@ -1818,9 +2340,9 @@
|
|
1818
2340
|
|
1819
2341
|
UI.modal.dialog = function(content, options) {
|
1820
2342
|
|
1821
|
-
var modal = UI.modal(
|
2343
|
+
var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
|
1822
2344
|
|
1823
|
-
modal.on("uk.modal
|
2345
|
+
modal.on("hide.uk.modal", function(){
|
1824
2346
|
if (modal.persist) {
|
1825
2347
|
modal.persist.appendTo(modal.persist.data("modalPersistParent"));
|
1826
2348
|
modal.persist = false;
|
@@ -1833,24 +2355,24 @@
|
|
1833
2355
|
return modal;
|
1834
2356
|
};
|
1835
2357
|
|
1836
|
-
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog"></div></div>';
|
2358
|
+
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
1837
2359
|
|
1838
2360
|
UI.modal.alert = function(content, options) {
|
1839
2361
|
|
1840
2362
|
UI.modal.dialog(([
|
1841
2363
|
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
1842
|
-
'<div class="uk-modal-
|
1843
|
-
]).join(""),
|
2364
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
|
2365
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options)).show();
|
1844
2366
|
};
|
1845
2367
|
|
1846
2368
|
UI.modal.confirm = function(content, onconfirm, options) {
|
1847
2369
|
|
1848
|
-
onconfirm =
|
2370
|
+
onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
|
1849
2371
|
|
1850
2372
|
var modal = UI.modal.dialog(([
|
1851
2373
|
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
1852
|
-
'<div class="uk-modal-
|
1853
|
-
]).join(""),
|
2374
|
+
'<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>'
|
2375
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options));
|
1854
2376
|
|
1855
2377
|
modal.element.find(".js-modal-confirm").on("click", function(){
|
1856
2378
|
onconfirm();
|
@@ -1860,34 +2382,37 @@
|
|
1860
2382
|
modal.show();
|
1861
2383
|
};
|
1862
2384
|
|
1863
|
-
|
1864
|
-
UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
|
1865
|
-
|
1866
|
-
var ele = $(this);
|
2385
|
+
UI.modal.prompt = function(text, value, onsubmit, options) {
|
1867
2386
|
|
1868
|
-
|
1869
|
-
e.preventDefault();
|
1870
|
-
}
|
2387
|
+
onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
|
1871
2388
|
|
1872
|
-
|
1873
|
-
|
1874
|
-
modal
|
1875
|
-
|
2389
|
+
var modal = UI.modal.dialog(([
|
2390
|
+
text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
|
2391
|
+
'<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
|
2392
|
+
'<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>'
|
2393
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options)),
|
2394
|
+
input = modal.element.find("input[type='text']").val(value || '');
|
2395
|
+
|
2396
|
+
modal.element.find(".js-modal-ok").on("click", function(){
|
2397
|
+
if (onsubmit(input.val())!==false){
|
2398
|
+
modal.hide();
|
2399
|
+
}
|
2400
|
+
});
|
2401
|
+
modal.show();
|
2402
|
+
setTimeout(function(){ input.focus(); }, 100);
|
2403
|
+
};
|
1876
2404
|
|
1877
|
-
|
2405
|
+
UI.modal.blockUI = function(content, options) {
|
1878
2406
|
|
1879
|
-
|
1880
|
-
|
2407
|
+
var modal = UI.modal.dialog(([
|
2408
|
+
'<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
|
2409
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false}, options));
|
1881
2410
|
|
1882
|
-
|
1883
|
-
|
1884
|
-
active.hide();
|
1885
|
-
}
|
1886
|
-
});
|
2411
|
+
modal.content = modal.element.find('.uk-modal-content:first');
|
2412
|
+
modal.show();
|
1887
2413
|
|
1888
|
-
|
1889
|
-
|
1890
|
-
}, 150));
|
2414
|
+
return modal;
|
2415
|
+
};
|
1891
2416
|
|
1892
2417
|
|
1893
2418
|
// helper functions
|
@@ -1898,7 +2423,7 @@
|
|
1898
2423
|
if (typeof content === 'object') {
|
1899
2424
|
|
1900
2425
|
// convert DOM object to a jQuery object
|
1901
|
-
content = content instanceof jQuery ? content :
|
2426
|
+
content = content instanceof jQuery ? content : UI.$(content);
|
1902
2427
|
|
1903
2428
|
if(content.parent().length) {
|
1904
2429
|
modal.persist = content;
|
@@ -1906,10 +2431,10 @@
|
|
1906
2431
|
}
|
1907
2432
|
}else if (typeof content === 'string' || typeof content === 'number') {
|
1908
2433
|
// just insert the data as innerHTML
|
1909
|
-
content =
|
2434
|
+
content = UI.$('<div></div>').html(content);
|
1910
2435
|
}else {
|
1911
2436
|
// unsupported data type!
|
1912
|
-
content =
|
2437
|
+
content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
|
1913
2438
|
}
|
1914
2439
|
|
1915
2440
|
content.appendTo(modal.element.find('.uk-modal-dialog'));
|
@@ -1917,9 +2442,9 @@
|
|
1917
2442
|
return modal;
|
1918
2443
|
}
|
1919
2444
|
|
1920
|
-
})(
|
2445
|
+
})(UIkit);
|
1921
2446
|
|
1922
|
-
(function(
|
2447
|
+
(function(UI) {
|
1923
2448
|
|
1924
2449
|
"use strict";
|
1925
2450
|
|
@@ -1931,24 +2456,42 @@
|
|
1931
2456
|
"multiple": false
|
1932
2457
|
},
|
1933
2458
|
|
2459
|
+
boot: function() {
|
2460
|
+
|
2461
|
+
// init code
|
2462
|
+
UI.ready(function(context) {
|
2463
|
+
|
2464
|
+
UI.$("[data-uk-nav]", context).each(function() {
|
2465
|
+
var nav = UI.$(this);
|
2466
|
+
|
2467
|
+
if (!nav.data("nav")) {
|
2468
|
+
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
|
2469
|
+
}
|
2470
|
+
});
|
2471
|
+
});
|
2472
|
+
},
|
2473
|
+
|
1934
2474
|
init: function() {
|
1935
2475
|
|
1936
2476
|
var $this = this;
|
1937
2477
|
|
1938
|
-
this.on("click", this.options.toggle, function(e) {
|
2478
|
+
this.on("click.uikit.nav", this.options.toggle, function(e) {
|
1939
2479
|
e.preventDefault();
|
1940
|
-
var ele =
|
2480
|
+
var ele = UI.$(this);
|
1941
2481
|
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
|
1942
2482
|
});
|
1943
2483
|
|
1944
2484
|
this.find(this.options.lists).each(function() {
|
1945
|
-
var $ele =
|
2485
|
+
var $ele = UI.$(this),
|
1946
2486
|
parent = $ele.parent(),
|
1947
2487
|
active = parent.hasClass("uk-active");
|
1948
2488
|
|
1949
2489
|
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
|
1950
2490
|
parent.data("list-container", $ele.parent());
|
1951
2491
|
|
2492
|
+
// Init ARIA
|
2493
|
+
parent.attr('aria-expanded', parent.hasClass("uk-open"));
|
2494
|
+
|
1952
2495
|
if (active) $this.open(parent, true);
|
1953
2496
|
});
|
1954
2497
|
|
@@ -1956,14 +2499,17 @@
|
|
1956
2499
|
|
1957
2500
|
open: function(li, noanimation) {
|
1958
2501
|
|
1959
|
-
var element = this.element, $li =
|
2502
|
+
var $this = this, element = this.element, $li = UI.$(li);
|
1960
2503
|
|
1961
2504
|
if (!this.options.multiple) {
|
1962
2505
|
|
1963
2506
|
element.children(".uk-open").not(li).each(function() {
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
2507
|
+
|
2508
|
+
var ele = UI.$(this);
|
2509
|
+
|
2510
|
+
if (ele.data("list-container")) {
|
2511
|
+
ele.data("list-container").stop().animate({height: 0}, function() {
|
2512
|
+
UI.$(this).parent().removeClass("uk-open");
|
1967
2513
|
});
|
1968
2514
|
}
|
1969
2515
|
});
|
@@ -1971,12 +2517,19 @@
|
|
1971
2517
|
|
1972
2518
|
$li.toggleClass("uk-open");
|
1973
2519
|
|
2520
|
+
// Update ARIA
|
2521
|
+
$li.attr('aria-expanded', $li.hasClass("uk-open"));
|
2522
|
+
|
1974
2523
|
if ($li.data("list-container")) {
|
2524
|
+
|
1975
2525
|
if (noanimation) {
|
1976
2526
|
$li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
|
2527
|
+
this.trigger("display.uk.check");
|
1977
2528
|
} else {
|
1978
2529
|
$li.data('list-container').stop().animate({
|
1979
2530
|
height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
|
2531
|
+
}, function() {
|
2532
|
+
$this.trigger("display.uk.check");
|
1980
2533
|
});
|
1981
2534
|
}
|
1982
2535
|
}
|
@@ -1987,7 +2540,7 @@
|
|
1987
2540
|
// helper
|
1988
2541
|
|
1989
2542
|
function getHeight(ele) {
|
1990
|
-
var $ele =
|
2543
|
+
var $ele = UI.$(ele), height = "auto";
|
1991
2544
|
|
1992
2545
|
if ($ele.is(":visible")) {
|
1993
2546
|
height = $ele.outerHeight();
|
@@ -2006,20 +2559,9 @@
|
|
2006
2559
|
return height;
|
2007
2560
|
}
|
2008
2561
|
|
2009
|
-
|
2010
|
-
UI.ready(function(context) {
|
2562
|
+
})(UIkit);
|
2011
2563
|
|
2012
|
-
|
2013
|
-
var nav = $(this);
|
2014
|
-
|
2015
|
-
if (!nav.data("nav")) {
|
2016
|
-
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
|
2017
|
-
}
|
2018
|
-
});
|
2019
|
-
});
|
2020
|
-
|
2021
|
-
})(jQuery, jQuery.UIkit);
|
2022
|
-
(function($, UI) {
|
2564
|
+
(function(UI) {
|
2023
2565
|
|
2024
2566
|
"use strict";
|
2025
2567
|
|
@@ -2031,13 +2573,13 @@
|
|
2031
2573
|
|
2032
2574
|
show: function(element) {
|
2033
2575
|
|
2034
|
-
element =
|
2576
|
+
element = UI.$(element);
|
2035
2577
|
|
2036
2578
|
if (!element.length) return;
|
2037
2579
|
|
2038
|
-
var $body =
|
2580
|
+
var $body = UI.$('body'),
|
2039
2581
|
bar = element.find(".uk-offcanvas-bar:first"),
|
2040
|
-
rtl = (
|
2582
|
+
rtl = (UI.langdirection == "right"),
|
2041
2583
|
flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
|
2042
2584
|
dir = flip * (rtl ? -1 : 1);
|
2043
2585
|
|
@@ -2045,58 +2587,45 @@
|
|
2045
2587
|
|
2046
2588
|
element.addClass("uk-active");
|
2047
2589
|
|
2048
|
-
$body.css({"width": window.innerWidth, "height":
|
2590
|
+
$body.css({"width": window.innerWidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
|
2049
2591
|
$body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
|
2050
2592
|
|
2051
2593
|
$html.css('margin-top', scrollpos.y * -1);
|
2052
2594
|
|
2053
2595
|
bar.addClass("uk-offcanvas-bar-show");
|
2054
2596
|
|
2055
|
-
|
2056
|
-
|
2057
|
-
var target = $(e.target);
|
2058
|
-
|
2059
|
-
if (!e.type.match(/swipe/)) {
|
2060
|
-
|
2061
|
-
if (!target.hasClass("uk-offcanvas-close")) {
|
2062
|
-
if (target.hasClass("uk-offcanvas-bar")) return;
|
2063
|
-
if (target.parents(".uk-offcanvas-bar:first").length) return;
|
2064
|
-
}
|
2065
|
-
}
|
2066
|
-
|
2067
|
-
e.stopImmediatePropagation();
|
2068
|
-
Offcanvas.hide();
|
2069
|
-
});
|
2597
|
+
this._initElement(element);
|
2070
2598
|
|
2071
|
-
|
2072
|
-
if (e.keyCode === 27) { // ESC
|
2073
|
-
Offcanvas.hide();
|
2074
|
-
}
|
2075
|
-
});
|
2599
|
+
bar.trigger('show.uk.offcanvas', [element, bar]);
|
2076
2600
|
|
2077
|
-
|
2601
|
+
// Update ARIA
|
2602
|
+
element.attr('aria-hidden', 'false');
|
2078
2603
|
},
|
2079
2604
|
|
2080
2605
|
hide: function(force) {
|
2081
2606
|
|
2082
|
-
var $body =
|
2083
|
-
panel =
|
2084
|
-
rtl = (
|
2607
|
+
var $body = UI.$('body'),
|
2608
|
+
panel = UI.$(".uk-offcanvas.uk-active"),
|
2609
|
+
rtl = (UI.langdirection == "right"),
|
2085
2610
|
bar = panel.find(".uk-offcanvas-bar:first"),
|
2086
2611
|
finalize = function() {
|
2087
2612
|
$body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
|
2088
2613
|
panel.removeClass("uk-active");
|
2614
|
+
|
2089
2615
|
bar.removeClass("uk-offcanvas-bar-show");
|
2090
2616
|
$html.css('margin-top', '');
|
2091
2617
|
window.scrollTo(scrollpos.x, scrollpos.y);
|
2092
|
-
|
2618
|
+
bar.trigger('hide.uk.offcanvas', [panel, bar]);
|
2619
|
+
|
2620
|
+
// Update ARIA
|
2621
|
+
panel.attr('aria-hidden', 'true');
|
2093
2622
|
};
|
2094
2623
|
|
2095
2624
|
if (!panel.length) return;
|
2096
2625
|
|
2097
|
-
if (
|
2626
|
+
if (UI.support.transition && !force) {
|
2098
2627
|
|
2099
|
-
$body.one(
|
2628
|
+
$body.one(UI.support.transition.end, function() {
|
2100
2629
|
finalize();
|
2101
2630
|
}).css((rtl ? "margin-right" : "margin-left"), "");
|
2102
2631
|
|
@@ -2107,19 +2636,95 @@
|
|
2107
2636
|
} else {
|
2108
2637
|
finalize();
|
2109
2638
|
}
|
2639
|
+
},
|
2640
|
+
|
2641
|
+
_initElement: function(element) {
|
2110
2642
|
|
2111
|
-
|
2112
|
-
|
2643
|
+
if (element.data("OffcanvasInit")) return;
|
2644
|
+
|
2645
|
+
element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) {
|
2646
|
+
|
2647
|
+
var target = UI.$(e.target);
|
2648
|
+
|
2649
|
+
if (!e.type.match(/swipe/)) {
|
2650
|
+
|
2651
|
+
if (!target.hasClass("uk-offcanvas-close")) {
|
2652
|
+
if (target.hasClass("uk-offcanvas-bar")) return;
|
2653
|
+
if (target.parents(".uk-offcanvas-bar:first").length) return;
|
2654
|
+
}
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
e.stopImmediatePropagation();
|
2658
|
+
Offcanvas.hide();
|
2659
|
+
});
|
2660
|
+
|
2661
|
+
element.on("click", "a[href^='#']", function(e){
|
2662
|
+
|
2663
|
+
var link = UI.$(this),
|
2664
|
+
href = link.attr("href");
|
2665
|
+
|
2666
|
+
if (href == "#") {
|
2667
|
+
return;
|
2668
|
+
}
|
2669
|
+
|
2670
|
+
UI.$doc.one('hide.uk.offcanvas', function() {
|
2671
|
+
|
2672
|
+
var target;
|
2673
|
+
|
2674
|
+
try {
|
2675
|
+
target = UI.$(href);
|
2676
|
+
} catch (e){
|
2677
|
+
target = ""
|
2678
|
+
}
|
2679
|
+
|
2680
|
+
if (!target.length) {
|
2681
|
+
target = UI.$('[name="'+href.replace('#','')+'"]');
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
if (target.length && link.attr('data-uk-smooth-scroll') && UI.Utils.scrollToElement) {
|
2685
|
+
UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
|
2686
|
+
} else {
|
2687
|
+
window.location.href = href;
|
2688
|
+
}
|
2689
|
+
});
|
2690
|
+
|
2691
|
+
Offcanvas.hide();
|
2692
|
+
});
|
2693
|
+
|
2694
|
+
element.data("OffcanvasInit", true);
|
2113
2695
|
}
|
2114
2696
|
};
|
2115
2697
|
|
2116
2698
|
UI.component('offcanvasTrigger', {
|
2117
2699
|
|
2700
|
+
boot: function() {
|
2701
|
+
|
2702
|
+
// init code
|
2703
|
+
$html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
|
2704
|
+
|
2705
|
+
e.preventDefault();
|
2706
|
+
|
2707
|
+
var ele = UI.$(this);
|
2708
|
+
|
2709
|
+
if (!ele.data("offcanvasTrigger")) {
|
2710
|
+
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
|
2711
|
+
ele.trigger("click");
|
2712
|
+
}
|
2713
|
+
});
|
2714
|
+
|
2715
|
+
$html.on('keydown.uk.offcanvas', function(e) {
|
2716
|
+
|
2717
|
+
if (e.keyCode === 27) { // ESC
|
2718
|
+
Offcanvas.hide();
|
2719
|
+
}
|
2720
|
+
});
|
2721
|
+
},
|
2722
|
+
|
2118
2723
|
init: function() {
|
2119
2724
|
|
2120
2725
|
var $this = this;
|
2121
2726
|
|
2122
|
-
this.options =
|
2727
|
+
this.options = UI.$.extend({
|
2123
2728
|
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
2124
2729
|
}, this.options);
|
2125
2730
|
|
@@ -2132,21 +2737,9 @@
|
|
2132
2737
|
|
2133
2738
|
UI.offcanvas = Offcanvas;
|
2134
2739
|
|
2135
|
-
|
2136
|
-
$html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
|
2137
|
-
|
2138
|
-
e.preventDefault();
|
2139
|
-
|
2140
|
-
var ele = $(this);
|
2141
|
-
|
2142
|
-
if (!ele.data("offcanvasTrigger")) {
|
2143
|
-
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
|
2144
|
-
ele.trigger("click");
|
2145
|
-
}
|
2146
|
-
});
|
2740
|
+
})(UIkit);
|
2147
2741
|
|
2148
|
-
|
2149
|
-
(function($, UI) {
|
2742
|
+
(function(UI) {
|
2150
2743
|
|
2151
2744
|
"use strict";
|
2152
2745
|
|
@@ -2155,33 +2748,56 @@
|
|
2155
2748
|
UI.component('switcher', {
|
2156
2749
|
|
2157
2750
|
defaults: {
|
2158
|
-
connect
|
2159
|
-
toggle
|
2160
|
-
active
|
2161
|
-
animation: false
|
2751
|
+
connect : false,
|
2752
|
+
toggle : ">*",
|
2753
|
+
active : 0,
|
2754
|
+
animation : false,
|
2755
|
+
duration : 200
|
2756
|
+
},
|
2757
|
+
|
2758
|
+
animating: false,
|
2759
|
+
|
2760
|
+
boot: function() {
|
2761
|
+
|
2762
|
+
// init code
|
2763
|
+
UI.ready(function(context) {
|
2764
|
+
|
2765
|
+
UI.$("[data-uk-switcher]", context).each(function() {
|
2766
|
+
var switcher = UI.$(this);
|
2767
|
+
|
2768
|
+
if (!switcher.data("switcher")) {
|
2769
|
+
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
|
2770
|
+
}
|
2771
|
+
});
|
2772
|
+
});
|
2162
2773
|
},
|
2163
2774
|
|
2164
2775
|
init: function() {
|
2165
2776
|
|
2166
2777
|
var $this = this;
|
2167
2778
|
|
2168
|
-
this.on("click", this.options.toggle, function(e) {
|
2779
|
+
this.on("click.uikit.switcher", this.options.toggle, function(e) {
|
2169
2780
|
e.preventDefault();
|
2170
2781
|
$this.show(this);
|
2171
2782
|
});
|
2172
2783
|
|
2173
2784
|
if (this.options.connect) {
|
2174
2785
|
|
2175
|
-
this.connect =
|
2786
|
+
this.connect = UI.$(this.options.connect);
|
2787
|
+
|
2788
|
+
this.connect.find(".uk-active").removeClass(".uk-active");
|
2176
2789
|
|
2177
2790
|
// delegate switch commands within container content
|
2178
2791
|
if (this.connect.length) {
|
2179
2792
|
|
2793
|
+
// Init ARIA for connect
|
2794
|
+
this.connect.children().attr('aria-hidden', 'true');
|
2795
|
+
|
2180
2796
|
this.connect.on("click", '[data-uk-switcher-item]', function(e) {
|
2181
2797
|
|
2182
2798
|
e.preventDefault();
|
2183
2799
|
|
2184
|
-
var item =
|
2800
|
+
var item = UI.$(this).attr('data-uk-switcher-item');
|
2185
2801
|
|
2186
2802
|
if ($this.index == item) return;
|
2187
2803
|
|
@@ -2191,33 +2807,88 @@
|
|
2191
2807
|
$this.show($this.index + (item=='next' ? 1:-1));
|
2192
2808
|
break;
|
2193
2809
|
default:
|
2194
|
-
$this.show(item);
|
2810
|
+
$this.show(parseInt(item, 10));
|
2811
|
+
}
|
2812
|
+
}).on('swipeRight swipeLeft', function(e) {
|
2813
|
+
e.preventDefault();
|
2814
|
+
if(!window.getSelection().toString()) {
|
2815
|
+
$this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
|
2195
2816
|
}
|
2196
2817
|
});
|
2197
2818
|
}
|
2198
2819
|
|
2199
2820
|
var toggles = this.find(this.options.toggle),
|
2200
|
-
active
|
2821
|
+
active = toggles.filter(".uk-active");
|
2201
2822
|
|
2202
2823
|
if (active.length) {
|
2203
|
-
this.show(active);
|
2824
|
+
this.show(active, false);
|
2204
2825
|
} else {
|
2826
|
+
|
2827
|
+
if (this.options.active===false) return;
|
2828
|
+
|
2205
2829
|
active = toggles.eq(this.options.active);
|
2206
|
-
this.show(active.length ? active : toggles.eq(0));
|
2830
|
+
this.show(active.length ? active : toggles.eq(0), false);
|
2207
2831
|
}
|
2832
|
+
|
2833
|
+
// Init ARIA for toggles
|
2834
|
+
toggles.not(active).attr('aria-expanded', 'false');
|
2835
|
+
active.attr('aria-expanded', 'true');
|
2836
|
+
|
2837
|
+
this.on('changed.uk.dom', function() {
|
2838
|
+
$this.connect = UI.$($this.options.connect);
|
2839
|
+
});
|
2208
2840
|
}
|
2209
2841
|
|
2210
2842
|
},
|
2211
2843
|
|
2212
|
-
show: function(tab) {
|
2844
|
+
show: function(tab, animate) {
|
2845
|
+
|
2846
|
+
if (this.animating) {
|
2847
|
+
return;
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
if (isNaN(tab)) {
|
2851
|
+
tab = UI.$(tab);
|
2852
|
+
} else {
|
2853
|
+
|
2854
|
+
var toggles = this.find(this.options.toggle);
|
2855
|
+
|
2856
|
+
tab = tab < 0 ? toggles.length-1 : tab;
|
2857
|
+
tab = toggles.eq(toggles[tab] ? tab : 0);
|
2858
|
+
}
|
2859
|
+
|
2860
|
+
var $this = this,
|
2861
|
+
toggles = this.find(this.options.toggle),
|
2862
|
+
active = UI.$(tab),
|
2863
|
+
animation = Animations[this.options.animation] || function(current, next) {
|
2864
|
+
|
2865
|
+
if (!$this.options.animation) {
|
2866
|
+
return Animations.none.apply($this);
|
2867
|
+
}
|
2213
2868
|
|
2214
|
-
|
2869
|
+
var anim = $this.options.animation.split(',');
|
2215
2870
|
|
2216
|
-
|
2871
|
+
if (anim.length == 1) {
|
2872
|
+
anim[1] = anim[0];
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
anim[0] = anim[0].trim();
|
2876
|
+
anim[1] = anim[1].trim();
|
2877
|
+
|
2878
|
+
return coreAnimation.apply($this, [anim, current, next]);
|
2879
|
+
};
|
2880
|
+
|
2881
|
+
if (animate===false || !UI.support.animation) {
|
2882
|
+
animation = Animations.none;
|
2883
|
+
}
|
2217
2884
|
|
2218
2885
|
if (active.hasClass("uk-disabled")) return;
|
2219
2886
|
|
2220
|
-
|
2887
|
+
// Update ARIA for Toggles
|
2888
|
+
toggles.attr('aria-expanded', 'false');
|
2889
|
+
active.attr('aria-expanded', 'true');
|
2890
|
+
|
2891
|
+
toggles.filter(".uk-active").removeClass("uk-active");
|
2221
2892
|
active.addClass("uk-active");
|
2222
2893
|
|
2223
2894
|
if (this.options.connect && this.connect.length) {
|
@@ -2230,95 +2901,207 @@
|
|
2230
2901
|
|
2231
2902
|
this.connect.each(function() {
|
2232
2903
|
|
2233
|
-
var container =
|
2234
|
-
children = container.children(),
|
2235
|
-
current = children.filter('.uk-active'),
|
2236
|
-
next = children.eq($this.index);
|
2904
|
+
var container = UI.$(this),
|
2905
|
+
children = UI.$(container.children()),
|
2906
|
+
current = UI.$(children.filter('.uk-active')),
|
2907
|
+
next = UI.$(children.eq($this.index));
|
2908
|
+
|
2909
|
+
$this.animating = true;
|
2237
2910
|
|
2238
2911
|
animation.apply($this, [current, next]).then(function(){
|
2239
2912
|
|
2240
2913
|
current.removeClass("uk-active");
|
2241
2914
|
next.addClass("uk-active");
|
2242
|
-
|
2915
|
+
|
2916
|
+
// Update ARIA for connect
|
2917
|
+
current.attr('aria-hidden', 'true');
|
2918
|
+
next.attr('aria-hidden', 'false');
|
2919
|
+
|
2920
|
+
UI.Utils.checkDisplay(next, true);
|
2921
|
+
|
2922
|
+
$this.animating = false;
|
2243
2923
|
});
|
2244
2924
|
});
|
2245
2925
|
}
|
2246
2926
|
|
2247
|
-
this.trigger("uk.switcher
|
2927
|
+
this.trigger("show.uk.switcher", [active]);
|
2248
2928
|
}
|
2249
2929
|
});
|
2250
2930
|
|
2251
|
-
|
2252
2931
|
Animations = {
|
2253
2932
|
|
2254
2933
|
'none': function() {
|
2255
|
-
|
2256
|
-
var d = $.Deferred();
|
2934
|
+
var d = UI.$.Deferred();
|
2257
2935
|
d.resolve();
|
2258
2936
|
return d.promise();
|
2259
2937
|
},
|
2260
2938
|
|
2261
|
-
'fade': function(current, next
|
2939
|
+
'fade': function(current, next) {
|
2940
|
+
return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
|
2941
|
+
},
|
2262
2942
|
|
2263
|
-
|
2943
|
+
'slide-bottom': function(current, next) {
|
2944
|
+
return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
|
2945
|
+
},
|
2946
|
+
|
2947
|
+
'slide-top': function(current, next) {
|
2948
|
+
return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
|
2949
|
+
},
|
2264
2950
|
|
2265
|
-
|
2266
|
-
|
2951
|
+
'slide-vertical': function(current, next, dir) {
|
2952
|
+
|
2953
|
+
var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
|
2954
|
+
|
2955
|
+
if (current && current.index() > next.index()) {
|
2956
|
+
anim.reverse();
|
2267
2957
|
}
|
2268
2958
|
|
2269
|
-
|
2270
|
-
|
2271
|
-
d.resolve();
|
2272
|
-
});
|
2959
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
2960
|
+
},
|
2273
2961
|
|
2274
|
-
|
2962
|
+
'slide-left': function(current, next) {
|
2963
|
+
return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
|
2964
|
+
},
|
2965
|
+
|
2966
|
+
'slide-right': function(current, next) {
|
2967
|
+
return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
|
2968
|
+
},
|
2969
|
+
|
2970
|
+
'slide-horizontal': function(current, next, dir) {
|
2971
|
+
|
2972
|
+
var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
|
2973
|
+
|
2974
|
+
if (current && current.index() > next.index()) {
|
2975
|
+
anim.reverse();
|
2976
|
+
}
|
2977
|
+
|
2978
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
2979
|
+
},
|
2980
|
+
|
2981
|
+
'scale': function(current, next) {
|
2982
|
+
return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
|
2275
2983
|
}
|
2276
2984
|
};
|
2277
2985
|
|
2986
|
+
UI.switcher.animations = Animations;
|
2278
2987
|
|
2279
|
-
// init code
|
2280
|
-
UI.ready(function(context) {
|
2281
2988
|
|
2282
|
-
|
2283
|
-
var switcher = $(this);
|
2989
|
+
// helpers
|
2284
2990
|
|
2285
|
-
|
2286
|
-
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
|
2287
|
-
}
|
2288
|
-
});
|
2289
|
-
});
|
2991
|
+
function coreAnimation(cls, current, next) {
|
2290
2992
|
|
2291
|
-
|
2993
|
+
var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
|
2292
2994
|
|
2293
|
-
(
|
2995
|
+
if (next[0]===current[0]) {
|
2996
|
+
d.resolve();
|
2997
|
+
return d.promise();
|
2998
|
+
}
|
2294
2999
|
|
2295
|
-
|
3000
|
+
if (typeof(cls) == 'object') {
|
3001
|
+
clsIn = cls[0];
|
3002
|
+
clsOut = cls[1] || cls[0];
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
release = function() {
|
3006
|
+
|
3007
|
+
if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
|
3008
|
+
|
3009
|
+
next.addClass(clsIn).one(UI.support.animation.end, function() {
|
3010
|
+
|
3011
|
+
next.removeClass(''+clsIn+'').css({opacity:'', display:''});
|
3012
|
+
|
3013
|
+
d.resolve();
|
3014
|
+
|
3015
|
+
if (current) current.css({opacity:'', display:''});
|
3016
|
+
|
3017
|
+
}.bind(this)).show();
|
3018
|
+
};
|
3019
|
+
|
3020
|
+
next.css('animation-duration', this.options.duration+'ms');
|
3021
|
+
|
3022
|
+
if (current && current.length) {
|
3023
|
+
|
3024
|
+
current.css('animation-duration', this.options.duration+'ms');
|
2296
3025
|
|
3026
|
+
current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
|
3027
|
+
release();
|
3028
|
+
}.bind(this)).css('display', '');
|
3029
|
+
|
3030
|
+
} else {
|
3031
|
+
next.addClass('uk-active');
|
3032
|
+
release();
|
3033
|
+
}
|
3034
|
+
|
3035
|
+
return d.promise();
|
3036
|
+
}
|
3037
|
+
|
3038
|
+
})(UIkit);
|
3039
|
+
|
3040
|
+
(function(UI) {
|
3041
|
+
|
3042
|
+
"use strict";
|
2297
3043
|
|
2298
3044
|
UI.component('tab', {
|
2299
3045
|
|
2300
3046
|
defaults: {
|
2301
|
-
'target'
|
2302
|
-
'connect'
|
2303
|
-
'active'
|
3047
|
+
'target' : '>li:not(.uk-tab-responsive, .uk-disabled)',
|
3048
|
+
'connect' : false,
|
3049
|
+
'active' : 0,
|
3050
|
+
'animation' : false,
|
3051
|
+
'duration' : 200
|
3052
|
+
},
|
3053
|
+
|
3054
|
+
boot: function() {
|
3055
|
+
|
3056
|
+
// init code
|
3057
|
+
UI.ready(function(context) {
|
3058
|
+
|
3059
|
+
UI.$("[data-uk-tab]", context).each(function() {
|
3060
|
+
|
3061
|
+
var tab = UI.$(this);
|
3062
|
+
|
3063
|
+
if (!tab.data("tab")) {
|
3064
|
+
var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
|
3065
|
+
}
|
3066
|
+
});
|
3067
|
+
});
|
2304
3068
|
},
|
2305
3069
|
|
2306
3070
|
init: function() {
|
2307
3071
|
|
2308
3072
|
var $this = this;
|
2309
3073
|
|
2310
|
-
this.
|
3074
|
+
this.current = false;
|
3075
|
+
|
3076
|
+
this.on("click.uikit.tab", this.options.target, function(e) {
|
3077
|
+
|
2311
3078
|
e.preventDefault();
|
2312
|
-
|
2313
|
-
$this.
|
3079
|
+
|
3080
|
+
if ($this.switcher && $this.switcher.animating) {
|
3081
|
+
return;
|
3082
|
+
}
|
3083
|
+
|
3084
|
+
var current = $this.find($this.options.target).not(this);
|
3085
|
+
|
3086
|
+
current.removeClass("uk-active").blur();
|
3087
|
+
|
3088
|
+
$this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
|
3089
|
+
|
3090
|
+
$this.current = UI.$(this);
|
3091
|
+
|
3092
|
+
// Update ARIA
|
3093
|
+
if (!$this.options.connect) {
|
3094
|
+
current.attr('aria-expanded', 'false');
|
3095
|
+
UI.$(this).attr('aria-expanded', 'true');
|
3096
|
+
}
|
2314
3097
|
});
|
2315
3098
|
|
2316
3099
|
if (this.options.connect) {
|
2317
|
-
this.connect =
|
3100
|
+
this.connect = UI.$(this.options.connect);
|
2318
3101
|
}
|
2319
3102
|
|
2320
3103
|
// init responsive tab
|
2321
|
-
this.responsivetab =
|
3104
|
+
this.responsivetab = UI.$('<li class="uk-tab-responsive uk-active"><a></a></li>').append('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>');
|
2322
3105
|
|
2323
3106
|
this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
|
2324
3107
|
this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
|
@@ -2327,17 +3110,17 @@
|
|
2327
3110
|
if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
|
2328
3111
|
|
2329
3112
|
// handle click
|
2330
|
-
this.responsivetab.lst.on('click', 'a', function(e) {
|
3113
|
+
this.responsivetab.lst.on('click.uikit.tab', 'a', function(e) {
|
2331
3114
|
|
2332
3115
|
e.preventDefault();
|
2333
3116
|
e.stopPropagation();
|
2334
3117
|
|
2335
|
-
var link =
|
3118
|
+
var link = UI.$(this);
|
2336
3119
|
|
2337
|
-
$this.element.children(':not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
|
3120
|
+
$this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
|
2338
3121
|
});
|
2339
3122
|
|
2340
|
-
this.on('uk.switcher.
|
3123
|
+
this.on('show.uk.switcher change.uk.tab', function(e, tab) {
|
2341
3124
|
$this.responsivetab.caption.html(tab.text());
|
2342
3125
|
});
|
2343
3126
|
|
@@ -2345,13 +3128,19 @@
|
|
2345
3128
|
|
2346
3129
|
// init UIkit components
|
2347
3130
|
if (this.options.connect) {
|
2348
|
-
UI.switcher(this.element, {
|
3131
|
+
this.switcher = UI.switcher(this.element, {
|
3132
|
+
"toggle" : ">li:not(.uk-tab-responsive)",
|
3133
|
+
"connect" : this.options.connect,
|
3134
|
+
"active" : this.options.active,
|
3135
|
+
"animation" : this.options.animation,
|
3136
|
+
"duration" : this.options.duration
|
3137
|
+
});
|
2349
3138
|
}
|
2350
3139
|
|
2351
3140
|
UI.dropdown(this.responsivetab, {"mode": "click"});
|
2352
3141
|
|
2353
3142
|
// init
|
2354
|
-
$this.trigger("uk.tab
|
3143
|
+
$this.trigger("change.uk.tab", [this.element.find(this.options.target).filter('.uk-active')]);
|
2355
3144
|
|
2356
3145
|
this.check();
|
2357
3146
|
|
@@ -2359,16 +3148,16 @@
|
|
2359
3148
|
if ($this.element.is(":visible")) $this.check();
|
2360
3149
|
}, 100));
|
2361
3150
|
|
2362
|
-
this.on('uk.check
|
3151
|
+
this.on('display.uk.check', function(){
|
2363
3152
|
if ($this.element.is(":visible")) $this.check();
|
2364
3153
|
});
|
2365
3154
|
},
|
2366
3155
|
|
2367
3156
|
check: function() {
|
2368
3157
|
|
2369
|
-
var children = this.element.children(':not(.uk-tab-responsive)').removeClass('uk-hidden');
|
3158
|
+
var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
|
2370
3159
|
|
2371
|
-
if (children.length
|
3160
|
+
if (!children.length) return;
|
2372
3161
|
|
2373
3162
|
var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
|
2374
3163
|
doresponsive = false,
|
@@ -2378,7 +3167,7 @@
|
|
2378
3167
|
|
2379
3168
|
children.each(function(){
|
2380
3169
|
|
2381
|
-
if (
|
3170
|
+
if (UI.$(this).offset().top > top) {
|
2382
3171
|
doresponsive = true;
|
2383
3172
|
}
|
2384
3173
|
});
|
@@ -2387,7 +3176,7 @@
|
|
2387
3176
|
|
2388
3177
|
for (var i = 0; i < children.length; i++) {
|
2389
3178
|
|
2390
|
-
item = children.eq(i);
|
3179
|
+
item = UI.$(children.eq(i));
|
2391
3180
|
link = item.find('a');
|
2392
3181
|
|
2393
3182
|
if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
|
@@ -2401,225 +3190,103 @@
|
|
2401
3190
|
}
|
2402
3191
|
}
|
2403
3192
|
|
2404
|
-
this.responsivetab[this.responsivetab.lst.children().length ? 'removeClass':'addClass']('uk-hidden');
|
3193
|
+
this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
|
2405
3194
|
}
|
2406
3195
|
});
|
2407
3196
|
|
2408
|
-
|
2409
|
-
UI.ready(function(context) {
|
2410
|
-
|
2411
|
-
$("[data-uk-tab]", context).each(function() {
|
2412
|
-
|
2413
|
-
var tab = $(this);
|
2414
|
-
|
2415
|
-
if (!tab.data("tab")) {
|
2416
|
-
var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
|
2417
|
-
}
|
2418
|
-
});
|
2419
|
-
});
|
3197
|
+
})(UIkit);
|
2420
3198
|
|
2421
|
-
|
2422
|
-
(function($, UI, $win) {
|
3199
|
+
(function(UI){
|
2423
3200
|
|
2424
3201
|
"use strict";
|
2425
3202
|
|
2426
|
-
|
2427
|
-
tooltipdelay, checkdelay;
|
2428
|
-
|
2429
|
-
UI.component('tooltip', {
|
3203
|
+
UI.component('cover', {
|
2430
3204
|
|
2431
3205
|
defaults: {
|
2432
|
-
|
2433
|
-
"pos": "top",
|
2434
|
-
"animation": false,
|
2435
|
-
"delay": 0, // in miliseconds
|
2436
|
-
"cls": "",
|
2437
|
-
"src": function() { return this.attr("title"); }
|
3206
|
+
automute : true
|
2438
3207
|
},
|
2439
3208
|
|
2440
|
-
|
3209
|
+
boot: function() {
|
2441
3210
|
|
2442
|
-
|
3211
|
+
// auto init
|
3212
|
+
UI.ready(function(context) {
|
2443
3213
|
|
2444
|
-
|
3214
|
+
UI.$("[data-uk-cover]", context).each(function(){
|
2445
3215
|
|
2446
|
-
|
2447
|
-
$tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
|
2448
|
-
}
|
3216
|
+
var ele = UI.$(this);
|
2449
3217
|
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
"mouseleave": function(e) { $this.hide(); }
|
3218
|
+
if(!ele.data("cover")) {
|
3219
|
+
var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
|
3220
|
+
}
|
3221
|
+
});
|
2455
3222
|
});
|
2456
|
-
|
2457
|
-
this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
|
2458
|
-
|
2459
|
-
// disable title attribute
|
2460
|
-
this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
|
2461
3223
|
},
|
2462
3224
|
|
2463
|
-
|
2464
|
-
|
2465
|
-
if (tooltipdelay) clearTimeout(tooltipdelay);
|
2466
|
-
if (checkdelay) clearTimeout(checkdelay);
|
2467
|
-
if (!this.tip.length) return;
|
2468
|
-
|
2469
|
-
$tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
|
2470
|
-
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
|
2471
|
-
|
2472
|
-
var $this = this,
|
2473
|
-
pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
|
2474
|
-
width = $tooltip[0].offsetWidth,
|
2475
|
-
height = $tooltip[0].offsetHeight,
|
2476
|
-
offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
|
2477
|
-
position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
|
2478
|
-
tmppos = position.split("-"),
|
2479
|
-
tcss = {
|
2480
|
-
"display" : "none",
|
2481
|
-
"visibility" : "visible",
|
2482
|
-
"top" : (pos.top + pos.height + height),
|
2483
|
-
"left" : pos.left
|
2484
|
-
};
|
2485
|
-
|
2486
|
-
|
2487
|
-
// prevent strange position
|
2488
|
-
// when tooltip is in offcanvas etc.
|
2489
|
-
if ($('html').css('position')=='fixed' || $('body').css('position')=='fixed'){
|
2490
|
-
var bodyoffset = $('body').offset(),
|
2491
|
-
htmloffset = $('html').offset(),
|
2492
|
-
docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
|
2493
|
-
|
2494
|
-
pos.left -= docoffset.left;
|
2495
|
-
pos.top -= docoffset.top;
|
2496
|
-
}
|
2497
|
-
|
2498
|
-
|
2499
|
-
if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
|
2500
|
-
tmppos[0] = tmppos[0] == "left" ? "right" : "left";
|
2501
|
-
}
|
2502
|
-
|
2503
|
-
var variants = {
|
2504
|
-
"bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
|
2505
|
-
"top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
|
2506
|
-
"left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
|
2507
|
-
"right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
|
2508
|
-
};
|
2509
|
-
|
2510
|
-
$.extend(tcss, variants[tmppos[0]]);
|
2511
|
-
|
2512
|
-
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
|
2513
|
-
|
2514
|
-
var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
|
2515
|
-
|
2516
|
-
if(boundary) {
|
2517
|
-
|
2518
|
-
switch(boundary) {
|
2519
|
-
case "x":
|
3225
|
+
init: function() {
|
2520
3226
|
|
2521
|
-
|
2522
|
-
position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
|
2523
|
-
} else {
|
2524
|
-
position = tcss.left < 0 ? "right": "left";
|
2525
|
-
}
|
3227
|
+
this.parent = this.element.parent();
|
2526
3228
|
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
if (tmppos.length == 2) {
|
2531
|
-
position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
|
2532
|
-
} else {
|
2533
|
-
position = (tcss.top < 0 ? "bottom": "top");
|
2534
|
-
}
|
3229
|
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
3230
|
+
this.check();
|
3231
|
+
}.bind(this), 100));
|
2535
3232
|
|
2536
|
-
|
3233
|
+
this.on("display.uk.check", function(e) {
|
3234
|
+
if(this.element.is(":visible")) this.check();
|
3235
|
+
}.bind(this));
|
2537
3236
|
|
2538
|
-
|
2539
|
-
if (tmppos.length == 2) {
|
2540
|
-
position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
|
2541
|
-
} else {
|
2542
|
-
position = tcss.left < 0 ? "right": "left";
|
2543
|
-
}
|
3237
|
+
this.check();
|
2544
3238
|
|
2545
|
-
|
3239
|
+
if (this.element.is('iframe') && this.options.automute) {
|
2546
3240
|
|
2547
|
-
|
3241
|
+
var src = this.element.attr('src');
|
2548
3242
|
|
2549
|
-
|
3243
|
+
this.element.attr('src', '').on('load', function(){
|
2550
3244
|
|
2551
|
-
|
3245
|
+
this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
2552
3246
|
|
2553
|
-
|
3247
|
+
}).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
|
2554
3248
|
}
|
2555
|
-
|
2556
|
-
|
2557
|
-
tcss.left -= $("body").position().left;
|
2558
|
-
|
2559
|
-
tooltipdelay = setTimeout(function(){
|
2560
|
-
|
2561
|
-
$tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
|
2562
|
-
|
2563
|
-
if ($this.options.animation) {
|
2564
|
-
$tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
|
2565
|
-
} else {
|
2566
|
-
$tooltip.show();
|
2567
|
-
}
|
2568
|
-
|
2569
|
-
tooltipdelay = false;
|
2570
|
-
|
2571
|
-
// close tooltip if element was removed or hidden
|
2572
|
-
checkdelay = setInterval(function(){
|
2573
|
-
if(!$this.element.is(':visible')) $this.hide();
|
2574
|
-
}, 150);
|
2575
|
-
|
2576
|
-
}, parseInt(this.options.delay, 10) || 0);
|
2577
3249
|
},
|
2578
3250
|
|
2579
|
-
|
2580
|
-
if(this.element.is("input") && this.element[0]===document.activeElement) return;
|
3251
|
+
check: function() {
|
2581
3252
|
|
2582
|
-
|
2583
|
-
|
3253
|
+
this.element.css({
|
3254
|
+
'width' : '',
|
3255
|
+
'height' : ''
|
3256
|
+
});
|
2584
3257
|
|
2585
|
-
|
3258
|
+
this.dimension = {w: this.element.width(), h: this.element.height()};
|
2586
3259
|
|
2587
|
-
if (this.
|
2588
|
-
|
2589
|
-
} else {
|
2590
|
-
$tooltip.hide();
|
3260
|
+
if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
|
3261
|
+
this.dimension.w = this.element.attr('width');
|
2591
3262
|
}
|
2592
|
-
},
|
2593
3263
|
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
3264
|
+
if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
|
3265
|
+
this.dimension.h = this.element.attr('height');
|
3266
|
+
}
|
2597
3267
|
|
2598
|
-
|
3268
|
+
this.ratio = this.dimension.w / this.dimension.h;
|
2599
3269
|
|
2600
|
-
var
|
3270
|
+
var w = this.parent.width(), h = this.parent.height(), width, height;
|
2601
3271
|
|
2602
|
-
if
|
2603
|
-
|
2604
|
-
}
|
3272
|
+
// if element height < parent height (gap underneath)
|
3273
|
+
if ((w / this.ratio) < h) {
|
2605
3274
|
|
2606
|
-
|
2607
|
-
|
2608
|
-
}
|
2609
|
-
|
2610
|
-
return axis;
|
2611
|
-
}
|
2612
|
-
});
|
3275
|
+
width = Math.ceil(h * this.ratio);
|
3276
|
+
height = h;
|
2613
3277
|
|
3278
|
+
// element width < parent width (gap to right)
|
3279
|
+
} else {
|
2614
3280
|
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
3281
|
+
width = w;
|
3282
|
+
height = Math.ceil(w / this.ratio);
|
3283
|
+
}
|
2618
3284
|
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
3285
|
+
this.element.css({
|
3286
|
+
'width' : width,
|
3287
|
+
'height' : height
|
3288
|
+
});
|
2622
3289
|
}
|
2623
3290
|
});
|
2624
3291
|
|
2625
|
-
})(
|
3292
|
+
})(UIkit);
|