Spaces:
Runtime error
Runtime error
File size: 2,136 Bytes
778709a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<script>
function changeButtonColors() {
const streamlitDoc = window.parent.document;
const buttons = Array.from(streamlitDoc.querySelectorAll('.stButton > button'));
const Create_Obituary = buttons.find(el => el.innerText === 'Create Obituary');
const I_want_to_add_more_information = buttons.find(el => el.innerText === 'I want to add more information');
const I_want_to_export_and_edit_manually = buttons.find(el => el.innerText === 'I want to export and edit manually');
const save_docx = buttons.find(el => el.innerText === 'Save as DOCX');
const Email_Obituary = buttons.find(el => el.innerText === 'Email Obituary');
const Send = buttons.find(el => el.innerText === 'Send');
if (Create_Obituary) {
Create_Obituary.style.backgroundColor = "Blue";
}
if (I_want_to_add_more_information) {
I_want_to_add_more_information.style.backgroundColor = "Blue";
}
if (I_want_to_export_and_edit_manually) {
I_want_to_export_and_edit_manually.style.backgroundColor = "#e75480";
}
if (save_docx) {
save_docx.style.backgroundColor = "Blue";
}
if (Email_Obituary) {
Email_Obituary.style.backgroundColor = "#e75480";
}
if (Send) {
Send.style.backgroundColor = "#e75480";
}
}
function updateButtonColorsOnClick() {
const streamlitDoc = window.parent.document;
const Email_Obituary = streamlitDoc.querySelector('.stButton > button:contains("Email Obituary")');
if (Email_Obituary) {
Email_Obituary.addEventListener("click", () => {
setTimeout(() => {
changeButtonColors();
}, 50);
});
}
}
changeButtonColors(); // Call initially to set colors for form page buttons
updateButtonColorsOnClick(); // Add event listener for "Email Obituary" button
window.addEventListener('message', (event) => {
if (event.data.type === 'streamlit:update') {
setTimeout(() => {
changeButtonColors();
updateButtonColorsOnClick();
}, 200);
}
});
</script>
|