Skip to content

Commit bd55c10

Browse files
committed
cleanup buttons
1 parent 7d4ad83 commit bd55c10

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

contentScript.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function createSendToQueueForm(message, onClose) {
3939
`;
4040

4141
const title = document.createElement('h3');
42-
title.textContent = 'Send Message to Queue';
42+
title.textContent = 'Copy Message to Queue';
4343
title.style.marginTop = '0';
4444

4545
const queueLabel = document.createElement('label');
@@ -207,27 +207,35 @@ function handleRabbitMQMessageDecoding(mutations) {
207207
const base64Msg = btoa(unescape(encodeURIComponent(JSON.stringify(parsedMsgObject, null, 2))));
208208
const messageText = decodeURIComponent(escape(atob(`${base64Msg}`)));
209209

210+
const buttonContainer = document.createElement('div');
211+
buttonContainer.style.cssText = `
212+
display: flex;
213+
gap: 10px;
214+
margin-bottom: 10px;
215+
`;
216+
210217
const copyButton = document.createElement('button');
211218
copyButton.className = 'copy-msg-btn';
212219
copyButton.textContent = 'Copy';
213-
copyButton.style.marginRight = '10px';
214220
copyButton.addEventListener('click', function () {
215221
navigator.clipboard.writeText(messageText);
216222
});
217223

218224
const sendButton = document.createElement('button');
219225
sendButton.className = 'send-msg-btn';
220-
sendButton.textContent = 'Send (a copy) to queue';
226+
sendButton.textContent = 'Send to queue';
221227
sendButton.addEventListener('click', function () {
222228
const form = createSendToQueueForm(messageText, function() {
223229
document.body.removeChild(form);
224230
});
225231
document.body.appendChild(form);
226232
});
227233

234+
buttonContainer.appendChild(copyButton);
235+
buttonContainer.appendChild(sendButton);
236+
228237
const targetElement = mutation.addedNodes[i].querySelector('div > table > tbody > tr:nth-child(5) > td');
229-
targetElement.prepend(copyButton);
230-
targetElement.prepend(sendButton);
238+
targetElement.prepend(buttonContainer);
231239
} catch (e) {
232240
console.log(`error adding buttons`, e);
233241
}

0 commit comments

Comments
 (0)