Code formatting, corrected notification object on Facebook script
This commit is contained in:
		
							parent
							
								
									7e7a6eb86a
								
							
						
					
					
						commit
						04808273c8
					
				
					 2 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
// ==UserScript==
 | 
			
		||||
// @name          Facebook desktop notification
 | 
			
		||||
// @namespace     https://www.schtobia.de/
 | 
			
		||||
// @version       0.1.0
 | 
			
		||||
// @description	  Facebook desktop notification (based on HTML5)
 | 
			
		||||
// @version       0.1.1
 | 
			
		||||
// @description   Facebook desktop notification (based on HTML5)
 | 
			
		||||
// @include       http*://www.facebook.com/*
 | 
			
		||||
// @include       http*://facebook.com/*
 | 
			
		||||
// @grant         GM_getValue
 | 
			
		||||
| 
						 | 
				
			
			@ -36,18 +36,18 @@ notify = function()
 | 
			
		|||
	newMessages = messagesElement.innerHTML;
 | 
			
		||||
	newNotifications = notificationsElement.innerHTML;
 | 
			
		||||
 | 
			
		||||
	if (newFriendRequests > lastFriendRequests || newMessages > lastMessages || newNotifications > lastNotifications )
 | 
			
		||||
	if (newFriendRequests > lastFriendRequests || newMessages > lastMessages || newNotifications > lastNotifications)
 | 
			
		||||
	{
 | 
			
		||||
		var msg= " ";
 | 
			
		||||
 | 
			
		||||
		if (newFriendRequests > lastFriendRequests)
 | 
			
		||||
			msg=msg+"| "+(newFriendRequests-lastFriendRequests)+" new Friend Request(s) |";
 | 
			
		||||
			msg = msg + "| " + (newFriendRequests - lastFriendRequests) + " new Friend Request(s) |";
 | 
			
		||||
 | 
			
		||||
		if (newMessages>lastMessages)
 | 
			
		||||
			msg=msg+"| "+(newMessages-lastMessages)+" new Message(s) |";
 | 
			
		||||
		if (newMessages > lastMessages)
 | 
			
		||||
			msg = msg + "| " + (newMessages - lastMessages) + " new Message(s) |";
 | 
			
		||||
 | 
			
		||||
		if (newNotifications>lastNotifications)
 | 
			
		||||
			msg=msg+"| "+(newNotifications-lastNotifications)+" new Notification(s) |";
 | 
			
		||||
		if (newNotifications > lastNotifications)
 | 
			
		||||
			msg = msg + "| " + (newNotifications - lastNotifications) + " new Notification(s) |";
 | 
			
		||||
 | 
			
		||||
		console.log(GM_info.script.name + ": Trying to set notification...", msg);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ notify = function()
 | 
			
		|||
			{
 | 
			
		||||
				"dir" : "auto",
 | 
			
		||||
				"body" : msg,
 | 
			
		||||
				"icon" : "https://s-static.ak.facebook.com/rsrc.php/yi/r/q9U99v3_saj.ico",
 | 
			
		||||
				"icon" : "https://s-static.ak.facebook.com/rsrc.php/yi/r/q9U99v3_saj.ico"
 | 
			
		||||
			}
 | 
			
		||||
		)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ notify = function()
 | 
			
		|||
{
 | 
			
		||||
	newNotifications = notificationsElement.innerHTML;
 | 
			
		||||
 | 
			
		||||
	if (newNotifications > lastNotifications )
 | 
			
		||||
	if (newNotifications > lastNotifications)
 | 
			
		||||
	{
 | 
			
		||||
		var msg = (newNotifications - lastNotifications) + " new Notification(s)";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue