Greasy Fork is available in English.
自动填写提取密码,失败不重试。
当前为
// ==UserScript==
// @name 度娘盘自动填写提取密码
// @namespace http://jixun.org/
// @description 自动填写提取密码,失败不重试。
// @include http://pan.baidu.com/share/init?*
// @include http://yun.baidu.com/share/init?*
// @version 1
// @grant none
// @run-at document-start
// ==/UserScript==
(function ($) {
$.addEventListener ('DOMContentLoaded', function () {
// 抓取提取码
var sCode = location.hash.slice(1).trim();
// 检查是否为标准格式 (4字符, 小写字母及数字混合)
if (!/^[a-z0-9]{4}$/.test(sCode))
// 没有 Key 或格式不对
return ;
// 调试用
console.log ('抓取到的提取码: %s', sCode);
var fCode = $.getElementById ('accessCode');
(function (el) {
el.textContent = el.textContent.replace(/:/, ' ( 自动尝试: ' + sCode + ' )');
}) (fCode.parentNode.previousElementSibling);
// 键入提取码并单击「提交」按钮。
fCode.value = sCode;
$.getElementById ('submitBtn').click ();
// 当提取码不正确的时候,度娘会自己提示错误而非跳转。
}, false);
})(document);