Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #15

Merged
merged 3 commits into from
Dec 15, 2023
Merged

Dev #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pages/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ chrome.runtime.onInstalled.addListener(async () => {
matches: ['*://*/*'],
js: ["src/pages/content/index.js"],
// KEY for cache invalidation
css: ["Global.chunk.css"],
// css: ["assets/css/contentStyle.chunk.css"],
}]).then(async () => {
const registeredScripts = await chrome.scripting.getRegisteredContentScripts();
Expand Down
4 changes: 3 additions & 1 deletion src/pages/content/components/Demo/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect } from "react";
import Styles from "@src/global.css";

export default function App() {
useEffect(() => {
Expand All @@ -7,8 +8,9 @@ export default function App() {

return (
<>
<style>{Styles}</style>
<div
className="text-lime-400 p-4 w-screen bg-red-400"
className="text-lime-400 p-4 w-screen bg-red-400 font-sans" // Need to set the font family because otherwise it would inherit from website.
>
content view
<button
Expand Down
2 changes: 0 additions & 2 deletions src/pages/content/components/Demo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { createRoot } from "react-dom/client";
import '../../../../global.css'
import App from "@src/pages/content/components/Demo/app";
import refreshOnUpdate from "virtual:reload-on-update-in-view";

refreshOnUpdate("pages/content");

const root = document.createElement("div");
root.id = "fictional-fortnight-content-view-root";
root.style.all = "unset";

document.body.append(root);

Expand Down
6 changes: 4 additions & 2 deletions src/pages/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const Popup = () => {
updatedList.map((site) => `*://${site}/*`) :
whitelist.map((site) => `*://${site}/*`),
js: ["src/pages/content/index.js"],
css: ["./assets/css/_virtual_reload-on-update-in-view.chunk.css"],
}
])
} else if (mode === 'blacklist') {
Expand All @@ -78,6 +79,7 @@ const Popup = () => {
updatedList.map((site) => `*://${site}/*`) :
blacklist.map((site) => `*://${site}/*`),
js: ["src/pages/content/index.js"],
css: ["./assets/css/_virtual_reload-on-update-in-view.chunk.css"],
}
])
}
Expand Down Expand Up @@ -282,14 +284,14 @@ const Popup = () => {
const renderButton = () => {
if (isOnList()) {
return (
<button className="text-sm p-1 border-1 border-red-500" onClick={removeFromList}>
<button className="text-sm p-1 border border-red-500" onClick={removeFromList}>
-
{currentSiteHostname}
</button>
);
} else {
return (
<button className="text-sm p-1 border-1 border-green-500" onClick={addToList}>
<button className="text-sm p-1 border border-green-500" onClick={addToList}>
+
{currentSiteHostname}
</button>
Expand Down
Loading