Github - Hide bots and github-actions from dashboards

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

As of 2022-05-18. See the latest version.

  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.3
  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. document.head.appendChild(document.createElement('style')).innerHTML = `
  19. .Details:hover .newexpanderbutton .Link--secondary {
  20. color: var(--color-accent-fg) !important;
  21. }
  22. `
  23.  
  24. function unhideBot (ev) {
  25. const div = this
  26. div.classList.add('shotBot')
  27. div.removeEventListener('click', unhideBot)
  28. div.style.fontSize = ''
  29. if (div.querySelector('.no-border-bottom')) {
  30. div.querySelector('.no-border-bottom').classList.replace('no-border-bottom', 'border-bottom')
  31. }
  32. div.querySelector('.Box').style.display = ''
  33. div.querySelector('.body').style.height = ''
  34. div.querySelector('.body .d-flex').style.padding = ''
  35. div.querySelector('img.avatar').height = '32'
  36. div.querySelector('img.avatar').width = '32'
  37. if (div.querySelector('.newexpanderbutton')) {
  38. div.querySelector('.newexpanderbutton').remove()
  39. }
  40. }
  41.  
  42. function hideBots () {
  43. const expandButton = document.querySelector('button.js-details-target:not(.Header-link)[aria-expanded="false"]')
  44. document.querySelectorAll('#dashboard div.push:not(.shotBot)').forEach(function (div) {
  45. const label = div.querySelector('.body .d-flex .d-flex .Label')
  46. const isAppUrl = div.querySelector('.body .d-flex .d-flex a.Link--primary[href^="/apps/"]')
  47. if (isAppUrl || (label && label.textContent === 'bot')) {
  48. div.style.fontSize = '10px'
  49. if (div.querySelector('.border-bottom')) {
  50. div.querySelector('.border-bottom').classList.replace('border-bottom', 'no-border-bottom')
  51. }
  52. div.querySelector('.Box').style.display = 'none'
  53. div.querySelector('.body').style.height = '22px'
  54. div.querySelector('.body .d-flex').style.padding = '0px'
  55. div.querySelector('img.avatar').height = '20'
  56. div.querySelector('img.avatar').width = '20'
  57. div.addEventListener('click', unhideBot)
  58. const line = div.querySelector('.Details .flex-column .flex-justify-between.flex-items-baseline')
  59. if (line && expandButton && !line.querySelector('button.js-details-target')) {
  60. const newExpandButton = document.createElement('button')
  61. line.appendChild(newExpandButton)
  62. newExpandButton.outerHTML = expandButton.outerHTML.replace('js-details-target', 'js-details-target newexpanderbutton')
  63. }
  64. }
  65. })
  66. }
  67.  
  68. hideBots()
  69. const iv = window.setInterval(hideBots, 200)
  70. window.setTimeout(() => window.clearInterval(iv), 5000)
  71. window.setInterval(hideBots, 4000)
  72. })()