killbill-assets-ui 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,76 @@
1
+ // Generated by CoffeeScript 1.6.3
2
+ /*
3
+ jQuery Spin
4
+ Copyright 2014 Kevin Sylvestre
5
+ 1.1.6
6
+ */
7
+
8
+
9
+ (function() {
10
+ "use strict";
11
+ var $, Spinner;
12
+
13
+ $ = jQuery;
14
+
15
+ Spinner = (function() {
16
+ Spinner.prototype.defaults = {
17
+ petals: 9
18
+ };
19
+
20
+ function Spinner($element, options) {
21
+ this.$element = $element;
22
+ this.options = $.extend({}, this.defaults, options);
23
+ this.configure();
24
+ }
25
+
26
+ Spinner.prototype.show = function() {
27
+ return this.$element.animate({
28
+ opacity: 1.0
29
+ });
30
+ };
31
+
32
+ Spinner.prototype.hide = function() {
33
+ return this.$element.animate({
34
+ opacity: 0.0
35
+ });
36
+ };
37
+
38
+ Spinner.prototype.destroy = function() {
39
+ this.$element.empty();
40
+ return this.$element.data('spin', void 0);
41
+ };
42
+
43
+ Spinner.prototype.configure = function() {
44
+ var $petal, i, _i, _ref, _results;
45
+ this.$element.empty();
46
+ _results = [];
47
+ for (i = _i = 0, _ref = this.options.petals; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
48
+ $petal = $("<div />");
49
+ _results.push(this.$element.append($petal));
50
+ }
51
+ return _results;
52
+ };
53
+
54
+ return Spinner;
55
+
56
+ })();
57
+
58
+ $.fn.spin = function(options) {
59
+ return $(this).each(function() {
60
+ var $this, spinner;
61
+ $this = $(this);
62
+ spinner = $this.data('spinner');
63
+ if (spinner == null) {
64
+ $this.data('spinner', spinner = new Spinner($this, options));
65
+ }
66
+ if (typeof options === 'string') {
67
+ return spinner[options]();
68
+ }
69
+ });
70
+ };
71
+
72
+ $(function() {
73
+ return $('[data-spin]').spin();
74
+ });
75
+
76
+ }).call(this);