From bce09d305c7ad0b9b33bd1ba0779d0912af30078 Mon Sep 17 00:00:00 2001 From: Genbu Hase <14960841+GenbuHase@users.noreply.github.com> Date: Tue, 4 Feb 2020 15:57:45 +0900 Subject: [PATCH] =?UTF-8?q?v1.0.1=20+=20YouTube=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?,=20Module=E5=90=8D=E5=A4=89=E6=9B=B4=20+=20README=E3=82=92?= =?UTF-8?q?=E5=88=86=E3=81=8B=E3=82=8A=E3=82=84=E3=81=99=E3=81=8F=E5=8A=A0?= =?UTF-8?q?=E7=AD=86=20*=20On/Off=E7=94=BB=E9=9D=A2=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++---- README_ja.md | 12 +++++++----- manifest.json | 11 ++++++++--- modules/{YouTube-Live.js => YouTube.js} | 4 ++++ 4 files changed, 25 insertions(+), 12 deletions(-) rename modules/{YouTube-Live.js => YouTube.js} (92%) diff --git a/README.md b/README.md index 1b67720..aed5859 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,18 @@ This extension enables your [Bouyomi-chan] to read aloud automatically on some s ## Installation Make sure to install [a WebSocket Plugin for Bouyomi-chan](https://github.com/chocoa/BouyomiChan-WebSocket-Plugin) before using Bouyomi-Launcher. -1. Download one from this repository and unpack. +1. Download one from this repository and unpack. -2. Turn on `Developer Mode` from `chrome://extensions`. +2. Turn on `Developer Mode` from `chrome://extensions`. -3. Import one by selecting unpacked folder.
+3. Import one by selecting unpacked folder.
![chrome://extensions](https://user-images.githubusercontent.com/14960841/73714728-b37fdb00-4709-11ea-9c8d-5280f77d39fa.png) ## Implemented Services -* YouTube Live +* ### YouTube (https://www.youtube.com/live_chat) +* ### YouTube Live (https://studio.youtube.com/channel/{:id}/livestreaming/dashboard) + ※ Available on latest-UI ## LICENSE diff --git a/README_ja.md b/README_ja.md index 0a301da..64c6a5c 100644 --- a/README_ja.md +++ b/README_ja.md @@ -6,23 +6,25 @@ いくつかのサービスにおいて、[棒読みちゃん]が自動的に読み上げるようになります。 -## Languages +## 他言語のREADME * [英語 (English)](/README.md) ## 導入方法 ご利用の前に、必ず[WebSocketプラグイン](https://github.com/chocoa/BouyomiChan-WebSocket-Plugin)を導入してください。 -1. このレポジトリから棒読みランチャーをダウンロードし、解凍します。 +1. このレポジトリから棒読みランチャーをダウンロードし、解凍します。 -2. `chrome://extensions`から`デベロッパーモード`を有効にします。 +2. `chrome://extensions`から`デベロッパーモード`を有効にします。 -3. `パッケージされていない拡張機能を読み込む`より、解凍されたフォルダを参照しインストールします。
+3. `パッケージされていない拡張機能を読み込む`より、解凍されたフォルダを参照しインストールします。
![chrome://extensions](https://user-images.githubusercontent.com/14960841/73714728-b37fdb00-4709-11ea-9c8d-5280f77d39fa.png) ## 実装済みのサービス -* YouTube Live +* ### YouTube (https://www.youtube.com/live_chat) +* ### YouTube Live (https://studio.youtube.com/channel/{:id}/livestreaming/dashboard) + ※ 現行のUIで有効 ## ライセンス diff --git a/manifest.json b/manifest.json index 66424ab..7eca5c4 100644 --- a/manifest.json +++ b/manifest.json @@ -2,13 +2,18 @@ "manifest_version": 2, "name": "棒読みランチャー", "description": "棒読みちゃんに自動読み上げさせるChrome拡張機能", - "version": "1.0.0", + "version": "1.0.1", "content_scripts": [ { - "matches": ["*://studio.youtube.com/channel/*/livestreaming/*"], - "js": ["modules/YouTube-Live.js"], + "matches": [ + "*://www.youtube.com/live_chat*", + "*://studio.youtube.com/channel/*/livestreaming/dashboard*" + ], + "js": ["modules/YouTube.js"], + + "all_frames": true, "run_at": "document_idle" } ] diff --git a/modules/YouTube-Live.js b/modules/YouTube.js similarity index 92% rename from modules/YouTube-Live.js rename to modules/YouTube.js index bb4410f..de659d6 100644 --- a/modules/YouTube-Live.js +++ b/modules/YouTube.js @@ -12,6 +12,8 @@ const BOUYOMI_SOCKET_URL = "ws://localhost:50002"; */ const sendMessageToSocket = (message, config = {}) => { const bouyomi = new WebSocket(BOUYOMI_SOCKET_URL); + bouyomi.addEventListener("error", () => { throw new Error("Couldn't connect to Bouyomi-chan's socket server") }); + bouyomi.addEventListener("open", () => { bouyomi.send([ config.speed !== undefined ? config.speed : -1, @@ -45,6 +47,8 @@ const sanitizeChatMessage = messageElement => { (() => { + console.info("[Bouyomi Launcher] Launched"); + const observer = new MutationObserver(mutations => { for (const mutation of mutations) { if (mutation.type !== "childList") return;