parent
dc5bbc5eb0
commit
0d626a491c
6 changed files with 51 additions and 7 deletions
|
|
@ -74,6 +74,21 @@
|
|||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_text": {
|
||||
"message": "ChatGPT window dimensions",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_height": {
|
||||
"message": "Height",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_width": {
|
||||
"message": "Width",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefsInfoTitle": {
|
||||
"message": "Important Information",
|
||||
"description": ""
|
||||
|
|
|
|||
|
|
@ -74,6 +74,21 @@
|
|||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_text": {
|
||||
"message": "Dimensioni della finestra di ChatGPT",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_height": {
|
||||
"message": "Altezza",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefs_OptionText_chatgpt_win_width": {
|
||||
"message": "Larghezza",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"prefsInfoTitle": {
|
||||
"message": "Informazioni Importanti",
|
||||
"description": ""
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { mzta_script } from './js/mzta-chatgpt.js';
|
||||
import { prefs_default } from './options/mzta-options-default.js';
|
||||
|
||||
var createdWindowID = null;
|
||||
|
||||
|
|
@ -71,12 +72,13 @@ messenger.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|||
});
|
||||
|
||||
|
||||
function openChatGPT(promptText,action,curr_tabId){
|
||||
async function openChatGPT(promptText,action,curr_tabId){
|
||||
let prefs = await browser.storage.sync.get(prefs_default);
|
||||
return browser.windows.create({
|
||||
url: "https://chat.openai.com",
|
||||
type: "popup",
|
||||
width: 700,
|
||||
height: 800
|
||||
width: prefs.chatgpt_win_width,
|
||||
height: prefs.chatgpt_win_height
|
||||
}).then((newWindow) => {
|
||||
console.log("Script started...");
|
||||
createdWindowID = newWindow.id;
|
||||
|
|
|
|||
4
options/mzta-options-default.js
Normal file
4
options/mzta-options-default.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export const prefs_default = {
|
||||
chatgpt_win_height: 800,
|
||||
chatgpt_win_width: 700,
|
||||
}
|
||||
|
|
@ -6,8 +6,11 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="miczRelNotes"><a href="mzta-release-notes.html">Release Notes</a></div>
|
||||
<div id="miczPrefs"><label><input type="checkbox" id="force_msedge" name="force_msedge" class="option-input" /> __MSG_forceMsedgeOptionText__</label><br/>
|
||||
<label><input type="checkbox" id="always_link" name="always_link" class="option-input" /> __MSG_AlwaysLinkOptionText__</label><br/>
|
||||
<div id="miczPrefs">
|
||||
<span>__MSG_prefs_OptionText_chatgpt_win_text__</span><br/>
|
||||
<label><input type="number" id="chatgpt_win_height" name="chatgpt_win_height" class="option-input" /> __MSG_prefs_OptionText_chatgpt_win_height__</label><br/>
|
||||
<input type="number" id="chatgpt_win_width" name="chatgpt_win_width" class="option-input" /> __MSG_prefs_OptionText_chatgpt_win_width__</label><br/>
|
||||
<br/>
|
||||
<label><input type="text" id="default_sign_name" name="default_sign_name" class="option-input" /> Default signature name</label></div>
|
||||
<div id="miczDescription">
|
||||
<h1>__MSG_prefsInfoTitle__</h1>
|
||||
|
|
@ -16,7 +19,7 @@
|
|||
__MSG_prefsInfoDesc_3__</p>
|
||||
</div>
|
||||
<div id="miczDonation">__MSG_prefsDonation_1__<br/><a href="http://micz.it/thunderdbird-addon-thunderai/donate/">__MSG_prefsDonation_2__</a></div>
|
||||
<script src="mzta-options.js"></script>
|
||||
<script src="mzta-options.js" type="module"></script>
|
||||
<script src="../js/mzta-i18n.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { prefs_default } from './mzta-options-default.js';
|
||||
|
||||
function saveOptions(e) {
|
||||
e.preventDefault();
|
||||
let options = {};
|
||||
|
|
@ -32,7 +34,10 @@ function restoreOptions() {
|
|||
element.checked = result[element.id] || false;
|
||||
break;
|
||||
case 'number':
|
||||
element.value = result[element.id] || 0;
|
||||
let default_value = 0;
|
||||
if(element.id == 'chatgpt_win_height') default_value = prefs_default.chatgpt_win_height;
|
||||
if(element.id == 'chatgpt_win_width') default_value = prefs_default.chatgpt_win_width;
|
||||
element.value = result[element.id] || default_value;
|
||||
break;
|
||||
case 'text':
|
||||
element.value = result[element.id] || '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue