MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I just found one thing I love about Prorotype: it has an Object.toJSON() method whereas jQuery relies on JSON.stringify() and if the browser doesn't have said method then you need an external script adding.

Anyway, pushing to the mods site. I also took the chance to remove the hard coded "Alerts" in the myalerts_headericon template and add z-index: 9999; to the CSS .myalerts_popup_wrapper .myalerts_popup.

To update the plugin, first deactivate it via the ACP, re-upload the plugin then re-activate. Your settings should remain unchanged as should your templates if you've modified them. If you have modified your templates, you need to update the myalerts_alert_row_popup template and add the following id to the <li>:

id="alert_row_popup_{$alert['id']}"

If you're not sure about the required change, the best bet would be to use the find updated templates tool in the ACP or just revert the template.
There is much to love about Prototype Big Grin
The only think I dislike about it is the fact you have to use $$() to select by class instead of just $(). Once I'd got that figured out though it was plain sailing. I must say that I do still prefer jQuery's syntax in some cases though:

Prototype:

Event.observe('unreadAlerts_menu', 'click', function(e) {
		Event.stop(e);
		var popup_id = e.target.identify() + '_popup';
		Effect.toggle(popup_id, 'blind', {
			afterFinish: function() {
   				var toMarkRead = new Array;
				$$('[id^="alert_row_popup_"]').each(function(s, index) {
					toMarkRead.push(s.readAttribute('id').substr(16));
				});

				new Ajax.Request('xmlhttp.php?action=markRead',
  				{
		    		method:'get',
		    		parameters: {
		    			my_post_key: my_post_key,
		    			toMarkRead: Object.toJSON(toMarkRead),
		    			js_type: 'prototype'
		    		},
					onSuccess: function() {},
					onFailure: function() {}
		  		});
   			}
   		});
	});

jQuery:

$('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');
Edit.
Fixed.
Be aware that if you have problems updating MyAlerts templates after upgrading, it is a known fault within PluginLibrary that I have reported to frostschutz. I know WWEForums had this issue last night and I had to modify the templates via phpmyadmin.
Yeah, I've had that issue. I always need to uninstall/reinstall the plugin to get the template saving to work.
Yeah, frostschutz said he'd take a look at it today so we should see PluginLibrary 11 within a few days Smile
I will try this on localhost once all these current issues are sorted.
Can anybody tell me how to fix this issue?
Well I dont know dose this happening with everybody or not. Let me explain the issue properly below.
Support I have 2 account in my board, 1 is Test1 and Test2. Now suppose Test1 sent a PM to Test2. Well then in the Top Alert notification section become red and clicking on that a dropdown list will come with the notification.
Now the issue.
Suppose I got a notification: "Test1 sent you a new private message titled "test". (Today 10:15 AM)"
Now when I click on the PM subject which is "test", it will properly redirecting me to the PM page so that I can read the PM. But the issue is, in the top alert notification area still keeps Red and showing "(1)" which means I have some unread notification. But I already read it naa?
Well to remove that read and (1) - I have to click on the "view alert" link within the dropdown list, then it redirecting to a new alert page where I can see all the alerts. From that page if I click on the PM subject, it also redirect me to the PM and the top alert notification becomes normal.

Any help? Is this a bug? How to fix it?
(2012-10-17, 10:29 AM)godgifted Wrote: [ -> ]Any help? Is this a bug? How to fix it?

What you're describing is still being worked on I believe, I get the same thing.

Would be ideal if it marked all the alerts as 'read' when the alert drop down is shown, as that's pretty much it doing it's job: It has alerted you.