diff --git a/facebook-notification.user.js b/facebook-notification.user.js index 8c42c8f..484ae82 100644 --- a/facebook-notification.user.js +++ b/facebook-notification.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Facebook desktop notification // @namespace https://www.schtobia.de/ -// @version 0.1.1 +// @version 0.2.0 // @description Facebook desktop notification (based on HTML5) // @include http*://www.facebook.com/* // @include http*://facebook.com/* @@ -32,6 +32,14 @@ var intervalID = null; notify = function() { + if (friendRequestsElement == null || messagesElement == null || notificationsElement == null) + { + console.log(GM_info.script.name + ": One of the DOM nodes is empty! Clearing the interval timer " + intervalID + "!"); + clearInterval(intervalID); + intervalID = null; + return; + } + newFriendRequests = friendRequestsElement.innerHTML; newMessages = messagesElement.innerHTML; newNotifications = notificationsElement.innerHTML; diff --git a/googleplus-notification.user.js b/googleplus-notification.user.js index f5b687d..dd0207e 100644 --- a/googleplus-notification.user.js +++ b/googleplus-notification.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Google+ desktop notification // @namespace https://www.schtobia.de/ -// @version 0.1.1 +// @version 0.2.0 // @description Google+ desktop notification (based on HTML5) // @include http*://plus.google.com/* // @grant GM_getValue @@ -25,6 +25,14 @@ var intervalID = null; notify = function() { + if (notificationsElement == null) + { + console.log(GM_info.script.name + ": The DOM node is empty! Clearing the interval timer " + intervalID + "!"); + clearInterval(intervalID); + intervalID = null; + return; + } + newNotifications = notificationsElement.innerHTML; if (newNotifications > lastNotifications)