parent
dc5bbc5eb0
commit
0d626a491c
6 changed files with 51 additions and 7 deletions
|
|
@ -74,6 +74,21 @@
|
||||||
"description": ""
|
"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": {
|
"prefsInfoTitle": {
|
||||||
"message": "Important Information",
|
"message": "Important Information",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,21 @@
|
||||||
"description": ""
|
"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": {
|
"prefsInfoTitle": {
|
||||||
"message": "Informazioni Importanti",
|
"message": "Informazioni Importanti",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { mzta_script } from './js/mzta-chatgpt.js';
|
import { mzta_script } from './js/mzta-chatgpt.js';
|
||||||
|
import { prefs_default } from './options/mzta-options-default.js';
|
||||||
|
|
||||||
var createdWindowID = null;
|
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({
|
return browser.windows.create({
|
||||||
url: "https://chat.openai.com",
|
url: "https://chat.openai.com",
|
||||||
type: "popup",
|
type: "popup",
|
||||||
width: 700,
|
width: prefs.chatgpt_win_width,
|
||||||
height: 800
|
height: prefs.chatgpt_win_height
|
||||||
}).then((newWindow) => {
|
}).then((newWindow) => {
|
||||||
console.log("Script started...");
|
console.log("Script started...");
|
||||||
createdWindowID = newWindow.id;
|
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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="miczRelNotes"><a href="mzta-release-notes.html">Release Notes</a></div>
|
<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/>
|
<div id="miczPrefs">
|
||||||
<label><input type="checkbox" id="always_link" name="always_link" class="option-input" /> __MSG_AlwaysLinkOptionText__</label><br/>
|
<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>
|
<label><input type="text" id="default_sign_name" name="default_sign_name" class="option-input" /> Default signature name</label></div>
|
||||||
<div id="miczDescription">
|
<div id="miczDescription">
|
||||||
<h1>__MSG_prefsInfoTitle__</h1>
|
<h1>__MSG_prefsInfoTitle__</h1>
|
||||||
|
|
@ -16,7 +19,7 @@
|
||||||
__MSG_prefsInfoDesc_3__</p>
|
__MSG_prefsInfoDesc_3__</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="miczDonation">__MSG_prefsDonation_1__<br/><a href="http://micz.it/thunderdbird-addon-thunderai/donate/">__MSG_prefsDonation_2__</a></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>
|
<script src="../js/mzta-i18n.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { prefs_default } from './mzta-options-default.js';
|
||||||
|
|
||||||
function saveOptions(e) {
|
function saveOptions(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let options = {};
|
let options = {};
|
||||||
|
|
@ -32,7 +34,10 @@ function restoreOptions() {
|
||||||
element.checked = result[element.id] || false;
|
element.checked = result[element.id] || false;
|
||||||
break;
|
break;
|
||||||
case 'number':
|
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;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
element.value = result[element.id] || '';
|
element.value = result[element.id] || '';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue