added a btn to open the manage prompts tab

This commit is contained in:
mic 2024-05-06 23:15:08 +02:00
parent 2f3fd93095
commit da955b4a26
4 changed files with 25 additions and 0 deletions

View file

@ -164,6 +164,11 @@
"description": ""
},
"prefs_OptionText_btnManagePrompts": {
"message": "Manage your prompts",
"description": ""
},
"prefsInfoTitle": {
"message": "Important Information",
"description": ""

View file

@ -164,6 +164,11 @@
"description": ""
},
"prefs_OptionText_btnManagePrompts": {
"message": "Gestisci i tuoi prompts",
"description": ""
},
"prefsInfoTitle": {
"message": "Informazioni Importanti",
"description": ""

View file

@ -71,6 +71,9 @@
</td>
</tr>
</table>
<div id="btn_custom_prompts">
<button id="btnManagePrompts">__MSG_prefs_OptionText_btnManagePrompts__</button>
</div>
<div id="miczDescription">
<h1>__MSG_prefsInfoTitle__</h1>
<p>__MSG_prefsInfoDesc_1__<br/>

View file

@ -93,4 +93,16 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll(".option-input").forEach(element => {
element.addEventListener("change", saveOptions);
});
document.getElementById('btnManagePrompts').addEventListener('click', () => {
// check if the tab is already there
browser.tabs.query({url: browser.runtime.getURL('../customprompts/mzta-custom-prompts.html')}).then((tabs) => {
if (tabs.length > 0) {
// if the tab is already there, focus it
browser.tabs.update(tabs[0].id, {active: true});
} else {
// if the tab is not there, create it
browser.tabs.create({url: browser.runtime.getURL('../customprompts/mzta-custom-prompts.html')});
}
})
});
}, { once: true });