Browse Source

fixed sound notifications

master
Hedgehog 11 years ago
parent
commit
370a1be8de
  1. 2
      home.html
  2. 21
      js/options.js
  3. 4
      js/twister_timeline.js

2
home.html

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

21
js/options.js

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

4
js/twister_timeline.js

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

Loading…
Cancel
Save