Sha256: 101a3774fd4145309d5af27debd6b9e3bffeb04e91025dcc2c68f4b57390d729
Contents?: true
Size: 971 Bytes
Versions: 6
Compression:
Stored size: 971 Bytes
Contents
//= require thredded/core/thredded (() => { const COMPONENT_SELECTOR = '#thredded--container [data-time-ago]'; const Thredded = window.Thredded; if ('timeago' in window) { const timeago = window.timeago; Thredded.onPageLoad(() => { const threddedContainer = document.querySelector('#thredded--container'); if (!threddedContainer) return; timeago().render( document.querySelectorAll(COMPONENT_SELECTOR), threddedContainer.getAttribute('data-thredded-locale').replace('-', '_')); }); document.addEventListener('turbolinks:before-cache', () => { timeago.cancel(); }); } else if ('jQuery' in window && 'timeago' in jQuery.fn) { const $ = window.jQuery; Thredded.onPageLoad(() => { const allowFutureWas = $.timeago.settings.allowFuture; $.timeago.settings.allowFuture = true; $(COMPONENT_SELECTOR).timeago(); $.timeago.settings.allowFuture = allowFutureWas; }); } })();
Version data entries
6 entries across 6 versions & 1 rubygems