Nexus No Wait

Download from Nexusmods.com without wait and redirect (support Manual/Vortex)

Από την 23/01/2020. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Nexus No Wait
// @description Download from Nexusmods.com without wait and redirect (support Manual/Vortex)
// @namespace   NexusNoWait
// @include     https://www.nexusmods.com/*/mods/*
// @run-at      document-idle
// @version     1.3
// @require			http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==


$(document).on('click', '.btn', function(event) {

    var href = $(this).attr('href');
    if (~href.indexOf("file_id")) {
        event.preventDefault();
        var button = $(this);

        button.css("color", "yellow");
        button.text('WAIT');

        var game_id = document.getElementById("section").dataset.gameId;
        var search_params = new URLSearchParams(href);
        var file_id = search_params.get("file_id");

        if (!~href.indexOf("nmm")) {
            $.ajax({
                type: "POST",
                url: "/Core/Libs/Common/Managers/Downloads?GenerateDownloadUrl",
                data: {
                    fid: file_id,
                    game_id: game_id,
                },
                success: function(data) {
                    if (data && data.url) {
                        console.log('Success');
                        window.location.href = data.url;
                        btnSuccess(button);
                    } else {
                        btnError(button);
                    }
                },
                error: function() {
                    btnError(button);
                }
            });
        } else {
            $.ajax({
                type: "GET",
                url: href,
                success: function(data) {
                    var slow = $(data).find('#slowDownloadButton');
                    var downloadUrl = slow.data('download-url');
                    document.location.href = downloadUrl;
                    btnSuccess(button);
                },
                error: function(ajaxContext) {
                    console.log(ajaxContext.responseText);
                    btnError(button);
                }
            });
        }
    }
    var popup = $(this).parent();
    if (popup.hasClass('popup')) {
        popup.children("button").click();
    }
});

function btnError(button) {
    button.css("color", "red");
    button.text('ERROR');
}

function btnSuccess(button) {
    button.css("color", "green");
    button.text('LOADING');
}