fixed sound notifications

This commit is contained in:
Hedgehog 2014-06-17 19:57:30 +04:00
parent a38a162a03
commit 370a1be8de
3 changed files with 13 additions and 18 deletions

View File

@ -33,7 +33,7 @@
<script src="jquery-emotions/jquery.emotions.js"></script>
<script src="js/sjcl.js"></script>
<script>
$(function(){setInterval("networkUpdate()", 2000); homeIntInit();})
$(function(){setInterval("networkUpdate()", 2000); homeIntInit();});
</script>
<link rel="icon" type="image/png" href="img/twister_mini.png" />

View File

@ -57,33 +57,28 @@ var TwisterOptions = function()
this.DMsNotif = function() {
if($.Options.getOption('sndDM', 'false') === "false") return;
var opt = $.Options.getOption('sndDM', 'false');
var player = $('#player');
$('#player').empty();
if (player[0].canPlayType('audio/mpeg;')) {
player.attr('type', 'audio/mpeg');
player.attr('src', 'sound/'+localStorage['sndDM']+'.mp3');
} else {
player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+localStorage['sndDM']+'.ogg');
}
player.attr('type', 'audio/mpeg');
player.attr('src', 'sound/'+opt+'.mp3');
player[0].volume = $.Options.getOption('playerVol', 1);
player[0].play();
}
this.mensNotif = function() {
if($.Options.getOption('sndMention', 'false' === 'false')) return;
if($.Options.getOption('sndMention', 'false') === 'false') return;
var opt = $.Options.getOption('sndMention', 'false');
var player = $('#player');
$('#playerSec').empty();
if (player[0].canPlayType('audio/mpeg;')) {
player.attr('type', 'audio/mpeg');
player.attr('src', 'sound/'+localStorage['sndMention']+'.mp3');
} else {
player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+localStorage['sndMention']+'.ogg');
}
player.attr('type', 'audio/mpeg');
player.attr('src', 'sound/'+opt+'.mp3');
player[0].volume = $.Options.getOption('playerVol', 1);
player[0].play();
};

View File

@ -279,7 +279,7 @@ function processLastHave(userHaves)
// callback for getposts to update the number of new pending posts not shown in timeline
function processNewPostsConfirmation(expected, posts)
{
_newPostsPending += posts.length -1;
_newPostsPending += posts.length;
//we don't want to produce alert for the posts that won't be displayed
var p2h = 0;
@ -291,7 +291,7 @@ function processNewPostsConfirmation(expected, posts)
}
_newPostsPending += posts.length - p2h;
if( _newPostsPending ) {
$.MAL.reportNewPosts(_newPostsPending);
$.MAL.reportNewPosts(_newPostsPending - 1);
}
if( posts.length < expected ) {
// new DMs have probably been produced by users we follow.