/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(core) { if (typeof define == "function" && define.amd) { // AMD define("uikit", function(){ var uikit = core(window, window.jQuery, window.document); uikit.load = function(res, req, onload, config) { var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, ""); if (!base) { throw new Error( "Please define base path to uikit in the requirejs config." ); } for (i = 0; i < resources.length; i += 1) { var resource = resources[i].replace(/\./g, '/'); load.push(base+'/js/addons/'+resource); } req(load, function() { onload(uikit); }); }; return uikit; }); } if (!window.jQuery) { throw new Error( "UIkit requires jQuery" ); } if (window && window.jQuery) { core(window, window.jQuery, window.document); } })(function(global, $, doc) { "use strict"; var UI = $.UIkit || {}, $html = $("html"), $win = $(window); if (UI.fn) { return UI; } UI.version = '2.5.0'; UI.fn = function(command, options) { var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2]; if (!UI[component]) { $.error("UIkit component [" + component + "] does not exist."); return this; } return this.each(function() { var $this = $(this), data = $this.data(component); if (!data) $this.data(component, (data = new UI[component](this, method ? undefined : options))); if (method) data[method].apply(data, Array.prototype.slice.call(args, 1)); }); }; UI.support = {}; UI.support.transition = (function() { var transitionEnd = (function() { var element = doc.body || doc.documentElement, transEndEventNames = { WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', OTransition: 'oTransitionEnd otransitionend', transition: 'transitionend' }, name; for (name in transEndEventNames) { if (element.style[name] !== undefined) return transEndEventNames[name]; } }()); return transitionEnd && { end: transitionEnd }; })(); UI.support.animation = (function() { var animationEnd = (function() { var element = doc.body || doc.documentElement, animEndEventNames = { WebkitAnimation: 'webkitAnimationEnd', MozAnimation: 'animationend', OAnimation: 'oAnimationEnd oanimationend', animation: 'animationend' }, name; for (name in animEndEventNames) { if (element.style[name] !== undefined) return animEndEventNames[name]; } }()); return animationEnd && { end: animationEnd }; })(); UI.support.requestAnimationFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.msRequestAnimationFrame || global.oRequestAnimationFrame || function(callback){ global.setTimeout(callback, 1000/60); }; UI.support.touch = ( ('ontouchstart' in window && navigator.userAgent.toLowerCase().match(/mobile|tablet/)) || (global.DocumentTouch && document instanceof global.DocumentTouch) || (global.navigator['msPointerEnabled'] && global.navigator['msMaxTouchPoints'] > 0) || //IE 10 (global.navigator['pointerEnabled'] && global.navigator['maxTouchPoints'] > 0) || //IE >=11 false ); UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || global.MozMutationObserver || null); UI.Utils = {}; UI.Utils.debounce = function(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; UI.Utils.removeCssRules = function(selectorRegEx) { var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref; if(!selectorRegEx) return; setTimeout(function(){ try { _ref = document.styleSheets; for (_i = 0, _len = _ref.length; _i < _len; _i++) { stylesheet = _ref[_i]; idxs = []; stylesheet.cssRules = stylesheet.cssRules; for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) { if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) { idxs.unshift(idx); } } for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) { stylesheet.deleteRule(idxs[_k]); } } } catch (_error) {} }, 0); }; UI.Utils.isInView = function(element, options) { var $element = $(element); if (!$element.is(':visible')) { return false; } var window_left = $win.scrollLeft(), window_top = $win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top; options = $.extend({topoffset:0, leftoffset:0}, options); if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() && left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) { return true; } else { return false; } }; UI.Utils.options = function(string) { if ($.isPlainObject(string)) return string; var start = (string ? string.indexOf("{") : -1), options = {}; if (start != -1) { try { options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))(); } catch (e) {} } return options; }; UI.Utils.template = function(str, data) { var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g), i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0; while(i < tokens.length) { toc = tokens[i]; if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) { i = i + 1; toc = tokens[i]; cmd = toc[0]; prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0); switch(cmd) { case '~': output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];"); openblocks++; break; case ':': output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];"); openblocks++; break; case '#': output.push("if("+prop+") {"); openblocks++; break; case '^': output.push("if(!"+prop+") {"); openblocks++; break; case '/': output.push("}"); openblocks--; break; case '!': output.push("__ret.push("+prop+");"); break; default: output.push("__ret.push(escape("+prop+"));"); break; } } else { output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');"); } i = i + 1; } fn = [ 'var __ret = [];', 'try {', 'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};', '}catch(e){__ret = [e.message];}', 'return __ret.join("").replace(/\\n\\n/g, "\\n");', "function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(//g, '>');}" ].join("\n"); var func = new Function('$data', fn); return data ? func(data) : func; }; UI.Utils.events = {}; UI.Utils.events.click = UI.support.touch ? 'tap' : 'click'; $.UIkit = UI; $.fn.uk = UI.fn; $.UIkit.langdirection = $html.attr("dir") == "rtl" ? "right" : "left"; $(function(){ $(doc).trigger("uk-domready"); // Check for dom modifications if(!UI.support.mutationobserver) return; var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) { $(doc).trigger("uk-domready"); }, 300)); // pass in the target node, as well as the observer options observer.observe(document.body, { childList: true, subtree: true }); // remove css hover rules for touch devices if (UI.support.touch) { UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/); } }); // add touch identifier class $html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch"); return UI; }); (function($, UI) { "use strict"; var win = $(window), event = 'resize orientationchange'; var StackMargin = function(element, options) { var $this = this, $element = $(element); if($element.data("stackMargin")) return; this.element = $element; this.columns = this.element.children(); this.options = $.extend({}, StackMargin.defaults, options); if (!this.columns.length) return; win.on(event, (function() { var fn = function() { $this.process(); }; $(function() { fn(); win.on("load", fn); }); return UI.Utils.debounce(fn, 150); })()); $(document).on("uk-domready", function(e) { $this.columns = $this.element.children(); $this.process(); }); this.element.data("stackMargin", this); }; $.extend(StackMargin.prototype, { process: function() { var $this = this; this.revert(); var skip = false, firstvisible = this.columns.filter(":visible:first"), offset = firstvisible.length ? firstvisible.offset().top : false; if (offset === false) return; this.columns.each(function() { var column = $(this); if (column.is(":visible")) { if (skip) { column.addClass($this.options.cls); } else { if (column.offset().top != offset) { column.addClass($this.options.cls); skip = true; } } } }); return this; }, revert: function() { this.columns.removeClass(this.options.cls); return this; } }); StackMargin.defaults = { 'cls': 'uk-margin-small-top' }; UI["stackMargin"] = StackMargin; // init code $(document).on("uk-domready", function(e) { $("[data-uk-margin]").each(function() { var ele = $(this), obj; if (!ele.data("stackMargin")) { obj = new StackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin"))); } }); }); })(jQuery, jQuery.UIkit); // Based on Zeptos touch.js // https://raw.github.com/madrobby/zepto/master/src/touch.js // Zepto.js may be freely distributed under the MIT license. ;(function($){ var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture; function swipeDirection(x1, x2, y1, y2) { return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down'); } function longTap() { longTapTimeout = null; if (touch.last) { touch.el.trigger('longTap'); touch = {}; } } function cancelLongTap() { if (longTapTimeout) clearTimeout(longTapTimeout); longTapTimeout = null; } function cancelAll() { if (touchTimeout) clearTimeout(touchTimeout); if (tapTimeout) clearTimeout(tapTimeout); if (swipeTimeout) clearTimeout(swipeTimeout); if (longTapTimeout) clearTimeout(longTapTimeout); touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null; touch = {}; } function isPrimaryTouch(event){ return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary; } $(function(){ var now, delta, deltaX = 0, deltaY = 0, firstTouch; if ('MSGesture' in window) { gesture = new MSGesture(); gesture.target = document.body; } $(document) .bind('MSGestureEnd', function(e){ var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null; if (swipeDirectionFromVelocity) { touch.el.trigger('swipe'); touch.el.trigger('swipe'+ swipeDirectionFromVelocity); } }) .on('touchstart MSPointerDown', function(e){ if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return; firstTouch = e.type == 'MSPointerDown' ? e : e.originalEvent.touches[0]; now = Date.now(); delta = now - (touch.last || now); touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode); if(touchTimeout) clearTimeout(touchTimeout); touch.x1 = firstTouch.pageX; touch.y1 = firstTouch.pageY; if (delta > 0 && delta <= 250) touch.isDoubleTap = true; touch.last = now; longTapTimeout = setTimeout(longTap, longTapDelay); // adds the current touch contact for IE gesture recognition if (gesture && e.type == 'MSPointerDown') gesture.addPointer(e.originalEvent.pointerId); }) .on('touchmove MSPointerMove', function(e){ if(e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return; firstTouch = e.type == 'MSPointerMove' ? e : e.originalEvent.touches[0]; cancelLongTap(); touch.x2 = firstTouch.pageX; touch.y2 = firstTouch.pageY; deltaX += Math.abs(touch.x1 - touch.x2); deltaY += Math.abs(touch.y1 - touch.y2); }) .on('touchend MSPointerUp', function(e){ if(e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return; cancelLongTap(); // swipe if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){ swipeTimeout = setTimeout(function() { touch.el.trigger('swipe'); touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))); touch = {}; }, 0); // normal tap } else if ('last' in touch) { // don't fire tap when delta position changed by more than 30 pixels, // for instance when moving to a point and back to origin if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) { // delay by one tick so we can cancel the 'tap' event if 'scroll' fires // ('tap' fires before 'scroll') tapTimeout = setTimeout(function() { // trigger universal 'tap' with the option to cancelTouch() // (cancelTouch cancels processing of single vs double taps for faster 'tap' response) var event = $.Event('tap'); event.cancelTouch = cancelAll; touch.el.trigger(event); // trigger double tap immediately if (touch.isDoubleTap) { touch.el.trigger('doubleTap'); touch = {}; } // trigger single tap after 250ms of inactivity else { touchTimeout = setTimeout(function(){ touchTimeout = null; touch.el.trigger('singleTap'); touch = {}; }, 250); } }, 0); } else { touch = {}; } deltaX = deltaY = 0; } }) // when the browser window loses focus, // for example when a modal dialog is shown, // cancel all ongoing events .on('touchcancel MSPointerCancel', cancelAll); // scrolling the window indicates intention of the user // to scroll, not tap or swipe, so cancel all ongoing events $(window).on('scroll', cancelAll); }); ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){ $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); }; }); })(jQuery); (function($, UI) { "use strict"; var Alert = function(element, options) { var $this = this; this.options = $.extend({}, Alert.defaults, options); this.element = $(element); if(this.element.data("alert")) return; this.element.on("click", this.options.trigger, function(e) { e.preventDefault(); $this.close(); }); this.element.data("alert", this); }; $.extend(Alert.prototype, { close: function() { var element = this.element.trigger("close"); if (this.options.fade) { element.css("overflow", "hidden").css("max-height", element.height()).animate({ "height": 0, "opacity": 0, "padding-top": 0, "padding-bottom": 0, "margin-top": 0, "margin-bottom": 0 }, this.options.duration, removeElement); } else { removeElement(); } function removeElement() { element.trigger("closed").remove(); } } }); Alert.defaults = { "fade": true, "duration": 200, "trigger": ".uk-alert-close" }; UI["alert"] = Alert; // init code $(document).on("click.alert.uikit", "[data-uk-alert]", function(e) { var ele = $(this); if (!ele.data("alert")) { var alert = new Alert(ele, UI.Utils.options(ele.data("uk-alert"))); if ($(e.target).is(ele.data("alert").options.trigger)) { e.preventDefault(); alert.close(); } } }); })(jQuery, jQuery.UIkit); (function($, UI) { "use strict"; var ButtonRadio = function(element, options) { var $this = this, $element = $(element); if($element.data("buttonRadio")) return; this.options = $.extend({}, ButtonRadio.defaults, options); this.element = $element.on("click", this.options.target, function(e) { e.preventDefault(); $element.find($this.options.target).not(this).removeClass("uk-active").blur(); $element.trigger("change", [$(this).addClass("uk-active")]); }); this.element.data("buttonRadio", this); }; $.extend(ButtonRadio.prototype, { getSelected: function() { this.element.find(".uk-active"); } }); ButtonRadio.defaults = { "target": ".uk-button" }; var ButtonCheckbox = function(element, options) { var $element = $(element); if($element.data("buttonCheckbox")) return; this.options = $.extend({}, ButtonCheckbox.defaults, options); this.element = $element.on("click", this.options.target, function(e) { e.preventDefault(); $element.trigger("change", [$(this).toggleClass("uk-active").blur()]); }); this.element.data("buttonCheckbox", this); }; $.extend(ButtonCheckbox.prototype, { getSelected: function() { this.element.find(".uk-active"); } }); ButtonCheckbox.defaults = { "target": ".uk-button" }; var Button = function(element, options) { var $this = this, $element = $(element); if($element.data("button")) return; this.options = $.extend({}, Button.defaults, options); this.element = $element.on("click", function(e) { e.preventDefault(); $this.toggle(); $element.trigger("change", [$element.blur().hasClass("uk-active")]); }); this.element.data("button", this); }; $.extend(Button.prototype, { options: {}, toggle: function() { this.element.toggleClass("uk-active"); } }); Button.defaults = {}; UI["button"] = Button; UI["buttonCheckbox"] = ButtonCheckbox; UI["buttonRadio"] = ButtonRadio; // init code $(document).on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) { var ele = $(this); if (!ele.data("buttonRadio")) { var obj = new ButtonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))); if ($(e.target).is(obj.options.target)) { $(e.target).trigger("click"); } } }); $(document).on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) { var ele = $(this); if (!ele.data("buttonCheckbox")) { var obj = new ButtonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))); if ($(e.target).is(obj.options.target)) { $(e.target).trigger("click"); } } }); $(document).on("click.button.uikit", "[data-uk-button]", function(e) { var ele = $(this); if (!ele.data("button")) { var obj = new Button(ele, ele.attr("data-uk-button")); ele.trigger("click"); } }); })(jQuery, jQuery.UIkit); (function($, UI) { "use strict"; var active = false, Dropdown = function(element, options) { var $this = this, $element = $(element); if($element.data("dropdown")) return; this.options = $.extend({}, Dropdown.defaults, options); this.element = $element; this.dropdown = this.element.find(".uk-dropdown"); this.centered = this.dropdown.hasClass("uk-dropdown-center"); this.justified = this.options.justify ? $(this.options.justify) : false; this.boundary = $(this.options.boundary); if(!this.boundary.length) { this.boundary = $(window); } if (this.options.mode == "click" || UI.support.touch) { this.element.on("click", function(e) { var $target = $(e.target); if (!$target.parents(".uk-dropdown").length) { if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){ e.preventDefault(); } $target.blur(); } if (!$this.element.hasClass("uk-open")) { $this.show(); } else { if ($target.is("a") || !$this.element.find(".uk-dropdown").find(e.target).length) { $this.element.removeClass("uk-open"); active = false; } } }); } else { this.element.on("mouseenter", function(e) { if ($this.remainIdle) { clearTimeout($this.remainIdle); } $this.show(); }).on("mouseleave", function() { $this.remainIdle = setTimeout(function() { $this.element.removeClass("uk-open"); $this.remainIdle = false; if (active && active[0] == $this.element[0]) active = false; }, $this.options.remaintime); }); } this.element.data("dropdown", this); }; $.extend(Dropdown.prototype, { remainIdle: false, show: function(){ if (active && active[0] != this.element[0]) { active.removeClass("uk-open"); } this.checkDimensions(); this.element.addClass("uk-open"); active = this.element; this.registerOuterClick(); }, registerOuterClick: function(){ var $this = this; $(document).off("click.outer.dropdown"); setTimeout(function() { $(document).on("click.outer.dropdown", function(e) { if (active && active[0] == $this.element[0] && ($(e.target).is("a") || !$this.element.find(".uk-dropdown").find(e.target).length)) { active.removeClass("uk-open"); $(document).off("click.outer.dropdown"); } }); }, 10); }, checkDimensions: function() { if(!this.dropdown.length) return; var dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, "").css("min-width", ""), offset = dropdown.show().offset(), width = dropdown.outerWidth(), boundarywidth = this.boundary.width(), boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0; // centered dropdown if (this.centered) { dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1); offset = dropdown.offset(); // reset dropdown if ((width + offset.left) > boundarywidth || offset.left < 0) { dropdown.css("margin-" + $.UIkit.langdirection, ""); offset = dropdown.offset(); } } // justify dropdown if (this.justified && this.justified.length) { var jwidth = this.justified.outerWidth(); dropdown.css("min-width", jwidth); if ($.UIkit.langdirection == 'right') { var right1 = boundarywidth - (this.justified.offset().left + jwidth), right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth()); dropdown.css("margin-right", right1 - right2); } else { dropdown.css("margin-left", this.justified.offset().left - offset.left); } offset = dropdown.offset(); } if ((width + (offset.left-boundaryoffset)) > boundarywidth) { dropdown.addClass("uk-dropdown-flip"); offset = dropdown.offset(); } if (offset.left < 0) { dropdown.addClass("uk-dropdown-stack"); } dropdown.css("display", ""); } }); Dropdown.defaults = { "mode": "hover", "remaintime": 800, "justify": false, "boundary": $(window) }; UI["dropdown"] = Dropdown; var triggerevent = UI.support.touch ? "click":"mouseenter"; // init code $(document).on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) { var ele = $(this); if (!ele.data("dropdown")) { var dropdown = new Dropdown(ele, UI.Utils.options(ele.data("uk-dropdown"))); if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) { dropdown.show(); } if(dropdown.element.find('.uk-dropdown').length) { e.preventDefault(); } } }); })(jQuery, jQuery.UIkit); (function($, UI) { "use strict"; var win = $(window), event = 'resize orientationchange'; var GridMatchHeight = function(element, options) { var $this = this, $element = $(element); if($element.data("gridMatchHeight")) return; this.options = $.extend({}, GridMatchHeight.defaults, options); this.element = $element; this.columns = this.element.children(); this.elements = this.options.target ? this.element.find(this.options.target) : this.columns; if (!this.columns.length) return; win.on(event, (function() { var fn = function() { $this.match(); }; $(function() { fn(); win.on("load", fn); }); return UI.Utils.debounce(fn, 150); })()); $(document).on("uk-domready", function(e) { $this.columns = $this.element.children(); $this.elements = $this.options.target ? $this.element.find($this.options.target) : $this.columns; $this.match(); }); this.element.data("gridMatchHeight", this); }; $.extend(GridMatchHeight.prototype, { match: function() { this.revert(); var firstvisible = this.columns.filter(":visible:first"); if (!firstvisible.length) return; var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false, max = 0, $this = this; if (stacked) return; if(this.options.row) { this.element.width(); // force redraw setTimeout(function(){ var lastoffset = false, group = []; $this.elements.each(function(i) { var ele = $(this), offset = ele.offset().top; if(offset != lastoffset && group.length) { $this.matchHeights($(group)); group = []; offset = ele.offset().top; } group.push(ele); lastoffset = offset; }); if(group.length) { $this.matchHeights($(group)); } }, 0); } else { this.matchHeights(this.elements); } return this; }, revert: function() { this.elements.css('min-height', ''); return this; }, matchHeights: function(elements){ if(elements.length < 2) return; var max = 0; elements.each(function() { max = Math.max(max, $(this).outerHeight()); }).each(function(i) { var element = $(this), height = max - (element.outerHeight() - element.height()); element.css('min-height', height + 'px'); }); } }); GridMatchHeight.defaults = { "target" : false, "row" : false }; var GridMargin = function(element, options) { var $element = $(element); if($element.data("gridMargin")) return; this.options = $.extend({}, GridMargin.defaults, options); var stackMargin = new UI.stackMargin($element, this.options); $element.data("gridMargin", stackMargin); }; GridMargin.defaults = { cls: 'uk-grid-margin' }; UI["gridMatchHeight"] = GridMatchHeight; UI["gridMargin"] = GridMargin; // init code $(document).on("uk-domready", function(e) { $("[data-uk-grid-match],[data-uk-grid-margin]").each(function() { var grid = $(this), obj; if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatchHeight")) { obj = new GridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match"))); } if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) { obj = new GridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin"))); } }); }); })(jQuery, jQuery.UIkit); (function($, UI, $win) { "use strict"; var active = false, html = $("html"), Modal = function(element, options) { var $this = this; this.element = $(element); this.options = $.extend({}, Modal.defaults, options); this.transition = UI.support.transition; this.dialog = this.element.find(".uk-modal-dialog"); this.scrollable = (function(){ var scrollable = $this.dialog.find('.uk-overflow-container:first'); return scrollable.length ? scrollable : false; })(); this.element.on("click", ".uk-modal-close", function(e) { e.preventDefault(); $this.hide(); }).on("click", function(e) { var target = $(e.target); if (target[0] == $this.element[0] && $this.options.bgclose) { $this.hide(); } }); }; $.extend(Modal.prototype, { scrollable: false, transition: false, toggle: function() { return this[this.isActive() ? "hide" : "show"](); }, show: function() { var $this = this; if (this.isActive()) return; if (active) active.hide(true); this.element.removeClass("uk-open").show(); this.resize(); active = this; html.addClass("uk-modal-page").height(); // force browser engine redraw this.element.addClass("uk-open").trigger("uk.modal.show"); return this; }, hide: function(force) { if (!this.isActive()) return; if (!force && UI.support.transition) { var $this = this; this.element.one(UI.support.transition.end, function() { $this._hide(); }).removeClass("uk-open"); } else { this._hide(); } return this; }, resize: function() { var paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left"); this.scrollbarwidth = window.innerWidth - html.width(); html.css(paddingdir, this.scrollbarwidth); this.element.css(paddingdir, ""); if (this.dialog.offset().left > this.scrollbarwidth) { this.element.css(paddingdir, this.scrollbarwidth); } if (this.scrollable) { this.scrollable.css("height", 0); var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)), dh = this.dialog.outerHeight(), wh = window.innerHeight, h = wh - 2*(offset < 20 ? 20:offset) - dh; this.scrollable.css("height", h < this.options.minScrollHeight ? "":h); } }, _hide: function() { this.element.hide().removeClass("uk-open"); html.removeClass("uk-modal-page").css("padding-" + (UI.langdirection == 'left' ? "right":"left"), ""); if(active===this) active = false; this.element.trigger("uk.modal.hide"); }, isActive: function() { return (active == this); } }); Modal.dialog = { tpl : '