mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cd697dc32 | ||
|
|
9946bd1af2 | ||
|
|
3b06d72270 | ||
|
|
4bd0556464 | ||
|
|
7e12a914d5 | ||
|
|
25eaf4fa20 | ||
|
|
b3efa1f787 | ||
|
|
9a18e70e34 | ||
|
|
64ece9cb73 | ||
|
|
66c974b011 | ||
|
|
d8cc93c841 | ||
|
|
de22accfda | ||
|
|
e5b0b60dde | ||
|
|
32d98e6544 | ||
|
|
3dde05eda2 | ||
|
|
6aeefaae64 | ||
|
|
93d695e6c2 | ||
|
|
160924feee | ||
|
|
e3f3ed20e6 | ||
|
|
52149f4c0f | ||
|
|
cbc586f9ac | ||
|
|
fc8e20be0d | ||
|
|
368059eb0d | ||
|
|
ea77375fcc | ||
|
|
16005e417d | ||
|
|
7c5b750264 | ||
|
|
cc6b65c6c4 | ||
|
|
d2c99c2d77 | ||
|
|
84c25e3042 | ||
|
|
8840dba90f | ||
|
|
856dded58f | ||
|
|
1d1bd2a003 | ||
|
|
dc91ee76ca | ||
|
|
90bb9a4d02 | ||
|
|
d12d847f2f | ||
|
|
31a9de252d | ||
|
|
299cb485c3 | ||
|
|
882d462849 | ||
|
|
fc3710b37b | ||
|
|
3ac170ad01 | ||
|
|
4069545603 | ||
|
|
db9fc11f13 | ||
|
|
76667f68ec | ||
|
|
e27a287a68 | ||
|
|
ce3731774d | ||
|
|
8cbf2bb50b | ||
|
|
6f8c44b2eb | ||
|
|
bbc5c11667 | ||
|
|
d074fdec96 | ||
|
|
5d98208596 | ||
|
|
4480ad4d84 | ||
|
|
df6c6cb30f | ||
|
|
0f2da334e8 | ||
|
|
7562340ec2 | ||
|
|
fee5b7be44 | ||
|
|
e89f75e4b6 | ||
|
|
8bcaf906fb | ||
|
|
cee00a87c1 | ||
|
|
9b627f4e8f | ||
|
|
af977840c6 | ||
|
|
e8370121d5 | ||
|
|
3175d7f8e9 | ||
|
|
ab4035bbc5 | ||
|
|
3d88d29d93 | ||
|
|
1ac361b4df | ||
|
|
24c37324b8 | ||
|
|
21bce341f0 | ||
|
|
0d9c3dc807 | ||
|
|
60f9274438 | ||
|
|
e23722baa0 | ||
|
|
d25e8c7360 | ||
|
|
87bf472ee4 | ||
|
|
e28e196a17 | ||
|
|
0f7ed9926c | ||
|
|
75eb63632f | ||
|
|
e1982f265e | ||
|
|
e2a01bb744 | ||
|
|
8c8e41bc89 |
@@ -24,7 +24,10 @@
|
|||||||
"no-self-assign": "off",
|
"no-self-assign": "off",
|
||||||
"@typescript-eslint/no-empty-interface": "off",
|
"@typescript-eslint/no-empty-interface": "off",
|
||||||
"react/prop-types": [2, { "ignore": ["children"] }],
|
"react/prop-types": [2, { "ignore": ["children"] }],
|
||||||
"@typescript-eslint/member-delimiter-style": "warn"
|
"@typescript-eslint/member-delimiter-style": "warn",
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/no-this-alias": "off"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"react": {
|
"react": {
|
||||||
|
|||||||
7
.github/workflows/updateInvidous.yml
vendored
7
.github/workflows/updateInvidous.yml
vendored
@@ -11,9 +11,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Download instance list
|
- name: Download instance lists
|
||||||
run: |
|
run: |
|
||||||
wget https://api.invidious.io/instances.json -O ci/data.json
|
wget https://api.invidious.io/instances.json -O ci/invidious_instances.json
|
||||||
|
wget https://github.com/TeamPiped/piped-uptime/raw/master/history/summary.json -O ci/piped_instances.json
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: "Run CI"
|
- name: "Run CI"
|
||||||
@@ -24,7 +25,7 @@ jobs:
|
|||||||
# v4.2.3
|
# v4.2.3
|
||||||
with:
|
with:
|
||||||
commit-message: Update Invidious List
|
commit-message: Update Invidious List
|
||||||
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
||||||
branch: ci/update_invidious_list
|
branch: ci/update_invidious_list
|
||||||
title: Update Invidious List
|
title: Update Invidious List
|
||||||
body: Automated Invidious list update
|
body: Automated Invidious list update
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,5 +7,6 @@ web-ext-artifacts
|
|||||||
dist/
|
dist/
|
||||||
tmp/
|
tmp/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
ci/data.json
|
ci/invidious_instances.json
|
||||||
|
ci/piped_instances.json
|
||||||
test-results
|
test-results
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
|||||||
[submodule "public/_locales"]
|
[submodule "public/_locales"]
|
||||||
path = public/_locales
|
path = public/_locales
|
||||||
url = https://github.com/ajayyy/ExtensionTranslations
|
url = https://github.com/ajayyy/ExtensionTranslations
|
||||||
|
[submodule "maze-utils"]
|
||||||
|
path = maze-utils
|
||||||
|
url = https://github.com/ajayyy/maze-utils
|
||||||
|
|||||||
@@ -1 +1,31 @@
|
|||||||
If you make any contributions to SponsorBlock after this file was created, you are agreeing that any code you have contributed will be licensed under LGPL-3.0.
|
If you make any contributions to SponsorBlock after this file was created, you are agreeing that any code you have contributed will be licensed under LGPL-3.0 or later.
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
https://crowdin.com/project/sponsorblock
|
||||||
|
|
||||||
|
# Building
|
||||||
|
## Building locally
|
||||||
|
0. You must have [Node.js 16 or later](https://nodejs.org/) and npm installed. Works best on Linux
|
||||||
|
1. Clone with submodules
|
||||||
|
```bash
|
||||||
|
git clone --recursive https://github.com/ajayyy/SponsorBlock
|
||||||
|
```
|
||||||
|
Or if you already cloned it, pull submodules with
|
||||||
|
```bash
|
||||||
|
git submodule update --init --recursive
|
||||||
|
```
|
||||||
|
2. Copy the file `config.json.example` to `config.json` and adjust configuration as desired.
|
||||||
|
- Comments are invalid in JSON, make sure they are all removed.
|
||||||
|
- You will need to repeat this step in the future if you get build errors related to `CompileConfig` or `property does not exist on type ConfigClass`. This can happen for example when a new category is added.
|
||||||
|
3. Run `npm ci` in the repository to install dependencies.
|
||||||
|
4. Run `npm run build:dev` (for Chrome) or `npm run build:dev:firefox` (for Firefox) to generate a development version of the extension with source maps.
|
||||||
|
- You can also run `npm run build` (for Chrome) or `npm run build:firefox` (for Firefox) to generate a production build.
|
||||||
|
5. The built extension is now in `dist/`. You can load this folder directly in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/#manifest), or convert it to a zip file to load it as a [temporary extension](https://developer.mozilla.org/docs/Tools/about:debugging#loading_a_temporary_extension) in Firefox.
|
||||||
|
|
||||||
|
## Developing with a clean profile and hot reloading
|
||||||
|
Run `npm run dev` (for Chrome) or `npm run dev:firefox` (for Firefox) to run the extension using a clean browser profile with hot reloading. This uses [`web-ext run`](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#commands).
|
||||||
|
|
||||||
|
Known chromium bug: Extension is not loaded properly on first start. Visit `chrome://extensions/` and reload the extension.
|
||||||
|
|
||||||
|
For Firefox for Android, use `npm run dev:firefox-android -- --adb-device <ip-address of the device>`. See the [Firefox documentation](https://extensionworkshop.com/documentation/develop/developing-extensions-for-firefox-for-android/#debug-your-extension) for more information. You may need to edit package.json and add the parameters directly there.
|
||||||
|
|
||||||
|
|||||||
41
README.md
41
README.md
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
SponsorBlock is an open-source crowdsourced browser extension to skip sponsor segments in YouTube videos. Users submit when a sponsor happens from the extension, and the extension automatically skips sponsors it knows about. It also supports skipping other categories, such as intros, outros and reminders to subscribe.
|
SponsorBlock is an open-source crowdsourced browser extension to skip sponsor segments in YouTube videos. Users submit when a sponsor happens from the extension, and the extension automatically skips sponsors it knows about. It also supports skipping other categories, such as intros, outros and reminders to subscribe.
|
||||||
|
|
||||||
It also supports Invidio.us.
|
It also supports Invidious.
|
||||||
|
|
||||||
**Translate:** [](https://crowdin.com/project/sponsorblock)
|
**Translate:** [](https://crowdin.com/project/sponsorblock)
|
||||||
|
|
||||||
@@ -56,47 +56,14 @@ The dataset and API are now being used in some [ports](https://github.com/ajayyy
|
|||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
||||||
You can read the API docs [here](https://wiki.sponsor.ajay.app/index.php/API_Docs).
|
You can read the API docs [here](https://wiki.sponsor.ajay.app/w/API_Docs).
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
You must have [Node.js 16](https://nodejs.org/) and npm installed.
|
|
||||||
|
|
||||||
1. Clone with submodules
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/ajayyy/SponsorBlock --recurse-submodules=yes
|
|
||||||
```
|
|
||||||
|
|
||||||
Or if you already cloned it, pull submodules with
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Copy the file `config.json.example` to `config.json` and adjust configuration as desired.
|
|
||||||
|
|
||||||
- You will need to repeat this step in the future if you get build errors related to `CompileConfig`. This can happen for example when a new category is added.
|
|
||||||
|
|
||||||
3. Run `npm install` in the repository to install dependencies.
|
|
||||||
|
|
||||||
4. Run `npm run build:dev` (for Chrome) or `npm run build:dev:firefox` (for Firefox) to generate a development version of the extension with source maps.
|
|
||||||
|
|
||||||
- You can also run `npm run build` (for Chrome) or `npm run build:firefox` (for Firefox) to generate a production build.
|
|
||||||
|
|
||||||
5. The built extension is now in `dist/`. You can load this folder directly in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/#manifest), or convert it to a zip file to load it as a [temporary extension](https://developer.mozilla.org/en-US/docs/Tools/about:debugging#loading_a_temporary_extension) in Firefox.
|
|
||||||
|
|
||||||
### Developing with a clean profile and hot reloading
|
|
||||||
|
|
||||||
Run `npm run dev` (for Chrome) or `npm run dev:firefox` (for Firefox) to run the extension using a clean browser profile with hot reloading. This uses [`web-ext run`](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#commands).
|
|
||||||
|
|
||||||
Known chromium bug: Extension is not loaded properly on first start. Visit `chrome://extensions/` and reload the extension.
|
|
||||||
|
|
||||||
For Firefox for Android, use `npm run dev:firefox-android -- --adb-device <ip-address of the device>`. See the [Firefox documentation](https://extensionworkshop.com/documentation/develop/developing-extensions-for-firefox-for-android/#debug-your-extension) for more information.
|
|
||||||
|
|
||||||
# Credit
|
# Credit
|
||||||
|
|
||||||
The awesome [Invidious API](https://docs.invidious.io/API.md) was previously used, and the server is now using [NewLeaf](https://git.sr.ht/~cadence/NewLeaf) as a to get video info from YouTube.
|
The awesome [Invidious API](https://docs.invidious.io/) was previously used, and the server is now using [NewLeaf](https://git.sr.ht/~cadence/NewLeaf) as a to get video info from YouTube.
|
||||||
|
|
||||||
Originally forked from [YTSponsorSkip](https://github.com/NDevTK/YTSponsorSkip), but very little code remains.
|
Originally forked from [YTSponsorSkip](https://github.com/NDevTK/YTSponsorSkip), but very little code remains.
|
||||||
|
|
||||||
|
|||||||
63
ci/generateList.ts
Normal file
63
ci/generateList.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
This file is only ran by GitHub Actions in order to populate the Invidious instances list
|
||||||
|
|
||||||
|
This file should not be shipped with the extension
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Criteria for inclusion:
|
||||||
|
Invidious
|
||||||
|
- 30d uptime >= 90%
|
||||||
|
- available for at least 80/90 days
|
||||||
|
- must have been up for at least 90 days
|
||||||
|
- HTTPS only
|
||||||
|
- url includes name (this is to avoid redirects)
|
||||||
|
|
||||||
|
Piped
|
||||||
|
- 30d uptime >= 90%
|
||||||
|
- available for at least 80/90 days
|
||||||
|
- must have been up for at least 90 days
|
||||||
|
- must not be a wildcard redirect to piped.video
|
||||||
|
- must be currently up
|
||||||
|
- must have a functioning frontend
|
||||||
|
- must have a functioning API
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { writeFile, existsSync } from "fs"
|
||||||
|
import { join } from "path"
|
||||||
|
import { getInvidiousList } from "./invidiousCI";
|
||||||
|
// import { getPipedList } from "./pipedCI";
|
||||||
|
|
||||||
|
const checkPath = (path: string) => existsSync(path);
|
||||||
|
const fixArray = (arr: string[]) => [...new Set(arr)].sort()
|
||||||
|
|
||||||
|
async function generateList() {
|
||||||
|
// import file from https://api.invidious.io/instances.json
|
||||||
|
const invidiousPath = join(__dirname, "invidious_instances.json");
|
||||||
|
// import file from https://github.com/TeamPiped/piped-uptime/raw/master/history/summary.json
|
||||||
|
const pipedPath = join(__dirname, "piped_instances.json");
|
||||||
|
|
||||||
|
// check if files exist
|
||||||
|
if (!checkPath(invidiousPath) || !checkPath(pipedPath)) {
|
||||||
|
console.log("Missing files")
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static non-invidious instances
|
||||||
|
const staticInstances = ["www.youtubekids.com"];
|
||||||
|
// invidious instances
|
||||||
|
const invidiousList = fixArray(getInvidiousList())
|
||||||
|
// piped instnaces
|
||||||
|
// const pipedList = fixArray(await getPipedList())
|
||||||
|
|
||||||
|
console.log([...staticInstances, ...invidiousList])
|
||||||
|
|
||||||
|
writeFile(
|
||||||
|
join(__dirname, "./invidiouslist.json"),
|
||||||
|
JSON.stringify([...staticInstances, ...invidiousList]),
|
||||||
|
(err) => {
|
||||||
|
if (err) return console.log(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
generateList()
|
||||||
@@ -1,55 +1,31 @@
|
|||||||
/*
|
import { InvidiousInstance, instanceMap } from "./invidiousType"
|
||||||
This file is only ran by GitHub Actions in order to populate the Invidious instances list
|
|
||||||
|
|
||||||
This file should not be shipped with the extension
|
import * as data from "../ci/invidious_instances.json";
|
||||||
*/
|
|
||||||
|
|
||||||
import { writeFile, existsSync } from 'fs';
|
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
// import file from https://api.invidious.io/instances.json
|
|
||||||
if (!existsSync(join(__dirname, "data.json"))) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
import * as data from "../ci/data.json";
|
|
||||||
|
|
||||||
type instanceMap = {
|
|
||||||
name: string;
|
|
||||||
url: string;
|
|
||||||
dailyRatios: {ratio: string; label: string }[];
|
|
||||||
thirtyDayUptime: string;
|
|
||||||
}[]
|
|
||||||
|
|
||||||
// only https servers
|
// only https servers
|
||||||
const mapped: instanceMap = data
|
const mapped: instanceMap = data
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
.filter((i: InvidiousInstance) => i[1]?.type === "https")
|
||||||
.filter((i: any) => i[1]?.type === 'https')
|
.map((instance: InvidiousInstance) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
.map((instance: any) => {
|
|
||||||
return {
|
return {
|
||||||
name: instance[0],
|
name: instance[0],
|
||||||
url: instance[1].uri,
|
url: instance[1].uri,
|
||||||
dailyRatios: instance[1].monitor.dailyRatios,
|
dailyRatios: instance[1].monitor.dailyRatios,
|
||||||
thirtyDayUptime: instance[1]?.monitor['30dRatio'].ratio,
|
thirtyDayUptime: instance[1]?.monitor["30dRatio"].ratio,
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// reliability and sanity checks
|
// reliability and sanity checks
|
||||||
const reliableCheck = mapped
|
const reliableCheck = mapped
|
||||||
.filter((instance) => {
|
.filter(instance => {
|
||||||
// 30d uptime >= 90%
|
// 30d uptime >= 90%
|
||||||
const thirtyDayUptime = Number(instance.thirtyDayUptime) >= 90
|
const thirtyDayUptime = Number(instance.thirtyDayUptime) >= 90;
|
||||||
// available for at least 80/90 days
|
// available for at least 80/90 days
|
||||||
const dailyRatioCheck = instance.dailyRatios.filter(status => status.label !== "black")
|
const dailyRatioCheck = instance.dailyRatios.filter(status => status.label !== "black");
|
||||||
return (thirtyDayUptime && dailyRatioCheck.length >= 80)
|
return thirtyDayUptime && dailyRatioCheck.length >= 80;
|
||||||
})
|
})
|
||||||
// url includes name
|
// url includes name
|
||||||
.filter(instance => instance.url.includes(instance.name))
|
.filter(instance => instance.url.includes(instance.name));
|
||||||
|
|
||||||
// finally map to array
|
export function getInvidiousList(): string[] {
|
||||||
const result: string[] = reliableCheck.map(instance => instance.name).sort()
|
return reliableCheck.map(instance => instance.name).sort()
|
||||||
writeFile(join(__dirname, "./invidiouslist.json"), JSON.stringify(result), (err) => {
|
}
|
||||||
if (err) return console.log(err);
|
|
||||||
})
|
|
||||||
54
ci/invidiousType.ts
Normal file
54
ci/invidiousType.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
type ratio = {
|
||||||
|
ratio: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type instanceMap = {
|
||||||
|
name: string;
|
||||||
|
url: string;
|
||||||
|
dailyRatios: {ratio: string; label: string }[];
|
||||||
|
thirtyDayUptime: string;
|
||||||
|
}[]
|
||||||
|
|
||||||
|
export type InvidiousInstance = [
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
flag: string;
|
||||||
|
region: string;
|
||||||
|
stats: null | {
|
||||||
|
version: string;
|
||||||
|
software: {
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
branch: string;
|
||||||
|
};
|
||||||
|
openRegistrations: boolean;
|
||||||
|
usage: {
|
||||||
|
users: {
|
||||||
|
total: number;
|
||||||
|
activeHalfyear: number;
|
||||||
|
activeMonth: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
metadata: {
|
||||||
|
updatedAt: number;
|
||||||
|
lastChannelRefreshedAt: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
cors: boolean | null;
|
||||||
|
api: boolean | null;
|
||||||
|
type: "https" | "http" | "onion" | "i2p";
|
||||||
|
uri: string;
|
||||||
|
monitor: null | {
|
||||||
|
monitorId: number;
|
||||||
|
createdAt: number;
|
||||||
|
statusClass: string;
|
||||||
|
name: string;
|
||||||
|
url: string | null;
|
||||||
|
type: "HTTP(s)";
|
||||||
|
dailyRatios: ratio[];
|
||||||
|
"90dRatio": ratio;
|
||||||
|
"30dRatio": ratio;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1 +1 @@
|
|||||||
["inv.bp.projectsegfau.lt","inv.zzls.xyz","invidious.0011.lt","invidious.baczek.me","invidious.lunar.icu","invidious.privacydev.net","invidious.tiekoetter.com","iv.ggtyler.dev","iv.melmac.space","vid.puffyan.us","y.com.sb","yewtu.be","yt.artemislena.eu"]
|
["www.youtubekids.com","inv.bp.projectsegfau.lt","inv.tux.pizza","inv.zzls.xyz","invidious.0011.lt","invidious.lunar.icu","invidious.privacydev.net","invidious.tiekoetter.com","iv.ggtyler.dev","iv.melmac.space","vid.priv.au","vid.puffyan.us","yewtu.be","yt.artemislena.eu"]
|
||||||
92
ci/pipedCI.ts
Normal file
92
ci/pipedCI.ts
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import * as data from "../ci/piped_instances.json";
|
||||||
|
|
||||||
|
type percent = string
|
||||||
|
type dailyMinutesDown = Record<string, number>
|
||||||
|
|
||||||
|
type PipedInstance = {
|
||||||
|
name: string;
|
||||||
|
url: string;
|
||||||
|
icon: string;
|
||||||
|
slug: string;
|
||||||
|
status: string;
|
||||||
|
uptime: percent;
|
||||||
|
uptimeDay: percent;
|
||||||
|
uptimeWeek: percent;
|
||||||
|
uptimeMonth: percent;
|
||||||
|
uptimeYear: percent;
|
||||||
|
time: number;
|
||||||
|
timeDay: number;
|
||||||
|
timeWeek: number;
|
||||||
|
timeMonth: number;
|
||||||
|
timeYear: number;
|
||||||
|
dailyMinutesDown: dailyMinutesDown
|
||||||
|
}
|
||||||
|
|
||||||
|
const percentNumber = (percent: percent) => Number(percent.replace("%", ""))
|
||||||
|
const ninetyDaysAgo = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000)
|
||||||
|
|
||||||
|
function dailyMinuteFilter (dailyMinutesDown: dailyMinutesDown) {
|
||||||
|
let daysDown = 0
|
||||||
|
for (const [date, minsDown] of Object.entries(dailyMinutesDown)) {
|
||||||
|
if (new Date(date) >= ninetyDaysAgo && minsDown > 1000) { // if within 90 days and down for more than 1000 minutes
|
||||||
|
daysDown++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return true f less than 10 days down
|
||||||
|
return daysDown < 10
|
||||||
|
}
|
||||||
|
|
||||||
|
const getHost = (url: string) => new URL(url).host
|
||||||
|
|
||||||
|
const getWatchPage = async (instance: PipedInstance) =>
|
||||||
|
fetch(`https://${getHost(instance.url)}`, { redirect: "manual" })
|
||||||
|
.then(res => res.headers.get("Location"))
|
||||||
|
.catch(e => { console.log (e); return null })
|
||||||
|
|
||||||
|
const siteOK = async (instance) => {
|
||||||
|
// check if entire site is redirect
|
||||||
|
const notRedirect = await fetch(instance.url, { redirect: "manual" })
|
||||||
|
.then(res => res.status == 200)
|
||||||
|
// only allow kavin to return piped.video
|
||||||
|
// if (instance.url.startsWith("https://piped.video") && instance.slug !== "kavin-rocks-official") return false
|
||||||
|
// check if frontend is OK
|
||||||
|
const watchPageStatus = await fetch(instance.frontendUrl)
|
||||||
|
.then(res => res.ok)
|
||||||
|
// test API - stream returns ok result
|
||||||
|
const streamStatus = await fetch(`${instance.apiUrl}/streams/BaW_jenozKc`)
|
||||||
|
.then(res => res.ok)
|
||||||
|
// get startTime of monitor
|
||||||
|
const age = await fetch(instance.historyUrl)
|
||||||
|
.then(res => res.text())
|
||||||
|
.then(text => { // startTime greater than 90 days ago
|
||||||
|
const date = text.match(/startTime: (.+)/)[1]
|
||||||
|
return Date.parse(date) < ninetyDaysAgo.valueOf()
|
||||||
|
})
|
||||||
|
// console.log(notRedirect, watchPageStatus, streamStatus, age, instance.frontendUrl, instance.apiUrl)
|
||||||
|
return notRedirect && watchPageStatus && streamStatus && age
|
||||||
|
}
|
||||||
|
|
||||||
|
const staticFilters = (data as PipedInstance[])
|
||||||
|
.filter(instance => {
|
||||||
|
const isup = instance.status === "up"
|
||||||
|
const monthCheck = percentNumber(instance.uptimeMonth) >= 90
|
||||||
|
const dailyMinuteCheck = dailyMinuteFilter(instance.dailyMinutesDown)
|
||||||
|
return isup && monthCheck && dailyMinuteCheck
|
||||||
|
})
|
||||||
|
.map(async instance => {
|
||||||
|
// get frontend url
|
||||||
|
const frontendUrl = await getWatchPage(instance)
|
||||||
|
if (!frontendUrl) return null // return false if frontend doesn't resolve
|
||||||
|
// get api base
|
||||||
|
const apiUrl = instance.url.replace("/healthcheck", "")
|
||||||
|
const historyUrl = `https://raw.githubusercontent.com/TeamPiped/piped-uptime/master/history/${instance.slug}.yml`
|
||||||
|
const pass = await siteOK({ apiUrl, historyUrl, frontendUrl, url: instance.url })
|
||||||
|
const frontendHost = getHost(frontendUrl)
|
||||||
|
return pass ? frontendHost : null
|
||||||
|
})
|
||||||
|
|
||||||
|
export async function getPipedList(): Promise<string[]> {
|
||||||
|
const instances = await Promise.all(staticFilters)
|
||||||
|
.then(arr => arr.filter(i => i !== null))
|
||||||
|
return instances
|
||||||
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"declarativeContent"
|
"declarativeContent",
|
||||||
|
"webNavigation"
|
||||||
],
|
],
|
||||||
"background": {
|
"background": {
|
||||||
"persistent": false
|
"persistent": false
|
||||||
}
|
},
|
||||||
|
"permissions": [
|
||||||
|
"https://*.youtube.com/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,11 @@
|
|||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "sponsorBlocker@ajay.app"
|
"id": "sponsorBlocker@ajay.app"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"background": {
|
||||||
|
"persistent": false
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"scripting"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "5.4.10",
|
"version": "5.4.17",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"homepage_url": "https://sponsor.ajay.app",
|
"homepage_url": "https://sponsor.ajay.app",
|
||||||
@@ -84,8 +84,7 @@
|
|||||||
"https://sponsor.ajay.app/*"
|
"https://sponsor.ajay.app/*"
|
||||||
],
|
],
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"*://*/*",
|
"*://*/*"
|
||||||
"webNavigation"
|
|
||||||
],
|
],
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_title": "SponsorBlock",
|
"default_title": "SponsorBlock",
|
||||||
@@ -116,6 +115,21 @@
|
|||||||
"light": "icons/IconSponsorBlocker128px.png",
|
"light": "icons/IconSponsorBlocker128px.png",
|
||||||
"dark": "icons/IconSponsorBlocker128px.png",
|
"dark": "icons/IconSponsorBlocker128px.png",
|
||||||
"size": 128
|
"size": 128
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"light": "icons/IconSponsorBlocker256px.png",
|
||||||
|
"dark": "icons/IconSponsorBlocker256px.png",
|
||||||
|
"size": 256
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"light": "icons/IconSponsorBlocker512px.png",
|
||||||
|
"dark": "icons/IconSponsorBlocker512px.png",
|
||||||
|
"size": 512
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"light": "icons/IconSponsorBlocker1024px.png",
|
||||||
|
"dark": "icons/IconSponsorBlocker1024px.png",
|
||||||
|
"size": 1024
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
{
|
{
|
||||||
"background": {
|
"background": {
|
||||||
"persistent": false
|
"persistent": false
|
||||||
}
|
},
|
||||||
|
"permissions": [
|
||||||
|
"scripting"
|
||||||
|
],
|
||||||
|
"optional_permissions": [
|
||||||
|
"webNavigation"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
1
maze-utils
Submodule
1
maze-utils
Submodule
Submodule maze-utils added at 79bef97a3b
File diff suppressed because one or more lines are too long
42
package-lock.json
generated
42
package-lock.json
generated
@@ -27,7 +27,6 @@
|
|||||||
],
|
],
|
||||||
"license": "LGPL-3.0-or-later",
|
"license": "LGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ajayyy/maze-utils": "1.1.37",
|
|
||||||
"content-scripts-register-polyfill": "^4.0.2",
|
"content-scripts-register-polyfill": "^4.0.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
@@ -66,32 +65,6 @@
|
|||||||
"node": ">=16"
|
"node": ">=16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ajayyy/maze-utils": {
|
|
||||||
"version": "1.1.37",
|
|
||||||
"resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.37.tgz",
|
|
||||||
"integrity": "sha512-EOec/tfgTDdG2RFzfGdRpyBE3ACE7sAmzfKGzLZqhNznQGcCt/gELw49dHf7NeFzU+EU5vJ2jzTDizfB96gBMg==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "individual",
|
|
||||||
"url": "https://sponsor.ajay.app/donate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/ajayyy-org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/ajayyy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "individual",
|
|
||||||
"url": "https://paypal.me/ajayyy"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
||||||
@@ -13359,8 +13332,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/word-wrap": {
|
"node_modules/word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@@ -13601,11 +13575,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ajayyy/maze-utils": {
|
|
||||||
"version": "1.1.37",
|
|
||||||
"resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.37.tgz",
|
|
||||||
"integrity": "sha512-EOec/tfgTDdG2RFzfGdRpyBE3ACE7sAmzfKGzLZqhNznQGcCt/gELw49dHf7NeFzU+EU5vJ2jzTDizfB96gBMg=="
|
|
||||||
},
|
|
||||||
"@ampproject/remapping": {
|
"@ampproject/remapping": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
||||||
@@ -23380,8 +23349,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"word-wrap": {
|
"word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wrap-ansi": {
|
"wrap-ansi": {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "background.js",
|
"main": "background.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ajayyy/maze-utils": "1.1.37",
|
|
||||||
"content-scripts-register-polyfill": "^4.0.2",
|
"content-scripts-register-polyfill": "^4.0.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
@@ -56,7 +55,7 @@
|
|||||||
"build:watch": "npm run build:watch:chrome",
|
"build:watch": "npm run build:watch:chrome",
|
||||||
"build:watch:chrome": "webpack --env browser=chrome --config webpack/webpack.dev.js --watch",
|
"build:watch:chrome": "webpack --env browser=chrome --config webpack/webpack.dev.js --watch",
|
||||||
"build:watch:firefox": "webpack --env browser=firefox --config webpack/webpack.dev.js --watch",
|
"build:watch:firefox": "webpack --env browser=firefox --config webpack/webpack.dev.js --watch",
|
||||||
"ci:invidious": "ts-node ci/invidiousCI.ts",
|
"ci:invidious": "ts-node ci/generateList.ts",
|
||||||
"dev": "npm run build:dev && concurrently \"npm run web-run\" \"npm run build:watch\"",
|
"dev": "npm run build:dev && concurrently \"npm run web-run\" \"npm run build:watch\"",
|
||||||
"dev:firefox": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox\" \"npm run build:watch:firefox\"",
|
"dev:firefox": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox\" \"npm run build:watch:firefox\"",
|
||||||
"dev:firefox-android": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox-android\" \"npm run build:watch:firefox\"",
|
"dev:firefox-android": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox-android\" \"npm run build:watch:firefox\"",
|
||||||
|
|||||||
Submodule public/_locales updated: 1b0a076f74...5528978f2f
@@ -198,6 +198,11 @@ div:hover > .sponsorBlockChapterBar {
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#categoryPill .sbPillNoText .sponsorSkipLogo {
|
||||||
|
margin-top: calc(2.6rem - 18px);
|
||||||
|
margin-bottom: calc(2.6rem - 18px);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
from { opacity: 0; }
|
from { opacity: 0; }
|
||||||
}
|
}
|
||||||
@@ -772,6 +777,14 @@ input::-webkit-inner-spin-button {
|
|||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#categoryPillParent {
|
||||||
|
height: fit-content;
|
||||||
|
margin-top: auto;
|
||||||
|
margin-bottom: auto;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.sponsorBlockCategoryPill {
|
.sponsorBlockCategoryPill {
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
@@ -854,3 +867,7 @@ input::-webkit-inner-spin-button {
|
|||||||
.sponsorThumbnailLabel:hover span {
|
.sponsorThumbnailLabel:hover span {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sponsorblock-chapter-visible {
|
||||||
|
display: inherit !important;
|
||||||
|
}
|
||||||
@@ -703,7 +703,7 @@ svg {
|
|||||||
padding: 20px 0px 0px 0px !important;
|
padding: 20px 0px 0px 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#deArrowPromotion {
|
.promotion-container {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="deArrowPromotion" class="hidden">
|
<div id="deArrowPromotion" class="promotion-container" class="hidden">
|
||||||
<a class="dearrow-link"
|
<a class="dearrow-link"
|
||||||
href="https://dearrow.ajay.app"
|
href="https://dearrow.ajay.app"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@@ -180,6 +180,20 @@
|
|||||||
<div class="small-description">__MSG_whatShowCategoryWithoutPermission__</div>
|
<div class="small-description">__MSG_whatShowCategoryWithoutPermission__</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="ytNeuterPromotion" class="promotion-container">
|
||||||
|
<a class="dearrow-link"
|
||||||
|
href="https://github.com/mchangrh/yt-neuter/blob/main/docs/filters/sponsorblock.md#install"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
|
|
||||||
|
<span class="promotion-description">
|
||||||
|
__MSG_YtNeuterMessage__
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="small-description">__MSG_requiresUblock__</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="interface" class="option-group hidden">
|
<div id="interface" class="option-group hidden">
|
||||||
@@ -490,7 +504,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-description">(__MSG_supportedSites__ Invidious, CloudTube, Piped)</div>
|
<div class="small-description">(__MSG_supportedSites__ Invidious, CloudTube, Piped, YouTube Kids)</div>
|
||||||
<div class="small-description">__MSG_supportOtherSitesDescription__ </div>
|
<div class="small-description">__MSG_supportOtherSitesDescription__ </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,174 +1,3 @@
|
|||||||
@ajayyy/maze-utils
|
|
||||||
1.1.7 <https://github.com/ajayyy/SponsorBlock>
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
|
|
||||||
******************************
|
|
||||||
|
|
||||||
content-scripts-register-polyfill
|
content-scripts-register-polyfill
|
||||||
4.0.2 <https://github.com/fregante/content-scripts-register-polyfill>
|
4.0.2 <https://github.com/fregante/content-scripts-register-polyfill>
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import * as CompileConfig from "../config.json";
|
|||||||
import Config from "./config";
|
import Config from "./config";
|
||||||
import { Registration } from "./types";
|
import { Registration } from "./types";
|
||||||
import "content-scripts-register-polyfill";
|
import "content-scripts-register-polyfill";
|
||||||
import { sendRealRequestToCustomServer, setupBackgroundRequestProxy } from "@ajayyy/maze-utils/lib/background-request-proxy";
|
import { sendRealRequestToCustomServer, setupBackgroundRequestProxy } from "../maze-utils/src/background-request-proxy";
|
||||||
import { setupTabUpdates } from "@ajayyy/maze-utils/lib/tab-updates";
|
import { setupTabUpdates } from "../maze-utils/src/tab-updates";
|
||||||
import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
|
import { generateUserID } from "../maze-utils/src/setup";
|
||||||
|
|
||||||
// Make the config public for debugging purposes
|
// Make the config public for debugging purposes
|
||||||
|
|
||||||
@@ -13,6 +13,10 @@ window.SB = Config;
|
|||||||
|
|
||||||
import Utils from "./utils";
|
import Utils from "./utils";
|
||||||
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
|
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
|
||||||
|
import { isFirefoxOrSafari } from "../maze-utils/src";
|
||||||
|
import { injectUpdatedScripts } from "../maze-utils/src/cleanup";
|
||||||
|
import { logWarn } from "./utils/logger";
|
||||||
|
import { chromeP } from "../maze-utils/src/browserApi";
|
||||||
const utils = new Utils({
|
const utils = new Utils({
|
||||||
registerFirefoxContentScript,
|
registerFirefoxContentScript,
|
||||||
unregisterFirefoxContentScript
|
unregisterFirefoxContentScript
|
||||||
@@ -24,7 +28,7 @@ const popupPort: Record<string, chrome.runtime.Port> = {};
|
|||||||
const contentScriptRegistrations = {};
|
const contentScriptRegistrations = {};
|
||||||
|
|
||||||
// Register content script if needed
|
// Register content script if needed
|
||||||
utils.wait(() => Config.config !== null).then(function() {
|
utils.wait(() => Config.isReady()).then(function() {
|
||||||
if (Config.config.supportInvidious) utils.setupExtraSiteContentScripts();
|
if (Config.config.supportInvidious) utils.setupExtraSiteContentScripts();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -72,7 +76,11 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
|||||||
case "infoUpdated":
|
case "infoUpdated":
|
||||||
case "videoChanged":
|
case "videoChanged":
|
||||||
if (sender.tab) {
|
if (sender.tab) {
|
||||||
|
try {
|
||||||
popupPort[sender.tab.id]?.postMessage(request);
|
popupPort[sender.tab.id]?.postMessage(request);
|
||||||
|
} catch (e) {
|
||||||
|
// This can happen if the popup is closed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
@@ -132,6 +140,11 @@ chrome.runtime.onInstalled.addListener(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
|
// Only do this once the old version understands how to clean itself up
|
||||||
|
if (!isFirefoxOrSafari() && chrome.runtime.getManifest().version !== "5.4.13") {
|
||||||
|
injectUpdatedScripts().catch(logWarn);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,29 +153,62 @@ chrome.runtime.onInstalled.addListener(function () {
|
|||||||
*
|
*
|
||||||
* @param {JSON} options
|
* @param {JSON} options
|
||||||
*/
|
*/
|
||||||
function registerFirefoxContentScript(options: Registration) {
|
async function registerFirefoxContentScript(options: Registration) {
|
||||||
const oldRegistration = contentScriptRegistrations[options.id];
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
if (oldRegistration) oldRegistration.unregister();
|
const existingRegistrations = await chromeP.scripting.getRegisteredContentScripts({
|
||||||
|
ids: [options.id]
|
||||||
|
});
|
||||||
|
|
||||||
chrome.contentScripts.register({
|
if (existingRegistrations.length > 0
|
||||||
|
&& existingRegistrations[0].matches.every((match) => options.matches.includes(match))) {
|
||||||
|
// No need to register another script, already registered
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await unregisterFirefoxContentScript(options.id);
|
||||||
|
|
||||||
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
|
await chromeP.scripting.registerContentScripts([{
|
||||||
|
id: options.id,
|
||||||
|
runAt: "document_start",
|
||||||
|
matches: options.matches,
|
||||||
allFrames: options.allFrames,
|
allFrames: options.allFrames,
|
||||||
js: options.js,
|
js: options.js,
|
||||||
css: options.css,
|
css: options.css,
|
||||||
|
persistAcrossSessions: true,
|
||||||
|
}]);
|
||||||
|
} else {
|
||||||
|
chrome.contentScripts.register({
|
||||||
|
allFrames: options.allFrames,
|
||||||
|
js: options.js?.map?.(file => ({file})),
|
||||||
|
css: options.css?.map?.(file => ({file})),
|
||||||
matches: options.matches
|
matches: options.matches
|
||||||
}).then((registration) => void (contentScriptRegistrations[options.id] = registration));
|
}).then((registration) => void (contentScriptRegistrations[options.id] = registration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only works on Firefox.
|
* Only works on Firefox.
|
||||||
* Firefox requires that this is handled by the background script
|
* Firefox requires that this is handled by the background script
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function unregisterFirefoxContentScript(id: string) {
|
async function unregisterFirefoxContentScript(id: string) {
|
||||||
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
|
try {
|
||||||
|
await chromeP.scripting.unregisterContentScripts({
|
||||||
|
ids: [id]
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// Already registered
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (contentScriptRegistrations[id]) {
|
if (contentScriptRegistrations[id]) {
|
||||||
contentScriptRegistrations[id].unregister();
|
contentScriptRegistrations[id].unregister();
|
||||||
delete contentScriptRegistrations[id];
|
delete contentScriptRegistrations[id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function submitVote(type: number, UUID: string, category: string) {
|
async function submitVote(type: number, UUID: string, category: string) {
|
||||||
let userID = Config.config.userID;
|
let userID = Config.config.userID;
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
|
|||||||
import { VoteResponse } from "../messageTypes";
|
import { VoteResponse } from "../messageTypes";
|
||||||
import { AnimationUtils } from "../utils/animationUtils";
|
import { AnimationUtils } from "../utils/animationUtils";
|
||||||
import { Tooltip } from "../render/Tooltip";
|
import { Tooltip } from "../render/Tooltip";
|
||||||
import { getErrorMessage } from "@ajayyy/maze-utils/lib/formating";
|
import { getErrorMessage } from "../../maze-utils/src/formating";
|
||||||
|
|
||||||
export interface CategoryPillProps {
|
export interface CategoryPillProps {
|
||||||
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
||||||
|
showTextByDefault: boolean;
|
||||||
|
showTooltipOnClick: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CategoryPillState {
|
export interface CategoryPillState {
|
||||||
@@ -43,18 +45,23 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<span style={style}
|
<span style={style}
|
||||||
className={"sponsorBlockCategoryPill"}
|
className={"sponsorBlockCategoryPill" + (!this.props.showTextByDefault ? " sbPillNoText" : "")}
|
||||||
aria-label={this.getTitleText()}
|
aria-label={this.getTitleText()}
|
||||||
onClick={(e) => this.toggleOpen(e)}
|
onClick={(e) => this.toggleOpen(e)}
|
||||||
onMouseEnter={() => this.openTooltip()}
|
onMouseEnter={() => this.openTooltip()}
|
||||||
onMouseLeave={() => this.closeTooltip()}>
|
onMouseLeave={() => this.closeTooltip()}>
|
||||||
|
|
||||||
<span className="sponsorBlockCategoryPillTitleSection">
|
<span className="sponsorBlockCategoryPillTitleSection">
|
||||||
<img className="sponsorSkipLogo sponsorSkipObject"
|
<img className="sponsorSkipLogo sponsorSkipObject"
|
||||||
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
||||||
</img>
|
</img>
|
||||||
|
|
||||||
|
{
|
||||||
|
(this.props.showTextByDefault || this.state.open) &&
|
||||||
<span className="sponsorBlockCategoryPillTitle">
|
<span className="sponsorBlockCategoryPillTitle">
|
||||||
{chrome.i18n.getMessage("category_" + this.state.segment?.category)}
|
{chrome.i18n.getMessage("category_" + this.state.segment?.category)}
|
||||||
</span>
|
</span>
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{this.state.open && (
|
{this.state.open && (
|
||||||
@@ -81,7 +88,10 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
{/* Close Button */}
|
{/* Close Button */}
|
||||||
<img src={chrome.extension.getURL("icons/close.png")}
|
<img src={chrome.extension.getURL("icons/close.png")}
|
||||||
className="categoryPillClose"
|
className="categoryPillClose"
|
||||||
onClick={() => this.setState({ show: false })}>
|
onClick={() => {
|
||||||
|
this.setState({ show: false });
|
||||||
|
this.closeTooltip();
|
||||||
|
}}>
|
||||||
</img>
|
</img>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
@@ -91,6 +101,14 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (this.state.show) {
|
if (this.state.show) {
|
||||||
|
if (this.props.showTooltipOnClick) {
|
||||||
|
if (this.state.open) {
|
||||||
|
this.closeTooltip();
|
||||||
|
} else {
|
||||||
|
this.openTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({ open: !this.state.open });
|
this.setState({ open: !this.state.open });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,6 +126,8 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
open: false,
|
open: false,
|
||||||
show: type === 1
|
show: type === 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.closeTooltip();
|
||||||
} else if (response.statusCode !== 403) {
|
} else if (response.statusCode !== 403) {
|
||||||
alert(getErrorMessage(response.statusCode, response.responseText));
|
alert(getErrorMessage(response.statusCode, response.responseText));
|
||||||
}
|
}
|
||||||
@@ -127,7 +147,11 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
}
|
}
|
||||||
|
|
||||||
private openTooltip(): void {
|
private openTooltip(): void {
|
||||||
const tooltipMount = document.querySelector("#above-the-fold") as HTMLElement;
|
if (this.tooltip) {
|
||||||
|
this.tooltip.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
const tooltipMount = document.querySelector("#above-the-fold, ytm-slim-owner-renderer") as HTMLElement;
|
||||||
if (tooltipMount) {
|
if (tooltipMount) {
|
||||||
this.tooltip = new Tooltip({
|
this.tooltip = new Tooltip({
|
||||||
text: this.getTitleText(),
|
text: this.getTitleText(),
|
||||||
@@ -143,7 +167,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
}
|
}
|
||||||
|
|
||||||
private closeTooltip(): void {
|
private closeTooltip(): void {
|
||||||
this.tooltip?.close();
|
this.tooltip?.close?.();
|
||||||
this.tooltip = null;
|
this.tooltip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
|
|||||||
import { VoteResponse } from "../messageTypes";
|
import { VoteResponse } from "../messageTypes";
|
||||||
import { AnimationUtils } from "../utils/animationUtils";
|
import { AnimationUtils } from "../utils/animationUtils";
|
||||||
import { Tooltip } from "../render/Tooltip";
|
import { Tooltip } from "../render/Tooltip";
|
||||||
import { getErrorMessage } from "@ajayyy/maze-utils/lib/formating";
|
import { getErrorMessage } from "../../maze-utils/src/formating";
|
||||||
|
|
||||||
export interface ChapterVoteProps {
|
export interface ChapterVoteProps {
|
||||||
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
|
import SbSvg from "../svg-icons/sb_svg";
|
||||||
|
|
||||||
enum CountdownMode {
|
enum CountdownMode {
|
||||||
Timer,
|
Timer,
|
||||||
@@ -28,6 +29,7 @@ export interface NoticeProps {
|
|||||||
extraClass?: string;
|
extraClass?: string;
|
||||||
hideLogo?: boolean;
|
hideLogo?: boolean;
|
||||||
hideRightInfo?: boolean;
|
hideRightInfo?: boolean;
|
||||||
|
logoFill?: string;
|
||||||
|
|
||||||
// Callback for when this is closed
|
// Callback for when this is closed
|
||||||
closeListener: () => void;
|
closeListener: () => void;
|
||||||
@@ -122,10 +124,10 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
|||||||
<td className="noticeLeftIcon">
|
<td className="noticeLeftIcon">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
{!this.props.hideLogo &&
|
{!this.props.hideLogo &&
|
||||||
<img id={"sponsorSkipLogo" + this.idSuffix}
|
<SbSvg
|
||||||
className="sponsorSkipLogo sponsorSkipObject"
|
id={"sponsorSkipLogo" + this.idSuffix}
|
||||||
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
fill={this.props.logoFill}
|
||||||
</img>
|
className="sponsorSkipLogo sponsorSkipObject"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span id={"sponsorSkipMessage" + this.idSuffix}
|
<span id={"sponsorSkipMessage" + this.idSuffix}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import ThumbsUpSvg from "../svg-icons/thumbs_up_svg";
|
|||||||
import ThumbsDownSvg from "../svg-icons/thumbs_down_svg";
|
import ThumbsDownSvg from "../svg-icons/thumbs_down_svg";
|
||||||
import PencilSvg from "../svg-icons/pencil_svg";
|
import PencilSvg from "../svg-icons/pencil_svg";
|
||||||
import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
|
import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
|
||||||
import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
|
import { generateUserID } from "../../maze-utils/src/setup";
|
||||||
import { keybindToString } from "@ajayyy/maze-utils/lib/config";
|
import { keybindToString } from "../../maze-utils/src/config";
|
||||||
|
|
||||||
enum SkipButtonState {
|
enum SkipButtonState {
|
||||||
Undo, // Unskip
|
Undo, // Unskip
|
||||||
@@ -177,7 +177,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NoticeComponent noticeTitle={this.state.noticeTitle}
|
<NoticeComponent
|
||||||
|
noticeTitle={this.state.noticeTitle}
|
||||||
amountOfPreviousNotices={this.amountOfPreviousNotices}
|
amountOfPreviousNotices={this.amountOfPreviousNotices}
|
||||||
showInSecondSlot={this.showInSecondSlot}
|
showInSecondSlot={this.showInSecondSlot}
|
||||||
idSuffix={this.idSuffix}
|
idSuffix={this.idSuffix}
|
||||||
@@ -191,6 +192,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
ref={this.noticeRef}
|
ref={this.noticeRef}
|
||||||
closeListener={() => this.closeListener()}
|
closeListener={() => this.closeListener()}
|
||||||
smaller={this.state.smaller}
|
smaller={this.state.smaller}
|
||||||
|
logoFill={Config.config.barTypes[this.segments[0].category].color}
|
||||||
limitWidth={true}
|
limitWidth={true}
|
||||||
firstColumn={firstColumn}
|
firstColumn={firstColumn}
|
||||||
bottomRow={[...this.getMessageBoxes(), ...this.getBottomRow() ]}
|
bottomRow={[...this.getMessageBoxes(), ...this.getBottomRow() ]}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
|
|||||||
import { RectangleTooltip } from "../render/RectangleTooltip";
|
import { RectangleTooltip } from "../render/RectangleTooltip";
|
||||||
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
||||||
import { DEFAULT_CATEGORY } from "../utils/categoryUtils";
|
import { DEFAULT_CATEGORY } from "../utils/categoryUtils";
|
||||||
import { getFormattedTime, getFormattedTimeToSeconds } from "@ajayyy/maze-utils/lib/formating";
|
import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
|
||||||
|
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
import * as React from "react";
|
|
||||||
|
|
||||||
export interface TooltipProps {
|
|
||||||
text: string;
|
|
||||||
show: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TooltipState {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class TooltipComponent extends React.Component<TooltipProps, TooltipState> {
|
|
||||||
|
|
||||||
constructor(props: TooltipProps) {
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): React.ReactElement {
|
|
||||||
const style: React.CSSProperties = {
|
|
||||||
display: this.props.show ? "flex" : "none",
|
|
||||||
position: "absolute",
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span style={style}
|
|
||||||
className={"sponsorBlockTooltip"} >
|
|
||||||
<span className="sponsorBlockTooltipText">
|
|
||||||
{this.props.text}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TooltipComponent;
|
|
||||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
|||||||
import { createRoot, Root } from 'react-dom/client';
|
import { createRoot, Root } from 'react-dom/client';
|
||||||
import Config from "../../config";
|
import Config from "../../config";
|
||||||
import KeybindDialogComponent from "./KeybindDialogComponent";
|
import KeybindDialogComponent from "./KeybindDialogComponent";
|
||||||
import { formatKey, Keybind, keybindEquals, keybindToString } from "@ajayyy/maze-utils/lib/config";
|
import { formatKey, Keybind, keybindEquals, keybindToString } from "../../../maze-utils/src/config";
|
||||||
|
|
||||||
export interface KeybindProps {
|
export interface KeybindProps {
|
||||||
option: string;
|
option: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { ChangeEvent } from "react";
|
import { ChangeEvent } from "react";
|
||||||
import Config from "../../config";
|
import Config from "../../config";
|
||||||
import { Keybind, formatKey, keybindEquals } from "@ajayyy/maze-utils/lib/config";
|
import { Keybind, formatKey, keybindEquals } from "../../../maze-utils/src/config";
|
||||||
|
|
||||||
export interface KeybindDialogProps {
|
export interface KeybindDialogProps {
|
||||||
option: string;
|
option: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as CompileConfig from "../config.json";
|
import * as CompileConfig from "../config.json";
|
||||||
import * as invidiousList from "../ci/invidiouslist.json";
|
import * as invidiousList from "../ci/invidiouslist.json";
|
||||||
import { Category, CategorySelection, CategorySkipOption, NoticeVisbilityMode, PreviewBarOption, SponsorTime, VideoID, SponsorHideType } from "./types";
|
import { Category, CategorySelection, CategorySkipOption, NoticeVisbilityMode, PreviewBarOption, SponsorTime, VideoID, SponsorHideType } from "./types";
|
||||||
import { Keybind, ProtoConfig, keybindEquals } from "@ajayyy/maze-utils/lib/config";
|
import { Keybind, ProtoConfig, keybindEquals } from "../maze-utils/src/config";
|
||||||
import { HashedValue } from "@ajayyy/maze-utils/lib/hash";
|
import { HashedValue } from "../maze-utils/src/hash";
|
||||||
|
|
||||||
export interface Permission {
|
export interface Permission {
|
||||||
canSubmit: boolean;
|
canSubmit: boolean;
|
||||||
@@ -75,6 +75,7 @@ interface SBConfig {
|
|||||||
allowScrollingToEdit: boolean;
|
allowScrollingToEdit: boolean;
|
||||||
deArrowInstalled: boolean;
|
deArrowInstalled: boolean;
|
||||||
showDeArrowPromotion: boolean;
|
showDeArrowPromotion: boolean;
|
||||||
|
showZoomToFillError2: boolean;
|
||||||
|
|
||||||
// Used to cache calculated text color info
|
// Used to cache calculated text color info
|
||||||
categoryPillColors: {
|
categoryPillColors: {
|
||||||
@@ -147,6 +148,10 @@ class ConfigClass extends ProtoConfig<SBConfig, SBStorage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function migrateOldSyncFormats(config: SBConfig) {
|
function migrateOldSyncFormats(config: SBConfig) {
|
||||||
|
if (config["showZoomToFillError"]) {
|
||||||
|
chrome.storage.sync.remove("showZoomToFillError");
|
||||||
|
}
|
||||||
|
|
||||||
if (!config["chapterCategoryAdded"]) {
|
if (!config["chapterCategoryAdded"]) {
|
||||||
config["chapterCategoryAdded"] = true;
|
config["chapterCategoryAdded"] = true;
|
||||||
|
|
||||||
@@ -311,6 +316,7 @@ const syncDefaults = {
|
|||||||
allowScrollingToEdit: true,
|
allowScrollingToEdit: true,
|
||||||
deArrowInstalled: false,
|
deArrowInstalled: false,
|
||||||
showDeArrowPromotion: true,
|
showDeArrowPromotion: true,
|
||||||
|
showZoomToFillError2: true,
|
||||||
|
|
||||||
categoryPillColors: {},
|
categoryPillColors: {},
|
||||||
|
|
||||||
|
|||||||
176
src/content.ts
176
src/content.ts
@@ -24,7 +24,7 @@ import SubmissionNotice from "./render/SubmissionNotice";
|
|||||||
import { Message, MessageResponse, VoteResponse } from "./messageTypes";
|
import { Message, MessageResponse, VoteResponse } from "./messageTypes";
|
||||||
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
||||||
import { getStartTimeFromUrl } from "./utils/urlParser";
|
import { getStartTimeFromUrl } from "./utils/urlParser";
|
||||||
import { getControls, getExistingChapters, getHashParams, isVisible } from "./utils/pageUtils";
|
import { getControls, getExistingChapters, getHashParams, isPlayingPlaylist, isVisible } from "./utils/pageUtils";
|
||||||
import { CategoryPill } from "./render/CategoryPill";
|
import { CategoryPill } from "./render/CategoryPill";
|
||||||
import { AnimationUtils } from "./utils/animationUtils";
|
import { AnimationUtils } from "./utils/animationUtils";
|
||||||
import { GenericUtils } from "./utils/genericUtils";
|
import { GenericUtils } from "./utils/genericUtils";
|
||||||
@@ -32,18 +32,23 @@ import { logDebug } from "./utils/logger";
|
|||||||
import { importTimes } from "./utils/exporter";
|
import { importTimes } from "./utils/exporter";
|
||||||
import { ChapterVote } from "./render/ChapterVote";
|
import { ChapterVote } from "./render/ChapterVote";
|
||||||
import { openWarningDialog } from "./utils/warnings";
|
import { openWarningDialog } from "./utils/warnings";
|
||||||
import { isFirefoxOrSafari, waitFor } from "@ajayyy/maze-utils";
|
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
|
||||||
import { getErrorMessage, getFormattedTime } from "@ajayyy/maze-utils/lib/formating";
|
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
|
||||||
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube } from "@ajayyy/maze-utils/lib/video";
|
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube } from "../maze-utils/src/video";
|
||||||
import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "@ajayyy/maze-utils/lib/config";
|
import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "../maze-utils/src/config";
|
||||||
import { findValidElement, waitForElement } from "@ajayyy/maze-utils/lib/dom"
|
import { findValidElement, waitForElement } from "../maze-utils/src/dom"
|
||||||
import { getHash, HashedValue } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash, HashedValue } from "../maze-utils/src/hash";
|
||||||
import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
|
import { generateUserID } from "../maze-utils/src/setup";
|
||||||
import { updateAll } from "@ajayyy/maze-utils/lib/thumbnailManagement";
|
import { updateAll } from "../maze-utils/src/thumbnailManagement";
|
||||||
import { setupThumbnailListener } from "./utils/thumbnails";
|
import { setupThumbnailListener } from "./utils/thumbnails";
|
||||||
import * as documentScript from "../dist/js/document.js";
|
import * as documentScript from "../dist/js/document.js";
|
||||||
import { Tooltip } from "./render/Tooltip";
|
import { Tooltip } from "./render/Tooltip";
|
||||||
import { isDeArrowInstalled } from "./utils/crossExtension";
|
import { isDeArrowInstalled } from "./utils/crossExtension";
|
||||||
|
import { runCompatibilityChecks } from "./utils/compatibility";
|
||||||
|
import { cleanPage } from "./utils/pageCleaner";
|
||||||
|
import { addCleanupListener } from "../maze-utils/src/cleanup";
|
||||||
|
|
||||||
|
cleanPage();
|
||||||
|
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
@@ -87,7 +92,9 @@ utils.wait(() => Config.isReady(), 5000, 10).then(() => {
|
|||||||
Config.config.showDeArrowPromotion = false;
|
Config.config.showDeArrowPromotion = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 5000)
|
}, 5000);
|
||||||
|
|
||||||
|
runCompatibilityChecks();
|
||||||
});
|
});
|
||||||
|
|
||||||
const skipBuffer = 0.003;
|
const skipBuffer = 0.003;
|
||||||
@@ -470,6 +477,8 @@ function videoIDChange(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleMobileControlsMutations(): void {
|
function handleMobileControlsMutations(): void {
|
||||||
|
if (!chrome.runtime?.id) return;
|
||||||
|
|
||||||
updateVisibilityOfPlayerControlsButton();
|
updateVisibilityOfPlayerControlsButton();
|
||||||
|
|
||||||
skipButtonControlBar?.updateMobileControls();
|
skipButtonControlBar?.updateMobileControls();
|
||||||
@@ -521,7 +530,7 @@ function createPreviewBar(): void {
|
|||||||
selector: ".vjs-progress-holder",
|
selector: ".vjs-progress-holder",
|
||||||
isVisibleCheck: false
|
isVisibleCheck: false
|
||||||
}, {
|
}, {
|
||||||
// For Youtube Music
|
// For Youtube Music and YTKids
|
||||||
// there are two sliders, one for volume and one for progress - both called #progressContainer
|
// there are two sliders, one for volume and one for progress - both called #progressContainer
|
||||||
selector: "#progress-bar>#sliderContainer>div>#sliderBar>#progressContainer",
|
selector: "#progress-bar>#sliderContainer>div>#sliderBar>#progressContainer",
|
||||||
}, {
|
}, {
|
||||||
@@ -700,7 +709,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
|
|||||||
|
|
||||||
// Don't pretend to be earlier than we are, could result in loops
|
// Don't pretend to be earlier than we are, could result in loops
|
||||||
if (forcedSkipTime !== null && forceVideoTime > forcedSkipTime) {
|
if (forcedSkipTime !== null && forceVideoTime > forcedSkipTime) {
|
||||||
forcedSkipTime = null;
|
forcedSkipTime = forceVideoTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments);
|
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments);
|
||||||
@@ -794,11 +803,12 @@ function incorrectVideoCheck(videoID?: string, sponsorTime?: SponsorTime): boole
|
|||||||
const currentVideoID = getYouTubeVideoID();
|
const currentVideoID = getYouTubeVideoID();
|
||||||
const recordedVideoID = videoID || getVideoID();
|
const recordedVideoID = videoID || getVideoID();
|
||||||
if (currentVideoID !== recordedVideoID || (sponsorTime
|
if (currentVideoID !== recordedVideoID || (sponsorTime
|
||||||
&& (!sponsorTimes || !sponsorTimes?.some((time) => time.segment === sponsorTime.segment))
|
&& (!sponsorTimes || !sponsorTimes?.some((time) => time.segment[0] === sponsorTime.segment[0] && time.segment[1] === sponsorTime.segment[1]))
|
||||||
&& !sponsorTimesSubmitting.some((time) => time.segment === sponsorTime.segment))) {
|
&& !sponsorTimesSubmitting.some((time) => time.segment[0] === sponsorTime.segment[0] && time.segment[1] === sponsorTime.segment[1]))) {
|
||||||
// Something has really gone wrong
|
// Something has really gone wrong
|
||||||
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
||||||
console.error("[SponsorBlock] VideoID recorded: " + recordedVideoID + ". Actual VideoID: " + currentVideoID);
|
console.error("[SponsorBlock] VideoID recorded: " + recordedVideoID + ". Actual VideoID: " + currentVideoID);
|
||||||
|
console.error("[SponsorBlock] SponsorTime", sponsorTime, "sponsorTimes", sponsorTimes, "sponsorTimesSubmitting", sponsorTimesSubmitting);
|
||||||
|
|
||||||
// Video ID change occured
|
// Video ID change occured
|
||||||
checkVideoIDChange();
|
checkVideoIDChange();
|
||||||
@@ -809,18 +819,38 @@ function incorrectVideoCheck(videoID?: string, sponsorTime?: SponsorTime): boole
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let playbackRateCheckInterval: NodeJS.Timeout | null = null;
|
||||||
|
let lastPlaybackSpeed = 1;
|
||||||
|
let setupVideoListenersFirstTime = true;
|
||||||
function setupVideoListeners() {
|
function setupVideoListeners() {
|
||||||
//wait until it is loaded
|
//wait until it is loaded
|
||||||
getVideo().addEventListener('loadstart', videoOnReadyListener)
|
getVideo().addEventListener('loadstart', videoOnReadyListener)
|
||||||
getVideo().addEventListener('durationchange', durationChangeListener);
|
getVideo().addEventListener('durationchange', durationChangeListener);
|
||||||
|
|
||||||
|
if (setupVideoListenersFirstTime) {
|
||||||
|
addCleanupListener(() => {
|
||||||
|
getVideo().removeEventListener('loadstart', videoOnReadyListener);
|
||||||
|
getVideo().removeEventListener('durationchange', durationChangeListener);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!Config.config.disableSkipping) {
|
if (!Config.config.disableSkipping) {
|
||||||
switchingVideos = false;
|
switchingVideos = false;
|
||||||
|
|
||||||
let startedWaiting = false;
|
let startedWaiting = false;
|
||||||
let lastPausedAtZero = true;
|
let lastPausedAtZero = true;
|
||||||
|
|
||||||
getVideo().addEventListener('play', () => {
|
const rateChangeListener = () => {
|
||||||
|
updateVirtualTime();
|
||||||
|
clearWaitingTime();
|
||||||
|
|
||||||
|
startSponsorSchedule();
|
||||||
|
};
|
||||||
|
getVideo().addEventListener('ratechange', rateChangeListener);
|
||||||
|
// Used by videospeed extension (https://github.com/igrigorik/videospeed/pull/740)
|
||||||
|
getVideo().addEventListener('videoSpeed_ratechange', rateChangeListener);
|
||||||
|
|
||||||
|
const playListener = () => {
|
||||||
// If it is not the first event, then the only way to get to 0 is if there is a seek event
|
// If it is not the first event, then the only way to get to 0 is if there is a seek event
|
||||||
// This check makes sure that changing the video resolution doesn't cause the extension to think it
|
// This check makes sure that changing the video resolution doesn't cause the extension to think it
|
||||||
// gone back to the begining
|
// gone back to the begining
|
||||||
@@ -850,9 +880,10 @@ function setupVideoListeners() {
|
|||||||
|
|
||||||
startSponsorSchedule();
|
startSponsorSchedule();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
getVideo().addEventListener('play', playListener);
|
||||||
|
|
||||||
});
|
const playingListener = () => {
|
||||||
getVideo().addEventListener('playing', () => {
|
|
||||||
updateVirtualTime();
|
updateVirtualTime();
|
||||||
lastPausedAtZero = false;
|
lastPausedAtZero = false;
|
||||||
|
|
||||||
@@ -878,8 +909,31 @@ function setupVideoListeners() {
|
|||||||
|
|
||||||
startSponsorSchedule();
|
startSponsorSchedule();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
getVideo().addEventListener('seeking', () => {
|
if (playbackRateCheckInterval) clearInterval(playbackRateCheckInterval);
|
||||||
|
lastPlaybackSpeed = getVideo().playbackRate;
|
||||||
|
|
||||||
|
// Video speed controller compatibility
|
||||||
|
// That extension makes rate change events not propagate
|
||||||
|
if (document.body.classList.contains("vsc-initialized")) {
|
||||||
|
playbackRateCheckInterval = setInterval(() => {
|
||||||
|
if ((!getVideoID() || getVideo().paused) && playbackRateCheckInterval) {
|
||||||
|
// Video is gone, stop checking
|
||||||
|
clearInterval(playbackRateCheckInterval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getVideo().playbackRate !== lastPlaybackSpeed) {
|
||||||
|
lastPlaybackSpeed = getVideo().playbackRate;
|
||||||
|
|
||||||
|
rateChangeListener();
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getVideo().addEventListener('playing', playingListener);
|
||||||
|
|
||||||
|
const seekingListener = () => {
|
||||||
lastKnownVideoTime.fromPause = false;
|
lastKnownVideoTime.fromPause = false;
|
||||||
|
|
||||||
if (!getVideo().paused){
|
if (!getVideo().paused){
|
||||||
@@ -903,47 +957,56 @@ function setupVideoListeners() {
|
|||||||
lastPausedAtZero = true;
|
lastPausedAtZero = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
getVideo().addEventListener('ratechange', () => {
|
getVideo().addEventListener('seeking', seekingListener);
|
||||||
updateVirtualTime();
|
|
||||||
clearWaitingTime();
|
|
||||||
|
|
||||||
startSponsorSchedule();
|
|
||||||
});
|
|
||||||
// Used by videospeed extension (https://github.com/igrigorik/videospeed/pull/740)
|
|
||||||
getVideo().addEventListener('videoSpeed_ratechange', () => {
|
|
||||||
updateVirtualTime();
|
|
||||||
clearWaitingTime();
|
|
||||||
|
|
||||||
startSponsorSchedule();
|
|
||||||
});
|
|
||||||
const stoppedPlayback = () => {
|
const stoppedPlayback = () => {
|
||||||
// Reset lastCheckVideoTime
|
// Reset lastCheckVideoTime
|
||||||
lastCheckVideoTime = -1;
|
lastCheckVideoTime = -1;
|
||||||
lastCheckTime = 0;
|
lastCheckTime = 0;
|
||||||
|
|
||||||
|
if (playbackRateCheckInterval) clearInterval(playbackRateCheckInterval);
|
||||||
|
|
||||||
lastKnownVideoTime.videoTime = null;
|
lastKnownVideoTime.videoTime = null;
|
||||||
lastKnownVideoTime.preciseTime = null;
|
lastKnownVideoTime.preciseTime = null;
|
||||||
updateWaitingTime();
|
updateWaitingTime();
|
||||||
|
|
||||||
cancelSponsorSchedule();
|
cancelSponsorSchedule();
|
||||||
};
|
};
|
||||||
getVideo().addEventListener('pause', () => {
|
const pauseListener = () => {
|
||||||
lastKnownVideoTime.fromPause = true;
|
lastKnownVideoTime.fromPause = true;
|
||||||
|
|
||||||
stoppedPlayback();
|
stoppedPlayback();
|
||||||
});
|
};
|
||||||
getVideo().addEventListener('waiting', () => {
|
getVideo().addEventListener('pause', pauseListener);
|
||||||
|
const waitingListener = () => {
|
||||||
logDebug("[SB] Not skipping due to buffering");
|
logDebug("[SB] Not skipping due to buffering");
|
||||||
startedWaiting = true;
|
startedWaiting = true;
|
||||||
|
|
||||||
stoppedPlayback();
|
stoppedPlayback();
|
||||||
});
|
};
|
||||||
|
getVideo().addEventListener('waiting', waitingListener);
|
||||||
|
|
||||||
startSponsorSchedule();
|
startSponsorSchedule();
|
||||||
|
|
||||||
|
if (setupVideoListenersFirstTime) {
|
||||||
|
addCleanupListener(() => {
|
||||||
|
getVideo().removeEventListener('play', playListener);
|
||||||
|
getVideo().removeEventListener('playing', playingListener);
|
||||||
|
getVideo().removeEventListener('seeking', seekingListener);
|
||||||
|
getVideo().removeEventListener('ratechange', rateChangeListener);
|
||||||
|
getVideo().removeEventListener('videoSpeed_ratechange', rateChangeListener);
|
||||||
|
getVideo().removeEventListener('pause', pauseListener);
|
||||||
|
getVideo().removeEventListener('waiting', waitingListener);
|
||||||
|
|
||||||
|
if (playbackRateCheckInterval) clearInterval(playbackRateCheckInterval);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupVideoListenersFirstTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
function updateVirtualTime() {
|
function updateVirtualTime() {
|
||||||
if (currentVirtualTimeInterval) clearInterval(currentVirtualTimeInterval);
|
if (currentVirtualTimeInterval) clearInterval(currentVirtualTimeInterval);
|
||||||
|
|
||||||
@@ -1353,6 +1416,7 @@ async function channelIDChange(channelIDInfo: ChannelIDInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function videoElementChange(newVideo: boolean): void {
|
function videoElementChange(newVideo: boolean): void {
|
||||||
|
waitFor(() => Config.isReady()).then(() => {
|
||||||
if (newVideo) {
|
if (newVideo) {
|
||||||
setupVideoListeners();
|
setupVideoListeners();
|
||||||
setupSkipButtonControlBar();
|
setupSkipButtonControlBar();
|
||||||
@@ -1365,6 +1429,7 @@ function videoElementChange(newVideo: boolean): void {
|
|||||||
setTimeout(checkPreviewbarState, 100);
|
setTimeout(checkPreviewbarState, 100);
|
||||||
setTimeout(checkPreviewbarState, 1000);
|
setTimeout(checkPreviewbarState, 1000);
|
||||||
setTimeout(checkPreviewbarState, 5000);
|
setTimeout(checkPreviewbarState, 5000);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPreviewbarState(): void {
|
function checkPreviewbarState(): void {
|
||||||
@@ -1584,8 +1649,10 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
|||||||
// for some reason you also can't skip to 1 second before the end
|
// for some reason you also can't skip to 1 second before the end
|
||||||
if (v.loop && v.duration > 1 && skipTime[1] >= v.duration - 1) {
|
if (v.loop && v.duration > 1 && skipTime[1] >= v.duration - 1) {
|
||||||
v.currentTime = 0;
|
v.currentTime = 0;
|
||||||
} else if (navigator.vendor === "Apple Computer, Inc." && v.duration > 1 && skipTime[1] >= v.duration) {
|
} else if (v.duration > 1 && skipTime[1] >= v.duration
|
||||||
|
&& (navigator.vendor === "Apple Computer, Inc." || isPlayingPlaylist())) {
|
||||||
// MacOS will loop otherwise #1027
|
// MacOS will loop otherwise #1027
|
||||||
|
// Sometimes playlists loop too #1804
|
||||||
v.currentTime = v.duration - 0.001;
|
v.currentTime = v.duration - 0.001;
|
||||||
} else {
|
} else {
|
||||||
if (inMuteSegment(skipTime[1], true)) {
|
if (inMuteSegment(skipTime[1], true)) {
|
||||||
@@ -1616,9 +1683,10 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
|||||||
beep.play();
|
beep.play();
|
||||||
beep.addEventListener("ended", () => {
|
beep.addEventListener("ended", () => {
|
||||||
navigator.mediaSession.metadata = null;
|
navigator.mediaSession.metadata = null;
|
||||||
setTimeout(() =>
|
setTimeout(() => {
|
||||||
navigator.mediaSession.metadata = oldMetadata
|
navigator.mediaSession.metadata = oldMetadata;
|
||||||
);
|
beep.remove();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2328,11 +2396,21 @@ function previousChapter(): void {
|
|||||||
function addHotkeyListener(): void {
|
function addHotkeyListener(): void {
|
||||||
document.addEventListener("keydown", hotkeyListener);
|
document.addEventListener("keydown", hotkeyListener);
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
const onLoad = () => {
|
||||||
// Allow us to stop propagation to YouTube by being deeper
|
// Allow us to stop propagation to YouTube by being deeper
|
||||||
document.removeEventListener("keydown", hotkeyListener);
|
document.removeEventListener("keydown", hotkeyListener);
|
||||||
document.body.addEventListener("keydown", hotkeyListener);
|
document.body.addEventListener("keydown", hotkeyListener);
|
||||||
|
|
||||||
|
addCleanupListener(() => {
|
||||||
|
document.body.removeEventListener("keydown", hotkeyListener);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (document.readyState === "complete") {
|
||||||
|
onLoad();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", onLoad);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hotkeyListener(e: KeyboardEvent): void {
|
function hotkeyListener(e: KeyboardEvent): void {
|
||||||
@@ -2388,8 +2466,8 @@ function hotkeyListener(e: KeyboardEvent): void {
|
|||||||
* Adds the CSS to the page if needed. Required on optional sites with Chrome.
|
* Adds the CSS to the page if needed. Required on optional sites with Chrome.
|
||||||
*/
|
*/
|
||||||
function addCSS() {
|
function addCSS() {
|
||||||
if (!isFirefoxOrSafari() && Config.config.invidiousInstances.includes(new URL(document.URL).host)) {
|
if (!isFirefoxOrSafari() && Config.config.invidiousInstances.includes(new URL(document.URL).hostname)) {
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
const onLoad = () => {
|
||||||
const head = document.getElementsByTagName("head")[0];
|
const head = document.getElementsByTagName("head")[0];
|
||||||
|
|
||||||
for (const file of utils.css) {
|
for (const file of utils.css) {
|
||||||
@@ -2401,7 +2479,13 @@ function addCSS() {
|
|||||||
|
|
||||||
head.appendChild(fileref);
|
head.appendChild(fileref);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (document.readyState === "complete") {
|
||||||
|
onLoad();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", onLoad);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2486,7 +2570,9 @@ function setCategoryColorCSSVariables() {
|
|||||||
if (!styleContainer) {
|
if (!styleContainer) {
|
||||||
styleContainer = document.createElement("style");
|
styleContainer = document.createElement("style");
|
||||||
styleContainer.id = "sbCategoryColorStyle";
|
styleContainer.id = "sbCategoryColorStyle";
|
||||||
document.head.appendChild(styleContainer)
|
|
||||||
|
const head = (document.head || document.documentElement);
|
||||||
|
head.appendChild(styleContainer)
|
||||||
}
|
}
|
||||||
|
|
||||||
let css = ":root {"
|
let css = ":root {"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { init } from "@ajayyy/maze-utils/lib/injected/document";
|
import { init } from "../maze-utils/src/injected/document";
|
||||||
|
|
||||||
init();
|
init();
|
||||||
10
src/help.ts
10
src/help.ts
@@ -1,10 +1,14 @@
|
|||||||
import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup";
|
import { localizeHtmlPage } from "../maze-utils/src/setup";
|
||||||
import Config from "./config";
|
import Config from "./config";
|
||||||
import { showDonationLink } from "./utils/configUtils";
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
|
|
||||||
import { waitFor } from "@ajayyy/maze-utils";
|
import { waitFor } from "../maze-utils/src";
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', init);
|
if (document.readyState === "complete") {
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
localizeHtmlPage();
|
localizeHtmlPage();
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import { ActionType, Category, SegmentContainer, SponsorHideType, SponsorSourceT
|
|||||||
import { partition } from "../utils/arrayUtils";
|
import { partition } from "../utils/arrayUtils";
|
||||||
import { DEFAULT_CATEGORY, shortCategoryName } from "../utils/categoryUtils";
|
import { DEFAULT_CATEGORY, shortCategoryName } from "../utils/categoryUtils";
|
||||||
import { normalizeChapterName } from "../utils/exporter";
|
import { normalizeChapterName } from "../utils/exporter";
|
||||||
import { getFormattedTimeToSeconds } from "@ajayyy/maze-utils/lib/formating";
|
import { getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
|
||||||
import { findValidElement } from "@ajayyy/maze-utils/lib/dom";
|
import { findValidElement } from "../../maze-utils/src/dom";
|
||||||
|
import { addCleanupListener } from "../../maze-utils/src/cleanup";
|
||||||
|
|
||||||
const TOOLTIP_VISIBLE_CLASS = 'sponsorCategoryTooltipVisible';
|
const TOOLTIP_VISIBLE_CLASS = 'sponsorCategoryTooltipVisible';
|
||||||
const MIN_CHAPTER_SIZE = 0.003;
|
const MIN_CHAPTER_SIZE = 0.003;
|
||||||
@@ -97,7 +98,8 @@ class PreviewBar {
|
|||||||
this.chapterTooltip = document.createElement("div");
|
this.chapterTooltip = document.createElement("div");
|
||||||
this.chapterTooltip.className = "ytp-tooltip-title sponsorCategoryTooltip";
|
this.chapterTooltip.className = "ytp-tooltip-title sponsorCategoryTooltip";
|
||||||
|
|
||||||
const tooltipTextWrapper = document.querySelector(".ytp-tooltip-text-wrapper");
|
// global chaper tooltip or duration tooltip
|
||||||
|
const tooltipTextWrapper = document.querySelector(".ytp-tooltip-text-wrapper") ?? document.querySelector("#progress-bar-container.ytk-player > #hover-time-info");
|
||||||
const originalTooltip = tooltipTextWrapper.querySelector(".ytp-tooltip-title:not(.sponsorCategoryTooltip)") as HTMLElement;
|
const originalTooltip = tooltipTextWrapper.querySelector(".ytp-tooltip-title:not(.sponsorCategoryTooltip)") as HTMLElement;
|
||||||
if (!tooltipTextWrapper || !tooltipTextWrapper.parentElement) return;
|
if (!tooltipTextWrapper || !tooltipTextWrapper.parentElement) return;
|
||||||
|
|
||||||
@@ -200,6 +202,10 @@ class PreviewBar {
|
|||||||
childList: true,
|
childList: true,
|
||||||
subtree: true,
|
subtree: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addCleanupListener(() => {
|
||||||
|
observer.disconnect();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private setTooltipTitle(segment: PreviewBarSegment, tooltip: HTMLElement): void {
|
private setTooltipTitle(segment: PreviewBarSegment, tooltip: HTMLElement): void {
|
||||||
@@ -625,6 +631,11 @@ class PreviewBar {
|
|||||||
childListObserver.observe(this.originalChapterBar, {
|
childListObserver.observe(this.originalChapterBar, {
|
||||||
childList: true
|
childList: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addCleanupListener(() => {
|
||||||
|
attributeObserver.disconnect();
|
||||||
|
childListObserver.disconnect();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateChapterAllMutation(originalChapterBar: HTMLElement, progressBar: HTMLElement, firstUpdate = false): void {
|
private updateChapterAllMutation(originalChapterBar: HTMLElement, progressBar: HTMLElement, firstUpdate = false): void {
|
||||||
@@ -773,9 +784,12 @@ class PreviewBar {
|
|||||||
if (!Config.config.showSegmentNameInChapterBar
|
if (!Config.config.showSegmentNameInChapterBar
|
||||||
|| ((!segments || segments.length <= 0) && submittingSegments?.length <= 0)) {
|
|| ((!segments || segments.length <= 0) && submittingSegments?.length <= 0)) {
|
||||||
const chaptersContainer = this.getChaptersContainer();
|
const chaptersContainer = this.getChaptersContainer();
|
||||||
const chapterButton = this.getChapterButton(chaptersContainer);
|
if (chaptersContainer) {
|
||||||
if (chapterButton && chapterButton.classList.contains("ytp-chapter-container-disabled")) {
|
chaptersContainer.querySelector(".sponsorChapterText")?.remove();
|
||||||
chaptersContainer.style.display = "none";
|
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
|
||||||
|
|
||||||
|
chapterTitle.style.removeProperty("display");
|
||||||
|
chaptersContainer.classList.remove("sponsorblock-chapter-visible");
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
@@ -801,7 +815,7 @@ class PreviewBar {
|
|||||||
|
|
||||||
if (chaptersContainer) {
|
if (chaptersContainer) {
|
||||||
if (segments.length > 0) {
|
if (segments.length > 0) {
|
||||||
chaptersContainer.style.removeProperty("display");
|
chaptersContainer.classList.add("sponsorblock-chapter-visible");
|
||||||
|
|
||||||
const chosenSegment = segments.sort((a, b) => {
|
const chosenSegment = segments.sort((a, b) => {
|
||||||
if (a.actionType === ActionType.Chapter && b.actionType !== ActionType.Chapter) {
|
if (a.actionType === ActionType.Chapter && b.actionType !== ActionType.Chapter) {
|
||||||
@@ -818,11 +832,11 @@ class PreviewBar {
|
|||||||
chapterButton.disabled = false;
|
chapterButton.disabled = false;
|
||||||
|
|
||||||
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
|
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
|
||||||
chapterTitle.innerText = "";
|
chapterTitle.style.display = "none";
|
||||||
|
|
||||||
const chapterCustomText = (chapterTitle.querySelector(".sponsorChapterText") || (() => {
|
const chapterCustomText = (chapterTitle.parentElement.querySelector(".sponsorChapterText") || (() => {
|
||||||
const elem = document.createElement("div");
|
const elem = document.createElement("div");
|
||||||
chapterTitle.appendChild(elem);
|
chapterTitle.parentElement.insertBefore(elem, chapterTitle);
|
||||||
elem.classList.add("sponsorChapterText");
|
elem.classList.add("sponsorChapterText");
|
||||||
return elem;
|
return elem;
|
||||||
})()) as HTMLDivElement;
|
})()) as HTMLDivElement;
|
||||||
@@ -853,11 +867,10 @@ class PreviewBar {
|
|||||||
} else {
|
} else {
|
||||||
chaptersContainer.querySelector(".sponsorChapterText")?.remove();
|
chaptersContainer.querySelector(".sponsorChapterText")?.remove();
|
||||||
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
|
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
|
||||||
if (chapterTitle.innerText === "") {
|
|
||||||
chaptersContainer.style.display = "none";
|
chapterTitle.style.removeProperty("display");
|
||||||
} else {
|
chaptersContainer.classList.remove("sponsorblock-chapter-visible");
|
||||||
chaptersContainer.style.removeProperty("display");
|
|
||||||
}
|
|
||||||
this.chapterVote.setVisibility(false);
|
this.chapterVote.setVisibility(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Config from "../config";
|
|||||||
import { SponsorTime } from "../types";
|
import { SponsorTime } from "../types";
|
||||||
import { getSkippingText } from "../utils/categoryUtils";
|
import { getSkippingText } from "../utils/categoryUtils";
|
||||||
import { AnimationUtils } from "../utils/animationUtils";
|
import { AnimationUtils } from "../utils/animationUtils";
|
||||||
import { keybindToString } from "@ajayyy/maze-utils/lib/config";
|
import { keybindToString } from "../../maze-utils/src/config";
|
||||||
|
|
||||||
export interface SkipButtonControlBarProps {
|
export interface SkipButtonControlBarProps {
|
||||||
skip: (segment: SponsorTime) => void;
|
skip: (segment: SponsorTime) => void;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import CategoryChooser from "./render/CategoryChooser";
|
|||||||
import UnsubmittedVideos from "./render/UnsubmittedVideos";
|
import UnsubmittedVideos from "./render/UnsubmittedVideos";
|
||||||
import KeybindComponent from "./components/options/KeybindComponent";
|
import KeybindComponent from "./components/options/KeybindComponent";
|
||||||
import { showDonationLink } from "./utils/configUtils";
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup";
|
import { localizeHtmlPage } from "../maze-utils/src/setup";
|
||||||
import { StorageChangesObject } from "@ajayyy/maze-utils/lib/config";
|
import { StorageChangesObject } from "../maze-utils/src/config";
|
||||||
import { getHash } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash } from "../maze-utils/src/hash";
|
||||||
import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
|
import { isFirefoxOrSafari } from "../maze-utils/src";
|
||||||
import { isDeArrowInstalled } from "./utils/crossExtension";
|
import { isDeArrowInstalled } from "./utils/crossExtension";
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
let embed = false;
|
let embed = false;
|
||||||
@@ -24,7 +24,11 @@ let embed = false;
|
|||||||
const categoryChoosers: CategoryChooser[] = [];
|
const categoryChoosers: CategoryChooser[] = [];
|
||||||
const unsubmittedVideos: UnsubmittedVideos[] = [];
|
const unsubmittedVideos: UnsubmittedVideos[] = [];
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', init);
|
if (document.readyState === "complete") {
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
localizeHtmlPage();
|
localizeHtmlPage();
|
||||||
@@ -445,7 +449,12 @@ function invidiousInstanceAddInit(element: HTMLElement, option: string) {
|
|||||||
let instanceList = Config.config[option];
|
let instanceList = Config.config[option];
|
||||||
if (!instanceList) instanceList = [];
|
if (!instanceList) instanceList = [];
|
||||||
|
|
||||||
instanceList.push(textBox.value.trim().toLowerCase());
|
let domain = textBox.value.trim().toLowerCase();
|
||||||
|
if (domain.includes(":")) {
|
||||||
|
domain = domain.split(":")[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
instanceList.push(domain);
|
||||||
|
|
||||||
Config.config[option] = instanceList;
|
Config.config[option] = instanceList;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import Config from "./config";
|
import Config from "./config";
|
||||||
import Utils from "./utils";
|
import Utils from "./utils";
|
||||||
import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup";
|
import { localizeHtmlPage } from "../maze-utils/src/setup";
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
// This is needed, if Config is not imported before Utils, things break.
|
// This is needed, if Config is not imported before Utils, things break.
|
||||||
// Probably due to cyclic dependencies
|
// Probably due to cyclic dependencies
|
||||||
Config.config;
|
Config.config;
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', init);
|
if (document.readyState === "complete") {
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
localizeHtmlPage();
|
localizeHtmlPage();
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ import {
|
|||||||
import { showDonationLink } from "./utils/configUtils";
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
import { AnimationUtils } from "./utils/animationUtils";
|
import { AnimationUtils } from "./utils/animationUtils";
|
||||||
import { shortCategoryName } from "./utils/categoryUtils";
|
import { shortCategoryName } from "./utils/categoryUtils";
|
||||||
import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup";
|
import { localizeHtmlPage } from "../maze-utils/src/setup";
|
||||||
import { exportTimes } from "./utils/exporter";
|
import { exportTimes } from "./utils/exporter";
|
||||||
import GenericNotice from "./render/GenericNotice";
|
import GenericNotice from "./render/GenericNotice";
|
||||||
import { getErrorMessage, getFormattedTime } from "@ajayyy/maze-utils/lib/formating";
|
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
|
||||||
import { StorageChangesObject } from "@ajayyy/maze-utils/lib/config";
|
import { StorageChangesObject } from "../maze-utils/src/config";
|
||||||
import { getHash } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash } from "../maze-utils/src/hash";
|
||||||
|
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import Config from "../config";
|
|||||||
import { VoteResponse } from "../messageTypes";
|
import { VoteResponse } from "../messageTypes";
|
||||||
import { Category, SegmentUUID, SponsorTime } from "../types";
|
import { Category, SegmentUUID, SponsorTime } from "../types";
|
||||||
import { Tooltip } from "./Tooltip";
|
import { Tooltip } from "./Tooltip";
|
||||||
import { waitFor } from "@ajayyy/maze-utils";
|
import { waitFor } from "../../maze-utils/src";
|
||||||
import { getYouTubeTitleNode } from "@ajayyy/maze-utils/lib/elements";
|
import { getYouTubeTitleNode } from "../../maze-utils/src/elements";
|
||||||
|
import { addCleanupListener } from "../../maze-utils/src/cleanup";
|
||||||
|
|
||||||
const id = "categoryPill";
|
const id = "categoryPill";
|
||||||
|
|
||||||
@@ -24,6 +25,12 @@ export class CategoryPill {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.ref = React.createRef();
|
this.ref = React.createRef();
|
||||||
|
|
||||||
|
addCleanupListener(() => {
|
||||||
|
if (this.mutationObserver) {
|
||||||
|
this.mutationObserver.disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async attachToPage(onMobileYouTube: boolean, onInvidious: boolean,
|
async attachToPage(onMobileYouTube: boolean, onInvidious: boolean,
|
||||||
@@ -47,7 +54,11 @@ export class CategoryPill {
|
|||||||
|
|
||||||
this.root = createRoot(this.container);
|
this.root = createRoot(this.container);
|
||||||
this.ref = React.createRef();
|
this.ref = React.createRef();
|
||||||
this.root.render(<CategoryPillComponent ref={this.ref} vote={this.vote} />);
|
this.root.render(<CategoryPillComponent
|
||||||
|
ref={this.ref}
|
||||||
|
vote={this.vote}
|
||||||
|
showTextByDefault={!this.onMobileYouTube}
|
||||||
|
showTooltipOnClick={this.onMobileYouTube} />);
|
||||||
|
|
||||||
if (this.onMobileYouTube) {
|
if (this.onMobileYouTube) {
|
||||||
if (this.mutationObserver) {
|
if (this.mutationObserver) {
|
||||||
@@ -76,6 +87,7 @@ export class CategoryPill {
|
|||||||
// Use a parent because YouTube does weird things to the top level object
|
// Use a parent because YouTube does weird things to the top level object
|
||||||
// react would have to rerender if container was the top level
|
// react would have to rerender if container was the top level
|
||||||
const parent = document.createElement("span");
|
const parent = document.createElement("span");
|
||||||
|
parent.id = "categoryPillParent";
|
||||||
parent.appendChild(this.container);
|
parent.appendChild(this.container);
|
||||||
|
|
||||||
referenceNode.prepend(parent);
|
referenceNode.prepend(parent);
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import NoticeComponent from "../components/NoticeComponent";
|
|||||||
import Utils from "../utils";
|
import Utils from "../utils";
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
import { ButtonListener, ContentContainer } from "../types";
|
import { ContentContainer } from "../types";
|
||||||
import NoticeTextSelectionComponent from "../components/NoticeTextSectionComponent";
|
import NoticeTextSelectionComponent from "../components/NoticeTextSectionComponent";
|
||||||
|
import { ButtonListener } from "../../maze-utils/src/components/component-types";
|
||||||
|
|
||||||
export interface TextBox {
|
export interface TextBox {
|
||||||
icon: string;
|
icon: string;
|
||||||
@@ -46,6 +47,7 @@ export default class GenericNotice {
|
|||||||
const referenceNode = options.referenceNode ?? utils.findReferenceNode();
|
const referenceNode = options.referenceNode ?? utils.findReferenceNode();
|
||||||
|
|
||||||
this.noticeElement = document.createElement("div");
|
this.noticeElement = document.createElement("div");
|
||||||
|
this.noticeElement.className = "sponsorSkipNoticeContainer";
|
||||||
this.noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
this.noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
||||||
|
|
||||||
referenceNode.prepend(this.noticeElement);
|
referenceNode.prepend(this.noticeElement);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class SkipNotice {
|
|||||||
idSuffix += amountOfPreviousNotices;
|
idSuffix += amountOfPreviousNotices;
|
||||||
|
|
||||||
this.noticeElement = document.createElement("div");
|
this.noticeElement = document.createElement("div");
|
||||||
|
this.noticeElement.className = "sponsorSkipNoticeContainer";
|
||||||
this.noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
this.noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
||||||
|
|
||||||
referenceNode.prepend(this.noticeElement);
|
referenceNode.prepend(this.noticeElement);
|
||||||
|
|||||||
@@ -1,154 +1,7 @@
|
|||||||
import * as React from "react";
|
import { GenericTooltip, TooltipProps } from "../../maze-utils/src/components/Tooltip";
|
||||||
import { createRoot, Root } from 'react-dom/client';
|
|
||||||
import { ButtonListener } from "../types";
|
|
||||||
import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
|
|
||||||
import { isSafari } from "@ajayyy/maze-utils/lib/config";
|
|
||||||
|
|
||||||
export interface TooltipProps {
|
|
||||||
text?: string;
|
|
||||||
link?: string;
|
|
||||||
linkOnClick?: () => void;
|
|
||||||
referenceNode: HTMLElement;
|
|
||||||
prependElement?: HTMLElement; // Element to append before
|
|
||||||
bottomOffset?: string;
|
|
||||||
topOffset?: string;
|
|
||||||
leftOffset?: string;
|
|
||||||
rightOffset?: string;
|
|
||||||
timeout?: number;
|
|
||||||
opacity?: number;
|
|
||||||
displayTriangle?: boolean;
|
|
||||||
extraClass?: string;
|
|
||||||
showLogo?: boolean;
|
|
||||||
showGotIt?: boolean;
|
|
||||||
center?: boolean;
|
|
||||||
positionRealtive?: boolean;
|
|
||||||
containerAbsolute?: boolean;
|
|
||||||
buttons?: ButtonListener[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Tooltip {
|
|
||||||
text?: string;
|
|
||||||
container: HTMLDivElement;
|
|
||||||
|
|
||||||
timer: NodeJS.Timeout;
|
|
||||||
root: Root;
|
|
||||||
|
|
||||||
|
export class Tooltip extends GenericTooltip {
|
||||||
constructor(props: TooltipProps) {
|
constructor(props: TooltipProps) {
|
||||||
props.bottomOffset ??= "70px";
|
super(props, "icons/IconSponsorBlocker256px.png")
|
||||||
props.topOffset ??= "inherit";
|
|
||||||
props.leftOffset ??= "inherit";
|
|
||||||
props.rightOffset ??= "inherit";
|
|
||||||
props.opacity ??= 0.7;
|
|
||||||
props.displayTriangle ??= true;
|
|
||||||
props.extraClass ??= "";
|
|
||||||
props.showLogo ??= true;
|
|
||||||
props.showGotIt ??= true;
|
|
||||||
props.positionRealtive ??= true;
|
|
||||||
props.containerAbsolute ??= false;
|
|
||||||
props.center ??= false;
|
|
||||||
this.text = props.text;
|
|
||||||
|
|
||||||
this.container = document.createElement('div');
|
|
||||||
this.container.id = "sponsorTooltip" + props.text;
|
|
||||||
if (props.positionRealtive) this.container.style.position = "relative";
|
|
||||||
if (props.containerAbsolute) this.container.style.position = "absolute";
|
|
||||||
if (props.center) {
|
|
||||||
if (isFirefoxOrSafari() && !isSafari()) {
|
|
||||||
this.container.style.width = "-moz-available";
|
|
||||||
} else {
|
|
||||||
this.container.style.width = "-webkit-fill-available";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.prependElement) {
|
|
||||||
props.referenceNode.insertBefore(this.container, props.prependElement);
|
|
||||||
} else {
|
|
||||||
props.referenceNode.appendChild(this.container);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.timeout) {
|
|
||||||
this.timer = setTimeout(() => this.close(), props.timeout * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
const backgroundColor = `rgba(28, 28, 28, ${props.opacity})`;
|
|
||||||
|
|
||||||
this.root = createRoot(this.container);
|
|
||||||
this.root.render(
|
|
||||||
<div style={{
|
|
||||||
bottom: props.bottomOffset,
|
|
||||||
top: props.topOffset,
|
|
||||||
left: props.leftOffset,
|
|
||||||
right: props.rightOffset,
|
|
||||||
backgroundColor,
|
|
||||||
margin: props.center ? "auto" : null
|
|
||||||
}}
|
|
||||||
className={"sponsorBlockTooltip" +
|
|
||||||
(props.displayTriangle ? " sbTriangle" : "") +
|
|
||||||
` ${props.extraClass}`}>
|
|
||||||
<div>
|
|
||||||
{props.showLogo ?
|
|
||||||
<img className="sponsorSkipLogo sponsorSkipObject"
|
|
||||||
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
|
||||||
</img>
|
|
||||||
: null}
|
|
||||||
{this.text ?
|
|
||||||
<span className={`sponsorSkipObject${!props.showLogo ? ` sponsorSkipObjectFirst` : ``}`}>
|
|
||||||
{this.text + (props.link ? ". " : "")}
|
|
||||||
{props.link ?
|
|
||||||
<a style={{textDecoration: "underline"}}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
href={props.link}>
|
|
||||||
{chrome.i18n.getMessage("LearnMore")}
|
|
||||||
</a>
|
|
||||||
: (props.linkOnClick ?
|
|
||||||
<a style={{textDecoration: "underline", marginLeft: "5px", cursor: "pointer"}}
|
|
||||||
onClick={props.linkOnClick}>
|
|
||||||
{chrome.i18n.getMessage("LearnMore")}
|
|
||||||
</a>
|
|
||||||
: null)}
|
|
||||||
</span>
|
|
||||||
: null}
|
|
||||||
|
|
||||||
{this.getButtons(props.buttons)}
|
|
||||||
</div>
|
|
||||||
{props.showGotIt ?
|
|
||||||
<button className="sponsorSkipObject sponsorSkipNoticeButton"
|
|
||||||
style ={{float: "right" }}
|
|
||||||
onClick={() => this.close()}>
|
|
||||||
|
|
||||||
{chrome.i18n.getMessage("GotIt")}
|
|
||||||
</button>
|
|
||||||
: null}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
getButtons(buttons?: ButtonListener[]): JSX.Element[] {
|
|
||||||
if (buttons) {
|
|
||||||
const result: JSX.Element[] = [];
|
|
||||||
|
|
||||||
for (const button of buttons) {
|
|
||||||
result.push(
|
|
||||||
<button className="sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton"
|
|
||||||
key={button.name}
|
|
||||||
onClick={(e) => button.listener(e)}>
|
|
||||||
|
|
||||||
{button.name}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close(): void {
|
|
||||||
this.root.unmount();
|
|
||||||
this.container.remove();
|
|
||||||
|
|
||||||
if (this.timer) clearTimeout(this.timer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
55
src/svg-icons/sb_svg.tsx
Normal file
55
src/svg-icons/sb_svg.tsx
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
export interface SbIconProps {
|
||||||
|
id?: string;
|
||||||
|
fill?: string;
|
||||||
|
className?: string;
|
||||||
|
width?: string;
|
||||||
|
height?: string;
|
||||||
|
onClick?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SbSvg({
|
||||||
|
id = "",
|
||||||
|
fill = "#ff0000",
|
||||||
|
className = "",
|
||||||
|
onClick
|
||||||
|
}: SbIconProps): JSX.Element {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 565.15 568"
|
||||||
|
id={id}
|
||||||
|
className={className}
|
||||||
|
onClick={() => onClick?.() } >
|
||||||
|
<g
|
||||||
|
id="Layer_2"
|
||||||
|
data-name="Layer 2">
|
||||||
|
<g
|
||||||
|
id="Layer_1-2"
|
||||||
|
data-name="Layer 1"
|
||||||
|
style={{
|
||||||
|
fill
|
||||||
|
}}>
|
||||||
|
<path
|
||||||
|
d="M282.58,568a65,65,0,0,1-34.14-9.66C95.41,463.94,2.54,300.46,0,121A64.91,64.91,0,0,1,34,62.91a522.56,522.56,0,0,1,497.16,0,64.91,64.91,0,0,1,34,58.12c-2.53,179.43-95.4,342.91-248.42,437.3A65,65,0,0,1,282.58,568Zm0-548.31A502.24,502.24,0,0,0,43.4,80.22a45.27,45.27,0,0,0-23.7,40.53c2.44,172.67,91.81,330,239.07,420.83a46.19,46.19,0,0,0,47.61,0C453.64,450.73,543,293.42,545.45,120.75a45.26,45.26,0,0,0-23.7-40.54A502.26,502.26,0,0,0,282.58,19.69Z"
|
||||||
|
id="path8"
|
||||||
|
style={{
|
||||||
|
fill
|
||||||
|
}} />
|
||||||
|
<path
|
||||||
|
style={{
|
||||||
|
fill
|
||||||
|
}}
|
||||||
|
d="M 284.70508 42.693359 A 479.9 479.9 0 0 0 54.369141 100.41992 A 22.53 22.53 0 0 0 42.669922 120.41992 C 45.069922 290.25992 135.67008 438.63977 270.83008 522.00977 A 22.48 22.48 0 0 0 294.32031 522.00977 C 429.48031 438.63977 520.08047 290.25992 522.48047 120.41992 A 22.53 22.53 0 0 0 510.7793 100.41992 A 479.9 479.9 0 0 0 284.70508 42.693359 z M 220.41016 145.74023 L 411.2793 255.93945 L 220.41016 366.14062 L 220.41016 145.74023 z "
|
||||||
|
id="path10" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<polygon style={{
|
||||||
|
fill: "#fff"
|
||||||
|
}}
|
||||||
|
points="411.28 255.94 220.41 145.74 220.41 366.14 411.28 255.94"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -99,8 +99,8 @@ export interface Registration {
|
|||||||
message: string;
|
message: string;
|
||||||
id: string;
|
id: string;
|
||||||
allFrames: boolean;
|
allFrames: boolean;
|
||||||
js: browser.extensionTypes.ExtensionFileOrCode[];
|
js: string[];
|
||||||
css: browser.extensionTypes.ExtensionFileOrCode[];
|
css: string[];
|
||||||
matches: string[];
|
matches: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,8 +221,3 @@ export enum NoticeVisbilityMode {
|
|||||||
FadedForAutoSkip = 3,
|
FadedForAutoSkip = 3,
|
||||||
FadedForAll = 4
|
FadedForAll = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ButtonListener {
|
|
||||||
name: string;
|
|
||||||
listener: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
||||||
}
|
|
||||||
36
src/utils.ts
36
src/utils.ts
@@ -1,12 +1,12 @@
|
|||||||
import Config, { VideoDownvotes } from "./config";
|
import Config, { VideoDownvotes } from "./config";
|
||||||
import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType, CategorySkipOption } from "./types";
|
import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType, CategorySkipOption } from "./types";
|
||||||
|
|
||||||
import { getHash, HashedValue } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash, HashedValue } from "../maze-utils/src/hash";
|
||||||
import * as CompileConfig from "../config.json";
|
import * as CompileConfig from "../config.json";
|
||||||
import { isFirefoxOrSafari, waitFor } from "@ajayyy/maze-utils";
|
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
|
||||||
import { findValidElementFromSelector } from "@ajayyy/maze-utils/lib/dom";
|
import { findValidElementFromSelector } from "../maze-utils/src/dom";
|
||||||
import { FetchResponse, sendRequestToCustomServer } from "@ajayyy/maze-utils/lib/background-request-proxy"
|
import { FetchResponse, sendRequestToCustomServer } from "../maze-utils/src/background-request-proxy"
|
||||||
import { isSafari } from "@ajayyy/maze-utils/lib/config";
|
import { isSafari } from "../maze-utils/src/config";
|
||||||
|
|
||||||
export default class Utils {
|
export default class Utils {
|
||||||
|
|
||||||
@@ -47,9 +47,13 @@ export default class Utils {
|
|||||||
* @param {CallableFunction} callback
|
* @param {CallableFunction} callback
|
||||||
*/
|
*/
|
||||||
setupExtraSitePermissions(callback: (granted: boolean) => void): void {
|
setupExtraSitePermissions(callback: (granted: boolean) => void): void {
|
||||||
let permissions = ["webNavigation"];
|
const permissions = [];
|
||||||
if (!isSafari()) permissions.push("declarativeContent");
|
if (!isFirefoxOrSafari()) {
|
||||||
if (isFirefoxOrSafari() && !isSafari()) permissions = [];
|
permissions.push("declarativeContent");
|
||||||
|
}
|
||||||
|
if (!isFirefoxOrSafari() || isSafari()) {
|
||||||
|
permissions.push("webNavigation");
|
||||||
|
}
|
||||||
|
|
||||||
chrome.permissions.request({
|
chrome.permissions.request({
|
||||||
origins: this.getPermissionRegex(),
|
origins: this.getPermissionRegex(),
|
||||||
@@ -73,21 +77,12 @@ export default class Utils {
|
|||||||
* For now, it is just SB.config.invidiousInstances.
|
* For now, it is just SB.config.invidiousInstances.
|
||||||
*/
|
*/
|
||||||
setupExtraSiteContentScripts(): void {
|
setupExtraSiteContentScripts(): void {
|
||||||
const firefoxJS = [];
|
|
||||||
for (const file of this.js) {
|
|
||||||
firefoxJS.push({file});
|
|
||||||
}
|
|
||||||
const firefoxCSS = [];
|
|
||||||
for (const file of this.css) {
|
|
||||||
firefoxCSS.push({file});
|
|
||||||
}
|
|
||||||
|
|
||||||
const registration: Registration = {
|
const registration: Registration = {
|
||||||
message: "registerContentScript",
|
message: "registerContentScript",
|
||||||
id: "invidious",
|
id: "invidious",
|
||||||
allFrames: true,
|
allFrames: true,
|
||||||
js: firefoxJS,
|
js: this.js,
|
||||||
css: firefoxCSS,
|
css: this.css,
|
||||||
matches: this.getPermissionRegex()
|
matches: this.getPermissionRegex()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -299,7 +294,8 @@ export default class Utils {
|
|||||||
"#main-panel.ytmusic-player-page", // YouTube music
|
"#main-panel.ytmusic-player-page", // YouTube music
|
||||||
"#player-container .video-js", // Invidious
|
"#player-container .video-js", // Invidious
|
||||||
".main-video-section > .video-container", // Cloudtube
|
".main-video-section > .video-container", // Cloudtube
|
||||||
".shaka-video-container" // Piped
|
".shaka-video-container", // Piped
|
||||||
|
"#player-container.ytk-player", // YT Kids
|
||||||
];
|
];
|
||||||
|
|
||||||
let referenceNode = findValidElementFromSelector(selectors)
|
let referenceNode = findValidElementFromSelector(selectors)
|
||||||
|
|||||||
15
src/utils/compatibility.ts
Normal file
15
src/utils/compatibility.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import Config from "../config";
|
||||||
|
|
||||||
|
export function runCompatibilityChecks() {
|
||||||
|
if (Config.config.showZoomToFillError2 && document.URL.includes("watch?v=")) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const zoomToFill = document.querySelector(".zoomtofillBtn");
|
||||||
|
|
||||||
|
if (zoomToFill) {
|
||||||
|
alert(chrome.i18n.getMessage("zoomToFillUnsupported"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Config.config.showZoomToFillError2 = false;
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as CompileConfig from "../../config.json";
|
import * as CompileConfig from "../../config.json";
|
||||||
|
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { isSafari } from "@ajayyy/maze-utils/lib/config";
|
import { isSafari } from "../../maze-utils/src/config";
|
||||||
import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
|
import { isFirefoxOrSafari } from "../../maze-utils/src";
|
||||||
|
|
||||||
export function isDeArrowInstalled(): Promise<boolean> {
|
export function isDeArrowInstalled(): Promise<boolean> {
|
||||||
if (Config.config.deArrowInstalled) {
|
if (Config.config.deArrowInstalled) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ActionType, Category, SegmentUUID, SponsorSourceType, SponsorTime } from "../types";
|
import { ActionType, Category, SegmentUUID, SponsorSourceType, SponsorTime } from "../types";
|
||||||
import { shortCategoryName } from "./categoryUtils";
|
import { shortCategoryName } from "./categoryUtils";
|
||||||
import * as CompileConfig from "../../config.json";
|
import * as CompileConfig from "../../config.json";
|
||||||
import { getFormattedTime, getFormattedTimeToSeconds } from "@ajayyy/maze-utils/lib/formating";
|
import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
|
||||||
import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
|
import { generateUserID } from "../../maze-utils/src/setup";
|
||||||
|
|
||||||
const inTest = typeof chrome === "undefined";
|
const inTest = typeof chrome === "undefined";
|
||||||
|
|
||||||
|
|||||||
8
src/utils/pageCleaner.ts
Normal file
8
src/utils/pageCleaner.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export function cleanPage() {
|
||||||
|
// For live-updates
|
||||||
|
if (document.readyState === "complete") {
|
||||||
|
for (const element of document.querySelectorAll("#categoryPillParent, .playerButton, .sponsorThumbnailLabel, #submissionNoticeContainer, .sponsorSkipNoticeContainer, #sponsorBlockPopupContainer, .skipButtonControlBarContainer, #previewbar, .sponsorBlockChapterBar")) {
|
||||||
|
element.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ActionType, Category, SponsorSourceType, SponsorTime, VideoID } from "../types";
|
import { ActionType, Category, SponsorSourceType, SponsorTime, VideoID } from "../types";
|
||||||
import { getFormattedTimeToSeconds } from "@ajayyy/maze-utils/lib/formating";
|
import { getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
|
||||||
|
|
||||||
export function getControls(): HTMLElement {
|
export function getControls(): HTMLElement {
|
||||||
const controlsSelectors = [
|
const controlsSelectors = [
|
||||||
@@ -94,3 +94,7 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
|||||||
|
|
||||||
return chapters;
|
return chapters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isPlayingPlaylist() {
|
||||||
|
return !!document.URL.includes("&list=");
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { isOnInvidious, parseYouTubeVideoIDFromURL } from "@ajayyy/maze-utils/lib/video";
|
import { isOnInvidious, parseYouTubeVideoIDFromURL } from "../../maze-utils/src/video";
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { getVideoLabel } from "./videoLabels";
|
import { getVideoLabel } from "./videoLabels";
|
||||||
import { setThumbnailListener } from "@ajayyy/maze-utils/lib/thumbnailManagement";
|
import { setThumbnailListener } from "../../maze-utils/src/thumbnailManagement";
|
||||||
|
|
||||||
export async function labelThumbnails(thumbnails: HTMLImageElement[]): Promise<void> {
|
export async function labelThumbnails(thumbnails: HTMLImageElement[]): Promise<void> {
|
||||||
await Promise.all(thumbnails.map((t) => labelThumbnail(t)));
|
await Promise.all(thumbnails.map((t) => labelThumbnail(t)));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Category, CategorySkipOption, VideoID } from "../types";
|
import { Category, CategorySkipOption, VideoID } from "../types";
|
||||||
import { getHash } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash } from "../../maze-utils/src/hash";
|
||||||
import Utils from "../utils";
|
import Utils from "../utils";
|
||||||
import { logWarn } from "./logger";
|
import { logWarn } from "./logger";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { objectToURI } from "@ajayyy/maze-utils";
|
import { objectToURI } from "../../maze-utils/src";
|
||||||
import { getHash } from "@ajayyy/maze-utils/lib/hash";
|
import { getHash } from "../../maze-utils/src/hash";
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import GenericNotice, { NoticeOptions } from "../render/GenericNotice";
|
import GenericNotice, { NoticeOptions } from "../render/GenericNotice";
|
||||||
import { ContentContainer } from "../types";
|
import { ContentContainer } from "../types";
|
||||||
|
|||||||
@@ -16,5 +16,8 @@
|
|||||||
"dom",
|
"dom",
|
||||||
"dom.iterable"
|
"dom.iterable"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -16,5 +16,8 @@
|
|||||||
"dom",
|
"dom",
|
||||||
"dom.iterable"
|
"dom.iterable"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,8 @@ module.exports = env => {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.js']
|
extensions: ['.ts', '.tsx', '.js'],
|
||||||
|
symlinks: false
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// Prehook to start building document script before normal build
|
// Prehook to start building document script before normal build
|
||||||
|
|||||||
Reference in New Issue
Block a user