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.

2019-11-23 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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

} );