diff --git a/src/_locales/de/main.json b/src/_locales/de/main.json index 6bdb230..f53d5d7 100644 --- a/src/_locales/de/main.json +++ b/src/_locales/de/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Zum Ende springen", "Explain": "Erklären", "Failed to get arkose token.": "Arkose-Token konnte nicht abgerufen werden.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Bitte halten Sie https://chat.openai.com geöffnet und versuchen Sie es erneut. Wenn es immer noch nicht funktioniert, geben Sie einige Zeichen in das Eingabefeld der ChatGPT-Webseite ein und versuchen Sie es erneut." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Bitte halten Sie https://chat.openai.com geöffnet und versuchen Sie es erneut. Wenn es immer noch nicht funktioniert, geben Sie einige Zeichen in das Eingabefeld der ChatGPT-Webseite ein und versuchen Sie es erneut.", + "Open Side Panel": "Seitenleiste öffnen" } diff --git a/src/_locales/en/main.json b/src/_locales/en/main.json index c3cb71d..c7f9947 100644 --- a/src/_locales/en/main.json +++ b/src/_locales/en/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Jump to bottom", "Explain": "Explain", "Failed to get arkose token.": "Failed to get arkose token.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.", + "Open Side Panel": "Open Side Panel" } diff --git a/src/_locales/es/main.json b/src/_locales/es/main.json index 1932260..15c7875 100644 --- a/src/_locales/es/main.json +++ b/src/_locales/es/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Saltar al final", "Explain": "Explicar", "Failed to get arkose token.": "No se pudo obtener el token de arkose.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenga https://chat.openai.com abierto e inténtelo de nuevo. Si aún no funciona, escriba algunos caracteres en el cuadro de entrada de la página web de chatgpt e inténtelo de nuevo." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenga https://chat.openai.com abierto e inténtelo de nuevo. Si aún no funciona, escriba algunos caracteres en el cuadro de entrada de la página web de chatgpt e inténtelo de nuevo.", + "Open Side Panel": "Abrir panel lateral" } diff --git a/src/_locales/fr/main.json b/src/_locales/fr/main.json index b663ab7..895fd4a 100644 --- a/src/_locales/fr/main.json +++ b/src/_locales/fr/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Aller en bas", "Explain": "Expliquer", "Failed to get arkose token.": "Échec de l'obtention du jeton arkose.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Veuillez garder https://chat.openai.com ouvert et réessayer. Si cela ne fonctionne toujours pas, tapez quelques caractères dans la boîte de saisie de la page web chatgpt et réessayez." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Veuillez garder https://chat.openai.com ouvert et réessayer. Si cela ne fonctionne toujours pas, tapez quelques caractères dans la boîte de saisie de la page web chatgpt et réessayez.", + "Open Side Panel": "Ouvrir le panneau latéral" } diff --git a/src/_locales/in/main.json b/src/_locales/in/main.json index a373796..835405e 100644 --- a/src/_locales/in/main.json +++ b/src/_locales/in/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Lompat ke bawah", "Explain": "Jelaskan", "Failed to get arkose token.": "Gagal mendapatkan token arkose.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Harap tetap buka https://chat.openai.com dan coba lagi. Jika masih tidak berhasil, ketik beberapa karakter di kotak masukan halaman web chatgpt dan coba lagi." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Harap tetap buka https://chat.openai.com dan coba lagi. Jika masih tidak berhasil, ketik beberapa karakter di kotak masukan halaman web chatgpt dan coba lagi.", + "Open Side Panel": "Buka Panel Samping" } diff --git a/src/_locales/it/main.json b/src/_locales/it/main.json index cf20d4e..45bd122 100644 --- a/src/_locales/it/main.json +++ b/src/_locales/it/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Salta in fondo", "Explain": "Spiega", "Failed to get arkose token.": "Impossibile ottenere il token arkose", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Per favore, mantieni aperto https://chat.openai.com e riprova. Se ancora non funziona, digita alcuni caratteri nella casella di input della pagina web di chatgpt e riprova." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Per favore, mantieni aperto https://chat.openai.com e riprova. Se ancora non funziona, digita alcuni caratteri nella casella di input della pagina web di chatgpt e riprova.", + "Open Side Panel": "Apri il pannello laterale" } diff --git a/src/_locales/ja/main.json b/src/_locales/ja/main.json index 689fdab..d65f410 100644 --- a/src/_locales/ja/main.json +++ b/src/_locales/ja/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "最下部にジャンプ", "Explain": "説明", "Failed to get arkose token.": "arkoseトークンの取得に失敗しました。", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com を開いたままにして、もう一度試してください。それでもうまくいかない場合は、chatgpt webページの入力ボックスにいくつかの文字を入力してからもう一度試してください。" + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com を開いたままにして、もう一度試してください。それでもうまくいかない場合は、chatgpt webページの入力ボックスにいくつかの文字を入力してからもう一度試してください。", + "Open Side Panel": "サイドパネルを開く" } diff --git a/src/_locales/ko/main.json b/src/_locales/ko/main.json index da8a3cc..3a5f653 100644 --- a/src/_locales/ko/main.json +++ b/src/_locales/ko/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "아래로 이동", "Explain": "설명", "Failed to get arkose token.": "arkose 토큰을 가져오지 못했습니다.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com 을 열어두고 다시 시도하세요. 여전히 작동하지 않으면 chatgpt 웹 페이지의 입력 상자에 몇 가지 문자를 입력한 다음 다시 시도하세요." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "https://chat.openai.com 을 열어두고 다시 시도하세요. 여전히 작동하지 않으면 chatgpt 웹 페이지의 입력 상자에 몇 가지 문자를 입력한 다음 다시 시도하세요.", + "Open Side Panel": "사이드 패널 열기" } diff --git a/src/_locales/pt/main.json b/src/_locales/pt/main.json index e729bc5..f77a4cb 100644 --- a/src/_locales/pt/main.json +++ b/src/_locales/pt/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Ir para o fundo", "Explain": "Explicar", "Failed to get arkose token.": "Falha ao obter o token arkose.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenha https://chat.openai.com aberto e tente novamente. Se ainda não funcionar, digite alguns caracteres na caixa de entrada da página da web do chatgpt e tente novamente." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Por favor, mantenha https://chat.openai.com aberto e tente novamente. Se ainda não funcionar, digite alguns caracteres na caixa de entrada da página da web do chatgpt e tente novamente.", + "Open Side Panel": "Abrir Painel Lateral" } diff --git a/src/_locales/ru/main.json b/src/_locales/ru/main.json index 98af461..c1acc5c 100644 --- a/src/_locales/ru/main.json +++ b/src/_locales/ru/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "Перейти вниз", "Explain": "Объяснить", "Failed to get arkose token.": "Не удалось получить токен arkose.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Пожалуйста, оставьте открытым https://chat.openai.com и попробуйте еще раз. Если это все еще не работает, введите несколько символов в поле ввода веб-страницы chatgpt и попробуйте еще раз." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Пожалуйста, оставьте открытым https://chat.openai.com и попробуйте еще раз. Если это все еще не работает, введите несколько символов в поле ввода веб-страницы chatgpt и попробуйте еще раз.", + "Open Side Panel": "Открыть боковую панель" } diff --git a/src/_locales/tr/main.json b/src/_locales/tr/main.json index 5523b4f..86e5223 100644 --- a/src/_locales/tr/main.json +++ b/src/_locales/tr/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "En alta git", "Explain": "Açıkla", "Failed to get arkose token.": "Arkose jetonu alınamadı.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Lütfen https://chat.openai.com adresini açık tutun ve tekrar deneyin. Hala çalışmazsa, chatgpt web sayfasının girdi kutusuna bazı karakterler yazın ve tekrar deneyin." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "Lütfen https://chat.openai.com adresini açık tutun ve tekrar deneyin. Hala çalışmazsa, chatgpt web sayfasının girdi kutusuna bazı karakterler yazın ve tekrar deneyin.", + "Open Side Panel": "Yan Paneli Aç" } diff --git a/src/_locales/zh-hans/main.json b/src/_locales/zh-hans/main.json index 8e292a8..b3cba10 100644 --- a/src/_locales/zh-hans/main.json +++ b/src/_locales/zh-hans/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "跳转到底部", "Explain": "解释", "Failed to get arkose token.": "获取arkose token失败.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "请保持 https://chat.openai.com 打开并重试. 如果仍然不起作用, 请在chatgpt网页的输入框中输入一些字符, 然后再试一次." + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "请保持 https://chat.openai.com 打开并重试. 如果仍然不起作用, 请在chatgpt网页的输入框中输入一些字符, 然后再试一次.", + "Open Side Panel": "打开侧边栏" } diff --git a/src/_locales/zh-hant/main.json b/src/_locales/zh-hant/main.json index 3f257f6..b91f900 100644 --- a/src/_locales/zh-hant/main.json +++ b/src/_locales/zh-hant/main.json @@ -128,5 +128,6 @@ "Jump to bottom": "轉跳至底部", "Explain": "解釋", "Failed to get arkose token.": "無法取得 arkose token.", - "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "請保持 https://chat.openai.com 開啟並重試,如果還是無法通過驗證,請在 ChatGPT 網頁版輸入框輸入一些文字後再重試" + "Please keep https://chat.openai.com open and try again. If it still doesn't work, type some characters in the input box of chatgpt web page and try again.": "請保持 https://chat.openai.com 開啟並重試,如果還是無法通過驗證,請在 ChatGPT 網頁版輸入框輸入一些文字後再重試", + "Open Side Panel": "開啟側邊面板" } diff --git a/src/background/commands.mjs b/src/background/commands.mjs index e6b3b3e..1440d74 100644 --- a/src/background/commands.mjs +++ b/src/background/commands.mjs @@ -2,7 +2,7 @@ import Browser from 'webextension-polyfill' import { config as menuConfig } from '../content-script/menu-tools/index.mjs' export function registerCommands() { - Browser.commands.onCommand.addListener(async (command) => { + Browser.commands.onCommand.addListener(async (command, tab) => { const message = { itemId: command, selectionText: '', @@ -12,7 +12,7 @@ export function registerCommands() { if (command in menuConfig) { if (menuConfig[command].action) { - menuConfig[command].action(true) + menuConfig[command].action(true, tab) } if (menuConfig[command].genPrompt) { diff --git a/src/background/index.mjs b/src/background/index.mjs index 21fc279..7b31f48 100644 --- a/src/background/index.mjs +++ b/src/background/index.mjs @@ -279,6 +279,16 @@ try { }, ['requestHeaders'], ) + + Browser.tabs.onUpdated.addListener(async (tabId, info, tab) => { + if (!tab.url) return + // eslint-disable-next-line no-undef + await chrome.sidePanel.setOptions({ + tabId, + path: 'IndependentPanel.html', + enabled: true, + }) + }) } catch (error) { console.log(error) } diff --git a/src/background/menus.mjs b/src/background/menus.mjs index ad027ee..f53ffe1 100644 --- a/src/background/menus.mjs +++ b/src/background/menus.mjs @@ -57,7 +57,7 @@ export function refreshMenu() { }) } else if (message.itemId in menuConfig) { if (menuConfig[message.itemId].action) { - menuConfig[message.itemId].action(true) + menuConfig[message.itemId].action(true, tab) } if (menuConfig[message.itemId].genPrompt) { diff --git a/src/content-script/menu-tools/index.mjs b/src/content-script/menu-tools/index.mjs index dc0347a..0f5e600 100644 --- a/src/content-script/menu-tools/index.mjs +++ b/src/content-script/menu-tools/index.mjs @@ -57,6 +57,18 @@ export const config = { } }, }, + openSidePanel: { + label: 'Open Side Panel', + action: async (fromBackground, tab) => { + console.debug('action is from background', fromBackground) + if (fromBackground) { + // eslint-disable-next-line no-undef + chrome.sidePanel.open({ windowId: tab.windowId, tabId: tab.id }) + } else { + // side panel is not supported + } + }, + }, closeAllChats: { label: 'Close All Chats In This Page', action: async (fromBackground) => { diff --git a/src/manifest.json b/src/manifest.json index e0bfc6b..7ed06f2 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -24,7 +24,8 @@ "unlimitedStorage", "tabs", "webRequest", - "declarativeNetRequestWithHostAccess" + "declarativeNetRequestWithHostAccess", + "sidePanel" ], "optional_permissions": [ "background" @@ -35,6 +36,9 @@ "action": { "default_popup": "popup.html" }, + "sidePanel": { + "default_path": "IndependentPanel.html" + }, "declarative_net_request": { "rule_resources": [ { @@ -99,6 +103,9 @@ "openConversationWindow": { "description": "Open the independent conversation window" }, + "openSidePanel": { + "description": "Open the independent conversation side panel" + }, "closeAllChats": { "description": "Close all chats in this page" } diff --git a/src/popup/index.jsx b/src/popup/index.jsx index 9eefdaa..b62f4b0 100644 --- a/src/popup/index.jsx +++ b/src/popup/index.jsx @@ -17,12 +17,13 @@ getUserConfig().then(async (config) => { console.debug('custom icon action triggered', message) if (config.clickIconAction in menuConfig) { + const currentTab = (await Browser.tabs.query({ active: true, currentWindow: true }))[0] + if (menuConfig[config.clickIconAction].action) { - menuConfig[config.clickIconAction].action(false) + menuConfig[config.clickIconAction].action(false, currentTab) } if (menuConfig[config.clickIconAction].genPrompt) { - const currentTab = (await Browser.tabs.query({ active: true, currentWindow: true }))[0] Browser.tabs.sendMessage(currentTab.id, { type: 'CREATE_CHAT', data: message,