Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Greasemonkey-循环通知_Javascript_Greasemonkey_Tampermonkey - Fatal编程技术网

Javascript Greasemonkey-循环通知

Javascript Greasemonkey-循环通知,javascript,greasemonkey,tampermonkey,Javascript,Greasemonkey,Tampermonkey,我有一个网站,其中金额上升,我想显示一个通知,只有当金额超过10时才会显示 我每2秒钟检查一次,但现在通知一直出现在屏幕上 我如何才能发出通知,在满足条件时显示一次,并在单击之前保持可见 // ==UserScript== // @name test // @namespace http://tampermonkey.net/ // @version 0.1 // @description test // @author You // @match

我有一个网站,其中金额上升,我想显示一个通知,只有当金额超过10时才会显示

我每2秒钟检查一次,但现在通知一直出现在屏幕上

我如何才能发出通知,在满足条件时显示一次,并在单击之前保持可见

// ==UserScript==
// @name         test
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  test
// @author       You
// @match        http://example.com*
// @grant        GM_openInTab
// @grant        GM_notification
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

var site_status = false;

function site_update(){

    var currentclaim = parseInt( document.evaluate('//*[@id="Amount"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerHTML );

    if (currentclaim > 10) {
        site_status = true;
    }

    if (site_status) {
        GM_notification("Now Time", "It is now time" + currentclaim, null, 1000);
    }

    setTimeout(site_update, 2000);
}

site_update();

})();

答案是错误的。指定超时为0的选项对象如果可能,是否有代码示例。