PageSourceSearch

https://www.wuestenrot.lu/media/formcentric/standard/javascript_2/jquery_xdr_transport.js

js wuestenrot.lu collected 2026-10-07 00:58:45 UTC 3,416 bytes, 89 lines download raw bytes

1/*
2 * jQuery XDomainRequest Transport Plugin
3 * https://github.com/blueimp/jQuery-File-Upload
4 *
5 * Copyright 2011, Sebastian Tschan
6 * https://blueimp.net
7 *
8 * Licensed under the MIT license:
9 * http://www.opensource.org/licenses/MIT
10 *
11 * Based on Julian Aubourg's ajaxHooks xdr.js:
12 * https://github.com/jaubourg/ajaxHooks/
13 */
14
15/* global define, require, window, XDomainRequest */
16
17(function (factory) {
18    'use strict';
19    if (typeof define === 'function' && define.amd) {
20        // Register as an anonymous AMD module:
21        define(['jquery'], factory);
22    } else if (typeof exports === 'object') {
23        // Node/CommonJS:
24        factory(require('jquery'));
25    } else {
26        // Browser globals:
27        factory(window.jQuery);
28    }
29}(function ($) {
30    'use strict';
31    if (window.XDomainRequest && !$.support.cors) {
32        $.ajaxTransport(function (s) {
33            if (s.crossDomain && s.async) {
34                if (s.timeout) {
35                    s.xdrTimeout = s.timeout;
36                    delete s.timeout;
37                }
38                var xdr;
39                return {
40                    send: function (headers, completeCallback) {
41                        var addParamChar = /\?/.test(s.url) ? '&' : '?';
42                        function callback(status, statusText, responses, responseHeaders) {
43                            xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
44                            xdr = null;
45                            completeCallback(status, statusText, responses, responseHeaders);
46                        }
47                        xdr = new XDomainRequest();
48                        // XDomainRequest only supports GET and POST:
49                        if (s.type === 'DELETE') {
50                            s.url = s.url + addParamChar + '_method=DELETE';
51                            s.type = 'POST';
52                        } else if (s.type === 'PUT') {
53                            s.url = s.url + addParamChar + '_method=PUT';
54                            s.type = 'POST';
55                        } else if (s.type === 'PATCH') {
56                            s.url = s.url + addParamChar + '_method=PATCH';
57                            s.type = 'POST';
58                        }
59                        xdr.open(s.type, s.url);
60                        xdr.onload = function () {
61                            callback(
62                                200,
63                                'OK',
64                                {text: xdr.responseText},
65                                'Content-Type: ' + xdr.contentType
66                            );
67                        };
68                        xdr.onerror = function () {
69                            callback(404, 'Not Found');
70                        };
71                        if (s.xdrTimeout) {
72                            xdr.ontimeout = function () {
73                                callback(0, 'timeout');
74                            };
75                            xdr.timeout = s.xdrTimeout;
76                        }
77                        xdr.send((s.hasContent && s.data) || null);
78                    },
79                    abort: function () {
80                        if (xdr) {
81                            xdr.onerror = $.noop();
82                            xdr.abort();
83                        }
84                    }
85                };
86            }
87        });
88    }
89}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.