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/landing/ui/field/color/src/layout/primary/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/color/src/layout/primary/primary.js
import {EventEmitter} from 'main.core.events';
import {Cache, Tag, Event, Dom, Loc} from 'main.core';

import ColorValue from "../../color_value";

import 'ui.fonts.opensans';
import './css/primary.css';

export default class Primary extends EventEmitter
{
	static ACTIVE_CLASS: string = 'active';
	static CSS_VAR: string = '--primary';

	// todo: layout or control?
	constructor(options = {})
	{
		super();
		this.cache = new Cache.MemoryCache();
		this.setEventNamespace('BX.Landing.UI.Field.Color.Primary');
		Event.bind(this.getLayout(), 'click', () => this.onClick());

		if (options.content && options.content === 'var(--primary)')
		{
			this.setActive();
		}
	}

	getLayout(): HTMLElement
	{
		return this.cache.remember('layout', () => {
			return Tag.render`
				<div class="landing-ui-field-color-primary">
					<i class="landing-ui-field-color-primary-preview"></i>
					<span class="landing-ui-field-color-primary-text">
						${Loc.getMessage('LANDING_FIELD_COLOR-PRIMARY_TITLE')}
					</span>
				</div>
			`;
		});
	}

	getValue(): ColorValue
	{
		return this.cache.remember('value', () => {
			return new ColorValue(Primary.CSS_VAR);
		});
	}

	onClick()
	{
		this.setActive();
		this.emit('onChange', {color: this.getValue()});
	}

	setActive()
	{
		Dom.addClass(this.getLayout(), Primary.ACTIVE_CLASS);
	}

	unsetActive()
	{
		Dom.removeClass(this.getLayout(), Primary.ACTIVE_CLASS);
	}

	isActive(): boolean
	{
		return Dom.hasClass(this.getLayout(), Primary.ACTIVE_CLASS);
	}

	isPrimaryValue(value: ColorValue): boolean
	{
		return (value !== null) && (this.getValue().getCssVar() === value.getCssVar());
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit