Github: reduce title opacity of PRs with a specific label

23/01/2025, 12:23:20

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Github: reduce title opacity of PRs with a specific label
// @namespace   Violentmonkey Scripts
// @match       https://github.com/navikt/aksel/pulls*
// @grant       none
// @version     1.2
// @author      popular-software
// @description 23/01/2025, 12:23:20
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2
// @run-at document-end
// @license MIT
// ==/UserScript==

const LABEL_TO_DIM = "On hold :pause_button:";
const ONLY_DIM_TITLE = false;

const disconnect = VM.observe(document.body, () => {
  const nodes = document.body.querySelectorAll(`div.flex-auto:has(.Link--primary):has(a[data-name="${LABEL_TO_DIM}"])`);

  for (let node of nodes) {
    if (ONLY_DIM_TITLE) {
      const title = node.querySelector('a');
      title.style = "opacity: 0.2;";
    }
    else {
      node.style = "opacity: 0.2; font-size: 10px;";
    }
  }

});

// You can also disconnect the observer explicitly when it's not used any more
// disconnect();