diff --git a/mzta-background.js b/mzta-background.js index 38ee7d84..9aefe907 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -74,6 +74,7 @@ messenger.runtime.onMessage.addListener((message, sender, sendResponse) => { async function openChatGPT(promptText,action,curr_tabId){ let prefs = await browser.storage.sync.get(prefs_default); + prefs = checkScreenDimensions(prefs); return browser.windows.create({ url: "https://chat.openai.com", type: "popup", @@ -93,3 +94,13 @@ async function openChatGPT(promptText,action,curr_tabId){ }); }); } + +function checkScreenDimensions(prefs){ + let width = window.screen.width; + let height = window.screen.height; + + if(prefs.chatgpt_win_height > height) prefs.chatgpt_win_height = height - 50; + if(prefs.chatgpt_win_width > width) prefs.chatgpt_win_width = width - 50; + + return prefs; +}