DF RequestHandler

Request handler library for Dead Frontier

Από την 25/05/2026. Δείτε την τελευταία έκδοση.

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greatest.deepsurf.us/scripts/579721/1834453/DF%20RequestHandler.js

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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.

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

// Thanks to SilverBeam (creator of SilverScripts) for allowing me to use the serializeObject and makeRequest functions from SilverScripts

function serializeObject(obj)
    {
        var pairs = [];
        for (var prop in obj)
        {
            if (!obj.hasOwnProperty(prop)) continue;
            pairs.push(prop + "=" + obj[prop]);
        }
        return pairs.join("&");
    }

function makeRequest(requestUrl, requestParams, callbackFunc, callbackParams = null)
{
    return new Promise((resolve) =>
    {
        var xhttp = new XMLHttpRequest();
        var payload = null;
        xhttp.onreadystatechange = function()
        {
            if (this.readyState == 4 && this.status == 200)
            {
                // Invoke the callback with the request response text and some parameters, if any were supplied
                // then resolve the Promise with the callback's reponse
                let callbackResponse = null;
                if (callbackFunc != null)
                {
                    callbackResponse = callbackFunc(this.responseText, callbackParams);
                }
                if (callbackResponse == null)
                {
                    callbackResponse = true;
                }
                resolve(callbackResponse);
            }
        };

        payload = serializeObject(requestParams);

        xhttp.open("POST", "https://fairview.deadfrontier.com/onlinezombiemmo/" + requestUrl + ".php", true);
        xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xhttp.setRequestHeader("x-requested-with", "ArysScriptsRequest");
        payload = "hash=" + unsafeWindow.hash(payload) + "&" + payload;
        xhttp.send(payload);
    });
}