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/yandex.market/ui/input/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/yandex.market/ui/input/dependlist.js
(function(BX, $, window) {

	var Plugin = BX.namespace('YandexMarket.Plugin');
	var Input = BX.namespace('YandexMarket.Ui.Input');

	var constructor = Input.DependList = Plugin.Base.extend({

		defaults: {
			dependElement: null,
			optionElement: 'option',
			fieldElement: '.js-form-field'
		},

		initialize: function() {
			this.callParent('initialize', constructor);
			this.bind();
		},

		destroy: function() {
			this.unbind();
			this.callParent('destroy', constructor);
		},

		bind: function() {
			this.handleDependChange(true);
		},

		unbind: function() {
			this.handleDependChange(false);
		},

		handleDependChange: function(dir) {
			var depend = this.getElement('depend');

			depend[dir ? 'on' : 'off']('change keyup', $.proxy(this.onDependChange, this));
		},

		onDependChange: function(evt) {
			var value = evt.target.value;

			this.updateAvailable(value);
		},

		updateAvailable: function(value) {
			var optionList = this.getElement('option');
			var option;
			var availableList;
			var isAvailable;
			var i;
			var needResetSelected;
			var firstAvailable;
			var availableCount = 0;

			for (i = optionList.length - 1; i >= 0; i--) {
				option = optionList.eq(i);
				availableList = (option.data('available').split(',') || '');
				isAvailable = (availableList.indexOf(value) !== -1);

				if (isAvailable) {
					firstAvailable = option;
					option.prop('disabled', false);
					option.prop('hidden', false);
					availableCount++;
				} else {
					option.prop('disabled', true);
					option.prop('hidden', true);

					if (option.prop('selected')) {
						needResetSelected = true;
						option.prop('selected', false);
					}
				}
			}

			if (needResetSelected && firstAvailable) {
				firstAvailable.prop('selected', true);
			}

			this.updateFieldView(availableCount > 1);
		},

		updateFieldView: function(dir) {
			var field = this.getElement('field', this.$el, 'closest');

			field.toggleClass('is--hidden', !dir);
		}

	}, {
		dataName: 'UiInputDependList'
	});

})(BX, jQuery, window);

Youez - 2016 - github.com/yon3zu
LinuXploit