Check on callback if the DOM nodes exist.
If the don't, clear the timer, as each subsequent run would operate on the same empty nodes.
This commit is contained in:
parent
ebd2a09947
commit
4b14ea8de1
2 changed files with 18 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue