Adobe Products Direct Download

Change Adobe products download link to direct url

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           Adobe Products Direct Download
// @namespace      http://qixinglu.com
// @description    Change Adobe products download link to direct url
// @include        http://www.adobe.com/cfusion/tdrc/index.cfm?product=*
// @include        https://www.adobe.com/cfusion/tdrc/index.cfm?product=*
// @include        http://get.adobe.com/flashplayer/
// @include        http://get.adobe.com/flashplayer/otherversions/
// @include        http://get.adobe.com/*/flashplayer/
// @include        http://get.adobe.com/*/flashplayer/otherversions/
// @include        http://get.adobe.com/reader/
// @include        http://get.adobe.com/reader/otherversions/
// @include        http://get.adobe.com/*/reader/
// @include        http://get.adobe.com/*/reader/otherversions/
// @version 0.0.1.20140517140357
// ==/UserScript==

var sites = [
    {
        url: 'cfusion/tdrc/index.cfm?product=',
        handler: function() {
            var versions_node = document.getElementById('product1')
            var get_url = function() {
                return versions_node.value.match(new RegExp('http://.*$'))[0];
            }
            var download_button = document.getElementById('download-button');
            var download_link = document.createElement('a');
            download_link.id = 'download-link';
            download_link.className = 'download-button';
            download_link.href = get_url();
            download_link.text = download_button.textContent;
            download_button.parentNode.replaceChild(download_link, download_button);
            versions_node.onchange = function() { 
                download_link.href = get_url();
            }
        },
    },
    {
        url: '/otherversions/',
        handler: function() {
            var versions_node = document.getElementById('installer')
            var get_url = function() {
                if (versions_node.value === '0') {
                    return 'javascript:void(0)';
                }
                return '../completion/?installer=' + versions_node.value;
            }
            var download_button = document.getElementById('buttonDownload');
            var download_link = document.createElement('a');
            download_link.id = 'download-link';
            download_link.href = get_url();
            download_link.className = 'download-button';
            download_link.text = download_button.textContent;
            download_button.style.display = 'none';
            download_button.parentNode.appendChild(download_link);
            versions_node.onchange = function() { 
                download_link.href = get_url();
                var addon_node = document.getElementsByClassName('addon')[0];
                addon_node.parentNode.removeChild(addon_node);
            }
        }
    },
    {
        url: 'get.adobe.com/',
        handler: function() {
            var installer_node = document.getElementById('installer');
            var download_link = document.getElementById('buttonDownload');
            download_link.href = 'completion/?installer=' + installer_node.value;
            var addon_node = document.getElementsByClassName('addon')[0];
            addon_node.parentNode.removeChild(addon_node);
        }
    }
];

var url = document.URL;
var i, site;
for (i = 0; i < sites.length; i += 1) {
    site = sites[i];
    if (url.indexOf(site.url) != -1) {
        site.handler();
        break;
    }
}