PR page improvements

many things for teads github PRs

Verze ze dne 20. 11. 2024. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         PR page improvements
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  many things for teads github PRs
// @author       Me
// @match        https://github.com/ebuzzing/*/pull/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // --------
    // -------- PR jobs no scroll, infinite height
    // --------
    // Add style to the document
    const style = document.createElement('style');
    style.textContent = '.branch-action-item.open>.merge-status-list.hide-closed-list { max-height: 1000vh !important; }';
    document.head.appendChild(style);

    // Create a MutationObserver to monitor the DOM for changes
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            if (mutation.addedNodes.length > 0) {
                // Check if any of the added nodes contain the elements we are interested in

                // --------
                // -------- PR jobs links target blank
                // --------
                document.querySelectorAll('a.status-actions').forEach(e => {
                    e.setAttribute('target', '_blank');
                });

                // --------
                // -------- All sonarcloud links target blank
                // --------
                [...document.querySelectorAll('a')].filter(e => e.innerText === "sonarcloud").forEach(s => {[...s.parentElement.parentElement.parentElement.parentElement.parentElement.querySelectorAll('a')].forEach(link => link.setAttribute('target', '_blank'))})

            }
        });
    });

    // Configure the observer to watch for additions to the child list of the target node
    const config = { childList: true, subtree: true };

    // Start observing the document body for changes
    observer.observe(document.body, config);

    // --------
    // -------- Add hide whitespace by default
    // --------
    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)");
    goToFilesElement.setAttribute('href', goToFilesElement.getAttribute('href') + '?w=1')
})();