﻿/**
* jquery.tabs 0.10. Best JavaScript tabs there is.
* 
* http://flowplayer.org/tools/tabs.html
*
* Copyright (c) 2008 Tero Piirainen (support@flowplayer.org)
*
* Released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
* 
* Since  : 0.10 - Nov 1 2008
* Version: 0.10 - Wed Nov 05 2008 12:03:23 GMT-0000 (GMT+00:00)
*/
(function($) { function Tabs(tabs, panes, opts) { var self = this; var current = 0; $.extend(this, { click: function(i) { var tab = tabs.eq(i); if (typeof i == 'string') { tab = tabs.filter("[href=" + i + "]"); i = tabs.index(tab); } if (!tab.length) { return self; } if (opts.onBeforeClick && opts.onBeforeClick.call(self, i) === false) { return false; } if (!opts.onClick || opts.onClick.call(self, i) !== false) { this.getPanes().hide().eq(i).show(); } tabs.removeClass(opts.current); tab.addClass(opts.current); current = i; return self; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); } }); tabs.each(function(i) { $(this).click(function(e) { self.click(i); return e.preventDefault(); }); if (location.hash && ($(this).attr("href") == location.hash)) { self.click(i); } }); if (!panes.filter(":visible").length) { this.click(0); } } $.prototype.tabs = function(query, arg) { if (!query || typeof query == 'number') { return this.eq(query || 0).data("tabs"); } var opts = { tabs: 'a', current: 'current', onBeforeClick: null, onClick: null }; if ($.isFunction(arg)) { arg = { onBeforeClick: arg }; } $.extend(opts, arg); this.each(function() { var tabs = new Tabs($(this).find(opts.tabs), $(query), opts); $(this).data("tabs", tabs); }); return this; }; })(jQuery);
