!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(),r.push(t[0]))}function t(){n||(i.update(),setTimeout(t,a))}var a=1e3,n=!1,r=o([]),i={update:function(){o("[data-livestamp]").each(function(){var t=o(this);e(t,t.data("livestamp"))});var i=[];r.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())!=(n=n.moment.fromNow())&&(a=o.Event("change.livestamp"),e.trigger(a,[t,n]),a.isDefaultPrevented()||e.html(n))}),r=r.not(i)},pause:function(){n=!0},resume:function(){n=!1,t()},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)}),i.update()),t},destroy:function(e){return r=r.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=i,o(function(){i.resume()}),o.fn.livestamp=function(t,a){return s[t]||(a=t,t="add"),s[t](this,a)}}(jQuery,moment);