dbr.ee: direct download

always direct download button on dbr.ee

当前为 2017-01-06 提交的版本,查看 最新版本

// ==UserScript==
// @name        dbr.ee: direct download
// @namespace   mailto: [email protected]
// @locale      en
// @include     *dbr.ee*
// @description:en always direct download button on dbr.ee
// @version     1.0
// @run-at      document-start
// @grant       none
// @description always direct download button on dbr.ee
// ==/UserScript==


var fileid = window.location.href.split("/").slice(-1)[0];
if(fileid !== "") {
    document.addEventListener("DOMContentLoaded", waitForDLButton);
}

function doEverything(btn) {
    var newbtnform = document.createElement("form");
    newbtnform.setAttribute("class", "button_to");
    newbtnform.setAttribute("method", "get");
    newbtnform.setAttribute("action", "/"+fileid+"/d");

    var newbtnspan = document.createElement("span");
    newbtnspan.setAttribute("class", "icon-download");

    var newbtn = document.createElement("button");
    newbtn.setAttribute("class", "btn btn--block");
    newbtn.setAttribute("title", "Direct Download");
    newbtn.setAttribute("data-disable-with", "Downloading...");
    newbtn.setAttribute("type", "submit");
    newbtn.innerHTML = " DOWNLOAD";

    newbtn.insertBefore(newbtnspan, newbtn.childNodes[0]);
    newbtnform.appendChild(newbtn);

    var btnparent = btn.parentElement;
    btn.remove();
    btnparent.appendChild(newbtnform);
}

function waitForDLButton() {
    var btn = document.getElementsByClassName("icon-download");

    if(btn.length > 0) {
        doEverything(btn[0].parentElement);
    } else {
        setTimeout(waitForDLButton, 100);
    }
}

QingJ © 2025

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