diff --git a/background.js b/background.js index 3f3e407..a58749c 100644 --- a/background.js +++ b/background.js @@ -1,9 +1,3 @@ -async function getCurrentTab() { - let queryOptions = { active: true, currentWindow: true }; - let [tab] = await chrome.tabs.query(queryOptions); - return tab; -} - chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.create({ title: 'Make Gather fullscreen', @@ -15,14 +9,11 @@ chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.onClicked.addListener(async (data) => { if (data.menuItemId === 'make-fullscreen') { - const tab = await getCurrentTab(); - await chrome.scripting.insertCSS({ - target: { tabId: tab.id }, - files: ['inject.css'], + chrome.tabs.insertCSS({ + file: 'inject.css', }); - await chrome.scripting.executeScript({ - target: { tabId: tab.id }, - files: ['inject.js'], + chrome.tabs.executeScript({ + file: 'inject.js', }); } }); diff --git a/inject.css b/inject.css index 5b2f3a7..21b61a7 100644 --- a/inject.css +++ b/inject.css @@ -1,12 +1,10 @@ -body { - transform: translate(-72px, 0); - width: calc(100vw + 72px); +.GameComponent-container > :nth-child(1) > :nth-child(1) { + display: none !important; } - /* Additional */ .GameCanvasContainer-settings { display: none; } .GameVideo-self-video-container { - display: none; + display: none !important; } diff --git a/inject.js b/inject.js index 12ddcbe..34f98d6 100644 --- a/inject.js +++ b/inject.js @@ -2,7 +2,9 @@ const script = document.createElement('script'); script.innerHTML = ` window.innerWidth = window.outerWidth + 72; - window.innerHeight = window.outerHeight; + window.addEventListener('resize', () => { + window.innerWidth = window.outerWidth + 72; + }); `; document.head.appendChild(script); diff --git a/manifest.json b/manifest.json index d0f7a36..49d601e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,11 +2,10 @@ "name": "Gather Fullscreen", "description": "Click to show Gather in fullscreen", "version": "1.0", - "permissions": ["contextMenus", "scripting"], - "host_permissions": ["https://gather.town/app/*"], + "permissions": ["contextMenus", "activeTab", "https://gather.town/app/*"], "background": { - "type": "module", - "service_worker": "background.js" + "scripts": ["background.js"], + "persistent": false }, - "manifest_version": 3 + "manifest_version": 2 }