// ==UserScript== // @name 【自用】雪球 // @match https://xueqiu.com/* // @version 2021.09.08 // @author heckles // @description 链接当前页面打开 // @icon https://github.com/favicon.ico // @homepage https://greasyfork.org/zh-CN/scripts/431835-%E8%87%AA%E7%94%A8-%E9%9B%AA%E7%90%83 // @namespace https://greasyfork.org/users/24050 // @downloadURL none // ==/UserScript== const cusCSS = ` /*减淡其他信息*/ .optional__tb { color:rgba(0,0,0,0.4) !important; } /*自选股名称加粗*/ td a.name { color:rgba(0,0,0,0.65) !important; font-weight: bold !important; } ` function addNewStyle(newStyle) {//增加新样式表 var styleElement = document.getElementById('styles_js'); if (!styleElement) { styleElement = document.createElement('style'); styleElement.type = 'text/css'; styleElement.id = 'styles_js'; document.getElementsByTagName('head')[0].appendChild(styleElement); } styleElement.appendChild(document.createTextNode(newStyle)); } addNewStyle(cusCSS); const cssframe = ` right: 0px; top: -1px; position: fixed; width: 68%; background-color:#fff; z-index:999999; ` const cssnewsfbg = ` top: 0px; left: 0px; position: fixed; width: 100%; background-color:rgba(0,0,0,0.8); z-index:0; ` var newsframe = document.createElement("iframe"); newsframe.name = "newsframeName"; newsframe.id = "newss"; newsframe.setAttribute("frameborder", "no"); var newsfbg = document.createElement("div"); newsfbg.id = "newsfbg"; document.body.appendChild(newsfbg); newsfbg.appendChild(newsframe); if (window.location.href.indexOf("xueqiu.com/S") < 0) { var WaitXXX = setInterval(function () { //间隔执行 if (document.querySelector("td .name")) { clearInterval(WaitXXX); StartJsIndex(); dvdelne(); layout(); } }, 1000); //间隔时间,毫秒 }else{ StartJsGp(); } function layout() { //var targ = document.querySelector("a[innerHTML='发帖']"); //没法用innerHTML的内容来queryselect,因为目标元素的所有父元素都包含这个内容 //var targ = document.querySelector(".nav__btn--longtext a[href='javascript:;']"); //这样倒是可以 var abr = document.createElement("button"); abr.style.cssText ="margin:2px 0px 2px 12px;width:64px;height:28px;z-index:99999999;font-size:14px;border:0px;background:transparent;color:#fff;"; abr.innerHTML = "切换布局"; document.querySelector("div.signed_container div.nav__lf").appendChild(abr); abr.onclick = function(){ var xx = document.querySelector("div.home__col--rt ul.home__business").style.display; switch (xx) { case "block": xx = "none"; break; case "none": xx = "block"; break; default: xx = "none"; } console.log(xx); document.querySelector("div.home__col--rt ul.home__business").style.display = xx; document.querySelector("div.home__col--rt div.info-report-wrap").style.display = xx; }; abr.click();//模拟点击一下 } function dvdelne() { var zichiRowtd = document.querySelector("a[href='/S/SZ159967']").parentNode.parentNode.querySelectorAll("td");//.previousSibling .nextSibling var zhishuRowtd = document.querySelector("a[href='/S/SH000016']").parentNode.parentNode.querySelectorAll("td"); for (var i=0; i