Compare commits

...

21 Commits

Author SHA1 Message Date
Ajay
d1b2def47c bump version 2023-09-06 11:45:08 -04:00
Ajay Ramachandran
48cdabe2a5 Merge pull request #1534 from EthanBnntt/EthanBnntt-patch-1
Reduced execution time of hexToRgb function by ~70%
2023-09-05 01:28:23 -04:00
Ajay Ramachandran
bc2db0cf2c Merge branch 'master' into EthanBnntt-patch-1 2023-09-05 01:28:15 -04:00
Ajay Ramachandran
843ef37dcd Merge pull request #1814 from ajayyy/ci/update_invidious_list
Update Invidious List
2023-09-05 01:25:54 -04:00
Ajay
ed260a0667 Fix clicking a video from homepage on mobile YouTube
Fixes https://github.com/ajayyy/SponsorBlock/issues/1849
2023-09-05 01:19:50 -04:00
Ajay
2e131c2a95 Stop spacebar in chapters box from pausing video 2023-09-04 02:37:19 -04:00
Ajay
f5e884b6aa Merge branch 'master' of https://github.com/ajayyy/SponsorBlock 2023-09-03 21:29:02 -04:00
Ajay
a9929d0c93 Adjust dearrow message params 2023-09-03 21:29:00 -04:00
github-actions[bot]
3fb43d1c0e Update Invidious List 2023-09-01 00:19:28 +00:00
Ajay Ramachandran
a1b2855538 Merge pull request #1842 from ajayyy/ci/oss_attribution
Update OSS Attribution
2023-08-25 21:49:27 -04:00
github-actions[bot]
07236baed5 Update OSS Attribution 2023-08-26 01:30:48 +00:00
Ajay
f991435857 Switch back to upstream content-scripts-register-polyfill 2023-08-25 21:29:39 -04:00
Ajay
faa3259165 Fix invidious support on Safari for iOS 2023-08-25 20:22:58 -04:00
Ajay
c96bafb6f7 bump version 2023-08-25 18:39:52 -04:00
Ajay
9b7680f0e6 Fix invidious support on Safari 2023-08-25 16:38:50 -04:00
Ajay
16e01b7494 Fix comment 2023-08-25 16:34:08 -04:00
Ajay
6cd697dc32 bump version 2023-08-25 16:03:33 -04:00
Ajay
9946bd1af2 Use chromep in another spot 2023-08-25 16:03:17 -04:00
Ajay
3b06d72270 Fix invidious support of Firefox 2023-08-25 16:01:11 -04:00
Ajay
4bd0556464 Remove webnavigation optional permission from firefox 2023-08-23 22:44:41 -04:00
Bennett
edaed61612 Reduced execution time of hexToRgb function by ~70%
Coded to use less regex.
On average, "indexOf" performs better than "parseInt."
2022-10-13 14:48:17 -04:00
14 changed files with 61 additions and 56 deletions

View File

@@ -1 +1 @@
["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"]
["www.youtubekids.com","inv.bp.projectsegfau.lt","inv.citw.lgbt","inv.in.projectsegfau.lt","inv.makerlab.tech","inv.pistasjis.net","inv.tux.pizza","inv.zzls.xyz","invidious.0011.lt","invidious.io.lol","invidious.lunar.icu","invidious.no-logs.com","invidious.projectsegfau.lt","invidious.protokolla.fi","invidious.slipfox.xyz","invidious.tiekoetter.com","iv.ggtyler.dev","iv.melmac.space","iv.nboeck.de","onion.tube","vid.priv.au","vid.puffyan.us","yewtu.be","yt.artemislena.eu","yt.oelrichsgarcia.de"]

View File

@@ -1,6 +1,7 @@
{
"optional_permissions": [
"declarativeContent"
"declarativeContent",
"webNavigation"
],
"background": {
"persistent": false

View File

@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "SponsorBlock",
"version": "5.4.16",
"version": "5.4.19",
"default_locale": "en",
"description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app",
@@ -84,8 +84,7 @@
"https://sponsor.ajay.app/*"
],
"optional_permissions": [
"*://*/*",
"webNavigation"
"*://*/*"
],
"browser_action": {
"default_title": "SponsorBlock",

View File

@@ -4,5 +4,8 @@
},
"permissions": [
"scripting"
],
"optional_permissions": [
"webNavigation"
]
}

