Greasy Fork

Greasy Fork is available in English.

mebook小书屋自动打开百度云

自动打开百度云链接并填写密码

当前为 2018-11-11 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         mebook小书屋自动打开百度云
// @namespace    http://mebook.cc/
// @version      1.1
// @description  自动打开百度云链接并填写密码
// @author       Ming
// @match        http://mebook.cc/download.php?*
// @match        http://shuwu.mobi/download.php?*
// @match        https://pan.baidu.com/share/init?*
// @match        https://pan.baidu.com/s/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if (window.location.host === "mebook.cc") {
        var passPtag = document.getElementsByClassName("desc")[0].children[6].innerHTML;
        var passMatch = new RegExp("百度网盘密码:([0-9a-z]{4})");
        var pass = passMatch.exec(passPtag)[1];
        if (pass.length === 4) {
            var linkAtag = document.getElementsByClassName("list")[0].children[0];
            //linkAtag.href = linkAtag.href + "#" + pass;
            window.location.href=linkAtag.href + "#" + pass;
        } 
    } else {
        if (window.location.host === "pan.baidu.com") {
            var url = window.location.href;
            var matchPass = new RegExp("#([0-9a-z]{4})");

            var pass = matchPass.exec(url)[1];

            if (pass.length === 4) {
                var inputTag = document.getElementById("evppn2p");
                inputTag.value = pass;
                var button = document.getElementsByClassName("g-button g-button-blue-large")[0];
                button.click();
            }
        }
    }
    
})();