PR page improvements

many things for teads github PRs

当前为 2024-11-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PR page improvements
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description many things for teads github PRs
  6. // @author Me
  7. // @match https://github.com/ebuzzing/*/pull/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // --------
  16. // -------- PR jobs no scroll, infinite height
  17. // --------
  18. // Add style to the document
  19. const style = document.createElement('style');
  20. style.textContent = '.branch-action-item.open>.merge-status-list.hide-closed-list { max-height: 1000vh !important; }';
  21. document.head.appendChild(style);
  22.  
  23. // Create a MutationObserver to monitor the DOM for changes
  24. const observer = new MutationObserver(mutations => {
  25. mutations.forEach(mutation => {
  26. if (mutation.addedNodes.length > 0) {
  27. // Check if any of the added nodes contain the elements we are interested in
  28.  
  29. // --------
  30. // -------- PR jobs links target blank
  31. // --------
  32. document.querySelectorAll('a.status-actions').forEach(e => {
  33. e.setAttribute('target', '_blank');
  34. });
  35.  
  36. // --------
  37. // -------- All sonarcloud links target blank
  38. // --------
  39. [...document.querySelectorAll('a')].filter(e => e.innerText === "sonarcloud").forEach(s => {[...s.parentElement.parentElement.parentElement.parentElement.parentElement.querySelectorAll('a')].forEach(link => link.setAttribute('target', '_blank'))})
  40.  
  41. }
  42. });
  43. });
  44.  
  45. // Configure the observer to watch for additions to the child list of the target node
  46. const config = { childList: true, subtree: true };
  47.  
  48. // Start observing the document body for changes
  49. observer.observe(document.body, config);
  50.  
  51. // --------
  52. // -------- Add hide whitespace by default
  53. // --------
  54. const goToFilesElement = document.querySelector("#repo-content-pjax-container > div > div.clearfix.js-issues-results > div.px-3.px-md-0.ml-n3.mr-n3.mx-md-0.tabnav > nav > a:nth-child(4)");
  55. goToFilesElement.setAttribute('href', goToFilesElement.getAttribute('href') + '?w=1')
  56. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址