fix: linting issue

This commit is contained in:
Astrian Zheng 2025-05-24 08:59:17 +10:00
parent ebd78dcae4
commit 67e40dd36d
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA
4 changed files with 24 additions and 37 deletions

View File

@ -41,6 +41,7 @@
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded"
}
},
"globals": ["chrome", "browser"]
}
}

View File

@ -1,13 +1,23 @@
console.log("background.js loaded 55555")
console.log('background.js loaded 55555')
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
console.log("onBeforeRequest MAIN_FRAME:", details.url, details.type, details.frameId, details.tabId)
if (details.url === "https://monster-siren.hypergryph.com/manifest.json" && details.type === "other" && details.frameId === 0) {
console.log("onBeforeRequest - REDIRECTING MAIN_FRAME")
chrome.tabs.create({ url: chrome.runtime.getURL("index.html") })
(details) => {
console.log(
'onBeforeRequest MAIN_FRAME:',
details.url,
details.type,
details.frameId,
details.tabId,
)
if (
details.url === 'https://monster-siren.hypergryph.com/manifest.json' &&
details.type === 'other' &&
details.frameId === 0
) {
console.log('onBeforeRequest - REDIRECTING MAIN_FRAME')
chrome.tabs.create({ url: chrome.runtime.getURL('index.html') })
chrome.tabs.remove(details.tabId)
}
},
{ urls: ["https://monster-siren.hypergryph.com/manifest.json"] }
)
{ urls: ['https://monster-siren.hypergryph.com/manifest.json'] },
)

View File

@ -20,4 +20,4 @@
"service_worker": "background.js"
},
"permissions": ["tabs", "webRequest"]
}
}

View File

@ -1,29 +1,5 @@
import { createApp } from 'vue';
import './style.css';
import App from './App.vue';
// unregister the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
// 可以根据 scope 判断是否是目标网站的 Service Worker
console.log('Unregistering service worker:', registration.scope)
registration.unregister()
}
})
}
// Replace the body content with the Vue app
document.getElementsByTagName('html')[0].innerHTML = `
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MSR Mod</title>
</head>
<body>
<div id="app"></div>
</body>
`;
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')