Github - Hide bots and github-actions from dashboards

Minimizes pushs and commits from github actions and bots from github.com dashboard

目前为 2020-10-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Github - Hide bots and github-actions from dashboards
  3. // @description Minimizes pushs and commits from github actions and bots from github.com dashboard
  4. // @namespace cuzi
  5. // @author cuzi
  6. // @version 1.1
  7. // @description Hide bot's and github-actions' push from dashboard news
  8. // @copyright 2020, cuzi (https://openuserjs.org/users/cuzi)
  9. // @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
  10. // @icon https://github.githubassets.com/pinned-octocat.svg
  11. // @match https://github.com/
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict'
  17.  
  18. function unhideBot (ev) {
  19. const div = this
  20. div.classList.add('shotBot')
  21. div.removeEventListener('click', unhideBot)
  22. div.style.fontSize = ''
  23. if (div.querySelector('.no-border-bottom')) {
  24. div.querySelector('.no-border-bottom').classList.replace('no-border-bottom', 'border-bottom')
  25. }
  26. div.querySelector('.Box').style.display = ''
  27. div.querySelector('.body').style.height = ''
  28. div.querySelector('.body .d-flex').style.padding = ''
  29. div.querySelector('img.avatar').height = '32'
  30. div.querySelector('img.avatar').width = '32'
  31. }
  32.  
  33. function hideBots () {
  34. document.querySelectorAll('#dashboard div.push:not(.shotBot)').forEach(function (div) {
  35. const label = div.querySelector('.body .d-flex .d-flex .Label')
  36. const a = div.querySelector('.body .d-flex .d-flex a')
  37. if ((label && label.textContent === 'bot') || (a && a.textContent === 'github-actions')) {
  38. div.style.fontSize = '10px'
  39. if (div.querySelector('.border-bottom')) {
  40. div.querySelector('.border-bottom').classList.replace('border-bottom', 'no-border-bottom')
  41. }
  42. div.querySelector('.Box').style.display = 'none'
  43. div.querySelector('.body').style.height = '22px'
  44. div.querySelector('.body .d-flex').style.padding = '0px'
  45. div.querySelector('img.avatar').height = '20'
  46. div.querySelector('img.avatar').width = '20'
  47. div.addEventListener('click', unhideBot)
  48. }
  49. })
  50. }
  51.  
  52. hideBots()
  53. const iv = window.setInterval(hideBots, 200)
  54. window.setTimeout(() => window.clearInterval(iv), 5000)
  55. window.setInterval(hideBots, 4000)
  56. })()