1
如何在第一次运行grepmonkey脚本时运行函数?在第一次运行Greasemonkey脚本时执行函数
如何在第一次运行grepmonkey脚本时运行函数?在第一次运行Greasemonkey脚本时执行函数
您可以使用GM_setValue
和GM_getValue
存储设置等
尝试“得到”的标志。如果没有设置,则进行第一次运行调用,然后设置该值。例如
var isfirstrun = GM_getValue('firstrun', '0');
if (isfirstrun == '0')
{
// value not set, so must be the first run
DoSomething();
GM_setValue('firstrun', '1');
}
的文档是here