Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minified with closure compiler;

  • Loading branch information...
commit e06ebf1614550ddce293581513443ad23ac2955e 1 parent 9b023e8
@christophercliff authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 jquery.sausage.min.js
View
6 jquery.sausage.min.js
@@ -0,0 +1,6 @@
+(function(e){e.widget("cc.sausage",{options:{page:".page",content:function(a){return'<span class="sausage-span">'+(a+1)+"</span>"}},_create:function(){var a=this.element;this.$outer=a;this.$inner=e.isWindow(this.element.get(0))?e("body"):a.children(":first-child");this.$sausages=e('<div class="sausage-set"/>');this.sausages=this.$sausages.get(0);this.offsets=[];this.$sausages.appendTo(this.$inner);this._trigger("create")},_init:function(){this.$outer.height()>=this.$inner.height()?this.destroy():
+(this.draw(),this._update(),this._events(),this._delegates(),this.$sausages.addClass("sausage-set-init"),this.blocked=!1,this._trigger("init"))},_events:function(){var a=this;a.hasScrolled=!1;a.$outer.bind("resize.sausage",function(){a.draw()}).bind("scroll.sausage",function(){a.hasScrolled=!0});setInterval(function(){if(a.hasScrolled)a.hasScrolled=!1,a._update()},250)},_getCurrent:function(){var a=this.$outer.scrollTop()+this._getHandleHeight(this.$outer,this.$inner)/4;this.$outer.height();this.$inner.height();
+var b=0;for(l=this.offsets.length;b<l;b++)if(this.offsets[b+1])if(a<=this.offsets[b])break;else{if(a>this.offsets[b]&&a<=this.offsets[b+1])break}else break;return b},_delegates:function(){var a=this;a.$sausages.delegate(".sausage","hover",function(){a.blocked||e(this).toggleClass("sausage-hover")}).delegate(".sausage","click",function(b){b.preventDefault();if(!a.blocked){var d=e(this),f=d.index(),k=a.$inner.find(a.options.page).eq(f).offset().top;a._scrollTo(k);a._trigger("onClick",b,{$sausage:d,
+i:f});d.hasClass("current")||a._trigger("onUpdate",b,{$sausage:d,i:f})}})},_scrollTo:function(a){var b=this.$outer,d=Math.abs((this.offsets[this.current]-a)/2),d=d<1E3?d:1E3;this.$outer.get(0)===window&&(b=e("body, html, document"));b.stop(!0).animate({scrollTop:a},d)},_handleClick:function(){},_update:function(){i=this._getCurrent();c="sausage-current";if(!(i===this.current||this.blocked))this.current=i,this.$sausages.children().eq(i).addClass(c).siblings().removeClass(c),this._trigger("update")},
+_getHandleHeight:function(a,b){var d=a.height(),f=b.height();return d/f*d},draw:function(){var a=this.$outer.height(),b=this.$inner.height(),d=this.$inner.find(this.options.page),f,e=[],h,j;this.offsets=[];this.count=d.length;this.$sausages.detach().empty();for(var g=0;g<this.count;g++)f=d.eq(g),h=f.offset(),j=h.top/b*a,e.push('<div class="sausage'+(g===this.current?" sausage-current":"")+'" style="height:'+f.outerHeight()/b*a+"px;top:"+j+'px;">'+this.options.content(g,f)+"</div>"),this.offsets.push(h.top);
+this.sausages.innerHTML=e.join("");this.$sausages.appendTo(this.$inner)},block:function(){this.blocked=!0;this.$sausages.addClass("sausage-set-blocked")},unblock:function(){this.$sausages.removeClass("sausage-set-blocked");this.blocked=!1},destroy:function(){this.$outer.unbind(".sausage");this.$sausages.remove()}})})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.