GitHub: involved issues

Make the Pulls and Issues links show your involved issues

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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