View File

@@ -62,7 +62,7 @@
"webext-content-scripts": {
"ignore": false,
"name": "webext-content-scripts",
"version": "2.5.2",
"version": "2.5.5",
"authors": "Federico Brigante <me@fregante.com> (https://fregante.com)",
"url": "https://github.com/fregante/webext-content-scripts",
"license": "MIT",
@@ -80,7 +80,7 @@
"webext-polyfill-kinda": {
"ignore": false,
"name": "webext-polyfill-kinda",
"version": "1.0.0",
"version": "1.0.2",
"authors": "Federico Brigante <me@fregante.com> (https://fregante.com)",
"url": "https://github.com/fregante/webext-polyfill-kinda",
"license": "MIT",

33
package-lock.json generated
View File

@@ -12961,12 +12961,15 @@
}
},
"node_modules/webext-content-scripts": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-2.5.2.tgz",
"integrity": "sha512-N1Xq/E8dx0lVAOyPquuo+2Vj9Fx1GoqCFo79lWeJHbemaBJ53N3BHBmbJJYsQ8FOP1xiwN4bPRQY2dpSjHAD3Q==",
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-2.5.5.tgz",
"integrity": "sha512-CIq1LA/nHIXE43v8qlpqNPcbsSzGuQBkeykbqOWvKJ1Rx/q7zgdZsLgxwyoonWiQcJczslVmGWCfdBY04JwIyw==",
"dependencies": {
"webext-patterns": "^1.3.0",
"webext-polyfill-kinda": "^1.0.0"
"webext-polyfill-kinda": "^1.0.2"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/fregante"
@@ -12995,9 +12998,9 @@
}
},
"node_modules/webext-polyfill-kinda": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-1.0.0.tgz",
"integrity": "sha512-Py/d3w/bC0KntuO60ePSWHsdrebZ3uYBLeFUjyPkDV3yTEQib0MRFvPh57t8XjImu4ylBoEAsFjzh/r22UtxMw==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-1.0.2.tgz",
"integrity": "sha512-rqQUKeBTOicej0tjDJWDQlOTnDcm9yYJTzgI+7rMdyYV4QHmYMRm+yjkcVgECkg/Wu9MboZ4lYeBPdp1Ep9WgQ==",
"funding": {
"url": "https://github.com/sponsors/fregante"
}
@@ -16739,7 +16742,7 @@
"resolved": "https://registry.npmjs.org/content-scripts-register-polyfill/-/content-scripts-register-polyfill-4.0.2.tgz",
"integrity": "sha512-8hDm+tu3BkxHZP7EUIIIo/495F6QNXF7cI9Lwr4PQaiohw2wWmi9k2SE4W4kNrAaLnFw6RZ2ev8EmrQb+sCoGQ==",
"requires": {
"webext-content-scripts": "^2.5.2",
"webext-content-scripts": "v2.5.5",
"webext-patterns": "^1.3.0",
"webext-polyfill-kinda": "^1.0.0"
}
@@ -23096,12 +23099,12 @@
"dev": true
},
"webext-content-scripts": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-2.5.2.tgz",
"integrity": "sha512-N1Xq/E8dx0lVAOyPquuo+2Vj9Fx1GoqCFo79lWeJHbemaBJ53N3BHBmbJJYsQ8FOP1xiwN4bPRQY2dpSjHAD3Q==",
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-2.5.5.tgz",
"integrity": "sha512-CIq1LA/nHIXE43v8qlpqNPcbsSzGuQBkeykbqOWvKJ1Rx/q7zgdZsLgxwyoonWiQcJczslVmGWCfdBY04JwIyw==",
"requires": {
"webext-patterns": "^1.3.0",
"webext-polyfill-kinda": "^1.0.0"
"webext-polyfill-kinda": "^1.0.2"
}
},
"webext-patterns": {
@@ -23120,9 +23123,9 @@
}
},
"webext-polyfill-kinda": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-1.0.0.tgz",
"integrity": "sha512-Py/d3w/bC0KntuO60ePSWHsdrebZ3uYBLeFUjyPkDV3yTEQib0MRFvPh57t8XjImu4ylBoEAsFjzh/r22UtxMw=="
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-1.0.2.tgz",
"integrity": "sha512-rqQUKeBTOicej0tjDJWDQlOTnDcm9yYJTzgI+7rMdyYV4QHmYMRm+yjkcVgECkg/Wu9MboZ4lYeBPdp1Ep9WgQ=="
},
"webidl-conversions": {
"version": "7.0.0",

View File

@@ -8,6 +8,11 @@
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"overrides": {
"content-scripts-register-polyfill": {
"webext-content-scripts": "v2.5.5"
}
},
"devDependencies": {
"@types/chrome": "^0.0.220",
"@types/firefox-webext-browser": "^111.0.0",

View File

@@ -164,7 +164,7 @@ SOFTWARE.
******************************
webext-content-scripts
2.5.2 <https://github.com/fregante/webext-content-scripts>
2.5.5 <https://github.com/fregante/webext-content-scripts>
MIT License
Copyright (c) Federico Brigante <me@fregante.com> (https://fregante.com)
@@ -194,7 +194,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
******************************
webext-polyfill-kinda
1.0.0 <https://github.com/fregante/webext-polyfill-kinda>
1.0.2 <https://github.com/fregante/webext-polyfill-kinda>
MIT License
Copyright (c) Federico Brigante <me@fregante.com> (https://fregante.com)

View File

@@ -155,18 +155,9 @@ chrome.runtime.onInstalled.addListener(function () {
*/
async function registerFirefoxContentScript(options: Registration) {
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
// Bug in Firefox where you need to use browser namespace for this call
const getContentScripts = async (filter: browser.scripting.ContentScriptFilter) => {
if (isFirefoxOrSafari()) {
return await browser.scripting.getRegisteredContentScripts(filter);
} else {
return await chrome.scripting.getRegisteredContentScripts(filter);
}
};
const existingRegistrations = await getContentScripts({
const existingRegistrations = await chromeP.scripting.getRegisteredContentScripts({
ids: [options.id]
});
}).catch(() => []);
if (existingRegistrations.length > 0
&& existingRegistrations[0].matches.every((match) => options.matches.includes(match))) {
@@ -204,9 +195,13 @@ async function registerFirefoxContentScript(options: Registration) {
*/
async function unregisterFirefoxContentScript(id: string) {
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
await chromeP.scripting.unregisterContentScripts({
ids: [id]
});
try {
await chromeP.scripting.unregisterContentScripts({
ids: [id]
});
} catch (e) {
// Not registered yet
}
} else {
if (contentScriptRegistrations[id]) {
contentScriptRegistrations[id].unregister();

View File

@@ -138,6 +138,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
type="text"
style={{color: "inherit", backgroundColor: "inherit"}}
value={this.state.sponsorTimeEdits[0]}
onKeyDown={(e) => e.stopPropagation()}
onKeyUp={(e) => e.stopPropagation()}
onChange={(e) => this.handleOnChange(0, e, sponsorTime, e.target.value)}
onWheel={(e) => this.changeTimesWhenScrolling(0, e, sponsorTime)}>
</input>

View File

@@ -63,7 +63,7 @@ utils.wait(() => Config.isReady(), 5000, 10).then(() => {
&& Config.config.showDeArrowPromotion
&& Config.config.showUpsells
&& Config.config.showNewFeaturePopups
&& (Config.config.skipCount > 100 || !Config.config.trackViewCount)
&& (Config.config.skipCount > 30 || !Config.config.trackViewCount)
&& Math.random() < 0.05) {
if (!await isDeArrowInstalled()) {

View File

@@ -4,20 +4,17 @@ function getLuminance(color: string): number {
return Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
}
/* From https://stackoverflow.com/a/5624139 */
function hexToRgb(hex: string): {r: number; g: number; b: number} {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function(m, r, g, b) {
return r + r + g + g + b + b;
});
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
/* Converts hex color to rgb color */
const hexChars = "0123456789abcdef";
function hexToRgb(hex: string): { r: number; g: number; b: number } | null {
if (hex.length == 4)
hex = "#" + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
return /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
? {
r: hexChars.indexOf(hex[1]) * 16 + hexChars.indexOf(hex[2]),
g: hexChars.indexOf(hex[3]) * 16 + hexChars.indexOf(hex[4]),
b: hexChars.indexOf(hex[5]) * 16 + hexChars.indexOf(hex[6]),
}: null;
}
/**
@@ -31,4 +28,4 @@ function indexesOf<T>(array: T[], value: T): number[] {
export const GenericUtils = {
getLuminance,
indexesOf
}
}