Skip to content

Instantly share code, notes, and snippets.

@cha0s
Last active August 29, 2015 14:15
Show Gist options
  • Save cha0s/616ba91f4c6f86909c30 to your computer and use it in GitHub Desktop.
Save cha0s/616ba91f4c6f86909c30 to your computer and use it in GitHub Desktop.
javascript:(function() { angular.element(document.body).injector().invoke(['$rootScope', 'shrub-socket', 'shrub-ui/notifications', function($rootScope, socket, notifications) { if (window.playMessageSound) { window.playMessageSound = false; notifications.add({text: 'Message sound disabled'}); } else { window.playMessageSound = true; if (!window.messageSound) { window.messageSound = document.createElement('audio'); window.messageSound.src = 'http://reddichat.com/chat-message.mp3'; socket.on('reddichat.chat.message', function() { if (window.playMessageSound) window.messageSound.play(); }); } notifications.add({text: 'Message sound enabled'}); } $rootScope.$digest(); }]); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment