mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-27 18:08:26 +03:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cd697dc32 | ||
|
|
9946bd1af2 | ||
|
|
3b06d72270 | ||
|
|
4bd0556464 |
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"declarativeContent"
|
"declarativeContent",
|
||||||
|
"webNavigation"
|
||||||
],
|
],
|
||||||
"background": {
|
"background": {
|
||||||
"persistent": false
|
"persistent": false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "5.4.16",
|
"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",
|
||||||
|
|||||||
@@ -4,5 +4,8 @@
|
|||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"scripting"
|
"scripting"
|
||||||
|
],
|
||||||
|
"optional_permissions": [
|
||||||
|
"webNavigation"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,16 +155,7 @@ chrome.runtime.onInstalled.addListener(function () {
|
|||||||
*/
|
*/
|
||||||
async function registerFirefoxContentScript(options: Registration) {
|
async function registerFirefoxContentScript(options: Registration) {
|
||||||
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
// Bug in Firefox where you need to use browser namespace for this call
|
const existingRegistrations = await chromeP.scripting.getRegisteredContentScripts({
|
||||||
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({
|
|
||||||
ids: [options.id]
|
ids: [options.id]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -204,9 +195,13 @@ async function registerFirefoxContentScript(options: Registration) {
|
|||||||
*/
|
*/
|
||||||
async function unregisterFirefoxContentScript(id: string) {
|
async function unregisterFirefoxContentScript(id: string) {
|
||||||
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
await chromeP.scripting.unregisterContentScripts({
|
try {
|
||||||
ids: [id]
|
await chromeP.scripting.unregisterContentScripts({
|
||||||
});
|
ids: [id]
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// Already registered
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (contentScriptRegistrations[id]) {
|
if (contentScriptRegistrations[id]) {
|
||||||
contentScriptRegistrations[id].unregister();
|
contentScriptRegistrations[id].unregister();
|
||||||
|
|||||||
Reference in New Issue
Block a user