mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 12:23:24 +00:00
21 lines
498 B
TypeScript
21 lines
498 B
TypeScript
// raw urls don't work with eslint, so its a false positive
|
|
// eslint-disable-next-line import/no-unresolved
|
|
import contentScriptUrl from 'url:~contents/movie-web';
|
|
|
|
import { queryCurrentTab } from '~utils/tabs';
|
|
|
|
export function injectScript() {
|
|
queryCurrentTab((tab) => {
|
|
if (!tab.id) return;
|
|
chrome.scripting
|
|
.executeScript({
|
|
target: {
|
|
tabId: tab.id,
|
|
},
|
|
world: 'MAIN',
|
|
files: [contentScriptUrl],
|
|
})
|
|
.catch(() => {});
|
|
});
|
|
}
|