403Webshell
Server IP : 85.158.181.41  /  Your IP : 216.73.217.12
Web Server : Apache
System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64
User : moncbefd ( 1024)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/moncbefd/www.moneta.at/JSEngine/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/moncbefd/www.moneta.at/JSEngine/libs/xhr.js
/* --------------------------------------------------------------
 xhr.js 2016-02-23
 Gambio GmbH
 http://www.gambio.de
 Copyright (c) 2016 Gambio GmbH
 Released under the GNU General Public License (Version 2)
 [http://www.gnu.org/licenses/gpl-2.0.html]
 --------------------------------------------------------------
 */

jse.libs.xhr = jse.libs.xhr || {};

/**
 * ## AJAX Library
 *
 * This library contains wrapper-methods for the original jquery AJAX methods ('ajax', 'post', 'get').
 *
 * @module JSE/Libs/xhr
 * @exports jse.libs.xhr
 */
(function (exports) {

    'use strict';

    /**
     * Default AJAX Options
     *
     * @type {object}
     */
    var defaultAjaxOptions = {
        type: 'post',
        dataType: 'json',
        cache: false,
        async: true
    };

    /**
     * Wrapper for the jquery "ajax" method.
     *
     * @param {object} parameters AJAX-config object which gets merged with the default settings from config.
     *
     * @return {object} Returns an ajax compatible promise object.
     */
    exports.ajax = function (parameters, ignoreFail) {

        var $pageToken = $('input[name="page_token"]');

        parameters = parameters || {};
        parameters.data = parameters.data || {};

        // If no page token was provided try to use the existing one.
        if (!parameters.data.page_token) {
            parameters.data.page_token = ($pageToken.length) ? $pageToken.val() : '';
        }

        var options = $.extend({}, defaultAjaxOptions, parameters),
            deferred = $.Deferred(),
            promise = deferred.promise();

        /**
         * Default fail handler
         *
         * @param {Object} result The failure response
         */
        var _failHandler = function (result) {
        	if (result === null) {
        		deferred.reject();
	        } else {
		        result.message = result.message || 'JavaScript AJAX Error';
		        deferred.reject(result);
	        }
        };

        // The ajax call
        var ajax = $.ajax(options).done(function (result) {
            // Check if it is an JSON-compatible result, if so, check the success message.
            if (result.success !== undefined && result.success === false && !ignoreFail) {
                _failHandler(result);
            } else {
                // set new page_token
                if (result.page_token !== undefined) {
                    $pageToken.val(result.page_token);
                }
                deferred.resolve(result);
            }
        }).fail(function () {
            if (!ignoreFail) {
                _failHandler(null);
            } else {
                deferred.reject({});
            }
        });

        // Add an ajax abort method to the promise, for cases where we need to abort the AJAX request.
        promise.abort = function () {
            ajax.abort();
        };

        return promise;
    };


    /**
     * Wrapper function for the jquery "get" method.
     *
     * @param {object} parameters AJAX-config object which will be merged with the default settings from config.
     *
     * @return {object} Returns an ajax compatible promise object.
     */
    exports.get = function (parameters, ignoreFail) {
        return exports.ajax($.extend({}, {type: 'get'}, parameters), ignoreFail);
    };

    /**
     * Wrapper function for the jquery "post" method.
     *
     * @param {object} parameters AJAX-config object which gets merged with the default settings from config.
     *
     * @return {object} Returns an ajax compatible promise object.
     */
    exports.post = function (parameters, ignoreFail) {
        return exports.ajax($.extend({}, {type: 'post'}, parameters), ignoreFail);
    };

})(jse.libs.xhr);

Youez - 2016 - github.com/yon3zu
LinuXploit