1(function($) { 2 $.fn.multitabs = function() { 3 var _this = $(this); 4 var tabs = _this.children('.tab__header[data-child="false"]').children('div'); 5 var childrenTabs = _this.find('.tab__header[data-child="true"]').children('div'); 6 7 $(tabs).add(childrenTabs).on('click', function() { 8 var num; 9 var _this = $(this); 10 var classNameTab = _this.attr('class').split(' '); 11 var classNameContent = _this.parent().siblings().children(); 12 13 for (i = 0; i <= classNameTab.length; i++) { 14 if (/([\d.]+)/.test(classNameTab[i])) { 15 var isChild = $(_this).parent().data('child'); 16 num = classNameTab[i].split('-')[1]; 17 18 if (!isChild) { 19 $(tabs).removeClass('tab__header--active'); 20 $(_this).addClass('tab__header--active'); 21 } else { 22 $(_this).siblings().removeClass('tab__header--active'); 23 $(_this).addClass('tab__header--active'); 24 } 25 26 } 27 } 28 29 $(classNameContent).each(function(i, n) { 30 var name = $(n).attr('class').split(' '); 31 for (n = 0; n <= name.length; n++) { 32 if (name[n] != undefined) { 33 if (/([\d.]+)/.test(name[n])) { 34 if (num === name[n].split('-')[1]) { 35 var el = $(classNameContent)[num - 1]; 36 $(classNameContent).removeClass('tab__content--active'); 37 $(el).addClass('tab__content--active'); 38 } 39 } 40 } 41 } 42 }); 43 44 }); 45 46 } 47})(jQuery);
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.