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==
|
// ==UserScript==
|
||||||
// @name Facebook desktop notification
|
// @name Facebook desktop notification
|
||||||
// @namespace https://www.schtobia.de/
|
// @namespace https://www.schtobia.de/
|
||||||
// @version 0.1.0
|
// @version 0.1.1
|
||||||
// @description Facebook desktop notification (based on HTML5)
|
// @description Facebook desktop notification (based on HTML5)
|
||||||
// @include http*://www.facebook.com/*
|
// @include http*://www.facebook.com/*
|
||||||
// @include http*://facebook.com/*
|
// @include http*://facebook.com/*
|
||||||
// @grant GM_getValue
|
// @grant GM_getValue
|
||||||
|
@ -36,18 +36,18 @@ notify = function()
|
||||||
newMessages = messagesElement.innerHTML;
|
newMessages = messagesElement.innerHTML;
|
||||||
newNotifications = notificationsElement.innerHTML;
|
newNotifications = notificationsElement.innerHTML;
|
||||||
|
|
||||||
if (newFriendRequests > lastFriendRequests || newMessages > lastMessages || newNotifications > lastNotifications )
|
if (newFriendRequests > lastFriendRequests || newMessages > lastMessages || newNotifications > lastNotifications)
|
||||||
{
|
{
|
||||||
var msg= " ";
|
var msg= " ";
|
||||||
|
|
||||||
if (newFriendRequests > lastFriendRequests)
|
if (newFriendRequests > lastFriendRequests)
|
||||||
msg=msg+"| "+(newFriendRequests-lastFriendRequests)+" new Friend Request(s) |";
|
msg = msg + "| " + (newFriendRequests - lastFriendRequests) + " new Friend Request(s) |";
|
||||||
|
|
||||||
if (newMessages>lastMessages)
|
if (newMessages > lastMessages)
|
||||||
msg=msg+"| "+(newMessages-lastMessages)+" new Message(s) |";
|
msg = msg + "| " + (newMessages - lastMessages) + " new Message(s) |";
|
||||||
|
|
||||||
if (newNotifications>lastNotifications)
|
if (newNotifications > lastNotifications)
|
||||||
msg=msg+"| "+(newNotifications-lastNotifications)+" new Notification(s) |";
|
msg = msg + "| " + (newNotifications - lastNotifications) + " new Notification(s) |";
|
||||||
|
|
||||||
console.log(GM_info.script.name + ": Trying to set notification...", msg);
|
console.log(GM_info.script.name + ": Trying to set notification...", msg);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ notify = function()
|
||||||
{
|
{
|
||||||
"dir" : "auto",
|
"dir" : "auto",
|
||||||
"body" : msg,
|
"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;
|
newNotifications = notificationsElement.innerHTML;
|
||||||
|
|
||||||
if (newNotifications > lastNotifications )
|
if (newNotifications > lastNotifications)
|
||||||
{
|
{
|
||||||
var msg = (newNotifications - lastNotifications) + " new Notification(s)";
|
var msg = (newNotifications - lastNotifications) + " new Notification(s)";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue