PageSourceSearch

http://dvs76.ru/bitrix/cache/js/s1/dvs76/kernel_currency/kernel_currency.js?15409065032669

js dvs76.ru collected 2026-10-04 03:06:41 UTC 2,669 bytes, 128 lines download raw bytes

1; /* /bitrix/js/currency/core_currency.js?14897498862414*/
2
3; /* Start:"a:4:{s:4:"full";s:51:"/bitrix/js/currency/core_currency.js?14897498862414";s:6:"source";s:36:"/bitrix/js/currency/core_currency.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4(function(window) {
5
6if (BX.Currency)
7{
8	return;
9}
10
11BX.Currency = {
12	currencyList: [],
13	defaultFormat: {
14		'FORMAT_STRING': '#',
15		'DEC_POINT': '.',
16		'THOUSANDS_SEP': ' ',
17		'DECIMALS': 2,
18		'HIDE_ZERO': 'N'
19	},
20
21	setCurrencyFormat: function(currency, format, replace)
22	{
23		var index = this.getCurrencyIndex(currency),
24			currencyFormat = BX.clone(this.defaultFormat, true),
25			i;
26
27		replace = !!replace;
28		if (index > -1 && !replace)
29		{
30			return;
31		}
32		if (index === -1)
33		{
34			index = this.currencyList.length;
35		}
36
37		for (i in currencyFormat)
38		{
39			if (currencyFormat.hasOwnProperty(i) && typeof format[i] !== 'undefined')
40			{
41				currencyFormat[i] = format[i];
42			}
43		}
44		this.currencyList[index] = {
45			'currency': currency,
46			'format': BX.clone(currencyFormat, true)
47		};
48	},
49
50	setCurrencies: function(currencies, replace)
51	{
52		var i;
53		if (!!currencies && BX.type.isArray(currencies))
54		{
55			for (i = 0; i < currencies.length; i++)
56			{
57				if (!!currencies[i].CURRENCY && !!currencies[i].FORMAT)
58				{
59					this.setCurrencyFormat(currencies[i].CURRENCY, currencies[i].FORMAT, replace);
60				}
61			}
62		}
63	},
64
65	getCurrencyFormat: function(currency)
66	{
67		var index = this.getCurrencyIndex(currency);
68		return (index > -1 ? this.currencyList[index].format : false);
69	},
70
71	getCurrencyIndex: function(currency)
72	{
73		var i, index = -1;
74		if (this.currencyList.length === 0)
75		{
76			return index;
77		}
78		for (i = 0; i < this.currencyList.length; i++)
79		{
80			if (this.currencyList[i].currency === currency)
81			{
82				index = i;
83				break;
84			}
85		}
86		return index;
87	},
88
89	clearCurrency: function(currency)
90	{
91		var index = this.getCurrencyIndex(currency);
92		if (index > -1)
93		{
94			this.currencyList = BX.util.deleteFromArray(this.currencyList, index);
95		}
96	},
97
98	clean: function()
99	{
100		this.currencyList = [];
101	},
102
103	currencyFormat: function (price, currency, useTemplate)
104	{
105		var result = '',
106			format;
107		useTemplate = !!useTemplate;
108		format = this.getCurrencyFormat(currency);
109		if (!!format && typeof format === 'object')
110		{
111			format.CURRENT_DECIMALS = format.DECIMALS;
112			if (format.HIDE_ZERO === 'Y' && price == parseInt(price, 10))
113			{
114				format.CURRENT_DECIMALS = 0;
115			}
116			result = BX.util.number_format(price, format.CURRENT_DECIMALS, format.DEC_POINT, format.THOUSANDS_SEP);
117			if (useTemplate)
118			{
119				result = format.FORMAT_STRING.replace('#', result);
120			}
121		}
122		return result;
123	}
124};
125})(window);
126
127/* End */
128;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.