AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.12.74.66
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/ui/tour/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/ui/tour/src/step.js
import { Dom, Event, Reflection, Type } from 'main.core';

export class Step extends Event.EventEmitter
{
	constructor(options)
	{
		super(options);
		this.target = null;
		if (
			Type.isString(options.target) && options.target !== '' ||
			Type.isFunction(options.target) ||
			Type.isDomNode(options.target)
		)
		{
			this.target = options.target;
		}

		this.id = options.id || null;
		this.text = options.text;
		this.areaPadding = options.areaPadding;
		this.link = options.link || "";
		this.linkTitle = options.linkTitle || null;
		this.rounded = options.rounded || false;
		this.title = options.title || null;
		this.article = options.article || null;
		this.position = options.position || null;
		this.cursorMode = options.cursorMode || false;
		this.targetEvent = options.targetEvent || null;
		this.buttons = options.buttons || [];
		this.condition = options.condition || null;

		const events = Type.isPlainObject(options.events) ? options.events : {};

		for (let eventName in events)
		{
			const callback = Type.isFunction(events[eventName]) ? events[eventName] : Reflection.getClass(events[eventName]);
			if (callback)
			{
				this.subscribe(this.constructor.getFullEventName(eventName), () => {
					callback();
				});
			}
		}
	}

	getCondition()
	{
		return this.condition;
	}

	getTarget()
	{
		if (Type.isString(this.target) && this.target !== '')
		{
			return document.querySelector(this.target);
		}

		if (Type.isFunction(this.target))
		{
			return this.target();
		}

		return this.target;
	}

	getTargetPos()
	{
		if (Type.isDomNode(this.target))
		{
			return Dom.getPosition(this.target);
		}
	}

	getId()
	{
		return this.id;
	}

	getButtons()
	{
		return this.buttons;
	}

	getAreaPadding()
	{
		return this.areaPadding;
	}

	getRounded()
	{
		return this.rounded;
	}

	getText()
	{
		return this.text;
	}

	getLink()
	{
		return this.link;
	}

	getLinkTitle(): ?string
	{
		return this.linkTitle;
	}

	getTitle()
	{
		return this.title;
	}

	getPosition()
	{
		return this.position;
	}

	getArticle()
	{
		return this.article;
	}

	getCursorMode()
	{
		return this.cursorMode;
	}

	getTargetEvent()
	{
		return this.targetEvent;
	}

	static getFullEventName(shortName)
	{
		return "Step:" + shortName;
	}

	setTarget(target)
	{
		this.target = target;
	}

	initTargetEvent()
	{
		if(Type.isFunction(this.targetEvent))
		{
			this.targetEvent();
			return;
		}

		this.getTarget().dispatchEvent(new MouseEvent(this.targetEvent))
	}
}

Anon7 - 2022
AnonSec Team