Uloz.to Direct Link

Direct links in search on Uloz.to

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);