Zhihu Anonymous Answer Filter

Show anonymous answer in zhihu.com only !

目前為 2020-05-11 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Zhihu Anonymous Answer Filter
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Show anonymous answer in zhihu.com only !
  6. // @author Zhao Yuting
  7. // @match https://www.zhihu.com/question/*
  8. // @require https://code.jquery.com/jquery-3.5.1.min.js
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13.  
  14. // 功能
  15. // 按键句号筛选匿名用户的答案
  16. // (按时间排序情况下)按键左 上一页; 按键右 下一页;
  17. (function() {
  18. 'use strict';
  19. let doAnonymousAnswer = function() {
  20. $('div.List-item').each(function(i){
  21. if( $('meta[itemprop="name"][content="匿名用户"]', this).length > 0 ) {
  22. $(this).show();
  23. }else{
  24. $(this).hide();
  25. }
  26. });
  27. };
  28. let doNextPage = function(){
  29. $('button').filter(function(i){
  30. return $(this).text() == '下一页';
  31. }).each(function(i){
  32. $(this).click();
  33. });
  34. };
  35. let doPrevPage = function(){
  36. $('button').filter(function(i){
  37. return $(this).text() == '上一页';
  38. }).each(function(i){
  39. $(this).click();
  40. });
  41. };
  42. $(document).keydown(function(event){
  43. console.log(event.keyCode);
  44. if(event.keyCode == 190){ // key .
  45. doAnonymousAnswer();
  46. } else if(event.keyCode == 39){ // key -->
  47. doNextPage();
  48. }else if(event.keyCode == 37){ // key <--
  49. doPrevPage();
  50. }
  51. });
  52. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址