2017-02-19, 02:30 AM
[quote pid='1264453' dateline='1487469594']
I did that. But its not very important anyway, i don't mind using the normal icons.
Btw, i noticed another thing about that sound notification:
E.g. You open the forum, you get a sound notification because you have 3 alerts, now you open open the alerts box and then click on one of the alerts. You get redirected to that alerted thread and then you hear the sound again. I suppose thats because its changing from "3" to "2", since you visited that page.
Can that be fixed somehow, because imagine you have 10+ alerts and you need to hear the sound everytime.
Altough i am going to sleep now, ill see later again. Bye.
[/quote]
oh I didn't take that scenario into the account when developing this.
Anyway you can use these code. What this does, whenever the user clicked on one of the UNREAD messages, it takes the existing value stored in the cookie, and reduces it by one, since at the same time value in myalerts is reduced by one (when alert--unread is clicked), the user won't be notified again until they receive a new notification.
I did that. But its not very important anyway, i don't mind using the normal icons.
Btw, i noticed another thing about that sound notification:
E.g. You open the forum, you get a sound notification because you have 3 alerts, now you open open the alerts box and then click on one of the alerts. You get redirected to that alerted thread and then you hear the sound again. I suppose thats because its changing from "3" to "2", since you visited that page.
Can that be fixed somehow, because imagine you have 10+ alerts and you need to hear the sound everytime.
Altough i am going to sleep now, ill see later again. Bye.
[/quote]
oh I didn't take that scenario into the account when developing this.
Anyway you can use these code. What this does, whenever the user clicked on one of the UNREAD messages, it takes the existing value stored in the cookie, and reduces it by one, since at the same time value in myalerts is reduced by one (when alert--unread is clicked), the user won't be notified again until they receive a new notification.
<audio id="alert_sound" src="myalert.mp3"></audio>
<script>
var number = document.getElementsByClassName("myalerts")[0].innerHTML;
var num = number.match(/\d/g)[0];
if(num > 0){
if(num != Cookies.get('notification_sound')){
document.getElementById("alert_sound").play();
Cookies.set('notification_sound', num, { expires: 365 });
}
}else
{
Cookies.remove('notification_sound');
}
var getAllClass = document.getElementsByClassName("alert--unread");
for (var i = 0; i < getAllClass.length; i++)
{
getAllClass[i].addEventListener("click", function(){
Cookies.set('notification_sound', paraseInt(Cookies.get('notification_sound')) -1, { expires: 365 });
});
}
</script>