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": { "formatter": {
"quoteStyle": "single", "quoteStyle": "single",
"semicolons": "asNeeded" "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( chrome.webRequest.onBeforeRequest.addListener(
function(details) { (details) => {
console.log("onBeforeRequest MAIN_FRAME:", details.url, details.type, details.frameId, details.tabId) console.log(
if (details.url === "https://monster-siren.hypergryph.com/manifest.json" && details.type === "other" && details.frameId === 0) { 'onBeforeRequest MAIN_FRAME:',
console.log("onBeforeRequest - REDIRECTING MAIN_FRAME") details.url,
chrome.tabs.create({ url: chrome.runtime.getURL("index.html") }) 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) chrome.tabs.remove(details.tabId)
} }
}, },
{ urls: ["https://monster-siren.hypergryph.com/manifest.json"] } { urls: ['https://monster-siren.hypergryph.com/manifest.json'] },
) )

View File

@ -1,29 +1,5 @@
import { createApp } from 'vue'; import { createApp } from 'vue'
import './style.css'; import './style.css'
import App from './App.vue'; 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>
`;
createApp(App).mount('#app') createApp(App).mount('#app')