PageSourceSearch

https://www.relocationsrs.com.mx/wp-content/themes/specular/js/jquery.easy-pie-chart.js?ver=1

js relocationsrs.com.mx collected 2026-10-03 01:56:38 UTC 6,472 bytes, 189 lines download raw bytes

1// Generated by CoffeeScript 1.4.0
2
3/*
4Easy pie chart is a jquery plugin to display simple animated pie charts for only one value
5
6Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
7and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
8
9Built on top of the jQuery library (http://jquery.com)
10
11@source: http://github.com/rendro/easy-pie-chart/
12@autor: Robert Fleischmann
13@version: 1.0.1
14
15Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210
16Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script
17*/
18
19
20(function() {
21
22  (function($) {
23    $.easyPieChart = function(el, options) {
24      var addScaleLine, animateLine, drawLine, easeInOutQuad, renderBackground, renderScale, renderTrack,
25        _this = this;
26      this.el = el;
27      this.$el = $(el);
28      this.$el.data("easyPieChart", this);
29      this.init = function() {
30        var percent;
31        _this.options = $.extend({}, $.easyPieChart.defaultOptions, options);
32        percent = parseInt(_this.$el.data('percent'), 10);
33        _this.percentage = 0;
34        _this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0);
35        _this.$el.append(_this.canvas);
36        if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) {
37          G_vmlCanvasManager.initElement(_this.canvas);
38        }
39        _this.ctx = _this.canvas.getContext('2d');
40        if (window.devicePixelRatio > 1.5) {
41          $(_this.canvas).css({
42            width: _this.options.size,
43            height: _this.options.size
44          });
45          _this.canvas.width *= 2;
46          _this.canvas.height *= 2;
47          _this.ctx.scale(2, 2);
48        }
49        _this.ctx.translate(_this.options.size / 2, _this.options.size / 2);
50        _this.$el.addClass('easyPieChart');
51        _this.$el.css({
52          width: _this.options.size,
53          height: _this.options.size,
54          lineHeight: "" + _this.options.size + "px"
55        });
56        _this.update(percent);
57        return _this;
58      };
59      this.update = function(percent) {
60        if (_this.options.animate === false) {
61          return drawLine(percent);
62        } else {
63          return animateLine(_this.percentage, percent);
64        }
65      };
66      renderScale = function() {
67        var i, _i, _results;
68        _this.ctx.fillStyle = _this.options.scaleColor;
69        _this.ctx.lineWidth = 1;
70        _results = [];
71        for (i = _i = 0; _i <= 24; i = ++_i) {
72          _results.push(addScaleLine(i));
73        }
74        return _results;
75      };
76      addScaleLine = function(i) {
77        var offset;
78        offset = i % 6 === 0 ? 0 : _this.options.size * 0.017;
79        _this.ctx.save();
80        _this.ctx.rotate(i * Math.PI / 12);
81        _this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1);
82        return _this.ctx.restore();
83      };
84      renderTrack = function() {
85        var offset;
86        offset = _this.options.size / 2 - _this.options.lineWidth / 2;
87        if (_this.options.scaleColor !== false) {
88          offset -= _this.options.size * 0.08;
89        }
90        _this.ctx.beginPath();
91        _this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true);
92        _this.ctx.closePath();
93        _this.ctx.strokeStyle = _this.options.trackColor;
94        _this.ctx.lineWidth = _this.options.lineWidth;
95        return _this.ctx.stroke();
96      };
97      renderBackground = function() {
98        if (_this.options.scaleColor !== false) {
99          renderScale();
100        }
101        if (_this.options.trackColor !== false) {
102          return renderTrack();
103        }
104      };
105      drawLine = function(percent) {
106        var offset;
107        renderBackground();
108        var grd=_this.ctx.createLinearGradient(0,0,170,0);
109        grd.addColorStop(0,_this.options.barColor);
110        grd.addColorStop(1,_this.options.barColor2);
111        _this.ctx.strokeStyle = grd;
112        _this.ctx.lineCap = _this.options.lineCap;
113        _this.ctx.lineWidth = _this.options.lineWidth;
114        offset = _this.options.size / 2 - _this.options.lineWidth / 2;
115        if (_this.options.scaleColor !== false) {
116          offset -= _this.options.size * 0.08;
117        }
118        _this.ctx.save();
119        _this.ctx.rotate(-Math.PI / 2);
120        _this.ctx.beginPath();
121        _this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false);
122        _this.ctx.stroke();
123        return _this.ctx.restore();
124      };
125      animateLine = function(from, to) {
126        var currentStep, fps, steps;
127        fps = 30;
128        steps = fps * _this.options.animate / 1000;
129        currentStep = 0;
130        _this.options.onStart.call(_this);
131        _this.percentage = to;
132        if (_this.animation) {
133          clearInterval(_this.animation);
134          _this.animation = false;
135        }
136        return _this.animation = setInterval(function() {
137          _this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size);
138          renderBackground.call(_this);
139          drawLine.call(_this, [easeInOutQuad(currentStep, from, to - from, steps)]);
140          currentStep++;
141          if ((currentStep / steps) > 1) {
142            clearInterval(_this.animation);
143            _this.animation = false;
144            return _this.options.onStop.call(_this);
145          }
146        }, 1000 / fps);
147      };
148      easeInOutQuad = function(t, b, c, d) {
149        var easeIn, easing;
150        easeIn = function(t) {
151          return Math.pow(t, 2);
152        };
153        easing = function(t) {
154          if (t < 1) {
155            return easeIn(t);
156          } else {
157            return 2 - easeIn((t / 2) * -2 + 2);
158          }
159        };
160        t /= d / 2;
161        return c / 2 * easing(t) + b;
162      };
163      return this.init();
164    };
165    $.easyPieChart.defaultOptions = {
166      barColor: '#ef1e25',
167      barColor2: '#ef1e25',
168      trackColor: '#f2f2f2',
169      scaleColor: '#dfe0e0',
170      lineCap: 'round',
171      size: 110,
172      lineWidth: 3,
173      animate: false,
174      onStart: $.noop,
175      onStop: $.noop
176    };
177    $.fn.easyPieChart = function(options) {
178      return $.each(this, function(i, el) {
179        var $el;
180        $el = $(el);
181        if (!$el.data('easyPieChart')) {
182          return $el.data('easyPieChart', new $.easyPieChart(el, options));
183        }
184      });
185    };
186    return void 0;
187  })(jQuery);
188
189}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.