// ==UserScript== // @name 河畔跳蚤查找器 // @namespace http://tampermonkey.net/ // @version 0.5 // @description try to take over the world! // @author sheldon coulson // @match https://bbs.uestc.edu.cn/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here... let li = document.getElementsByClassName("s xst") let links = new Array let count = 0 let flag = 0 let normalThread = 0 let check = ""; const x = /mac/i for (let i = 0; i < li.length; i++){ check = li[i].parentNode.parentNode.parentNode.id.slice(0, 5); if(check == "stick"){ normalThread++; } } for (let i = normalThread; i < li.length; i++){ let str = li[i].innerHTML; if(str.search(x)!=-1){ links.push(li[i].href); count++; } } if(count){ if(flag = confirm("本页有关于\""+x.source+"\"的"+count+"条相关信息,是否查看?")){ for(let j = count-1; j >= 0;j--){ window.open(links[j], "_blank"); } }flag = 0; } })();