From aa2f9ad94621666dff5ea4b103325f05d54438b0 Mon Sep 17 00:00:00 2001 From: professor-k Date: Thu, 12 Apr 2012 21:32:32 +0300 Subject: [PATCH 1/2] Automatic mode added --- _locales/en/messages.json | 4 ++++ _locales/ru/messages.json | 4 ++++ _locales/uk/messages.json | 4 ++++ background.js | 7 +++++++ options.html | 4 ++++ options.js | 4 ++++ 6 files changed, 27 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 046461f..099fa36 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -78,6 +78,10 @@ "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_auto_mode": { + "message": "Will trigger timer automatically on browser launch and at the end of pause.", + "description": "On the options page, label for the checkbox that enables/disables the automcatic mode" + }, "options_save_changes": { "message": "Save changes", "description": "On the options page, text for the submit button" diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 96fa4d2..9657b87 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -70,6 +70,10 @@ "message": "Согласно строгим правилам, единственным способом остановки бегущего счетчика является отключение расширения.", "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_auto_mode": { + "message": "Автоматически запускать счетчик при запуске браузера и после паузы.", + "description": "On the options page, label for the checkbox that enables/disables the automcatic mode" + }, "options_save_changes": { "message": "Сохранить изменения", "description": "On the options page, text for the submit button" diff --git a/_locales/uk/messages.json b/_locales/uk/messages.json index ef048a0..45e1cb2 100644 --- a/_locales/uk/messages.json +++ b/_locales/uk/messages.json @@ -70,6 +70,10 @@ "message": "У відповідності до суворих правил, єдиним способом зупинки лічильника є відключення розширення.", "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_auto_mode": { + "message": "Автоматично запускати лічильник при запуску браузера і по завершенні паузи.", + "description": "On the options page, label for the checkbox that enables/disables the automcatic mode" + }, "options_save_changes": { "message": "Зберегти зміни", "description": "On the options page, text for the submit button" diff --git a/background.js b/background.js index 460bae1..f51bdf1 100644 --- a/background.js +++ b/background.js @@ -313,6 +313,10 @@ var notification, mainPomodoro = new Pomodoro({ console.log("playing ring", RING); RING.play(); } + + if(timer.pomodoro.nextMode == 'work' && PREFS.autoMode) { + timer.pomodoro.start(); + } }, onStart: function (timer) { chrome.browserAction.setIcon({ @@ -357,3 +361,6 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { } }); +if(PREFS.autoMode) { + mainPomodoro.start(); +} diff --git a/options.html b/options.html index 65e55ec..12c7e80 100644 --- a/options.html +++ b/options.html @@ -147,6 +147,10 @@

+
+ + +
diff --git a/options.js b/options.js index 32dada8..06dd692 100644 --- a/options.js +++ b/options.js @@ -28,6 +28,7 @@ var form = document.getElementById('options-form'), clickRestartsEl = document.getElementById('click-restarts'), saveSuccessfulEl = document.getElementById('save-successful'), timeFormatErrorEl = document.getElementById('time-format-error'), + autoModeEl = document.getElementById('auto-mode'), background = chrome.extension.getBackgroundPage(), startCallbacks = {}, durationEls = {}; @@ -63,6 +64,7 @@ form.onsubmit = function () { showNotifications: showNotificationsEl.checked, shouldRing: shouldRingEl.checked, clickRestarts: clickRestartsEl.checked, + autoMode: autoModeEl.checked, whitelist: whitelistEl.selectedIndex == 1 }) saveSuccessfulEl.className = 'show'; @@ -74,6 +76,7 @@ showNotificationsEl.onchange = formAltered; shouldRingEl.onchange = formAltered; clickRestartsEl.onchange = formAltered; whitelistEl.onchange = formAltered; +autoModeEl.onchange = formAltered; function formAltered() { saveSuccessfulEl.removeAttribute('class'); @@ -85,6 +88,7 @@ showNotificationsEl.checked = background.PREFS.showNotifications; shouldRingEl.checked = background.PREFS.shouldRing; clickRestartsEl.checked = background.PREFS.clickRestarts; whitelistEl.selectedIndex = background.PREFS.whitelist ? 1 : 0; +autoModeEl.checked = background.PREFS.autoMode; var duration, minutes, seconds; for(var key in durationEls) { From 07501713740d406c58e8904d30b89caa221e2eaa Mon Sep 17 00:00:00 2001 From: professor-k Date: Thu, 12 Apr 2012 21:33:28 +0300 Subject: [PATCH 2/2] Localization of notification setting --- _locales/ru/messages.json | 4 ++++ _locales/uk/messages.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 9657b87..0cb7db1 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -58,6 +58,10 @@ "message": "Время должно быть задано в формате «мм» или «мм:сс»", "description": "On the options page, error message indicating bad format for timer duration" }, + "options_show_notifications": { + "message": "Показывать уведомления, когда счетчик достигнет нуля", + "description": "On the options page, label for the checkbox that enables/disables the notification at the end of a timer" + }, "options_should_ring": { "message": "Звенеть, когда счетчик достигнет нуля (будет звук)", "description": "On the options page, label for the checkbox that enables/disables ringing sound at the end of a timer" diff --git a/_locales/uk/messages.json b/_locales/uk/messages.json index 45e1cb2..f53641e 100644 --- a/_locales/uk/messages.json +++ b/_locales/uk/messages.json @@ -58,6 +58,10 @@ "message": "Час має бути задано у вигляді «хх» або «хх:сс»", "description": "On the options page, error message indicating bad format for timer duration" }, + "options_show_notifications": { + "message": "Показувати повідомлення, коли лічильник дійде до нуля", + "description": "On the options page, label for the checkbox that enables/disables the notification at the end of a timer" + }, "options_should_ring": { "message": "Дзвеніти, коли лічильник дійде до нуля (буде зі звуком)", "description": "On the options page, label for the checkbox that enables/disables ringing sound at the end of a timer"