diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d244cdd..f893399 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -78,6 +78,14 @@ "message": "By the strictness philosophy, the only way to cancel a running timer is to disable the extension.", "description": "On the options page, note below the label for the click-restarts checkbox explaining that this will not allow users to *cancel* a running timer" }, + "options_autostart_work": { + "message": "Automatically start a work timer once the break is over", + "description": "On the options page, label for the checkbox that enables/disables starting a work timer automatically once the break is over" + }, + "options_autostart_break": { + "message": "Automatically start a break timer once the pomodoro is over", + "description": "On the options page, label for the checkbox that enables/disables starting a break timer automatically once the pomodoro is over" + }, "options_save_changes": { "message": "Save changes", "description": "On the options page, text for the submit button" diff --git a/background.js b/background.js index d09ff79..605ff87 100644 --- a/background.js +++ b/background.js @@ -37,6 +37,8 @@ function defaultPrefs() { }, shouldRing: true, clickRestarts: false, + autostartWork: false, + autostartBreak: true, whitelist: false } } @@ -297,8 +299,8 @@ var notification, mainPomodoro = new Pomodoro({ }); chrome.browserAction.setBadgeText({text: ''}); + var nextModeName = chrome.i18n.getMessage(timer.pomodoro.nextMode); if(PREFS.showNotifications) { - var nextModeName = chrome.i18n.getMessage(timer.pomodoro.nextMode); notification = webkitNotifications.createNotification( ICONS.FULL[timer.type], chrome.i18n.getMessage("timer_end_notification_header"), @@ -318,6 +320,14 @@ var notification, mainPomodoro = new Pomodoro({ console.log("playing ring", RING); RING.play(); } + + if(nextModeName == 'break' && PREFS.autostartBreak) { + mainPomodoro.start(); + } + + if(nextModeName == 'work' && PREFS.autostartWork) { + mainPomodoro.start(); + } }, onStart: function (timer) { chrome.browserAction.setIcon({ @@ -331,7 +341,7 @@ var notification, mainPomodoro = new Pomodoro({ } else { executeInAllBlockedTabs('unblock'); } - if(notification) notification.cancel(); + if(notification) setTimeout(function(){notification.cancel();}, '10000'); var tabViews = chrome.extension.getViews({type: 'tab'}), tab; for(var i in tabViews) { tab = tabViews[i]; diff --git a/manifest.json b/manifest.json index ed779f5..9c82fc8 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,7 @@ "name": "__MSG_ext_name__", "options_page": "options.html", "permissions": [ "notifications", "tabs", "" ], - "version": "1.6.1", + "version": "1.6.2", "web_accessible_resources": [ "icons/work_full.png", "icons/break_full.png" diff --git a/options.html b/options.html index d97ca87..3dbda09 100644 --- a/options.html +++ b/options.html @@ -135,6 +135,14 @@

+
+ + +
+
+ + +