rails-uikit-sass 2.27.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +43 -0
  4. data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
  5. data/lib/rails-uikit-sass.rb +12 -0
  6. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  8. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  9. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  10. data/vendor/assets/javascripts/components/accordion.js +180 -0
  11. data/vendor/assets/javascripts/components/accordion.min.js +2 -0
  12. data/vendor/assets/javascripts/components/autocomplete.js +340 -0
  13. data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
  14. data/vendor/assets/javascripts/components/datepicker.js +3167 -0
  15. data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
  16. data/vendor/assets/javascripts/components/form-password.js +67 -0
  17. data/vendor/assets/javascripts/components/form-password.min.js +2 -0
  18. data/vendor/assets/javascripts/components/form-select.js +85 -0
  19. data/vendor/assets/javascripts/components/form-select.min.js +2 -0
  20. data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
  21. data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
  22. data/vendor/assets/javascripts/components/grid.js +540 -0
  23. data/vendor/assets/javascripts/components/grid.min.js +2 -0
  24. data/vendor/assets/javascripts/components/htmleditor.js +679 -0
  25. data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
  26. data/vendor/assets/javascripts/components/lightbox.js +588 -0
  27. data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
  28. data/vendor/assets/javascripts/components/nestable.js +653 -0
  29. data/vendor/assets/javascripts/components/nestable.min.js +2 -0
  30. data/vendor/assets/javascripts/components/notify.js +189 -0
  31. data/vendor/assets/javascripts/components/notify.min.js +2 -0
  32. data/vendor/assets/javascripts/components/pagination.js +147 -0
  33. data/vendor/assets/javascripts/components/pagination.min.js +2 -0
  34. data/vendor/assets/javascripts/components/parallax.js +462 -0
  35. data/vendor/assets/javascripts/components/parallax.min.js +2 -0
  36. data/vendor/assets/javascripts/components/search.js +92 -0
  37. data/vendor/assets/javascripts/components/search.min.js +2 -0
  38. data/vendor/assets/javascripts/components/slider.js +552 -0
  39. data/vendor/assets/javascripts/components/slider.min.js +2 -0
  40. data/vendor/assets/javascripts/components/slideset.js +523 -0
  41. data/vendor/assets/javascripts/components/slideset.min.js +2 -0
  42. data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
  43. data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
  44. data/vendor/assets/javascripts/components/slideshow.js +596 -0
  45. data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
  46. data/vendor/assets/javascripts/components/sortable.js +688 -0
  47. data/vendor/assets/javascripts/components/sortable.min.js +2 -0
  48. data/vendor/assets/javascripts/components/sticky.js +364 -0
  49. data/vendor/assets/javascripts/components/sticky.min.js +2 -0
  50. data/vendor/assets/javascripts/components/timepicker.js +192 -0
  51. data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
  52. data/vendor/assets/javascripts/components/tooltip.js +235 -0
  53. data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
  54. data/vendor/assets/javascripts/components/upload.js +262 -0
  55. data/vendor/assets/javascripts/components/upload.min.js +2 -0
  56. data/vendor/assets/javascripts/core/alert.js +66 -0
  57. data/vendor/assets/javascripts/core/alert.min.js +2 -0
  58. data/vendor/assets/javascripts/core/button.js +156 -0
  59. data/vendor/assets/javascripts/core/button.min.js +2 -0
  60. data/vendor/assets/javascripts/core/core.js +820 -0
  61. data/vendor/assets/javascripts/core/core.min.js +2 -0
  62. data/vendor/assets/javascripts/core/cover.js +87 -0
  63. data/vendor/assets/javascripts/core/cover.min.js +2 -0
  64. data/vendor/assets/javascripts/core/dropdown.js +534 -0
  65. data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
  66. data/vendor/assets/javascripts/core/grid.js +117 -0
  67. data/vendor/assets/javascripts/core/grid.min.js +2 -0
  68. data/vendor/assets/javascripts/core/modal.js +387 -0
  69. data/vendor/assets/javascripts/core/modal.min.js +2 -0
  70. data/vendor/assets/javascripts/core/nav.js +153 -0
  71. data/vendor/assets/javascripts/core/nav.min.js +2 -0
  72. data/vendor/assets/javascripts/core/offcanvas.js +197 -0
  73. data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
  74. data/vendor/assets/javascripts/core/scrollspy.js +209 -0
  75. data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
  76. data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
  77. data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
  78. data/vendor/assets/javascripts/core/switcher.js +307 -0
  79. data/vendor/assets/javascripts/core/switcher.min.js +2 -0
  80. data/vendor/assets/javascripts/core/tab.js +169 -0
  81. data/vendor/assets/javascripts/core/tab.min.js +2 -0
  82. data/vendor/assets/javascripts/core/toggle.js +124 -0
  83. data/vendor/assets/javascripts/core/toggle.min.js +2 -0
  84. data/vendor/assets/javascripts/core/touch.js +175 -0
  85. data/vendor/assets/javascripts/core/touch.min.js +2 -0
  86. data/vendor/assets/javascripts/core/utility.js +335 -0
  87. data/vendor/assets/javascripts/core/utility.min.js +2 -0
  88. data/vendor/assets/javascripts/uikit.js +3898 -0
  89. data/vendor/assets/javascripts/uikit.min.js +3 -0
  90. data/vendor/assets/stylesheets/components/accordion.scss +94 -0
  91. data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
  92. data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
  93. data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
  94. data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
  95. data/vendor/assets/stylesheets/components/form-file.scss +63 -0
  96. data/vendor/assets/stylesheets/components/form-password.scss +74 -0
  97. data/vendor/assets/stylesheets/components/form-select.scss +66 -0
  98. data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
  99. data/vendor/assets/stylesheets/components/nestable.scss +231 -0
  100. data/vendor/assets/stylesheets/components/notify.scss +190 -0
  101. data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
  102. data/vendor/assets/stylesheets/components/progress.scss +173 -0
  103. data/vendor/assets/stylesheets/components/search.scss +309 -0
  104. data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
  105. data/vendor/assets/stylesheets/components/slider.scss +139 -0
  106. data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
  107. data/vendor/assets/stylesheets/components/sortable.scss +124 -0
  108. data/vendor/assets/stylesheets/components/sticky.scss +57 -0
  109. data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
  110. data/vendor/assets/stylesheets/components/upload.scss +34 -0
  111. data/vendor/assets/stylesheets/core/alert.scss +141 -0
  112. data/vendor/assets/stylesheets/core/animation.scss +599 -0
  113. data/vendor/assets/stylesheets/core/article.scss +139 -0
  114. data/vendor/assets/stylesheets/core/badge.scss +110 -0
  115. data/vendor/assets/stylesheets/core/base.scss +563 -0
  116. data/vendor/assets/stylesheets/core/block.scss +155 -0
  117. data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
  118. data/vendor/assets/stylesheets/core/button.scss +406 -0
  119. data/vendor/assets/stylesheets/core/close.scss +132 -0
  120. data/vendor/assets/stylesheets/core/column.scss +209 -0
  121. data/vendor/assets/stylesheets/core/comment.scss +172 -0
  122. data/vendor/assets/stylesheets/core/contrast.scss +493 -0
  123. data/vendor/assets/stylesheets/core/cover.scss +70 -0
  124. data/vendor/assets/stylesheets/core/description-list.scss +71 -0
  125. data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
  126. data/vendor/assets/stylesheets/core/flex.scss +320 -0
  127. data/vendor/assets/stylesheets/core/form.scss +629 -0
  128. data/vendor/assets/stylesheets/core/grid.scss +731 -0
  129. data/vendor/assets/stylesheets/core/icon.scss +930 -0
  130. data/vendor/assets/stylesheets/core/list.scss +102 -0
  131. data/vendor/assets/stylesheets/core/modal.scss +343 -0
  132. data/vendor/assets/stylesheets/core/nav.scss +468 -0
  133. data/vendor/assets/stylesheets/core/navbar.scss +325 -0
  134. data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
  135. data/vendor/assets/stylesheets/core/overlay.scss +534 -0
  136. data/vendor/assets/stylesheets/core/pagination.scss +197 -0
  137. data/vendor/assets/stylesheets/core/panel.scss +332 -0
  138. data/vendor/assets/stylesheets/core/print.scss +61 -0
  139. data/vendor/assets/stylesheets/core/subnav.scss +213 -0
  140. data/vendor/assets/stylesheets/core/switcher.scss +38 -0
  141. data/vendor/assets/stylesheets/core/tab.scss +368 -0
  142. data/vendor/assets/stylesheets/core/table.scss +147 -0
  143. data/vendor/assets/stylesheets/core/text.scss +136 -0
  144. data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
  145. data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
  146. data/vendor/assets/stylesheets/core/utility.scss +610 -0
  147. data/vendor/assets/stylesheets/core/variables.scss +23 -0
  148. data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
  149. data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
  150. data/vendor/assets/stylesheets/uikit.scss +52 -0
  151. metadata +251 -0
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ !function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slider",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e,i,s,n,a={};return t.component("slider",{defaults:{center:!1,threshold:10,infinite:!0,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0,activecls:"uk-active"},boot:function(){t.ready(function(e){setTimeout(function(){t.$("[data-uk-slider]",e).each(function(){var e=t.$(this);e.data("slider")||t.slider(e,t.Utils.options(e.attr("data-uk-slider")))})},0)})},init:function(){var o=this;this.container=this.element.find(".uk-slider"),this.focus=0,t.$win.on("resize load",t.Utils.debounce(function(){o.update(!0)},100)),this.on("click.uk.slider","[data-uk-slider-item]",function(e){e.preventDefault();var i=t.$(this).attr("data-uk-slider-item");if(o.focus!=i)switch(o.stop(),i){case"next":case"previous":o["next"==i?"next":"previous"]();break;default:o.updateFocus(parseInt(i,10))}}),this.container.on({"touchstart mousedown":function(h){h.originalEvent&&h.originalEvent.touches&&(h=h.originalEvent.touches[0]),h.button&&2==h.button||!o.active||(o.stop(),s=t.$(h.target).is("a")?t.$(h.target):t.$(h.target).parents("a:first"),n=!1,s.length&&s.one("click",function(t){n&&t.preventDefault()}),i=function(t){n=!0,e=o,a={touchx:parseInt(t.pageX,10),dir:1,focus:o.focus,base:o.options.center?"center":"area"},t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),e.element.data({"pointer-start":{x:parseInt(t.pageX,10),y:parseInt(t.pageY,10)},"pointer-pos-start":o.pos}),o.container.addClass("uk-drag"),i=!1},i.x=parseInt(h.pageX,10),i.threshold=o.options.threshold)},mouseenter:function(){o.options.pauseOnHover&&(o.hovering=!0)},mouseleave:function(){o.hovering=!1}}),this.update(!0),this.on("display.uk.check",function(){o.element.is(":visible")&&o.update(!0)}),this.element.find("a,img").attr("draggable","false"),this.options.autoplay&&this.start(),t.domObserve(this.element,function(){o.element.children(":not([data-slider-slide])").length&&o.update(!0)})},update:function(e){var i,s,n,a,o=this,h=0,r=0;return this.items=this.container.children().filter(":visible"),this.vp=this.element[0].getBoundingClientRect().width,this.container.css({"min-width":"","min-height":""}),this.items.each(function(e){i=t.$(this).attr("data-slider-slide",e),a=i.css({left:"",width:""})[0].getBoundingClientRect(),s=a.width,n=i.width(),r=Math.max(r,a.height),i.css({left:h,width:s}).data({idx:e,left:h,width:s,cwidth:n,area:h+s,center:h-(o.vp/2-n/2)}),h+=s}),this.container.css({"min-width":h,"min-height":r}),this.options.infinite&&(h<=2*this.vp||this.items.length<5)&&!this.itemsResized?(this.container.children().each(function(t){o.container.append(o.items.eq(t).clone(!0).attr("id",""))}).each(function(t){o.container.append(o.items.eq(t).clone(!0).attr("id",""))}),this.itemsResized=!0,this.update()):(this.cw=h,this.pos=0,this.active=h>=this.vp,this.container.css({"-ms-transform":"","-webkit-transform":"",transform:""}),e&&this.updateFocus(this.focus),void 0)},updatePos:function(t){this.pos=t,this.container.css({"-ms-transform":"translateX("+t+"px)","-webkit-transform":"translateX("+t+"px)",transform:"translateX("+t+"px)"})},updateFocus:function(e,i){if(this.active){i=i||(e>this.focus?1:-1);var s,n,a=this.items.eq(e);if(this.options.infinite&&this.infinite(e,i),this.options.center)this.updatePos(-1*a.data("center")),this.items.filter("."+this.options.activecls).removeClass(this.options.activecls),a.addClass(this.options.activecls);else if(this.options.infinite)this.updatePos(-1*a.data("left"));else{for(s=0,n=e;n<this.items.length;n++)s+=this.items.eq(n).data("width");if(s>this.vp)this.updatePos(-1*a.data("left"));else if(1==i){for(s=0,n=this.items.length-1;n>=0;n--){if(s+=this.items.eq(n).data("width"),s==this.vp){e=n;break}if(s>this.vp){e=n<this.items.length-1?n+1:n;break}}s>this.vp?this.updatePos(-1*(this.container.width()-this.vp)):this.updatePos(-1*this.items.eq(e).data("left"))}}var o=this.items.eq(e).data("left");this.items.removeClass("uk-slide-before uk-slide-after").each(function(i){i!==e&&t.$(this).addClass(t.$(this).data("left")<o?"uk-slide-before":"uk-slide-after")}),this.focus=e,this.trigger("focusitem.uk.slider",[e,this.items.eq(e),this])}},next:function(){var t=this.items[this.focus+1]?this.focus+1:this.options.infinite?0:this.focus;this.updateFocus(t,1)},previous:function(){var t=this.items[this.focus-1]?this.focus-1:this.options.infinite?this.items[this.focus-1]?this.items-1:this.items.length-1:this.focus;this.updateFocus(t,-1)},start:function(){this.stop();var t=this;this.interval=setInterval(function(){t.hovering||t.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)},infinite:function(t,e){var i,s=this,n=this.items.eq(t),a=t,o=[],h=0;if(1==e){for(i=0;i<this.items.length&&(a!=t&&(h+=this.items.eq(a).data("width"),o.push(this.items.eq(a))),!(h>this.vp));i++)a=a+1==this.items.length?0:a+1;o.length&&o.forEach(function(t){var e=n.data("area");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}else{for(i=this.items.length-1;i>-1&&(h+=this.items.eq(a).data("width"),a!=t&&o.push(this.items.eq(a)),!(h>this.vp));i--)a=a-1==-1?this.items.length-1:a-1;o.length&&o.forEach(function(t){var e=n.data("left")-t.data("width");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}}}),t.$doc.on("mousemove.uk.slider touchmove.uk.slider",function(t){if(t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),i&&Math.abs(t.pageX-i.x)>i.threshold&&(window.getSelection().toString()?e=i=!1:i(t)),e){var s,n,o,h,r,c,d,u,f,l;if(t.clientX||t.clientY?s=t.clientX:(t.pageX||t.pageY)&&(s=t.pageX-document.body.scrollLeft-document.documentElement.scrollLeft),r=a.focus,n=s-e.element.data("pointer-start").x,o=e.element.data("pointer-pos-start")+n,h=s>e.element.data("pointer-start").x?-1:1,c=e.items.eq(a.focus),1==h)for(d=c.data("left")+Math.abs(n),u=0,f=a.focus;u<e.items.length;u++){if(l=e.items.eq(f),f!=a.focus&&l.data("left")<d&&l.data("area")>d){r=f;break}f=f+1==e.items.length?0:f+1}else for(d=c.data("left")-Math.abs(n),u=0,f=a.focus;u<e.items.length;u++){if(l=e.items.eq(f),f!=a.focus&&l.data("area")<=c.data("left")&&l.data("center")<d){r=f;break}f=f-1==-1?e.items.length-1:f-1}e.options.infinite&&r!=a._focus&&e.infinite(r,h),e.updatePos(o),a.dir=h,a._focus=r,a.touchx=parseInt(t.pageX,10),a.diff=d}}),t.$doc.on("mouseup.uk.slider touchend.uk.slider",function(){if(e){e.container.removeClass("uk-drag"),e.items.eq(a.focus);var t,s,n,o=!1;if(1==a.dir){for(s=0,n=a.focus;s<e.items.length;s++){if(t=e.items.eq(n),n!=a.focus&&t.data("left")>a.diff){o=n;break}n=n+1==e.items.length?0:n+1}e.options.infinite||o||(o=e.items.length)}else{for(s=0,n=a.focus;s<e.items.length;s++){if(t=e.items.eq(n),n!=a.focus&&t.data("left")<a.diff){o=n;break}n=n-1==-1?e.items.length-1:n-1}e.options.infinite||o||(o=0)}e.updateFocus(o!==!1?o:a._focus)}e=i=!1}),t.slider});
@@ -0,0 +1,523 @@
1
+ /*! UIkit 2.27.2 | 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-slideset', ['uikit'], function(){
12
+ return component || addon(UIkit);
13
+ });
14
+ }
15
+
16
+ })(function(UI){
17
+
18
+ "use strict";
19
+
20
+ var Animations;
21
+
22
+ UI.component('slideset', {
23
+
24
+ defaults: {
25
+ default : 1,
26
+ animation : 'fade',
27
+ duration : 200,
28
+ filter : '',
29
+ delay : false,
30
+ controls : false,
31
+ autoplay : false,
32
+ autoplayInterval : 7000,
33
+ pauseOnHover : true
34
+ },
35
+
36
+ sets: [],
37
+
38
+ boot: function() {
39
+
40
+ // auto init
41
+ UI.ready(function(context) {
42
+
43
+ UI.$('[data-uk-slideset]', context).each(function(){
44
+
45
+ var ele = UI.$(this);
46
+
47
+ if(!ele.data('slideset')) {
48
+ UI.slideset(ele, UI.Utils.options(ele.attr('data-uk-slideset')));
49
+ }
50
+ });
51
+ });
52
+ },
53
+
54
+ init: function() {
55
+
56
+ var $this = this;
57
+
58
+ this.activeSet = false;
59
+ this.list = this.element.find('.uk-slideset');
60
+ this.nav = this.element.find('.uk-slideset-nav');
61
+ this.controls = this.options.controls ? UI.$(this.options.controls) : this.element;
62
+
63
+ UI.$win.on('resize load', UI.Utils.debounce(function() {
64
+ $this.update();
65
+ }, 100));
66
+
67
+ $this.list.addClass('uk-grid-width-1-'+$this.options.default);
68
+
69
+ ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
70
+
71
+ if (!$this.options[bp]) {
72
+ return;
73
+ }
74
+
75
+ $this.list.addClass('uk-grid-width-'+bp+'-1-'+$this.options[bp]);
76
+ });
77
+
78
+ this.on('click.uk.slideset', '[data-uk-slideset-item]', function(e) {
79
+
80
+ e.preventDefault();
81
+
82
+ if ($this.animating) {
83
+ return;
84
+ }
85
+
86
+ var set = UI.$(this).attr('data-uk-slideset-item');
87
+
88
+ if ($this.activeSet === set) return;
89
+
90
+ switch(set) {
91
+ case 'next':
92
+ case 'previous':
93
+ $this[set=='next' ? 'next':'previous']();
94
+ break;
95
+ default:
96
+ $this.show(parseInt(set, 10));
97
+ }
98
+
99
+ });
100
+
101
+ this.controls.on('click.uk.slideset', '[data-uk-filter]', function(e) {
102
+
103
+ var ele = UI.$(this);
104
+
105
+ if (ele.parent().hasClass('uk-slideset')) {
106
+ return;
107
+ }
108
+
109
+ e.preventDefault();
110
+
111
+ if ($this.animating || $this.currentFilter == ele.attr('data-uk-filter')) {
112
+ return;
113
+ }
114
+
115
+ $this.updateFilter(ele.attr('data-uk-filter'));
116
+
117
+ $this._hide().then(function(){
118
+
119
+ $this.update(true, true);
120
+ });
121
+ });
122
+
123
+ this.on('swipeRight swipeLeft', function(e) {
124
+ $this[e.type=='swipeLeft' ? 'next' : 'previous']();
125
+ });
126
+
127
+ this.updateFilter(this.options.filter);
128
+ this.update();
129
+
130
+ this.element.on({
131
+ mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
132
+ mouseleave: function() { $this.hovering = false; }
133
+ });
134
+
135
+ // Set autoplay
136
+ if (this.options.autoplay) {
137
+ this.start();
138
+ }
139
+
140
+ UI.domObserve(this.list, function(e) {
141
+ if ($this.list.children(':visible:not(.uk-active)').length) {
142
+ $this.update(false,true);
143
+ }
144
+ });
145
+ },
146
+
147
+ update: function(animate, force) {
148
+
149
+ var visible = this.visible, i;
150
+
151
+ this.visible = this.getVisibleOnCurrenBreakpoint();
152
+
153
+ if (visible == this.visible && !force) {
154
+ return;
155
+ }
156
+
157
+ this.children = this.list.children().hide();
158
+ this.items = this.getItems();
159
+ this.sets = array_chunk(this.items, this.visible);
160
+
161
+ for (i=0;i<this.sets.length;i++) {
162
+ this.sets[i].css({'display': 'none'});
163
+ }
164
+
165
+ // update nav
166
+ if (this.nav.length && this.nav.empty()) {
167
+
168
+ for (i=0;i<this.sets.length;i++) {
169
+ this.nav.append('<li data-uk-slideset-item="'+i+'"><a></a></li>');
170
+ }
171
+
172
+ this.nav[this.nav.children().length==1 ? 'addClass':'removeClass']('uk-invisible');
173
+ }
174
+
175
+ this.activeSet = false;
176
+ this.show(0, !animate);
177
+ },
178
+
179
+ updateFilter: function(currentfilter) {
180
+
181
+ var $this = this, filter;
182
+
183
+ this.currentFilter = currentfilter;
184
+
185
+ this.controls.find('[data-uk-filter]').each(function(){
186
+
187
+ filter = UI.$(this);
188
+
189
+ if (!filter.parent().hasClass('uk-slideset')) {
190
+
191
+ if (filter.attr('data-uk-filter') == $this.currentFilter) {
192
+ filter.addClass('uk-active');
193
+ } else {
194
+ filter.removeClass('uk-active');
195
+ }
196
+ }
197
+ });
198
+ },
199
+
200
+ getVisibleOnCurrenBreakpoint: function() {
201
+
202
+ var breakpoint = null,
203
+ tmp = UI.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo('body'),
204
+ testdiv = tmp.children().eq(0),
205
+ breakpoints = this.options;
206
+
207
+ ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
208
+
209
+ if (!breakpoints[bp] || breakpoint) {
210
+ return;
211
+ }
212
+
213
+ tmp.attr('class', 'uk-grid-width-'+bp+'-1-2').width();
214
+
215
+ if (testdiv.width() == 50) {
216
+ breakpoint = bp;
217
+ }
218
+ });
219
+
220
+ tmp.remove();
221
+
222
+ return this.options[breakpoint] || this.options['default'];
223
+ },
224
+
225
+ getItems: function() {
226
+
227
+ var items = [], filter;
228
+
229
+ if (this.currentFilter) {
230
+
231
+ filter = this.currentFilter || [];
232
+
233
+ if (typeof(filter) === 'string') {
234
+ filter = filter.split(/,/).map(function(item){ return item.trim(); });
235
+ }
236
+
237
+ this.children.each(function(index){
238
+
239
+ var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
240
+
241
+ if (f) {
242
+
243
+ f = f.split(/,/).map(function(item){ return item.trim(); });
244
+
245
+ filter.forEach(function(item){
246
+ if (f.indexOf(item) > -1) infilter = true;
247
+ });
248
+ }
249
+
250
+ if(infilter) items.push(ele[0]);
251
+ });
252
+
253
+ items = UI.$(items);
254
+
255
+ } else {
256
+ items = this.list.children();
257
+ }
258
+
259
+ return items;
260
+ },
261
+
262
+ show: function(setIndex, noanimate, dir) {
263
+
264
+ var $this = this;
265
+
266
+ if (this.activeSet === setIndex || this.animating) {
267
+ return;
268
+ }
269
+
270
+ dir = dir || (setIndex < this.activeSet ? -1:1);
271
+
272
+ var current = this.sets[this.activeSet] || [],
273
+ next = this.sets[setIndex],
274
+ animation = this._getAnimation();
275
+
276
+ if (noanimate || !UI.support.animation) {
277
+ animation = Animations.none;
278
+ }
279
+
280
+ this.animating = true;
281
+
282
+ if (this.nav.length) {
283
+ this.nav.children().removeClass('uk-active').eq(setIndex).addClass('uk-active');
284
+ }
285
+
286
+ animation.apply($this, [current, next, dir]).then(function(){
287
+
288
+ UI.Utils.checkDisplay(next, true);
289
+
290
+ $this.children.hide().removeClass('uk-active');
291
+ next.addClass('uk-active').css({'display': '', 'opacity':''});
292
+
293
+ $this.animating = false;
294
+ $this.activeSet = setIndex;
295
+
296
+ UI.Utils.checkDisplay(next, true);
297
+
298
+ $this.trigger('show.uk.slideset', [next]);
299
+ });
300
+
301
+ },
302
+
303
+ _getAnimation: function() {
304
+
305
+ var animation = Animations[this.options.animation] || Animations.none;
306
+
307
+ if (!UI.support.animation) {
308
+ animation = Animations.none;
309
+ }
310
+
311
+ return animation;
312
+ },
313
+
314
+ _hide: function() {
315
+
316
+ var $this = this,
317
+ current = this.sets[this.activeSet] || [],
318
+ animation = this._getAnimation();
319
+
320
+ this.animating = true;
321
+
322
+ return animation.apply($this, [current, [], 1]).then(function(){
323
+ $this.animating = false;
324
+ });
325
+ },
326
+
327
+ next: function() {
328
+ this.show(this.sets[this.activeSet + 1] ? (this.activeSet + 1) : 0, false, 1);
329
+ },
330
+
331
+ previous: function() {
332
+ this.show(this.sets[this.activeSet - 1] ? (this.activeSet - 1) : (this.sets.length - 1), false, -1);
333
+ },
334
+
335
+ start: function() {
336
+
337
+ this.stop();
338
+
339
+ var $this = this;
340
+
341
+ this.interval = setInterval(function() {
342
+ if (!$this.hovering && !$this.animating) $this.next();
343
+ }, this.options.autoplayInterval);
344
+
345
+ },
346
+
347
+ stop: function() {
348
+ if (this.interval) clearInterval(this.interval);
349
+ }
350
+ });
351
+
352
+ Animations = {
353
+
354
+ 'none': function() {
355
+ var d = UI.$.Deferred();
356
+ d.resolve();
357
+ return d.promise();
358
+ },
359
+
360
+ 'fade': function(current, next) {
361
+ return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
362
+ },
363
+
364
+ 'slide-bottom': function(current, next) {
365
+ return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
366
+ },
367
+
368
+ 'slide-top': function(current, next) {
369
+ return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
370
+ },
371
+
372
+ 'slide-vertical': function(current, next, dir) {
373
+
374
+ var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
375
+
376
+ if (dir == -1) {
377
+ anim.reverse();
378
+ }
379
+
380
+ return coreAnimation.apply(this, [anim, current, next]);
381
+ },
382
+
383
+ 'slide-horizontal': function(current, next, dir) {
384
+
385
+ var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
386
+
387
+ if (dir == -1) {
388
+ anim.reverse();
389
+ }
390
+
391
+ return coreAnimation.apply(this, [anim, current, next, dir]);
392
+ },
393
+
394
+ 'scale': function(current, next) {
395
+ return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
396
+ }
397
+ };
398
+
399
+ UI.slideset.animations = Animations;
400
+
401
+ // helpers
402
+
403
+ function coreAnimation(cls, current, next, dir) {
404
+
405
+ var d = UI.$.Deferred(),
406
+ delay = (this.options.delay === false) ? Math.floor(this.options.duration/2) : this.options.delay,
407
+ $this = this, clsIn, clsOut, release, i;
408
+
409
+ dir = dir || 1;
410
+
411
+ this.element.css('min-height', this.element.height());
412
+
413
+ if (next[0]===current[0]) {
414
+ d.resolve();
415
+ return d.promise();
416
+ }
417
+
418
+ if (typeof(cls) == 'object') {
419
+ clsIn = cls[0];
420
+ clsOut = cls[1] || cls[0];
421
+ } else {
422
+ clsIn = cls;
423
+ clsOut = clsIn;
424
+ }
425
+
426
+ UI.$body.css('overflow-x', 'hidden'); // prevent horizontal scrollbar on animation
427
+
428
+ release = function() {
429
+
430
+ if (current && current.length) {
431
+ current.hide().removeClass(clsOut+' uk-animation-reverse').css({'opacity':'', 'animation-delay': '', 'animation':''});
432
+ }
433
+
434
+ if (!next.length) {
435
+ d.resolve();
436
+ return;
437
+ }
438
+
439
+ for (i=0;i<next.length;i++) {
440
+ next.eq(dir == 1 ? i:(next.length - i)-1).css('animation-delay', (i*delay)+'ms');
441
+ }
442
+
443
+ var finish = function() {
444
+ next.removeClass(''+clsIn+'').css({opacity:'', display:'', 'animation-delay':'', 'animation':''});
445
+ d.resolve();
446
+ UI.$body.css('overflow-x', '');
447
+ $this.element.css('min-height', '');
448
+ finish = false;
449
+ };
450
+
451
+ next.addClass(clsIn)[dir==1 ? 'last':'first']().one(UI.support.animation.end, function(){
452
+ if(finish) finish();
453
+ }).end().css('display', '');
454
+
455
+ // make sure everything resolves really
456
+ setTimeout(function() {
457
+ if(finish) finish();
458
+ }, next.length * delay * 2);
459
+ };
460
+
461
+ if (next.length) {
462
+ next.css('animation-duration', this.options.duration+'ms');
463
+ }
464
+
465
+ if (current && current.length) {
466
+
467
+ current.css('animation-duration', this.options.duration+'ms')[dir==1 ? 'last':'first']().one(UI.support.animation.end, function() {
468
+ release();
469
+ });
470
+
471
+ for (i=0;i<current.length;i++) {
472
+
473
+ (function (index, ele){
474
+
475
+ setTimeout(function(){
476
+
477
+ ele.css('display', 'none').css('display', '').css('opacity', 0).on(UI.support.animation.end, function(){
478
+ ele.removeClass(clsOut);
479
+ }).addClass(clsOut+' uk-animation-reverse');
480
+
481
+ }.bind(this), i * delay);
482
+
483
+ })(i, current.eq(dir == 1 ? i:(current.length - i)-1));
484
+ }
485
+
486
+ } else {
487
+ release();
488
+ }
489
+
490
+ return d.promise();
491
+ }
492
+
493
+ function array_chunk(input, size) {
494
+
495
+ var x, i = 0, c = -1, l = input.length || 0, n = [];
496
+
497
+ if (size < 1) return null;
498
+
499
+ while (i < l) {
500
+
501
+ x = i % size;
502
+
503
+ if(x) {
504
+ n[c][x] = input[i];
505
+ } else {
506
+ n[++c] = [input[i]];
507
+ }
508
+
509
+ i++;
510
+ }
511
+
512
+ i = 0;
513
+ l = n.length;
514
+
515
+ while (i < l) {
516
+ n[i] = jQuery(n[i]);
517
+ i++;
518
+ }
519
+
520
+ return n;
521
+ }
522
+
523
+ });