VectorDirectDL

Vectorのページにダウンロードボタンを追加する

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        VectorDirectDL
// @description Vectorのページにダウンロードボタンを追加する
// @version     2.1
// @namespace   phodra
// @include     http://www.vector.co.jp/soft/*
// @include     https://www.vector.co.jp/soft/*
// @exsample    https://www.vector.co.jp/soft/dl/win95/util/se169348.html
// @exsample    https://www.vector.co.jp/soft/dl/winnt/util/se100730.html
// ==/UserScript==
(function (){
	// リンクを追加する関数
	var AppendLink = function(page)
	{
		var $page = $(page);

		// 挿入箇所
		$inspos = $("h1");

		// ダウンロードボタンと名前を取得
		$btns = $page.find("a.btn.download");
		$names = $page.find("td>strong.fn");

		if ($names.size() == $btns.size())
		{
			for (i=0; i<$btns.size(); i++)
			{
				// ダウンローページヘのダイレクトリンクを作成
				var $link = $("<a class='downloadlink'/>");
				$link.text($names.eq(i).text());
				$link.attr('href', $btns.eq(i).attr('href'));

				// ソフト名の下に挿入
				$inspos.after($link);
				$inspos.after(" ");
			}
		}
	};

	// ダウンロードタブのエレメント
	var $dltab = $("#v_step>.download");
	if ($dltab.size() > 0)
	{
		// ダウンロードタブページを取得
		$.ajax({
			type: 'GET',
			url: $dltab.attr('href'),
			beforeSend: function(xhr){
				xhr.overrideMimeType("text/html; charset=Shift_JIS");
			},
			success: function(data){
				AppendLink(data);
			}
		});
	}
	else
	{
		// すでにダウンロードタブページの場合
		AppendLink(document);
	}
})();