Compare commits

..

13 Commits
5.4.8 ... 5.4.9

Author SHA1 Message Date
Ajay
35ac452a30 bump version 2023-06-21 23:11:02 -04:00
Ajay
de654e0016 update translations 2023-06-21 23:08:54 -04:00
Ajay
b4adee720f Add notice about dearrow, make dearrow links not appear if dearrow installed 2023-06-21 23:07:09 -04:00
Ajay
d4f668559c Add link in options to dearrow 2023-06-21 19:55:17 -04:00
Ajay
6b2b26faf5 update locales 2023-06-16 13:23:22 -04:00
Ajay
52135e7478 Merge branch 'master' of https://github.com/ajayyy/SponsorBlock 2023-06-16 13:22:46 -04:00
Ajay
10a0537b78 Fix video mutation listener refresh being called too many times 2023-06-16 13:22:43 -04:00
Ajay Ramachandran
b383acc902 Merge pull request #1705 from rakleed/border-radius
Add border radius like other YouTube elements
2023-06-16 12:26:41 -04:00
github-actions[bot]
f5706d9fe3 Update Invidious List (#1776)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-15 01:46:41 -04:00
Ajay
fea33945c7 bump maze utils again 2023-05-30 16:02:34 -04:00
Ajay
22826e3b36 Add some garbage collection to old thumbnail elements 2023-05-30 15:58:30 -04:00
Ajay
c7dad09555 Add warning when enabling filler 2023-05-29 14:39:44 -04:00
Pavel
992e727d93 Adds border radius like other YouTube elements 2023-03-22 03:42:42 +03:00
17 changed files with 260 additions and 23 deletions

View File

@@ -1 +1 @@
["inv.bp.projectsegfau.lt","inv.odyssey346.dev","inv.riverside.rocks","inv.vern.cc","invidious.baczek.me","invidious.epicsite.xyz","invidious.esmailelbob.xyz","invidious.flokinet.to","invidious.lidarshield.cloud","invidious.nerdvpn.de","invidious.privacydev.net","invidious.snopyta.org","invidious.tiekoetter.com","invidious.weblibre.org","iv.melmac.space","vid.puffyan.us","watch.thekitty.zone","y.com.sb","yewtu.be","yt.artemislena.eu","yt.funami.tech","yt.oelrichsgarcia.de"] ["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"]

View File

@@ -31,10 +31,16 @@
"mute": "https://wiki.sponsor.ajay.app/w/Mute_Segment", "mute": "https://wiki.sponsor.ajay.app/w/Mute_Segment",
"chapter": "https://wiki.sponsor.ajay.app/w/Chapter" "chapter": "https://wiki.sponsor.ajay.app/w/Chapter"
}, },
"extensionCommunicationAllowList": [ "extensionImportList": {
"enamippconapkdmgfgjchkhakpfinmaj", "chromium": [
"deArrow@ajay.app", "enamippconapkdmgfgjchkhakpfinmaj"
"deArrowBETA@ajay.app", ],
"app.ajay.dearrow.extension" "firefox": [
] "deArrow@ajay.app",
"deArrowBETA@ajay.app"
],
"safari": [
"app.ajay.dearrow.extension"
]
}
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "__MSG_fullName__", "name": "__MSG_fullName__",
"short_name": "SponsorBlock", "short_name": "SponsorBlock",
"version": "5.4.8", "version": "5.4.9",
"default_locale": "en", "default_locale": "en",
"description": "__MSG_Description__", "description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app", "homepage_url": "https://sponsor.ajay.app",
@@ -67,6 +67,7 @@
"icons/export.svg", "icons/export.svg",
"icons/PlayerInfoIconSponsorBlocker.svg", "icons/PlayerInfoIconSponsorBlocker.svg",
"icons/PlayerDeleteIconSponsorBlocker.svg", "icons/PlayerDeleteIconSponsorBlocker.svg",
"icons/dearrow.svg",
"popup.html", "popup.html",
"popup.css", "popup.css",
"content.css", "content.css",

