Code formatting, corrected notification object on Facebook script

This commit is contained in:
Tobias Schmidl 2014-03-08 07:08:05 +01:00
parent 7e7a6eb86a
commit 04808273c8
2 changed files with 10 additions and 10 deletions

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name Facebook desktop notification
// @namespace https://www.schtobia.de/
// @version 0.1.0
// @version 0.1.1
// @description Facebook desktop notification (based on HTML5)
// @include http*://www.facebook.com/*
// @include http*://facebook.com/*
@ -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"
}
)

View file

@ -29,7 +29,7 @@ notify = function()
{
newNotifications = notificationsElement.innerHTML;
if (newNotifications > lastNotifications )
if (newNotifications > lastNotifications)
{
var msg = (newNotifications - lastNotifications) + " new Notification(s)";