The Central Bank of Russian Federation (2024)

')); var nexButton = $(''); if (firstDateExist.NextWeekExist != null) { nexButton.click(function () { LoadCursPanel(firstDateExist.NextWeekExist, valId); }); } header.append(nexButton); RootTbl.append(header); var table = $('

'); var has_first_day = true; $.each(data, function (index, k) { var tr = $('

'); var diff_color = ''; var diff_sign = ''; if (k.diff > 0) { diff_color = 'class="_red"'; diff_sign = '+'; } if (k.diff < 0) { diff_color = 'class="_green"'; } if (has_first_day & k.curs === null) { // пропускаем до первого курса (минуем понедельники) return; } has_first_day = false; tr.append($('

' + moment(k.data).format("ddd") + '

')); tr.append($('

' + moment(k.data).format("DD.MM") + '

')); tr.append($('

' + (k.curs === null ? ' — ' : number_format(k.curs, 4, ',', ' ') + '₽') + '

')); if (k.diff === null) { tr.append($('

')); } else { tr.append($('

' + diff_sign + number_format(k.diff, 4, ',', ' ') + '₽

')); } table.append(tr); }); RootTbl.append(table); RootTbl.append($('

' + (IsEng ? 'Bank of Russia official exchange rates' : 'Официальный курс Банка России') + '

')); }).fail(function (xhr, textStatus, errorThrown) { var RootTbl = $("#V_" + valId); RootTbl.empty(); var Err = xhr.statusText; RootTbl.append($("

" + (IsEng ? "Error: " + Err + ", try refresh the page" : "Ошибка: " + Err + ", попробуйте обновить страницу") + "

")); }); } function number_format(number, decimals, dec_point, separator) { number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof separator === 'undefined') ? ',' : separator, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) { var k = Math.pow(10, prec); return '' + (Math.round(n * k) / k) .toFixed(prec); }; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) .split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '') .length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1) .join('0'); } return s.join(dec); }});//]]

