added close button. improved action buttons
This commit is contained in:
parent
5b6b200af0
commit
94e5398b02
1 changed files with 14 additions and 2 deletions
|
|
@ -51,6 +51,13 @@ messagesAreaStyle.textContent = `
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.action-buttons button {
|
||||||
|
display: inline;
|
||||||
|
margin: 0 10px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
@ -147,7 +154,6 @@ class MessagesArea extends HTMLElement {
|
||||||
|
|
||||||
addActionButtons(promptData = null) {
|
addActionButtons(promptData = null) {
|
||||||
if(promptData == null) { return; }
|
if(promptData == null) { return; }
|
||||||
if(promptData.action == 0) { return; } // No action needed
|
|
||||||
const actionButtons = document.createElement('div');
|
const actionButtons = document.createElement('div');
|
||||||
actionButtons.classList.add('action-buttons');
|
actionButtons.classList.add('action-buttons');
|
||||||
const actionButton = document.createElement('button');
|
const actionButton = document.createElement('button');
|
||||||
|
|
@ -166,7 +172,13 @@ class MessagesArea extends HTMLElement {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
actionButtons.appendChild(actionButton);
|
const closeButton = document.createElement('button');
|
||||||
|
closeButton.textContent = browser.i18n.getMessage("chatgpt_win_close");
|
||||||
|
closeButton.addEventListener('click', () => {
|
||||||
|
browser.runtime.sendMessage({command: "chatgpt_close"}); // close window
|
||||||
|
});
|
||||||
|
if(promptData.action != 0) { actionButtons.appendChild(actionButton); }
|
||||||
|
actionButtons.appendChild(closeButton);
|
||||||
this.messages.appendChild(actionButtons);
|
this.messages.appendChild(actionButtons);
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue