added link to the status page. fixes #28

This commit is contained in:
mic 2024-04-18 22:40:36 +02:00
parent 656a6c9f4f
commit 55692e7ebd
6 changed files with 30 additions and 1 deletions

View file

@ -99,6 +99,11 @@
"description": "" "description": ""
}, },
"prefs_status_page": {
"message": "Service Status",
"description": ""
},
"prefs_OptionText_chatgpt_win_text": { "prefs_OptionText_chatgpt_win_text": {
"message": "ChatGPT window dimensions", "message": "ChatGPT window dimensions",
"description": "" "description": ""

View file

@ -99,6 +99,11 @@
"description": "" "description": ""
}, },
"prefs_status_page": {
"message": "Stato del servizio",
"description": ""
},
"prefs_OptionText_chatgpt_win_text": { "prefs_OptionText_chatgpt_win_text": {
"message": "Dimensioni della finestra di ChatGPT", "message": "Dimensioni della finestra di ChatGPT",
"description": "" "description": ""

View file

@ -117,6 +117,8 @@ function addCustomDiv(prompt_action,tabId) {
style.innerHTML += "#mzta-loading{height:50px;display:inline-block;}"; style.innerHTML += "#mzta-loading{height:50px;display:inline-block;}";
style.innerHTML += "#mzta-model_warn{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-height:100%px;min-width:30%;max-width:50%;padding:3px;border-radius:5px;text-align:center;background-color:#FFBABA;border:1px solid;font-size:13px;color:#D8000C;display:none;}"; style.innerHTML += "#mzta-model_warn{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-height:100%px;min-width:30%;max-width:50%;padding:3px;border-radius:5px;text-align:center;background-color:#FFBABA;border:1px solid;font-size:13px;color:#D8000C;display:none;}";
style.innerHTML += "#mzta-btn_gpt35 {background-color: #007bff;border: none;color: white;padding: 2px 4px;text-align: center;text-decoration: none;display: none;font-size: 13px;margin-left: 4px;transition-duration: 0.4s;cursor: pointer;border-radius: 2px;}"; style.innerHTML += "#mzta-btn_gpt35 {background-color: #007bff;border: none;color: white;padding: 2px 4px;text-align: center;text-decoration: none;display: none;font-size: 13px;margin-left: 4px;transition-duration: 0.4s;cursor: pointer;border-radius: 2px;}";
style.innerHTML += "#mzta-status-page{position:fixed;bottom:0;left:0;padding-left:5px;font-size:13px;font-style:italic;text-decoration:underline;color:#919191;}";
style.innerHTML += "#mzta-status-page:hover{color:#007bff;}";
// Add <style> to the page's <head> // Add <style> to the page's <head>
document.head.appendChild(style); document.head.appendChild(style);
@ -141,6 +143,12 @@ function addCustomDiv(prompt_action,tabId) {
}; };
modelWarnDiv.appendChild(btn_gpt35); modelWarnDiv.appendChild(btn_gpt35);
//status page
var status_page_div = document.createElement('div');
status_page_div.id = 'mzta-status-page';
status_page_div.innerHTML = '<a href="https://micz.it/thunderdbird-addon-thunderai/status/">'+ mztaStatusPageDesc +'</a>';
fixedDiv.appendChild(status_page_div);
// span for the text // span for the text
var curr_msg = document.createElement('span'); var curr_msg = document.createElement('span');
curr_msg.id='mzta-curr_msg'; curr_msg.id='mzta-curr_msg';

View file

@ -150,7 +150,10 @@ async function openChatGPT(promptText, action, curr_tabId) {
} }
}); });
browser.tabs.executeScript(createdTab.id, { code: mzta_script, matchAboutBlank: false }) let pre_script = `let mztaStatusPageDesc="`+ browser.i18n.getMessage("prefs_status_page") +`";
`;
browser.tabs.executeScript(createdTab.id, { code: pre_script + mzta_script, matchAboutBlank: false })
.then(async () => { .then(async () => {
console.log("Script injected successfully"); console.log("Script injected successfully");
browser.tabs.sendMessage(createdTab.id, { command: "chatgpt_send", prompt: promptText, action: action, tabId: curr_tabId }); browser.tabs.sendMessage(createdTab.id, { command: "chatgpt_send", prompt: promptText, action: action, tabId: curr_tabId });

View file

@ -43,6 +43,13 @@ div#miczRelNotes{
padding: 2px 5px 0px 0px; padding: 2px 5px 0px 0px;
} }
div#miczStatusPage{
position:absolute;
left: 0px;
bottom: 2px;
padding: 2px 0px 0px 5px;
}
div#miczDescription h1{ div#miczDescription h1{
text-align: center; text-align: center;
margin-bottom: 0px; margin-bottom: 0px;

View file

@ -6,6 +6,7 @@
</head> </head>
<body> <body>
<div id="miczRelNotes"><a href="mzta-release-notes.html">__MSG_prefs_OptionText_release_notes__</a></div> <div id="miczRelNotes"><a href="mzta-release-notes.html">__MSG_prefs_OptionText_release_notes__</a></div>
<div id="miczStatusPage"><a href="https://micz.it/thunderdbird-addon-thunderai/status/">__MSG_prefs_status_page__</a></div>
<table id="miczPrefs"> <table id="miczPrefs">
<tr> <tr>
<td><span>__MSG_prefs_OptionText_chatgpt_win_text__</span></td> <td><span>__MSG_prefs_OptionText_chatgpt_win_text__</span></td>