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,124 @@
1
+ /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI){
3
+
4
+ "use strict";
5
+
6
+ var toggles = [];
7
+
8
+ UI.component('toggle', {
9
+
10
+ defaults: {
11
+ target : false,
12
+ cls : 'uk-hidden',
13
+ animation : false,
14
+ duration : 200
15
+ },
16
+
17
+ boot: function(){
18
+
19
+ // init code
20
+ UI.ready(function(context) {
21
+
22
+ UI.$("[data-uk-toggle]", context).each(function() {
23
+ var ele = UI.$(this);
24
+
25
+ if (!ele.data("toggle")) {
26
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
27
+ }
28
+ });
29
+
30
+ setTimeout(function(){
31
+
32
+ toggles.forEach(function(toggle){
33
+ toggle.getToggles();
34
+ });
35
+
36
+ }, 0);
37
+ });
38
+ },
39
+
40
+ init: function() {
41
+
42
+ var $this = this;
43
+
44
+ this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
45
+
46
+ this.on("click", function(e) {
47
+
48
+ if ($this.element.is('a[href="#"]')) {
49
+ e.preventDefault();
50
+ }
51
+
52
+ $this.toggle();
53
+ });
54
+
55
+ toggles.push(this);
56
+ },
57
+
58
+ toggle: function() {
59
+
60
+ this.getToggles();
61
+
62
+ if(!this.totoggle.length) return;
63
+
64
+ if (this.options.animation && UI.support.animation) {
65
+
66
+ var $this = this, animations = this.options.animation.split(',');
67
+
68
+ if (animations.length == 1) {
69
+ animations[1] = animations[0];
70
+ }
71
+
72
+ animations[0] = animations[0].trim();
73
+ animations[1] = animations[1].trim();
74
+
75
+ this.totoggle.css('animation-duration', this.options.duration+'ms');
76
+
77
+ this.totoggle.each(function(){
78
+
79
+ var ele = UI.$(this);
80
+
81
+ if (ele.hasClass($this.options.cls)) {
82
+
83
+ ele.toggleClass($this.options.cls);
84
+
85
+ UI.Utils.animate(ele, animations[0]).then(function(){
86
+ ele.css('animation-duration', '');
87
+ UI.Utils.checkDisplay(ele);
88
+ });
89
+
90
+ } else {
91
+
92
+ UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
93
+ ele.toggleClass($this.options.cls).css('animation-duration', '');
94
+ UI.Utils.checkDisplay(ele);
95
+ });
96
+
97
+ }
98
+
99
+ });
100
+
101
+ } else {
102
+ this.totoggle.toggleClass(this.options.cls);
103
+ UI.Utils.checkDisplay(this.totoggle);
104
+ }
105
+
106
+ this.updateAria();
107
+
108
+ },
109
+
110
+ getToggles: function() {
111
+ this.totoggle = this.options.target ? UI.$(this.options.target):[];
112
+ this.updateAria();
113
+ },
114
+
115
+ updateAria: function() {
116
+ if (this.aria && this.totoggle.length) {
117
+ this.totoggle.not('[aria-hidden]').each(function(){
118
+ UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
119
+ });
120
+ }
121
+ }
122
+ });
123
+
124
+ })(UIkit);
@@ -0,0 +1,175 @@
1
+ /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ // Based on Zeptos touch.js
3
+ // https://raw.github.com/madrobby/zepto/master/src/touch.js
4
+ // Zepto.js may be freely distributed under the MIT license.
5
+
6
+ ;(function($){
7
+
8
+ if ($.fn.swipeLeft) {
9
+ return;
10
+ }
11
+
12
+
13
+ var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
14
+
15
+ function swipeDirection(x1, x2, y1, y2) {
16
+ return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
17
+ }
18
+
19
+ function longTap() {
20
+ longTapTimeout = null;
21
+ if (touch.last) {
22
+ if ( touch.el !== undefined ) touch.el.trigger('longTap');
23
+ touch = {};
24
+ }
25
+ }
26
+
27
+ function cancelLongTap() {
28
+ if (longTapTimeout) clearTimeout(longTapTimeout);
29
+ longTapTimeout = null;
30
+ }
31
+
32
+ function cancelAll() {
33
+ if (touchTimeout) clearTimeout(touchTimeout);
34
+ if (tapTimeout) clearTimeout(tapTimeout);
35
+ if (swipeTimeout) clearTimeout(swipeTimeout);
36
+ if (longTapTimeout) clearTimeout(longTapTimeout);
37
+ touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
38
+ touch = {};
39
+ }
40
+
41
+ function isPrimaryTouch(event){
42
+ return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
43
+ }
44
+
45
+ $(function(){
46
+ var now, delta, deltaX = 0, deltaY = 0, firstTouch;
47
+
48
+ if ('MSGesture' in window) {
49
+ gesture = new MSGesture();
50
+ gesture.target = document.body;
51
+ }
52
+
53
+ $(document)
54
+ .on('MSGestureEnd gestureend', function(e){
55
+
56
+ var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
57
+
58
+ if (swipeDirectionFromVelocity && touch.el !== undefined) {
59
+ touch.el.trigger('swipe');
60
+ touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
61
+ }
62
+ })
63
+ // MSPointerDown: for IE10
64
+ // pointerdown: for IE11
65
+ .on('touchstart MSPointerDown pointerdown', function(e){
66
+
67
+ if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
68
+
69
+ firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
70
+
71
+ now = Date.now();
72
+ delta = now - (touch.last || now);
73
+ touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
74
+
75
+ if(touchTimeout) clearTimeout(touchTimeout);
76
+
77
+ touch.x1 = firstTouch.pageX;
78
+ touch.y1 = firstTouch.pageY;
79
+
80
+ if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
81
+
82
+ touch.last = now;
83
+ longTapTimeout = setTimeout(longTap, longTapDelay);
84
+
85
+ // adds the current touch contact for IE gesture recognition
86
+ if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
87
+ gesture.addPointer(e.originalEvent.pointerId);
88
+ }
89
+
90
+ })
91
+ // MSPointerMove: for IE10
92
+ // pointermove: for IE11
93
+ .on('touchmove MSPointerMove pointermove', function(e){
94
+
95
+ if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
96
+
97
+ firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
98
+
99
+ cancelLongTap();
100
+ touch.x2 = firstTouch.pageX;
101
+ touch.y2 = firstTouch.pageY;
102
+
103
+ deltaX += Math.abs(touch.x1 - touch.x2);
104
+ deltaY += Math.abs(touch.y1 - touch.y2);
105
+ })
106
+ // MSPointerUp: for IE10
107
+ // pointerup: for IE11
108
+ .on('touchend MSPointerUp pointerup', function(e){
109
+
110
+ if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
111
+
112
+ cancelLongTap();
113
+
114
+ // swipe
115
+ if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
116
+
117
+ swipeTimeout = setTimeout(function() {
118
+ if ( touch.el !== undefined ) {
119
+ touch.el.trigger('swipe');
120
+ touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
121
+ }
122
+ touch = {};
123
+ }, 0);
124
+
125
+ // normal tap
126
+ } else if ('last' in touch) {
127
+
128
+ // don't fire tap when delta position changed by more than 30 pixels,
129
+ // for instance when moving to a point and back to origin
130
+ if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
131
+ // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
132
+ // ('tap' fires before 'scroll')
133
+ tapTimeout = setTimeout(function() {
134
+
135
+ // trigger universal 'tap' with the option to cancelTouch()
136
+ // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
137
+ var event = $.Event('tap');
138
+ event.cancelTouch = cancelAll;
139
+ if ( touch.el !== undefined ) touch.el.trigger(event);
140
+
141
+ // trigger double tap immediately
142
+ if (touch.isDoubleTap) {
143
+ if ( touch.el !== undefined ) touch.el.trigger('doubleTap');
144
+ touch = {};
145
+ }
146
+
147
+ // trigger single tap after 250ms of inactivity
148
+ else {
149
+ touchTimeout = setTimeout(function(){
150
+ touchTimeout = null;
151
+ if ( touch.el !== undefined ) touch.el.trigger('singleTap');
152
+ touch = {};
153
+ }, 250);
154
+ }
155
+ }, 0);
156
+ } else {
157
+ touch = {};
158
+ }
159
+ deltaX = deltaY = 0;
160
+ }
161
+ })
162
+ // when the browser window loses focus,
163
+ // for example when a modal dialog is shown,
164
+ // cancel all ongoing events
165
+ .on('touchcancel MSPointerCancel pointercancel', cancelAll);
166
+
167
+ // scrolling the window indicates intention of the user
168
+ // to scroll, not tap or swipe, so cancel all ongoing events
169
+ $(window).on('scroll', cancelAll);
170
+ });
171
+
172
+ ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
173
+ $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
174
+ });
175
+ })(jQuery);
@@ -0,0 +1,338 @@
1
+ /*! UIkit 2.27.1 | 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
+ rowfirst: false,
13
+ observe: false
14
+ },
15
+
16
+ boot: function() {
17
+
18
+ // init code
19
+ UI.ready(function(context) {
20
+
21
+ UI.$("[data-uk-margin]", context).each(function() {
22
+
23
+ var ele = UI.$(this);
24
+
25
+ if (!ele.data("stackMargin")) {
26
+ UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
27
+ }
28
+ });
29
+ });
30
+ },
31
+
32
+ init: function() {
33
+
34
+ var $this = this;
35
+
36
+ UI.$win.on('resize orientationchange', (function() {
37
+
38
+ var fn = function() {
39
+ $this.process();
40
+ };
41
+
42
+ UI.$(function() {
43
+ fn();
44
+ UI.$win.on("load", fn);
45
+ });
46
+
47
+ return UI.Utils.debounce(fn, 20);
48
+ })());
49
+
50
+ this.on("display.uk.check", function(e) {
51
+ if (this.element.is(":visible")) this.process();
52
+ }.bind(this));
53
+
54
+ if (this.options.observe) {
55
+
56
+ UI.domObserve(this.element, function(e) {
57
+ if ($this.element.is(":visible")) $this.process();
58
+ });
59
+ }
60
+
61
+ stacks.push(this);
62
+ },
63
+
64
+ process: function() {
65
+
66
+ var $this = this, columns = this.element.children();
67
+
68
+ UI.Utils.stackMargin(columns, this.options);
69
+
70
+ if (!this.options.rowfirst || !columns.length) {
71
+ return this;
72
+ }
73
+
74
+ // Mark first column elements
75
+ var group = {}, minleft = false;
76
+
77
+ columns.removeClass(this.options.rowfirst).each(function(offset, $ele){
78
+
79
+ $ele = UI.$(this);
80
+
81
+ if (this.style.display != 'none') {
82
+ offset = $ele.offset().left;
83
+ ((group[offset] = group[offset] || []) && group[offset]).push(this);
84
+ minleft = minleft === false ? offset : Math.min(minleft, offset);
85
+ }
86
+ });
87
+
88
+ UI.$(group[minleft]).addClass(this.options.rowfirst);
89
+
90
+ return this;
91
+ }
92
+
93
+ });
94
+
95
+
96
+ // responsive element e.g. iframes
97
+
98
+ (function(){
99
+
100
+ var elements = [], check = function(ele) {
101
+
102
+ if (!ele.is(':visible')) return;
103
+
104
+ var width = ele.parent().width(),
105
+ iwidth = ele.data('width'),
106
+ ratio = (width / iwidth),
107
+ height = Math.floor(ratio * ele.data('height'));
108
+
109
+ ele.css({'height': (width < iwidth) ? height : ele.data('height')});
110
+ };
111
+
112
+ UI.component('responsiveElement', {
113
+
114
+ defaults: {},
115
+
116
+ boot: function() {
117
+
118
+ // init code
119
+ UI.ready(function(context) {
120
+
121
+ UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
122
+
123
+ var ele = UI.$(this), obj;
124
+
125
+ if (!ele.data("responsiveElement")) {
126
+ obj = UI.responsiveElement(ele, {});
127
+ }
128
+ });
129
+ });
130
+ },
131
+
132
+ init: function() {
133
+
134
+ var ele = this.element;
135
+
136
+ if (ele.attr('width') && ele.attr('height')) {
137
+
138
+ ele.data({
139
+
140
+ 'width' : ele.attr('width'),
141
+ 'height': ele.attr('height')
142
+
143
+ }).on('display.uk.check', function(){
144
+ check(ele);
145
+ });
146
+
147
+ check(ele);
148
+
149
+ elements.push(ele);
150
+ }
151
+ }
152
+ });
153
+
154
+ UI.$win.on('resize load', UI.Utils.debounce(function(){
155
+
156
+ elements.forEach(function(ele){
157
+ check(ele);
158
+ });
159
+
160
+ }, 15));
161
+
162
+ })();
163
+
164
+
165
+
166
+ // helper
167
+
168
+ UI.Utils.stackMargin = function(elements, options) {
169
+
170
+ options = UI.$.extend({
171
+ cls: 'uk-margin-small-top'
172
+ }, options);
173
+
174
+ elements = UI.$(elements).removeClass(options.cls);
175
+
176
+ var min = false;
177
+
178
+ elements.each(function(offset, height, pos, $ele){
179
+
180
+ $ele = UI.$(this);
181
+
182
+ if ($ele.css('display') != 'none') {
183
+
184
+ offset = $ele.offset();
185
+ height = $ele.outerHeight();
186
+ pos = offset.top + height;
187
+
188
+ $ele.data({
189
+ 'ukMarginPos': pos,
190
+ 'ukMarginTop': offset.top
191
+ });
192
+
193
+ if (min === false || (offset.top < min.top) ) {
194
+
195
+ min = {
196
+ top : offset.top,
197
+ left : offset.left,
198
+ pos : pos
199
+ };
200
+ }
201
+ }
202
+
203
+ }).each(function($ele) {
204
+
205
+ $ele = UI.$(this);
206
+
207
+ if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
208
+ $ele.addClass(options.cls);
209
+ }
210
+ });
211
+ };
212
+
213
+ UI.Utils.matchHeights = function(elements, options) {
214
+
215
+ elements = UI.$(elements).css('min-height', '');
216
+ options = UI.$.extend({ row : true }, options);
217
+
218
+ var matchHeights = function(group){
219
+
220
+ if (group.length < 2) return;
221
+
222
+ var max = 0;
223
+
224
+ group.each(function() {
225
+ max = Math.max(max, UI.$(this).outerHeight());
226
+ }).each(function() {
227
+
228
+ var element = UI.$(this),
229
+ height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
230
+
231
+ element.css('min-height', height + 'px');
232
+ });
233
+ };
234
+
235
+ if (options.row) {
236
+
237
+ elements.first().width(); // force redraw
238
+
239
+ setTimeout(function(){
240
+
241
+ var lastoffset = false, group = [];
242
+
243
+ elements.each(function() {
244
+
245
+ var ele = UI.$(this), offset = ele.offset().top;
246
+
247
+ if (offset != lastoffset && group.length) {
248
+
249
+ matchHeights(UI.$(group));
250
+ group = [];
251
+ offset = ele.offset().top;
252
+ }
253
+
254
+ group.push(ele);
255
+ lastoffset = offset;
256
+ });
257
+
258
+ if (group.length) {
259
+ matchHeights(UI.$(group));
260
+ }
261
+
262
+ }, 0);
263
+
264
+ } else {
265
+ matchHeights(elements);
266
+ }
267
+ };
268
+
269
+ (function(cacheSvgs){
270
+
271
+ UI.Utils.inlineSvg = function(selector, root) {
272
+
273
+ var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
274
+
275
+ var img = UI.$(this),
276
+ src = img.attr('src');
277
+
278
+ if (!cacheSvgs[src]) {
279
+
280
+ var d = UI.$.Deferred();
281
+
282
+ UI.$.get(src, {nc: Math.random()}, function(data){
283
+ d.resolve(UI.$(data).find('svg'));
284
+ });
285
+
286
+ cacheSvgs[src] = d.promise();
287
+ }
288
+
289
+ cacheSvgs[src].then(function(svg) {
290
+
291
+ var $svg = UI.$(svg).clone();
292
+
293
+ if (img.attr('id')) $svg.attr('id', img.attr('id'));
294
+ if (img.attr('class')) $svg.attr('class', img.attr('class'));
295
+ if (img.attr('style')) $svg.attr('style', img.attr('style'));
296
+
297
+ if (img.attr('width')) {
298
+ $svg.attr('width', img.attr('width'));
299
+ if (!img.attr('height')) $svg.removeAttr('height');
300
+ }
301
+
302
+ if (img.attr('height')){
303
+ $svg.attr('height', img.attr('height'));
304
+ if (!img.attr('width')) $svg.removeAttr('width');
305
+ }
306
+
307
+ img.replaceWith($svg);
308
+ });
309
+ });
310
+ };
311
+
312
+ // init code
313
+ UI.ready(function(context) {
314
+ UI.Utils.inlineSvg('[data-uk-svg]', context);
315
+ });
316
+
317
+ })({});
318
+
319
+ UI.Utils.getCssVar = function(name) {
320
+
321
+ /* usage in css: .var-name:before { content:"xyz" } */
322
+
323
+ var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
324
+
325
+ element.classList.add('var-'+name);
326
+
327
+ try {
328
+ val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
329
+ } catch (e) {
330
+ val = undefined;
331
+ }
332
+
333
+ doc.removeChild(element);
334
+
335
+ return val;
336
+ }
337
+
338
+ })(UIkit);