// ==UserScript== // @name 知乎显示匿名按钮和查看问题日志按钮 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 显示匿名按钮和查看问题日志按钮 // @author AN drew // @match https://www.zhihu.com/question/* // @require https://code.jquery.com/jquery-3.1.1.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; var $child4 = $("#root > div > main > div > div:nth-child(10) > div:nth-child(2) > div > div.QuestionHeader-footer > div > div > div.QuestionHeaderActions > div:nth-child(4)"); if($child4.find("button").length > 0 && $child4.find("button").attr("aria-label").indexOf("更多") > -1) $child4.attr("style","display:none") var $child5 = $('#root > div > main > div > div:nth-child(10) > div:nth-child(2) > div > div.QuestionHeader-footer > div > div > div.QuestionHeaderActions > div:nth-child(5)'); if($child5.find("button").length > 0 && $child5.find("button").attr("aria-label").indexOf("更多") > -1) $child5.attr("style","display:none") var a =''; var $anonymous = $(a) $anonymous.bind("click",function(){ $("#root > div > main > div > div:nth-child(10) > div:nth-child(2) > div > div.QuestionHeader-footer > div > div > div.QuestionHeaderActions > div:nth-child(5)>button").click(); $(".Menu.QuestionHeader-menu > button").click(); }) var url = window.location.href; var end,href; if(url.indexOf("answer")>-1) { end=url.indexOf("answer") href = url.substring(0,end); } else { href=url+"/" } var L='  查看问题日志' var $log = $(L); var $Popover = $('
') $Popover.append($log) var $QuestionHeaderActions = $("#root > div > main > div > div:nth-child(10) > div:nth-child(2) > div > div.QuestionHeader-footer > div > div > div.QuestionHeaderActions") $QuestionHeaderActions.append($anonymous) $QuestionHeaderActions.append($Popover) setInterval(function(){ $(".Pc-card.Card").attr("style","display:none") }, 1000); // Your code here... })();