您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
知乎标题自由隐藏与显示
// ==UserScript== // @name 知乎小工具 // @namespace greasyfork.org // @version 0.1 // @description 知乎标题自由隐藏与显示 // @author codrwu // @include https://www.zhihu.com/question/* // @icon https://static.zhihu.com/static/favicon.ico // @grant none // ==/UserScript== (function() { 'use strict'; document.getElementsByClassName("QuestionHeader-title")[0].setAttribute("hidden","true"); var button = document.createElement("input"); button.setAttribute("type", "button"); button.setAttribute("value", "显示标题"); button.setAttribute("class", "Button FollowButton Button--primary Button--blue"); button.addEventListener('click', function() { if(document.getElementsByClassName("QuestionHeader-title")[0].getAttribute("hidden")){ document.getElementsByClassName("QuestionHeader-title")[0].removeAttribute("hidden"); button.setAttribute("value", "隐藏标题"); }else{ document.getElementsByClassName("QuestionHeader-title")[0].setAttribute("hidden","true"); button.setAttribute("value", "显示标题"); } }); var x = document.getElementsByClassName("QuestionHeader-content"); x[0].appendChild(button); })();