H-Flash Downloader

Create swf download link on the info bar

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         H-Flash Downloader
// @name:zh-CN   H-Flash 下载器
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description:en  Create download link for flash games on h-flash.com
// @description:zh-cn  添加h-flash.com中游戏的下载链接
// @author       sini
// @match        https://h-flash.com/*
// @icon         
// @grant        GM.xmlHttpRequest
// @license      GPLv3
// @description Create swf download link on the info bar
// ==/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);
})();