Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Notification on new message. HTML5 audio tag.

Added html5 audio tag to play notification on new message. Added .ogg
for Firefox and .mp3 for other browsers.
  • Loading branch information...
commit d492ae27e7a73e439074f6a21f2d4c532cf09fca 1 parent 01c5f61
@richard-ive richard-ive authored
View
2  .gitignore
@@ -2,3 +2,5 @@
*.un~
node_modules
test.js
+
+.DS_Store
View
6 public/index.html
@@ -47,6 +47,12 @@
<div id="spiner"></div>
<p id="statusmsg"></p>
</div>
+
+<audio preload="auto" autobuffer id="notification">
+ <source src="media/bell.mp3" />
+ <source src="media/bell.ogg" />
+</audio>
+
<div id="js">
<script src="//code.jquery.com/jquery.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js" type="text/javascript"></script>
View
2  public/js/app.js
@@ -101,6 +101,8 @@ $(document).ready(function(){
}
}
+ document.getElementById('notification').play();
+
message = _.escapeHTML(message);
message = giveMeColors(message);
message = message.replace(/(https?:\/\/[-_.a-zA-Z0-9&?\/=\[\]()$!#+:]+)/g, "<a href=\"$1\" target=\"_BLANK\">$1</a>");
View
BIN  public/media/bell.mp3
Binary file not shown
View
BIN  public/media/bell.ogg
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.