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/cvetdv.ru/bitrix/components/bitrix/catalog.top/settings/position/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/components/bitrix/catalog.top/settings/position/script.js
function initPositionControl(params)
{
	var data = JSON.parse(params.data);
	if (data)
	{
		window['pos_parameter_' + params.propertyID] = new PositionParameterControl(data, params);
	}
}

function PositionParameterControl(data, params)
{
	var rand = BX.util.getRandomString(5);

	this.params = params || {};
	this.positions = data.positions || {};
	this.parentClassName = data.className ? ' ' + data.className : '';
	this.selected = this.params.oInput.value || this.params.propertyParams.DEFAULT;
	this.id = 'pos_params_container_' + this.params.propertyID + '_' + rand;

	BX.loadCSS(this.getPath() + '/style.css?' + rand);
	this.buildNodes();
	this.saveData();
}

PositionParameterControl.prototype =
{
	getPath: function()
	{
		var path = this.params.propertyParams.JS_FILE.split('/');

		path.pop();

		return path.join('/');
	},

	buildNodes: function()
	{
		var nodes = [];

		for (var i in this.positions)
		{
			if (this.positions.hasOwnProperty(i))
			{
				nodes.push(
					BX.create('DIV', {
						attrs: {'data-value': this.positions[i]},
						props: {
							className: 'bx-pos-parameter bx-pos-parameter-' + this.positions[i]
							+ (this.positions[i] == this.selected ? ' selected' : '')
						},
						events: {click: BX.proxy(this.selectPosition, this)}
					})
				);
			}
		}

		this.params.oCont.appendChild(
			BX.create('DIV', {
				props: {className: 'bx-pos-parameter-container' + this.parentClassName},
				children: [
					BX.create('DIV', {children: nodes, props: {className: 'bx-pos-parameter-block'}}),
					BX.create('DIV', {props: {className: 'bx-pos-parameter-decore'}}),
					BX.create('DIV', {props: {className: 'bx-pos-parameter-decore'}}),
					BX.create('DIV', {props: {className: 'bx-pos-parameter-decore'}}),
					BX.create('DIV', {props: {className: 'bx-pos-parameter-decore'}}),
					BX.create('DIV', {props: {className: 'bx-pos-parameter-decore'}})
				]
			})
		);
	},

	selectPosition: function(event)
	{
		var target = BX.getEventTarget(event),
			items = this.params.oCont.querySelectorAll('.bx-pos-parameter'),
			value = target.getAttribute('data-value');

		if (this.selected == value)
			return;

		this.selected = value;

		for (var k in items)
		{
			if (items.hasOwnProperty(k))
			{
				if (items[k].getAttribute('data-value') == this.selected)
				{
					BX.addClass(items[k], 'selected');
				}
				else
				{
					BX.removeClass(items[k], 'selected');
				}
			}
		}

		this.saveData();
	},

	saveData: function()
	{
		this.params.oInput.value = this.selected;
	}
};

Youez - 2016 - github.com/yon3zu
LinuXploit