Sha256: a2e01adcd11c4b27b17ebf8b4bbb58e533d0a2e7d6edf59da072905a632f2e90
Contents?: true
Size: 918 Bytes
Versions: 5
Compression:
Stored size: 918 Bytes
Contents
(() => { 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')); }); 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
5 entries across 5 versions & 1 rubygems