Uloz.to Direct Link

Direct links in search on Uloz.to

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            Uloz.to Direct Link
// @name:cs         Ulož.to Přímé odkazy
// @namespace       https://greasyfork.org/users/43813
// @version         0.2.1
// @author          d4nkeroni
// @description     Direct links in search on Uloz.to
// @description:cs  Přímé odkazy ve vyhledávání na Ulož.to
// @icon            https://i.imgur.com/FaenDWi.png
// @copyright       2015-2018, d4nkeroni
// @license         MIT
// @include         http*://*uloz.to/hledej*
// @include         http*://*ulozto.cz/hledej*
// @include         http*://*ulozto.sk/hledej*
// @include         http*://*ulozto.net/hledej*
// @include         http*://*zachowajto.pl/hledej*
// @include         http*://*pornfile.cz/hledej*
// @grant           none
// ==/UserScript==
/*jshint multistr: true */

var maxTries = 20;
var time = 500;
var tries = 0;

function fixLinks() {
    tries++;
    if ($(".js-result-item").length > 0) {
        $('<li class="no-txt addToFavourites copyLink"> \
             <a class="t-button-add-to-favourites" rel="tooltip" title="Zobrazit přímý odkaz"> \
               <i class="fi fi-share-alt"></i> \
               <span>Zobrazit přímý odkaz</span> \
             </a> \
           </li>"').insertAfter(".quickDownload");

        $('<div id="confirmCopy" style=" \
          position: fixed; \
          z-index: 999; \
          left: 20%; \
          top: 1%; \
          width: 59%; \
          border: 1px solid #cfcfcf; \
          border-radius: 5px; \
          background-color: #fbfbfb; \
          padding: 5px; \
          display: none; \
          "><input type="text" value="Generování odkazu..." readonly="readonly">\
          <button type="button" style="\
          margin-left: 10px;" id="btnCopy">Zkopírovat</button>\
          <button type="button" style="\
          margin-left: 10px;" id="btnClose">Zavřít</button>\
          </div>').appendTo("body");


        $(".copyLink").on("click", function(event){
            ready = false;
            var item = $(event.target).closest(".js-result-item");
            var link = item.find(".name").find(".jsTrackingLinkRefresh");
            var url = link.attr("href");
            $("#confirmCopy input").attr("value", "Generování odkazu...");
            $("#confirmCopy").css("display", "unset");
            if (url.indexOf("file-tracking") != -1){
                var xhr = new XMLHttpRequest();
                xhr.open("GET", url, true);
                xhr.onreadystatechange = function(e) {
                    if (xhr.status == 200 | 401 && xhr.readyState == 2) {
                        if (url != xhr.responseURL) {
                            link.attr("href", xhr.responseURL);
                            item.find(".media").find(".jsTrackingLinkRefresh").attr("href", xhr.responseURL);
                            item.find(".tools").find(".jsTrackingLinkRefresh").attr("href", xhr.responseURL + "?showDialog=1");
                            $("#confirmCopy input").attr("value", xhr.responseURL);
                            $("#confirmCopy input").select();
                        }
                        else if (url.indexOf("limit-exceeded") != -1) alert("limit-exceeded");
                    }
                };
                xhr.send();
            }
            else {
               $("#confirmCopy input").attr("value", url);
               $("#confirmCopy input").select();
            }
        });

        $("#btnCopy").on("click", function(event){
            $("#confirmCopy input").select();
            try {
                var successful = document.execCommand('copy');
                var msg = successful ? 'successful' : 'unsuccessful';
                console.log('Copying text command was ' + msg);
            } catch (err) {
                console.log('Oops, unable to copy');
            }
            $("#confirmCopy").css("display", "none");
        });
        $("#btnClose").on("click", function(event){
            $("#confirmCopy").css("display", "none");
        });
    } else if (tries < maxTries) window.setTimeout(fixLinks, time);
}
window.setTimeout(fixLinks, time);