1var jTabs; 2 3(function($){ 4 function setDefaults(name, value, hash){ 5 if(hash[name] === undefined) hash[name] = value; 6 } 7 8 jTabs = function(tabs, contents, options){ 9 var root = this; 10 11 this.construct = function (tabs, contents, options) { 12 13 options = options || {}; 14 setDefaults('startIndex', 0, options); 15 setDefaults('activeClass', 'active', options); 16 setDefaults('windowClass', 'contentsWindow', options); 17 setDefaults('fps', '120', options); 18 setDefaults('duration', '100', options); 19 setDefaults('transition', 'expo:in:out', options); 20 setDefaults('autoPlay', false, options); 21 setDefaults('autoPlayWait', 10000, options); 22 23 // this.setOptions(options); 24 root.options = options; 25 26 root.tabsElement = tabs[0]; 27 root.contentsElement = contents[0]; 28 root.tabsList = $(root.tabsElement).children('div'); 29 root.contentsList = $(root.contentsElement).children('div'); 30 // this.slideFx = new Fx.Morph(this.contentsElement, { 31 // fps : this.options.fps, 32 // duration: this.options.duration, 33 // transition: this.options.transition 34 //}); 35 root.windowWidth = $(root.contentsList[0]).width(); 36 root.currentPosition = -(root.options.startIndex * root.windowWidth); 37 $(root.contentsElement).css('left', root.currentPosition + 'px'); 38 root.currentIndex = root.options.startIndex; 39 root.tabsCount = root.tabsList.length; 40 root.activeTab = $(root.tabsList[root.currentIndex]).addClass(root.options.activeClass); 41 root.activeContents = $(root.contentsList[root.currentIndex]).addClass(root.options.activeClass); 42 // console.log(this.tabsCount); 43 $(root.tabsList).each(function(i, tab) { 44 // console.log(i); 45 // console.log(tab); 46 setupTabs($(tab), $(root.contentsList[i]), i); 47 }); 48 }; 49 50 var setupTabs = function(tab, contents, i) { 51 tab.on('mousedown', function(e) { 52 if (tab != root.activeTab) { 53 root.activeTab.removeClass(root.options.activeClass); 54 root.activeTab = tab; 55 root.activeTab.addClass(root.options.activeClass); 56 57 root.activeContents.removeClass(root.options.activeClass); 58 root.activeContents = contents; 59 root.activeContents.addClass(root.options.activeClass); 60 root.currentIndex = i; 61 // jQuery(this).change([tab, contents]); 62 } 63 }); 64 } 65 66 this.nextSlide = function (){ 67 if (root.currentIndex == root.tabsCount-1) { 68 $(root.tabsList[0]).mousedown(); 69 } else { 70 $(root.tabsList[root.currentIndex+1]).mousedown(); 71 } 72 return root; 73 }; 74 75 this.previousSlide = function () { 76 if (root.currentIndex == 0) $(root.tabsList[root.tabsCount-1]).mousedown(); 77 else $(root.tabsList[root.currentIndex-1]).mousedown(); 78 return root; 79 }; 80 81 return this.construct(tabs, contents, options); 82 }; 83})(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.