GitHub Releases - Show all assets

Clicks the first "Show all xxx assets" button for you on the Releases page.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        GitHub Releases - Show all assets
// @description Clicks the first "Show all xxx assets" button for you on the Releases page.
// @namespace   RainSlide
// @author      RainSlide
// @license     Unlicense
// @version     1.0
// @icon        https://github.githubassets.com/pinned-octocat.svg
// @match       https://github.com/*
// @grant       none
// @run-at      document-idle
// ==/UserScript==

"use strict";

const click = () => document.querySelector(".js-release-asset-untruncate-btn")?.click();

click();

/* When GitHub load a page with pjax,
it adds (then removes) a div.turbo-progress-bar under <html>, between <head> and <body>.
So we can just watch its removal for pjax page load complete. */
new MutationObserver(mutations => {
	for (const { removedNodes } of mutations) {
		if (removedNodes.length === 1 && removedNodes[0].className === "turbo-progress-bar") {
			click();
			break;
		}
	}
}).observe(document.documentElement, { childList: true });