-
Notifications
You must be signed in to change notification settings - Fork 24
/
jquery.ba-peenmeter.min.js
9 lines (9 loc) · 1.01 KB
/
jquery.ba-peenmeter.min.js
1
2
3
4
5
6
7
8
9
/*
* jQuery peenMeter: Eight Equals Equals Dee - v1.0 - 2/19/2010
* http://peenmeter.com/
*
* Copyright (c) 2010 "Boycow" Ben Analman
* Dual licensed under the MIT and GPL licenses.
* http://github.com/cowboy/jquery-peenmeter/
*/
(function($){var a,b;$.peenMeterHTML=b=function(d){a=d};b('<span class="peen"><span class="balls">8</span><span class="shaft">=</span><span class="head">D</span><span class="jizz">~</span><span class="pct"></span></span>');$.fn.peenMeter=function(e,d){e=isNaN(e)?0:parseInt(Math.max(0,Math.min(100,e)));d=d||a;return this.each(function(){var h=$(this),s=h.html("").width(),p=$(d).css("white-space","pre").appendTo(h),l=p.children(".shaft"),k=p.children(".jizz"),q=p.children(".pct"),i=l.html(),g=k.html(),j,m;function n(){return p.width()}function r(t){l.html(c(i,t))}function f(t){k.html(c(g,t))}function o(){r();f()}q.html(e+"%");o();j=-n();r(1);j+=n();m=-n();f(1);m+=n();o();r((s-n())*e/100/j);f((s-n())/m)})};function c(e,d){return Array(parseInt(isNaN(d)?0:Math.max(0,d))+1).join(e)}})(jQuery);