下载按钮

try to take over the world!

As of 2018-08-16. See the latest version.

// ==UserScript==
// @name         下载按钮
// @namespace    需要硕鼠软件。硕鼠插件新版的Chrome和Firefox都无法安装》无技术现学现卖的脚本。硕鼠请打开自动跳转和自动启动下载器,下载页面会在5秒后关闭。
// @version      0.1.1
// @description  try to take over the world!
// @author       poi
// @match        https://www.bilibili.com/bangumi/*
// @match        https://www.bilibili.com/video/*
// @match        http://www.flvcd.com/xdown.php?id=*
// @grant        none
// ==/UserScript==

(function() {
    var url=window.location.href;
    var reg=/(http:\/\/www.flvcd.com\/xdown.php\?id=)(\d{1,99})/;
    console.log(reg.test(url)+"/n"+url);
    if(!reg.test(url)){

            function loadCssCode(code){
            var style = document.createElement('style');
            style.type = 'text/css';
            style.rel = 'stylesheet';
            style.appendChild(document.createTextNode(code));
            var head = document.getElementsByTagName('head')[0];
            head.appendChild(style);
        }
        loadCssCode('.ss{background: #E8E9EB;z-index:999;width:100px;height:100px;border:0px;box-shadow:3px 3px 3px #888888; border-radius:50px;position: fixed;opacity:0.1;transition-duration:1s;}.ss:hover{transition-duration:0.5s;opacity:1;}.ss:active{background: #6f6f6f;width:95px;height:95px;}');

        var newButton = document.createElement("input");
        newButton.value="下载";
        newButton.className="ss";
        newButton.type='button';
        newButton.onclick=function (){
            window.open('http://www.flvcd.com/parse.php?format=&kw='+window.location.href);
        };
        var x=document.getElementById("banner_link");
        x.appendChild(newButton);
        var y=document.getElementById("video-page-app");
        y.appendChild(newButton);
    }else{
        setTimeout('window.close();',5000);
    };
})();