PageSourceSearch

https://cdnn.1prime.ru//js/libs/quotes.js

js 1prime.ru collected 2026-10-01 08:35:41 UTC 36,218 bytes, 953 lines download raw bytes

1let CURRENCY_RATES_BANKS = {};
2let CURRENCY_RATES_CB = null;
3let CURRENCY_RATES_FOREX = null;
4
5function getCurrencyRatesBanks(code) {    
6    if (!CURRENCY_RATES_BANKS[code]) {
7        const currency = code === 'USD' ? 'prime_prq_curs_jsonp': 'prime_prq_cure_jsonp';
8        CURRENCY_RATES_BANKS[code] = $.getJSON('https://webservice.1prime.ru/pttable?host=1prime.ru&encoding=utf-8&template='+currency+'&time='+Date.now());
9    }
10
11    return CURRENCY_RATES_BANKS[code];
12}
13
14function getCurrencyRatesCb() {    
15    if (!CURRENCY_RATES_CB) {
16        CURRENCY_RATES_CB = $.getJSON('https://webservice.1prime.ru/pttable?host=1prime.ru&encoding=utf-8&template=prime_cbcur_jsonp&time='+Date.now());
17    }
18
19    return CURRENCY_RATES_CB;
20}
21
22function getCurrencyRatesForex() {    
23    if (!CURRENCY_RATES_FOREX) {
24        CURRENCY_RATES_FOREX = $.getJSON('https://webservice.1prime.ru/pttable?host=1prime.ru&encoding=utf-8&template=prime_fxcur_jsonp&time='+Date.now());
25    }
26
27    return CURRENCY_RATES_FOREX;
28}
29
30// Виждет котировок
31$(function() {
32    var container = $('.cell-quotes');
33	var selected = null;
34	var rURL = [];
35    
36    if (!container.length) {
37        return
38    }
39
40	function chartDraw(uRLS,sID) {
41		uRLS.forEach( function (item, counter, arr) {
42			if ( item.id == sID ) {
43				jRes = $.getJSON(item.URL)
44				.done( function(jRes){
45					var chartData = [];
46
47					jRes.candles.forEach( function (item, counter, arr) {
48						chartData.push([item.Date, item.Close]);
49					});
50
51					// Настраиваем опции локализации графика
52					Highcharts.setOptions({
53						lang: {
54							months: ['01', '02', '03', '04', '05', '06',  '07', '08', '09', '10', '11', '12'],
55							weekdays: [ 'Воскресенье','Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
56							downloadSVG: "Скачать как SVG",
57							shortMonths: ['01', '02', '03', '04', '05', '06',  '07', '08', '09', '10', '11', '12'],
58						},
59						global: { useUTC: false }
60					});
61
62                    var lines = $('.quotations-widget__line').filter('[data-id="' + sID + '"]');
63
64                    lines.siblings().removeClass('m-active');
65                    lines.siblings('.quotations-widget__chart-container').remove();
66                    
67                    lines.each(function() {
68                        $(this)
69                            .addClass('m-active')
70                            .after('<div class="quotations-widget__chart-container"></div>');
71                    })
72                        
73					// Рисуем график
74                    lines.siblings('.quotations-widget__chart-container').each(function() {
75                        $(this).highcharts('StockChart', {
76                            loading: {
77                                style: { backgroundColor: '#254c98'},
78                                labelStyle: { color: 'white' }
79                            },
80    
81                            chart: {
82                                marginTop: -1,
83                                marginLeft: -1,
84                                marginRight: -1,
85                                marginBottom: 4,
86                                backgroundColor: 'transparent'
87                            },
88
89                            credits: {
90                                enabled:false
91                            },
92    
93                            rangeSelector: { //верхняя навигация периода
94                                selected: 0,
95                                enabled:false,
96                            },
97    
98                            navigator: {
99                                enabled:false,
100                            },
101
102                            series: {
103                                color: "red",
104                                data: [],
105                            },
106    
107                            navigation: {
108                                buttonOptions: { enabled:false },
109                            },
110    
111                            legend: {
112                                enabled: false,
113                            },
114    
115                            xAxis: [{
116                                tickPositioner: function(min, max) {
117                                    var ticks = [],
118                                        left = this.left,
119                                        width = this.width,
120                                        step = width / 3,
121                                        end = left + width;
122    
123                                    ticks.info = this.tickPositions.info;
124                                    ticks.push(min);
125    
126                                    for (var i = left + step; i < end; i += step) {
127                                        ticks.push(this.toValue(i));
128                                    }
129    
130                                    if (ticks.length < 4) {
131                                        ticks.push(max);
132                                    }
133
134                                    return ticks;
135                                },
136                                formatter() {
137                                    if(this.isFirst || this.isLast) {
138                                        return ''
139                                    } else {
140                                        return this.value
141                                    }
142                                },
143                                labels: {
144                                    y: 0,
145                                    x: 0,
146                                    style:{
147                                        "font-size": "12px",
148                                        "font-family": "RobotoFlex",
149                                        "color": "#9B9B9B"
150                                    }
151                                },
152                                gridLineWidth: 1,
153                                lineWidth: 0,
154                                tickWidth: 0
155                            }],
156    
157                            yAxis: [{
158                                tickPositioner: function(min, max) {
159                                    var ticks = [],
160                                        left = this.left,
161                                        width = this.width,
162                                        step = width / 3,
163                                        vStep = (max - min) / 3,
164                                        vState = min,
165                                        end = left + width;
166    
167                                    ticks.info = this.tickPositions.info;
168                                    ticks.push(min);
169                                    for (var i = left + step; i < end; i += step) {
170                                        ticks.push(vState += vStep);
171                                    }
172    
173                                    if (ticks.length < 4) {
174                                        ticks.push(max);
175                                    }
176                                    return ticks;
177                                },
178    
179                                labels: { enabled : false },
180                                height: "83%",
181                                top: "1%",
182                                maxPadding: 0.1,
183                                minPadding: 0.1,
184                                endOnTick: false,
185                                lineWidth: 0
186                            }],
187
188                            tooltip: {
189                                useHTML: true,
190                                backgroundColor: '#28A6FF',
191                                borderWidth: 0,
192                                borderRadius: 0,
193                                style: {
194                                    "color": "white",
195                                    "cursor": "default",
196                                    "fontSize": "12px",
197                                    "padding": "8px",
198                                },
199                                formatter: function() {
200                                    var x = new Date(this.x);
201    
202                                    var date = x.getDate();
203                                    if (date < 10) date = '0'+date;
204    
205                                    var month = (x.getMonth() + 1);
206                                    if (month < 10) month = '0'+month;
207    
208                                    x = date + '.' + month + '.' + x.getFullYear();
209                                    return '<div>' + x + '</div>' + '<div style="font-size: 14px; font-weight: 600; text-align: center;">' + parseFloat(this.y).toFixed(2) + '</div>';
210                                }
211                            },
212    
213                            credits: { enabled: false },
214    
215                            scrollbar: { enabled:false },
216    
217                            series: [{
218                                pointStart: 5000,
219                                id: 'main_graph',
220                                type: 'line',
221                                name: 'chart',
222                                data: chartData,
223                                color: "#28A6FF",
224                                pointInterval: 36e5 * 24,
225                                dataGrouping:{ enabled:false },
226                                fillColor : {
227                                    linearGradient : [0,0,0,300],
228                                    stops : [
229                                        [0, "rgba(133, 0, 82, 1)"], //цвет и прозрачность области под графиком
230                                        [1, Highcharts.Color("#850052").setOpacity(0).get('rgba')]
231                                    ]
232                                },
233                                threshold: null,
234                            }]
235                        });
236                    })
237				})
238
239				.fail(function(jqxhr, textStatus, error) {
240					var err = textStatus + ', ' + error;
241					console.log( "Request Failed: " + err);
242				});
243			};
244		});
245	};
246
247	function refresh() {
248		rURL = [];
249		var jR = $.getJSON('https://site.birweb.1prime.ru/svc/companyTicker/pttable?days=30&pairs=USDRUBF:MOEX&pairs=EURRUBF:MOEX&pairs=BTC:MOEX&pairs=ETH:MOEX&pairs=IMOEX:MOEX&pairs=RTSI:MOEX&pairs=BR:MOEX&pairs=NG:MOEX&pairs=GLDRUBF:MOEX')
250			.done(function(jR) {
251				jR.forEach( function (item, counter, arr) {
252					var formattedHtml = '<div class="stock-name">' + item.short_name + '</div>' +
253										'<div class="stock-value">' + parseFloat(item.value).toFixed(2) + '</div>' +
254										'<div class="' + (item.diff >= 0 ? 'value-up' : 'value-down') + '">' + parseFloat(Math.abs(item.diff)).toFixed(2) + '%</div>'+
255										'<div class="stock-time">' + item.time + '</div>';
256
257					$('.quotations-widget__line[data-id="' + item.id + '"]').html(formattedHtml);
258
259					rURL.push({
260						id : item.id,
261						sname: item.short_name,
262						URL : 'https://site.birweb.1prime.ru/svc/companyTicker/histcandles?days=30&pair='+item.id,
263						name : item.name,
264						formattedHtml: formattedHtml
265					});
266
267					if (!selected && item.id == 'USDRUBF:MOEX') { // by default
268						selected = item.id;
269					}
270				});
271
272				chartDraw(rURL, selected);
273			})
274
275			.fail(function(jqxhr, textStatus, error) {
276				var err = textStatus + ', ' + error;
277				console.log( "Request Failed: " + err);
278			});
279
280		setTimeout(refresh, 1000 * 60);
281	}
282
283	$('.quotations-widget__line').click(function(e) {
284		selected = e.currentTarget.dataset.id;
285		chartDraw(rURL, selected);
286	});
287
288	refresh();
289});
290
291// График Tradingview
292$(function() {
293    $('.chart-tradingview').each(function() {
294        var container = $(this);
295        var exchange = container.data('exchange');
296        var ticker = container.data('ticker');
297        var id = Date.now();
298
299        container.html(`
300            <div id="tradingview_${id}"></div>
301
302            <div class="tradingview-widget-copyright">
303                <a href="https://ru.tradingview.com/symbols/${ticker}/?exchange=${exchange}" rel="noopener" target="_blank">
304                    <span class="blue-text">График ${ticker}</span>
305                </a>
306                от TradingView
307            </div>
308        `)
309
310        new TradingView.widget({
311            autosize: true,
312            symbol: `${exchange}:${ticker}`,
313            interval: "D",
314            timezone: "Europe/Moscow",
315            theme: "light",
316            style: "3",
317            locale: "ru",
318            toolbar_bg: "#2961b5",
319            enable_publishing: false,
320            container_id: `tradingview_${id}`,
321        });
322    })
323})
324
325// Курсы основных валютных пар FOREX
326$(function() {
327    var titles = {
328        "USD/RUB": "Курс доллара на Форекс",
329        "AUD/USD": "Курс австралийского доллара к доллару США",
330        "EUR/AUD": "Курс евро к австралийскому доллару",
331        "EUR/GBP": "Курс евро к британскому фунту",
332        "GBP/CHF": "Курс британского фунта к швейцарскому франку",
333        "USD/CAD": "Курс доллара США к канадскому доллару",
334        "EUR/RUB": "Курс евро на Форекс",
335        "CAD/JPY": "Курс канадского доллара к японской иене",
336        "EUR/CAD": "Курс евро к канадскому доллару",
337        "EUR/JPY": "Курс евро к японской иене",
338        "GBP/JPY": "Курс британского фунта к японской иене",
339        "USD/CHF": "Курс доллара США к швейцарскому франку",
340        "AUD/JPY": "Курс австралийского доллара к японской иене",
341        "CHF/JPY": "Курс швейцарского франка к японской иене",
342        "EUR/CHF": "Курс евро к швейцарскому франку",
343        "EUR/USD": "Курс евро к доллару США",
344        "GBP/USD": "Курс британского фунта к доллару США",
345        "USD/JPY": "Курс доллара США к японской иене"
346    }
347
348	function refreshForex(table) {
349		if (!table.length) return;
350
351        const title = table.data('title') || 'Курсы основных валютных пар FOREX';
352        const list = table.data('list') ? table.data('list').split(',') : Object.keys(titles);
353
354		table.addClass('loading');
355
356		getCurrencyRatesForex().done(function(data) {
357                var tbody = '';
358				$.each(data, function(i, ticker) {
359                    if (!list.includes(ticker.id)) {
360                        return
361                    }
362
363                    var url = `/charts_${ticker.id.toLowerCase().replace('/','_')}`;
364					tbody += `
365                        <tr>
366                            <td>
367                                <a href="${url}">
368                                    ${titles[ticker.id]}
369                                </a>
370                            </td>
371                            <td>
372                                <a href="${url}">
373                                    ${ticker.id}
374                                </a>
375                            </td>
376                            <td>${ticker.value}</td>
377                            <td>${ticker.diff}%</td>
378                            <td>${ticker.time}</td>
379                        </tr>
380                    `;
381				});
382                table.html(`
383                    <div class="article__table-title">
384                        ${title}
385                    </div>
386                    <div class="article__table-wr">
387                        <table>
388                            <tbody>
389                                <tr class="color-bg">
390                                    <td colspan="2">Валютная пара</td>
391                                    <td>Курс</td>
392                                    <td>Изменение</td>
393                                    <td>Время</td>
394                                </tr>
395                                ${tbody}
396                            </tbody>
397                        </table>
398                    </div>`);
399			})
400			.always(function() {
401				table.removeClass('loading');
402			});
403	}
404
405    $('.table-forex').each(function() {
406        var table = $(this);
407
408        refreshForex(table);
409    })
410})
411
412// График ЦБ
413$(function() {
414    var table = $('.table-ticker'),
415        tickerId = table.data('ticker');
416
417    if (!table.length && !tickerId) {
418        return
419    }
420
421	function drawChart(data) {
422		var chartData = [],
423			timeOffset = 24 * 3600 * 1000;
424
425		data.candles.forEach(function (item, counter, arr) {
426			chartData.push([item.Date, item.Close]);
427		});
428
429		Highcharts.setOptions({
430			lang: {
431				months: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
432				weekdays: [ 'Воскресенье','Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
433				downloadSVG: 'Скачать как SVG',
434				shortMonths: ['янв.', 'февр.', 'мар.', 'апр.', 'май', 'июн.', 'июл.', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.'],
435			}
436		});
437
438		// Рисуем график
439		$('.chart-cb__chart').highcharts('StockChart', {
440			loading: {
441				style: { backgroundColor: 'silver'},
442				labelStyle: { color: 'white' }
443			},
444
445			rangeSelector: {
446				enabled: false
447			},
448
449			tooltip: {
450                useHTML: true,
451                backgroundColor: '#28A6FF',
452                borderWidth: 0,
453                borderRadius: 0,
454                style: {
455                    "color": "white",
456                    "cursor": "default",
457                    "fontSize": "12px",
458                    "padding": "8px",
459                },
460                formatter: function() {
461                    var x = new Date(this.x);
462
463                    var date = x.getDate();
464                    if (date < 10) date = '0'+date;
465
466                    var month = (x.getMonth() + 1);
467                    if (month < 10) month = '0'+month;
468
469                    x = date + '.' + month + '.' + x.getFullYear();
470                    return '<div>' + x + '</div>' + '<div style="font-size: 14px; font-weight: 600; text-align: center;">' + parseFloat(this.y).toFixed(2) + '</div>';
471                }
472			},
473
474			credits: { enabled: false },
475
476			scrollbar: { enabled: false },
477
478			navigator: {
479				series: {
480					fillOpacity: 1,
481					lineWidth: 0,
482					fillColor: 'rgba(48, 99, 187, .07)'
483				},
484			},
485
486			timezoneOffset: 3,
487
488			series: [{
489				pointStart: 5000,
490				id: 'main_graph',
491				type: 'line',
492				name: 'chart',
493				data: chartData,
494				color: '#28A6FF',
495				pointInterval: 36e5 * 24, // 36e5 one hour * 24 = one day
496				dataGrouping: { enabled: false },
497				threshold: null
498			}],
499
500			xAxis: {
501				min: new Date().setFullYear(new Date().getFullYear() - 1)
502			},
503		});
504	};
505
506	function updateInfo(ticker) {
507		$('.chart-cb__head').html(`
508            <div class="chart-cb__head-value">${ticker.value}</div>
509            <div class="chart-cb__head-diff ${ticker.diff < 0 ? 'm-down': 'm-up'}">${Math.abs(ticker.value - ticker.prev).toFixed(4)} (${ticker.diff}%)</div>
510            <div class="chart-cb__head-time">${ticker.date}</div>
511        `);
512	}
513
514	function updateTable(data) {
515		var tbody = '';
516        var title = table.data('title') ? `<div class="article__table-title">${table.data('title')}</div>` : '';
517
518		for (var i = data.candles.length; --i >= data.candles.length - 10;) {
519			var candle = {
520				prev: data.candles[i - 1] ? data.candles[i - 1] : data.candles[i],
521				curr: data.candles[i]
522			};
523
524			var x = new Date(candle.curr.Date);
525
526			var date = x.getDate(x.setDate(x.getDate() + 1));
527			if (date < 10) date = '0' + date;
528
529			var month = x.getMonth() + 1;
530			if (month < 10) month = '0' + month;
531
532			x = date + '.' + month + '.' + x.getFullYear();
533
534			var diff = ((candle.curr.Close - candle.prev.Close) / candle.prev.Close) * 100;
535
536            tbody += `
537                <tr>
538                    <td>${x}</td>
539                    <td>${candle.curr.Close}</td>
540                    <td>${diff.toFixed(2)}%</td>
541                </tr>
542            `;
543		};
544
545        table.html(`
546            ${title}
547            <div class="article__table-wr">
548                <table>
549                    <tbody>
550                        <tr class="color-bg">
551                            <td>Дата</td>
552                            <td>Курс</td>
553                            <td>Изменение</td>
554                        </tr>
555                        ${tbody}
556                    </tbody>
557                </table>
558            </div>`);
559	}
560
561	function refresh() {
562		table.addClass('loading');
563
564		$.getJSON('https://webservice.1prime.ru/pttable?host=1prime.ru&encoding=utf-8&template=prime_cbcur2_jsonp&time=' + Date.now())
565			.then(function(data) {
566				var ticker = null;
567				
568                $.each(data, function(i, t) {
569					if (t.id == tickerId) {
570						ticker = t;
571						updateInfo(ticker);
572						return false;
573					}
574				});
575
576				return $.getJSON('https://webservice.1prime.ru/histcandles?period=1440&ClientID=histcandles_cur_site&field=' + ticker.field + '&note=' + ticker.note + '&sheet=' + ticker.sheet + '&time=0') // time is period
577			})
578			.then(function(data) {
579				updateTable(data);
580				drawChart(data);
581			})
582			.always(function() {
583				table.removeClass('loading');
584			});
585	}
586
587    $('.chart-cb').each(function() {
588        var container = $(this);
589
590        container.html(`
591            <div class="chart-cb__head"></div>
592            <div class="chart-cb__chart"></div>
593        `);
594    });
595
596    refresh();
597})
598
599// Курсы валют ЦБ РФ
600$(function() {
601    var titles = {
602        "AUD": {
603            "title": "Австралийский доллар",
604            "amount": "1"
605        },
606        "AZN": {
607            "title": "Азербайджанский манат",
608            "amount": "1"
609        },
610        "AMD": {
611            "title": "Армянский драм",
612            "amount": "100"
613        },
614        "BYN": {
615            "title": "Белорусский рубль",
616            "amount": "1"
617        },
618        "BGN": {
619            "title": "Болгарский лев",
620            "amount": "1"
621        },
622        "BRL": {
623            "title": "Бразильский реал",
624            "amount": "1"
625        },
626        "HUF": {
627            "title": "Венгерский форинт",
628            "amount": "100"
629        },
630        "KRW": {
631            "title": "Вон Республики Корея",
632            "amount": "1000"
633        },
634        "HKD": {
635            "title": "Гонконгский доллар",
636            "amount": "10"
637        },
638        "DKK": {
639            "title": "Датская крона",
640            "amount": "1"
641        },
642        "USD": {
643            "title": "Доллар США",
644            "amount": "1"
645        },
646        "EUR": {
647            "title": "Евро",
648            "amount": "1"
649        },
650        "INR": {
651            "title": "Индийский рупи",
652            "amount": "100"
653        },
654        "KZT": {
655            "title": "Казахстанский тенге",
656            "amount": "100"
657        },
658        "CAD": {
659            "title": "Канадский доллар",
660            "amount": "1"
661        },
662        "KGS": {
663            "title": "Киргизский сом",
664            "amount": "100"
665        },
666        "CNY": {
667            "title": "Китайский юань",
668            "amount": "1"
669        },
670        "MDL": {
671            "title": "Молдавский лей",
672            "amount": "10"
673        },
674        "TMT": {
675            "title": "Новый туркменский манат",
676            "amount": "1"
677        },
678        "NOK": {
679            "title": "Норвежская крона",
680            "amount": "10"
681        },
682        "PLN": {
683            "title": "Польский злотый",
684            "amount": "1"
685        },
686        "RON": {
687            "title": "Румынский лей",
688            "amount": "1"
689        },
690        "XDR": {
691            "title": "СДР (специальные права заимствования)",
692            "amount": "1"
693        },
694        "SGD": {
695            "title": "Сингапурский доллар",
696            "amount": "1"
697        },
698        "TJS": {
699            "title": "Таджикский сомони",
700            "amount": "10"
701        },
702        "TRY": {
703            "title": "Турецких лир",
704            "amount": "10"
705        },
706        "UZS": {
707            "title": "Узбекский сум",
708            "amount": "10000"
709        },
710        "UAH": {
711            "title": "Украинская гривна",
712            "amount": "10"
713        },
714        "GBP": {
715            "title": "Фунт стерлингов Соединенного королевства",
716            "amount": "1"
717        },
718        "CZK": {
719            "title": "Чешская крона",
720            "amount": "10"
721        },
722        "SEK": {
723            "title": "Шведская крона",
724            "amount": "10"
725        },
726        "CHF": {
727            "title": "Швейцарский франк",
728            "amount": "1"
729        },
730        "ZAR": {
731            "title": "Южноафриканский рэнд",
732            "amount": "10"
733        },
734        "JPY": {
735            "title": "Японская иена",
736            "amount": "100"
737        }
738    }
739
740	function refresh(table) {
741		table.addClass('loading');
742
743		getCurrencyRatesCb()
744			.done(function(data) {
745                var tbody = '';
746				
747                $.each(data, function(i, ticker) {
748                    var url = `/charts_${ticker.id.toLowerCase()}_cb`;
749
750					tbody += `
751                        <tr>
752                            <td>
753                                <a href="${url}">
754                                    ${ticker.id}
755                                </a>
756                            </td>
757                            <td>
758                                <a href="${url}">
759                                    ${titles[ticker.id].title}
760                                </a>
761                            </td>
762                            <td>${titles[ticker.id].amount}</td>
763                            <td>${ticker.value}</td>
764                            <td>${ticker.diff}%</td>
765                        </tr>
766                    `;
767				});
768
769                table.html(`
770                            <div class="article__table-title">
771                                Курсы валют ЦБ РФ на ${data[0].date.replace(/\//g, '.')}
772                            </div>
773                            <div class="article__table-wr m-short">
774                                <table>
775                                    <tbody>
776                                        <tr class="color-bg">
777                                            <td>
777Код</td>
778                                            <td>Валюта</td>
779                                            <td>Кол-во</td>
780                                            <td>Курс</td>
781                                            <td>Изменение</td>
782                                        </tr>
783                                        ${tbody}
784                                    </tbody>
785                                </table>
786                            </div>
787                            <div class="article__table-more">
788                                Показать еще
789                                <svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" viewBox="0 0 25 24" fill="none">
790                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M20.9332 7.50269C21.2409 7.81028 21.2409 8.30898 20.9332 8.61658L13.0569 16.493C12.7493 16.8005 12.2506 16.8005 11.943 16.493L4.06663 8.61658C3.75904 8.30899 3.75904 7.81028 4.06663 7.50269C4.37422 7.1951 4.87293 7.1951 5.18052 7.50269L12.4999 14.8221L19.8193 7.50269C20.127 7.1951 20.6257 7.1951 20.9332 7.50269Z" fill="#2961B5"/>
791                                </svg>
792                            </div>`);
793			})
794			.always(function() {
795				table.removeClass('loading');
796			});
797	}
798
799    $('.table-cb').each(function() {
800        var container = $(this);
801
802        refresh(container);
803    })
804
805    $('.table-cb').on('click', '.article__table-more', function() {
806        $(this).parent().find('.article__table-wr').removeClass('m-short');
807    })
808})
809
810// Курс в банках
811$(function() {
812	function refresh(table) {
813		getCurrencyRatesBanks(table.data('currency'))
814            .done(function(data) {
815                const bestBuy = _.sortBy(data, 'value').reverse()[0];
816                const bestSell = _.sortBy(data, 'diff')[0];
817
818                table.html(`
819                            <div class="article__table-title">
820                                ${table.data('title')}
821                            </div>
822                            <div class="article__table-wr">
823                                <table>
824                                    <tbody>
825                                        <tr class="color-bg">
826                                            <td>Банк</td>
827                                            <td>Курс</td>
828                                            <td>Время</td>
829                                        </tr>
830                                        <tr>
831                                            <td><div class="best-rate-title">Лучший курс покупки</div> ${bestBuy.short_name}</td>
832                                            <td>${bestBuy.value}</td>
833                                            <td>${bestBuy.time}</td>
834                                        </tr>
835                                        <tr>
836                                            <td><div class="best-rate-title">Лучший курс продажи</div> ${bestSell.short_name}</td>
837                                            <td>${bestSell.value}</td>
838                                            <td>${bestSell.time}</td>
839                                        </tr>
840                                    </tbody>
841                                </table>
842                            </div>`);
843			})
844	}
845
846    $('.table-banks-best').each(function() {
847        var container = $(this);
848
849        refresh(container);
850    })
851})
852
853// Данные по банкам
854$(function() {
855	function refresh(table) {
856        getCurrencyRatesBanks(table.data('currency')).done(function(data) {
857            let tbody = ''
858
859            $.each(data, function(i, bank) {
860                tbody += `
861                    <tr>
862                        <td>
863                            ${bank.short_name}
864                        </td>
865                        <td>
866                            ${bank.value}
867                        </td>
868                        <td>${bank.diff}</td>
869                        <td>${bank.time}</td>
870                    </tr>
871                `;
872            });
873    
874            table.html(`
875                        <div class="article__table-title">
876                            ${table.data('title')}
877                        </div>
878                        <div class="article__table-wr m-short">
879                            <table>
880                                <tbody>
881                                    <tr class="color-bg">
882                                        <td>Банк</td>
883                                        <td>Покупка</td>
884                                        <td>Продажа</td>
885                                        <td>Время</td>
886                                    </tr>
887                                    ${tbody}
888                                </tbody>
889                            </table>
890                        </div>
891                        <div class="article__table-more">
892                            Показать еще
893                            <svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" viewBox="0 0 25 24" fill="none">
894                                <path fill-rule="evenodd" clip-rule="evenodd" d="M20.9332 7.50269C21.2409 7.81028 21.2409 8.30898 20.9332 8.61658L13.0569 16.493C12.7493 16.8005 12.2506 16.8005 11.943 16.493L4.06663 8.61658C3.75904 8.30899 3.75904 7.81028 4.06663 7.50269C4.37422 7.1951 4.87293 7.1951 5.18052 7.50269L12.4999 14.8221L19.8193 7.50269C20.127 7.1951 20.6257 7.1951 20.9332 7.50269Z" fill="#2961B5"/>
895                            </svg>
896                        </div>`);
897        })
898    }
899
900    $('.table-banks').each(function() {
901        var container = $(this);
902
903        refresh(container);
904    })
905
906    $('.table-banks').on('click', '.article__table-more', function() {
907        $(this).parent().find('.article__table-wr').removeClass('m-short');
908    })
909})
910
911$(function() {
912    function colorBadge(value) {
913        return value > 0 ? 'green' : 'red';
914    }
915    function formatDate(date) {
916        return date.replace(/\//g, '.');
917    }
918    function refresh(container) {
919        const currency = container.data('currency');
920
921        $.when(getCurrencyRatesBanks(currency), getCurrencyRatesCb(), getCurrencyRatesForex()).done(function(data1, data2, data3) {
922            const bestBanks = _.sortBy(data1[0], 'value').reverse()[0];
923            const bestCb = data2[0].filter(i => i.id === currency)[0];
924            const bestForex = data3[0].filter(i => i.id === `${currency}/RUB`)[0];
925
926            container.html(`
927                <div class="currency-compare__item">
928                    <div class="currency-compare__title">Лучший курс покупки в банках</div>
929                    <div class="currency-compare__date">${formatDate(bestBanks.date)}</div>
930                    <div class="currency-compare__value">${bestBanks.value.toFixed(2)} руб</div>
931                </div>
932    
933                <div class="currency-compare__item">
934                    <div class="currency-compare__title">Курс покупки ЦБ</div>
935                    <div class="currency-compare__date">${formatDate(bestCb.date)}</div>
936                    <div class="currency-compare__value">${bestCb.value.toFixed(2)} руб <span class="m-${colorBadge(bestCb.diff)}">${bestCb.diff}</span></div>
937                </div>
938    
939                <div class="currency-compare__item">
940                    <div class="currency-compare__title">Курс покупки Forex</div>
941                    <div class="currency-compare__date">${formatDate(bestForex.date)}</div>
942                    <div class="currency-compare__value">${bestForex.value.toFixed(2)} руб <span class="m-${colorBadge(bestForex.diff)}">${bestForex.diff}</span></div>
943                </div>
944            `)
945        })
946    }
947
948    $('.currency-compare').each(function() {
949        var container = $(this);
950
951        refresh(container);
952    })
953})

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.