14
package-lock.json generated
View File

@@ -27,7 +27,7 @@
], ],
"license": "LGPL-3.0-or-later", "license": "LGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@ajayyy/maze-utils": "1.1.29", "@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"
@@ -67,9 +67,9 @@
} }
}, },
"node_modules/@ajayyy/maze-utils": { "node_modules/@ajayyy/maze-utils": {
"version": "1.1.29", "version": "1.1.37",
"resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.29.tgz", "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.37.tgz",
"integrity": "sha512-P8htPiJjGmkkkELYducx0eiUo3/W0MEG6G/S3oJ/buFNxXRFXWb9ZTzu7/RSmEgmRFBRiKtXyGbjDhsYQDf1BA==", "integrity": "sha512-EOec/tfgTDdG2RFzfGdRpyBE3ACE7sAmzfKGzLZqhNznQGcCt/gELw49dHf7NeFzU+EU5vJ2jzTDizfB96gBMg==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@@ -13602,9 +13602,9 @@
}, },
"dependencies": { "dependencies": {
"@ajayyy/maze-utils": { "@ajayyy/maze-utils": {
"version": "1.1.29", "version": "1.1.37",
"resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.29.tgz", "resolved": "https://registry.npmjs.org/@ajayyy/maze-utils/-/maze-utils-1.1.37.tgz",
"integrity": "sha512-P8htPiJjGmkkkELYducx0eiUo3/W0MEG6G/S3oJ/buFNxXRFXWb9ZTzu7/RSmEgmRFBRiKtXyGbjDhsYQDf1BA==" "integrity": "sha512-EOec/tfgTDdG2RFzfGdRpyBE3ACE7sAmzfKGzLZqhNznQGcCt/gELw49dHf7NeFzU+EU5vJ2jzTDizfB96gBMg=="
}, },
"@ampproject/remapping": { "@ampproject/remapping": {
"version": "2.2.0", "version": "2.2.0",

View File

@@ -4,7 +4,7 @@
"description": "", "description": "",
"main": "background.js", "main": "background.js",
"dependencies": { "dependencies": {
"@ajayyy/maze-utils": "1.1.29", "@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"

View File

@@ -730,11 +730,12 @@ input::-webkit-inner-spin-button {
border-radius: 5px; border-radius: 5px;
padding: 10px; padding: 10px;
max-width: 300px; max-width: 300px;
width: max-content;
white-space: normal; white-space: normal;
line-height: 1.5em; line-height: 1.5em;
color: white; color: white;
font-size: 12px; font-size: 12px;
z-index: 1000; z-index: 10000;
} }
.sponsorBlockTooltip a { .sponsorBlockTooltip a {

54
public/icons/dearrow.svg Normal file
View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="800px"
height="800px"
viewBox="0 0 36 36"
aria-hidden="true"
role="img"
class="iconify iconify--twemoji"
preserveAspectRatio="xMidYMid meet"
version="1.1"
id="svg10"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs14" />
<sodipodi:namedview
id="namedview12"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="0.65479573"
inkscape:cx="493.2836"
inkscape:cy="514.66432"
inkscape:window-width="1920"
inkscape:window-height="983"
inkscape:window-x="435"
inkscape:window-y="768"
inkscape:window-maximized="1"
inkscape:current-layer="svg10" />
<path
fill="#1213BD"
d="M36 18.302c0 4.981-2.46 9.198-5.655 12.462s-7.323 5.152-12.199 5.152s-9.764-1.112-12.959-4.376S0 23.283 0 18.302s2.574-9.38 5.769-12.644S13.271 0 18.146 0s9.394 2.178 12.589 5.442C33.931 8.706 36 13.322 36 18.302z"
id="path2" />
<path
fill="#ffffff"
d="m 30.394282,18.410186 c 0,3.468849 -1.143025,6.865475 -3.416513,9.137917 -2.273489,2.272442 -5.670115,2.92874 -9.137918,2.92874 -3.467803,0 -6.373515,-1.147212 -8.6470033,-3.419654 -2.2734888,-2.272442 -3.5871299,-5.178154 -3.5871299,-8.647003 0,-3.46885 0.9420533,-6.746149 3.2144954,-9.0196379 2.2724418,-2.2734888 5.5507878,-3.9513905 9.0196378,-3.9513905 3.46885,0 6.492841,1.9322561 8.76633,4.204698 2.273489,2.2724424 3.788101,5.2974804 3.788101,8.7663304 z"
id="path4"
style="fill:#88c9f9;fill-opacity:1;stroke-width:1.04673" />
<path
fill="#292f33"
d="m 23.95823,17.818306 c 0,3.153748 -2.644888,5.808102 -5.798635,5.808102 -3.153748,0 -5.599825,-2.654354 -5.599825,-5.808102 0,-3.153747 2.446077,-5.721714 5.599825,-5.721714 3.153747,0 5.798635,2.567967 5.798635,5.721714 z"
id="path8"
style="stroke-width:1.18339;fill:#0a62a5;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -38,7 +38,7 @@
--white: black; --white: black;
} }
.medium-description, .switch-container, .optionLabel, .categoryTableElement { .medium-description, .switch-container, .optionLabel, .categoryTableElement, .promotion-description {
color: var(--white); color: var(--white);
} }
@@ -702,3 +702,19 @@ svg {
border: none !important; border: none !important;
padding: 20px 0px 0px 0px !important; padding: 20px 0px 0px 0px !important;
} }
#deArrowPromotion {
width: fit-content;
}
.dearrow-link {
display: flex;
align-items: center;
justify-content: center;
text-decoration: none;
}
.dearrow-link > img {
width: 40px;
margin-right: 4px;
}

View File

@@ -65,6 +65,19 @@
</div> </div>
<div id="deArrowPromotion" class="hidden">
<a class="dearrow-link"
href="https://dearrow.ajay.app"
target="_blank"
rel="noreferrer">
<img src="/icons/dearrow.svg"/>
<span class="promotion-description">
__MSG_DeArrowPromotionMessage__
</span>
</a>
</div>
<div data-type="toggle" data-sync="muteSegments"> <div data-type="toggle" data-sync="muteSegments">
<div class="switch-container"> <div class="switch-container">
<label class="switch"> <label class="switch">
@@ -342,6 +355,18 @@
</div> </div>
</div> </div>
<div data-type="toggle" data-toggle-type="reverse" data-sync="showNewFeaturePopups">
<div class="switch-container">
<label class="switch">
<input id="showNewFeaturePopups" type="checkbox" checked>
<span class="slider round"></span>
</label>
<label class="switch-label" for="showNewFeaturePopups">
__MSG_hideNewFeatureUpdates__
</label>
</div>
</div>
<div data-type="toggle" data-toggle-type="reverse" data-sync="showDonationLink" data-no-safari="true"> <div data-type="toggle" data-toggle-type="reverse" data-sync="showDonationLink" data-no-safari="true">
<div class="switch-container"> <div class="switch-container">
<label class="switch"> <label class="switch">

View File

@@ -12,6 +12,7 @@ import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
window.SB = Config; window.SB = Config;
import Utils from "./utils"; import Utils from "./utils";
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
const utils = new Utils({ const utils = new Utils({
registerFirefoxContentScript, registerFirefoxContentScript,
unregisterFirefoxContentScript unregisterFirefoxContentScript
@@ -80,7 +81,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
}); });
chrome.runtime.onMessageExternal.addListener((request, sender, callback) => { chrome.runtime.onMessageExternal.addListener((request, sender, callback) => {
if (CompileConfig.extensionCommunicationAllowList.includes(sender.id)) { if (getExtensionIdsToImportFrom().includes(sender.id)) {
if (request.message === "requestConfig") { if (request.message === "requestConfig") {
callback({ callback({
userID: Config.config.userID, userID: Config.config.userID,

View File

@@ -139,6 +139,12 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
case "autoSkip": case "autoSkip":
option = CategorySkipOption.AutoSkip; option = CategorySkipOption.AutoSkip;
if (this.props.category === "filler" && !Config.config.isVip) {
if (!confirm(chrome.i18n.getMessage("FillerWarning"))) {
event.target.value = "disable";
}
}
break; break;
} }

View File

@@ -54,6 +54,7 @@ interface SBConfig {
showDonationLink: boolean; showDonationLink: boolean;
showPopupDonationCount: number; showPopupDonationCount: number;
showUpsells: boolean; showUpsells: boolean;
showNewFeaturePopups: boolean;
donateClicked: number; donateClicked: number;
autoHideInfoButton: boolean; autoHideInfoButton: boolean;
autoSkipOnMusicVideos: boolean; autoSkipOnMusicVideos: boolean;
@@ -72,6 +73,8 @@ interface SBConfig {
useVirtualTime: boolean; useVirtualTime: boolean;
showSegmentFailedToFetchWarning: boolean; showSegmentFailedToFetchWarning: boolean;
allowScrollingToEdit: boolean; allowScrollingToEdit: boolean;
deArrowInstalled: boolean;
showDeArrowPromotion: boolean;
// Used to cache calculated text color info // Used to cache calculated text color info
categoryPillColors: { categoryPillColors: {
@@ -292,6 +295,7 @@ const syncDefaults = {
showDonationLink: true, showDonationLink: true,
showPopupDonationCount: 0, showPopupDonationCount: 0,
showUpsells: true, showUpsells: true,
showNewFeaturePopups: true,
donateClicked: 0, donateClicked: 0,
autoHideInfoButton: true, autoHideInfoButton: true,
autoSkipOnMusicVideos: false, autoSkipOnMusicVideos: false,
@@ -305,6 +309,8 @@ const syncDefaults = {
useVirtualTime: true, useVirtualTime: true,
showSegmentFailedToFetchWarning: true, showSegmentFailedToFetchWarning: true,
allowScrollingToEdit: true, allowScrollingToEdit: true,
deArrowInstalled: false,
showDeArrowPromotion: true,
categoryPillColors: {}, categoryPillColors: {},

View File

@@ -36,12 +36,14 @@ import { isFirefoxOrSafari, waitFor } from "@ajayyy/maze-utils";
import { getErrorMessage, getFormattedTime } from "@ajayyy/maze-utils/lib/formating"; import { getErrorMessage, getFormattedTime } from "@ajayyy/maze-utils/lib/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 "@ajayyy/maze-utils/lib/video";
import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "@ajayyy/maze-utils/lib/config"; import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "@ajayyy/maze-utils/lib/config";
import { findValidElement } from "@ajayyy/maze-utils/lib/dom" import { findValidElement, waitForElement } from "@ajayyy/maze-utils/lib/dom"
import { getHash, HashedValue } from "@ajayyy/maze-utils/lib/hash"; import { getHash, HashedValue } from "@ajayyy/maze-utils/lib/hash";
import { generateUserID } from "@ajayyy/maze-utils/lib/setup"; import { generateUserID } from "@ajayyy/maze-utils/lib/setup";
import { updateAll } from "@ajayyy/maze-utils/lib/thumbnailManagement"; import { updateAll } from "@ajayyy/maze-utils/lib/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 { isDeArrowInstalled } from "./utils/crossExtension";
const utils = new Utils(); const utils = new Utils();
@@ -49,6 +51,42 @@ utils.wait(() => Config.isReady(), 5000, 10).then(() => {
// Hack to get the CSS loaded on permission-based sites (Invidious) // Hack to get the CSS loaded on permission-based sites (Invidious)
addCSS(); addCSS();
setCategoryColorCSSVariables(); setCategoryColorCSSVariables();
// DeArrow promotion
setTimeout(async () => {
if (document.URL === "https://www.youtube.com/"
&& Config.config.showDeArrowPromotion
&& Config.config.showUpsells
&& Config.config.showNewFeaturePopups
&& Math.random() < 0.05) {
if (!await isDeArrowInstalled()) {
const element = await waitForElement("#contents") as HTMLElement;
if (element) {
Config.config.showDeArrowPromotion = false;
new Tooltip({
text: chrome.i18n.getMessage("DeArrowPromotionMessage2"),
linkOnClick: () => window.open("https://dearrow.ajay.app"),
referenceNode: element,
prependElement: element.firstElementChild as HTMLElement,
timeout: 15000,
positionRealtive: false,
containerAbsolute: true,
bottomOffset: "inherit",
topOffset: "-82px",
leftOffset: "0",
rightOffset: "0",
displayTriangle: false,
center: true,
opacity: 1
});
}
} else {
Config.config.showDeArrowPromotion = false;
}
}
}, 5000)
}); });
const skipBuffer = 0.003; const skipBuffer = 0.003;
@@ -1928,6 +1966,7 @@ function openInfoMenu() {
const frame = document.createElement("iframe"); const frame = document.createElement("iframe");
frame.width = "374"; frame.width = "374";
frame.height = "500"; frame.height = "500";
frame.style.borderRadius = "12px";
frame.addEventListener("load", () => frame.contentWindow.postMessage("", "*")); frame.addEventListener("load", () => frame.contentWindow.postMessage("", "*"));
frame.src = chrome.extension.getURL("popup.html"); frame.src = chrome.extension.getURL("popup.html");
popup.appendChild(frame); popup.appendChild(frame);

View File

@@ -17,6 +17,7 @@ import { localizeHtmlPage } from "@ajayyy/maze-utils/lib/setup";
import { StorageChangesObject } from "@ajayyy/maze-utils/lib/config"; import { StorageChangesObject } from "@ajayyy/maze-utils/lib/config";
import { getHash } from "@ajayyy/maze-utils/lib/hash"; import { getHash } from "@ajayyy/maze-utils/lib/hash";
import { isFirefoxOrSafari } from "@ajayyy/maze-utils"; import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
import { isDeArrowInstalled } from "./utils/crossExtension";
const utils = new Utils(); const utils = new Utils();
let embed = false; let embed = false;
@@ -68,6 +69,18 @@ async function init() {
donate.classList.add("hidden"); donate.classList.add("hidden");
} }
// DeArrow promotion
if (Config.config.showNewFeaturePopups && Config.config.showUpsells) {
isDeArrowInstalled().then((installed) => {
if (!installed) {
const deArrowPromotion = document.getElementById("deArrowPromotion");
deArrowPromotion.classList.remove("hidden");
deArrowPromotion.addEventListener("click", () => Config.config.showDeArrowPromotion = false);
}
});
}
// Set all of the toggle options to the correct option // Set all of the toggle options to the correct option
const optionsContainer = document.getElementById("options"); const optionsContainer = document.getElementById("options");
const optionsElements = optionsContainer.querySelectorAll("*"); const optionsElements = optionsContainer.querySelectorAll("*");

View File

@@ -1,6 +1,8 @@
import * as React from "react"; import * as React from "react";
import { createRoot, Root } from 'react-dom/client'; import { createRoot, Root } from 'react-dom/client';
import { ButtonListener } from "../types"; import { ButtonListener } from "../types";
import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
import { isSafari } from "@ajayyy/maze-utils/lib/config";
export interface TooltipProps { export interface TooltipProps {
text?: string; text?: string;
@@ -9,6 +11,7 @@ export interface TooltipProps {
referenceNode: HTMLElement; referenceNode: HTMLElement;
prependElement?: HTMLElement; // Element to append before prependElement?: HTMLElement; // Element to append before
bottomOffset?: string; bottomOffset?: string;
topOffset?: string;
leftOffset?: string; leftOffset?: string;
rightOffset?: string; rightOffset?: string;
timeout?: number; timeout?: number;
@@ -17,7 +20,9 @@ export interface TooltipProps {
extraClass?: string; extraClass?: string;
showLogo?: boolean; showLogo?: boolean;
showGotIt?: boolean; showGotIt?: boolean;
center?: boolean;
positionRealtive?: boolean; positionRealtive?: boolean;
containerAbsolute?: boolean;
buttons?: ButtonListener[]; buttons?: ButtonListener[];
} }
@@ -30,6 +35,7 @@ export class Tooltip {
constructor(props: TooltipProps) { constructor(props: TooltipProps) {
props.bottomOffset ??= "70px"; props.bottomOffset ??= "70px";
props.topOffset ??= "inherit";
props.leftOffset ??= "inherit"; props.leftOffset ??= "inherit";
props.rightOffset ??= "inherit"; props.rightOffset ??= "inherit";
props.opacity ??= 0.7; props.opacity ??= 0.7;
@@ -38,11 +44,21 @@ export class Tooltip {
props.showLogo ??= true; props.showLogo ??= true;
props.showGotIt ??= true; props.showGotIt ??= true;
props.positionRealtive ??= true; props.positionRealtive ??= true;
props.containerAbsolute ??= false;
props.center ??= false;
this.text = props.text; this.text = props.text;
this.container = document.createElement('div'); this.container = document.createElement('div');
this.container.id = "sponsorTooltip" + props.text; this.container.id = "sponsorTooltip" + props.text;
if (props.positionRealtive) this.container.style.position = "relative"; 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) { if (props.prependElement) {
props.referenceNode.insertBefore(this.container, props.prependElement); props.referenceNode.insertBefore(this.container, props.prependElement);
@@ -58,8 +74,17 @@ export class Tooltip {
this.root = createRoot(this.container); this.root = createRoot(this.container);
this.root.render( this.root.render(
<div style={{bottom: props.bottomOffset, left: props.leftOffset, right: props.rightOffset, backgroundColor}} <div style={{
className={"sponsorBlockTooltip" + (props.displayTriangle ? " sbTriangle" : "") + ` ${props.extraClass}`}> 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> <div>
{props.showLogo ? {props.showLogo ?
<img className="sponsorSkipLogo sponsorSkipObject" <img className="sponsorSkipLogo sponsorSkipObject"

View File

@@ -0,0 +1,44 @@
import * as CompileConfig from "../../config.json";
import Config from "../config";
import { isSafari } from "@ajayyy/maze-utils/lib/config";
import { isFirefoxOrSafari } from "@ajayyy/maze-utils";
export function isDeArrowInstalled(): Promise<boolean> {
if (Config.config.deArrowInstalled) {
return Promise.resolve(true);
} else {
return new Promise((resolve) => {
const extensionIds = getExtensionIdsToImportFrom();
let count = 0;
for (const id of extensionIds) {
chrome.runtime.sendMessage(id, { message: "isInstalled" }, (response) => {
if (chrome.runtime.lastError) {
count++;
if (count === extensionIds.length) {
resolve(false);
}
return;
}
resolve(response);
if (response) {
Config.config.deArrowInstalled = true;
}
});
}
});
}
}
export function getExtensionIdsToImportFrom(): string[] {
if (isSafari()) {
return CompileConfig.extensionImportList.safari;
} else if (isFirefoxOrSafari()) {
return CompileConfig.extensionImportList.firefox;
} else {
return CompileConfig.extensionImportList.chromium;
}
}