vendor/assets/javascripts/uikit.js in uikit2-rails-0.1.8 vs vendor/assets/javascripts/uikit.js in uikit2-rails-0.1.9

- old
+ new

@@ -1,6 +1,6 @@ -/*! UIkit 2.26.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(core) { if (typeof define == "function" && define.amd) { // AMD define("uikit", function(){ @@ -42,11 +42,11 @@ "use strict"; var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined; - UI.version = '2.26.2'; + UI.version = '2.26.3'; UI.noConflict = function() { // restore UIkit version if (_UI) { global.UIkit = _UI; @@ -179,10 +179,23 @@ timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; + UI.Utils.throttle = function (func, limit) { + var wait = false; + return function () { + if (!wait) { + func.call(); + wait = true; + setTimeout(function () { + wait = false; + }, limit); + } + } + }; + UI.Utils.removeCssRules = function(selectorRegEx) { var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref; if(!selectorRegEx) return; @@ -2573,13 +2586,11 @@ if (target[0] == $this.element[0] && $this.options.bgclose) { $this.hide(); } }); - UI.domObserve(this.element, function(e) { - $this.resize(); - }); + UI.domObserve(this.element, function(e) { $this.resize(); }); }, toggle: function() { return this[this.isActive() ? "hide" : "show"](); }, @@ -2595,11 +2606,11 @@ if (this.options.modal && active) { active.hide(true); } this.element.removeClass("uk-open").show(); - this.resize(); + this.resize(true); if (this.options.modal) { active = this; } @@ -2644,12 +2655,14 @@ } return this; }, - resize: function() { + resize: function(force) { + if (!this.isActive() && !force) return; + var bodywidth = body.width(); this.scrollbarwidth = window.innerWidth - bodywidth; body.css(this.paddingdir, this.scrollbarwidth); @@ -2708,16 +2721,16 @@ if (!activeCount) { $html.removeClass('uk-modal-page'); body.css(this.paddingdir, ""); } - if(active===this) active = false; + if (active===this) active = false; this.trigger('hide.uk.modal'); }, isActive: function() { - return this.active; + return this.element.hasClass('uk-open'); } }); UI.component('modalTrigger', {