这个加了,试过后依然不行。
// ==UserScript==
// @
name joinquant comm open item
// @
namespace https://greasyfork.org/users/256625// @
match https://uqer.datayes.com/v3/*// @
match https://www.joinquant.com/view/community/list?listType=1// @
version 1
// @
description yeah
// @
author DipshitDickinson
// @
grant GM_openInTab
// @
run-at document-end
// ==/UserScript==
'use strict';
//setTimeout(autoClick,500);
//setInterval(autoClick,2000);
function matchURL(x) {
return window.location.href.indexOf(x) != -1;
}
(function() {
function pageOnLoad() {
// HTML 文档已完成加载
//打开一个社区帖子
const item = "body > section > main > div > div.jq-m-community-list__content > div.jq-m-community-list__left > div.jq-m-community-list__list > div.jq-c-list.jq-c-list_community > div:nth-child(10) > div > div.jq-c-list_community__title > div.jq-c-list_community__text"
console.log("----------------------------starting")
async function waitForItem() {
while (!document.querySelector(item)) {
await new Promise(resolve => setTimeout(resolve, 3000)); // 等待 1 秒
}
// 当目标按钮出现时,执行相应的操作
document.querySelector(item).click();
console.log("----------------------------clicked")
}
waitForItem();
}
function ready(fn) {
if (document.readyState !== 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(pageOnLoad);
})();