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/plugin/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

	'use strict';

	var Plugin = BX.namespace('YandexMarket.Plugin');
	var Utils = BX.namespace('YandexMarket.Utils');

	function Base(element, options) {
		this.setOrigin(element);

		this.options = $.extend(true, {}, this.constructor.defaults || this.defaults, this.$el.data());

		this.setOptions(options);
		this.initVars();
		this.initialize();
	}

	Plugin.Base = Base;

	$.extend(true, Base, {

		dataName: null,

		extend: function(protoProps, staticProps) {
			var parent = this;
            var child = function() {
                return Base.apply(this, arguments);
            };

            return Utils.inherit(parent, child, protoProps, staticProps);
		},

		getInstance: function(element, isDisableCreate) {
			var dataName = this.dataName;
			var elementNode;
			var result;

			if (dataName) {
				elementNode = element instanceof $ ? element[0] : element;
				result = $.data(elementNode, dataName);

				if (!result && !isDisableCreate) {
					result = new this(element);
				}
			}

			return result;
		}

	});

	$.extend(true, Base.prototype, {

		defaults: {},

		initVars: function() {},

		initialize: function() {},

		destroy: function() {
			this.releaseOrigin();
		},

		getParent: function(key, constructor) {
			var parent;
			var result;

			if (!constructor) { constructor = this.constructor; }

			parent = constructor.prototype.__super__;

			if (!parent) {
				// nothing
			} else if (key in parent) {
				result = parent[key];
			} else if (parent.constructor) {
				result = this.getParent(key, parent.constructor);
			}

			return result;
		},

		callParent: function(method, args, constructor) {
			var fn;

			if (typeof args === 'function') {
				constructor = args;
				args = null;
			}

			fn = this.getParent(method, constructor);

			return fn && fn.apply(this, args);
		},

		getStatic: function(key) {
			return this.constructor[key];
		},

		releaseOrigin: function() {
			var dataName = this.getStatic('dataName');

			if (this.el && dataName) {
				$.removeData(this.el, dataName);
			}

			this.$el = null;
			this.el = null;
		},

		setOrigin: function(element) {
			var dataName = this.getStatic('dataName');

			this.$el = $(element);
			this.el = this.$el.get(0);

			if (dataName && this.el) {
				$.data(this.el, dataName, this);
			}
		},

		setOptions: function(options) {
			this.options = $.extend(true, this.options, options);
		},

		getElement: function(key, context, method) {
			var selector = this.getElementSelector(key);

			return this.getNode(selector, context, method);
		},

		getElementSelector: function(key) {
			var optionKey = key + 'Element';

			return this.options[optionKey];
		},

		getTemplate: function(key) {
			var optionKey = key + 'Template';
			var option = this.options[optionKey];
			var result;

			if (option && /^[#.][\w+-_]+$/.test(option)) {
				result = this.getNode(option).html();
			} else {
				result = option;
			}

			return result;
		},

		getNode: function (selector, context, method) {
			var result;

			if (selector.substr(0, 1) === '#') { // is id query
				context = $(document);
				method = 'find';
			} else {
				if (!context) { context = this.$el }
			}

			if (method) {
				result = context[method](selector);
			} else {
				result = context.find(selector);
			}

			return result;
		},

		getLang: function(key, replaces) {
			var langKey;
			var optionKey = 'lang' + key.substr(0, 1).toUpperCase() + key.substr(1).toLowerCase();
			var result;

			if (this.options.lang != null && key in this.options.lang) {
				result = this.options.lang[key];
			} else if (optionKey in this.options) {
				result = this.options[optionKey];
			} else {
				langKey = this.options.langPrefix + key;
				result = BX.message(langKey) || '';
			}

			if (result && replaces) {
				result = Utils.compileTemplate(result, replaces);
			}

			return result;
		}

	});

})(BX, jQuery, window);

Youez - 2016 - github.com/yon3zu
LinuXploit