uikit-rails 0.0.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -3
  3. data/Gemfile +2 -1
  4. data/LICENSE.txt +21 -0
  5. data/README.md +65 -0
  6. data/Rakefile +0 -1
  7. data/assets/fonts/FontAwesome.otf +0 -0
  8. data/assets/fonts/fontawesome-webfont.ttf +0 -0
  9. data/assets/fonts/fontawesome-webfont.woff +0 -0
  10. data/assets/fonts/fontawesome-webfont.woff2 +0 -0
  11. data/assets/javascripts/components/accordion.js +174 -0
  12. data/assets/javascripts/components/accordion.min.js +2 -0
  13. data/assets/javascripts/components/autocomplete.js +334 -0
  14. data/assets/javascripts/components/autocomplete.min.js +2 -0
  15. data/assets/javascripts/components/datepicker.js +3166 -0
  16. data/assets/javascripts/components/datepicker.min.js +3 -0
  17. data/assets/javascripts/components/form-password.js +67 -0
  18. data/assets/javascripts/components/form-password.min.js +2 -0
  19. data/assets/javascripts/components/form-select.js +70 -0
  20. data/assets/javascripts/components/form-select.min.js +2 -0
  21. data/assets/javascripts/components/grid.js +527 -0
  22. data/assets/javascripts/components/grid.min.js +2 -0
  23. data/assets/javascripts/components/htmleditor.js +623 -0
  24. data/assets/javascripts/components/htmleditor.min.js +2 -0
  25. data/assets/javascripts/components/lightbox.js +555 -0
  26. data/assets/javascripts/components/lightbox.min.js +2 -0
  27. data/assets/javascripts/components/nestable.js +638 -0
  28. data/assets/javascripts/components/nestable.min.js +2 -0
  29. data/assets/javascripts/components/notify.js +189 -0
  30. data/assets/javascripts/components/notify.min.js +2 -0
  31. data/assets/javascripts/components/pagination.js +147 -0
  32. data/assets/javascripts/components/pagination.min.js +2 -0
  33. data/assets/javascripts/components/parallax.js +435 -0
  34. data/assets/javascripts/components/parallax.min.js +2 -0
  35. data/assets/javascripts/components/search.js +92 -0
  36. data/assets/javascripts/components/search.min.js +2 -0
  37. data/assets/javascripts/components/slider.js +531 -0
  38. data/assets/javascripts/components/slider.min.js +2 -0
  39. data/assets/javascripts/components/slideset.js +506 -0
  40. data/assets/javascripts/components/slideset.min.js +2 -0
  41. data/assets/javascripts/components/slideshow-fx.js +375 -0
  42. data/assets/javascripts/components/slideshow-fx.min.js +2 -0
  43. data/assets/javascripts/components/slideshow.js +562 -0
  44. data/assets/javascripts/components/slideshow.min.js +2 -0
  45. data/assets/javascripts/components/sortable.js +688 -0
  46. data/assets/javascripts/components/sortable.min.js +2 -0
  47. data/assets/javascripts/components/sticky.js +359 -0
  48. data/assets/javascripts/components/sticky.min.js +2 -0
  49. data/assets/javascripts/components/timepicker.js +192 -0
  50. data/assets/javascripts/components/timepicker.min.js +2 -0
  51. data/assets/javascripts/components/tooltip.js +234 -0
  52. data/assets/javascripts/components/tooltip.min.js +2 -0
  53. data/assets/javascripts/components/upload.js +260 -0
  54. data/assets/javascripts/components/upload.min.js +2 -0
  55. data/assets/javascripts/core/alert.js +66 -0
  56. data/assets/javascripts/core/alert.min.js +2 -0
  57. data/assets/javascripts/core/button.js +157 -0
  58. data/assets/javascripts/core/button.min.js +2 -0
  59. data/assets/javascripts/core/core.js +730 -0
  60. data/assets/javascripts/core/core.min.js +2 -0
  61. data/assets/javascripts/core/cover.js +95 -0
  62. data/assets/javascripts/core/cover.min.js +2 -0
  63. data/assets/javascripts/core/dropdown.js +514 -0
  64. data/assets/javascripts/core/dropdown.min.js +2 -0
  65. data/assets/javascripts/core/grid.js +114 -0
  66. data/assets/javascripts/core/grid.min.js +2 -0
  67. data/assets/javascripts/core/modal.js +384 -0
  68. data/assets/javascripts/core/modal.min.js +2 -0
  69. data/assets/javascripts/core/nav.js +136 -0
  70. data/assets/javascripts/core/nav.min.js +2 -0
  71. data/assets/javascripts/core/offcanvas.js +180 -0
  72. data/assets/javascripts/core/offcanvas.min.js +2 -0
  73. data/assets/javascripts/core/scrollspy.js +208 -0
  74. data/assets/javascripts/core/scrollspy.min.js +2 -0
  75. data/assets/javascripts/core/smooth-scroll.js +62 -0
  76. data/assets/javascripts/core/smooth-scroll.min.js +2 -0
  77. data/assets/javascripts/core/switcher.js +309 -0
  78. data/assets/javascripts/core/switcher.min.js +2 -0
  79. data/assets/javascripts/core/tab.js +167 -0
  80. data/assets/javascripts/core/tab.min.js +2 -0
  81. data/assets/javascripts/core/toggle.js +120 -0
  82. data/assets/javascripts/core/toggle.min.js +2 -0
  83. data/assets/javascripts/core/touch.js +175 -0
  84. data/assets/javascripts/core/touch.min.js +2 -0
  85. data/assets/javascripts/core/utility.js +289 -0
  86. data/assets/javascripts/core/utility.min.js +2 -0
  87. data/assets/javascripts/uikit-components.js +23 -0
  88. data/assets/javascripts/uikit.js +3706 -0
  89. data/assets/javascripts/uikit.min.js +3 -0
  90. data/assets/stylesheets/components/accordion.scss +94 -0
  91. data/assets/stylesheets/components/autocomplete.scss +102 -0
  92. data/assets/stylesheets/components/datepicker.scss +197 -0
  93. data/assets/stylesheets/components/dotnav.scss +212 -0
  94. data/assets/stylesheets/components/form-advanced.scss +128 -0
  95. data/assets/stylesheets/components/form-file.scss +63 -0
  96. data/assets/stylesheets/components/form-password.scss +74 -0
  97. data/assets/stylesheets/components/form-select.scss +66 -0
  98. data/assets/stylesheets/components/htmleditor.scss +269 -0
  99. data/assets/stylesheets/components/nestable.scss +229 -0
  100. data/assets/stylesheets/components/notify.scss +190 -0
  101. data/assets/stylesheets/components/placeholder.scss +66 -0
  102. data/assets/stylesheets/components/progress.scss +173 -0
  103. data/assets/stylesheets/components/search.scss +309 -0
  104. data/assets/stylesheets/components/slidenav.scss +183 -0
  105. data/assets/stylesheets/components/slider.scss +131 -0
  106. data/assets/stylesheets/components/slideshow.scss +208 -0
  107. data/assets/stylesheets/components/sortable.scss +122 -0
  108. data/assets/stylesheets/components/sticky.scss +64 -0
  109. data/assets/stylesheets/components/tooltip.scss +177 -0
  110. data/assets/stylesheets/components/upload.scss +34 -0
  111. data/assets/stylesheets/core/alert.scss +141 -0
  112. data/assets/stylesheets/core/animation.scss +599 -0
  113. data/assets/stylesheets/core/article.scss +139 -0
  114. data/assets/stylesheets/core/badge.scss +110 -0
  115. data/assets/stylesheets/core/base-noconflict.scss +397 -0
  116. data/assets/stylesheets/core/base.scss +541 -0
  117. data/assets/stylesheets/core/block.scss +153 -0
  118. data/assets/stylesheets/core/breadcrumb.scss +86 -0
  119. data/assets/stylesheets/core/button.scss +406 -0
  120. data/assets/stylesheets/core/close.scss +132 -0
  121. data/assets/stylesheets/core/column.scss +209 -0
  122. data/assets/stylesheets/core/comment.scss +172 -0
  123. data/assets/stylesheets/core/contrast.scss +493 -0
  124. data/assets/stylesheets/core/cover.scss +70 -0
  125. data/assets/stylesheets/core/description-list.scss +71 -0
  126. data/assets/stylesheets/core/dropdown.scss +280 -0
  127. data/assets/stylesheets/core/flex.scss +320 -0
  128. data/assets/stylesheets/core/form.scss +627 -0
  129. data/assets/stylesheets/core/grid.scss +688 -0
  130. data/assets/stylesheets/core/icon.scss +897 -0
  131. data/assets/stylesheets/core/list.scss +102 -0
  132. data/assets/stylesheets/core/modal.scss +341 -0
  133. data/assets/stylesheets/core/nav.scss +468 -0
  134. data/assets/stylesheets/core/navbar.scss +325 -0
  135. data/assets/stylesheets/core/offcanvas.scss +168 -0
  136. data/assets/stylesheets/core/overlay.scss +534 -0
  137. data/assets/stylesheets/core/pagination.scss +197 -0
  138. data/assets/stylesheets/core/panel.scss +332 -0
  139. data/assets/stylesheets/core/print.scss +59 -0
  140. data/assets/stylesheets/core/subnav.scss +213 -0
  141. data/assets/stylesheets/core/switcher.scss +38 -0
  142. data/assets/stylesheets/core/tab.scss +368 -0
  143. data/assets/stylesheets/core/table.scss +147 -0
  144. data/assets/stylesheets/core/text.scss +128 -0
  145. data/assets/stylesheets/core/thumbnail.scss +122 -0
  146. data/assets/stylesheets/core/thumbnav.scss +122 -0
  147. data/assets/stylesheets/core/utility.scss +606 -0
  148. data/assets/stylesheets/core/variables.scss +23 -0
  149. data/assets/stylesheets/uikit-components.scss +22 -0
  150. data/assets/stylesheets/uikit-mixins.scss +327 -0
  151. data/assets/stylesheets/uikit-variables.scss +817 -0
  152. data/assets/stylesheets/uikit.scss +56 -0
  153. data/lib/uikit-rails.rb +2 -2
  154. data/lib/uikit-rails/engine.rb +11 -1
  155. data/lib/uikit-rails/version.rb +1 -3
  156. data/uikit-rails.gemspec +15 -16
  157. metadata +169 -44
  158. data/README.rb +0 -1
  159. data/vendor/assets/javascripts/ui.card.js +0 -115
  160. data/vendor/assets/javascripts/ui.color-picker.js +0 -351
  161. data/vendor/assets/javascripts/ui.confirmation.js +0 -133
  162. data/vendor/assets/javascripts/ui.dialog.js +0 -252
  163. data/vendor/assets/javascripts/ui.emitter.js +0 -99
  164. data/vendor/assets/javascripts/ui.js +0 -1641
  165. data/vendor/assets/javascripts/ui.menu.js +0 -238
  166. data/vendor/assets/javascripts/ui.notification.js +0 -240
  167. data/vendor/assets/javascripts/ui.overlay.js +0 -79
  168. data/vendor/assets/javascripts/ui.split-button.js +0 -108
  169. data/vendor/assets/stylesheets/ui.card.css +0 -55
  170. data/vendor/assets/stylesheets/ui.color-picker.css +0 -6
  171. data/vendor/assets/stylesheets/ui.confirmation.css +0 -7
  172. data/vendor/assets/stylesheets/ui.css +0 -337
  173. data/vendor/assets/stylesheets/ui.dialog.css +0 -92
  174. data/vendor/assets/stylesheets/ui.menu.css +0 -32
  175. data/vendor/assets/stylesheets/ui.notification.css +0 -107
  176. data/vendor/assets/stylesheets/ui.overlay.css +0 -16
  177. data/vendor/assets/stylesheets/ui.split-button.css +0 -27
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.24.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ !function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideset",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i,e,s,n){var a,o,r,l,h=t.$.Deferred(),u=this.options.delay===!1?Math.floor(this.options.duration/2):this.options.delay,d=this;if(n=n||1,this.element.css("min-height",this.element.height()),s[0]===e[0])return h.resolve(),h.promise();if("object"==typeof i?(a=i[0],o=i[1]||i[0]):(a=i,o=a),r=function(){if(e&&e.length&&e.hide().removeClass(o+" uk-animation-reverse").css({opacity:"","animation-delay":"",animation:""}),!s.length)return h.resolve(),void 0;for(l=0;l<s.length;l++)s.eq(1==n?l:s.length-l-1).css("animation-delay",l*u+"ms");s.addClass(a)[1==n?"last":"first"]().one(t.support.animation.end,function(){s.removeClass(""+a).css({opacity:"",display:"","animation-delay":"",animation:""}),h.resolve(),d.element.css("min-height","")}).end().css("display","")},s.length&&s.css("animation-duration",this.options.duration+"ms"),e&&e.length)for(e.css("animation-duration",this.options.duration+"ms")[1==n?"last":"first"]().one(t.support.animation.end,function(){r()}),l=0;l<e.length;l++)!function(i,e){setTimeout(function(){e.css("display","none").css("display","").css("opacity",0).on(t.support.animation.end,function(){e.removeClass(o)}).addClass(o+" uk-animation-reverse")}.bind(this),l*u)}(l,e.eq(1==n?l:e.length-l-1));else r();return h.promise()}function e(t,i){var e,s=0,n=-1,a=t.length||0,o=[];if(1>i)return null;for(;a>s;)e=s%i,e?o[n][e]=t[s]:o[++n]=[t[s]],s++;for(s=0,a=o.length;a>s;)o[s]=jQuery(o[s]),s++;return o}var s;t.component("slideset",{defaults:{"default":1,animation:"fade",duration:200,filter:"",delay:!1,controls:!1,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},sets:[],boot:function(){t.ready(function(i){t.$("[data-uk-slideset]",i).each(function(){var i=t.$(this);i.data("slideset")||t.slideset(i,t.Utils.options(i.attr("data-uk-slideset")))})})},init:function(){var i=this;this.activeSet=!1,this.list=this.element.find(".uk-slideset"),this.nav=this.element.find(".uk-slideset-nav"),this.controls=this.options.controls?t.$(this.options.controls):this.element,t.$win.on("resize load",t.Utils.debounce(function(){i.updateSets()},100)),i.list.addClass("uk-grid-width-1-"+i.options.default),["xlarge","large","medium","small"].forEach(function(t){i.options[t]&&i.list.addClass("uk-grid-width-"+t+"-1-"+i.options[t])}),this.on("click.uikit.slideset","[data-uk-slideset-item]",function(e){if(e.preventDefault(),!i.animating){var s=t.$(this).attr("data-uk-slideset-item");if(i.activeSet!==s)switch(s){case"next":case"previous":i["next"==s?"next":"previous"]();break;default:i.show(parseInt(s,10))}}}),this.controls.on("click.uikit.slideset","[data-uk-filter]",function(e){var s=t.$(this);s.parent().hasClass("uk-slideset")||(e.preventDefault(),i.animating||i.currentFilter==s.attr("data-uk-filter")||(i.updateFilter(s.attr("data-uk-filter")),i._hide().then(function(){i.updateSets(!0,!0)})))}),this.on("swipeRight swipeLeft",function(t){i["swipeLeft"==t.type?"next":"previous"]()}),this.updateFilter(this.options.filter),this.updateSets(),this.element.on({mouseenter:function(){i.options.pauseOnHover&&(i.hovering=!0)},mouseleave:function(){i.hovering=!1}}),this.options.autoplay&&this.start()},updateSets:function(t,i){var s,n=this.visible;if(this.visible=this.getVisibleOnCurrenBreakpoint(),n!=this.visible||i){for(this.children=this.list.children().hide(),this.items=this.getItems(),this.sets=e(this.items,this.visible),s=0;s<this.sets.length;s++)this.sets[s].css({display:"none"});if(this.nav.length&&this.nav.empty()){for(s=0;s<this.sets.length;s++)this.nav.append('<li data-uk-slideset-item="'+s+'"><a></a></li>');this.nav[1==this.nav.children().length?"addClass":"removeClass"]("uk-invisible")}this.activeSet=!1,this.show(0,!t)}},updateFilter:function(i){var e,s=this;this.currentFilter=i,this.controls.find("[data-uk-filter]").each(function(){e=t.$(this),e.parent().hasClass("uk-slideset")||(e.attr("data-uk-filter")==s.currentFilter?e.addClass("uk-active"):e.removeClass("uk-active"))})},getVisibleOnCurrenBreakpoint:function(){var i=null,e=t.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo("body"),s=e.children().eq(0),n=this.options;return["xlarge","large","medium","small"].forEach(function(t){n[t]&&!i&&(e.attr("class","uk-grid-width-"+t+"-1-2").width(),50==s.width()&&(i=t))}),e.remove(),this.options[i]||this.options["default"]},getItems:function(){var i,e=[];return this.currentFilter?(i=this.currentFilter||[],"string"==typeof i&&(i=i.split(/,/).map(function(t){return t.trim()})),this.children.each(function(){var s=t.$(this),n=s.attr("data-uk-filter"),a=i.length?!1:!0;n&&(n=n.split(/,/).map(function(t){return t.trim()}),i.forEach(function(t){n.indexOf(t)>-1&&(a=!0)})),a&&e.push(s[0])}),e=t.$(e)):e=this.list.children(),e},show:function(i,e,n){var a=this;if(this.activeSet!==i&&!this.animating){n=n||(i<this.activeSet?-1:1);var o=this.sets[this.activeSet]||[],r=this.sets[i],l=this._getAnimation();(e||!t.support.animation)&&(l=s.none),this.animating=!0,this.nav.length&&this.nav.children().removeClass("uk-active").eq(i).addClass("uk-active"),l.apply(a,[o,r,n]).then(function(){t.Utils.checkDisplay(r,!0),a.children.hide().removeClass("uk-active"),r.addClass("uk-active").css({display:"",opacity:""}),a.animating=!1,a.activeSet=i,t.Utils.checkDisplay(r,!0),a.trigger("show.uk.slideset",[r])})}},_getAnimation:function(){var i=s[this.options.animation]||s.none;return t.support.animation||(i=s.none),i},_hide:function(){var t=this,i=this.sets[this.activeSet]||[],e=this._getAnimation();return this.animating=!0,e.apply(t,[i,[],1]).then(function(){t.animating=!1})},next:function(){this.show(this.sets[this.activeSet+1]?this.activeSet+1:0,!1,1)},previous:function(){this.show(this.sets[this.activeSet-1]?this.activeSet-1:this.sets.length-1,!1,-1)},start:function(){this.stop();var t=this;this.interval=setInterval(function(){t.hovering||t.animating||t.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)}}),s={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,e){return i.apply(this,["uk-animation-fade",t,e])},"slide-bottom":function(t,e){return i.apply(this,["uk-animation-slide-bottom",t,e])},"slide-top":function(t,e){return i.apply(this,["uk-animation-slide-top",t,e])},"slide-vertical":function(t,e,s){var n=["uk-animation-slide-top","uk-animation-slide-bottom"];return-1==s&&n.reverse(),i.apply(this,[n,t,e])},"slide-horizontal":function(t,e,s){var n=["uk-animation-slide-right","uk-animation-slide-left"];return-1==s&&n.reverse(),i.apply(this,[n,t,e,s])},scale:function(t,e){return i.apply(this,["uk-animation-scale-up",t,e])}},t.slideset.animations=s});
@@ -0,0 +1,375 @@
1
+ /*! UIkit 2.24.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-slideshow-fx", ["uikit"], function() {
12
+ return component || addon(UIkit);
13
+ });
14
+ }
15
+
16
+ })(function(UI) {
17
+
18
+ "use strict";
19
+
20
+ var Animations = UI.slideshow.animations;
21
+
22
+ UI.$.extend(UI.slideshow.animations, {
23
+ 'slice': function(current, next, dir, fromfx) {
24
+
25
+ if (!current.data('cover')) {
26
+ return Animations.fade.apply(this, arguments);
27
+ }
28
+
29
+ var d = UI.$.Deferred();
30
+
31
+ var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
32
+ bgimage = next.data('cover').css('background-image'),
33
+ ghost = UI.$('<li></li>').css({
34
+ top : 0,
35
+ left : 0,
36
+ width : this.container.width(),
37
+ height : this.container.height(),
38
+ opacity: 1,
39
+ zIndex : 15
40
+ }),
41
+ ghostWidth = ghost.width(),
42
+ ghostHeight = ghost.height(),
43
+ pos = fromfx == 'slice-up' ? ghostHeight:'0',
44
+ bar;
45
+
46
+ for (var i = 0; i < this.options.slices; i++) {
47
+
48
+ if (fromfx == 'slice-up-down') {
49
+ pos = ((i % 2) + 2) % 2==0 ? '0':ghostHeight;
50
+ }
51
+
52
+ var width = (i == this.options.slices-1) ? sliceWidth : sliceWidth,
53
+ clipto = ('rect(0px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
54
+ clipfrom;
55
+
56
+ //slice-down - default
57
+ clipfrom = ('rect(0px, '+(width*(i+1))+'px, 0px, '+(sliceWidth*i)+'px)');
58
+
59
+ if (fromfx == 'slice-up' || (fromfx == 'slice-up-down' && ((i % 2) + 2) % 2==0 )) {
60
+ clipfrom = ('rect('+ghostHeight+'px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)');
61
+ }
62
+
63
+ bar = UI.$('<div class="uk-cover-background"></div>').css({
64
+ 'position' : 'absolute',
65
+ 'top' : 0,
66
+ 'left' : 0,
67
+ 'width' : ghostWidth,
68
+ 'height' : ghostHeight,
69
+ 'background-image' : bgimage,
70
+ 'clip' : clipfrom,
71
+ 'opacity' : 0,
72
+ 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms',
73
+ '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms'
74
+
75
+ }).data('clip', clipto);
76
+
77
+ ghost.append(bar);
78
+ }
79
+
80
+ this.container.append(ghost);
81
+
82
+ ghost.children().last().on(UI.support.transition.end, function() {
83
+ ghost.remove();
84
+ d.resolve();
85
+ });
86
+
87
+ ghost.width();
88
+
89
+ ghost.children().each(function() {
90
+ var bar = UI.$(this);
91
+
92
+ bar.css({
93
+ 'clip': bar.data('clip'),
94
+ 'opacity': 1
95
+ });
96
+ });
97
+
98
+ return d.promise();
99
+ },
100
+
101
+ 'slice-up': function(current, next, dir) {
102
+ return Animations.slice.apply(this, [current, next, dir, 'slice-up']);
103
+ },
104
+
105
+ 'slice-down': function(current, next, dir) {
106
+ return Animations.slice.apply(this, [current, next, dir, 'slice-down']);
107
+ },
108
+
109
+ 'slice-up-down': function(current, next, dir) {
110
+ return Animations.slice.apply(this, [current, next, dir, 'slice-up-down']);
111
+ },
112
+
113
+ 'fold': function(current, next, dir) {
114
+
115
+ if (!next.data('cover')) {
116
+ return Animations.fade.apply(this, arguments);
117
+ }
118
+
119
+ var d = UI.$.Deferred();
120
+
121
+ var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
122
+ bgimage = next.data('cover').css('background-image'),
123
+ ghost = UI.$('<li></li>').css({
124
+ width : next.width(),
125
+ height : next.height(),
126
+ opacity: 1,
127
+ zIndex : 15
128
+ }),
129
+ ghostWidth = next.width(),
130
+ ghostHeight = next.height(),
131
+ bar;
132
+
133
+ for (var i = 0; i < this.options.slices; i++) {
134
+
135
+ bar = UI.$('<div class="uk-cover-background"></div>').css({
136
+ 'position' : 'absolute',
137
+ 'top' : 0,
138
+ 'left' : 0,
139
+ 'width' : ghostWidth,
140
+ 'height' : ghostHeight,
141
+ 'background-image' : bgimage,
142
+ 'transform-origin' : (sliceWidth*i)+'px 0 0',
143
+ 'clip' : ('rect(0px, '+(sliceWidth*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
144
+ 'opacity' : 0,
145
+ 'transform' : 'scaleX(0.000001)',
146
+ 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms',
147
+ '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms'
148
+ });
149
+
150
+ ghost.prepend(bar);
151
+ }
152
+
153
+ this.container.append(ghost);
154
+
155
+ ghost.width();
156
+
157
+ ghost.children().first().on(UI.support.transition.end, function() {
158
+ ghost.remove();
159
+ d.resolve();
160
+ }).end().css({
161
+ 'transform': 'scaleX(1)',
162
+ 'opacity': 1
163
+ });
164
+
165
+ return d.promise();
166
+ },
167
+
168
+ 'puzzle': function(current, next, dir) {
169
+
170
+ if (!next.data('cover')) {
171
+ return Animations.fade.apply(this, arguments);
172
+ }
173
+
174
+ var d = UI.$.Deferred(), $this = this;
175
+
176
+ var boxCols = Math.round(this.options.slices/2),
177
+ boxWidth = Math.round(next.width()/boxCols),
178
+ boxRows = Math.round(next.height()/boxWidth),
179
+ boxHeight = Math.round(next.height()/boxRows)+1,
180
+ bgimage = next.data('cover').css('background-image'),
181
+ ghost = UI.$('<li></li>').css({
182
+ width : this.container.width(),
183
+ height : this.container.height(),
184
+ opacity : 1,
185
+ zIndex : 15
186
+ }),
187
+ ghostWidth = this.container.width(),
188
+ ghostHeight = this.container.height(),
189
+ box, rect, width;
190
+
191
+ for (var rows = 0; rows < boxRows; rows++) {
192
+
193
+ for (var cols = 0; cols < boxCols; cols++) {
194
+
195
+ width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
196
+
197
+ rect = [
198
+ (boxHeight * rows) +'px', // top
199
+ (width * (cols+1)) +'px', // right
200
+ (boxHeight * (rows + 1)) +'px', // bottom
201
+ (boxWidth * cols) +'px' // left
202
+ ];
203
+
204
+ box = UI.$('<div class="uk-cover-background"></div>').css({
205
+ 'position' : 'absolute',
206
+ 'top' : 0,
207
+ 'left' : 0,
208
+ 'opacity' : 0,
209
+ 'width' : ghostWidth,
210
+ 'height' : ghostHeight,
211
+ 'background-image' : bgimage,
212
+ 'clip' : ('rect('+rect.join(',')+')'),
213
+ '-webkit-transform' : 'translateZ(0)', // fixes webkit opacity flickering bug
214
+ 'transform' : 'translateZ(0)' // fixes moz opacity flickering bug
215
+ });
216
+
217
+ ghost.append(box);
218
+ }
219
+ }
220
+
221
+ this.container.append(ghost);
222
+
223
+ var boxes = shuffle(ghost.children());
224
+
225
+ boxes.each(function(i) {
226
+ UI.$(this).css({
227
+ 'transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms',
228
+ '-webkit-transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms'
229
+ });
230
+ }).last().on(UI.support.transition.end, function() {
231
+ ghost.remove();
232
+ d.resolve();
233
+ });
234
+
235
+ ghost.width();
236
+
237
+ boxes.css({'opacity': 1});
238
+
239
+ return d.promise();
240
+ },
241
+
242
+ 'boxes': function(current, next, dir, fromfx) {
243
+
244
+ if (!next.data('cover')) {
245
+ return Animations.fade.apply(this, arguments);
246
+ }
247
+
248
+ var d = UI.$.Deferred();
249
+
250
+ var boxCols = Math.round(this.options.slices/2),
251
+ boxWidth = Math.round(next.width()/boxCols),
252
+ boxRows = Math.round(next.height()/boxWidth),
253
+ boxHeight = Math.round(next.height()/boxRows)+1,
254
+ bgimage = next.data('cover').css('background-image'),
255
+ ghost = UI.$('<li></li>').css({
256
+ width : next.width(),
257
+ height : next.height(),
258
+ opacity : 1,
259
+ zIndex : 15
260
+ }),
261
+ ghostWidth = next.width(),
262
+ ghostHeight = next.height(),
263
+ box, rect, width, cols;
264
+
265
+ for (var rows = 0; rows < boxRows; rows++) {
266
+
267
+ for (cols = 0; cols < boxCols; cols++) {
268
+
269
+ width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
270
+
271
+ rect = [
272
+ (boxHeight * rows) +'px', // top
273
+ (width * (cols+1)) +'px', // right
274
+ (boxHeight * (rows + 1)) +'px', // bottom
275
+ (boxWidth * cols) +'px' // left
276
+ ];
277
+
278
+ box = UI.$('<div class="uk-cover-background"></div>').css({
279
+ 'position' : 'absolute',
280
+ 'top' : 0,
281
+ 'left' : 0,
282
+ 'opacity' : 1,
283
+ 'width' : ghostWidth,
284
+ 'height' : ghostHeight,
285
+ 'background-image' : bgimage,
286
+ 'transform-origin' : rect[3]+' '+rect[0]+' 0',
287
+ 'clip' : ('rect('+rect.join(',')+')'),
288
+ '-webkit-transform' : 'scale(0.0000000000000001)',
289
+ 'transform' : 'scale(0.0000000000000001)'
290
+ });
291
+
292
+ ghost.append(box);
293
+ }
294
+ }
295
+
296
+ this.container.append(ghost);
297
+
298
+ var rowIndex = 0, colIndex = 0, timeBuff = 0, box2Darr = [[]], boxes = ghost.children(), prevCol;
299
+
300
+ if (fromfx == 'boxes-reverse') {
301
+ boxes = [].reverse.apply(boxes);
302
+ }
303
+
304
+ boxes.each(function() {
305
+
306
+ box2Darr[rowIndex][colIndex] = UI.$(this);
307
+ colIndex++;
308
+
309
+ if(colIndex == boxCols) {
310
+ rowIndex++;
311
+ colIndex = 0;
312
+ box2Darr[rowIndex] = [];
313
+ }
314
+ });
315
+
316
+ for (cols = 0, prevCol = 0; cols < (boxCols * boxRows); cols++) {
317
+
318
+ prevCol = cols;
319
+
320
+ for (var row = 0; row < boxRows; row++) {
321
+
322
+ if (prevCol >= 0 && prevCol < boxCols) {
323
+
324
+ box2Darr[row][prevCol].css({
325
+ 'transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms',
326
+ '-webkit-transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms'
327
+ });
328
+ }
329
+ prevCol--;
330
+ }
331
+ timeBuff += 100;
332
+ }
333
+
334
+ boxes.last().on(UI.support.transition.end, function() {
335
+ ghost.remove();
336
+ d.resolve();
337
+ });
338
+
339
+ ghost.width();
340
+
341
+ boxes.css({
342
+ '-webkit-transform': 'scale(1)',
343
+ 'transform': 'scale(1)'
344
+ });
345
+
346
+ return d.promise();
347
+ },
348
+
349
+ 'boxes-reverse': function(current, next, dir) {
350
+ return Animations.boxes.apply(this, [current, next, dir, 'boxes-reverse']);
351
+ },
352
+
353
+ 'random-fx': function(){
354
+
355
+ var animations = ['slice-up', 'fold', 'puzzle', 'slice-down', 'boxes', 'slice-up-down', 'boxes-reverse'];
356
+
357
+ this.fxIndex = (this.fxIndex === undefined ? -1 : this.fxIndex) + 1;
358
+
359
+ if (!animations[this.fxIndex]) this.fxIndex = 0;
360
+
361
+ return Animations[animations[this.fxIndex]].apply(this, arguments);
362
+ }
363
+ });
364
+
365
+
366
+ // helper functions
367
+
368
+ // Shuffle an array
369
+ var shuffle = function(arr) {
370
+ for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x) {}
371
+ return arr;
372
+ };
373
+
374
+ return UI.slideshow.animations;
375
+ });
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.24.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ !function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow-fx",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t=i.slideshow.animations;i.$.extend(i.slideshow.animations,{slice:function(e,s,n,o){if(!e.data("cover"))return t.fade.apply(this,arguments);for(var r,a=i.$.Deferred(),c=Math.ceil(this.element.width()/this.options.slices),h=s.data("cover").css("background-image"),d=i.$("<li></li>").css({top:0,left:0,width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),p=d.width(),l=d.height(),u="slice-up"==o?l:"0",f=0;f<this.options.slices;f++){"slice-up-down"==o&&(u=(f%2+2)%2==0?"0":l);var m,x=f==this.options.slices-1?c:c,v="rect(0px, "+x*(f+1)+"px, "+l+"px, "+c*f+"px)";m="rect(0px, "+x*(f+1)+"px, 0px, "+c*f+"px)",("slice-up"==o||"slice-up-down"==o&&(f%2+2)%2==0)&&(m="rect("+l+"px, "+x*(f+1)+"px, "+l+"px, "+c*f+"px)"),r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:p,height:l,"background-image":h,clip:m,opacity:0,transition:"all "+this.options.duration+"ms ease-in-out "+60*f+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+60*f+"ms"}).data("clip",v),d.append(r)}return this.container.append(d),d.children().last().on(i.support.transition.end,function(){d.remove(),a.resolve()}),d.width(),d.children().each(function(){var t=i.$(this);t.css({clip:t.data("clip"),opacity:1})}),a.promise()},"slice-up":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up"])},"slice-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-down"])},"slice-up-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up-down"])},fold:function(e,s){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var n,o=i.$.Deferred(),r=Math.ceil(this.element.width()/this.options.slices),a=s.data("cover").css("background-image"),c=i.$("<li></li>").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),h=s.width(),d=s.height(),p=0;p<this.options.slices;p++)n=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:h,height:d,"background-image":a,"transform-origin":r*p+"px 0 0",clip:"rect(0px, "+r*(p+1)+"px, "+d+"px, "+r*p+"px)",opacity:0,transform:"scaleX(0.000001)",transition:"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms"}),c.prepend(n);return this.container.append(c),c.width(),c.children().first().on(i.support.transition.end,function(){c.remove(),o.resolve()}).end().css({transform:"scaleX(1)",opacity:1}),o.promise()},puzzle:function(s,n){if(!n.data("cover"))return t.fade.apply(this,arguments);for(var o,r,a,c=i.$.Deferred(),h=this,d=Math.round(this.options.slices/2),p=Math.round(n.width()/d),l=Math.round(n.height()/p),u=Math.round(n.height()/l)+1,f=n.data("cover").css("background-image"),m=i.$("<li></li>").css({width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),x=this.container.width(),v=this.container.height(),g=0;l>g;g++)for(var w=0;d>w;w++)a=w==d-1?p+2:p,r=[u*g+"px",a*(w+1)+"px",u*(g+1)+"px",p*w+"px"],o=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:0,width:x,height:v,"background-image":f,clip:"rect("+r.join(",")+")","-webkit-transform":"translateZ(0)",transform:"translateZ(0)"}),m.append(o);this.container.append(m);var b=e(m.children());return b.each(function(t){i.$(this).css({transition:"all "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms","-webkit-transition":"all "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms"})}).last().on(i.support.transition.end,function(){m.remove(),c.resolve()}),m.width(),b.css({opacity:1}),c.promise()},boxes:function(e,s,n,o){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var r,a,c,h,d=i.$.Deferred(),p=Math.round(this.options.slices/2),l=Math.round(s.width()/p),u=Math.round(s.height()/l),f=Math.round(s.height()/u)+1,m=s.data("cover").css("background-image"),x=i.$("<li></li>").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),v=s.width(),g=s.height(),w=0;u>w;w++)for(h=0;p>h;h++)c=h==p-1?l+2:l,a=[f*w+"px",c*(h+1)+"px",f*(w+1)+"px",l*h+"px"],r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:1,width:v,height:g,"background-image":m,"transform-origin":a[3]+" "+a[0]+" 0",clip:"rect("+a.join(",")+")","-webkit-transform":"scale(0.0000000000000001)",transform:"scale(0.0000000000000001)"}),x.append(r);this.container.append(x);var b,k=0,y=0,$=0,I=[[]],M=x.children();for("boxes-reverse"==o&&(M=[].reverse.apply(M)),M.each(function(){I[k][y]=i.$(this),y++,y==p&&(k++,y=0,I[k]=[])}),h=0,b=0;p*u>h;h++){b=h;for(var z=0;u>z;z++)b>=0&&p>b&&I[z][b].css({transition:"all "+this.options.duration+"ms linear "+(50+$)+"ms","-webkit-transition":"all "+this.options.duration+"ms linear "+(50+$)+"ms"}),b--;$+=100}return M.last().on(i.support.transition.end,function(){x.remove(),d.resolve()}),x.width(),M.css({"-webkit-transform":"scale(1)",transform:"scale(1)"}),d.promise()},"boxes-reverse":function(i,e,s){return t.boxes.apply(this,[i,e,s,"boxes-reverse"])},"random-fx":function(){var i=["slice-up","fold","puzzle","slice-down","boxes","slice-up-down","boxes-reverse"];return this.fxIndex=(void 0===this.fxIndex?-1:this.fxIndex)+1,i[this.fxIndex]||(this.fxIndex=0),t[i[this.fxIndex]].apply(this,arguments)}});var e=function(i){for(var t,e,s=i.length;s;t=parseInt(Math.random()*s),e=i[--s],i[s]=i[t],i[t]=e);return i};return i.slideshow.animations});
@@ -0,0 +1,562 @@
1
+ /*! UIkit 2.24.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-slideshow", ["uikit"], function() {
12
+ return component || addon(UIkit);
13
+ });
14
+ }
15
+
16
+ })(function(UI) {
17
+
18
+ "use strict";
19
+
20
+ var Animations, playerId = 0;
21
+
22
+ UI.component('slideshow', {
23
+
24
+ defaults: {
25
+ animation : "fade",
26
+ duration : 500,
27
+ height : "auto",
28
+ start : 0,
29
+ autoplay : false,
30
+ autoplayInterval : 7000,
31
+ videoautoplay : true,
32
+ videomute : true,
33
+ slices : 15,
34
+ pauseOnHover : true,
35
+ kenburns : false,
36
+ kenburnsanimations : [
37
+ 'uk-animation-middle-left',
38
+ 'uk-animation-top-right',
39
+ 'uk-animation-bottom-left',
40
+ 'uk-animation-top-center',
41
+ '', // middle-center
42
+ 'uk-animation-bottom-right'
43
+ ]
44
+ },
45
+
46
+ current : false,
47
+ interval : null,
48
+ hovering : false,
49
+
50
+ boot: function() {
51
+
52
+ // init code
53
+ UI.ready(function(context) {
54
+
55
+ UI.$('[data-uk-slideshow]', context).each(function() {
56
+
57
+ var slideshow = UI.$(this);
58
+
59
+ if (!slideshow.data("slideshow")) {
60
+ UI.slideshow(slideshow, UI.Utils.options(slideshow.attr("data-uk-slideshow")));
61
+ }
62
+ });
63
+ });
64
+ },
65
+
66
+ init: function() {
67
+
68
+ var $this = this, canvas, kbanimduration;
69
+
70
+ this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow'));
71
+ this.slides = this.container.children();
72
+ this.slidesCount = this.slides.length;
73
+ this.current = this.options.start;
74
+ this.animating = false;
75
+ this.triggers = this.find('[data-uk-slideshow-item]');
76
+ this.fixFullscreen = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && this.container.hasClass('uk-slideshow-fullscreen'); // viewport unit fix for height:100vh - should be fixed in iOS 8
77
+
78
+ if (this.options.kenburns) {
79
+
80
+ kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
81
+
82
+ if (!String(kbanimduration).match(/(ms|s)$/)) {
83
+ kbanimduration += 'ms';
84
+ }
85
+
86
+ if (typeof(this.options.kenburnsanimations) == 'string') {
87
+ this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
88
+ }
89
+ }
90
+
91
+ this.slides.each(function(index) {
92
+
93
+ var slide = UI.$(this),
94
+ media = slide.children('img,video,iframe').eq(0);
95
+
96
+ slide.data('media', media);
97
+ slide.data('sizer', media);
98
+
99
+ if (media.length) {
100
+
101
+ var placeholder;
102
+
103
+ switch(media[0].nodeName) {
104
+ case 'IMG':
105
+
106
+ var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
107
+
108
+ if (media.attr('width') && media.attr('height')) {
109
+ placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')});
110
+ media.replaceWith(placeholder);
111
+ media = placeholder;
112
+ placeholder = undefined;
113
+ }
114
+
115
+ media.css({width: '100%',height: 'auto', opacity:0});
116
+ slide.prepend(cover).data('cover', cover);
117
+ break;
118
+
119
+ case 'IFRAME':
120
+
121
+ var src = media[0].src, iframeId = 'sw-'+(++playerId);
122
+
123
+ media
124
+ .attr('src', '').on('load', function(){
125
+
126
+ if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
127
+ $this.pausemedia(media);
128
+ }
129
+
130
+ if ($this.options.videomute) {
131
+
132
+ $this.mutemedia(media);
133
+
134
+ var inv = setInterval((function(ic) {
135
+ return function() {
136
+ $this.mutemedia(media);
137
+ if (++ic >= 4) clearInterval(inv);
138
+ }
139
+ })(0), 250);
140
+ }
141
+
142
+ })
143
+ .data('slideshow', $this) // add self-reference for the vimeo-ready listener
144
+ .attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
145
+ .attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
146
+ .addClass('uk-position-absolute');
147
+
148
+ // disable pointer events
149
+ if(!UI.support.touch) media.css('pointer-events', 'none');
150
+
151
+ placeholder = true;
152
+
153
+ if (UI.cover) {
154
+ UI.cover(media);
155
+ media.attr('data-uk-cover', '{}');
156
+ }
157
+
158
+ break;
159
+
160
+ case 'VIDEO':
161
+ media.addClass('uk-cover-object uk-position-absolute');
162
+ placeholder = true;
163
+
164
+ if ($this.options.videomute) $this.mutemedia(media);
165
+ }
166
+
167
+ if (placeholder) {
168
+
169
+ canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
170
+ var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
171
+
172
+ slide.prepend(img);
173
+ slide.data('sizer', img);
174
+ }
175
+
176
+ } else {
177
+ slide.data('sizer', slide);
178
+ }
179
+
180
+ if ($this.hasKenBurns(slide)) {
181
+
182
+ slide.data('cover').css({
183
+ '-webkit-animation-duration': kbanimduration,
184
+ 'animation-duration': kbanimduration
185
+ });
186
+ }
187
+ });
188
+
189
+ this.on("click.uikit.slideshow", '[data-uk-slideshow-item]', function(e) {
190
+
191
+ e.preventDefault();
192
+
193
+ var slide = UI.$(this).attr('data-uk-slideshow-item');
194
+
195
+ if ($this.current == slide) return;
196
+
197
+ switch(slide) {
198
+ case 'next':
199
+ case 'previous':
200
+ $this[slide=='next' ? 'next':'previous']();
201
+ break;
202
+ default:
203
+ $this.show(parseInt(slide, 10));
204
+ }
205
+
206
+ $this.stop();
207
+ });
208
+
209
+ // Set start slide
210
+ this.slides.attr('aria-hidden', 'true').eq(this.current).addClass('uk-active').attr('aria-hidden', 'false');
211
+ this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass('uk-active');
212
+
213
+ UI.$win.on("resize load", UI.Utils.debounce(function() {
214
+ $this.resize();
215
+
216
+ if ($this.fixFullscreen) {
217
+ $this.container.css('height', window.innerHeight);
218
+ $this.slides.css('height', window.innerHeight);
219
+ }
220
+ }, 100));
221
+
222
+ // chrome image load fix
223
+ setTimeout(function(){
224
+ $this.resize();
225
+ }, 80);
226
+
227
+ // Set autoplay
228
+ if (this.options.autoplay) {
229
+ this.start();
230
+ }
231
+
232
+ if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
233
+ this.playmedia(this.slides.eq(this.current).data('media'));
234
+ }
235
+
236
+ if (this.options.kenburns) {
237
+ this.applyKenBurns(this.slides.eq(this.current));
238
+ }
239
+
240
+ this.container.on({
241
+ mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
242
+ mouseleave: function() { $this.hovering = false; }
243
+ });
244
+
245
+ this.on('swipeRight swipeLeft', function(e) {
246
+ $this[e.type=='swipeLeft' ? 'next' : 'previous']();
247
+ });
248
+
249
+ this.on('display.uk.check', function(){
250
+ if ($this.element.is(":visible")) {
251
+
252
+ $this.resize();
253
+
254
+ if ($this.fixFullscreen) {
255
+ $this.container.css('height', window.innerHeight);
256
+ $this.slides.css('height', window.innerHeight);
257
+ }
258
+ }
259
+ });
260
+ },
261
+
262
+
263
+ resize: function() {
264
+
265
+ if (this.container.hasClass('uk-slideshow-fullscreen')) return;
266
+
267
+ var height = this.options.height;
268
+
269
+ if (this.options.height === 'auto') {
270
+
271
+ height = 0;
272
+
273
+ this.slides.css('height', '').each(function() {
274
+ height = Math.max(height, UI.$(this).height());
275
+ });
276
+ }
277
+
278
+ this.container.css('height', height);
279
+ this.slides.css('height', height);
280
+ },
281
+
282
+ show: function(index, direction) {
283
+
284
+ if (this.animating || this.current == index) return;
285
+
286
+ this.animating = true;
287
+
288
+ var $this = this,
289
+ current = this.slides.eq(this.current),
290
+ next = this.slides.eq(index),
291
+ dir = direction ? direction : this.current < index ? -1 : 1,
292
+ currentmedia = current.data('media'),
293
+ animation = Animations[this.options.animation] ? this.options.animation : 'fade',
294
+ nextmedia = next.data('media'),
295
+ finalize = function() {
296
+
297
+ if (!$this.animating) return;
298
+
299
+ if (currentmedia && currentmedia.is('video,iframe')) {
300
+ $this.pausemedia(currentmedia);
301
+ }
302
+
303
+ if (nextmedia && nextmedia.is('video,iframe')) {
304
+ $this.playmedia(nextmedia);
305
+ }
306
+
307
+ next.addClass("uk-active").attr('aria-hidden', 'false');
308
+ current.removeClass("uk-active").attr('aria-hidden', 'true');
309
+
310
+ $this.animating = false;
311
+ $this.current = index;
312
+
313
+ UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
314
+
315
+ $this.trigger('show.uk.slideshow', [next, current, $this]);
316
+ };
317
+
318
+ $this.applyKenBurns(next);
319
+
320
+ // animation fallback
321
+ if (!UI.support.animation) {
322
+ animation = 'none';
323
+ }
324
+
325
+ current = UI.$(current);
326
+ next = UI.$(next);
327
+
328
+ $this.trigger('beforeshow.uk.slideshow', [next, current, $this]);
329
+
330
+ Animations[animation].apply(this, [current, next, dir]).then(finalize);
331
+
332
+ $this.triggers.removeClass('uk-active');
333
+ $this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
334
+ },
335
+
336
+ applyKenBurns: function(slide) {
337
+
338
+ if (!this.hasKenBurns(slide)) {
339
+ return;
340
+ }
341
+
342
+ var animations = this.options.kenburnsanimations,
343
+ index = this.kbindex || 0;
344
+
345
+
346
+ slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
347
+ slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
348
+
349
+ this.kbindex = animations[index + 1] ? (index+1):0;
350
+ },
351
+
352
+ hasKenBurns: function(slide) {
353
+ return (this.options.kenburns && slide.data('cover'));
354
+ },
355
+
356
+ next: function() {
357
+ this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1);
358
+ },
359
+
360
+ previous: function() {
361
+ this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1);
362
+ },
363
+
364
+ start: function() {
365
+
366
+ this.stop();
367
+
368
+ var $this = this;
369
+
370
+ this.interval = setInterval(function() {
371
+ if (!$this.hovering) $this.next();
372
+ }, this.options.autoplayInterval);
373
+
374
+ },
375
+
376
+ stop: function() {
377
+ if (this.interval) clearInterval(this.interval);
378
+ },
379
+
380
+ playmedia: function(media) {
381
+
382
+ if (!(media && media[0])) return;
383
+
384
+ switch(media[0].nodeName) {
385
+ case 'VIDEO':
386
+
387
+ if (!this.options.videomute) {
388
+ media[0].muted = false;
389
+ }
390
+
391
+ media[0].play();
392
+ break;
393
+ case 'IFRAME':
394
+
395
+ if (!this.options.videomute) {
396
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
397
+ }
398
+
399
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
400
+ break;
401
+ }
402
+ },
403
+
404
+ pausemedia: function(media) {
405
+
406
+ switch(media[0].nodeName) {
407
+ case 'VIDEO':
408
+ media[0].pause();
409
+ break;
410
+ case 'IFRAME':
411
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
412
+ break;
413
+ }
414
+ },
415
+
416
+ mutemedia: function(media) {
417
+
418
+ switch(media[0].nodeName) {
419
+ case 'VIDEO':
420
+ media[0].muted = true;
421
+ break;
422
+ case 'IFRAME':
423
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
424
+ break;
425
+ }
426
+ }
427
+ });
428
+
429
+ Animations = {
430
+
431
+ 'none': function() {
432
+
433
+ var d = UI.$.Deferred();
434
+ d.resolve();
435
+ return d.promise();
436
+ },
437
+
438
+ 'scroll': function(current, next, dir) {
439
+
440
+ var d = UI.$.Deferred();
441
+
442
+ current.css('animation-duration', this.options.duration+'ms');
443
+ next.css('animation-duration', this.options.duration+'ms');
444
+
445
+ next.css('opacity', 1).one(UI.support.animation.end, function() {
446
+
447
+ current.removeClass(dir === 1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
448
+ next.css('opacity', '').removeClass(dir === 1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
449
+ d.resolve();
450
+
451
+ }.bind(this));
452
+
453
+ current.addClass(dir == 1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
454
+ next.addClass(dir == 1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
455
+ next.width(); // force redraw
456
+
457
+ return d.promise();
458
+ },
459
+
460
+ 'swipe': function(current, next, dir) {
461
+
462
+ var d = UI.$.Deferred();
463
+
464
+ current.css('animation-duration', this.options.duration+'ms');
465
+ next.css('animation-duration', this.options.duration+'ms');
466
+
467
+ next.css('opacity', 1).one(UI.support.animation.end, function() {
468
+
469
+ current.removeClass(dir === 1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
470
+ next.css('opacity', '').removeClass(dir === 1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
471
+ d.resolve();
472
+
473
+ }.bind(this));
474
+
475
+ current.addClass(dir == 1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
476
+ next.addClass(dir == 1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
477
+ next.width(); // force redraw
478
+
479
+ return d.promise();
480
+ },
481
+
482
+ 'scale': function(current, next, dir) {
483
+
484
+ var d = UI.$.Deferred();
485
+
486
+ current.css('animation-duration', this.options.duration+'ms');
487
+ next.css('animation-duration', this.options.duration+'ms');
488
+
489
+ next.css('opacity', 1);
490
+
491
+ current.one(UI.support.animation.end, function() {
492
+
493
+ current.removeClass('uk-slideshow-scale-out');
494
+ next.css('opacity', '');
495
+ d.resolve();
496
+
497
+ }.bind(this));
498
+
499
+ current.addClass('uk-slideshow-scale-out');
500
+ current.width(); // force redraw
501
+
502
+ return d.promise();
503
+ },
504
+
505
+ 'fade': function(current, next, dir) {
506
+
507
+ var d = UI.$.Deferred();
508
+
509
+ current.css('animation-duration', this.options.duration+'ms');
510
+ next.css('animation-duration', this.options.duration+'ms');
511
+
512
+ next.css('opacity', 1);
513
+
514
+ // for plain text content slides - looks smoother
515
+ if (!(next.data('cover') || next.data('placeholder'))) {
516
+
517
+ next.css('opacity', 1).one(UI.support.animation.end, function() {
518
+ next.removeClass('uk-slideshow-fade-in');
519
+ }).addClass('uk-slideshow-fade-in');
520
+ }
521
+
522
+ current.one(UI.support.animation.end, function() {
523
+
524
+ current.removeClass('uk-slideshow-fade-out');
525
+ next.css('opacity', '');
526
+ d.resolve();
527
+
528
+ }.bind(this));
529
+
530
+ current.addClass('uk-slideshow-fade-out');
531
+ current.width(); // force redraw
532
+
533
+ return d.promise();
534
+ }
535
+ };
536
+
537
+ UI.slideshow.animations = Animations;
538
+
539
+ // Listen for messages from the vimeo player
540
+ window.addEventListener('message', function onMessageReceived(e) {
541
+
542
+ var data = e.data, iframe;
543
+
544
+ if (typeof(data) == 'string') {
545
+
546
+ try {
547
+ data = JSON.parse(data);
548
+ } catch(err) {
549
+ data = {};
550
+ }
551
+ }
552
+
553
+ if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
554
+ iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
555
+
556
+ if (iframe.length) {
557
+ iframe.data('slideshow').mutemedia(iframe);
558
+ }
559
+ }
560
+ }, false);
561
+
562
+ });