feat: rewrite to solidjs
This commit is contained in:
parent
74c6215c27
commit
afa2db26e7
21 changed files with 1074 additions and 1835 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { ContentScriptContext } from "#imports";
|
||||
import App from "./App.vue";
|
||||
import App from "./App";
|
||||
import { render } from "solid-js/web";
|
||||
import { featureEnableBlock } from "@/utils/storage";
|
||||
import { createApp } from "vue";
|
||||
import { createProxyService } from '@webext-core/proxy-service';
|
||||
import { createProxyService } from "@webext-core/proxy-service";
|
||||
import { BlockedSite } from "@/utils/types";
|
||||
const blockedSitesRepo = createProxyService(BLOCKED_SITES_REPO_KEY);
|
||||
|
||||
|
|
@ -14,12 +14,16 @@ export default defineContentScript({
|
|||
const ui = await defineOverlay(ctx);
|
||||
const isBlockEnabled = await featureEnableBlock.getValue();
|
||||
const currentDomain = window.location.hostname;
|
||||
const blockedSites = await blockedSitesRepo.getAll()
|
||||
const blockedSites = await blockedSitesRepo.getAll();
|
||||
|
||||
function isOnBlockList() {
|
||||
return (
|
||||
blockedSites.filter(function (blockedSite: BlockedSite) {
|
||||
return (blockedSite.url == currentDomain || "www." + blockedSite.url == currentDomain) && blockedSite.blocked;
|
||||
return (
|
||||
(blockedSite.url == currentDomain ||
|
||||
"www." + blockedSite.url == currentDomain) &&
|
||||
blockedSite.blocked
|
||||
);
|
||||
}).length > 0
|
||||
);
|
||||
}
|
||||
|
|
@ -44,8 +48,7 @@ function defineOverlay(ctx: ContentScriptContext) {
|
|||
position: "overlay",
|
||||
zIndex: 9999,
|
||||
onMount(container, _shadow, shadowHost) {
|
||||
const app = createApp(App);
|
||||
app.mount(container);
|
||||
const app = render(App, container);
|
||||
shadowHost.style.pointerEvents = "none";
|
||||
return app;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue