diff options
-rw-r--r-- | package-lock.json | 14 | ||||
-rw-r--r-- | package.json | 2 | ||||
m--------- | public/_locales | 0 | ||||
-rw-r--r-- | src/help.ts | 2 | ||||
-rw-r--r-- | src/options.ts | 2 | ||||
-rw-r--r-- | src/permissions.ts | 2 | ||||
-rw-r--r-- | src/popup.ts | 2 | ||||
-rw-r--r-- | src/utils/pageUtils.ts | 25 |
8 files changed, 13 insertions, 36 deletions
diff --git a/package-lock.json b/package-lock.json index 87fe7040..009225e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ ], "license": "LGPL-3.0-or-later", "dependencies": { - "@ajayyy/maze-utils": "1.1.25", + "@ajayyy/maze-utils": "1.1.26", "content-scripts-register-polyfill": "^4.0.2", "react": "^18.2.0", "react-dom": "^18.2.0" @@ -67,9 +67,9 @@ } }, "node_modules/@ajayyy/maze-utils": { - "version": "1.1.25", - "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.25.tgz", - "integrity": "sha512-GntQY3v0SfP35/IYuHeCeCuT7z+Pc15padVmRoYqD9aShsU0yrNBgmFJWxkFMIDoltMiY4ZqSWNlPX5p+Vyovw==", + "version": "1.1.26", + "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.26.tgz", + "integrity": "sha512-PlqDsdbqeG1qQa1ZGgO5d7N8VeuaKKiR7gzUq0m+ROYcRhQ4k66gxF9Lumhbq6X9B8o0pzNwTu9eT3LFyyfsVw==", "funding": [ { "type": "individual", @@ -13602,9 +13602,9 @@ }, "dependencies": { "@ajayyy/maze-utils": { - "version": "1.1.25", - "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.25.tgz", - "integrity": "sha512-GntQY3v0SfP35/IYuHeCeCuT7z+Pc15padVmRoYqD9aShsU0yrNBgmFJWxkFMIDoltMiY4ZqSWNlPX5p+Vyovw==" + "version": "1.1.26", + "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.26.tgz", + "integrity": "sha512-PlqDsdbqeG1qQa1ZGgO5d7N8VeuaKKiR7gzUq0m+ROYcRhQ4k66gxF9Lumhbq6X9B8o0pzNwTu9eT3LFyyfsVw==" }, "@ampproject/remapping": { "version": "2.2.0", diff --git a/package.json b/package.json index 112764be..0d7e7622 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "background.js", "dependencies": { - "@ajayyy/maze-utils": "1.1.25", + "@ajayyy/maze-utils": "1.1.26", "content-scripts-register-polyfill": "^4.0.2", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/public/_locales b/public/_locales -Subproject 21110d3bac6e15eb837fea4e6cfc7b647c58519 +Subproject 48ef0174a0f2d3ad881660193a440d6059fc934 diff --git a/src/help.ts b/src/help.ts index 10bd86cf..95d84c88 100644 --- a/src/help.ts +++ b/src/help.ts @@ -1,7 +1,7 @@ +import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup"; import Config from "./config"; import { showDonationLink } from "./utils/configUtils"; -import { localizeHtmlPage } from "./utils/pageUtils"; import { waitFor } from "@ajayyy/maze-utils"; window.addEventListener('DOMContentLoaded', init); diff --git a/src/options.ts b/src/options.ts index 63384605..58d96560 100644 --- a/src/options.ts +++ b/src/options.ts @@ -13,7 +13,7 @@ import CategoryChooser from "./render/CategoryChooser"; import UnsubmittedVideos from "./render/UnsubmittedVideos"; import KeybindComponent from "./components/options/KeybindComponent"; import { showDonationLink } from "./utils/configUtils"; -import { localizeHtmlPage } from "./utils/pageUtils"; +import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup"; import { StorageChangesObject } from "@ajayyy/maze-utils/lib/config"; import { getHash } from "@ajayyy/maze-utils/lib/hash"; import { isFirefoxOrSafari } from "@ajayyy/maze-utils"; diff --git a/src/permissions.ts b/src/permissions.ts index 1e2c1119..f38b0bc9 100644 --- a/src/permissions.ts +++ b/src/permissions.ts @@ -1,6 +1,6 @@ import Config from "./config"; import Utils from "./utils"; -import { localizeHtmlPage } from "./utils/pageUtils"; +import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup"; const utils = new Utils(); // This is needed, if Config is not imported before Utils, things break. diff --git a/src/popup.ts b/src/popup.ts index d361ef5e..526db59f 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -22,7 +22,7 @@ import { showDonationLink } from "./utils/configUtils"; import { AnimationUtils } from "./utils/animationUtils"; import { GenericUtils } from "./utils/genericUtils"; import { shortCategoryName } from "./utils/categoryUtils"; -import { localizeHtmlPage } from "./utils/pageUtils"; +import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup"; import { exportTimes } from "./utils/exporter"; import GenericNotice from "./render/GenericNotice"; import { getFormattedTime } from "@ajayyy/maze-utils/lib/formating"; diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts index 38bf4748..50ebde30 100644 --- a/src/utils/pageUtils.ts +++ b/src/utils/pageUtils.ts @@ -93,27 +93,4 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number): } return chapters; -} - -export function localizeHtmlPage(): void { - //Localize by replacing __MSG_***__ meta tags - const localizedTitle = getLocalizedMessage(document.title); - if (localizedTitle) document.title = localizedTitle; - - const body = document.querySelector(".sponsorBlockPageBody"); - const localizedMessage = getLocalizedMessage(body.innerHTML.toString()); - if (localizedMessage) body.innerHTML = localizedMessage; -} - -export function getLocalizedMessage(text: string): string | false { - const valNewH = text.replace(/__MSG_(\w+)__/g, function(match, v1) { - return v1 ? chrome.i18n.getMessage(v1).replace(/</g, "<") - .replace(/"/g, """).replace(/\n/g, "<br/>") : ""; - }); - - if (valNewH != text) { - return valNewH; - } else { - return false; - } -} +}
\ No newline at end of file |