Github - Hide bots and github-actions from dashboards

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

Instalar este script¿?
Script recomendado por el autor

Puede que también te guste Github Old Feed.

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