summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/header.html.tmpl1
-rw-r--r--extensions/BugModal/web/bug_modal.js13
2 files changed, 12 insertions, 2 deletions
diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
index 84efbd077..48064f06c 100644
--- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
@@ -60,6 +60,7 @@
jquery.push(
"datetimepicker",
"contextMenu",
+ "visibility"
);
style_urls.push(
"extensions/BugModal/web/bug_modal.css",
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index e0ef40a13..6c10c6fb0 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -51,7 +51,16 @@ $(function() {
'use strict';
// update relative dates
- window.setInterval(function() {
+ var relative_timer_duration = 60000;
+ var relative_timer_id = window.setInterval(relativeTimer, relative_timer_duration);
+ $(document).on('show.visibility', function() {
+ relative_timer_id = window.setInterval(relativeTimer, relative_timer_duration)
+ });
+ $(document).on('hide.visibility', function() {
+ window.clearInterval(relative_timer_id);
+ });
+
+ function relativeTimer() {
var now = Math.floor(new Date().getTime() / 1000);
$('.rel-time').each(function() {
$(this).text(timeAgo(now - $(this).data('time')));
@@ -59,7 +68,7 @@ $(function() {
$('.rel-time-title').each(function() {
$(this).attr('title', timeAgo(now - $(this).data('time')));
});
- }, 60000);
+ }
// all keywords for autocompletion (lazy-loaded on edit)
var keywords = [];