~johanvandegriff/live.johanv.xyz

9b64213e325f772747ce6bcfcaee3d0d93ca3f8c — Johan Vandegriff 1 year, 3 days ago de799b7
added notification sound for chat messages
2 files changed, 13 insertions(+), 0 deletions(-)

M index.html
A static/notification.ogg
M index.html => index.html +13 -0
@@ 36,6 36,12 @@
                | stream announcements:
                <a target="_blank" href="https://fosstodon.org/@johanv">mastodon</a></p>
            </div>

            <audio id="notification">
                <source src="/static/notification.ogg" type="audio/mpeg">
            </audio>
            <input type="checkbox" id="check" name="check" value="yes">
            <label for="check">chat notification sound?</label>
        </div>
        <div id="chat">
            <ul id="messages"></ul>


@@ 89,6 95,13 @@
                    
                    //scroll to the most recent message
                    $("#messages").scrollTop($("#messages")[0].scrollHeight);

                    //play sound if checkbox is checked
                    if (document.getElementById("check").checked) {
                        document.getElementById("notification").pause();
                        document.getElementById("notification").currentTime = 0;
                        document.getElementById("notification").play()
                    }
                });
            });
        </script>

A static/notification.ogg => static/notification.ogg +0 -0