AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.144.224.71
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/landing/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/landing//card.js
(function() {
	"use strict";

	BX.namespace("BX.Landing");

	var clone = BX.Landing.Utils.clone;
	var isPlainObject = BX.Landing.Utils.isPlainObject;
	var isEmpty = BX.Landing.Utils.isEmpty;
	var data = BX.Landing.Utils.data;
	var deepFreeze = BX.Landing.Utils.deepFreeze;


	/**
	 * Implements interface for works with cards of block
	 *
	 * @param {HTMLElement} node - Element of Card in Block.
	 * @param {cardManifest} manifest - Manifest of Card in Block.
	 * @param {string} selector - Selector of node
	 * @param {string} [label]
	 * @constructor
	 */
	BX.Landing.Block.Card = function(node, manifest, selector, label)
	{
		this.node = node;
		this.manifest = manifest || {};
		this.selector = selector;
		this.panels = new BX.Landing.UI.Collection.PanelCollection();
		this.form = null;
		this.node.classList.add("landing-card");
		this.label = label;
		this.preset = null;
		this.sortIndex = -1;

		if (isPlainObject(this.manifest.presets) && !isEmpty(this.manifest.presets))
		{
			var presetId = data(this.node, "data-card-preset");

			if (presetId)
			{
				this.preset = clone(this.manifest.presets[presetId]);
				this.preset.id = presetId;
				deepFreeze(this.preset);
			}
		}

		if (!BX.type.isDomNode(this.node))
		{
			throw new Error("BX.Landing.Block.Card: 'node' is not a DOMNode.");
		}

		if (!BX.type.isPlainObject(this.manifest))
		{
			throw new Error("BX.Landing.Block.Card: 'manifest' is not an Object.");
		}
	};


	/**
	 * Creates object.
	 * @static
	 */
	BX.Landing.Block.Card.init = function(node, manifest, selector)
	{
		return new BX.Landing.Block.Card(node, manifest, selector);
	};



	BX.Landing.Block.Card.prototype = {
		/**
		 * Gets card index
		 * @return {int}
		 */
		getIndex: function()
		{
			var index = parseInt(this.selector.split("@")[1]);
			index = BX.type.isNumber(index) ? index : 0;
			return index;
		},


		/**
		 * Gets card name
		 * @return {string}
		 */
		getName: function()
		{
			var name = (this.manifest.name || "") + " " + (this.getIndex() + 1);

			if (this.manifest.label)
			{
				var labelNode = this.node.querySelector("[data-selector*=\""+this.manifest.label+"\"]");

				if (labelNode && labelNode.innerHTML)
				{
					name = labelNode.innerHTML;
				}
			}

			return name;
		},


		getLabel: function()
		{
			return this.label;
		},


		/**
		 * Adds panel into card
		 * @param {BX.Landing.UI.Panel.BasePanel} panel
		 */
		addPanel: function(panel)
		{
			if (!!panel && panel instanceof BX.Landing.UI.Panel.BasePanel && !this.panels.contains(panel))
			{
				this.panels.add(panel);
				this.node.appendChild(panel.layout);
			}
		},


		clone: function()
		{
			return new BX.Landing.Block.Card(
				clone(this.node),
				clone(this.manifest),
				this.selector,
				clone(this.label)
			);
		}
	};
})();

Anon7 - 2022
AnonSec Team