|
117 | 117 | }
|
118 | 118 | });
|
119 | 119 |
|
120 |
| - // functions that can be called via $(el).timeago('action') |
121 |
| - // init is default when no action is given |
122 |
| - // functions are called with context of a single element |
123 |
| - var functions = { |
124 |
| - init: function(){ |
125 |
| - var refresh_el = $.proxy(refresh, this); |
126 |
| - refresh_el(); |
127 |
| - var $s = $t.settings; |
128 |
| - if ($s.refreshMillis > 0) { |
129 |
| - setInterval(refresh_el, $s.refreshMillis); |
130 |
| - } |
131 |
| - }, |
132 |
| - update: function(time){ |
133 |
| - $(this).data('timeago', { datetime: $t.parse(time) }); |
134 |
| - refresh.apply(this); |
| 120 | + // functions that can be called via $(el).timeago('action') |
| 121 | + // init is default when no action is given |
| 122 | + // functions are called with context of a single element |
| 123 | + var functions = { |
| 124 | + init: function(){ |
| 125 | + var refresh_el = $.proxy(refresh, this); |
| 126 | + refresh_el(); |
| 127 | + var $s = $t.settings; |
| 128 | + if ($s.refreshMillis > 0) { |
| 129 | + setInterval(refresh_el, $s.refreshMillis); |
135 | 130 | }
|
136 |
| - }; |
| 131 | + }, |
| 132 | + update: function(time){ |
| 133 | + $(this).data('timeago', { datetime: $t.parse(time) }); |
| 134 | + refresh.apply(this); |
| 135 | + } |
| 136 | + }; |
137 | 137 |
|
138 |
| - $.fn.timeago = function(action, options) { |
139 |
| - var fn = action ? functions[action] : functions.init; |
140 |
| - if(!fn){ |
141 |
| - throw new Error("Unknown function name '"+ action +"' for timeago"); |
142 |
| - } |
143 |
| - // each over objects here and call the requested function |
144 |
| - this.each(function(){ |
145 |
| - fn.call(this, options); |
146 |
| - }); |
147 |
| - return this; |
148 |
| - }; |
| 138 | + $.fn.timeago = function(action, options) { |
| 139 | + var fn = action ? functions[action] : functions.init; |
| 140 | + if(!fn){ |
| 141 | + throw new Error("Unknown function name '"+ action +"' for timeago"); |
| 142 | + } |
| 143 | + // each over objects here and call the requested function |
| 144 | + this.each(function(){ |
| 145 | + fn.call(this, options); |
| 146 | + }); |
| 147 | + return this; |
| 148 | + }; |
149 | 149 |
|
150 | 150 | function refresh() {
|
151 | 151 | var data = prepareData(this);
|
|
0 commit comments