Add Download Button to TC4Shell.com 7-Zip Plugins Page

Some download links are manually processed AND they need my manual update to keep update with TC4Shell.com AND the last update is done at 2019-11-24.

Versione datata 23/11/2019. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Add Download Button to TC4Shell.com 7-Zip Plugins Page
// @description Some download links are manually processed AND they need my manual update to keep update with TC4Shell.com AND the last update is done at 2019-11-24.
// @namespace   RainSlide
// @author      RainSlide
// @match       http://www.tc4shell.com/en/7zip/
// @match       http://www.tc4shell.com/ru/7zip/
// @match       https://www.tc4shell.com/en/7zip/
// @match       https://www.tc4shell.com/ru/7zip/
// @note        HTTPS is not ready...
// @version     1.0
// @grant       none
// ==/UserScript==

document.head.appendChild( (css => {
	const style = document.createElement("style");
	style.textContent = css;
	return style;
})(`
#content h1 ~ div > h2 {
	display: flex;
	flex-flow: row nowrap;
	justify-content: space-between;
	align-items: center;
}

.button_7z_plugins_download {
	padding: .5em;
	box-sizing: content-box;
	height: 1em;
	line-height: 1;
	font-family: inherit;
	font-size: smaller;
	background: #e84c3d;
}
.button_7z_plugins_download:hover {
	background: #ff605f;
}
`.trim()) );

document.querySelectorAll('#content h1 ~ div > h2').forEach( h2 => {

	let filename = h2.textContent.split(" ")[0];
	// if ( [ "Asar7z", "Lzip7z" ].some( str => str === filename ) )
	// 	filename = filename.replace(/7z$/, "");
	if (filename === "Asar7z") filename = "Asar"; else
	if (filename === "Lzip7z") filename = "Lzip";

	const a = document.createElement("a");
	a.href = "/binary/" + filename + ".zip";
	a.setAttribute("download", "");
	a.className = "button button_7z_plugins_download";
	a.textContent = "Download";

	h2.appendChild(a);

} );