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
@@ -1,19 +1,21 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
5
5
|
|
6
|
-
if (
|
7
|
-
component = addon(
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
8
|
}
|
9
9
|
|
10
10
|
if (typeof define == "function" && define.amd) {
|
11
11
|
define("uikit-form-password", ["uikit"], function(){
|
12
|
-
return component || addon(
|
12
|
+
return component || addon(UIkit);
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
})(function(
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
17
19
|
|
18
20
|
UI.component('formPassword', {
|
19
21
|
|
@@ -22,6 +24,22 @@
|
|
22
24
|
"lblHide": "Hide"
|
23
25
|
},
|
24
26
|
|
27
|
+
boot: function() {
|
28
|
+
// init code
|
29
|
+
UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
|
30
|
+
|
31
|
+
var ele = UI.$(this);
|
32
|
+
|
33
|
+
if (!ele.data("formPassword")) {
|
34
|
+
|
35
|
+
e.preventDefault();
|
36
|
+
|
37
|
+
var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
|
38
|
+
ele.trigger("click");
|
39
|
+
}
|
40
|
+
});
|
41
|
+
},
|
42
|
+
|
25
43
|
init: function() {
|
26
44
|
|
27
45
|
var $this = this;
|
@@ -44,18 +62,5 @@
|
|
44
62
|
}
|
45
63
|
});
|
46
64
|
|
47
|
-
// init code
|
48
|
-
UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
|
49
|
-
|
50
|
-
var ele = $(this);
|
51
|
-
if (!ele.data("formPassword")) {
|
52
|
-
|
53
|
-
e.preventDefault();
|
54
|
-
|
55
|
-
var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
|
56
|
-
ele.trigger("click");
|
57
|
-
}
|
58
|
-
});
|
59
|
-
|
60
65
|
return UI.formPassword;
|
61
|
-
});
|
66
|
+
});
|
@@ -1,25 +1,43 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
5
5
|
|
6
|
-
if (
|
7
|
-
component = addon(
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
8
|
}
|
9
9
|
|
10
10
|
if (typeof define == "function" && define.amd) {
|
11
11
|
define("uikit-form-select", ["uikit"], function(){
|
12
|
-
return component || addon(
|
12
|
+
return component || addon(UIkit);
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
})(function(
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
17
19
|
|
18
20
|
UI.component('formSelect', {
|
21
|
+
|
19
22
|
defaults: {
|
20
23
|
'target': '>span:first'
|
21
24
|
},
|
22
25
|
|
26
|
+
boot: function() {
|
27
|
+
// init code
|
28
|
+
UI.ready(function(context) {
|
29
|
+
|
30
|
+
UI.$("[data-uk-form-select]", context).each(function(){
|
31
|
+
|
32
|
+
var ele = UI.$(this);
|
33
|
+
|
34
|
+
if (!ele.data("formSelect")) {
|
35
|
+
var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
|
36
|
+
}
|
37
|
+
});
|
38
|
+
});
|
39
|
+
},
|
40
|
+
|
23
41
|
init: function() {
|
24
42
|
var $this = this;
|
25
43
|
|
@@ -45,17 +63,5 @@
|
|
45
63
|
}
|
46
64
|
});
|
47
65
|
|
48
|
-
// init code
|
49
|
-
UI.ready(function(context) {
|
50
|
-
|
51
|
-
$("[data-uk-form-select]", context).each(function(){
|
52
|
-
var ele = $(this);
|
53
|
-
|
54
|
-
if (!ele.data("formSelect")) {
|
55
|
-
var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
|
56
|
-
}
|
57
|
-
});
|
58
|
-
});
|
59
|
-
|
60
66
|
return UI.formSelect;
|
61
|
-
});
|
67
|
+
});
|
@@ -0,0 +1,524 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == "function" && define.amd) {
|
11
|
+
define("uikit-grid", ["uikit"], function(){
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
UI.component('grid', {
|
21
|
+
|
22
|
+
defaults: {
|
23
|
+
colwidth : 'auto',
|
24
|
+
animation : true,
|
25
|
+
duration : 300,
|
26
|
+
gutter : 0,
|
27
|
+
controls : false,
|
28
|
+
filter : false
|
29
|
+
},
|
30
|
+
|
31
|
+
boot: function() {
|
32
|
+
|
33
|
+
// init code
|
34
|
+
UI.ready(function(context) {
|
35
|
+
|
36
|
+
UI.$('[data-uk-grid]', context).each(function(){
|
37
|
+
|
38
|
+
var ele = UI.$(this);
|
39
|
+
|
40
|
+
if(!ele.data("grid")) {
|
41
|
+
var plugin = UI.grid(ele, UI.Utils.options(ele.attr('data-uk-grid')));
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
45
|
+
},
|
46
|
+
|
47
|
+
init: function() {
|
48
|
+
|
49
|
+
var $this = this, gutter = String(this.options.gutter).trim().split(' ');
|
50
|
+
|
51
|
+
this.gutterv = parseInt(gutter[0], 10);
|
52
|
+
this.gutterh = parseInt((gutter[1] || gutter[0]), 10);
|
53
|
+
|
54
|
+
// make sure parent element has the right position property
|
55
|
+
this.element.css({'position': 'relative'});
|
56
|
+
|
57
|
+
this.controls = null;
|
58
|
+
|
59
|
+
if (this.options.controls) {
|
60
|
+
|
61
|
+
this.controls = UI.$(this.options.controls);
|
62
|
+
|
63
|
+
// filter
|
64
|
+
this.controls.on('click', '[data-uk-filter]', function(e){
|
65
|
+
e.preventDefault();
|
66
|
+
$this.filter(UI.$(this).data('ukFilter'));
|
67
|
+
});
|
68
|
+
|
69
|
+
// sort
|
70
|
+
this.controls.on('click', '[data-uk-sort]', function(e){
|
71
|
+
e.preventDefault();
|
72
|
+
var cmd = UI.$(this).attr('data-uk-sort').split(':');
|
73
|
+
$this.sort(cmd[0], cmd[1]);
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
78
|
+
|
79
|
+
if ($this.currentfilter) {
|
80
|
+
$this.filter($this.currentfilter);
|
81
|
+
} else {
|
82
|
+
this.updateLayout();
|
83
|
+
}
|
84
|
+
|
85
|
+
}.bind(this), 100));
|
86
|
+
|
87
|
+
this.on('display.uk.check', function(){
|
88
|
+
if ($this.element.is(":visible")) $this.updateLayout();
|
89
|
+
});
|
90
|
+
|
91
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
92
|
+
$this.updateLayout();
|
93
|
+
});
|
94
|
+
|
95
|
+
if (this.options.filter !== false) {
|
96
|
+
this.filter(this.options.filter);
|
97
|
+
} else {
|
98
|
+
this.updateLayout();
|
99
|
+
}
|
100
|
+
},
|
101
|
+
|
102
|
+
_prepareElements: function() {
|
103
|
+
|
104
|
+
var children = this.element.children(':not([data-grid-prepared])'), css;
|
105
|
+
|
106
|
+
// exit if no already prepared elements found
|
107
|
+
if (!children.length) {
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
|
111
|
+
css = {
|
112
|
+
'position' : 'absolute',
|
113
|
+
'box-sizing' : 'border-box',
|
114
|
+
'width' : this.options.colwidth == 'auto' ? '' : this.options.colwidth
|
115
|
+
};
|
116
|
+
|
117
|
+
if (this.options.gutter) {
|
118
|
+
|
119
|
+
css['padding-left'] = this.gutterh;
|
120
|
+
css['padding-bottom'] = this.gutterv;
|
121
|
+
|
122
|
+
this.element.css('margin-left', this.gutterh * -1);
|
123
|
+
}
|
124
|
+
|
125
|
+
children.attr('data-grid-prepared', 'true').css(css);
|
126
|
+
},
|
127
|
+
|
128
|
+
updateLayout: function(elements) {
|
129
|
+
|
130
|
+
this._prepareElements();
|
131
|
+
|
132
|
+
elements = elements || this.element.children(':visible');
|
133
|
+
|
134
|
+
var $this = this,
|
135
|
+
children = elements,
|
136
|
+
maxwidth = this.element.width() + (2*this.gutterh) + 2,
|
137
|
+
left = 0,
|
138
|
+
top = 0,
|
139
|
+
positions = [],
|
140
|
+
|
141
|
+
item, width, height, pos, aX, aY, i, z, max, size;
|
142
|
+
|
143
|
+
this.trigger('beforeupdate.uk.grid', [children]);
|
144
|
+
|
145
|
+
children.each(function(index){
|
146
|
+
|
147
|
+
size = getElementSize(this);
|
148
|
+
|
149
|
+
item = UI.$(this);
|
150
|
+
width = size.outerWidth;
|
151
|
+
height = size.outerHeight;
|
152
|
+
left = 0;
|
153
|
+
top = 0;
|
154
|
+
|
155
|
+
for (i=0,max=positions.length;i<max;i++) {
|
156
|
+
|
157
|
+
pos = positions[i];
|
158
|
+
|
159
|
+
if (left <= pos.aX) { left = pos.aX; }
|
160
|
+
if (maxwidth < (left + width)) { left = 0; }
|
161
|
+
if (top <= pos.aY) { top = pos.aY; }
|
162
|
+
}
|
163
|
+
|
164
|
+
positions.push({
|
165
|
+
"ele" : item,
|
166
|
+
"top" : top,
|
167
|
+
"left" : left,
|
168
|
+
"width" : width,
|
169
|
+
"height" : height,
|
170
|
+
"aY" : (top + height),
|
171
|
+
"aX" : (left + width)
|
172
|
+
});
|
173
|
+
});
|
174
|
+
|
175
|
+
var posPrev, maxHeight = 0;
|
176
|
+
|
177
|
+
// fix top
|
178
|
+
for (i=0,max=positions.length;i<max;i++) {
|
179
|
+
|
180
|
+
pos = positions[i];
|
181
|
+
top = 0;
|
182
|
+
|
183
|
+
for (z=0;z<i;z++) {
|
184
|
+
|
185
|
+
posPrev = positions[z];
|
186
|
+
|
187
|
+
// (posPrev.left + 1) fixex 1px bug when using % based widths
|
188
|
+
if (pos.left < posPrev.aX && (posPrev.left +1) < pos.aX) {
|
189
|
+
top = posPrev.aY;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
pos.top = top;
|
194
|
+
pos.aY = top + pos.height;
|
195
|
+
|
196
|
+
maxHeight = Math.max(maxHeight, pos.aY);
|
197
|
+
}
|
198
|
+
|
199
|
+
maxHeight = maxHeight - this.gutterv;
|
200
|
+
|
201
|
+
if (this.options.animation) {
|
202
|
+
|
203
|
+
this.element.stop().animate({'height': maxHeight}, 100);
|
204
|
+
|
205
|
+
positions.forEach(function(pos){
|
206
|
+
pos.ele.stop().animate({"top": pos.top, "left": pos.left, opacity: 1}, this.options.duration);
|
207
|
+
}.bind(this));
|
208
|
+
|
209
|
+
} else {
|
210
|
+
|
211
|
+
this.element.css('height', maxHeight);
|
212
|
+
|
213
|
+
positions.forEach(function(pos){
|
214
|
+
pos.ele.css({"top": pos.top, "left": pos.left, opacity: 1});
|
215
|
+
}.bind(this));
|
216
|
+
}
|
217
|
+
|
218
|
+
// make sure to trigger possible scrollpies etc.
|
219
|
+
setTimeout(function() {
|
220
|
+
UI.$doc.trigger('scrolling.uk.document');
|
221
|
+
}, 2 * this.options.duration * (this.options.animation ? 1:0));
|
222
|
+
|
223
|
+
this.trigger('afterupdate.uk.grid', [children]);
|
224
|
+
},
|
225
|
+
|
226
|
+
filter: function(filter) {
|
227
|
+
|
228
|
+
this.currentfilter = filter;
|
229
|
+
|
230
|
+
filter = filter || [];
|
231
|
+
|
232
|
+
if (typeof(filter) === 'string') {
|
233
|
+
filter = filter.split(/,/).map(function(item){ return item.trim(); });
|
234
|
+
}
|
235
|
+
|
236
|
+
var $this = this, children = this.element.children(), elements = {"visible": [], "hidden": []}, visible, hidden;
|
237
|
+
|
238
|
+
children.each(function(index){
|
239
|
+
|
240
|
+
var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
|
241
|
+
|
242
|
+
if (f) {
|
243
|
+
|
244
|
+
f = f.split(/,/).map(function(item){ return item.trim(); });
|
245
|
+
|
246
|
+
filter.forEach(function(item){
|
247
|
+
if (f.indexOf(item) > -1) infilter = true;
|
248
|
+
});
|
249
|
+
}
|
250
|
+
|
251
|
+
elements[infilter ? "visible":"hidden"].push(ele);
|
252
|
+
});
|
253
|
+
|
254
|
+
// convert to jQuery collections
|
255
|
+
elements.hidden = UI.$(elements.hidden).map(function () {return this[0];});
|
256
|
+
elements.visible = UI.$(elements.visible).map(function () {return this[0];});
|
257
|
+
|
258
|
+
elements.hidden.attr('aria-hidden', 'true').filter(':visible').fadeOut(this.options.duration);
|
259
|
+
elements.visible.attr('aria-hidden', 'false').filter(':hidden').css('opacity', 0).show();
|
260
|
+
|
261
|
+
$this.updateLayout(elements.visible);
|
262
|
+
|
263
|
+
if (this.controls && this.controls.length) {
|
264
|
+
this.controls.find('[data-uk-filter]').removeClass('uk-active').filter('[data-uk-filter="'+filter+'"]').addClass('uk-active');
|
265
|
+
}
|
266
|
+
},
|
267
|
+
|
268
|
+
sort: function(by, order){
|
269
|
+
|
270
|
+
order = order || 1;
|
271
|
+
|
272
|
+
// covert from string (asc|desc) to number
|
273
|
+
if (typeof(order) === 'string') {
|
274
|
+
order = order.toLowerCase() == 'desc' ? -1 : 1;
|
275
|
+
}
|
276
|
+
|
277
|
+
var elements = this.element.children();
|
278
|
+
|
279
|
+
elements.sort(function(a, b){
|
280
|
+
|
281
|
+
a = UI.$(a);
|
282
|
+
b = UI.$(b);
|
283
|
+
|
284
|
+
return (b.data(by) || '') < (a.data(by) || '') ? order : (order*-1);
|
285
|
+
|
286
|
+
}).appendTo(this.element);
|
287
|
+
|
288
|
+
this.updateLayout(elements.filter(':visible'));
|
289
|
+
|
290
|
+
if (this.controls && this.controls.length) {
|
291
|
+
this.controls.find('[data-uk-sort]').removeClass('uk-active').filter('[data-uk-sort="'+by+':'+(order == -1 ? 'desc':'asc')+'"]').addClass('uk-active');
|
292
|
+
}
|
293
|
+
}
|
294
|
+
});
|
295
|
+
|
296
|
+
|
297
|
+
/*!
|
298
|
+
* getSize v1.2.2
|
299
|
+
* measure size of elements
|
300
|
+
* MIT license
|
301
|
+
* https://github.com/desandro/get-size
|
302
|
+
*/
|
303
|
+
var _getSize = (function(){
|
304
|
+
|
305
|
+
var prefixes = 'Webkit Moz ms Ms O'.split(' ');
|
306
|
+
var docElemStyle = document.documentElement.style;
|
307
|
+
|
308
|
+
function getStyleProperty( propName ) {
|
309
|
+
if ( !propName ) {
|
310
|
+
return;
|
311
|
+
}
|
312
|
+
|
313
|
+
// test standard property first
|
314
|
+
if ( typeof docElemStyle[ propName ] === 'string' ) {
|
315
|
+
return propName;
|
316
|
+
}
|
317
|
+
|
318
|
+
// capitalize
|
319
|
+
propName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
320
|
+
|
321
|
+
// test vendor specific properties
|
322
|
+
var prefixed;
|
323
|
+
for ( var i=0, len = prefixes.length; i < len; i++ ) {
|
324
|
+
prefixed = prefixes[i] + propName;
|
325
|
+
if ( typeof docElemStyle[ prefixed ] === 'string' ) {
|
326
|
+
return prefixed;
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
// -------------------------- helpers -------------------------- //
|
332
|
+
|
333
|
+
// get a number from a string, not a percentage
|
334
|
+
function getStyleSize( value ) {
|
335
|
+
var num = parseFloat( value );
|
336
|
+
// not a percent like '100%', and a number
|
337
|
+
var isValid = value.indexOf('%') === -1 && !isNaN( num );
|
338
|
+
return isValid && num;
|
339
|
+
}
|
340
|
+
|
341
|
+
function noop() {}
|
342
|
+
|
343
|
+
var logError = typeof console === 'undefined' ? noop : function( message ) {
|
344
|
+
console.error( message );
|
345
|
+
};
|
346
|
+
|
347
|
+
// -------------------------- measurements -------------------------- //
|
348
|
+
|
349
|
+
var measurements = [
|
350
|
+
'paddingLeft',
|
351
|
+
'paddingRight',
|
352
|
+
'paddingTop',
|
353
|
+
'paddingBottom',
|
354
|
+
'marginLeft',
|
355
|
+
'marginRight',
|
356
|
+
'marginTop',
|
357
|
+
'marginBottom',
|
358
|
+
'borderLeftWidth',
|
359
|
+
'borderRightWidth',
|
360
|
+
'borderTopWidth',
|
361
|
+
'borderBottomWidth'
|
362
|
+
];
|
363
|
+
|
364
|
+
function getZeroSize() {
|
365
|
+
var size = {
|
366
|
+
width: 0,
|
367
|
+
height: 0,
|
368
|
+
innerWidth: 0,
|
369
|
+
innerHeight: 0,
|
370
|
+
outerWidth: 0,
|
371
|
+
outerHeight: 0
|
372
|
+
};
|
373
|
+
for ( var i=0, len = measurements.length; i < len; i++ ) {
|
374
|
+
var measurement = measurements[i];
|
375
|
+
size[ measurement ] = 0;
|
376
|
+
}
|
377
|
+
return size;
|
378
|
+
}
|
379
|
+
|
380
|
+
|
381
|
+
// -------------------------- setup -------------------------- //
|
382
|
+
|
383
|
+
var isSetup = false;
|
384
|
+
var getStyle, boxSizingProp, isBoxSizeOuter;
|
385
|
+
|
386
|
+
/**
|
387
|
+
* setup vars and functions
|
388
|
+
* do it on initial getSize(), rather than on script load
|
389
|
+
* For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
390
|
+
*/
|
391
|
+
function setup() {
|
392
|
+
// setup once
|
393
|
+
if ( isSetup ) {
|
394
|
+
return;
|
395
|
+
}
|
396
|
+
isSetup = true;
|
397
|
+
|
398
|
+
var getComputedStyle = window.getComputedStyle;
|
399
|
+
getStyle = ( function() {
|
400
|
+
var getStyleFn = getComputedStyle ?
|
401
|
+
function( elem ) {
|
402
|
+
return getComputedStyle( elem, null );
|
403
|
+
} :
|
404
|
+
function( elem ) {
|
405
|
+
return elem.currentStyle;
|
406
|
+
};
|
407
|
+
|
408
|
+
return function getStyle( elem ) {
|
409
|
+
var style = getStyleFn( elem );
|
410
|
+
if ( !style ) {
|
411
|
+
logError( 'Style returned ' + style +
|
412
|
+
'. Are you running this code in a hidden iframe on Firefox? ' +
|
413
|
+
'See http://bit.ly/getsizebug1' );
|
414
|
+
}
|
415
|
+
return style;
|
416
|
+
};
|
417
|
+
})();
|
418
|
+
|
419
|
+
// -------------------------- box sizing -------------------------- //
|
420
|
+
|
421
|
+
boxSizingProp = getStyleProperty('boxSizing');
|
422
|
+
|
423
|
+
/**
|
424
|
+
* WebKit measures the outer-width on style.width on border-box elems
|
425
|
+
* IE & Firefox measures the inner-width
|
426
|
+
*/
|
427
|
+
if ( boxSizingProp ) {
|
428
|
+
var div = document.createElement('div');
|
429
|
+
div.style.width = '200px';
|
430
|
+
div.style.padding = '1px 2px 3px 4px';
|
431
|
+
div.style.borderStyle = 'solid';
|
432
|
+
div.style.borderWidth = '1px 2px 3px 4px';
|
433
|
+
div.style[ boxSizingProp ] = 'border-box';
|
434
|
+
|
435
|
+
var body = document.body || document.documentElement;
|
436
|
+
body.appendChild( div );
|
437
|
+
var style = getStyle( div );
|
438
|
+
|
439
|
+
isBoxSizeOuter = getStyleSize( style.width ) === 200;
|
440
|
+
body.removeChild( div );
|
441
|
+
}
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
// -------------------------- getSize -------------------------- //
|
446
|
+
|
447
|
+
function getSize( elem ) {
|
448
|
+
setup();
|
449
|
+
|
450
|
+
// use querySeletor if elem is string
|
451
|
+
if ( typeof elem === 'string' ) {
|
452
|
+
elem = document.querySelector( elem );
|
453
|
+
}
|
454
|
+
|
455
|
+
// do not proceed on non-objects
|
456
|
+
if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
|
457
|
+
return;
|
458
|
+
}
|
459
|
+
|
460
|
+
var style = getStyle( elem );
|
461
|
+
|
462
|
+
// if hidden, everything is 0
|
463
|
+
if ( style.display === 'none' ) {
|
464
|
+
return getZeroSize();
|
465
|
+
}
|
466
|
+
|
467
|
+
var size = {};
|
468
|
+
size.width = elem.offsetWidth;
|
469
|
+
size.height = elem.offsetHeight;
|
470
|
+
|
471
|
+
var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
|
472
|
+
style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
|
473
|
+
|
474
|
+
// get all measurements
|
475
|
+
for ( var i=0, len = measurements.length; i < len; i++ ) {
|
476
|
+
var measurement = measurements[i];
|
477
|
+
var value = style[ measurement ];
|
478
|
+
|
479
|
+
var num = parseFloat( value );
|
480
|
+
// any 'auto', 'medium' value will be 0
|
481
|
+
size[ measurement ] = !isNaN( num ) ? num : 0;
|
482
|
+
}
|
483
|
+
|
484
|
+
var paddingWidth = size.paddingLeft + size.paddingRight;
|
485
|
+
var paddingHeight = size.paddingTop + size.paddingBottom;
|
486
|
+
var marginWidth = size.marginLeft + size.marginRight;
|
487
|
+
var marginHeight = size.marginTop + size.marginBottom;
|
488
|
+
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
489
|
+
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
490
|
+
|
491
|
+
var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
492
|
+
|
493
|
+
// overwrite width and height if we can get it from style
|
494
|
+
var styleWidth = getStyleSize( style.width );
|
495
|
+
if ( styleWidth !== false ) {
|
496
|
+
size.width = styleWidth +
|
497
|
+
// add padding and border unless it's already including it
|
498
|
+
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
499
|
+
}
|
500
|
+
|
501
|
+
var styleHeight = getStyleSize( style.height );
|
502
|
+
if ( styleHeight !== false ) {
|
503
|
+
size.height = styleHeight +
|
504
|
+
// add padding and border unless it's already including it
|
505
|
+
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
506
|
+
}
|
507
|
+
|
508
|
+
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
509
|
+
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
510
|
+
|
511
|
+
size.outerWidth = size.width + marginWidth;
|
512
|
+
size.outerHeight = size.height + marginHeight;
|
513
|
+
|
514
|
+
return size;
|
515
|
+
}
|
516
|
+
|
517
|
+
return getSize;
|
518
|
+
|
519
|
+
})();
|
520
|
+
|
521
|
+
function getElementSize(ele) {
|
522
|
+
return _getSize(ele);
|
523
|
+
}
|
524
|
+
});
|