rails-uikit-sass 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
- data/lib/rails-uikit-sass.rb +12 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/components/accordion.js +180 -0
- data/vendor/assets/javascripts/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/components/form-password.js +67 -0
- data/vendor/assets/javascripts/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/components/form-select.js +85 -0
- data/vendor/assets/javascripts/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/grid.js +540 -0
- data/vendor/assets/javascripts/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/components/lightbox.js +588 -0
- data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/components/nestable.js +653 -0
- data/vendor/assets/javascripts/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/components/notify.js +189 -0
- data/vendor/assets/javascripts/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/components/pagination.js +147 -0
- data/vendor/assets/javascripts/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/components/parallax.js +462 -0
- data/vendor/assets/javascripts/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/search.js +92 -0
- data/vendor/assets/javascripts/components/search.min.js +2 -0
- data/vendor/assets/javascripts/components/slider.js +552 -0
- data/vendor/assets/javascripts/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/components/slideset.js +523 -0
- data/vendor/assets/javascripts/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
- data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/components/sortable.js +688 -0
- data/vendor/assets/javascripts/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/components/sticky.js +364 -0
- data/vendor/assets/javascripts/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/components/tooltip.js +235 -0
- data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/components/upload.js +262 -0
- data/vendor/assets/javascripts/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/core/alert.js +66 -0
- data/vendor/assets/javascripts/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/core/button.js +156 -0
- data/vendor/assets/javascripts/core/button.min.js +2 -0
- data/vendor/assets/javascripts/core/core.js +820 -0
- data/vendor/assets/javascripts/core/core.min.js +2 -0
- data/vendor/assets/javascripts/core/cover.js +87 -0
- data/vendor/assets/javascripts/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/core/dropdown.js +534 -0
- data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/core/grid.js +117 -0
- data/vendor/assets/javascripts/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/core/modal.js +387 -0
- data/vendor/assets/javascripts/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/core/nav.js +153 -0
- data/vendor/assets/javascripts/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/core/switcher.js +307 -0
- data/vendor/assets/javascripts/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/core/tab.js +169 -0
- data/vendor/assets/javascripts/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/core/toggle.js +124 -0
- data/vendor/assets/javascripts/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/core/touch.js +175 -0
- data/vendor/assets/javascripts/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/core/utility.js +335 -0
- data/vendor/assets/javascripts/core/utility.min.js +2 -0
- data/vendor/assets/javascripts/uikit.js +3898 -0
- data/vendor/assets/javascripts/uikit.min.js +3 -0
- data/vendor/assets/stylesheets/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/components/search.scss +309 -0
- data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
- data/vendor/assets/stylesheets/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/core/article.scss +139 -0
- data/vendor/assets/stylesheets/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/core/base.scss +563 -0
- data/vendor/assets/stylesheets/core/block.scss +155 -0
- data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/core/button.scss +406 -0
- data/vendor/assets/stylesheets/core/close.scss +132 -0
- data/vendor/assets/stylesheets/core/column.scss +209 -0
- data/vendor/assets/stylesheets/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
- data/vendor/assets/stylesheets/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/core/form.scss +629 -0
- data/vendor/assets/stylesheets/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/core/list.scss +102 -0
- data/vendor/assets/stylesheets/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/core/print.scss +61 -0
- data/vendor/assets/stylesheets/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/core/table.scss +147 -0
- data/vendor/assets/stylesheets/core/text.scss +136 -0
- data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit.scss +52 -0
- metadata +251 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-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,enablescripts:!1,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 n=this.iframe?this.preview.container:i.preview.parent(),r=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=r.height()-l.height(),e=n[0].scrollHeight-(i.iframe?i.iframe.height():n.height()),o=e/t,s=l.scrollTop()*o;n.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 n=i.editor.getCursor(),r=i.editor.getTokenAt(n);("<"==r.string.charAt(0)||"attribute"==r.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,n=[],r=o.getValue(),l=-1,s=0;return this.currentvalue=this.currentvalue.replace(t,function(){l=r.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="string"==typeof e?e:e(t,s);return a||""===a?(s++,n.push(t),a):arguments[0]}),n},_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.options.enablescripts||(this.currentvalue=this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/gim,"")),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),n=i.ch,r=n;r<o.length&&/[\w$]+/.test(o.charAt(r));)++r;for(;n&&/[\w$]+/.test(o.charAt(n-1));)--n;var l=n!=r&&o.slice(n,r);l&&(this.editor.setSelection({line:i.line,ch:n},{line:i.line,ch:r}),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(t){if("html"==e.getCursorMode()){t=t||"ul";for(var i=e.editor,o=i.getDoc(),n=o.getCursor(!0),r=o.getCursor(!1),l=CodeMirror.innerMode(i.getMode(),i.getTokenAt(i.getCursor()).state),s=l&&l.state&&l.state.context&&-1!=["ul","ol"].indexOf(l.state.context.tagName),a=n.line;a<r.line+1;a++)i.replaceRange("<li>"+i.getLine(a)+"</li>",{line:a,ch:0},{line:a,ch:i.getLine(a).length});s?i.setCursor({line:r.line,ch:i.getLine(r.line).length}):(i.replaceRange("<"+t+">\n"+i.getLine(n.line),{line:n.line,ch:0},{line:n.line,ch:i.getLine(n.line).length}),i.replaceRange(i.getLine(r.line+1)+"\n</"+t+">",{line:r.line+1,ch:0},{line:r.line+1,ch:i.getLine(r.line+1).length}),i.setCursor({line:r.line+1,ch:i.getLine(r.line+1).length})),i.focus()}};e.on("action.listUl",function(){o("ul")}),e.on("action.listOl",function(){o("ol")}),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")){var o=!1,n=e.htmleditor.parents().each(function(){"fixed"!=t.$(this).css("position")||t.$(this).is("html")||(o=t.$(this))});if(e.htmleditor.data("fixedParents",!1),o){var r=[];o=o.parent().find(n).each(function(){"none"!=t.$(this).css("transform")&&r.push(t.$(this).data("transform-reset",{transform:this.style.transform,"-webkit-transform":this.style.webkitTransform,"-webkit-transition":this.style.webkitTransition,transition:this.style.transition}).css({transform:"none","-webkit-transform":"none","-webkit-transition":"none",transition:"none"}))}),e.htmleditor.data("fixedParents",r)}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 l=e.editor.state.fullScreenRestore;i.style.width=l.width,i.style.height=l.height,window.scrollTo(l.scrollLeft,l.scrollTop),e.htmleditor.data("fixedParents")&&e.htmleditor.data("fixedParents").forEach(function(t){t.css(t.data("transform-reset"))})}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 n=e.options.mdparser||window.marked||null;n&&(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),n=i.line;n<o.line+1;n++)t.replaceRange("* "+t.getLine(n),{line:n,ch:0},{line:n,ch:t.getLine(n).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),n=1;if(i.line>0){var r,l=t.getLine(i.line-1);(r=l.match(/^(\d+)\./))&&(n=Number(r[1])+1)}for(var s=i.line;s<o.line+1;s++)t.replaceRange(n+". "+t.getLine(s),{line:s,ch:0},{line:s,ch:t.getLine(s).length}),n++;t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("renderLate",function(){"gfm"==e.editor.options.mode&&(e.currentvalue=n(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,588 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == 'function' && define.amd) { // 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
|
+
allowfullscreen : true,
|
26
|
+
duration : 400,
|
27
|
+
group : false,
|
28
|
+
keyboard : true
|
29
|
+
},
|
30
|
+
|
31
|
+
index : 0,
|
32
|
+
items : false,
|
33
|
+
|
34
|
+
boot: function() {
|
35
|
+
|
36
|
+
UI.$html.on('click', '[data-uk-lightbox]', function(e){
|
37
|
+
|
38
|
+
e.preventDefault();
|
39
|
+
|
40
|
+
var link = UI.$(this);
|
41
|
+
|
42
|
+
if (!link.data('lightbox')) {
|
43
|
+
|
44
|
+
UI.lightbox(link, UI.Utils.options(link.attr('data-uk-lightbox')));
|
45
|
+
}
|
46
|
+
|
47
|
+
link.data('lightbox').show(link);
|
48
|
+
});
|
49
|
+
|
50
|
+
// keyboard navigation
|
51
|
+
UI.$doc.on('keyup', function(e) {
|
52
|
+
|
53
|
+
if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
|
54
|
+
|
55
|
+
e.preventDefault();
|
56
|
+
|
57
|
+
switch(e.keyCode) {
|
58
|
+
case 37:
|
59
|
+
modal.lightbox.previous();
|
60
|
+
break;
|
61
|
+
case 39:
|
62
|
+
modal.lightbox.next();
|
63
|
+
break;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
});
|
67
|
+
},
|
68
|
+
|
69
|
+
init: function() {
|
70
|
+
|
71
|
+
var siblings = [];
|
72
|
+
|
73
|
+
this.index = 0;
|
74
|
+
this.siblings = [];
|
75
|
+
|
76
|
+
if (this.element && this.element.length) {
|
77
|
+
|
78
|
+
var domSiblings = this.options.group ? UI.$('[data-uk-lightbox*="'+this.options.group+'"]') : this.element;
|
79
|
+
|
80
|
+
domSiblings.each(function() {
|
81
|
+
|
82
|
+
var ele = UI.$(this);
|
83
|
+
|
84
|
+
siblings.push({
|
85
|
+
source : ele.attr('href'),
|
86
|
+
title : ele.attr('data-title') || ele.attr('title'),
|
87
|
+
type : ele.attr("data-lightbox-type") || 'auto',
|
88
|
+
link : ele
|
89
|
+
});
|
90
|
+
});
|
91
|
+
|
92
|
+
this.index = domSiblings.index(this.element);
|
93
|
+
this.siblings = siblings;
|
94
|
+
|
95
|
+
} else if (this.options.group && this.options.group.length) {
|
96
|
+
this.siblings = this.options.group;
|
97
|
+
}
|
98
|
+
|
99
|
+
this.trigger('lightbox-init', [this]);
|
100
|
+
},
|
101
|
+
|
102
|
+
show: function(index) {
|
103
|
+
|
104
|
+
this.modal = getModal(this);
|
105
|
+
|
106
|
+
// stop previous animation
|
107
|
+
this.modal.dialog.stop();
|
108
|
+
this.modal.content.stop();
|
109
|
+
|
110
|
+
var $this = this, promise = UI.$.Deferred(), data, item;
|
111
|
+
|
112
|
+
index = index || 0;
|
113
|
+
|
114
|
+
// index is a jQuery object or DOM element
|
115
|
+
if (typeof(index) == 'object') {
|
116
|
+
|
117
|
+
this.siblings.forEach(function(s, idx){
|
118
|
+
|
119
|
+
if (index[0] === s.link[0]) {
|
120
|
+
index = idx;
|
121
|
+
}
|
122
|
+
});
|
123
|
+
}
|
124
|
+
|
125
|
+
// fix index if needed
|
126
|
+
if ( index < 0 ) {
|
127
|
+
index = this.siblings.length - index;
|
128
|
+
} else if (!this.siblings[index]) {
|
129
|
+
index = 0;
|
130
|
+
}
|
131
|
+
|
132
|
+
item = this.siblings[index];
|
133
|
+
|
134
|
+
data = {
|
135
|
+
lightbox : $this,
|
136
|
+
source : item.source,
|
137
|
+
type : item.type,
|
138
|
+
index : index,
|
139
|
+
promise : promise,
|
140
|
+
title : item.title,
|
141
|
+
item : item,
|
142
|
+
meta : {
|
143
|
+
content : '',
|
144
|
+
width : null,
|
145
|
+
height : null
|
146
|
+
}
|
147
|
+
};
|
148
|
+
|
149
|
+
this.index = index;
|
150
|
+
|
151
|
+
this.modal.content.empty();
|
152
|
+
|
153
|
+
if (!this.modal.is(':visible')) {
|
154
|
+
this.modal.content.css({width:'', height:''}).empty();
|
155
|
+
this.modal.modal.show();
|
156
|
+
}
|
157
|
+
|
158
|
+
this.modal.loader.removeClass('uk-hidden');
|
159
|
+
|
160
|
+
promise.promise().done(function() {
|
161
|
+
|
162
|
+
$this.data = data;
|
163
|
+
$this.fitSize(data);
|
164
|
+
|
165
|
+
}).fail(function(){
|
166
|
+
|
167
|
+
data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
|
168
|
+
data.meta.width = 400;
|
169
|
+
data.meta.height = 300;
|
170
|
+
|
171
|
+
$this.data = data;
|
172
|
+
$this.fitSize(data);
|
173
|
+
});
|
174
|
+
|
175
|
+
$this.trigger('showitem.uk.lightbox', [data]);
|
176
|
+
},
|
177
|
+
|
178
|
+
fitSize: function() {
|
179
|
+
|
180
|
+
var $this = this,
|
181
|
+
data = this.data,
|
182
|
+
pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
|
183
|
+
dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
|
184
|
+
dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
|
185
|
+
dpad = dpadTop + dpadBot,
|
186
|
+
content = data.meta.content,
|
187
|
+
duration = $this.options.duration;
|
188
|
+
|
189
|
+
if (this.siblings.length > 1) {
|
190
|
+
|
191
|
+
content = [
|
192
|
+
content,
|
193
|
+
'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
|
194
|
+
'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
|
195
|
+
].join('');
|
196
|
+
}
|
197
|
+
|
198
|
+
// calculate width
|
199
|
+
var tmp = UI.$('<div> </div>').css({
|
200
|
+
opacity : 0,
|
201
|
+
position : 'absolute',
|
202
|
+
top : 0,
|
203
|
+
left : 0,
|
204
|
+
width : '100%',
|
205
|
+
maxWidth : $this.modal.dialog.css('max-width'),
|
206
|
+
padding : $this.modal.dialog.css('padding'),
|
207
|
+
margin : $this.modal.dialog.css('margin')
|
208
|
+
}), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
|
209
|
+
|
210
|
+
tmp.appendTo('body').width();
|
211
|
+
|
212
|
+
maxwidth = tmp.width();
|
213
|
+
maxheight = window.innerHeight - dpad;
|
214
|
+
|
215
|
+
tmp.remove();
|
216
|
+
|
217
|
+
this.modal.dialog.find('.uk-modal-caption').remove();
|
218
|
+
|
219
|
+
if (data.title) {
|
220
|
+
this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
|
221
|
+
maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
|
222
|
+
}
|
223
|
+
|
224
|
+
if (maxwidth < data.meta.width) {
|
225
|
+
|
226
|
+
h = Math.floor( h * (maxwidth / w) );
|
227
|
+
w = maxwidth;
|
228
|
+
}
|
229
|
+
|
230
|
+
if (maxheight < h) {
|
231
|
+
|
232
|
+
h = Math.floor(maxheight);
|
233
|
+
w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
|
234
|
+
}
|
235
|
+
|
236
|
+
this.modal.content.css('opacity', 0).width(w).html(content);
|
237
|
+
|
238
|
+
if (data.type == 'iframe') {
|
239
|
+
this.modal.content.find('iframe:first').height(h);
|
240
|
+
}
|
241
|
+
|
242
|
+
var dh = h + pad,
|
243
|
+
t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
|
244
|
+
|
245
|
+
if (t < 0) { t = 0; }
|
246
|
+
|
247
|
+
this.modal.closer.addClass('uk-hidden');
|
248
|
+
|
249
|
+
if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
|
250
|
+
duration = 0;
|
251
|
+
}
|
252
|
+
|
253
|
+
this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
|
254
|
+
$this.modal.loader.addClass('uk-hidden');
|
255
|
+
$this.modal.content.css({width:''}).animate({opacity: 1}, function() {
|
256
|
+
$this.modal.closer.removeClass('uk-hidden');
|
257
|
+
});
|
258
|
+
|
259
|
+
$this.modal.data({mwidth: w, mheight: h});
|
260
|
+
});
|
261
|
+
},
|
262
|
+
|
263
|
+
next: function() {
|
264
|
+
this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
|
265
|
+
},
|
266
|
+
|
267
|
+
previous: function() {
|
268
|
+
this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
|
269
|
+
}
|
270
|
+
});
|
271
|
+
|
272
|
+
|
273
|
+
// Plugins
|
274
|
+
|
275
|
+
UI.plugin('lightbox', 'image', {
|
276
|
+
|
277
|
+
init: function(lightbox) {
|
278
|
+
|
279
|
+
lightbox.on('showitem.uk.lightbox', function(e, data){
|
280
|
+
|
281
|
+
if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
|
282
|
+
|
283
|
+
var resolve = function(source, width, height) {
|
284
|
+
|
285
|
+
data.meta = {
|
286
|
+
content : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
|
287
|
+
width : width,
|
288
|
+
height : height
|
289
|
+
};
|
290
|
+
|
291
|
+
data.type = 'image';
|
292
|
+
|
293
|
+
data.promise.resolve();
|
294
|
+
};
|
295
|
+
|
296
|
+
if (!cache[data.source]) {
|
297
|
+
|
298
|
+
var img = new Image();
|
299
|
+
|
300
|
+
img.onerror = function(){
|
301
|
+
data.promise.reject('Loading image failed');
|
302
|
+
};
|
303
|
+
|
304
|
+
img.onload = function(){
|
305
|
+
cache[data.source] = {width: img.width, height: img.height};
|
306
|
+
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
307
|
+
};
|
308
|
+
|
309
|
+
img.src = data.source;
|
310
|
+
|
311
|
+
} else {
|
312
|
+
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
});
|
316
|
+
}
|
317
|
+
});
|
318
|
+
|
319
|
+
UI.plugin('lightbox', 'youtube', {
|
320
|
+
|
321
|
+
init: function(lightbox) {
|
322
|
+
|
323
|
+
var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
|
324
|
+
youtubeRegExpShort = /youtu\.be\/(.*)/;
|
325
|
+
|
326
|
+
|
327
|
+
lightbox.on('showitem.uk.lightbox', function(e, data){
|
328
|
+
|
329
|
+
var id, matches, resolve = function(id, width, height) {
|
330
|
+
|
331
|
+
data.meta = {
|
332
|
+
content: '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
333
|
+
width: width,
|
334
|
+
height: height
|
335
|
+
};
|
336
|
+
|
337
|
+
data.type = 'iframe';
|
338
|
+
|
339
|
+
data.promise.resolve();
|
340
|
+
};
|
341
|
+
|
342
|
+
if (matches = data.source.match(youtubeRegExp)) {
|
343
|
+
id = matches[2];
|
344
|
+
}
|
345
|
+
|
346
|
+
if (matches = data.source.match(youtubeRegExpShort)) {
|
347
|
+
id = matches[1];
|
348
|
+
}
|
349
|
+
|
350
|
+
if (id) {
|
351
|
+
|
352
|
+
if(!cache[id]) {
|
353
|
+
|
354
|
+
var img = new Image(), lowres = false;
|
355
|
+
|
356
|
+
img.onerror = function(){
|
357
|
+
cache[id] = {width:640, height:320};
|
358
|
+
resolve(id, cache[id].width, cache[id].height);
|
359
|
+
};
|
360
|
+
|
361
|
+
img.onload = function(){
|
362
|
+
//youtube default 404 thumb, fall back to lowres
|
363
|
+
if (img.width == 120 && img.height == 90) {
|
364
|
+
if (!lowres) {
|
365
|
+
lowres = true;
|
366
|
+
img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
|
367
|
+
} else {
|
368
|
+
cache[id] = {width: 640, height: 320};
|
369
|
+
resolve(id, cache[id].width, cache[id].height);
|
370
|
+
}
|
371
|
+
} else {
|
372
|
+
cache[id] = {width: img.width, height: img.height};
|
373
|
+
resolve(id, img.width, img.height);
|
374
|
+
}
|
375
|
+
};
|
376
|
+
|
377
|
+
img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
|
378
|
+
|
379
|
+
} else {
|
380
|
+
resolve(id, cache[id].width, cache[id].height);
|
381
|
+
}
|
382
|
+
|
383
|
+
e.stopImmediatePropagation();
|
384
|
+
}
|
385
|
+
});
|
386
|
+
}
|
387
|
+
});
|
388
|
+
|
389
|
+
|
390
|
+
UI.plugin('lightbox', 'vimeo', {
|
391
|
+
|
392
|
+
init: function(lightbox) {
|
393
|
+
|
394
|
+
var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
|
395
|
+
|
396
|
+
|
397
|
+
lightbox.on('showitem.uk.lightbox', function(e, data){
|
398
|
+
|
399
|
+
var id, resolve = function(id, width, height) {
|
400
|
+
|
401
|
+
data.meta = {
|
402
|
+
content: '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
403
|
+
width: width,
|
404
|
+
height: height
|
405
|
+
};
|
406
|
+
|
407
|
+
data.type = 'iframe';
|
408
|
+
|
409
|
+
data.promise.resolve();
|
410
|
+
};
|
411
|
+
|
412
|
+
if (matches = data.source.match(regex)) {
|
413
|
+
|
414
|
+
id = matches[2];
|
415
|
+
|
416
|
+
if(!cache[id]) {
|
417
|
+
|
418
|
+
UI.$.ajax({
|
419
|
+
type : 'GET',
|
420
|
+
url : '//vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
|
421
|
+
jsonp : 'callback',
|
422
|
+
dataType : 'jsonp',
|
423
|
+
success : function(data) {
|
424
|
+
cache[id] = {width:data.width, height:data.height};
|
425
|
+
resolve(id, cache[id].width, cache[id].height);
|
426
|
+
}
|
427
|
+
});
|
428
|
+
|
429
|
+
} else {
|
430
|
+
resolve(id, cache[id].width, cache[id].height);
|
431
|
+
}
|
432
|
+
|
433
|
+
e.stopImmediatePropagation();
|
434
|
+
}
|
435
|
+
});
|
436
|
+
}
|
437
|
+
});
|
438
|
+
|
439
|
+
UI.plugin('lightbox', 'video', {
|
440
|
+
|
441
|
+
init: function(lightbox) {
|
442
|
+
|
443
|
+
lightbox.on('showitem.uk.lightbox', function(e, data){
|
444
|
+
|
445
|
+
|
446
|
+
var resolve = function(source, width, height) {
|
447
|
+
|
448
|
+
data.meta = {
|
449
|
+
content: '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
|
450
|
+
width: width,
|
451
|
+
height: height
|
452
|
+
};
|
453
|
+
|
454
|
+
data.type = 'video';
|
455
|
+
|
456
|
+
data.promise.resolve();
|
457
|
+
};
|
458
|
+
|
459
|
+
if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
|
460
|
+
|
461
|
+
if (!cache[data.source]) {
|
462
|
+
|
463
|
+
var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
|
464
|
+
|
465
|
+
var idle = setInterval(function() {
|
466
|
+
|
467
|
+
if (vid[0].videoWidth) {
|
468
|
+
clearInterval(idle);
|
469
|
+
cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
|
470
|
+
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
471
|
+
vid.remove();
|
472
|
+
}
|
473
|
+
|
474
|
+
}, 20);
|
475
|
+
|
476
|
+
} else {
|
477
|
+
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
478
|
+
}
|
479
|
+
}
|
480
|
+
});
|
481
|
+
}
|
482
|
+
});
|
483
|
+
|
484
|
+
|
485
|
+
UIkit.plugin('lightbox', 'iframe', {
|
486
|
+
|
487
|
+
init: function (lightbox) {
|
488
|
+
|
489
|
+
lightbox.on('showitem.uk.lightbox', function (e, data) {
|
490
|
+
|
491
|
+
var resolve = function (source, width, height) {
|
492
|
+
|
493
|
+
data.meta = {
|
494
|
+
content: '<iframe class="uk-responsive-width" src="' + source + '" width="' + width + '" height="' + height + '"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
495
|
+
width: width,
|
496
|
+
height: height
|
497
|
+
};
|
498
|
+
|
499
|
+
data.type = 'iframe';
|
500
|
+
|
501
|
+
data.promise.resolve();
|
502
|
+
};
|
503
|
+
|
504
|
+
if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) {
|
505
|
+
resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600));
|
506
|
+
}
|
507
|
+
});
|
508
|
+
|
509
|
+
}
|
510
|
+
});
|
511
|
+
|
512
|
+
function getModal(lightbox) {
|
513
|
+
|
514
|
+
if (modal) {
|
515
|
+
modal.lightbox = lightbox;
|
516
|
+
return modal;
|
517
|
+
}
|
518
|
+
|
519
|
+
// init lightbox container
|
520
|
+
modal = UI.$([
|
521
|
+
'<div class="uk-modal">',
|
522
|
+
'<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;">',
|
523
|
+
'<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>',
|
524
|
+
'<div class="uk-lightbox-content"></div>',
|
525
|
+
'<div class="uk-modal-spinner uk-hidden"></div>',
|
526
|
+
'</div>',
|
527
|
+
'</div>'
|
528
|
+
].join('')).appendTo('body');
|
529
|
+
|
530
|
+
modal.dialog = modal.find('.uk-modal-dialog:first');
|
531
|
+
modal.content = modal.find('.uk-lightbox-content:first');
|
532
|
+
modal.loader = modal.find('.uk-modal-spinner:first');
|
533
|
+
modal.closer = modal.find('.uk-close.uk-close-alt');
|
534
|
+
modal.modal = UI.modal(modal, {modal:false});
|
535
|
+
|
536
|
+
// next / previous
|
537
|
+
modal.on('swipeRight swipeLeft', function(e) {
|
538
|
+
modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
|
539
|
+
}).on('click', '[data-lightbox-previous], [data-lightbox-next]', function(e){
|
540
|
+
e.preventDefault();
|
541
|
+
modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
|
542
|
+
});
|
543
|
+
|
544
|
+
// destroy content on modal hide
|
545
|
+
modal.on('hide.uk.modal', function(e) {
|
546
|
+
modal.content.html('');
|
547
|
+
});
|
548
|
+
|
549
|
+
var resizeCache = {w: window.innerWidth, h:window.innerHeight};
|
550
|
+
|
551
|
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
|
552
|
+
|
553
|
+
if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) {
|
554
|
+
modal.lightbox.fitSize();
|
555
|
+
}
|
556
|
+
|
557
|
+
resizeCache = {w: window.innerWidth, h:window.innerHeight};
|
558
|
+
|
559
|
+
}, 100));
|
560
|
+
|
561
|
+
modal.lightbox = lightbox;
|
562
|
+
|
563
|
+
return modal;
|
564
|
+
}
|
565
|
+
|
566
|
+
UI.lightbox.create = function(items, options) {
|
567
|
+
|
568
|
+
if (!items) return;
|
569
|
+
|
570
|
+
var group = [], o;
|
571
|
+
|
572
|
+
items.forEach(function(item) {
|
573
|
+
|
574
|
+
group.push(UI.$.extend({
|
575
|
+
source : '',
|
576
|
+
title : '',
|
577
|
+
type : 'auto',
|
578
|
+
link : false
|
579
|
+
}, (typeof(item) == 'string' ? {'source': item} : item)));
|
580
|
+
});
|
581
|
+
|
582
|
+
o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
|
583
|
+
|
584
|
+
return o;
|
585
|
+
};
|
586
|
+
|
587
|
+
return UI.lightbox;
|
588
|
+
});
|