您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
隐藏A类基金行和页面广告
// ==UserScript== // @name 天天基金排行榜优化版 // @name:en fund list // @namespace http://tampermonkey.net/ // @version 1.0 // @description 隐藏A类基金行和页面广告 // @description:en hide A fund and AD // @author lousi // @match *://fund.eastmoney.com/data/*.html* // @grant GM_addStyle // @license GPL-3.0 License // ==/UserScript== (function() { 'use strict'; // 修改日期范围为前两周 const today = new Date(); const twoWeeksAgo = new Date(today.getTime() - 14 * 24 * 60 * 60 * 1000); // 减去14天 const datest = document.getElementById('datest'); const dateend = document.getElementById('dateend'); if (datest && dateend) { datest.textContent = twoWeeksAgo.toISOString().slice(0, 10); // 格式化为YYYY-MM-DD dateend.textContent = today.toISOString().slice(0, 10); // 格式化为YYYY-MM-DD }; // 隐藏A类基金行 const hideAFunds = () => { const table = document.querySelector('table#dbtable'); if (!table) return; const rows = table.querySelectorAll('tbody tr'); rows.forEach(row => { const fundNameLink = row.querySelector('td:nth-child(4) a'); if (fundNameLink && fundNameLink.title && fundNameLink.title.endsWith('A')) { row.style.display = 'none'; } }); }; // 隐藏顶部和底部广告 const hideAds = () => { // 常见广告选择器(根据实际页面结构调整) const adSelectors = [ '.ad-banner', '.ad-container', '.top-ad', '.bottom-ad', '.ad-footer', '.cpright', '.rightAD', // 添加更多广告区域选择器 ]; adSelectors.forEach(selector => { document.querySelectorAll(selector).forEach(ad => { ad.style.display = 'none'; }); }); }; var rightAd = document.getElementById('rightAD'); if (rightAd) { rightAd.style.display = 'none'; }; const topframes = document.querySelectorAll('iframe'); topframes.forEach(iframe => { if(iframe.src.includes('same.eastmoney.com/s?z=eastmoney')) { iframe.remove(); } }); // 页面加载完成后执行 window.addEventListener('load', () => { hideAFunds(); hideAds(); }); // 监听表格更新(适用于动态加载) const observer = new MutationObserver(() => { hideAFunds(); }); observer.observe(document.body, { childList: true, subtree: true }); })();