manifest-v3

This commit is contained in:
daniel-j 2021-12-10 13:22:33 +01:00
parent 19ee93ab23
commit 15eafe6f3c
3 changed files with 18 additions and 10 deletions

View file

@ -1,5 +1,5 @@
{
"manifest_version": 2,
"manifest_version": 3,
"name": "fimfic2epub",
"short_name": "fimfic2epub",
@ -11,8 +11,7 @@
},
"background": {
"scripts": ["build/eventPage.js"],
"persistent": false
"service_worker": "build/eventPage.js"
},
"content_scripts": [
@ -23,20 +22,25 @@
}
],
"page_action": {
"action": {
"default_icon": "fimfic2epub-logo.png"
},
"web_accessible_resources": [
"fimfic2epub-logo.png"
{
"resources": ["fimfic2epub-logo.png"],
"matches": ["https://www.fimfiction.net/*"]
}
],
"permissions": [
"storage"
],
"host_permissions": [
"https://fimfiction.net/*",
"https://*.fimfiction.net/*",
"https://www.googleapis.com/*",
"https://i.ytimg.com/*",
"https://twemoji.maxcdn.com/*",
"storage"
"https://twemoji.maxcdn.com/*"
]
}

View file

@ -15,6 +15,10 @@ if (typeof safari !== 'undefined') {
})
}, false)
} else {
chrome.runtime.onInstalled.addListener(() => {
chrome.action.disable()
})
const onMessage = chrome.extension.onMessage ? chrome.extension.onMessage : chrome.runtime.onMessage
onMessage.addListener(function (request, sender, sendResponse) {
@ -28,11 +32,11 @@ if (typeof safari !== 'undefined') {
// required for async
return true
} else if (request.showPageAction) {
chrome.pageAction.show(sender.tab.id)
chrome.action.enable(sender.tab.id)
}
})
chrome.pageAction.onClicked.addListener(function (tab) {
chrome.action.onClicked.addListener(function (tab) {
chrome.tabs.sendMessage(tab.id, 'pageAction')
})
}

View file

@ -37,7 +37,7 @@ try {
pageStoryId = document.location.pathname.match(/^\/story\/(\d*)/)[1]
} catch (e) {}
const logoUrl = chrome.extension.getURL('fimfic2epub-logo.png')
const logoUrl = chrome.runtime.getURL('fimfic2epub-logo.png')
let ffc
const stories = document.querySelectorAll('.story_container')