Github: reduce title opacity of PRs with a specific label

23/01/2025, 12:23:20

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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();