fix: linting issue
This commit is contained in:
parent
ebd78dcae4
commit
67e40dd36d
|
@ -41,6 +41,7 @@
|
|||
"formatter": {
|
||||
"quoteStyle": "single",
|
||||
"semicolons": "asNeeded"
|
||||
}
|
||||
},
|
||||
"globals": ["chrome", "browser"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'] },
|
||||
)
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
"service_worker": "background.js"
|
||||
},
|
||||
"permissions": ["tabs", "webRequest"]
|
||||
}
|
||||
}
|
||||
|
|
30
src/main.ts
30
src/main.ts
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user