GitHub 去除中文搜索污染

隐藏GitHub某些项目,政见不同不是污染中文搜索的理由,关键词拉满就是无耻

  1. // ==UserScript==
  2. // @name GitHub 去除中文搜索污染
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 隐藏GitHub某些项目,政见不同不是污染中文搜索的理由,关键词拉满就是无耻
  6. // @license GPL-3.0 License
  7. // @author fdrag0n
  8. // @match https://github.com/search?*
  9. // ==/UserScript==
  10. //TODO 增加云端下发功能
  11. const blackListedUsers = [
  12. "haoxuesen", "zhaohmng", "zaohmeing", "haoxuesen", "zhaohmng-outlook-com", "Thestrangercamus", "shengxinjing",
  13. "cirosantilli", "Dimples1337", "codin-stuffs", "cheezcharmer", "zaohmeing", "zhaohmng-outlook-com",
  14. "codin-stuffs", "gege-circle",
  15. ];
  16. const blackListedProjectNames = ["china-dictatorship", "chinese-dictatorship","PCL2",
  17. ];
  18. const blackListedProjectNameKeyWords = "dictatorship"
  19. window.onload = function () {
  20. // 在页面完全加载之后执行的代码
  21. Check();
  22. };
  23. const observer = new MutationObserver(function (mutationsList, observer) {
  24. // 在 DOM 变化后执行的代码
  25. Check();
  26. });
  27. // 配置 MutationObserver 监听的选项
  28. const config = {
  29. childList: true,
  30. subtree: true
  31. };
  32. // 开始监听 DOM 变化
  33. observer.observe(document.body, config);
  34.  
  35.  
  36. function Check() {
  37. var titleList = document.querySelectorAll(".fIqerb") //搜索所有标题
  38. //console.log(titleList)
  39. for (var i = 0; i < titleList.length; i++) {
  40. var oneTitle = titleList[i]
  41. if (oneTitle.getAttribute("href").indexOf("/") == 0) {
  42.  
  43.  
  44. var userWithProject = oneTitle.querySelector(".search-match").innerText
  45. var user = userWithProject.split("/")[0]
  46. var project = userWithProject.split("/")[1]
  47.  
  48. if (blackListedUsers.includes(user) || blackListedProjectNames.includes(project) || project.indexOf(
  49. blackListedProjectNameKeyWords) != -1) {
  50. var card = oneTitle.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
  51. card.parentNode.removeChild(card)
  52. console.log("已经移除" + userWithProject)
  53. Check()
  54. }
  55. }
  56. }
  57. }

QingJ © 2025

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