您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
添加一个折叠按钮,把阮一峰博客的评论折叠起来
// ==UserScript== // @name 阮一峰博客的评论折叠 // @namespace xxx // @version 0.1 // @description 添加一个折叠按钮,把阮一峰博客的评论折叠起来 // @author xxx // @match *://www.ruanyifeng.com/blog/* // @icon https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org // @grant none // @require http://code.jquery.com/jquery-1.11.0.min.js // @license MIT // ==/UserScript== (function () { GM_addStyle(".hide { display: none !important; ") $("#comments").addClass("hide") $("#comments").before("<div style=\"margin:10px\"><button id=\"fold\">评论折叠展开</button></div>") $("#fold").on("click", fold) })(); function fold() { $("#comments").toggleClass("hide"); } function GM_addStyle(css) { const style = document.getElementById("GM_addStyleBy8626") || (function () { const style = document.createElement('style'); style.type = 'text/css'; style.id = "GM_addStyleBy8626"; document.head.appendChild(style); return style; })(); const sheet = style.sheet; sheet.insertRule(css, (sheet.rules || sheet.cssRules || []).length); }