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