Github - Hide bots and github-actions from dashboards

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

Verze ze dne 19. 05. 2022. Zobrazit nejnovější verzi.

  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.4
  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. div.style.cursor = ''
  38. if (div.querySelector('.newexpanderbutton')) {
  39. div.querySelector('.newexpanderbutton').remove()
  40. }
  41. }
  42.  
  43. function hideBots () {
  44. const expandButton = document.querySelector('button.js-details-target:not(.Header-link)[aria-expanded="false"]')
  45. document.querySelectorAll('#dashboard div.push:not(.shotBot)').forEach(function (div) {
  46. const label = div.querySelector('.body .d-flex .d-flex .Label')
  47. const isAppUrl = div.querySelector('.body .d-flex .d-flex a.Link--primary[href^="/apps/"]')
  48. if (isAppUrl || (label && label.textContent === 'bot')) {
  49. div.style.fontSize = '10px'
  50. if (div.querySelector('.border-bottom')) {
  51. div.querySelector('.border-bottom').classList.replace('border-bottom', 'no-border-bottom')
  52. }
  53. div.querySelector('.Box').style.display = 'none'
  54. div.querySelector('.body').style.height = '22px'
  55. div.querySelector('.body .d-flex').style.padding = '0px'
  56. div.querySelector('img.avatar').height = '20'
  57. div.querySelector('img.avatar').width = '20'
  58. div.style.cursor = 'row-resize'
  59. div.addEventListener('click', unhideBot)
  60. const line = div.querySelector('.Details .flex-column .flex-justify-between.flex-items-baseline')
  61. if (line && expandButton && !line.querySelector('button.js-details-target')) {
  62. const newExpandButton = document.createElement('button')
  63. line.appendChild(newExpandButton)
  64. newExpandButton.outerHTML = expandButton.outerHTML.replace('js-details-target', 'js-details-target newexpanderbutton')
  65. }
  66. }
  67. })
  68. }
  69.  
  70. hideBots()
  71. const iv = window.setInterval(hideBots, 200)
  72. window.setTimeout(() => window.clearInterval(iv), 5000)
  73. window.setInterval(hideBots, 4000)
  74. })()