From 0cd02fafd7df991deb03e24902e7c83a4d984c86 Mon Sep 17 00:00:00 2001 From: revilowaldow <52298102+revilowaldow@users.noreply.github.com> Date: Sat, 21 Mar 2026 21:12:00 +0000 Subject: [PATCH] feat(V3): Update extension for manifest V3 compatibility --- background.js | 2 +- manifest.json | 13 +++++++------ popup.js | 8 +++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/background.js b/background.js index 78dad75..ee2ee60 100644 --- a/background.js +++ b/background.js @@ -10,7 +10,7 @@ chrome.runtime.onInstalled.addListener(function () { pageUrl: { hostEquals: 'app.roll20.net' } }) ], - actions: [new chrome.declarativeContent.ShowPageAction()] + actions: [new chrome.declarativeContent.ShowAction()] }]); }); }); diff --git a/manifest.json b/manifest.json index ece6309..4ef41b9 100644 --- a/manifest.json +++ b/manifest.json @@ -2,12 +2,11 @@ "name": "Pixels on Roll20", "version": "0.1", "description": "Bring the magic of Pixels into Roll20!", - "permissions": ["activeTab", "declarativeContent", "storage"], + "permissions": ["activeTab", "declarativeContent", "storage", "scripting"], "background": { - "scripts": ["background.js"], - "persistent": false + "service_worker": "background.js" }, - "page_action": { + "action": { "default_popup": "popup.html", "default_icon": { "64": "images/logo-64.png" @@ -16,6 +15,8 @@ "icons": { "64": "images/logo-64.png" }, - "options_page": "options.html", - "manifest_version": 2 + "options_ui": { + "page": "options.html" + }, + "manifest_version": 3 } diff --git a/popup.js b/popup.js index 2603d92..e7a744a 100644 --- a/popup.js +++ b/popup.js @@ -65,9 +65,11 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { // Inject code in website // We need to be running in the webpage context to have access to the bluetooth stack chrome.tabs.query({ active: true, currentWindow: true }, tabs => { - chrome.tabs.executeScript( - tabs[0].id, - { file: "roll20.js" }, + chrome.scripting.executeScript( + { + target: { tabId: tabs[0].id }, + files: ["roll20.js"] + }, _ => { sendMessage({ action: "getStatus" }); chrome.storage.sync.get('formula', data => sendMessage({ action: "setFormula", formula: data.formula }))