From db45de9bae0840ac04d768c7a5a2928339cf4d6e Mon Sep 17 00:00:00 2001 From: gvasu Date: Sun, 14 Jul 2013 14:07:33 -0700 Subject: [PATCH 1/3] Automate Work / Break Cycle Give the users a choice in preferences section (called 'auto mode') which makes the extension to go in a work / break loop. This removes the need to manually intervene to flip the work/break switch. To Do: International strings. I have updated only locales\EN. Future Improvements: 1) This option wont work well with Notifications. users won't see notifications because we dismiss them on onStart when the next cycle begins. Users may potentially notice notification appear and disappear in a flash. This is minor annoyance or sometimes un-noticeable. We can potentially uncheck Notifications, When Auto-Mode is set. 2) I haven't addressed when the work / break loop expires. This will go on in a loop. The user has to uncheck auto-mode option to break out of the loop. --- _locales/en/messages.json | 4 ++++ background.js | 10 ++++++++++ options.html | 4 ++++ options.js | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d244cdd..bae82c0 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -70,6 +70,10 @@ "message": "Ring when a timer finishes (audio)", "description": "On the options page, label for the checkbox that enables/disables ringing sound at the end of a timer" }, + "options_auto_mode": { + "message": "Alternate between work and break cycles automatically", + "description": "On the options page, label for the checkbox that enables/disables automatic flipping between work and break modes" + }, "options_click_restarts": { "message": "Clicking on a running timer restarts it", "description": "On the options page, label for the checkbox that enables/disables the feature that clicking on a running timer restarts it" diff --git a/background.js b/background.js index d09ff79..ddec5f6 100644 --- a/background.js +++ b/background.js @@ -318,6 +318,16 @@ var notification, mainPomodoro = new Pomodoro({ console.log("playing ring", RING); RING.play(); } + + // If auto-mode is set, restart the cycle by calling start + // Note: If this is set, users won't see notifications because we + // dismissthem on onStart at Line 344. Users may potentially notice + // notification appear and disappear in a flash. + // To Do: International strings + if(PREFS.autoMode) { + mainPomodoro.start(); + } + }, onStart: function (timer) { chrome.browserAction.setIcon({ diff --git a/options.html b/options.html index d97ca87..638d9b2 100644 --- a/options.html +++ b/options.html @@ -135,6 +135,10 @@

+
+ + +