Greasy Fork is available in English.

Github - Hide bots and github-actions from dashboards

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

As of 13.01.2023. See ბოლო ვერსია.

  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.7
  7. // @copyright 2020, cuzi (https://openuserjs.org/users/cuzi)
  8. // @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
  9. // @icon https://raw.githubusercontent.com/hfg-gmuend/openmoji/master/color/72x72/E045.png
  10. // @match https://github.com/
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict'
  16.  
  17. document.head.appendChild(document.createElement('style')).innerHTML = `
  18. .Details:hover .newexpanderbutton .Link--secondary {
  19. color: var(--color-accent-fg) !important;
  20. }
  21. `
  22.  
  23. function unhideBot (ev) {
  24. const div = this
  25. div.classList.add('shotBot')
  26. div.removeEventListener('click', unhideBot)
  27. div.style.fontSize = ''
  28. if (div.querySelector('.no-border-bottom')) {
  29. div.querySelector('.no-border-bottom').classList.replace('no-border-bottom', 'border-bottom')
  30. }
  31. div.querySelector('.Box').style.display = ''
  32. if (div.querySelector('.body')) {
  33. div.querySelector('.body').style.height = ''
  34. div.querySelector('.body .d-flex').style.padding = ''
  35. } else {
  36. div.querySelector('.d-flex').style.padding = ''
  37. }
  38. div.querySelector('img.avatar').height = '32'
  39. div.querySelector('img.avatar').width = '32'
  40. div.style.cursor = ''
  41. if (div.querySelector('.newexpanderbutton')) {
  42. div.querySelector('.newexpanderbutton').remove()
  43. }
  44. }
  45.  
  46. function hideDiv (div, summary) {
  47. const expandButton = document.querySelector('button.js-details-target:not(.Header-link)[aria-expanded="false"]')
  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. if (div.querySelector('.body')) {
  54. div.querySelector('.body').style.height = '22px'
  55. div.querySelector('.body .d-flex').style = 'padding: 0px !important;'
  56. } else {
  57. div.querySelector('.d-flex').style = 'padding: 0px !important;'
  58. }
  59. div.querySelector('img.avatar').height = '20'
  60. div.querySelector('img.avatar').width = '20'
  61. div.style.cursor = 'row-resize'
  62. div.addEventListener('click', unhideBot)
  63. const line = div.querySelector('.Details .flex-column .flex-justify-between.flex-items-baseline')
  64. if (line && expandButton && !line.querySelector('button.js-details-target')) {
  65. const newExpandButton = document.createElement('button')
  66. line.appendChild(newExpandButton)
  67. newExpandButton.outerHTML = expandButton.outerHTML.replace('js-details-target', 'js-details-target newexpanderbutton')
  68. }
  69. const aLinkPrimary = div.querySelector('.no-underline a.Link--primary')
  70. if (summary && aLinkPrimary && !div.querySelector('.summaryspan')) {
  71. const summarySpan = document.createElement('span')
  72. summarySpan.classList.add('summaryspan')
  73. summarySpan.appendChild(document.createTextNode(summary.replace(/\s+to\s*$/, '')))
  74. aLinkPrimary.parentNode.appendChild(summarySpan)
  75. }
  76. }
  77.  
  78. function hideBots () {
  79. // Hide single push events
  80. document.querySelectorAll('#dashboard div.push:not(.shotBot),#dashboard div[classes*=push]:not(.shotBot),#dashboard div.body:not(.shotBot)').forEach(function (div) {
  81. const label = div.querySelector('.body .d-flex .d-flex .Label')
  82. const isAppUrl = div.querySelector('.body .d-flex .d-flex a.Link--primary[href^="/apps/"]')
  83. if (isAppUrl || (label && label.textContent === 'bot')) {
  84. hideDiv(div)
  85. }
  86. })
  87. // Hide grouped items
  88. document.querySelectorAll('#dashboard div.body:not(.shotBot)').forEach(function (div) {
  89. const isAppUrl = div.querySelector('.js-news-feed-event-group .d-inline-block[href^="/apps"] .avatar')
  90. if (isAppUrl) {
  91. const summary = div.querySelector('.dashboard-rollup-item>span') ? div.querySelector('.dashboard-rollup-item>span').textContent : null
  92. hideDiv(div, summary)
  93. }
  94. })
  95. }
  96.  
  97. hideBots()
  98. const iv = window.setInterval(hideBots, 200)
  99. window.setTimeout(() => window.clearInterval(iv), 5000)
  100. window.setInterval(hideBots, 5000)
  101. })()