vendor/assets/javascripts/uikit/core/tab.js in uikit2-rails-0.1.9 vs vendor/assets/javascripts/uikit/core/tab.js in uikit2-rails-0.1.10

- old
+ new

@@ -1,32 +1,32 @@ -/*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(UI) { "use strict"; UI.component('tab', { defaults: { - 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)', - 'connect' : false, - 'active' : 0, - 'animation' : false, - 'duration' : 200, - 'swiping' : true + target : '>li:not(.uk-tab-responsive, .uk-disabled)', + connect : false, + active : 0, + animation : false, + duration : 200, + swiping : true }, boot: function() { // init code UI.ready(function(context) { - UI.$("[data-uk-tab]", context).each(function() { + UI.$('[data-uk-tab]', context).each(function() { var tab = UI.$(this); - if (!tab.data("tab")) { - var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab"))); + if (!tab.data('tab')) { + var obj = UI.tab(tab, UI.Utils.options(tab.attr('data-uk-tab'))); } }); }); }, @@ -34,23 +34,23 @@ var $this = this; this.current = false; - this.on("click.uk.tab", this.options.target, function(e) { + this.on('click.uk.tab', this.options.target, function(e) { e.preventDefault(); if ($this.switcher && $this.switcher.animating) { return; } var current = $this.find($this.options.target).not(this); - current.removeClass("uk-active").blur(); + current.removeClass('uk-active').blur(); - $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]); + $this.trigger('change.uk.tab', [UI.$(this).addClass('uk-active'), $this.current]); $this.current = UI.$(this); // Update ARIA if (!$this.options.connect) { @@ -68,11 +68,11 @@ this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown'); this.responsivetab.lst = this.responsivetab.dropdown.find('ul'); this.responsivetab.caption = this.responsivetab.find('a:first'); - if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up"); + if (this.element.hasClass('uk-tab-bottom')) this.responsivetab.dropdown.addClass('uk-dropdown-up'); // handle click this.responsivetab.lst.on('click.uk.tab', 'a', function(e) { e.preventDefault(); @@ -89,33 +89,34 @@ this.element.append(this.responsivetab); // init UIkit components if (this.options.connect) { + this.switcher = UI.switcher(this.element, { - 'toggle' : '>li:not(.uk-tab-responsive)', - 'connect' : this.options.connect, - 'active' : this.options.active, - 'animation' : this.options.animation, - 'duration' : this.options.duration, - 'swiping' : this.options.swiping + toggle : '>li:not(.uk-tab-responsive)', + connect : this.options.connect, + active : this.options.active, + animation : this.options.animation, + duration : this.options.duration, + swiping : this.options.swiping }); } - UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"}); + UI.dropdown(this.responsivetab, {mode: 'click', preventflip: 'y'}); // init - $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]); + $this.trigger('change.uk.tab', [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]); this.check(); UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){ - if ($this.element.is(":visible")) $this.check(); + if ($this.element.is(':visible')) $this.check(); }, 100)); this.on('display.uk.check', function(){ - if ($this.element.is(":visible")) $this.check(); + if ($this.element.is(':visible')) $this.check(); }); }, check: function() { @@ -148,10 +149,11 @@ if (item.css('float') != 'none' && !item.attr('uk-dropdown')) { if (!item.hasClass('uk-disabled')) { - clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" '); + clone = UI.$(item[0].outerHTML); + clone.find('a').data('index', i); this.responsivetab.lst.append(clone); } item.addClass('uk-hidden');