-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (54 loc) · 2 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Styles to make the chat widget full-screen -->
<style>
messagebird-chat {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
max-width: none !important;
max-height: none !important;
border-radius: 0 !important;
}
/* Hide the close button inside the chat widget */
messagebird-chat::part(close-button) {
display: none !important;
}
</style>
<!-- Module script -->
<script defer type="module" src="https://embeddables.p.mbirdcdn.net/v1/web-components.es.js"></script>
</head>
<body>
<button id="auto-chat" hidden data-mbchat-trigger="94de0c92-98df-4d61-acf2-dfa114a5c480"></button>
<messagebird-chat
project-id="94de0c92-98df-4d61-acf2-dfa114a5c480"
workspace-id="a1b37cbd-b29d-4371-a81a-c1cd939b73a2"
></messagebird-chat>
<!-- Script to auto-trigger the chat button -->
<script>
window.addEventListener("load", function () {
const chatButton = document.getElementById("auto-chat");
if (chatButton) {
chatButton.click(); // Automatically trigger the chat button
console.log("Chat button triggered after all resources have fully loaded.");
} else {
console.error("Chat button with ID 'auto-chat' not found.");
}
});
// Loop through all buttons on the page
document.querySelectorAll('button').forEach(button => {
// Access the text content within the `.sr-only` span inside the button
const srOnlyText = button.querySelector('.sr-only')?.textContent;
// Check if the `.sr-only` span text includes "close widget" or "Download transcript"
if (srOnlyText?.includes("close widget") || srOnlyText?.includes("Download transcript")) {
// Set display to 'none' to hide the button
button.style.display = 'none';
}
});
</script>
</body>
</html>