MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2014-12-08, 09:38 PM)TBO29 Wrote: [ -> ]Another small one:

alt="{$alert['username']}'s avatar" does not work.

AH, I had noticed that one earlier but obviously completely forgotten about it. D'oh!
About the way of alerts can be showed  i think if have some internal var you can make it works with jQuery i use it and no problem. Used since 1.6 and goea fine without several loads.

And you can to set alerts with css customization, only have to add the class and where can be hided xD. (This with jQuery i din not do yet but i know it's easy to do)

 I share images of how i show alerts on my forum.
Looks good Smile I put plenty of CSS classes in to allow for customisation so it's nice to see them being used Wink
@EuanT Add 2 links on the Notification window, please: 1.Mark all as read 2.Alerts settings link on FaceBook notifications window.
Oh, and I think that when a person see something that it is also a notification, like a PM or a new post on his/her threads or a mention without clicking on the related notification, that notification should immediately appear as already read and not still keep on being unread!

After this being added, the plugin will be perfect!
it is my js code

<audio id="audiotag1" src="jscripts/chimes.wav" preload="auto"></audio>  
<script type="text/javascript">
jQuery(document).ready(function($) {

function play_single_sound() {document.getElementById('audiotag1').play();}

$("#AlertNew").html(0); 
var counter=0;
var myvar= setInterval(function AlertRefresh() {
if(3!=1) {
 $.ajax({
 type: "post",
 url: 'xmlhttp.php?action=newalert&my_post_key='+my_post_key,
 complete: function(request){
 if (request.responseText > 0) {
$("#AlertNew").html(request.responseText);
   
play_single_sound();

counter++;
if(counter>=1)
    clearInterval(myvar);
 }
 }
 });
}
}, 3000);
});
</script>


New Alert = play sound Smile

But alert popup not refresh Sad
Do you mean the popup content stays the same? I think that may be due to the action you're using. Try this for the AJAX instead:

$.ajax({
	type: "get",
	url: "xmlhttp.php?action=getNewAlerts",
	data: {
		"my_post_key": my_post_key,
		"from": "header"
	},
	dataType: "json",
 	complete: function(response) {
 		if (!response.errors) {
			$("#AlertNew").html(response.template);
   
			play_single_sound();

			counter++;
			if (counter>=1) {
				clearInterval(myvar);
			}
 		}
	}
});

I think that should work Smile
I'm still testing it, but is there a recent developed code available? I might be missing it entirely.
You should add one this week Big Grin
I plan to add a few more than one Wink