%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.144.25.14
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/components/bitrix/ui.tile.list/templates/.default/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/ui.tile.list/templates/.default//script.js
;(function ()
{
	var namespace = BX.namespace('BX.UI.TileList');
	if (namespace.Manager)
	{
		return;
	}

	var managerList = [];

	/**
	 * Tile.
	 *
	 */
	function Tile(options)
	{
		this.id = options.id;
		this.name = options.name;
		this.bgColor = options.bgColor;
		this.color = options.color;
		this.selected = options.selected;
		this.node = options.node;
		this.data = options.data;

		this.nameNode = Helper.getNode('tile/item/name', this.node);
		this.iconNode = Helper.getNode('tile/item/icon', this.node);
		this.iconColorNode = Helper.getNode('tile/item/icon/color', this.node);

		if (this.name)
		{
			this.nameNode.textContent = this.name;
		}
		if (options.iconClass)
		{
			BX.addClass(this.iconNode, options.iconClass);
		}

		this.changeSelection(this.selected);
	}
	Tile.prototype = {
		classSelected: 'ui-tile-list-item-selected',
		changeSelection: function (isSelected)
		{
			Helper.changeClass(this.node, this.classSelected, isSelected);
			this.nameNode.style.color = (isSelected && this.color) ? this.color : '';
			this.node.style.background = isSelected
				? (this.bgColor
						? this.bgColor
						: getComputedStyle(this.iconColorNode).backgroundColor
				)
				: '';

			this.selected = isSelected;
		},

		onClick: function ()
		{

		}
	};


	/**
	 * Manager.
	 *
	 */
	function Manager(params)
	{
		this.init(params);
	}
	Manager.prototype.events = {
		tileClick: 'tile-click',
		tileRemove: 'tile-remove',
		tileEdit: 'tile-edit',
		tileAdd: 'tile-add',
		buttonAdd: 'add'
	};
	Manager.getById = function (id)
	{
		var filtered = managerList.filter(function (item) {
			return item.id === id;
		});
		return filtered.length > 0 ? filtered[0] : null;
	};
	Manager.getList = function ()
	{
		return managerList;
	};

	Manager.prototype.init = function (params)
	{
		this.list = [];
		this.context = BX(params.containerId);
		if (!this.context)
		{
			return;
		}

		this.id = params.id;

		this.tileContainer = Helper.getNode('tile/items', this.context);
		this.tileTemplate = Helper.getNode('tile/template', this.context);
		this.buttonAdd = Helper.getNode('tile/add', this.context);

		Helper.getNodes('tile/item', this.context).forEach(this.initNode.bind(this, params.tileOptionsList || []));

		managerList.push(this);
		this.initEventHandlers();
	};
	Manager.prototype.initEventHandlers = function ()
	{
		if (this.buttonAdd)
		{
			BX.bind(this.buttonAdd, 'click', this.onButtonAdd.bind(this));
		}
	};
	Manager.prototype.initNode = function (tileOptionsList, node)
	{
		if (!node)
		{
			return null;
		}

		var id = node.getAttribute('data-id');
		var filtered = tileOptionsList.filter(function (tileOptions) {
			return tileOptions.id.toString() === id;
		}, this);
		if (filtered.length === 0)
		{
			return;
		}

		var tileOptions = filtered[0];
		tileOptions.node = node;
		this.addTile(tileOptions);
	};

	Manager.prototype.onRemove = function (tile, e)
	{
		e.preventDefault();
		e.stopPropagation();
		this.removeTile(tile);
		return false;
	};
	Manager.prototype.onTileClick = function (tile, e)
	{
		e.preventDefault();
		e.stopPropagation();
		this.fire(this.events.tileClick, [tile]);
	};


	Manager.prototype.removeTiles = function ()
	{
		var list = this.list;
		list.forEach(this.removeTile.bind(this));
	};
	Manager.prototype.removeTile = function (tile)
	{
		this.list = BX.util.deleteFromArray(this.list, this.list.indexOf(tile));
		BX.remove(tile.node);
		this.fire(this.events.tileRemove, [tile]);
	};
	Manager.prototype.getTile = function (id)
	{
		var filtered = this.list.filter(function (item) {
			return item.id === id;
		});
		return filtered.length > 0 ? filtered[0] : null;
	};
	Manager.prototype.getTiles = function ()
	{
		return this.list;
	};
	Manager.prototype.addTile = function (options)
	{
		if (!options.node)
		{
			options.node = Helper.getTemplatedNode(this.tileTemplate, {});
		}
		var tile = new namespace.Tile(options);
		if (!tile)
		{
			return null;
		}

		if (!this.tileContainer.contains(tile.node))
		{
			this.tileContainer.appendChild(tile.node);
		}

		BX.bind(tile.node, 'click', this.onTileClick.bind(this, tile));


		this.list.push(tile);
		this.fire(this.events.tileAdd, [tile]);

		return tile;
	};

	Manager.prototype.fire = function (eventName, data)
	{
		BX.onCustomEvent(this, eventName, data);
	};
	Manager.prototype.onButtonAdd = function (e)
	{
		e.preventDefault();
		e.stopPropagation();

		this.fire(this.events.buttonAdd, []);
	};

	var Helper = {
		getObjectByKey:  function (list, key, value)
		{
			var filtered = list.filter(function (item) {
				return (item.hasOwnProperty(key) && item[key] === value);
			});
			return filtered.length > 0 ? filtered[0] : null;
		},
		getNode:  function (role, context)
		{
			var nodes = this.getNodes(role, context);
			return nodes.length > 0 ? nodes[0] : null;
		},
		getNodes: function (role, context)
		{
			if (!context)
			{
				return [];
			}

			return BX.convert.nodeListToArray(context.querySelectorAll('[data-role="' + role + '"]'));
		},
		changeClass: function (node, className, isAdd)
		{
			if (!node)
			{
				return;
			}

			if (isAdd)
			{
				BX.addClass(node, className);
			}
			else
			{
				BX.removeClass(node, className);
			}
		},
		changeDisplay: function (node, isShow)
		{
			if (!node)
			{
				return;
			}

			node.style.display = isShow ? '' : 'none';
		},
		replace: function (text, data, isDataSafe)
		{
			data = data || {};
			isDataSafe = isDataSafe || false;

			if (!text)
			{
				return '';
			}

			for (var key in data)
			{
				if (!data.hasOwnProperty(key))
				{
					continue;
				}

				var value = data[key];
				value = value || '';
				if (!isDataSafe && value)
				{
					value = BX.util.htmlspecialchars(value);
				}
				text = text.replace(new RegExp('%' + key + '%', 'g'), value);
			}
			return text;
		},
		getTemplatedNode: function (templateNode, replaceData, isDataSafe)
		{
			if (!templateNode)
			{
				return null;
			}

			var template = Helper.replace(templateNode.innerHTML, replaceData, isDataSafe);
			var node = document.createElement('div');
			node.innerHTML = template;

			return node.children[0];
		}
	};


	namespace.Manager = Manager;
	namespace.Tile = Tile;

})();

Youez - 2016 - github.com/yon3zu
LinuXploit