");}function AutoTabSelect() { $(".tab").click(function (e) { firstLoad = true; var tabid = $(this).data("tabs-tab"); $.cookie("SelectedTab", tabid, { expires: 1 }); }); if ($.cookie("SelectedTab") !== undefined) { var tabidSelect = $.cookie("SelectedTab"); var tabObj = $(".d-md-block * [data-tabs-tab='" + tabidSelect + "']"); if (tabObj.length !== 0) { tab_id = tabidSelect; //tabObj.trigger('open-tab'); tabObj.click(); //$(".tab").removeClass("_active"); //tabObj.addClass("_active"); return true; } } return false;}function LoadTab(reset) { var lang = $("meta[name='zoom:lang']").attr("content"); moment.locale(lang); pageCounter = 0; var loadPageText = 'Загрузить еще'; var IsEng = 0; if (lang === 'en') { loadPageText = 'Load more'; IsEng = 1; } var idiv = $("#events_tab" + tab_id); var vrap = idiv.parent(); if (vrap.children(".more-button").length > 0 && reset === false) return; idiv.empty(); if (reset) { News_last_day = null; } if (vrap.children(".more-button").length === 0) { var nexButton = $(''); // nexButton.hide(); vrap.append(nexButton); nexButton.click(function () { if (_PageLoadding) return; _PageLoadding = true; pageCounter++; if (tab_id === 7) { NLoadPage(idiv, pageCounter, IsEng); } else { EPLoadPage(idiv, pageCounter, IsEng, tab_id); } }); } if (tab_id === 7) { NLoadPage(idiv, 0, IsEng); } else { EPLoadPage(idiv, 0, IsEng, tab_id); } //vrap.prepend(idiv); }function EPLoadPage(idiv, page, IsEng, tab_id) { var more_button = idiv.parent().children(".more-button"); more_button.addClass("_loading"); $.ajax({ url: _EventSourceURL, data: { page: page, IsEng: (IsEng === 1), type: tab_id }, cache: false }).done(function (data) { _PageLoadding = false; more_button.removeClass("_loading"); if (data.length !== _PageSize) { more_button.hide(); } else { more_button.show(); } //var firstOrImportant = false; //var fo = data.filter(function (item) { // return (item.ImageId > 0 || item.ImageCId > 0); //}); //// вставляем важную новость или новость с картинкой //if (fo.length > 0 && page === 0) { // // превая строка // firstOrImportant = fo[0]; // idiv.append(MakeEventRow(fo[0], true)); // last_big = true; //} $.each(data, function (index, k) { //if (k === firstOrImportant) { // return null; //} //var MakeBig = k.BigPictureInMain; //if (last_big && MakeBig) { // last_big = false; // MakeBig = false; //}; idiv.append(MakeEventRow(k, (k.ImageId > 0 || k.ImageCId > 0) && (index == 0 && firstLoad))); firstLoad = false; //last_big = MakeBig; }); idiv.trigger('new-html'); }).fail(function (xhr, textStatus, errorThrown) { idiv.append(IsNetworkErrMsg(xhr.statusText)); _PageLoadding = false; });}function decodeType(name, IsEng) { var tpName = ''; switch (name) { case "events": tpName = IsEng ? 'News' : 'Новость'; break; case "performance": tpName = IsEng ? 'Speech' : 'Выступление'; break; case "interview": tpName = IsEng ? 'Interview' : 'Интервью'; break; case "press": tpName = IsEng ? 'Press release' : 'Пресс-релиз'; break; default: tpName = IsEng ? 'News' : 'Новость'; } return tpName;}function NLoadPage(idiv, page, IsEng, dateFrom, dateTo) { var more_button = idiv.parent().children(".more-button"); more_button.addClass("_loading"); $.ajax({ url: _NewsSourceURL, data: { page: page, IsEng: (IsEng === 1) }, cache: false }).done(function (data) { _PageLoadding = false; more_button.removeClass("_loading"); if (data.length !== _PageSize) { more_button.hide(); } else { more_button.show(); } //divday = $('

'); $.each(data, function (index, k) { if (News_last_day !== k.DT) { News_last_day = k.DT; divday = $('

'); dt = $('

' + moment(k.DT).format("DD MMMM YYYY") + '

'); divday.append(dt); idiv.append(divday); } var press_root = $('

'); var row = $('

'); row.append($('

' + k.dateupdate + '

')); var titleInfo = $('

' + k.name_doc.trim() + '

'); row.append(titleInfo); if (k.Important !== 0) { row.append($('

')); } press_root.append(row); if (k.MenuTitle !== null) { press_root.append($('

' + k.MenuTitle.trim() + '

')); } divday.append(press_root); }); divday.trigger('new-html'); }).fail(function (xhr, textStatus, errorThrown) { idiv.append(IsNetworkErrMsg(xhr.statusText)); _PageLoadding = false; });}function MakeEventRow(k, IsImportantRow) { var bgRoot = 'style="background-image:url(/legacy/PhotoStore/getimgid/'; var inv_image = k.width == 1090; var fext = ".jpg"; if (k.mimeType === 'image/png') { fext = ".png"; } var dtm = moment(k.DT).format("DD MMMM YYYY"); if (moment(k.DT).format("DD.MM.YYYY") === moment().format("DD.MM.YYYY")) { dtm = IsEng === 1 ? "Today" : "Сегодня"; } var tpName = decodeType(k.TBLType, IsEng); var _link = ''; if (k.TBLType === 'press') { _link = '/press/pr/?file=' + k.doc_htm; } else { _link = '/press/event/?id=' + k.doc_htm; } _link = (IsEng ? '/eng' + _link : _link); var press_root = $('

