百度網盤自動轉存

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

目前為 2016-10-16 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 百度網盤自動轉存
  3. // @name:zh-CN 百度网盘自动转存
  4. // @namespace moe.jixun.baidu.auto.save
  5. // @version 0.3
  6. // @description 自動轉存當前文件至上次轉存路徑。
  7. // @author Jixun
  8. // @include http://pan.baidu.com/share/link*
  9. // @include https://pan.baidu.com/share/link*
  10. // @grant none
  11. // @run-at document-end
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. var errors = {
  19. 0: '成功',
  20. 5: '自己的文件',
  21. 12: '已经保存过了',
  22. 111: '另一保存任务进行中',
  23. '-33': '需要会员 (?)',
  24. 120: '需要会员 (?)',
  25. 130: '需要超级会员 (?)'
  26. };
  27.  
  28. (function (tip, c) {
  29. var key = yunData.MYNAME.replace(/@/g, "") + "_transfer_save_path";
  30. var _recent_path = localStorage.getItem(key);
  31. if (!_recent_path) _recent_path = '/';
  32. else _recent_path = _recent_path.replace(/\?\d+/, '');
  33.  
  34. var $ = require("base:widget/libs/jquery-1.12.4.js");
  35. $.ajax({
  36. type: 'POST',
  37. url: '/share/transfer?shareid=' + yunData.SHARE_ID + '&from=' + yunData.SHARE_UK,
  38. data: {
  39. filelist: JSON.stringify(yunData.FILEINFO.map(function(f){ return f.path; })),
  40. path: _recent_path
  41. },
  42. dataType: 'json',
  43. success: function (data) {
  44. var raw = typeof data == 'string' ? $.parseJSON(data) : data;
  45. var err = data.errno;
  46.  
  47. var errMsg = '';
  48. if (err in errors) {
  49. errMsg += errors[err] + ' (' + err + ')';
  50. } else {
  51. errMsg += '未知状态 (' + err + ')';
  52. }
  53.  
  54. var msg = '保存至: ' + _recent_path + ', 状态: ' + errMsg;
  55. document.title = errMsg + ' - ' + document.title;
  56.  
  57. tip.hide();
  58. tip.show({
  59. mode: err === 0 ? 'success' : 'caution',
  60. msg: msg,
  61. hasClose: true,
  62. autoClose: false,
  63. vipType: 'svip'
  64. });
  65. }
  66. });
  67.  
  68. tip.show({
  69. mode: 'loading',
  70. msg: "正在转存文件,请稍后...",
  71. hasClose: false,
  72. autoClose: false
  73. });
  74. })(
  75. /*tip: */require("system-core:system/uiService/tip/tip.js")
  76. );
  77. })();

QingJ © 2025

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