Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ var notification, mainPomodoro = new Pomodoro({
console.log("playing ring", RING);
RING.play();
}

// If auto-mode is set, restart the cycle by calling start
// To Do: International strings
if(PREFS.autoMode) {
setTimeout(function(){mainPomodoro.start();}, 30000);
}

},
onStart: function (timer) {
chrome.browserAction.setIcon({
Expand Down
4 changes: 4 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ <h1 data-i18n="options_title"></h1>
<input id="should-ring" type="checkbox" />
<label for="should-ring" data-i18n="options_should_ring"></label>
</div>
<div>
<input id="auto-mode" type="checkbox" />
<label for="auto-mode" data-i18n="options_auto_mode"></label>
</div>
<div>
<input id="click-restarts" type="checkbox" />
<label for="click-restarts">
Expand Down
4 changes: 4 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var form = document.getElementById('options-form'),
whitelistEl = document.getElementById('blacklist-or-whitelist'),
showNotificationsEl = document.getElementById('show-notifications'),
shouldRingEl = document.getElementById('should-ring'),
autoModeEl = document.getElementById('auto-mode'),
clickRestartsEl = document.getElementById('click-restarts'),
saveSuccessfulEl = document.getElementById('save-successful'),
timeFormatErrorEl = document.getElementById('time-format-error'),
Expand Down Expand Up @@ -62,6 +63,7 @@ form.onsubmit = function () {
durations: durations,
showNotifications: showNotificationsEl.checked,
shouldRing: shouldRingEl.checked,
autoMode: autoModeEl.checked,
clickRestarts: clickRestartsEl.checked,
whitelist: whitelistEl.selectedIndex == 1
})
Expand All @@ -72,6 +74,7 @@ form.onsubmit = function () {
siteListEl.onfocus = formAltered;
showNotificationsEl.onchange = formAltered;
shouldRingEl.onchange = formAltered;
autoModeEl.onchange = formAltered;
clickRestartsEl.onchange = formAltered;
whitelistEl.onchange = formAltered;

Expand All @@ -83,6 +86,7 @@ function formAltered() {
siteListEl.value = background.PREFS.siteList.join("\n");
showNotificationsEl.checked = background.PREFS.showNotifications;
shouldRingEl.checked = background.PREFS.shouldRing;
autoModeEl.checked = background.PREFS.autoMode;
clickRestartsEl.checked = background.PREFS.clickRestarts;
whitelistEl.selectedIndex = background.PREFS.whitelist ? 1 : 0;

Expand Down