MyAlerts alteration

  • Welcome to "The New" Wrestling Smarks Forum!

    I see that you are not currently registered on our forum. It only takes a second, and you can even login with your Facebook! If you would like to register now, pease click here: Register

    Once registered please introduce yourself in our introduction thread which can be found here: Introduction Board


euantor

Jobber
Joined
Sep 10, 2012
Messages
151
Reaction score
16
Points
0
Age
31
Location
England
First of all, IDK if you're using the latest version of MyAlerts here or not. Second, I'll likely be adding this code snippet to the next version but I'd love to see it manually added here in the meantime. I can't believe I overlooked it.

https://github.com/euantor/MyAlerts/wiki/Closing-the-alerts-popup-when-clicking-outside
 

Solidus1

eXit
Joined
Dec 25, 2011
Messages
15,712
Reaction score
4,672
Points
0
It is for me. Better revert that change though.
 

euantor

Jobber
Joined
Sep 10, 2012
Messages
151
Reaction score
16
Points
0
Age
31
Location
England
Or it may be because the MyAlerts JS is in the headerinclude twice.
 

Solidus1

eXit
Joined
Dec 25, 2011
Messages
15,712
Reaction score
4,672
Points
0
Okay, removed one and added the code back. How is it?
---
Now I can't open them.
 

euantor

Jobber
Joined
Sep 10, 2012
Messages
151
Reaction score
16
Points
0
Age
31
Location
England
The menu does now open but the previous issue of clicking within the menu still occurs.
 

Solidus1

eXit
Joined
Dec 25, 2011
Messages
15,712
Reaction score
4,672
Points
0
Can't even open it now, with or without the code above.
 

euantor

Jobber
Joined
Sep 10, 2012
Messages
151
Reaction score
16
Points
0
Age
31
Location
England
Odd indeed. I assume you've done a hard refresh etc? Check the source and post what is shown in the myalerts.js file please as it's working perfectly for me.
 

Solidus1

eXit
Joined
Dec 25, 2011
Messages
15,712
Reaction score
4,672
Points
0
Every time. Try Firefox.

PHP:
jQuery.noConflict();

jQuery(document).ready(function($)
{

$("body:not('.myalerts_popup:visible')").on('click', function() {
    $('.myalerts_popup:visible').slideToggle("fast");
});

$('.myalerts_popup > *').on('click', function(event) {
    event.stopPropagation();
}); 

	$('body').on({
		click: function(event)
		{
			event.preventDefault();
			var popup_id = $(this).attr('id') + '_popup';

			$('#' + popup_id).attr('top', $(this).height() + 'px').slideToggle('slow', function() {
				var toMarkRead = new Array;
				$('[id^="alert_row_popup_"]').each(function() {
					toMarkRead.push($(this).attr('id').substr(16));
				});

				$.get('xmlhttp.php?action=markRead', {
					my_post_key: my_post_key,
					toMarkRead: toMarkRead
				}, function(data) {

				});
			});
			return false;
		}
	}, '.myalerts_popup_hook');

	$('#getUnreadAlerts').on('click', function(event) {
		event.preventDefault();
		$.get('xmlhttp.php?action=getNewAlerts', function(data) {
			$('#latestAlertsListing').prepend(data);
		});
	});

	$('.deleteAlertButton').on('click', function(event) {
		event.preventDefault();
		var deleteButton = $(this);

		$.getJSON(deleteButton.attr('href'), {accessMethod: 'js'}, function(data) {
			if (data['success'])
			{
				deleteButton.parents('tr').get(0).remove();
				if (data['template'])
				{
					$('#latestAlertsListing').html(data['template']);
				}
			}
			else
			{
				alert(data['error']);
			}
		});
	});

	if (typeof myalerts_autorefresh !== 'undefined' && myalerts_autorefresh > 0)
	{
		window.setInterval(function() {
			$.get('xmlhttp.php?action=getNewAlerts', function(data) {
				$('#latestAlertsListing').prepend(data);
			});
		}, myalerts_autorefresh * 1000);
	}

	if (typeof unreadAlerts !== 'undefined' && unreadAlerts > 0)
	{
		document.title = document.title + ' (' + unreadAlerts + ')';
	}

});
 

euantor

Jobber
Joined
Sep 10, 2012
Messages
151
Reaction score
16
Points
0
Age
31
Location
England
Odd indeed. No idea why it wouldn't work in firefox. I'll have to look into it.