chatgpt win dimension checked against screen dimensions. fixes #16
This commit is contained in:
parent
ddd0475076
commit
b5e987f961
1 changed files with 11 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue