Realigned whitespace
This commit is contained in:
parent
fcca1b70e2
commit
c499fe9a9d
1 changed files with 27 additions and 27 deletions
|
@ -117,35 +117,35 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// functions that can be called via $(el).timeago('action')
|
// functions that can be called via $(el).timeago('action')
|
||||||
// init is default when no action is given
|
// init is default when no action is given
|
||||||
// functions are called with context of a single element
|
// functions are called with context of a single element
|
||||||
var functions = {
|
var functions = {
|
||||||
init: function(){
|
init: function(){
|
||||||
var refresh_el = $.proxy(refresh, this);
|
var refresh_el = $.proxy(refresh, this);
|
||||||
refresh_el();
|
refresh_el();
|
||||||
var $s = $t.settings;
|
var $s = $t.settings;
|
||||||
if ($s.refreshMillis > 0) {
|
if ($s.refreshMillis > 0) {
|
||||||
setInterval(refresh_el, $s.refreshMillis);
|
setInterval(refresh_el, $s.refreshMillis);
|
||||||
}
|
|
||||||
},
|
|
||||||
update: function(time){
|
|
||||||
$(this).data('timeago', { datetime: $t.parse(time) });
|
|
||||||
refresh.apply(this);
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
update: function(time){
|
||||||
|
$(this).data('timeago', { datetime: $t.parse(time) });
|
||||||
|
refresh.apply(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$.fn.timeago = function(action, options) {
|
$.fn.timeago = function(action, options) {
|
||||||
var fn = action ? functions[action] : functions.init;
|
var fn = action ? functions[action] : functions.init;
|
||||||
if(!fn){
|
if(!fn){
|
||||||
throw new Error("Unknown function name '"+ action +"' for timeago");
|
throw new Error("Unknown function name '"+ action +"' for timeago");
|
||||||
}
|
}
|
||||||
// each over objects here and call the requested function
|
// each over objects here and call the requested function
|
||||||
this.each(function(){
|
this.each(function(){
|
||||||
fn.call(this, options);
|
fn.call(this, options);
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
var data = prepareData(this);
|
var data = prepareData(this);
|
||||||
|
|
Reference in a new issue