HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/intranet.kauko.lt/wp-content/plugins/wise-chat/assets/js/src/utils/extensions.js
import $ from "jquery";

/**
 * Adds support for "progress" and "progressUpload" events. Required for progress bars.
 */
export function installXhrProgressEvent() {
	const originalXhr = $.ajaxSettings.xhr;

	$.ajaxSetup({
		xhr: function() {
			const req = originalXhr.call($.ajaxSettings), that = this;

			if (req) {
				if (typeof req.addEventListener == "function" && that.progress !== undefined) {
					req.addEventListener("progress", function(evt) {
						that.progress(evt);
					}, false);
				}
				if (typeof req.upload == "object" && that.progressUpload !== undefined) {
					req.upload.addEventListener("progress", function(evt) {
						that.progressUpload(evt);
					}, false);
				}
			}
			return req;
		}
	});
}