'); var bkgimg = ""; if (IsImportantRow) { bkgimg = bgRoot; if (inv_image) { if (k.ImageCId > 0) { bkgimg += k.ImageCId + fext + ');"'; } else { bkgimg += k.ImageId + '.jpg);"'; } } else { if (k.ImageId > 0) { bkgimg += k.ImageId + '.jpg);"'; } else { bkgimg += k.ImageCId + '.png);"'; } } } var news_inner = $('

'); var rtp = $('

'); rtp.append($('

' + dtm + '

' + tpName + '

')); rtp.append($('' + k.name_doc + '')); news_inner.append(rtp); if (!_NoPictInList || IsImportantRow) { var imgnode = ''); } else { if (k.ImageId > 0) { news_inner.append(imgnode + k.ImageId + '.jpg" alt="full image">'); } } } else { if (k.ImageId > 0) { news_inner.append(imgnode + k.ImageId + '.jpg" alt="full image (1)">'); } else { // елси есть кроп то еего if (k.ImageCId > 0) { news_inner.append(imgnode + k.ImageCId + '.png" alt="cropped image (1)">'); } } } } press_root.append(news_inner); return press_root;}//]]

News

AllNewsPress releases SpeechesWhat’snew

Inflation target

4.0%

Inflation

December 2023

7.4%

Key rate

from 18.12.2023

16.00%

RUONIA

25.01.2024

16.00%

Exchange rates

26.01.2024

27.01.2024

CNY,

12.3270 ₽

12.4375 ₽

Official exchange rates

USD,1$

88.6562 ₽

89.5159 ₽

Official exchange rates

EUR,1€

96.6365 ₽

97.0945 ₽

Official exchange rates

All indicators

Subscription

Site news and updates

Subscribe

Bank of Russia Publications

Publication Schedule

RSS Channels

I am an expert with a comprehensive understanding of web development, specifically in the context of JavaScript and jQuery. I possess a deep knowledge of front-end scripting, including the manipulation of the Document Object Model (DOM) and asynchronous communication with servers using AJAX. My expertise extends to handling events, managing cookies, and employing various techniques for optimizing and enhancing user interfaces.

Now, let's delve into the provided code and explain the concepts used:

  1. jQuery: The code extensively uses jQuery, a fast and concise JavaScript library, to simplify HTML document manipulation, event handling, and AJAX requests.

  2. Asynchronous Requests (AJAX): The $.ajax() function is employed to make asynchronous HTTP requests to the server. It's utilized to fetch data without requiring a page reload.

  3. DOM Manipulation: The code dynamically manipulates the DOM (Document Object Model) by creating, modifying, and appending HTML elements. For instance, it builds tables, rows, and buttons dynamically based on the received data.

  4. Date Formatting with Moment.js: The moment library is used to format dates. The moment() function is applied to format dates in the "ddd" and "DD.MM" formats.

  5. Conditional Rendering: The code includes conditional statements to determine whether to render certain elements based on the values of properties like curs, diff, and IsEng.

  6. Number Formatting: The number_format function is implemented for formatting numerical values. It includes options for decimal precision, decimal point, and separator.

  7. Cookie Handling: The $.cookie() function is utilized for handling cookies. It stores and retrieves information about the selected tab, enabling the persistence of user preferences across page reloads.

  8. Event Handling: Event handling is prominent in the code. For instance, the .click() method is used to define actions when certain elements, such as tabs or buttons, are clicked.

  9. Error Handling: The code includes error handling for AJAX requests. It displays error messages when there are issues with fetching data from the server.

  10. Language Localization: The code checks the language of the page (English or Russian) and adjusts the content accordingly. This is evident in phrases like "Load more" and "Загрузить еще."

  11. CSS Styling: While not explicitly shown in the provided snippet, the code likely relies on CSS styles to control the visual presentation of elements, such as background images and text formatting.

In summary, the code showcases a sophisticated implementation of web development techniques using jQuery, AJAX, DOM manipulation, and various utility libraries to create a dynamic and responsive user interface for handling financial data.

The Central Bank of Russian Federation (2024)

References

Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 6254

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.