// ==UserScript== // @name 吾爱破解论坛助手 // @namespace // @icon https://avatar.52pojie.cn/images/noavatar_small.gif // @version 1.03 // @description 移除广告、精简页面、后台自动签到、验证问答自动填充 // @author test // @match https://www.52pojie.cn/* // @license MIT // @grant GM_addStyle // @namespace https://greasyfork.org/users/984773 // @downloadURL none // ==/UserScript== ;(function () { 'use strict' runjs1() runjs2() runjs3() })() function runjs1() { const css = ` /* 页面背景 */ body{ background: none !important } /* 顶部工具条 */ #toptb{ display: none !important; } /* 版规 */ .bml{ display: none; } /* 帖内广告:水平 + 竖直 */ .dnch_eo_pt, .dnch_eo_pr{ display: none !important; } /* 用户签名 + 签名下的提示 */ .sign, .dnch_eo_pb{ display: none !important; } /* 底部免责声明 */ .res-footer-note{ display: none !important; } /* 底部广告 */ .dnch_eo_f{ display: none !important; } /* 菜单广告 */ .dnch_eo_mu{display: none !important;} /* 回帖框背景图 */ #f_pst #fastpostmessage{ background: none !important } ` try { GM_addStyle(css) } catch (e) { console.log('脚本失效,刷新后重试。', e) } } function runjs2() { const p = { befor: 'qds.png', after: 'wbs.png', afterImg: '', ajax: 'home.php?mod=task&do=apply&id=2', hide: `.qq_bind{ display: none }`, show: `.qq_bind{ display: inline-block }`, repeat: '本期您已申请过此任务', success: '任务已完成', } window.onload = function () { const imgDom = document.querySelector('.qq_bind') const img = imgDom.src.substring(imgDom.src.length - 7) if (img === p.after) { console.log('已经签到完毕!') return false } if (img === p.befor) { console.log('尝试自动签到中……') GM_addStyle(p.hide) const a = new Ajax() a.getHTML(p.ajax, function (res) { if (res.indexOf(p.success) > 0 || res.indexOf(p.repeat) > 0) { imgDom.parentNode.outerHTML = p.afterImg GM_addStyle(p.show) console.log('自动签到成功!') } else { console.log('自动签到失败,请手动签到!') } }) } } } function runjs3() { //验证问答自动填充 let times = 0 const intervalFn = setInterval(() => { const tipObj = document.getElementById('seccodeqS0_menu') const inputObj = document.getElementById('secqaaverify_qS0') const answer = tipObj.innerHTML.split('答案:')[1] if (answer) { inputObj.value = answer clearInterval(intervalFn) } times++ if (times >= 5) clearInterval(intervalFn) }, 1000) }