迅牛网盘直接下载

迅牛网盘免等待

// ==UserScript==
// @name         迅牛网盘直接下载
// @namespace    http://leochan.me
// @version      1.0.0
// @description  迅牛网盘免等待
// @author       Leo
// @match        http://www.xunniupan.co/down-*.html
// @match        http://www.xunniupan.co/file-*.html
// @match        http://www.xunniufile.com/down-*.html
// @match        http://www.xunniufile.com/file-*.html
// @icon         https://www.google.com/s2/favicons?sz=64&domain=leochan.me
// @license      GPLv2
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const openDownloadPage = () => {
        if(location.href.indexOf('/file-') !== -1){
            location.href = location.href.replace('/file-', '/down-');
        }
    }
    openDownloadPage();
    const showDownloadLink = () => {
        if(document.querySelector('#down_box')){
            setTimeout(() => {
                document.querySelector('#down_box').style.display = 'block';
                let links = document.querySelectorAll('.down_btn'), length = links.length, last = length - 1;
                if(length > 0){
                    location.href = links[last].href;
                }
            }, 1000);
        }
    }
    showDownloadLink();
})();