H-Flash Downloader

Create swf download link on the info bar

目前為 2022-04-06 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         H-Flash Downloader
// @name:zh-cn
// @name:en
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Create swf download link on the info bar
// @author       sini
// @match        https://h-flash.com/*
// @icon         
// @grant        GM.xmlHttpRequest
// @license      GPLv3
// ==/UserScript==

function create_dl(downpath,downname){
    var dl=document.createElement('A');
    var dlText=document.createTextNode("⬇️Download");
    dl.href=downpath;
    dl.download=downname;
    dl.appendChild(dlText);
    dl.className="Download Link"
    dl.onmouseout=function(ev){
        ev.target.style.color="#000000";
    }
    dl.onmouseover=function(ev){
        ev.target.style.color="#FF00FF";
    }
    return dl;
}
function add_dl(downpath,downname,parentE){
    var dl=create_dl(downpath,downname);
    var span0=parentE.getElementsByTagName("span")[0];
    parentE.insertBefore(dl,span0);
}
function add_dl_by_url(urlt,parentE){
    GM.xmlHttpRequest({
        method: "GET",
        url: urlt,
        onload: function(response) {
            var t=response.responseText;
            var sBegin=t.search("var downpath");
            var sEnd=t.search("var downallow")
            t=t.substring(sBegin,sEnd);
            eval(t);
            add_dl(downpath,downname,parentE);
        }
    });
}
var last=0;
function add_lite_dl(){
    var e=document.getElementsByClassName("gamebox");
    var e_dl=e[0].getElementsByClassName("Download Link");
    if(e_dl.length==0){
        last=0;
    }
    while(last<e.length){
        add_dl_by_url(e[last].href,e[last]);
        last++;
    }
}

(function() {
    'use strict';

    // Your code here...
    if(typeof(downpath)!='undefined'){
        var e=document.getElementsByClassName("rankinfo");
        add_dl(downpath,downname,e[0]);
    }
    setInterval(add_lite_dl,1000);
})();