Greasy Fork

来自缓存

Greasy Fork is available in English.

百度网盘批量离线

批量离线辅助脚本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         百度网盘批量离线
// @namespace    http://greasyfork.icu/users/63665
// @homepage     http://greasyfork.icu/zh-CN/scripts/23426
// @version      2.5
// @description  批量离线辅助脚本
// @author       fenghengzhi
// @match        http://pan.baidu.com/disk/home*
// @match        http://yun.baidu.com/disk/home*
// @match        https://pan.baidu.com/disk/home*
// @match        https://yun.baidu.com/disk/home*
// @run-at       document-start
// @require      https://unpkg.com/@babel/standalone/babel.min.js
// @require      https://unpkg.com/@babel/preset-env-standalone/babel-preset-env.min.js
// @require      https://unpkg.com/@babel/polyfill/dist/polyfill.min.js
// @require      https://unpkg.com/jquery/dist/jquery.min.js
// @note         2.2:解决离线下载过早点击批量离线按钮可能出不来的bug,更新babel到7
// @note         2.5:改进脚本管理器xmlhttpRequest的判断方式
// @connect      greasyfork.org
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// ==/UserScript==
var http
if(typeof GM_xmlhttpRequest!='undefined'){
 http=GM_xmlhttpRequest;
}else{
  http=GM.xmlHttpRequest;
}
var click=false; // 判断是否在脚本加载前点击离线下载按钮
// console.log(http);
function btnClick(){
    click=true;
}
http({
    method:'GET',
    url: "http://greasyfork.icu/scripts/37905-%E7%99%BE%E5%BA%A6%E7%BD%91%E7%9B%98%E6%89%B9%E9%87%8F%E7%A6%BB%E7%BA%BF/code/%E7%99%BE%E5%BA%A6%E7%BD%91%E7%9B%98%E6%89%B9%E9%87%8F%E7%A6%BB%E7%BA%BF.js",
    // synchronous:true,
    onload: function(response) {
        var src=response.responseText;
        //var c = Babel.transform(src, { presets: [['es2015',{strictMode:false}], 'es2016','es2017'],sourceType: 'script'});
        var c = Babel.transform(src, { presets: ['env'],sourceType: 'script'});

        console.log(c);
        $(function(){
            /* jshint ignore:start */
            eval(c.code);
            //debugger;
            //console.log(add_multi_button);
            if(click=true){
                $('body').off('click', 'a.g-button:contains(离线下载)', add_multi_button);
                add_multi_button()
            }else{
                $('body').off('click', 'a.g-button:contains(离线下载)', btnClick);
            }
            /* jshint ignore:end */
            // console.log(src,c.code,'success');
        });
    }
});

$(function(){
    $('body').one('click', 'a.g-button:contains(离线下载)', btnClick);
});