uikit-on-rails 1.5.0

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