!function(o,m){function e(t,a){var e=t.data("livestampdata");"number"==typeof a&&(a*=1e3),t.removeAttr("data-livestamp").removeData("livestamp"),a=m(a),m.isMoment(a)&&!isNaN(+a)&&((e=o.extend({},{original:t.contents()},e)).moment=m(a),t.data("livestampdata",e).empty(),n.push(t[0]))}var a=1e3,t=!1,n=o([]),i=function(){t||(r.update(),setTimeout(i,a))},r={update:function(){o("[data-livestamp]").each(function(){var t=o(this);e(t,t.data("livestamp"))});var i=[];n.each(function(){var t,a,e=o(this),n=e.data("livestampdata");void 0===n?i.push(this):!m.isMoment(n.moment)||(t=e.html())!=(a=n.moment.fromNow())&&(n=o.Event("change.livestamp"),e.trigger(n,[t,a]),n.isDefaultPrevented()||e.html(a))}),n=n.not(i)},pause:function(){t=!0},resume:function(){t=!1,i()},interval:function(t){if(void 0===t)return a;a=t}},s={add:function(t,a){return"number"==typeof a&&(a*=1e3),a=m(a),m.isMoment(a)&&!isNaN(+a)&&(t.each(function(){e(o(this),a)}),r.update()),t},destroy:function(e){return n=n.not(e),e.each(function(){var t=o(this),a=t.data("livestampdata");if(void 0===a)return e;t.html(a.original||"").removeData("livestampdata")}),e},isLivestamp:function(t){return void 0!==t.data("livestampdata")}};o.livestamp=r,o(function(){r.resume()}),o.fn.livestamp=function(t,a){return s[t]||(a=t,t="add"),s[t](this,a)}}(jQuery,moment);