// ==UserScript== // @name mteam pt discuss // @namespace http://tampermonkey.net/ // @version 2020.5 // @description mteam 根据 评论数高亮颜色, 筛选 // @author Sean // @match https://pt.m-team.cc/* // @grant GM_log // @run-at document-end // @supportURL https://greasyfork.org/en/scripts/ // @downloadURL none // ==/UserScript== (function () { 'use strict'; try { console.log("start 馒头筛选 pt ==== discuss"); var table = document.querySelector("#form_torrent > table"); var len = table.rows.length; //101 let totalHide = 0; for (let i = len - 1; i > 1; i--) { var searchText = table.rows[i].cells[2].innerText;//取得table行,列的值 let number = parseInt(searchText); if (number > 0) { } else { totalHide++; table.rows[i].style.display = 'none';//隐藏行操作 } } let bodyElement = document.querySelector("body") let divall = document.createElement("div"); divall.style = "padding-left: 10%;\n" + " padding-right: 30%;\n" + " font-size: x-large;\n" + " background: aquamarine;\n" + " margin-left: 5%;\n" + " margin-right: 5%;\n" + " width: 920px;"; divall.textContent = "成功隐藏了:" + totalHide + "个0评论的种子 " let buttonElement = document.createElement("button"); buttonElement.style = "color: #409eff;\n" + " background: #ecf5ff;\n" + " border-color: #b3d8ff;" + "display: inline-block;\n" + " line-height: 1;\n" + " white-space: nowrap;\n" + " cursor: pointer;" + "-webkit-appearance: none;\n" + " text-align: center;\n" + " box-sizing: border-box;\n" + " outline: none;\n" + " margin: 8px;\n" + " transition: .1s;\n" + " font-weight: 300;" + "padding: 6px 10px;\n" + " font-size: 14px;\n" + " border-radius: 4px;" buttonElement.οnclick = function () { alert("hello world"); } buttonElement.innerText = "点击显示" divall.appendChild(buttonElement) let tableElement = document.querySelector("body > table.mainouter") bodyElement.insertBefore(divall, tableElement) } catch (e) { GM_log(e) } })();