【发布时间】:2017-09-11 01:06:59
【问题描述】:
我正在尝试点击 stackoverflow.com 侧边栏中的第一个收藏链接。
我找到了这个脚本,但问题是页面不断刷新。
有没有办法阻止这种行为?
// ==UserScript==
// @name _ChromeC
// @include *//stackoverflow.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a major design
change introduced in GM 1.0.
It restores the sandbox.
*/
waitForKeyElements ("#interestingTags a", actionFunction);
function actionFunction (jNode) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);
}
【问题讨论】:
-
第一次后卸载脚本?
-
什么意思?
-
什么不清楚?
-
“卸载脚本”是什么意思?每次访问stackoverlow时是否应该卸载它并重新安装它? XD
-
我的意思是脚本不应该一直点击链接...
标签: greasemonkey