Add injected Menu Items

This commit is contained in:
Raven Scott 2024-10-02 06:02:29 -04:00
parent 8553e94547
commit e55bc2978a
2 changed files with 24 additions and 1 deletions

View File

@ -213,6 +213,29 @@ pre code {
/* Align the text left */ /* Align the text left */
} }
.copy-button-code {
background-color: #444;
/* Button background color */
color: white;
/* Button text color */
border: none;
/* Remove border */
cursor: pointer;
/* Pointer cursor for interaction */
padding: 5px 10px;
/* Adjusted padding for smaller size */
margin-top: 5px;
/* Space at the top */
display: inline-block;
/* Keep the button in line */
font-size: 14px;
/* Slightly smaller font size for compactness */
width: 75px;
/* Prevent the button from stretching */
text-align: left;
/* Align the text left */
}
.copy-button:hover { .copy-button:hover {
background-color: #555; background-color: #555;
/* Darker shade on hover */ /* Darker shade on hover */

View File

@ -80,7 +80,7 @@ function displayMessage(content, sender) {
// Adds a copy button to a code block // Adds a copy button to a code block
function addCopyButton(block) { function addCopyButton(block) {
const button = document.createElement('button'); const button = document.createElement('button');
button.classList.add('copy-button'); button.classList.add('copy-button-code');
button.textContent = 'Copy'; button.textContent = 'Copy';
button.addEventListener('click', () => copyToClipboard(block)); button.addEventListener('click', () => copyToClipboard(block));
block.parentNode.appendChild(button); block.parentNode.appendChild(button);