From 4f950113ca2d9247bccaa1ed2c4c28c7acea61d5 Mon Sep 17 00:00:00 2001 From: Shane O'Grady Date: Sun, 16 Oct 2016 18:59:42 -0200 Subject: [PATCH] Update the fuzzy timestamps during polling (#3193) The timestamps were not updated during live polling since cd3d18b81e9bd81fdbec440adb0d6709128c412a. This causes the timestamps to be updated with fuzzy timestamp text when live polling is turned on. --- web/assets/javascripts/application.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/assets/javascripts/application.js b/web/assets/javascripts/application.js index 779e16a8..75b260ea 100755 --- a/web/assets/javascripts/application.js +++ b/web/assets/javascripts/application.js @@ -39,16 +39,20 @@ $(function() { $($(this).attr('data-target')).toggle(); }); - var locale = $('body').data('locale'); + updateFuzzyTimes($('body').data('locale')); +}); + +function updateFuzzyTimes(locale) { var parts = locale.split('-'); if (typeof parts[1] !== 'undefined') { parts[1] = parts[1].toUpperCase(); locale = parts.join('_'); } + var t = timeago() t.render(document.querySelectorAll('time'), locale); t.cancel(); -}); +} function updatePage(url) { setInterval(function () { @@ -63,10 +67,14 @@ function updatePage(url) { var $header_status = $data.find('.status') $('.status').replaceWith($header_status) + + updateFuzzyTimes($('body').data('locale')); }) }, parseInt(localStorage.timeInterval) || 2000); } + + $(function() { 'use strict';