// ==UserScript== // @name stcn屏蔽特定用户 // @namespace acngamer.com // @version 0.33 // @description 本脚本用于屏蔽stcn指定用户的主题以及回复 // @author DL9412 // @match https://keylol.com/* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/372305/stcn%E5%B1%8F%E8%94%BD%E7%89%B9%E5%AE%9A%E7%94%A8%E6%88%B7.user.js // @updateURL https://update.greasyfork.icu/scripts/372305/stcn%E5%B1%8F%E8%94%BD%E7%89%B9%E5%AE%9A%E7%94%A8%E6%88%B7.meta.js // ==/UserScript== (function() { 'use strict'; const jq = window.jQuery; //重写ajax添加监听 function ajaxEventTrigger(event) { var ajaxEvent = new CustomEvent(event, { detail: this }); window.dispatchEvent(ajaxEvent); } var oldXHR = window.XMLHttpRequest; function newXHR() { var realXHR = new oldXHR(); realXHR.addEventListener('abort', function () { ajaxEventTrigger.call(this, 'ajaxAbort'); }, false); realXHR.addEventListener('error', function () { ajaxEventTrigger.call(this, 'ajaxError'); }, false); realXHR.addEventListener('load', function () { ajaxEventTrigger.call(this, 'ajaxLoad'); }, false); realXHR.addEventListener('loadstart', function () { ajaxEventTrigger.call(this, 'ajaxLoadStart'); }, false); realXHR.addEventListener('progress', function () { ajaxEventTrigger.call(this, 'ajaxProgress'); }, false); realXHR.addEventListener('timeout', function () { ajaxEventTrigger.call(this, 'ajaxTimeout'); }, false); realXHR.addEventListener('loadend', function () { ajaxEventTrigger.call(this, 'ajaxLoadEnd'); }, false); realXHR.addEventListener('readystatechange', function() { ajaxEventTrigger.call(this, 'ajaxReadyStateChange'); }, false); return realXHR; } window.XMLHttpRequest = newXHR; window.addEventListener('ajaxReadyStateChange', function (e) { if(e.detail.readyState == 4){ setTimeout(function(){hideuser();},1000) } }); window.addEventListener('ajaxAbort', function (e) { }); var blacklist = JSON.parse(localStorage.ublocklist || '[]'); //此处填写stcn用户uid,单人格式为[xxxxx],多人格式为[xxxxxx,xxxxxx] var uid=[]; uid = new Array(...(new Set([...blacklist,...uid]))) localStorage.ublocklist = JSON.stringify(uid); var hidetitle=1; var hidereply=1; hideuser(); if(/^\/suid-\d+$/.test(location.pathname)) manageuser(); function hideuser(){ console.info('hidestart'); var type=0; var bd = document.getElementById('nv_forum'); if(!bd) return; if(bd.className == 'pg_forumdisplay'){ type = 0; }else if(bd.className == 'pg_viewthread'){ type = 1; }else if(bd.className == 'pg_index'){ type = 2; }else if(bd.className == 'pg_guide'){ type = 3; } var hide = 0; if(type == 0 && hidetitle == 1){ for(let i=0;i.addToBlockList{float:right;margin-right:20px;font-size:18px;line-height:18px;font-weight:bold;cursor:pointer}'); jq(document).off('click','.addToBlockList'); jq(document).on('click','.addToBlockList',function(){ let adduid = jq(this).attr('uid'); let adduname = jq(this).attr('uname'); uid.push(adduid); localStorage.ublocklist = JSON.stringify(uid); jq(this).parents('table').hide(); }) for(let n=0;n 0) continue; let sp = document.createElement("span"); let adduidstr = replylist[n].href.match(/suid-\d{6}/)[0]; let adduid = adduidstr.replace('suid-',''); let adduname = replylist[n].innerText; replylist[n].parentNode.appendChild(sp); sp.innerText = '+'; sp.className = 'addToBlockList'; sp.setAttribute("uid",adduid); sp.setAttribute("uname",adduname); sp.setAttribute("title",'添加用户'+adduname+'至黑名单'); } }else if(type == 2 && hidetitle == 1){ for(let x=0;x0){ if(ema[0].href.search(reg)!= -1){ replylist[z].parentNode.style.display = 'none'; hide++; } } } } }else if(type == 3 && hidetitle == 1){ for(let m=0;m'); jq('#wp').after(''); jq('#manageblock').append('
屏蔽管理
'); uid.forEach(ele=>{ var str = '' jq('#manageblock').append(str); }) jq(document).off('click','.removeblock'); jq(document).on('click','.removeblock',function(){ let buid = jq(this).attr('uid'); let tmp = new Set(uid); tmp.delete(buid); uid = new Array(...tmp); localStorage.ublocklist = JSON.stringify(uid); manageuser(); }) } })();