还是电驴的下载选中文件

runeveryday 发布于 2011/06/22 20:29
阅读 364
收藏 0

电驴的下载选中文件代码:

function download(str, i, first) {
    var a = document.getElementsByName(str);
    var n = a.length;
    var isautoDownSub = $('autoDownload');
    var isShowPopPage = false;
    var isContinueDown = false;
    var isGetEd2k = false;
    //判断用户浏览器语言
    if(navigator.userAgent.indexOf("MSIE") > 0) {
            var language = navigator.userLanguage;
    } else {
            var language = navigator.language;
    }
        try{
            var e = e ? e : window.event;
        if (window.event) {
            e.cancelBubble=true;
        } else {
            e.stopPropagation();
        }
        }catch(e){}
   if (VeryCD.emule.installed()) {
                var ed2k_links = '';
                for (var i = i; i < n; i++) {
                        if(a[i].checked) {
                                if (ed2k_links=='') {
                                        ed2k_links = a[i].value;
                                } else {
                                        ed2k_links += "\n"+a[i].value;
                                }
                                if(isautoDownSub && isautoDownSub.checked) {
                                        isGetEd2k = true;
                                        var link = getLanguage(str,i,isContinueDown, isGetEd2k);
                                        if(link) {
                                                if (ed2k_links=='') {
                                                        ed2k_links = link;
                                                } else {
                                                        ed2k_links += "\n"+link;
                                                }
                                        }

                                }
                        }
                }
                VeryCD.emule.SendUrl(ed2k_links, 'dd', document.location);
                return;
   } else {
       if(navigator.userAgent.indexOf("MSIE") > 0) {
           isShowPopPage = true;
       }

   }

        if (!window.continueDown) {
                isContinueDown = true;
                //使用最旧的方法来批量新增下载
                for (var i = i; i < n; i++) {
                        if(a[i].checked) {
                                noWinToDown(a[i].value);

                                if(isautoDownSub && isautoDownSub.checked) {
                                        window.setTimeout("getLanguage('"+str+"', "+i+", "+isContinueDown+","+isGetEd2k+")",50);
                                }
                                if (first)
                                        timeout = 4000;

                                i++;
                                window.setTimeout("do_download('"+str+"', "+i+", "+isContinueDown+","+isGetEd2k+")", timeout);
                                break;
                        }
                }
        } else {
       if ('never' != getCookie('downPopup') && isShowPopPage == true) {
           check_link=''; //清空
           for (var i = i; i < n; i++) {
                        if(a[i].checked) {
                            if(check_link=='') {
                                check_link = a[i].value;
                            }else{
                                check_link += "," + a[i].value;
                            }
                                if(isautoDownSub && isautoDownSub.checked) {
                                        isGetEd2k = true;
                                        var link = getLanguage(str, i, isContinueDown, isGetEd2k);
                                        if(link) {
                                                if (check_link=='') {
                                                        check_link = link;
                                                } else {
                                                        check_link += ","+link;
                                                }
                                        }
                                }
                                var k = i;
                                var current_link = a[k].nextSibling;
                                var multi_text = '';
                                var tmp_counter = 0;
                                var comma = '';
                                var right_link ='';
                                while(true){
                                        if(a[k].checked && current_link){//如果是有效节点并且被选中
                                                if(current_link.href){
                                                        if(current_link.href.indexOf('ed2k') !== 0){
                                                                current_link = current_link.nextSibling; //获取ed2k的值
                                                                continue;
                                                        }
                                                        if(tmp_counter > 7){//收集超过若干个有效链接后,退出
                                                                multi_text += '<br />…………';
                                                                break;
                                                        }
                                                        var right_link = current_link;
                                                        tmp_counter++;
                                                        if (navigator.userAgent.toLowerCase().indexOf("msie")==-1) { //ie
                                                                multi_text += comma+current_link.text;
                                                        }else{
                                                                multi_text += comma+current_link.innerText;
                                                        }
                                                        comma = '<br />';
                                                }

                                                current_link = current_link.nextSibling;
                                        }else{//未被选中,或往下没有相邻节点了,那么切换到下个父节点
                                                if(++k >= n){//如果父节点也到底了,那么退出
                                                        break;
                                                }
                                                current_link = a[k].nextSibling;
                                        }
                                }

                                   downPopup(event);

                         }
                  }//
       } else {
           for (var i = i; i < n; i++) {
                if(a[i].checked) {
                                        continueDown(a[i].value);
                                        if(isautoDownSub && isautoDownSub.checked) {
                                                window.setTimeout("getLanguage('"+str+"', "+i+", "+isContinueDown+", "+isGetEd2k+")",50);
                                        }
                        if (first)
                                timeout = 4000;
                        i++;
                        window.setTimeout("do_download('"+str+"', "+i+", "+isContinueDown+", "+isGetEd2k+")", timeout);
                        break;
               }
            }
       }
        }
   }
我想用在自己的站上,但是不知道怎么使用,大家指点下。谢谢。用在自己的站上, VeryCD.emule.installed()这个也不知道修改成什么好。

加载中
返回顶部
顶部