1
0
Fork 0

Switch extension to MV2

main
Ambrose Chua 2021-10-17 00:20:40 +08:00
parent 03ac203786
commit e31f5b5f41
4 changed files with 14 additions and 24 deletions

View File

@ -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',
});
}
});

View File

@ -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;
}

View File

@ -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);

View File

@ -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
}