瀏覽代碼

feat: translations and minor auto-like fixes

Sv443 11 月之前
父節點
當前提交
3fcd880856
共有 4 個文件被更改,包括 43 次插入18 次删除
  1. 37 16
      assets/translations/README.md
  2. 3 0
      assets/translations/en_US.json
  3. 2 0
      src/features/input.ts
  4. 1 2
      src/index.ts

+ 37 - 16
assets/translations/README.md

@@ -16,15 +16,15 @@ To submit or edit a translation, please follow [this guide](../../contributing.m
 ### Translation progress:
 |   | Locale | Translated keys | Based on |
 | :----: | ------ | --------------- | :------: |
-| ─ | [`en_US`](./en_US.json) | 237 (default locale) |  |
-| ‼️ | [`de_DE`](./de_DE.json) | `214/237` (90.3%) | ─ |
-| ─ | [`en_UK`](./en_UK.json) | `237/237` (100%) | `en_US` |
-| ‼️ | [`es_ES`](./es_ES.json) | `214/237` (90.3%) | ─ |
-| ‼️ | [`fr_FR`](./fr_FR.json) | `214/237` (90.3%) | ─ |
-| ‼️ | [`hi_IN`](./hi_IN.json) | `214/237` (90.3%) | ─ |
-| ‼️ | [`ja_JA`](./ja_JA.json) | `214/237` (90.3%) | ─ |
-| ‼️ | [`pt_BR`](./pt_BR.json) | `214/237` (90.3%) | ─ |
-| ‼️ | [`zh_CN`](./zh_CN.json) | `214/237` (90.3%) | ─ |
+| ─ | [`en_US`](./en_US.json) | 240 (default locale) |  |
+| ‼️ | [`de_DE`](./de_DE.json) | `214/240` (89.2%) | ─ |
+| ─ | [`en_UK`](./en_UK.json) | `240/240` (100%) | `en_US` |
+| ‼️ | [`es_ES`](./es_ES.json) | `214/240` (89.2%) | ─ |
+| ‼️ | [`fr_FR`](./fr_FR.json) | `214/240` (89.2%) | ─ |
+| ‼️ | [`hi_IN`](./hi_IN.json) | `214/240` (89.2%) | ─ |
+| ‼️ | [`ja_JA`](./ja_JA.json) | `214/240` (89.2%) | ─ |
+| ‼️ | [`pt_BR`](./pt_BR.json) | `214/240` (89.2%) | ─ |
+| ‼️ | [`zh_CN`](./zh_CN.json) | `214/240` (89.2%) | ─ |
 
 <sub>
 ✅ - Fully translated
@@ -45,7 +45,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 ### Missing keys:
 
-<details><summary><code>de_DE</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>de_DE</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -65,6 +65,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -75,7 +78,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>es_ES</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>es_ES</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -95,6 +98,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -105,7 +111,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>fr_FR</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>fr_FR</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -125,6 +131,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -135,7 +144,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>hi_IN</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>hi_IN</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -155,6 +164,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -165,7 +177,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>ja_JA</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>ja_JA</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -185,6 +197,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -195,7 +210,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>pt_BR</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>pt_BR</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -215,6 +230,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |
@@ -225,7 +243,7 @@ This means to figure out which keys are untranslated, you will need to manually
 
 <br></details>
 
-<details><summary><code>zh_CN</code> - 23 missing keys <i>(click to show)</i></summary><br>
+<details><summary><code>zh_CN</code> - 26 missing keys <i>(click to show)</i></summary><br>
 
 | Key | English text |
 | --- | ------------ |
@@ -245,6 +263,9 @@ This means to figure out which keys are untranslated, you will need to manually
 | `auto_liked_video` | `Auto-liked the video` |
 | `feature_desc_autoLikeChannels` | `Automatically like all songs and videos of certain channels` |
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
+| `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
+| `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
 | `feature_btn_autoLikeOpenMgmtDialog_running` | `Opening...` |

+ 3 - 0
assets/translations/en_US.json

@@ -219,6 +219,9 @@
     "feature_helptext_anchorImprovements": "Some elements on the page are only clickable with the left mouse button, which means you can't open them in a new tab by middle-clicking or through the context menu using shift + right-click. This feature adds links to a lot of them or enlarges existing ones to make clicking easier.",
     "feature_desc_autoLikeChannels": "Automatically like all songs and videos of certain channels",
     "feature_helpText_autoLikeChannels": "Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.",
+    "feature_desc_autoLikeChannelToggleBtn": "Add a button to each channel page to enable or disable auto-liking",
+    "feature_desc_autoLikePlayerBarToggleBtn": "Add a button to the media controls to enable or disable auto-liking",
+    "feature_desc_autoLikeTimeout": "How many seconds a song needs to play before being liked",
     "feature_desc_autoLikeOpenMgmtDialog": "Open the dialog to manage auto-liked channels",
     "feature_btn_autoLikeOpenMgmtDialog": "Open dialog",
     "feature_btn_autoLikeOpenMgmtDialog_running": "Opening...",

+ 2 - 0
src/features/input.ts

@@ -245,6 +245,8 @@ export async function initAutoLikeChannels() {
       let timeout: NodeJS.Timeout;
       siteEvents.on("watchIdChanged", () => {
         timeout && clearTimeout(timeout);
+        if(!location.pathname.startsWith("/watch"))
+          return;
         timeout = setTimeout(() => {
           addSelectorListener<HTMLAnchorElement, "yt">("watchMetadata", "#owner ytd-channel-name yt-formatted-string a", {
             listener(chanElem) {

+ 1 - 2
src/index.ts

@@ -133,13 +133,12 @@ async function onDomLoad() {
   log(`DOM loaded and feature pre-init finished, now initializing all features for domain "${domain}"...`);
 
   try {
-    //#region (ytm) welcome dlg
+    //#region welcome dlg
 
     if(typeof await GM.getValue("bytm-installed") !== "string") {
       // open welcome menu with language selector
       const dlg = await getWelcomeDialog();
       dlg.on("close", () => GM.setValue("bytm-installed", JSON.stringify({ timestamp: Date.now(), version: scriptInfo.version })));
-      await dlg.mount();
       info("Showing welcome menu");
       await dlg.open();
     }