/* @author Oleg Krasnov (krasnov@artlebedev.ru) @created 2018.11.07 @copyright Art. Lebedev Studio (http://www.artlebedev.ru/) This source code follows Formatting section of Google Javascript Style Guide https://google.github.io/styleguide/jsguide.html#formatting */ /** * @constructor */ Directory = function() { /** * @type {!jQuery} * @private */ this.root_ = jQuery('.tabbox'); /** * @type {!jQuery} * @private */ this.rowQuestion_ = this.root_.find('.row.question'); /** * @type {!jQuery} * @private */ this.quantitySubRows_ = this.rowQuestion_.find('.field ins'); this.init_(); }; /** * @private */ Directory.prototype.init_ = function() { for (var i = 0; i < this.rowQuestion_.length; i++) { var quantitySubRows = this.rowQuestion_.eq(i).find('.row').length; this.quantitySubRows_.eq(i).text(quantitySubRows); } }; jQuery(document).ready(function() { new Directory(); }); $(function () { $('.tablist .tab .pseudo').click(function () { $(this).parents('.tablist').find('.active').removeClass('active'); $(this).parents('.tab').addClass('active'); $('.tabbox>div').hide(); $('.tabbox').find('#' + $(this).attr('rel')).show(); }); initCreditReportSwitcher('f_101'); initCreditReportSwitcher('f_102'); initCreditReportSwitcher('f_134'); initCreditReportSwitcher('f_135'); initCreditReportSwitcher('f_123'); initCreditReportSwitcher('f_802'); initCreditReportSwitcher('f_803'); initCreditReportSwitcher('f_805'); initCreditReportSwitcher('f_kfo'); initCreditReportSwitcher('f_nfo'); function initCreditReportSwitcher(id) { $('#' + id + ' .switched .normal').removeClass('active').hide(); $('#' + id + '_' + $('#' + id + ' .switcher .selected .pseudo').text()).addClass('active').show(); $('#' + id + ' .switcher .pseudo').click(function () { $(this).parents('.switcher').find('.selected').removeClass('selected'); $(this).parents('li').addClass('selected'); $('#' + id + ' .switched .normal').removeClass('active').hide(); $('#' + id + '_' + $(this).text()).addClass('active').show(); }); } });