new plugin YoutubeAdblock: blocks ads in embeds (formerly WatchTogetherAdblock)
This commit is contained in:
parent
2658459a98
commit
0f8d21a846
4 changed files with 9 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
# WatchTogetherAdblock
|
# WatchTogetherAdblock
|
||||||
|
|
||||||
Block ads in the YouTube WatchTogether activity via AdGuard
|
Block ads in YouTube embeds and the WatchTogether activity via AdGuard
|
||||||
|
|
||||||
Note that this only works for yourself, other users in the activity will still see ads.
|
Note that this only works for yourself, other users in the activity will still see ads.
|
||||||
|
|
||||||
Powered by a modified version of [Adguard's BlockYoutubeAdsShortcut](https://github.com/AdguardTeam/BlockYouTubeAdsShortcut)
|
Powered by a modified version of [Adguard's BlockYoutubeAdsShortcut](https://github.com/AdguardTeam/BlockYouTubeAdsShortcut)
|
|
@ -4,12 +4,14 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { migratePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
// The entire code of this plugin can be found in native.ts
|
// The entire code of this plugin can be found in native.ts
|
||||||
|
migratePluginSettings("YoutubeAdblock", "WatchTogetherAdblock");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "WatchTogetherAdblock",
|
name: "YoutubeAdblock",
|
||||||
description: "Block ads in the YouTube WatchTogether activity via AdGuard",
|
description: "Block ads in YouTube embeds and the WatchTogether activity via AdGuard",
|
||||||
authors: [Devs.ImLvna],
|
authors: [Devs.ImLvna, Devs.Ven],
|
||||||
});
|
});
|
|
@ -11,9 +11,9 @@ import adguard from "file://adguard.js?minify";
|
||||||
app.on("browser-window-created", (_, win) => {
|
app.on("browser-window-created", (_, win) => {
|
||||||
win.webContents.on("frame-created", (_, { frame }) => {
|
win.webContents.on("frame-created", (_, { frame }) => {
|
||||||
frame.once("dom-ready", () => {
|
frame.once("dom-ready", () => {
|
||||||
if (frame.url.includes("discordsays") && frame.url.includes("youtube.com")) {
|
if (!RendererSettings.store.plugins?.YoutubeAdblock?.enabled) return;
|
||||||
if (!RendererSettings.store.plugins?.WatchTogetherAdblock?.enabled) return;
|
|
||||||
|
|
||||||
|
if (frame.url.includes("youtube.com/embed/") || (frame.url.includes("discordsays") && frame.url.includes("youtube.com"))) {
|
||||||
frame.executeJavaScript(adguard);
|
frame.executeJavaScript(adguard);
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in a new issue