(button)
| 539 | |
| 540 | // Function to style the buttons |
| 541 | const styleButton = (button) => { |
| 542 | Object.assign(button.style, { |
| 543 | display: 'inline-block', |
| 544 | padding: '8px', |
| 545 | background: '#007bff', // Default standby color |
| 546 | color: 'white', |
| 547 | border: 'none', |
| 548 | borderRadius: '4px', |
| 549 | cursor: 'pointer', |
| 550 | transition: 'background-color 0.3s ease' |
| 551 | }) |
| 552 | |
| 553 | button.addEventListener('mouseover', () => { |
| 554 | if (button.textContent === 'Saving...' || button.textContent === 'Copied!' || button.textContent === 'Could not download' || button.textContent === 'Could not copy') { |
| 555 | button.style.backgroundColor = button.textContent.includes('Could not') ? 'darkred' : 'darkgreen' |
| 556 | } else { |
| 557 | button.style.backgroundColor = '#0056b3' // Darker blue for standby |
| 558 | } |
| 559 | }) |
| 560 | |
| 561 | button.addEventListener('mouseout', () => { |
| 562 | if (button.textContent === 'Saving...' || button.textContent === 'Copied!' || button.textContent === 'Could not download' || button.textContent === 'Could not copy') { |
| 563 | button.style.backgroundColor = button.textContent.includes('Could not') ? 'red' : 'green' |
| 564 | } else { |
| 565 | button.style.backgroundColor = '#007bff' // Default blue for standby |
| 566 | } |
| 567 | }) |
| 568 | } |
| 569 | |
| 570 | // Function to observe code blocks and add buttons |
| 571 | const observeCodeBlocks = () => { |
no outgoing calls
no test coverage detected