Easy offline | 一键离线下载

在种子或其他下载链接旁添加按钮,点击自动离线下载至网盘 | Easy stream torrents or videos from cloud storage

Pada tanggal 25 September 2016. Lihat %(latest_version_link).

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Easy offline | 一键离线下载
// @namespace    http://tampermonkey.net/
// @version      1.0.4
// @description  在种子或其他下载链接旁添加按钮,点击自动离线下载至网盘 | Easy stream torrents or videos from cloud storage
// @author       Hoothin
// @mail         [email protected]
// @include      http*://pan.baidu.com/*
// @include      http://115.com/*
// @include      https://www.furk.net/*
// @include      https://www.seedr.cc/*
// @match        http*://*/*
// @grant        GM_setValue
// @grant        GM_getValue
// @require      http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js
// ==/UserScript==

var enableUrl = 'a[href^="magnet"],[href^="ed2k://|file"],[href$=".torrent"],[href$=".mp4"],[href$=".rar"],[href$=".7z"],[href$=".zip"],[href$=".rmvb"],[href$=".mkv"],[href$=".avi"],[href$=".iso"]';
var disableUrl=[".torrentkitty.","bt.box.n0808.com"];
function include(Things,obj) {
	for (var i = Things.length - 1; i >= 0; i--) {
		if ($(Things[i]).attr('href')===$(obj).attr('href')){
			return true;
		}
	}
}

function setCss(){
    $('head').append('<style>a.whx-a{ background-repeat: no-repeat;background-position: center; display: inline-block;margin-left:5px;height: 20px;width: 20px;background-size: 20px;border-radius: 50%;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAARVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc6ur3AAAAFnRSTlMAYM5vMOA/ENGegK2olI6G1b97Z0sXENA+jAAAAKFJREFUKM+FklkSxCAIRHFfss3K/Y86iQSDVqzpH7FfgQpCVfAmGx+gl9JI0qrxrcNLzooEbKUG4EKWdkCiDRV0N0RTrZ5wvdgTTgp4SzCAHxAPZkAM5GOJWuuT7FE5OVPOBFLTYb3Oc2YB5uJ8+G6pgkTGt74ntcCJHiwFLHw10Tdc93jlGXGvSRtsHNpuPs+/o1ODfxAtSL0f7HPC+L/9AF60G3QxO1UaAAAAAElFTkSuQmCC");vertical-align: middle;}</style>');
}

function getAllEnableUrl() {
    var rawnodes = $(enableUrl).get();
    var nodes = [];
    if(rawnodes.length>0){
        for (var i = 0; i <rawnodes.length; i++) {
            var disable = false;
            var curNode = rawnodes[i];
            for(var j = 0; j < disableUrl.length; j++){
                var temp = disableUrl[j];
                if($(curNode)[0]["href"].indexOf(temp)!=-1){
                    disable = true;
                    break;
                }
            }
            if(disable)continue;
            if(!include(nodes,curNode)){
                nodes.push(curNode);
            }
        }
    }
    if(nodes.length>0){
        var codeList = [];
        var listLen = 0;
        listLen = nodes.length;
        setCss();
        if (listLen !== 0) {
            for (i = 0; i < listLen; i++) {
                var curNode = nodes[i];
                var url = $(curNode)[0]["href"];
                $(curNode).after($(curNode).clone().addClass('whx-a').css("background-color","#5e5eff").css("outline","none").empty().attr("target","_blank").attr("url",url).attr("title","115" ).attr("href", "http://115.com/?tab=offline&mode=wangpan").click(function (event) {GM_setValue("url",$(event.target).attr("url"));}));
                $(curNode).after($(curNode).clone().addClass('whx-a').css("background-color","#3BEBFF").css("outline","none").empty().attr("target","_blank").attr("url",url).attr("title","Furk" ).attr("href", "https://www.furk.net/users/files/add").click(function (event) {GM_setValue("url",$(event.target).attr("url"));}));
                $(curNode).after($(curNode).clone().addClass('whx-a').css("background-color","#F44336").css("outline","none").empty().attr("target","_blank").attr("url",url).attr("title","Seedr" ).attr("href", "https://www.seedr.cc/files").click(function (event) {GM_setValue("url",$(event.target).attr("url"));}));
                $(curNode).after($(curNode).clone().addClass('whx-a').css("background-color","#fefefe").css("outline","none").empty().attr("target","_blank").attr("url",url).attr("title","BaiduPan" ).attr("href", "http://pan.baidu.com/disk/home").click(function (event) {GM_setValue("url",$(event.target).attr("url"));}));
            }
        }
        $('.whx-a').css('b','d');
    }
}

var i=0;
var t=window.setInterval(function() {
    var curlink;
    if (location.href.indexOf("furk.net/users/files/add") != -1){
        window.clearInterval(t);
        curlink = GM_getValue('url');
        if(curlink){
            setTimeout(function() {
                $('#url').val(curlink);
                GM_setValue('url', '');
                $(":submit[value='Add download']").click();
            }, 500);
        }
    }else if(location.href.indexOf("seedr.cc/files") != -1){
        if($('#upload-button').css("display") != "none"){
            window.clearInterval(t);
            curlink = GM_getValue('url');
            if(curlink){
                setTimeout(function() {
                    $(':text[name="torrent"]').val(curlink);
                    GM_setValue('url', '');
                    $('#upload-button').click();
                }, 500);
            }
        }
    }else if(location.href.indexOf("pan.baidu.com/disk/home") != -1){
        window.clearInterval(t);
        curlink = GM_getValue('url');
        if(curlink){
            document.querySelector('.g-button[data-button-id=b13]').click();
            var bsi = setInterval(function() {
                var newTaskBtn = document.querySelector('#_disk_id_2');
                if(newTaskBtn){
                    clearInterval(bsi);
                    newTaskBtn.click();
                    setTimeout(function() {
                        document.querySelector('#share-offline-link').value = curlink;
                        document.querySelector('.g-button[data-button-id=b63]').click();
                    }, 500);
                }
            }, 500);
            GM_setValue('url', '');
        }
    }else if(location.href.indexOf("115.com/?tab=offline&mode=wangpan") != -1){
        window.clearInterval(t);
        curlink = GM_getValue('url');
        if(curlink){
            var rsc = setInterval(function() {
                if (document.readyState == 'complete') {
                    clearInterval(rsc);
                    setTimeout(function() {
                        Core['OFFL5Plug'].OpenLink();
                        setTimeout(function() {
                            $('#js_offline_new_add').val(curlink);
                        }, 300);
                    }, 1000);
                }
            }, 400);
            GM_setValue('url', '');
        }
    }else if((i===0 && $(enableUrl).length>0)||i>20){
        window.clearInterval(t);
        getAllEnableUrl();
    }else{
        i++;
    }
}, 500);