This repository has been archived by the owner on Nov 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
plusTabs.min.js
10 lines (10 loc) · 2.03 KB
/
plusTabs.min.js
1
2
3
4
5
6
7
8
9
10
/*!
* plusTabs version 1.0
* Author: Jason Day @iamjasonday
* (c) 2012, Jason Day
* Dual licensed under the MIT and GPL licenses
*/
(function(d){var g={init:function(b){void 0===b&&(b={});b=d.extend({},d.fn.plusTabs.defaults,b);return this.each(function(){function g(){var a="";!0===e.showCount&&(a=" ("+c.tabs("length")+")");f.find("li").hide();f.find("li.ui-state-active").show();0==c.find("li.seeMore").length?f.append("<li class='ui-state-default ui-corner-top seeMore'><a href='javascript: void(0);'>"+e.expandIcon+e.seeMoreText+a+"</a></li>"):c.find("li.seeMore").show();a=d(".seeMore").outerWidth();a=j-a-e.sizeTweak;f.find("li.ui-state-active").css("width",
a);var b=f.outerHeight(),a=c.find(".allTabs");a.css({top:b,width:e.dropWidth});a.find("a").removeClass("highlight");b=f.find("li.ui-state-active a").text();a=a.find('a:contains("'+b+'")');c.find(a).addClass("highlight")}var e=b,c=d(this);""!=e.className&&c.addClass(e.className);c.tabs();var f=c.find(".ui-tabs-nav"),j=c.outerWidth(),i=0;f.find("li").each(function(a,b){i+=d(b).outerWidth()});if(!0===e.seeMore&&i>=j){var k=d('<div class="allTabs" />').appendTo(c);f.find("a").clone().click(function(a){a.preventDefault();
c.tabs("select",d(this).index());g();c.find(".allTabs").slideUp("fast")}).appendTo(k);g()}var h=c.find(".allTabs");c.find(".seeMore a").click(function(){clearTimeout(timeout);h.slideDown();timeout=setTimeout(function(){h.slideUp();clearTimeout(timeout)},3E3)});c.find(".seeMore a").keydown(function(a){13===a.which&&h.find("a:first").focus()});h.mouseenter(function(){clearTimeout(timeout)});h.mouseleave(function(){clearTimeout(timeout);var a=d(this);timeout=setTimeout(function(){a.slideUp()},1E3)})})}};
d.fn.plusTabs=function(b){if(g[b])return g[b].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof b||!b)return g.init.apply(this,arguments);d.error("Method "+b+" does not exist on $.plusTabs")};d.fn.plusTabs.defaults={className:"plusTabs",seeMore:!0,seeMoreText:"More",showCount:!1,expandIcon:"▼ ",dropWidth:"66%",sizeTweak:0}})(jQuery);