uikit2-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/README.md +66 -0
  6. data/Rakefile +1 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +7 -0
  9. data/lib/uikit2/rails.rb +8 -0
  10. data/lib/uikit2/rails/version.rb +5 -0
  11. data/uikit2-rails.gemspec +25 -0
  12. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  13. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  14. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  15. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  16. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  17. data/vendor/assets/javascripts/uikit.js +3537 -0
  18. data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
  19. data/vendor/assets/javascripts/uikit/components/accordion.min.js +2 -0
  20. data/vendor/assets/javascripts/uikit/components/autocomplete.js +334 -0
  21. data/vendor/assets/javascripts/uikit/components/autocomplete.min.js +2 -0
  22. data/vendor/assets/javascripts/uikit/components/datepicker.js +3166 -0
  23. data/vendor/assets/javascripts/uikit/components/datepicker.min.js +3 -0
  24. data/vendor/assets/javascripts/uikit/components/form-password.js +67 -0
  25. data/vendor/assets/javascripts/uikit/components/form-password.min.js +2 -0
  26. data/vendor/assets/javascripts/uikit/components/form-select.js +70 -0
  27. data/vendor/assets/javascripts/uikit/components/form-select.min.js +2 -0
  28. data/vendor/assets/javascripts/uikit/components/grid.js +523 -0
  29. data/vendor/assets/javascripts/uikit/components/grid.min.js +2 -0
  30. data/vendor/assets/javascripts/uikit/components/htmleditor.js +623 -0
  31. data/vendor/assets/javascripts/uikit/components/htmleditor.min.js +2 -0
  32. data/vendor/assets/javascripts/uikit/components/lightbox.js +555 -0
  33. data/vendor/assets/javascripts/uikit/components/lightbox.min.js +2 -0
  34. data/vendor/assets/javascripts/uikit/components/nestable.js +638 -0
  35. data/vendor/assets/javascripts/uikit/components/nestable.min.js +2 -0
  36. data/vendor/assets/javascripts/uikit/components/notify.js +189 -0
  37. data/vendor/assets/javascripts/uikit/components/notify.min.js +2 -0
  38. data/vendor/assets/javascripts/uikit/components/pagination.js +147 -0
  39. data/vendor/assets/javascripts/uikit/components/pagination.min.js +2 -0
  40. data/vendor/assets/javascripts/uikit/components/parallax.js +417 -0
  41. data/vendor/assets/javascripts/uikit/components/parallax.min.js +2 -0
  42. data/vendor/assets/javascripts/uikit/components/search.js +92 -0
  43. data/vendor/assets/javascripts/uikit/components/search.min.js +2 -0
  44. data/vendor/assets/javascripts/uikit/components/slider.js +520 -0
  45. data/vendor/assets/javascripts/uikit/components/slider.min.js +2 -0
  46. data/vendor/assets/javascripts/uikit/components/slideset.js +502 -0
  47. data/vendor/assets/javascripts/uikit/components/slideset.min.js +2 -0
  48. data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +375 -0
  49. data/vendor/assets/javascripts/uikit/components/slideshow-fx.min.js +2 -0
  50. data/vendor/assets/javascripts/uikit/components/slideshow.js +545 -0
  51. data/vendor/assets/javascripts/uikit/components/slideshow.min.js +2 -0
  52. data/vendor/assets/javascripts/uikit/components/sortable.js +664 -0
  53. data/vendor/assets/javascripts/uikit/components/sortable.min.js +2 -0
  54. data/vendor/assets/javascripts/uikit/components/sticky.js +349 -0
  55. data/vendor/assets/javascripts/uikit/components/sticky.min.js +2 -0
  56. data/vendor/assets/javascripts/uikit/components/timepicker.js +192 -0
  57. data/vendor/assets/javascripts/uikit/components/timepicker.min.js +2 -0
  58. data/vendor/assets/javascripts/uikit/components/tooltip.js +234 -0
  59. data/vendor/assets/javascripts/uikit/components/tooltip.min.js +2 -0
  60. data/vendor/assets/javascripts/uikit/components/upload.js +260 -0
  61. data/vendor/assets/javascripts/uikit/components/upload.min.js +2 -0
  62. data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
  63. data/vendor/assets/javascripts/uikit/core/alert.min.js +2 -0
  64. data/vendor/assets/javascripts/uikit/core/button.js +157 -0
  65. data/vendor/assets/javascripts/uikit/core/button.min.js +2 -0
  66. data/vendor/assets/javascripts/uikit/core/core.js +725 -0
  67. data/vendor/assets/javascripts/uikit/core/core.min.js +2 -0
  68. data/vendor/assets/javascripts/uikit/core/cover.js +95 -0
  69. data/vendor/assets/javascripts/uikit/core/cover.min.js +2 -0
  70. data/vendor/assets/javascripts/uikit/core/dropdown.js +421 -0
  71. data/vendor/assets/javascripts/uikit/core/dropdown.min.js +2 -0
  72. data/vendor/assets/javascripts/uikit/core/grid.js +114 -0
  73. data/vendor/assets/javascripts/uikit/core/grid.min.js +2 -0
  74. data/vendor/assets/javascripts/uikit/core/modal.js +372 -0
  75. data/vendor/assets/javascripts/uikit/core/modal.min.js +2 -0
  76. data/vendor/assets/javascripts/uikit/core/nav.js +136 -0
  77. data/vendor/assets/javascripts/uikit/core/nav.min.js +2 -0
  78. data/vendor/assets/javascripts/uikit/core/offcanvas.js +180 -0
  79. data/vendor/assets/javascripts/uikit/core/offcanvas.min.js +2 -0
  80. data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
  81. data/vendor/assets/javascripts/uikit/core/scrollspy.min.js +2 -0
  82. data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
  83. data/vendor/assets/javascripts/uikit/core/smooth-scroll.min.js +2 -0
  84. data/vendor/assets/javascripts/uikit/core/switcher.js +304 -0
  85. data/vendor/assets/javascripts/uikit/core/switcher.min.js +2 -0
  86. data/vendor/assets/javascripts/uikit/core/tab.js +165 -0
  87. data/vendor/assets/javascripts/uikit/core/tab.min.js +2 -0
  88. data/vendor/assets/javascripts/uikit/core/toggle.js +120 -0
  89. data/vendor/assets/javascripts/uikit/core/toggle.min.js +2 -0
  90. data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
  91. data/vendor/assets/javascripts/uikit/core/touch.min.js +2 -0
  92. data/vendor/assets/javascripts/uikit/core/utility.js +239 -0
  93. data/vendor/assets/javascripts/uikit/core/utility.min.js +2 -0
  94. data/vendor/assets/stylesheets/uikit.almost-flat.css +8551 -0
  95. data/vendor/assets/stylesheets/uikit.css +8252 -0
  96. data/vendor/assets/stylesheets/uikit.gradient.css +8614 -0
  97. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +39 -0
  98. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.min.css +2 -0
  99. data/vendor/assets/stylesheets/uikit/components/accordion.css +37 -0
  100. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +39 -0
  101. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.min.css +2 -0
  102. data/vendor/assets/stylesheets/uikit/components/accordion.min.css +2 -0
  103. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +52 -0
  104. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.min.css +2 -0
  105. data/vendor/assets/stylesheets/uikit/components/autocomplete.css +50 -0
  106. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +52 -0
  107. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.min.css +2 -0
  108. data/vendor/assets/stylesheets/uikit/components/autocomplete.min.css +2 -0
  109. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +129 -0
  110. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.min.css +2 -0
  111. data/vendor/assets/stylesheets/uikit/components/datepicker.css +123 -0
  112. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +139 -0
  113. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.min.css +2 -0
  114. data/vendor/assets/stylesheets/uikit/components/datepicker.min.css +2 -0
  115. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +128 -0
  116. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.min.css +2 -0
  117. data/vendor/assets/stylesheets/uikit/components/dotnav.css +124 -0
  118. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +128 -0
  119. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.min.css +2 -0
  120. data/vendor/assets/stylesheets/uikit/components/dotnav.min.css +2 -0
  121. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +78 -0
  122. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.min.css +2 -0
  123. data/vendor/assets/stylesheets/uikit/components/form-advanced.css +78 -0
  124. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +78 -0
  125. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.min.css +2 -0
  126. data/vendor/assets/stylesheets/uikit/components/form-advanced.min.css +2 -0
  127. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +34 -0
  128. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.min.css +2 -0
  129. data/vendor/assets/stylesheets/uikit/components/form-file.css +34 -0
  130. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +34 -0
  131. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.min.css +2 -0
  132. data/vendor/assets/stylesheets/uikit/components/form-file.min.css +2 -0
  133. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +34 -0
  134. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.min.css +2 -0
  135. data/vendor/assets/stylesheets/uikit/components/form-password.css +34 -0
  136. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +34 -0
  137. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.min.css +2 -0
  138. data/vendor/assets/stylesheets/uikit/components/form-password.min.css +2 -0
  139. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +35 -0
  140. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.min.css +2 -0
  141. data/vendor/assets/stylesheets/uikit/components/form-select.css +35 -0
  142. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +35 -0
  143. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.min.css +2 -0
  144. data/vendor/assets/stylesheets/uikit/components/form-select.min.css +2 -0
  145. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +222 -0
  146. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.min.css +2 -0
  147. data/vendor/assets/stylesheets/uikit/components/htmleditor.css +164 -0
  148. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +229 -0
  149. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.min.css +2 -0
  150. data/vendor/assets/stylesheets/uikit/components/htmleditor.min.css +2 -0
  151. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +135 -0
  152. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.min.css +2 -0
  153. data/vendor/assets/stylesheets/uikit/components/nestable.css +132 -0
  154. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +139 -0
  155. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.min.css +2 -0
  156. data/vendor/assets/stylesheets/uikit/components/nestable.min.css +2 -0
  157. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +98 -0
  158. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.min.css +2 -0
  159. data/vendor/assets/stylesheets/uikit/components/notify.css +92 -0
  160. data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +98 -0
  161. data/vendor/assets/stylesheets/uikit/components/notify.gradient.min.css +2 -0
  162. data/vendor/assets/stylesheets/uikit/components/notify.min.css +2 -0
  163. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +29 -0
  164. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.min.css +2 -0
  165. data/vendor/assets/stylesheets/uikit/components/placeholder.css +29 -0
  166. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +29 -0
  167. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.min.css +2 -0
  168. data/vendor/assets/stylesheets/uikit/components/placeholder.min.css +2 -0
  169. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +104 -0
  170. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.min.css +2 -0
  171. data/vendor/assets/stylesheets/uikit/components/progress.css +94 -0
  172. data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +112 -0
  173. data/vendor/assets/stylesheets/uikit/components/progress.gradient.min.css +2 -0
  174. data/vendor/assets/stylesheets/uikit/components/progress.min.css +2 -0
  175. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +191 -0
  176. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.min.css +2 -0
  177. data/vendor/assets/stylesheets/uikit/components/search.css +189 -0
  178. data/vendor/assets/stylesheets/uikit/components/search.gradient.css +191 -0
  179. data/vendor/assets/stylesheets/uikit/components/search.gradient.min.css +2 -0
  180. data/vendor/assets/stylesheets/uikit/components/search.min.css +2 -0
  181. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +98 -0
  182. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.min.css +2 -0
  183. data/vendor/assets/stylesheets/uikit/components/slidenav.css +98 -0
  184. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +98 -0
  185. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.min.css +2 -0
  186. data/vendor/assets/stylesheets/uikit/components/slidenav.min.css +2 -0
  187. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +85 -0
  188. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.min.css +2 -0
  189. data/vendor/assets/stylesheets/uikit/components/slider.css +85 -0
  190. data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +85 -0
  191. data/vendor/assets/stylesheets/uikit/components/slider.gradient.min.css +2 -0
  192. data/vendor/assets/stylesheets/uikit/components/slider.min.css +2 -0
  193. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +140 -0
  194. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.min.css +2 -0
  195. data/vendor/assets/stylesheets/uikit/components/slideshow.css +140 -0
  196. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +140 -0
  197. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.min.css +2 -0
  198. data/vendor/assets/stylesheets/uikit/components/slideshow.min.css +2 -0
  199. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +62 -0
  200. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.min.css +2 -0
  201. data/vendor/assets/stylesheets/uikit/components/sortable.css +62 -0
  202. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +62 -0
  203. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.min.css +2 -0
  204. data/vendor/assets/stylesheets/uikit/components/sortable.min.css +2 -0
  205. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +31 -0
  206. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.min.css +2 -0
  207. data/vendor/assets/stylesheets/uikit/components/sticky.css +31 -0
  208. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +31 -0
  209. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.min.css +2 -0
  210. data/vendor/assets/stylesheets/uikit/components/sticky.min.css +2 -0
  211. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +118 -0
  212. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.min.css +2 -0
  213. data/vendor/assets/stylesheets/uikit/components/tooltip.css +116 -0
  214. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +118 -0
  215. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.min.css +2 -0
  216. data/vendor/assets/stylesheets/uikit/components/tooltip.min.css +2 -0
  217. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +10 -0
  218. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.min.css +2 -0
  219. data/vendor/assets/stylesheets/uikit/components/upload.css +10 -0
  220. data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +10 -0
  221. data/vendor/assets/stylesheets/uikit/components/upload.gradient.min.css +2 -0
  222. data/vendor/assets/stylesheets/uikit/components/upload.min.css +2 -0
  223. metadata +295 -0
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.22.0 | 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-htmleditor",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e=[];return t.component("htmleditor",{defaults:{iframe:!1,mode:"split",markdown:!1,autocomplete:!0,height:500,maxsplitsize:1e3,codemirror:{mode:"htmlmixed",lineWrapping:!0,dragDrop:!1,autoCloseTags:!0,matchTags:!0,autoCloseBrackets:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!1,tabSize:4,hintOptions:{completionSingle:!1}},toolbar:["bold","italic","strike","link","image","blockquote","listUl","listOl"],lblPreview:"Preview",lblCodeview:"HTML",lblMarkedview:"Markdown"},boot:function(){t.ready(function(e){t.$("textarea[data-uk-htmleditor]",e).each(function(){var e=t.$(this);e.data("htmleditor")||t.htmleditor(e,t.Utils.options(e.attr("data-uk-htmleditor")))})})},init:function(){var i=this,o=t.components.htmleditor.template;this.CodeMirror=this.options.CodeMirror||CodeMirror,this.buttons={},o=o.replace(/\{:lblPreview}/g,this.options.lblPreview),o=o.replace(/\{:lblCodeview}/g,this.options.lblCodeview),this.htmleditor=t.$(o),this.content=this.htmleditor.find(".uk-htmleditor-content"),this.toolbar=this.htmleditor.find(".uk-htmleditor-toolbar"),this.preview=this.htmleditor.find(".uk-htmleditor-preview").children().eq(0),this.code=this.htmleditor.find(".uk-htmleditor-code"),this.element.before(this.htmleditor).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),this.editor.htmleditor=this,this.editor.on("change",t.Utils.debounce(function(){i.render()},150)),this.editor.on("change",function(){i.editor.save(),i.element.trigger("input")}),this.code.find(".CodeMirror").css("height",this.options.height),this.options.iframe?(this.iframe=t.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>'),this.preview.append(this.iframe),this.iframe[0].contentWindow.document.open(),this.iframe[0].contentWindow.document.close(),this.preview.container=t.$(this.iframe[0].contentWindow.document).find("body"),"string"==typeof this.options.iframe&&this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">')):this.preview.container=this.preview,t.$win.on("resize load",t.Utils.debounce(function(){i.fit()},200));var r=this.iframe?this.preview.container:i.preview.parent(),n=this.code.find(".CodeMirror-sizer"),l=this.code.find(".CodeMirror-scroll").on("scroll",t.Utils.debounce(function(){if("tab"!=i.htmleditor.attr("data-mode")){var t=n.height()-l.height(),e=r[0].scrollHeight-(i.iframe?i.iframe.height():r.height()),o=e/t,s=l.scrollTop()*o;r.scrollTop(s)}},10));this.htmleditor.on("click",".uk-htmleditor-button-code, .uk-htmleditor-button-preview",function(e){e.preventDefault(),"tab"==i.htmleditor.attr("data-mode")&&(i.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),i.activetab=t.$(this).hasClass("uk-htmleditor-button-code")?"code":"preview",i.htmleditor.attr("data-active-tab",i.activetab),i.editor.refresh())}),this.htmleditor.on("click","a[data-htmleditor-button]",function(){i.code.is(":visible")&&i.trigger("action."+t.$(this).data("htmleditor-button"),[i.editor])}),this.preview.parent().css("height",this.code.height()),this.options.autocomplete&&this.CodeMirror.showHint&&this.CodeMirror.hint&&this.CodeMirror.hint.html&&this.editor.on("inputRead",t.Utils.debounce(function(){var t=i.editor.getDoc(),e=t.getCursor(),o=i.CodeMirror.innerMode(i.editor.getMode(),i.editor.getTokenAt(e).state).mode.name;if("xml"==o){var r=i.editor.getCursor(),n=i.editor.getTokenAt(r);("<"==n.string.charAt(0)||"attribute"==n.type)&&i.CodeMirror.showHint(i.editor,i.CodeMirror.hint.html,{completeSingle:!1})}},100)),this.debouncedRedraw=t.Utils.debounce(function(){i.redraw()},5),this.on("init.uk.component",function(){i.debouncedRedraw()}),this.element.attr("data-uk-check-display",1).on("display.uk.check",function(){this.htmleditor.is(":visible")&&this.fit()}.bind(this)),e.push(this)},addButton:function(t,e){this.buttons[t]=e},addButtons:function(e){t.$.extend(this.buttons,e)},replaceInPreview:function(t,e){function i(t){var e=o.getValue().substring(0,t).split("\n");return{line:e.length-1,ch:e[e.length-1].length}}var o=this.editor,r=[],n=o.getValue(),l=-1,s=0;return this.currentvalue=this.currentvalue.replace(t,function(){l=n.indexOf(arguments[0],++l);var t={matches:arguments,from:i(l),to:i(l+arguments[0].length),replace:function(e){o.replaceRange(e,t.from,t.to)},inRange:function(e){return e.line===t.from.line&&e.line===t.to.line?e.ch>=t.from.ch&&e.ch<t.to.ch:e.line===t.from.line&&e.ch>=t.from.ch||e.line>t.from.line&&e.line<t.to.line||e.line===t.to.line&&e.ch<t.to.ch}},a=e(t,s);return a?(s++,r.push(t),a):arguments[0]}),r},_buildtoolbar:function(){if(this.options.toolbar&&this.options.toolbar.length){var t=this,e=[];this.toolbar.empty(),this.options.toolbar.forEach(function(i){if(t.buttons[i]){var o=t.buttons[i].title?t.buttons[i].title:i;e.push('<li><a data-htmleditor-button="'+i+'" title="'+o+'" data-uk-tooltip>'+t.buttons[i].label+"</a></li>")}}),this.toolbar.html(e.join("\n"))}},fit:function(){var t=this.options.mode;"split"==t&&this.htmleditor.width()<this.options.maxsplitsize&&(t="tab"),"tab"==t&&(this.activetab||(this.activetab="code",this.htmleditor.attr("data-active-tab",this.activetab)),this.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter("code"==this.activetab?".uk-htmleditor-button-code":".uk-htmleditor-button-preview").addClass("uk-active")),this.editor.refresh(),this.preview.parent().css("height",this.code.height()),this.htmleditor.attr("data-mode",t)},redraw:function(){this._buildtoolbar(),this.render(),this.fit()},getMode:function(){return this.editor.getOption("mode")},getCursorMode:function(){var t={mode:"html"};return this.trigger("cursorMode",[t]),t.mode},render:function(){return this.currentvalue=this.editor.getValue(),this.currentvalue?(this.trigger("render",[this]),this.trigger("renderLate",[this]),this.preview.container.html(this.currentvalue),void 0):(this.element.val(""),this.preview.container.html(""),void 0)},addShortcut:function(e,i){var o={};return t.$.isArray(e)||(e=[e]),e.forEach(function(t){o[t]=i}),this.editor.addKeyMap(o),o},addShortcutAction:function(t,e){var i=this;this.addShortcut(e,function(){i.element.trigger("action."+t,[i.editor])})},replaceSelection:function(t){var e=this.editor.getSelection();if(!e.length){for(var i=this.editor.getCursor(),o=this.editor.getLine(i.line),r=i.ch,n=r;n<o.length&&/[\w$]+/.test(o.charAt(n));)++n;for(;r&&/[\w$]+/.test(o.charAt(r-1));)--r;var l=r!=n&&o.slice(r,n);l&&(this.editor.setSelection({line:i.line,ch:r},{line:i.line,ch:n}),e=l)}var s=t.replace("$1",e);this.editor.replaceSelection(s,"end"),this.editor.focus()},replaceLine:function(t){var e=this.editor.getDoc().getCursor(),i=this.editor.getLine(e.line),o=t.replace("$1",i);this.editor.replaceRange(o,{line:e.line,ch:0},{line:e.line,ch:i.length}),this.editor.setCursor({line:e.line,ch:o.length}),this.editor.focus()},save:function(){this.editor.save()}}),t.components.htmleditor.template=['<div class="uk-htmleditor uk-clearfix" data-mode="split">','<div class="uk-htmleditor-navbar">','<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>','<div class="uk-htmleditor-navbar-flip">','<ul class="uk-htmleditor-navbar-nav">','<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>','<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>','<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',"</ul>","</div>","</div>",'<div class="uk-htmleditor-content">','<div class="uk-htmleditor-code"></div>','<div class="uk-htmleditor-preview"><div></div></div>',"</div>","</div>"].join(""),t.plugin("htmleditor","base",{init:function(e){function i(t,i,o){e.on("action."+t,function(){"html"==e.getCursorMode()&&e["replaceLine"==o?"replaceLine":"replaceSelection"](i)})}e.addButtons({fullscreen:{title:"Fullscreen",label:'<i class="uk-icon-expand"></i>'},bold:{title:"Bold",label:'<i class="uk-icon-bold"></i>'},italic:{title:"Italic",label:'<i class="uk-icon-italic"></i>'},strike:{title:"Strikethrough",label:'<i class="uk-icon-strikethrough"></i>'},blockquote:{title:"Blockquote",label:'<i class="uk-icon-quote-right"></i>'},link:{title:"Link",label:'<i class="uk-icon-link"></i>'},image:{title:"Image",label:'<i class="uk-icon-picture-o"></i>'},listUl:{title:"Unordered List",label:'<i class="uk-icon-list-ul"></i>'},listOl:{title:"Ordered List",label:'<i class="uk-icon-list-ol"></i>'}}),i("bold","<strong>$1</strong>"),i("italic","<em>$1</em>"),i("strike","<del>$1</del>"),i("blockquote","<blockquote><p>$1</p></blockquote>","replaceLine"),i("link",'<a href="http://">$1</a>'),i("image",'<img src="http://" alt="$1">');var o=function(){if("html"==e.getCursorMode()){for(var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),r=i.line;r<o.line+1;r++)t.replaceRange("<li>"+t.getLine(r)+"</li>",{line:r,ch:0},{line:r,ch:t.getLine(r).length});t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}};e.on("action.listUl",function(){o()}),e.on("action.listOl",function(){o()}),e.htmleditor.on("click",'a[data-htmleditor-button="fullscreen"]',function(){e.htmleditor.toggleClass("uk-htmleditor-fullscreen");var i=e.editor.getWrapperElement();if(e.htmleditor.hasClass("uk-htmleditor-fullscreen"))e.editor.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:i.style.width,height:i.style.height},i.style.width="",i.style.height=e.content.height()+"px",document.documentElement.style.overflow="hidden";else{document.documentElement.style.overflow="";var o=e.editor.state.fullScreenRestore;i.style.width=o.width,i.style.height=o.height,window.scrollTo(o.scrollLeft,o.scrollTop)}setTimeout(function(){e.fit(),t.$win.trigger("resize")},50)}),e.addShortcut(["Ctrl-S","Cmd-S"],function(){e.element.trigger("htmleditor-save",[e])}),e.addShortcutAction("bold",["Ctrl-B","Cmd-B"])}}),t.plugin("htmleditor","markdown",{init:function(e){function i(){e.editor.setOption("mode","gfm"),e.htmleditor.find(".uk-htmleditor-button-code a").html(e.options.lblMarkedview)}function o(t,i,o){e.on("action."+t,function(){"markdown"==e.getCursorMode()&&e["replaceLine"==o?"replaceLine":"replaceSelection"](i)})}var r=e.options.mdparser||marked||null;r&&(e.options.markdown&&i(),o("bold","**$1**"),o("italic","*$1*"),o("strike","~~$1~~"),o("blockquote","> $1","replaceLine"),o("link","[$1](http://)"),o("image","![$1](http://)"),e.on("action.listUl",function(){if("markdown"==e.getCursorMode()){for(var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),r=i.line;r<o.line+1;r++)t.replaceRange("* "+t.getLine(r),{line:r,ch:0},{line:r,ch:t.getLine(r).length});t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("action.listOl",function(){if("markdown"==e.getCursorMode()){var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),r=1;if(i.line>0){var n,l=t.getLine(i.line-1);(n=l.match(/^(\d+)\./))&&(r=Number(n[1])+1)}for(var s=i.line;s<o.line+1;s++)t.replaceRange(r+". "+t.getLine(s),{line:s,ch:0},{line:s,ch:t.getLine(s).length}),r++;t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("renderLate",function(){"gfm"==e.editor.options.mode&&(e.currentvalue=r(e.currentvalue))}),e.on("cursorMode",function(t,i){if("gfm"==e.editor.options.mode){var o=e.editor.getDoc().getCursor();e.editor.getTokenAt(o).state.base.htmlState||(i.mode="markdown")}}),t.$.extend(e,{enableMarkdown:function(){i(),this.render()},disableMarkdown:function(){this.editor.setOption("mode","htmlmixed"),this.htmleditor.find(".uk-htmleditor-button-code a").html(this.options.lblCodeview),this.render()}}),e.on({enableMarkdown:function(){e.enableMarkdown()},disableMarkdown:function(){e.disableMarkdown()}}))}}),t.htmleditor});
@@ -0,0 +1,555 @@
1
+ /*! UIkit 2.22.0 | 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) { // AMD
11
+ define("uikit-lightbox", ["uikit"], function(){
12
+ return component || addon(UIkit);
13
+ });
14
+ }
15
+
16
+ })(function(UI){
17
+
18
+ "use strict";
19
+
20
+ var modal, cache = {};
21
+
22
+ UI.component('lightbox', {
23
+
24
+ defaults: {
25
+ "group" : false,
26
+ "duration" : 400,
27
+ "keyboard" : true
28
+ },
29
+
30
+ index : 0,
31
+ items : false,
32
+
33
+ boot: function() {
34
+
35
+ UI.$html.on('click', '[data-uk-lightbox]', function(e){
36
+
37
+ e.preventDefault();
38
+
39
+ var link = UI.$(this);
40
+
41
+ if (!link.data("lightbox")) {
42
+
43
+ UI.lightbox(link, UI.Utils.options(link.attr("data-uk-lightbox")));
44
+ }
45
+
46
+ link.data("lightbox").show(link);
47
+ });
48
+
49
+ // keyboard navigation
50
+ UI.$doc.on('keyup', function(e) {
51
+
52
+ if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
53
+
54
+ e.preventDefault();
55
+
56
+ switch(e.keyCode) {
57
+ case 37:
58
+ modal.lightbox.previous();
59
+ break;
60
+ case 39:
61
+ modal.lightbox.next();
62
+ break;
63
+ }
64
+ }
65
+ });
66
+ },
67
+
68
+ init: function() {
69
+
70
+ var siblings = [];
71
+
72
+ this.index = 0;
73
+ this.siblings = [];
74
+
75
+ if (this.element && this.element.length) {
76
+
77
+ var domSiblings = this.options.group ? UI.$([
78
+ '[data-uk-lightbox*="'+this.options.group+'"]',
79
+ "[data-uk-lightbox*='"+this.options.group+"']"
80
+ ].join(',')) : this.element;
81
+
82
+ domSiblings.each(function() {
83
+
84
+ var ele = UI.$(this);
85
+
86
+ siblings.push({
87
+ 'source': ele.attr('href'),
88
+ 'title' : ele.attr('title'),
89
+ 'type' : ele.attr("data-lightbox-type") || 'auto',
90
+ 'link' : ele
91
+ });
92
+ });
93
+
94
+ this.index = domSiblings.index(this.element);
95
+ this.siblings = siblings;
96
+
97
+ } else if (this.options.group && this.options.group.length) {
98
+ this.siblings = this.options.group;
99
+ }
100
+
101
+ this.trigger('lightbox-init', [this]);
102
+ },
103
+
104
+ show: function(index) {
105
+
106
+ this.modal = getModal(this);
107
+
108
+ // stop previous animation
109
+ this.modal.dialog.stop();
110
+ this.modal.content.stop();
111
+
112
+ var $this = this, promise = UI.$.Deferred(), data, item;
113
+
114
+ index = index || 0;
115
+
116
+ // index is a jQuery object or DOM element
117
+ if (typeof(index) == 'object') {
118
+
119
+ this.siblings.forEach(function(s, idx){
120
+
121
+ if (index[0] === s.link[0]) {
122
+ index = idx;
123
+ }
124
+ });
125
+ }
126
+
127
+ // fix index if needed
128
+ if ( index < 0 ) {
129
+ index = this.siblings.length - index;
130
+ } else if (!this.siblings[index]) {
131
+ index = 0;
132
+ }
133
+
134
+ item = this.siblings[index];
135
+
136
+ data = {
137
+ "lightbox" : $this,
138
+ "source" : item.source,
139
+ "type" : item.type,
140
+ "index" : index,
141
+ "promise" : promise,
142
+ "title" : item.title,
143
+ "item" : item,
144
+ "meta" : {
145
+ "content" : '',
146
+ "width" : null,
147
+ "height" : null
148
+ }
149
+ };
150
+
151
+ this.index = index;
152
+
153
+ this.modal.content.empty();
154
+
155
+ if (!this.modal.is(':visible')) {
156
+ this.modal.content.css({width:'', height:''}).empty();
157
+ this.modal.modal.show();
158
+ }
159
+
160
+ this.modal.loader.removeClass('uk-hidden');
161
+
162
+ promise.promise().done(function() {
163
+
164
+ $this.data = data;
165
+ $this.fitSize(data);
166
+
167
+ }).fail(function(){
168
+
169
+ data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
170
+ data.meta.width = 400;
171
+ data.meta.height = 300;
172
+
173
+ $this.data = data;
174
+ $this.fitSize(data);
175
+ });
176
+
177
+ $this.trigger('showitem.uk.lightbox', [data]);
178
+ },
179
+
180
+ fitSize: function() {
181
+
182
+ var $this = this,
183
+ data = this.data,
184
+ pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
185
+ dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
186
+ dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
187
+ dpad = dpadTop + dpadBot,
188
+ content = data.meta.content,
189
+ duration = $this.options.duration;
190
+
191
+ if (this.siblings.length > 1) {
192
+
193
+ content = [
194
+ content,
195
+ '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
196
+ '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
197
+ ].join('');
198
+ }
199
+
200
+ // calculate width
201
+ var tmp = UI.$('<div>&nbsp;</div>').css({
202
+ 'opacity' : 0,
203
+ 'position' : 'absolute',
204
+ 'top' : 0,
205
+ 'left' : 0,
206
+ 'width' : '100%',
207
+ 'max-width' : $this.modal.dialog.css('max-width'),
208
+ 'padding' : $this.modal.dialog.css('padding'),
209
+ 'margin' : $this.modal.dialog.css('margin')
210
+ }), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
211
+
212
+ tmp.appendTo('body').width();
213
+
214
+ maxwidth = tmp.width();
215
+ maxheight = window.innerHeight - dpad;
216
+
217
+ tmp.remove();
218
+
219
+ this.modal.dialog.find('.uk-modal-caption').remove();
220
+
221
+ if (data.title) {
222
+ this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
223
+ maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
224
+ }
225
+
226
+ if (maxwidth < data.meta.width) {
227
+
228
+ h = Math.floor( h * (maxwidth / w) );
229
+ w = maxwidth;
230
+ }
231
+
232
+ if (maxheight < h) {
233
+
234
+ h = Math.floor(maxheight);
235
+ w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
236
+ }
237
+
238
+ this.modal.content.css('opacity', 0).width(w).html(content);
239
+
240
+ if (data.type == 'iframe') {
241
+ this.modal.content.find('iframe:first').height(h);
242
+ }
243
+
244
+ var dh = h + pad,
245
+ t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
246
+
247
+ if (t < 0) { t = 0; }
248
+
249
+ this.modal.closer.addClass('uk-hidden');
250
+
251
+ if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
252
+ duration = 0;
253
+ }
254
+
255
+ this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
256
+ $this.modal.loader.addClass('uk-hidden');
257
+ $this.modal.content.css({width:''}).animate({'opacity': 1}, function() {
258
+ $this.modal.closer.removeClass('uk-hidden');
259
+ });
260
+
261
+ $this.modal.data({'mwidth': w, 'mheight': h});
262
+ });
263
+ },
264
+
265
+ next: function() {
266
+ this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
267
+ },
268
+
269
+ previous: function() {
270
+ this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
271
+ }
272
+ });
273
+
274
+
275
+ // Plugins
276
+
277
+ UI.plugin('lightbox', 'image', {
278
+
279
+ init: function(lightbox) {
280
+
281
+ lightbox.on("showitem.uk.lightbox", function(e, data){
282
+
283
+ if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
284
+
285
+ var resolve = function(source, width, height) {
286
+
287
+ data.meta = {
288
+ "content" : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
289
+ "width" : width,
290
+ "height" : height
291
+ };
292
+
293
+ data.type = 'image';
294
+
295
+ data.promise.resolve();
296
+ };
297
+
298
+ if (!cache[data.source]) {
299
+
300
+ var img = new Image();
301
+
302
+ img.onerror = function(){
303
+ data.promise.reject('Loading image failed');
304
+ };
305
+
306
+ img.onload = function(){
307
+ cache[data.source] = {width: img.width, height: img.height};
308
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
309
+ };
310
+
311
+ img.src = data.source;
312
+
313
+ } else {
314
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
315
+ }
316
+ }
317
+ });
318
+ }
319
+ });
320
+
321
+ UI.plugin("lightbox", "youtube", {
322
+
323
+ init: function(lightbox) {
324
+
325
+ var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
326
+ youtubeRegExpShort = /youtu\.be\/(.*)/;
327
+
328
+
329
+ lightbox.on("showitem.uk.lightbox", function(e, data){
330
+
331
+ var id, matches, resolve = function(id, width, height) {
332
+
333
+ data.meta = {
334
+ 'content': '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"></iframe>',
335
+ 'width': width,
336
+ 'height': height
337
+ };
338
+
339
+ data.type = 'iframe';
340
+
341
+ data.promise.resolve();
342
+ };
343
+
344
+ if (matches = data.source.match(youtubeRegExp)) {
345
+ id = matches[2];
346
+ }
347
+
348
+ if (matches = data.source.match(youtubeRegExpShort)) {
349
+ id = matches[1];
350
+ }
351
+
352
+ if (id) {
353
+
354
+ if(!cache[id]) {
355
+
356
+ var img = new Image(), lowres = false;
357
+
358
+ img.onerror = function(){
359
+ cache[id] = {width:640, height:320};
360
+ resolve(id, cache[id].width, cache[id].height);
361
+ };
362
+
363
+ img.onload = function(){
364
+ //youtube default 404 thumb, fall back to lowres
365
+ if (img.width == 120 && img.height == 90) {
366
+ if (!lowres) {
367
+ lowres = true;
368
+ img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
369
+ } else {
370
+ cache[id] = {width: 640, height: 320};
371
+ resolve(id, cache[id].width, cache[id].height);
372
+ }
373
+ } else {
374
+ cache[id] = {width: img.width, height: img.height};
375
+ resolve(id, img.width, img.height);
376
+ }
377
+ };
378
+
379
+ img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
380
+
381
+ } else {
382
+ resolve(id, cache[id].width, cache[id].height);
383
+ }
384
+
385
+ e.stopImmediatePropagation();
386
+ }
387
+ });
388
+ }
389
+ });
390
+
391
+
392
+ UI.plugin("lightbox", "vimeo", {
393
+
394
+ init: function(lightbox) {
395
+
396
+ var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
397
+
398
+
399
+ lightbox.on("showitem.uk.lightbox", function(e, data){
400
+
401
+ var id, resolve = function(id, width, height) {
402
+
403
+ data.meta = {
404
+ 'content': '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"></iframe>',
405
+ 'width': width,
406
+ 'height': height
407
+ };
408
+
409
+ data.type = 'iframe';
410
+
411
+ data.promise.resolve();
412
+ };
413
+
414
+ if (matches = data.source.match(regex)) {
415
+
416
+ id = matches[2];
417
+
418
+ if(!cache[id]) {
419
+
420
+ UI.$.ajax({
421
+ type : 'GET',
422
+ url : 'http://vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
423
+ jsonp : 'callback',
424
+ dataType : 'jsonp',
425
+ success : function(data) {
426
+ cache[id] = {width:data.width, height:data.height};
427
+ resolve(id, cache[id].width, cache[id].height);
428
+ }
429
+ });
430
+
431
+ } else {
432
+ resolve(id, cache[id].width, cache[id].height);
433
+ }
434
+
435
+ e.stopImmediatePropagation();
436
+ }
437
+ });
438
+ }
439
+ });
440
+
441
+ UI.plugin("lightbox", "video", {
442
+
443
+ init: function(lightbox) {
444
+
445
+ lightbox.on("showitem.uk.lightbox", function(e, data){
446
+
447
+
448
+ var resolve = function(source, width, height) {
449
+
450
+ data.meta = {
451
+ 'content': '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
452
+ 'width': width,
453
+ 'height': height
454
+ };
455
+
456
+ data.type = 'video';
457
+
458
+ data.promise.resolve();
459
+ };
460
+
461
+ if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
462
+
463
+ if (!cache[data.source]) {
464
+
465
+ var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
466
+
467
+ var idle = setInterval(function() {
468
+
469
+ if (vid[0].videoWidth) {
470
+ clearInterval(idle);
471
+ cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
472
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
473
+ vid.remove();
474
+ }
475
+
476
+ }, 20);
477
+
478
+ } else {
479
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
480
+ }
481
+ }
482
+ });
483
+ }
484
+ });
485
+
486
+
487
+ function getModal(lightbox) {
488
+
489
+ if (modal) {
490
+ modal.lightbox = lightbox;
491
+ return modal;
492
+ }
493
+
494
+ // init lightbox container
495
+ modal = UI.$([
496
+ '<div class="uk-modal">',
497
+ '<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2 - 200)+'px;">',
498
+ '<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>',
499
+ '<div class="uk-lightbox-content"></div>',
500
+ '<div class="uk-modal-spinner uk-hidden"></div>',
501
+ '</div>',
502
+ '</div>'
503
+ ].join('')).appendTo('body');
504
+
505
+ modal.dialog = modal.find('.uk-modal-dialog:first');
506
+ modal.content = modal.find('.uk-lightbox-content:first');
507
+ modal.loader = modal.find('.uk-modal-spinner:first');
508
+ modal.closer = modal.find('.uk-close.uk-close-alt');
509
+ modal.modal = UI.modal(modal, {modal:false});
510
+
511
+ // next / previous
512
+ modal.on("swipeRight swipeLeft", function(e) {
513
+ modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
514
+ }).on("click", "[data-lightbox-previous], [data-lightbox-next]", function(e){
515
+ e.preventDefault();
516
+ modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
517
+ });
518
+
519
+ // destroy content on modal hide
520
+ modal.on("hide.uk.modal", function(e) {
521
+ modal.content.html('');
522
+ });
523
+
524
+ UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
525
+ if (modal.is(':visible') && !UI.Utils.isFullscreen()) modal.lightbox.fitSize();
526
+ }.bind(this), 100));
527
+
528
+ modal.lightbox = lightbox;
529
+
530
+ return modal;
531
+ }
532
+
533
+ UI.lightbox.create = function(items, options) {
534
+
535
+ if (!items) return;
536
+
537
+ var group = [], o;
538
+
539
+ items.forEach(function(item) {
540
+
541
+ group.push(UI.$.extend({
542
+ 'source' : '',
543
+ 'title' : '',
544
+ 'type' : 'auto',
545
+ 'link' : false
546
+ }, (typeof(item) == 'string' ? {'source': item} : item)));
547
+ });
548
+
549
+ o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
550
+
551
+ return o;
552
+ };
553
+
554
+ return UI.lightbox;
555
+ });