Skip to content

Commit

Permalink
refactor : no need to use function to get the extension url
Browse files Browse the repository at this point in the history
  • Loading branch information
oggnimodd committed Oct 4, 2023
1 parent 739f6d1 commit c82615d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions apps/plugin/content-scripts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { extensionUrl } from "utils/chrome";
import Listener from "./listener";

const newDiv = document.createElement("div");
const hostname = window.location.hostname;
let iframeMountPointParent: HTMLElement | null;
const extensionUrl = chrome.runtime.getURL("/");
const iframeUrl = `${extensionUrl}iframe/index.html`;

const iframeUrl = `${extensionUrl}/iframe/index.html`;
const iframe = document.createElement("iframe");

if (hostname === "chat.openai.com") {
Expand Down
4 changes: 1 addition & 3 deletions apps/plugin/content-scripts/listener.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getExtensionUrl } from "utils/chrome";
import { extensionUrl } from "utils/chrome";

type ChatProvider = "chat-gpt" | "poe" | "claude" | "perplexity";

const extensionUrl = getExtensionUrl();

class Listener {
private autoSubmit: boolean;
private chatprovider: ChatProvider;
Expand Down
2 changes: 1 addition & 1 deletion apps/plugin/utils/chrome.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const getExtensionUrl = () => `chrome-extension://${chrome.runtime.id}`;
export const extensionUrl = `chrome-extension://${chrome.runtime.id}`;

0 comments on commit c82615d

Please sign in to comment.