GitHub Releases - Show all assets

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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 });