diff --git a/README.md b/README.md index e3a6a25b..991b2f43 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,33 @@ 1. **Select desired text** on any web page. 1. **Click the Talkie button** in your browser bar Talkie play button +You can also use the **Talkie shortcut key**: + +- +Shift+A on macOS +- Ctrl+Shift+A on Windows, Linux, Chrome OS +- If the key does not work, please check that it is not already in use by another extension. + +
+ How to check or change the Talkie shortcut key +
    +
  1. + In Chrome, click *Extensions* in the *Window* menu. +
  2. +
  3. + At the bottom of the extensions list, click *Keyboard shortcuts* in the lower right corner. +

    + Screenshot of Chrome's list of installed extensions, focusing on Talkie +

    +
  4. +
  5. + From the *Keyboard Shortcuts for Extensions and Apps* window you can check or change keyboard shortcuts for all Chrome extensions and apps. This way you also can verify that there are no shortcut key collisions between extensions. +

    + Screenshot of the Keyboard Shortcuts for Extensions and Apps window in Chrome, focusing on Talkie shortcuts +

    +
  6. +
+
+ ## Features diff --git a/_locales/da/automatic.json b/_locales/da/automatic.json index 23634326..0032194e 100644 --- a/_locales/da/automatic.json +++ b/_locales/da/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop med at snakke" }, + "commandBrowserActionDescription": { + "message": "Stop med at snakke" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Åbn Chrome Webshop side" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Åbn donation siden" + }, + "commandOpenWebsiteMainDescription": { + "message": "Åbn hjemmesiden" + }, + "commandStartStopDescription": { + "message": "Start / stop læsning udvælgelse" + }, "extensionDescription": { "message": "Vælg tekst på en webside, og få computeren læste det højt for dig ved blot at klikke på knappen Talkie." }, diff --git a/_locales/da/messages.json b/_locales/da/messages.json index 6f67d488..d2043820 100644 --- a/_locales/da/messages.json +++ b/_locales/da/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop med at snakke" }, + "commandBrowserActionDescription": { + "message": "Stop med at snakke" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Åbn Chrome Webshop side" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Åbn donation siden" + }, + "commandOpenWebsiteMainDescription": { + "message": "Åbn hjemmesiden" + }, + "commandStartStopDescription": { + "message": "Start / stop læsning udvælgelse" + }, "extensionDescription": { "message": "Vælg tekst på en webside, og få computeren læste det højt for dig ved blot at klikke på knappen Talkie." }, diff --git a/_locales/de/automatic.json b/_locales/de/automatic.json index a5f02739..daa5f86f 100644 --- a/_locales/de/automatic.json +++ b/_locales/de/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Hör auf zu reden" }, + "commandBrowserActionDescription": { + "message": "Hör auf zu reden" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Öffnen Sie die Chrome Web Store-Seite" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Öffnen Sie die Spendenseite" + }, + "commandOpenWebsiteMainDescription": { + "message": "Öffnen Sie die Website" + }, + "commandStartStopDescription": { + "message": "Start / Stop Lesevorgang" + }, "extensionDescription": { "message": "Wählen Sie Text auf jeder Web-Seite, und haben Sie den Computer lesen Sie es laut für Sie, indem Sie einfach auf die Talkie-Taste." }, diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 3ed6d75d..4bd7005d 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Hör auf zu reden" }, + "commandBrowserActionDescription": { + "message": "Hör auf zu reden" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Öffnen Sie die Chrome Web Store-Seite" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Öffnen Sie die Spendenseite" + }, + "commandOpenWebsiteMainDescription": { + "message": "Öffnen Sie die Website" + }, + "commandStartStopDescription": { + "message": "Start / Stop Lesevorgang" + }, "extensionDescription": { "message": "Wählen Sie Text auf jeder Web-Seite, und haben Sie den Computer lesen Sie es laut für Sie, indem Sie einfach auf die Talkie-Taste." }, diff --git a/_locales/en/base.json b/_locales/en/base.json index 61e9bfd2..18e38fd6 100644 --- a/_locales/en/base.json +++ b/_locales/en/base.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop talking" }, + "commandBrowserActionDescription": { + "message": "Read text selection out loud" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Open the Chrome Web Store page" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Open the donation page" + }, + "commandOpenWebsiteMainDescription": { + "message": "Open the website" + }, + "commandStartStopDescription": { + "message": "Start/stop reading selection" + }, "extensionDescription": { "message": "Select text on any web page, and have the computer read it out loud for you by simply clicking the Talkie button." }, diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ffa95652..525bef9c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop talking" }, + "commandBrowserActionDescription": { + "message": "Read text selection out loud" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Open the Chrome Web Store page" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Open the donation page" + }, + "commandOpenWebsiteMainDescription": { + "message": "Open the website" + }, + "commandStartStopDescription": { + "message": "Start/stop reading selection" + }, "extensionDescription": { "message": "Select text on any web page, and have the computer read it out loud for you by simply clicking the Talkie button." }, diff --git a/_locales/es/automatic.json b/_locales/es/automatic.json index 1f73a852..4126d72f 100644 --- a/_locales/es/automatic.json +++ b/_locales/es/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Deja de hablar" }, + "commandBrowserActionDescription": { + "message": "Deja de hablar" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Abrir la página Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Abrir la página de donaciones" + }, + "commandOpenWebsiteMainDescription": { + "message": "Abrir el sitio web" + }, + "commandStartStopDescription": { + "message": "Iniciar / detener la selección de lectura" + }, "extensionDescription": { "message": "Seleccione el texto en cualquier página web y haga que la computadora lo lea en voz alta para usted simplemente haciendo clic en el botón Talkie." }, @@ -31,7 +46,7 @@ "message": "Puntúalo" }, "popup_supportAndFeedback": { - "message": "Soporte y retroalimentación" + "message": "Soporte y comentarios" }, "popup_yourDonationsAreAppreciated": { "message": "Sus donaciones son apreciadas!" diff --git a/_locales/es/messages.json b/_locales/es/messages.json index a17c859b..c57520ff 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Deja de hablar" }, + "commandBrowserActionDescription": { + "message": "Deja de hablar" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Abrir la página Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Abrir la página de donaciones" + }, + "commandOpenWebsiteMainDescription": { + "message": "Abrir el sitio web" + }, + "commandStartStopDescription": { + "message": "Iniciar / detener la selección de lectura" + }, "extensionDescription": { "message": "Seleccione el texto en cualquier página web y haga que la computadora lo lea en voz alta para usted simplemente haciendo clic en el botón Talkie." }, @@ -49,7 +64,7 @@ "message": "Puntúalo" }, "popup_supportAndFeedback": { - "message": "Soporte y retroalimentación" + "message": "Soporte y comentarios" }, "popup_yourDonationsAreAppreciated": { "message": "Sus donaciones son apreciadas!" diff --git a/_locales/fr/automatic.json b/_locales/fr/automatic.json index f60f4068..1e9d7cac 100644 --- a/_locales/fr/automatic.json +++ b/_locales/fr/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Arrêter de parler" }, + "commandBrowserActionDescription": { + "message": "Arrêter de parler" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Ouvrez la page Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Ouvrir la page de don" + }, + "commandOpenWebsiteMainDescription": { + "message": "Ouvrir le site" + }, + "commandStartStopDescription": { + "message": "Commencer / arrêter la lecture de la sélection" + }, "extensionDescription": { "message": "Sélectionnez un texte sur n'importe quelle page Web et demandez à l'ordinateur de le lire à haute voix pour vous en cliquant simplement sur le bouton Talkie." }, diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 3104ffe8..b95faf1f 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Arrêter de parler" }, + "commandBrowserActionDescription": { + "message": "Arrêter de parler" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Ouvrez la page Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Ouvrir la page de don" + }, + "commandOpenWebsiteMainDescription": { + "message": "Ouvrir le site" + }, + "commandStartStopDescription": { + "message": "Commencer / arrêter la lecture de la sélection" + }, "extensionDescription": { "message": "Sélectionnez un texte sur n'importe quelle page Web et demandez à l'ordinateur de le lire à haute voix pour vous en cliquant simplement sur le bouton Talkie." }, diff --git a/_locales/he/automatic.json b/_locales/he/automatic.json index 402310a3..66e60484 100644 --- a/_locales/he/automatic.json +++ b/_locales/he/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": " רבדל קיספת" }, + "commandBrowserActionDescription": { + "message": " רבדל קיספת" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": " Chrome לש טנרטניאה תונח ףד תא חתפ" + }, + "commandOpenWebsiteDonateDescription": { + "message": " המורתה ףד תא חתפ" + }, + "commandOpenWebsiteMainDescription": { + "message": " רתאה תא חתפ" + }, + "commandStartStopDescription": { + "message": " הריחב אורקל קיספהל / לחתה" + }, "extensionDescription": { "message": " .Talkie רותפכ לע הציחל ידי לע טושפ ךליבשב םר לוקב הז תא אורקל בשחמה תא םהל שיו​​ ,והשלכ טנרטניא ףדב טסקט רחב" }, diff --git a/_locales/he/messages.json b/_locales/he/messages.json index 273749af..644e1d98 100644 --- a/_locales/he/messages.json +++ b/_locales/he/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": " רבדל קיספת" }, + "commandBrowserActionDescription": { + "message": " רבדל קיספת" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": " Chrome לש טנרטניאה תונח ףד תא חתפ" + }, + "commandOpenWebsiteDonateDescription": { + "message": " המורתה ףד תא חתפ" + }, + "commandOpenWebsiteMainDescription": { + "message": " רתאה תא חתפ" + }, + "commandStartStopDescription": { + "message": " הריחב אורקל קיספהל / לחתה" + }, "extensionDescription": { "message": "בחר טקסט מכל אתר ו-Talkie יקרא אותו עבורך בקול רם בלחיצת כפתור" }, diff --git a/_locales/it/automatic.json b/_locales/it/automatic.json index 2602d3f5..129fb3c1 100644 --- a/_locales/it/automatic.json +++ b/_locales/it/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Smetti di parlare" }, + "commandBrowserActionDescription": { + "message": "Smetti di parlare" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Aprire la pagina Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Aprire la pagina delle donazioni" + }, + "commandOpenWebsiteMainDescription": { + "message": "Aprire il sito web" + }, + "commandStartStopDescription": { + "message": "Start / smettere di leggere selezione" + }, "extensionDescription": { "message": "Selezionare testo su qualsiasi pagina web, e avere il computer leggere ad alta voce per voi con un semplice click sul pulsante Talkie." }, diff --git a/_locales/it/messages.json b/_locales/it/messages.json index 904d2099..4c6a066f 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Smetti di parlare" }, + "commandBrowserActionDescription": { + "message": "Smetti di parlare" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Aprire la pagina Chrome Web Store" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Aprire la pagina delle donazioni" + }, + "commandOpenWebsiteMainDescription": { + "message": "Aprire il sito web" + }, + "commandStartStopDescription": { + "message": "Start / smettere di leggere selezione" + }, "extensionDescription": { "message": "Selezionare testo su qualsiasi pagina web, e avere il computer leggere ad alta voce per voi con un semplice click sul pulsante Talkie." }, diff --git a/_locales/nb/automatic.json b/_locales/nb/automatic.json index b73a3a24..2709d209 100644 --- a/_locales/nb/automatic.json +++ b/_locales/nb/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Slutt å snakke" }, + "commandBrowserActionDescription": { + "message": "Slutt å snakke" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Åpne Chrome Nettmarked side" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Åpne donasjon siden" + }, + "commandOpenWebsiteMainDescription": { + "message": "Åpne nettsiden" + }, + "commandStartStopDescription": { + "message": "Starte / stoppe lesingen utvalg" + }, "extensionDescription": { "message": "Velg tekst på en nettside, og har datamaskinen lese den høyt for deg ved å klikke på Talkie-knappen." }, diff --git a/_locales/nb/messages.json b/_locales/nb/messages.json index 3a22491d..8c88371f 100644 --- a/_locales/nb/messages.json +++ b/_locales/nb/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Slutt å snakke" }, + "commandBrowserActionDescription": { + "message": "Slutt å snakke" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Åpne Chrome Nettmarked side" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Åpne donasjon siden" + }, + "commandOpenWebsiteMainDescription": { + "message": "Åpne nettsiden" + }, + "commandStartStopDescription": { + "message": "Starte / stoppe lesingen utvalg" + }, "extensionDescription": { "message": "Velg tekst på en nettside, og har datamaskinen lese den høyt for deg ved å klikke på Talkie-knappen." }, diff --git a/_locales/nl/automatic.json b/_locales/nl/automatic.json index ba73c3eb..24324813 100644 --- a/_locales/nl/automatic.json +++ b/_locales/nl/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop met praten" }, + "commandBrowserActionDescription": { + "message": "Stop met praten" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Open de Chrome Web Store-pagina" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Open de donatie pagina" + }, + "commandOpenWebsiteMainDescription": { + "message": "Open de website" + }, + "commandStartStopDescription": { + "message": "Start / stop het lezen van selectie" + }, "extensionDescription": { "message": "Selecteer tekst op een webpagina, en hebben de computer leest het hardop voor u door simpelweg te klikken op de knop Talkie." }, diff --git a/_locales/nl/messages.json b/_locales/nl/messages.json index f71fc412..78df098f 100644 --- a/_locales/nl/messages.json +++ b/_locales/nl/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Stop met praten" }, + "commandBrowserActionDescription": { + "message": "Stop met praten" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Open de Chrome Web Store-pagina" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Open de donatie pagina" + }, + "commandOpenWebsiteMainDescription": { + "message": "Open de website" + }, + "commandStartStopDescription": { + "message": "Start / stop het lezen van selectie" + }, "extensionDescription": { "message": "Selecteer tekst op een webpagina, en hebben de computer leest het hardop voor u door simpelweg te klikken op de knop Talkie." }, diff --git a/_locales/ru/automatic.json b/_locales/ru/automatic.json index 26933f30..94a483aa 100644 --- a/_locales/ru/automatic.json +++ b/_locales/ru/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Перестаньте разговаривать" }, + "commandBrowserActionDescription": { + "message": "Перестаньте разговаривать" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Откройте страницу Интернет-магазин Chrome" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Открыть страницу пожертвований" + }, + "commandOpenWebsiteMainDescription": { + "message": "Откройте веб-сайт" + }, + "commandStartStopDescription": { + "message": "Старт / Стоп чтение выбор" + }, "extensionDescription": { "message": "Выделите текст на любой веб-странице, и есть компьютер читать вслух для вас, просто нажав на кнопку Talkie." }, diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 2b1ff6d8..97b38a5a 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Перестаньте разговаривать" }, + "commandBrowserActionDescription": { + "message": "Перестаньте разговаривать" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Откройте страницу Интернет-магазин Chrome" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Открыть страницу пожертвований" + }, + "commandOpenWebsiteMainDescription": { + "message": "Откройте веб-сайт" + }, + "commandStartStopDescription": { + "message": "Старт / Стоп чтение выбор" + }, "extensionDescription": { "message": "Выделите текст на любой веб-странице, и есть компьютер читать вслух для вас, просто нажав на кнопку Talkie." }, diff --git a/_locales/sv/automatic.json b/_locales/sv/automatic.json index 345e1ce9..4a9a8ec7 100644 --- a/_locales/sv/automatic.json +++ b/_locales/sv/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Sluta prata" }, + "commandBrowserActionDescription": { + "message": "Sluta prata" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Öppna Chrome Web Store sida" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Öppna donationssida" + }, + "commandOpenWebsiteMainDescription": { + "message": "Öppna hemsidan" + }, + "commandStartStopDescription": { + "message": "Start / stopp läsa val" + }, "extensionDescription": { "message": "Markera text på en webbsida, och har datorn läsa den högt för dig genom att klicka på Talkie knappen." }, diff --git a/_locales/sv/messages.json b/_locales/sv/messages.json index 3ae17b71..41f43b96 100644 --- a/_locales/sv/messages.json +++ b/_locales/sv/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "Sluta prata" }, + "commandBrowserActionDescription": { + "message": "Sluta prata" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "Öppna Chrome Web Store sida" + }, + "commandOpenWebsiteDonateDescription": { + "message": "Öppna donationssida" + }, + "commandOpenWebsiteMainDescription": { + "message": "Öppna hemsidan" + }, + "commandStartStopDescription": { + "message": "Start / stopp läsa val" + }, "extensionDescription": { "message": "Markera text på valfri hemsida, och låt datorn läsa upp den för dig genom ett enkelt klick på Talkie-knappen." }, diff --git a/_locales/zh/automatic.json b/_locales/zh/automatic.json index 64056c45..5ccb3c45 100644 --- a/_locales/zh/automatic.json +++ b/_locales/zh/automatic.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "停止说话" }, + "commandBrowserActionDescription": { + "message": "停止说话" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "打开Chrome网上应用店页面" + }, + "commandOpenWebsiteDonateDescription": { + "message": "打开捐款页面" + }, + "commandOpenWebsiteMainDescription": { + "message": "打开网站" + }, + "commandStartStopDescription": { + "message": "开始/停止读取选择" + }, "extensionDescription": { "message": "在任何网页上选择文字,并让计算机大声读出它,只需点击对讲机按钮。" }, diff --git a/_locales/zh/messages.json b/_locales/zh/messages.json index ccbc6740..c03970d7 100644 --- a/_locales/zh/messages.json +++ b/_locales/zh/messages.json @@ -5,6 +5,21 @@ "buttonStopTitle": { "message": "停止说话" }, + "commandBrowserActionDescription": { + "message": "停止说话" + }, + "commandOpenWebsiteChromeWebStoreDescription": { + "message": "打开Chrome网上应用店页面" + }, + "commandOpenWebsiteDonateDescription": { + "message": "打开捐款页面" + }, + "commandOpenWebsiteMainDescription": { + "message": "打开网站" + }, + "commandStartStopDescription": { + "message": "开始/停止读取选择" + }, "extensionDescription": { "message": "在任何网页上选择文字,并让计算机大声读出它,只需点击对讲机按钮。" }, diff --git a/manifest.json b/manifest.json index c13265e1..caafec1a 100644 --- a/manifest.json +++ b/manifest.json @@ -16,6 +16,35 @@ "permissions": [ "activeTab" ], + "commands": { + "_execute_browser_action": { + "suggested_key": { + "windows": "Ctrl+Shift+A", + "mac": "Command+Shift+A", + "chromeos": "Ctrl+Shift+A", + "linux": "Ctrl+Shift+A" + }, + "description": "__MSG_commandBrowserActionDescription__" + }, + "start-stop": { + "suggested_key": { + "windows": "Alt+Shift+A", + "mac": "Alt+Shift+A", + "chromeos": "Alt+Shift+A", + "linux": "Alt+Shift+A" + }, + "description": "__MSG_commandStartStopDescription__" + }, + "open-website-main": { + "description": "__MSG_commandOpenWebsiteMainDescription__" + }, + "open-website-chromewebstore": { + "description": "__MSG_commandOpenWebsiteChromeWebStoreDescription__" + }, + "open-website-donate": { + "description": "__MSG_commandOpenWebsiteDonateDescription__" + } + }, "requirements": {}, "offline_enabled": true, "default_locale": "en", diff --git a/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-01.png b/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-01.png new file mode 100644 index 00000000..4fbff38d Binary files /dev/null and b/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-01.png differ diff --git a/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-02.png b/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-02.png new file mode 100644 index 00000000..dafa8a75 Binary files /dev/null and b/resources/keyboard-shortcuts/talkie-keyboard-shortcuts-02.png differ diff --git a/src/background.js b/src/background.js index 31928cae..864caf19 100644 --- a/src/background.js +++ b/src/background.js @@ -35,6 +35,7 @@ knownEvents:false, last:false, log:false, logError:false, +openUrlFromConfigurationInNewTab:false, Promise:false, promiseSeries:false, promiseTry:false, @@ -771,6 +772,38 @@ const enablePopup = () => { } ); + const commandMap = { + // NOTE: implicitly set by the browser, and actually "clicks" the Talkie icon. + // Handled by the popup handler (popup contents) and icon click handler. + // "_execute_browser_action": iconClickAction, + "start-stop": iconClickAction, + "open-website-main": () => openUrlFromConfigurationInNewTab("main"), + "open-website-chromewebstore": () => openUrlFromConfigurationInNewTab("chromewebstore"), + "open-website-donate": () => openUrlFromConfigurationInNewTab("donate"), + }; + + const shortcutKeyCommandHandler = (command) => { + log("Start", "shortcutKeyCommandHandler", command); + + const commandAction = commandMap[command]; + + if (typeof commandAction !== "function") { + throw new Error("Bad command action for command: " + command); + } + + return commandAction() + .then((result) => { + log("Done", "shortcutKeyCommandHandler", command, result); + + return undefined; + }) + .catch((error) => { + logError("Error", "shortcutKeyCommandHandler", command, error); + + throw error; + }); + }; + const broadcaster = new Broadcaster(); broadcaster.start(); @@ -789,6 +822,8 @@ const enablePopup = () => { // NOTE: used when the popup has been disabled. chrome.browserAction.onClicked.addListener(iconClickAction); + chrome.commands.onCommand.addListener(shortcutKeyCommandHandler); + enablePopup(); }()); diff --git a/src/popup-start.js b/src/popup-start.js index 6e52f51e..4c45b2c3 100644 --- a/src/popup-start.js +++ b/src/popup-start.js @@ -25,6 +25,7 @@ getBackgroundPage:false, knownEvents:false, log:false, logError:false, +openUrlInNewTab:false, Promise:false, promiseTry:false, window:false, @@ -169,7 +170,7 @@ const addLinkClickHandlers = () => promiseTry( const location = ln.href; ln.onclick = function() { - chrome.tabs.create({active: true, url: location}); + openUrlInNewTab(location); }; } } diff --git a/src/shared.js b/src/shared.js index 36a190c6..eb0f81ba 100644 --- a/src/shared.js +++ b/src/shared.js @@ -48,6 +48,44 @@ const logDebug = (...args) => { log("Start", "Loading shared code"); +// TODO: move to a file? +// TODO: read from manifest.json? +// TODO: allow overrides? +const configuration = { + urls: { + "main": "https://github.com/joelpurra/talkie", + "chromewebstore": "https://chrome.google.com/webstore/detail/talkie/enfbcfmmdpdminapkflljhbfeejjhjjk", + "donate": "https://joelpurra.com/donate", + }, +}; + +const openUrlInNewTab = (url) => promiseTry( + () => { + if (typeof url !== "string") { + throw new Error("Bad url: " + url); + } + + // NOTE: only https urls. + if (!url.startsWith("https://")) { + throw new Error("Bad url, only https:// allowed: " + url); + } + + chrome.tabs.create({active: true, url: url}); + } +); + +const openUrlFromConfigurationInNewTab = (id) => promiseTry( + () => { + const url = configuration.urls[id]; + + if (typeof url !== "string") { + throw new Error("Bad url for id: " + id); + } + + return openUrlInNewTab(url); + } +); + const shallowCopy = (...objs) => Object.assign({}, ...objs); const last = (indexable) => indexable[indexable.length - 1]; @@ -745,6 +783,7 @@ const api = { log, logDebug, logError, + openUrlFromConfigurationInNewTab, promiseSeries, promiseTry, shallowCopy,