This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
forked from guserIln/validate_emails
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tinytools.progressbar.min.js
8 lines (8 loc) · 2.45 KB
/
tinytools.progressbar.min.js
1
2
3
4
5
6
7
8
/*!
ProgressBar 1.0.3 - 2015-02-04
jQuery Tiny Progress Bar
(c) 2015, http://tinytools.codesells.com
license: http://www.opensource.org/licenses/mit-license.php
*/
(function(n,t,i){function h(t){return n.extend({initializing:!0,percent:0,width:!1,height:!1,split:1,backSplitLineColor:"#999",foreSplitLineColor:"#ddd",showPercent:!0,onPercentChanged:!1},t)}function u(n){return n.closest(".ProgressBar").data("settings")}function c(t,r){var o=h({}),u;o=n.extend(o,s);r=n.extend(o,r);n(t).addClass("ProgressBar");u='<p class="BackProgressBarPercent">50%<\/p>';u+='<canvas class="BackCanvas"><\/canvas>';u+='<div class="Bar">';u+='<p class="ForeProgressBarPercent">50%<\/p>';u+='<canvas class="ForeCanvas"><\/canvas>';u+="<\/div>";n(t).append(u);n(t).data("settings",r);r.width!=!1?n(t).css("width",r.width):n(t).width()==0&&n(t).css("width","200px");r.height!=!1?n(t).css("height",r.height):n(t).height()==0&&n(t).css("height","20px");n(t).children(".Bar").height(n(t).height());n(t).find("p").css("line-height",n(t).height().toString()+"px");n(t).find("canvas").prop("height",n(t).height().toString());e(n(t),r.percent);r.initializing=undefined;n(t).data("settings",r);n(i).resize(function(){n(t).find("p").css("width",n(t).width().toString()+"px");n(t).find("canvas").prop("width",n(t).width().toString());f(n(t).find(".BackCanvas"),r.backSplitLineColor,r.split);f(n(t).find(".ForeCanvas"),r.foreSplitLineColor,r.split)}).resize()}function f(n,t,i){var u,r,f;if(i>1)for(u=n.get(0),r=u.getContext("2d"),r.clearRect(0,0,u.width,u.height),r.strokeStyle=t,r.lineWidth=1,f=1;f<i;f++)r.beginPath(),r.moveTo(u.width/i*f,0),r.lineTo(u.width/i*f,u.height),r.stroke(),r.closePath()}function e(t,i){var r=u(n(t)),f;n(t).hasClass("ProgressBar")&&(f=Math.min(Math.max(i,0),100).toString()+"%",n(t).children(".Bar").css("width",f),n(t).find("p").text(r.showPercent==!0?f:""),r.initializing==undefined&&(r.percent=i,n(t).data("settings",r),o(r.onPercentChanged,i,t)))}function o(t,i,r){n.isFunction(t)&&t.call(undefined,i,r)}var r="progressBar",s;n.progressBar||(publicMethod=n.fn[r]=n[r]=function(n){var t=n;return this.each(function(n,i){c(i,t)})},n.fn.changePercent=function(n){e(this,n)},n.fn.getPercent=function(){return".ProgressBar".first().data("settings").percent},publicMethod.getSettings=function(n){return n.closest(".ProgressBar").data("settings")},publicMethod.percentChanged=function(n,t){o(u(t).onPercentChanged,n,t)})})(jQuery,document,window);
//# sourceMappingURL=tinytools.progressbar.min.js.map