GitHub: involved issues

Make the Pulls and Issues links show your involved issues

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        GitHub: involved issues
// @namespace   https://akinori.org
// @description Make the Pulls and Issues links show your involved issues
// @license     2-clause BSDL
// @author      Akinori MUSHA
// @include     https://github.com/*
// @version     1.0.3
// @homepage    https://github.com/knu/userjs-github_involved_issues
// @homepage    https://greasyfork.org/scripts/25200-github-involved-issues
// @grant       none

// ==/UserScript==
"use strict";
(function () {
    const meta = document.querySelector("meta[name=user-login]")

    if (!meta)
        return

    const user = meta.content
    const encode = function (decoded) {
        return encodeURIComponent(decoded).replace(/%20/g, "+")
    }

    const links = document.querySelectorAll("header ul li a")
    for (let i = 0; i < links.length; i++) {
        const href = links[i].getAttribute("href")
        switch (href) {
        case "/pulls":
            links[i].setAttribute("href", href + "?q=" + encode("is:open is:pr involves:" + user + " sort:updated-desc"))
            break
        case "/issues":
            links[i].setAttribute("href", href + "?q=" + encode("is:open is:issue involves:" + user + " sort:updated-desc"))
            break
        }
    }
})();