1;(function ($, window, document, undefined) { 2 'use strict'; 3 4 var settings = { 5 callback: $.noop, 6 deep_linking: true, 7 init: false 8 }, 9 10 methods = { 11 init : function (options) { 12 settings = $.extend({}, settings, options); 13 14 return this.each(function () { 15 if (!settings.init) methods.events(); 16 17 if (settings.deep_linking) methods.from_hash(); 18 }); 19 }, 20 21 events : function () { 22 $(document).on('click.fndtn', '.tabs a', function (e) { 23 methods.set_tab($(this).parent('dd, li'), e); 24 }); 25 26 settings.init = true; 27 }, 28 29 set_tab : function ($tab, e) { 30 var $activeTab = $tab.closest('dl, ul').find('.active'), 31 target = $tab.children('a').attr("href"), 32 hasHash = /^#/.test(target), 33 $content = $(target + 'Tab'); 34 35 if (hasHash && $content.length > 0) { 36 // Show tab content 37 if (e && !settings.deep_linking) e.preventDefault(); 38 $content.closest('.tabs-content').children('li').removeClass('active').hide(); 39 $content.css('display', 'block').addClass('active'); 40 } 41 42 // Make active tab 43 $activeTab.removeClass('active'); 44 $tab.addClass('active'); 45 46 settings.callback(); 47 }, 48 49 from_hash : function () { 50 var hash = window.location.hash, 51 $tab = $('a[href="' + hash + '"]'); 52 53 $tab.trigger('click.fndtn'); 54 } 55 } 56 57 $.fn.foundationTabs = function (method) { 58 if (methods[method]) { 59 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 60 } else if (typeof method === 'object' || !method) { 61 return methods.init.apply(this, arguments); 62 } else { 63 $.error('Method ' + method + ' does not exist on jQuery.foundationTabs'); 64 } 65 }; 66}(jQuery, this, this.document));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.