From ee1c1b39b29fbad948068f93b2a0eeb537ef456c Mon Sep 17 00:00:00 2001
From: Joas Schilling <coding@schilljs.com>
Date: Wed, 31 Aug 2016 17:33:00 +0200
Subject: [PATCH] Update live timestamps to give a more live feeling

---
 apps/files/js/filelist.js | 3 ++-
 core/js/js.js             | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index ca41012764a..7584362317c 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1202,8 +1202,9 @@
 			}
 			td = $('<td></td>').attr({ "class": "date" });
 			td.append($('<span></span>').attr({
-				"class": "modified",
+				"class": "modified live-relative-timestamp",
 				"title": formatted,
+				"data-timestamp": mtime,
 				"style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')'
 			}).text(text)
 			  .tooltip({placement: 'top'})
diff --git a/core/js/js.js b/core/js/js.js
index 799d2ba0b24..a123846a72e 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1660,6 +1660,13 @@ function initCore() {
 		$('body').delegate('#app-content', 'apprendered appresized', adjustControlsWidth);
 
 	}
+
+	// Update live timestamps every 30 seconds
+	setInterval(function() {
+		$('.live-relative-timestamp').each(function() {
+			$(this).text(OC.Util.relativeModifiedDate(parseInt($(this).attr('data-timestamp'), 10)));
+		});
+	}, 30 * 1000);
 }
 
 $(document).ready(initCore);
-- 
GitLab