百度網盤自動轉存

自動轉存當前文件至上次轉存路徑。

目前为 2016-10-16 提交的版本。查看 最新版本

// ==UserScript==
// @name         百度網盤自動轉存
// @name:zh-CN   百度网盘自动转存
// @namespace    moe.jixun.baidu.auto.save
// @version      0.3
// @description  自動轉存當前文件至上次轉存路徑。
// @author       Jixun
// @include      http://pan.baidu.com/share/link*
// @include      https://pan.baidu.com/share/link*
// @grant        none
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    var errors = {
        0: '成功',
        5: '自己的文件',
        12: '已经保存过了',
        111: '另一保存任务进行中',
        '-33': '需要会员 (?)',
        120: '需要会员 (?)',
        130: '需要超级会员 (?)'
    };

    (function (tip, c) {
        var key = yunData.MYNAME.replace(/@/g, "") + "_transfer_save_path";
        var _recent_path = localStorage.getItem(key);
        if (!_recent_path) _recent_path = '/';
        else _recent_path = _recent_path.replace(/\?\d+/, '');

        var $ = require("base:widget/libs/jquery-1.12.4.js");
        $.ajax({
            type: 'POST',
            url: '/share/transfer?shareid=' + yunData.SHARE_ID + '&from=' + yunData.SHARE_UK,
            data: {
                filelist: JSON.stringify(yunData.FILEINFO.map(function(f){ return f.path; })),
                path: _recent_path
            },
            dataType: 'json',
            success: function (data) {
                var raw = typeof data == 'string' ? $.parseJSON(data) : data;
                var err = data.errno;

                var errMsg = '';
                if (err in errors) {
                    errMsg += errors[err] + ' (' + err + ')';
                } else {
                    errMsg += '未知状态 (' + err + ')';
                }

                var msg = '保存至: ' + _recent_path + ', 状态: ' + errMsg;
                document.title = errMsg + ' - ' + document.title;

                tip.hide();
                tip.show({
                    mode: err === 0 ? 'success' : 'caution',
                    msg: msg,
                    hasClose: true,
                    autoClose: false,
                    vipType: 'svip'
                });
            }
        });

        tip.show({
            mode: 'loading',
            msg: "正在转存文件,请稍后...",
            hasClose: false,
            autoClose: false
        });
    })(
        /*tip: */require("system-core:system/uiService/tip/tip.js")
    );
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址