Fixes #13 by introducing vibration where available
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
<h1>Safe Chat</h1>
|
||||
<h1>Safe Chat @PACKAGE_VERSION@</h1>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
@@ -119,6 +119,19 @@ function status(text, msg) {
|
||||
});
|
||||
}
|
||||
|
||||
/// Alert user
|
||||
/** Alert user, e.g. that a new message has arrived.
|
||||
@param */
|
||||
function alert() {
|
||||
navigator.vibrate =
|
||||
navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
|
||||
if (navigator.vibrate) {
|
||||
// vibration API supported
|
||||
navigator.vibrate(1000);
|
||||
}
|
||||
(new Audio("A-Tone-His_Self-1266414414.mp3")).play();
|
||||
}
|
||||
|
||||
/// Check if user name is available
|
||||
/** Calls checknewuser.php on server and displays an error, if the
|
||||
user name is already in use. This function is used when creating a
|
||||
@@ -372,9 +385,7 @@ function get() {
|
||||
// calculate and show emoticons
|
||||
$('#id'+e.id).emoticonize();
|
||||
// beep for the first new message
|
||||
if (!beeped)
|
||||
(new Audio("A-Tone-His_Self-1266414414.mp3"))
|
||||
.play();
|
||||
if (!beeped) alert()
|
||||
beeped = true;
|
||||
success();
|
||||
})
|
||||
|
Reference in New Issue
Block a user