diff --git a/src/www/index.html b/src/www/index.html index 455647c..2d2e626 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -30,6 +30,12 @@

Next Actions (unsorted)

+
+ +

Configuration

@@ -63,7 +69,7 @@
-
+

diff --git a/src/www/js/personal-display.js b/src/www/js/personal-display.js index b930dd1..41e1fe2 100644 --- a/src/www/js/personal-display.js +++ b/src/www/js/personal-display.js @@ -146,7 +146,7 @@ $(".category-name").parent().remove(); _.forEach(PD.gtdCfg.categories, this.makeCategoryItem); } - this.$el.find('.refresh').val( + this.$el.find('.refresh-period').val( PD.refreshPeriod ? PD.refreshPeriod / 1000 : 15); this.$el.fadeIn(); }, @@ -322,7 +322,7 @@ function(span) { return $(span).text(); }); // Save global data - PD.refreshPeriod = parseInt(this.$el.find(".refresh").val()) * 1000; + PD.refreshPeriod = parseInt(this.$el.find(".refresh-period").val()) * 1000; if (PD.hasHTML5LocalStorage()) { localStorage.setItem("tsCfg", JSON.stringify(PD.tsCfg)); @@ -337,9 +337,13 @@ PD.Main = Backbone.View.extend({ el: $("body"), + events: { + "click a.refresh" : "refresh" + "click a.pause-continue" : "toggleSync" }, + initialize: function() { - _.bindAll(this, "refresh"); + _.bindAll(this, "refresh", "toggleSync"); // Create our config dialog view. PD.configDialog = new PD.ConfigDialog(); @@ -366,7 +370,7 @@ this.refresh(); // Schedule future refreshes. - setInterval(this.refresh, PD.refreshPeriod ? PD.refreshPeriod : 15000); + PD.refreshIntervalId = setInterval(this.refresh, PD.refreshPeriod ? PD.refreshPeriod : 15000); }, refresh: function() { @@ -492,7 +496,17 @@ collection.remove(model); }}); } }); - } + }, + + toggleSync: function() { + if (PD.refreshIntervalId == null) { + PD.refreshIntervalId = setInterval(this.refresh, + PD.refreshPeriod ? PD.refreshPeriod : 15000); + $('.pause-continue').text('Pause Monitoring'); } + else { + clearInterval(PD.refreshIntervalId); + PD.refreshIntervalId = null; + $('.pause-continue').text('Resume Monitoring'); } } }); PD.main = new PD.Main();