Ulož.to Přímé odkazy

Přímé odkazy ve vyhledávání na Ulož.to

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            Uloz.to Direct Link
// @name:cs         Ulož.to Přímé odkazy
// @namespace       https://greatest.deepsurf.us/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);