您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name yaohuo // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author Polygon // @match https://yaohuo.me/bbs-* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @run-at document-end // ==/UserScript== (function () { 'use strict'; let nextPageURL = document.querySelector('.more a').getAttribute('href') console.log(nextPageURL) console.log(nextPageURL.match(/Total=(\d+)/g)[0].split('=')[1]) if (parseInt(nextPageURL.match(/Total=(\d+)/g)[0].split('=')[1]) <= 15) { return } // 获取更多评论地址 let commentURL = location.protocol + '//' + location.host + nextPageURL.replace('page=2', 'page=1') // 移除简短评论url 第一个是正文,第二个是评论 let commentDiv = document.querySelectorAll('.content')[1] commentDiv.innerHTML = "" let iframe = document.createElement('iframe') iframe.id = 'full-comment' iframe.src = commentURL iframe.width = '100%' iframe.setAttribute('frameborder', 'no') iframe.setAttribute('scrolling', 'no') iframe.setAttribute('border', '0') iframe.style = ` transition: height 0.3s linear; ` commentDiv.appendChild(iframe) setInterval(() => { try { let iframeDocument = document.getElementById('full-comment').contentWindow.document let body = iframeDocument.querySelector('body') if (!body.children.length) { document.getElementById('full-comment').contentWindow.history.back() } while (true) { if (body.firstElementChild.className.search('content') == -1) { body.removeChild(body.firstElementChild) } else if (body.lastElementChild.className.search('showpage') == -1) { body.removeChild(body.lastElementChild) } else { iframe.height = iframeDocument.body.scrollHeight iframeDocument.querySelector('.showpage').style['background-color'] = 'white' break } } } catch (error) { console.log(error) } }, 600) })();