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.

Verze ze dne 23. 11. 2019. Zobrazit nejnovější verzi.

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        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);

} );