Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| vendors:cisco:uc:ece:custom-buttons [2026/02/12 12:59] – [page1.html] gerardorourke | vendors:cisco:uc:ece:custom-buttons [2026/02/25 15:54] (current) – [page1.html] gerardorourke | ||
|---|---|---|---|
| Line 40: | Line 40: | ||
| if (data.Caller === " | if (data.Caller === " | ||
| if (data.Value> | if (data.Value> | ||
| - | var sound = new Audio(" | ||
| alert(" | alert(" | ||
| } | } | ||
| Line 141: | Line 140: | ||
| <script language=javascript> | <script language=javascript> | ||
| function showChatButton() { | function showChatButton() { | ||
| - | | + | |
| } | } | ||
| function hideChatButton() { | function hideChatButton() { | ||
| - | | + | |
| } | } | ||
| - | |||
| window.addEventListener(" | window.addEventListener(" | ||
| Line 153: | Line 151: | ||
| const data = JSON.parse(event.data); | const data = JSON.parse(event.data); | ||
| - | // This shows all ECE events to console (so disable / comment out this console output in production) | + | |
| - | console.log(" | + | console.log(" |
| // Detect minimize | // Detect minimize | ||
| if (data.Caller === " | if (data.Caller === " | ||
| - | showChatButton(); | + | |
| } | } | ||
| // Detect maximize | // Detect maximize | ||
| if (data.Caller === " | if (data.Caller === " | ||
| - | hideChatButton(); | + | |
| + | // Screen reader announcement | ||
| + | var announcer = document.getElementById(" | ||
| + | announcer.textContent = ""; | ||
| } | } | ||
| - | // Detect Close Chat (this is only needed on ' | + | |
| - | if (data.Caller === " | + | if (data.Caller === " |
| - | showChatButton(); | + | showChatButton(); |
| } | } | ||
| - | // Detect badge count update | + | |
| if (data.Caller === " | if (data.Caller === " | ||
| var unread = data.Value; | var unread = data.Value; | ||
| - | if (unread > 0){ | + | |
| - | document.getElementById(" | + | document.getElementById(" |
| - | + | var announcer | |
| - | // Play audio alert (download and host on your own webserver) | + | |
| - | var sound = new Audio("https:// | + | // Screen reader announcement |
| - | sound.play(); | + | announcer.textContent |
| - | + | } else { | |
| - | // Screen reader announcement | + | |
| - | var announcer = document.getElementById("sr-announcer" | + | } |
| - | announcer.textContent = "Chat message received. You have " + unread + " unread messages."; | + | |
| - | } | + | |
| } | } | ||
| Line 281: | Line 281: | ||
| if (data.Caller === " | if (data.Caller === " | ||
| hideChatButton(); | hideChatButton(); | ||
| + | // Clear Screen reader announcement Text | ||
| + | var announcer = document.getElementById(" | ||
| + | announcer.textContent = ""; | ||
| + | |||
| } | } | ||
| - | // Detect badge count update | + | |
| if (data.Caller === " | if (data.Caller === " | ||
| var unread = data.Value; | var unread = data.Value; | ||
| - | if (unread > 0){ | + | |
| - | document.getElementById(" | + | document.getElementById(" |
| - | // Play audio alert (download and host on your own webserver) | + | var announcer |
| - | var sound = new Audio("https:// | + | |
| - | sound.play(); | + | // Screen reader announcement |
| - | + | announcer.textContent | |
| - | // Screen reader announcement | + | } else { |
| - | var announcer = document.getElementById("sr-announcer" | + | |
| - | announcer.textContent = "Chat message received. You have " + unread + " unread messages."; | + | } |
| - | } | + | |
| } | } | ||