ISPerson = { Sports: null, SportsById: {}, RanksById: {}, PersonId: 0, PStId: 0, PersonsIds: [], PersonsBigData: {}, PersonsSearchFirst: [], PersonsSearchViewCount: 0, PersonsLast: [], PersonsLastById: {}, PersonsTemp: [], PersonsTempById: {}, Events: {}, MedalType: ['gold', 'silver', 'bronze'], PersonsSearchCount: 0, Type: null, NewsType: '', IsInit: false, UrlPage: '', ISPersonEdit: { Action: '' }, PersonMouseOver: { x: 0, y: 0 }, News: { Pages: 0, Page: 1 }, History: true, ShowId: 0, Clicks: [], GroupBy: {}, Init: function () { this.IsInit = true; var thisclass = this; thisclass.UrlPage = document.location + ''; PersonsSearchCount = this.PersonsIds.length; $(".atlet-filter select").each(function () { var th = $(this); $(this).selectik({ width: th.width(), heightContainer: 400, customScroll: 0, speedAnimation: 100, smartPosition: true, isfilter: ($(this).attr('name') == 'ChampionId' || $(this).attr('name') == 'RankId' ? false : true) }); $(this).parent().find('ul').niceScroll({ cursorcolor: '#314c83', background: '#c8c8ca', autohidemode: false, cursorborder: 'none', railoffset: { top: -3 } }); $(this).parent().find('.custom-text').click(function () { $(this).parent().find('ul').getNiceScroll().resize(); }); }); $(".atlet-results .results-list .simple-block:first img").one("load", function () { var hSimple = $(".atlet-results .results-list .simple-block:first img").height(); $(".atlet-results .results-list .simple-block img").height(hSimple); var masonryCont = $('.atlet-results .results-list'); if (masonryCont.length) { masonryCont.masonry({ itemSelector: '.atlet-results .simple-block' }); var block = $('.atlet-results .simple-block'), blockImg = block.find('img'), lastTop = 0, marginTop = 0; block.each(function () { lastTop = lastTop || $(this).position().top; if (lastTop && lastTop < $(this).position().top) { marginTop = $(this).position().top - $(this).height() - lastTop; return false; } }); $(".big-block").each(function () { if (!$(this).hasClass('huge-block')) { $(this).css({ 'minHeight': block.outerHeight() * 2 }); $(this).width(block.outerWidth() * 3); $(this).find('.wrap-block').css({ 'minHeight': block.outerHeight() * 2, 'minWidth': blockImg.width() * 3 }); } }); masonryCont.masonry({ itemSelector: '.atlet-results .simple-block', }); masonryCont.on('layoutComplete', thisclass.BindBigBlocks()); } }).each(function () { if (this.complete) $(this).load(); }); $('#button-clear').click(function () { thisclass.FilterClear(); }); $('.atlet-results #button-open').click(function () { thisclass.AddPersons($(this)); return false; }); thisclass.ResultsListInit(); $.ajax({ url: "/ajax/dataforpersons?v=" + ISCommon.GetV(), data: {}, success: function (d) { for (var i = 0; i < d.Ranks.length; i++) thisclass.RanksById[d.Ranks[i].Id] = d.Ranks[i]; for (var i = 0; i < d.Events.length; i++) thisclass.Events[d.Events[i].Id] = d.Events[i]; } }); ISCatalogs.SportDownload(this.SetSport); $('.atlet-search-text .view-all').click(function () { $(this).hide(); $('.atlet-search-text .paginator').hide(); $('#button-open-downloadnews').show(); return false; }); this.SearchPersonsClick(); if ('person' == thisclass.Type || 'search' == thisclass.Type) this.PersonsLastGet(); $('.atlet-results .results-list .simple-block .additional-info a.database').click(function () { thisclass.out = 'exit'; document.location = "/person"; return true; }); if (this.Type == 'news') $('.news-page.item .content a').each(function () { if ($(this).attr('href').indexOf('/person/') > -1) { var id = parseInt($(this).attr('href').substring(8)); if (id > 0) { $(this).attr('data-personid', id); $(this).data('personid', id); $(this).addClass('person'); } } }); $( ".news-page.item a.person, " + ".box-for-scoreboard .persons-list a.person, " + ".page-content.prating td a.person, " + ".atlet-results .results-list .simple-block .additional-info, " + ".atlet-results .results-list .simple-block .additional-info a.info-fio, " + ".atlet-results .results-list .simple-block .additional-info a.desc, " + ".atlet-results .results-list .simple-block .additional-info a.info-date").click(function () { if ($(this).has('additional-info') && thisclass.out && thisclass.out == 'exit') return false; thisclass.AtletPopupToggle($(this)); ISPerson.PersonClick($(this).data('personid')); return false; }); $(window).on('resize', function () { thisclass.AtletPopupToggleResize(); }); if (this.ISPersonEdit.Action == "create") ISPersonEdit.IsD = true; ISPersonEdit.Init(); thisclass.FilterInit(); }, SetSport: function () { ISPerson.Sports = ISCatalogs.Sport; for (var i = 0; i < ISCatalogs.Sport.length; i++) ISPerson.SportsById[ISCatalogs.Sport[i].Id] = i; ISPerson.DownloadData(); }, DownloadData: function () { var thisclass = this; if (ISPerson.PersonId > 0) { thisclass.ShowId = ISPerson.PersonId; $('#boxprotocols table.year-2016 a').each(function (e) { if (typeof ($(this).attr("href")) == 'undefined' || ($(this).attr("href") == "/person/" + ISPerson.PersonId)) { $(this).after($(this).html()); $(this).remove(); } }); if (ISPerson.NewsType != 'newsofperson' && ISPerson.NewsType != 'commentsofexpert') { ISPerson.SetAtletPopupToggleBind(); ISPerson.PersonClick(ISPerson.PersonId); if (thisclass.History) ISHistory.Push({ id: ISPerson.PersonId, type: 'person', action: 'open' }, $('.atlet-popup .popup-content.atlet-content').data('name'), '/person/' + $('.atlet-popup .popup-content.atlet-content').data('url')); var popup = $(".atlet-popup"); var newWidth = ($("#container").width() < 1000) ? $("#container").width() : 1000, newHeight = $(".atlet-wrap").outerHeight(true) - $(".filter-wrap").outerHeight(true) - $(".results-count").outerHeight(true); $(".atlet-popup-bg").css({ top: 0, height: $(document).outerHeight() }); popup.css({ top: 10, width: newWidth, marginLeft: 0 - (newWidth / 2) }); $(".atlet-popup-bg").unbind('click'); $(".atlet-popup-bg").click(function () { popup.find(".close").click(); }); popup.find(".close").unbind('click'); popup.find(".close").click(function () { popup.hide(); $(".atlet-popup-bg").hide(); if (thisclass.History) ISHistory.Push({ id: ISPerson.PersonId, type: 'person', action: 'close' }, 'Российские спортсмены и специалисты', thisclass.UrlPage); return false; }); } } if (thisclass.PersonsIds.length > 0) $.ajax({ url: "/ajax/personsforsearch?v=" + ISCommon.GetV(), type: "POST", data: { 'v': '2', PersonsIdsString: JSON.stringify(thisclass.PersonsIds) }, success: function (d) { for (var i = 0; i < d.PersonsSearch.length; i++) thisclass.PersonsBigData[d.PersonsSearch[i].Id] = d.PersonsSearch[i]; } }); ISWidgetCalendarSport.Init(); }, AddPersons: function (el) { var thisclass = this; el.hide(); el.attr('disabled', 'disabled'); var url = '/ajax/personsforsearchform?v=' + ISCommon.GetV(); var data = { Take: 72, SearchSkip: thisclass.PersonsSearchViewCount, ProfessionId: $('.atlet-filter #ProfessionId').val(), LocationsRegionId: $('.atlet-filter #LocationsRegionId').val(), PlaceOfBirthRegionId: $('.atlet-filter #PlaceOfBirthRegionId').val(), WinterSportId: $('.atlet-filter #WinterSportId').val(), SummerSportId: $('.atlet-filter #SummerSportId').val(), SportId: $('.atlet-filter #SportId').val(), FIO: $('.atlet-filter #FIO').val(), YearFrom: $('.atlet-filter #YearFrom').val(), YearTo: $('.atlet-filter #YearTo').val(), ChampionId: $('.atlet-filter #ChampionId').val(), RankId: $('.atlet-filter #RankId').val() }; if (thisclass.Type == 'search') { url = '/ajax/personsforsearchpage?v=' + ISCommon.GetV(); data = { Take: 72, SearchSkip: thisclass.PersonsSearchViewCount, Q: $('.header-wrap #q').val(), T: $('.header-wrap #t').val() }; } $.ajax({ url: url, data: data, success: function (d) { thisclass.PersonsSearchCount = d.PersonsSearchCount; thisclass.PersonsSearchViewCount = thisclass.PersonsSearchViewCount + d.PersonsForAjaxList.length; var items = []; for (var i = 0; i < d.PersonsForAjaxList.length; i++) { var p = d.PersonsForAjaxList[i]; if (p.TemplateType == 2 || p.TemplateType == 3) thisclass.PersonsBigData[d.PersonsForAjaxList[i].Id] = d.PersonsForAjaxList[i]; var a = thisclass.GetASimpleBlockByP(p); $('div.results-list div.resultbottom').before(a); items.push(a); $('.atlet-results .results-list').masonry().masonry('appended', a); a.on('click', function () { if ($(this).has('additional-info') && thisclass.out && thisclass.out == 'exit') return false; thisclass.AtletPopupToggle($(this)); ISPerson.PersonClick($(this).data('personid')); return false; }); if (a.find('.additional-info a.database').length) { a.find('.additional-info a.database').click(function () { thisclass.out = 'exit'; document.location = "/person"; return true; }); } } thisclass.BindBigBlocks(); thisclass.ResultsListInit(); if (thisclass.PersonsSearchCount > thisclass.PersonsSearchViewCount) { $('.atlet-results #button-open').show(); $('.atlet-results #button-open').removeAttr('disabled'); } else { $('.atlet-results #button-open').hide(); $('.atlet-results .results-list').attr('style', 'padding-bottom: 28px !important; position: relative; height: ' + $('.atlet-results .results-list').height() + 'px;'); } } }); return false; }, SearchPersonsClick: function () { var thisclass = this; $('.atlet-search-text .paginator li a').unbind('click'); $('.atlet-search-text .paginator li a').click(function () { var elhref = $(this).attr('href'); $.ajax({ url: $(this).attr('href'), data: { a: "ajax", type: ISPerson.NewsType, PStId: ISPerson.PStId }, success: function (d) { $('.atlet-search-text').html(d.ResultSearch); thisclass.SearchPersonsClick(); } }); return false; }); ISCommon.AddNews(); /* $('#button-open-downloadnews').unbind('click'); $('#button-open-downloadnews').click(function () { thisclass.AddNews($(this)); return false; }); */ $('.atlet-search-text .view-all').unbind('click'); $('.atlet-search-text .view-all').click(function () { if ($('.atlet-search-text .paginator li:first').hasClass('active')) { $(this).hide(); $('.atlet-search-text .paginator').hide(); $('#button-open-downloadnews').show(); } else { $.ajax({ url: $('.atlet-search-text .paginator li:first a').attr('href'), data: { a: "ajax", type: ISPerson.NewsType, PStId: ISPerson.PStId }, success: function (d) { $('.atlet-search-text').html(d.ResultSearch); thisclass.SearchPersonsClick(); $(this).hide(); $('.atlet-search-text .paginator').hide(); $('#button-open-downloadnews').show(); } }); } return false; }); }, ResultsListInit: function () { var thisclass = this; if (thisclass.Type == 'olympicgames') $(".atlet-view-history .atlet-history-list a.simple-block").click(function () { thisclass.AtletPopupToggle($(this)); ISPerson.PersonClick($(this).data('personid')); return false; }); $(".atlet-results .results-list a.simple-block, .atlet-results .results-list div.simple-block .wrap-block, .persons-popups .simple-block a").unbind('click'); $(".atlet-results .results-list a.simple-block, .atlet-results .results-list div.simple-block .wrap-block, .persons-popups .simple-block a").click(function () { thisclass.AtletPopupToggle($(this)); ISPerson.PersonClick($(this).data('personid')); return false; }); $(".simple-block").hover(function () { $(this).find('img.black-white').stop().animate({ "opacity": "0" }, "slow"); }, function () { $(this).find('img.black-white').stop().animate({ "opacity": "1" }, "slow"); }); $(".wrap-block").each(function () { thisclass.BindBigBlocksItem($(this)); }); $(".atlet-results .results-list .simple-block, .atlet-view-history .atlet-history-list .simple-block").on('mouseover', function () { if ($(this).hasClass('huge-block') || $(this).hasClass('big-change-size')) { } else if ($(this).data('template') == 'BigWithBlue') { $('.persons-popups .simple-block.big-block.big-change-size').hide(); if (thisclass.PersonsBigData[$(this).data('personid')] != undefined) { var p = thisclass.PersonsBigData[$(this).data('personid')]; $('.persons-popups .simple-block.big-block.huge-block a').attr('href', '/person/' + p.Id); $('.persons-popups .simple-block.big-block.huge-block a').attr('data-personid', p.Id); $('.persons-popups .simple-block.big-block.huge-block a').data('personid', p.Id); var photocolor = p.Photo ? '/content/uploads/personalities/small/' + p.Photo : (p.PicFile != null && p.PicFile != '' ? 'http://old.infosport.ru/images/photo/' + p.PicFile : '/content/images/person_no_photo.jpg'); $('.persons-popups .simple-block.big-block.huge-block .photofix img').attr('src', photocolor); $('.persons-popups .simple-block.big-block.huge-block .sport-link').html(''); if (p.SportIds.length > 0) { if (ISCatalogs.SportGet(p.SportIds[0]).Logo != null) $('.persons-popups .simple-block.big-block.huge-block .sport-link').append($('', { src: '/content/uploads/sport/' + ISCatalogs.SportGet(p.SportIds[0]).Logo })) $('.persons-popups .simple-block.big-block.huge-block .sport-link').append(ISCatalogs.SportGet(p.SportIds[0]).Name); if (ISCatalogs.SportGet(p.SportIds[0]).Name.length > 20) $('.persons-popups .simple-block.big-block.huge-block .sport-link').attr('style', 'line-height:21px;'); else $('.persons-popups .simple-block.big-block.huge-block .sport-link').removeAttr('style'); } $('.persons-popups .simple-block.big-block.huge-block table tr').eq(0).find('td').eq(1).text(p.LName); $('.persons-popups .simple-block.big-block.huge-block table tr').eq(1).find('td').eq(1).text(p.FName); $('.persons-popups .simple-block.big-block.huge-block table tr').eq(2).find('td').eq(1).text(p.SName); $('.persons-popups .simple-block.big-block.huge-block table tr').eq(3).find('td').eq(1).text(p.Country ? p.Country : ''); $('.persons-popups .simple-block.big-block.huge-block table tr').eq(4).find('td').eq(1).text(p.Profession ? p.Profession : ''); var textspClear = (p.TextSp != null && p.TextSp != "") ? p.TextSp.replace(new RegExp("<[^>]+>", 'g'), '') : ''; if (textspClear.indexOf('.') > -1 && textspClear.indexOf('.') + 1 < textspClear.length) textspClear = textspClear.substring(textspClear.indexOf('.') + 1); textspClear = textspClear.Length > 250 ? textspClear.Substring(0, 250) + "..." : textspClear; var textClear = (p.Text != null && p.Text != "") ? p.Text.replace(new RegExp("
]+>", 'g'), '').replace(new RegExp("
", 'g'), '').replace(new RegExp("", p6) > -1) { p6i++; p6 = textClear.toLowerCase().indexOf("

", p6) + 1; } if (p6 + 4 < textClear.length && p6 > 1) textClear = textClear.substring(0, p6 - 1) + "..

"; $('.persons-popups .simple-block.big-block.huge-block .description .short').html(textspClear); $('.persons-popups .simple-block.big-block.huge-block .additional-info .info-fio').html(p.LName + ' ' + p.FName); $('.persons-popups .simple-block.big-block.huge-block .additional-info .desc').html(textClear); thisclass.PersonMouseOver.x = $(this).offset().left; thisclass.PersonMouseOver.y = $(this).offset().top; var x = thisclass.PersonMouseOver.x; var y = thisclass.PersonMouseOver.y; if (thisclass.PersonMouseOver.x > 1400) x = thisclass.PersonMouseOver.x - 560; else if (thisclass.PersonMouseOver.x > 1250) x = thisclass.PersonMouseOver.x - 420; else if (thisclass.PersonMouseOver.x > 1100) x = thisclass.PersonMouseOver.x - 280; else if (thisclass.PersonMouseOver.x > 1000) x = thisclass.PersonMouseOver.x - 140; var top = ('olympicgames' == thisclass.Type) ? thisclass.PersonMouseOver.y - 147 : thisclass.PersonMouseOver.y - 255; $('.persons-popups .simple-block.big-block.huge-block').show(); $('.persons-popups .simple-block.big-block.huge-block').css({ top: top + 'px', left: x - $('.content .atlet-wrap').offset().left - 3 + 'px' }); } } else if ($(this).data('template') == 'BigChangeSize') { $('.persons-popups .simple-block.big-block.huge-block').hide(); if (thisclass.PersonsBigData[$(this).data('personid')] != undefined) { var p = thisclass.PersonsBigData[$(this).data('personid')]; $('.persons-popups .simple-block.big-block.big-change-size a').attr('href', '/person/' + p.Id); $('.persons-popups .simple-block.big-block.big-change-size a').attr('data-personid', p.Id); $('.persons-popups .simple-block.big-block.big-change-size a').data('personid', p.Id); var photocolor = p.Photo ? '/content/uploads/personalities/small/' + p.Photo : (p.PicFile != null && p.PicFile != '' ? 'http://old.infosport.ru/images/photo/' + p.PicFile : '/content/images/person_no_photo.jpg'); $('.persons-popups .simple-block.big-block.big-change-size .photofix img').attr('src', photocolor); $('.persons-popups .simple-block.big-block.big-change-size .sport-link').html(''); if (p.SportIds.length > 0) { $('.persons-popups .simple-block.big-block.big-change-size .sport-link').append($('', { src: '/content/uploads/sport/' + ISCatalogs.SportGet(p.SportIds[0]).Logo })).append(ISCatalogs.SportGet(p.SportIds[0]).Name); if (ISCatalogs.SportGet(p.SportIds[0]).Name.length > 20) $('.persons-popups .simple-block.big-block.big-change-size .sport-link').attr('style', 'line-height:21px;'); } $('.persons-popups .simple-block.big-block.big-change-size .short-info-table div').eq(0).find('span').eq(0).text(p.LName); $('.persons-popups .simple-block.big-block.big-change-size .short-info-table div').eq(1).find('span').eq(0).text(p.FName); $('.persons-popups .simple-block.big-block.big-change-size .short-info-table div').eq(2).find('span').eq(0).text(p.SName); $('.persons-popups .simple-block.big-block.big-change-size .short-info-table div').eq(3).find('span').eq(0).text(p.Country ? p.Country : ''); $('.persons-popups .simple-block.big-block.big-change-size .short-info-table div').eq(4).find('span').eq(0).text(p.Profession ? p.Profession : ''); var textspClear = (p.TextSp != null && p.TextSp != "") ? p.TextSp.replace(new RegExp("<[^>]+>", 'g'), '') : ''; if (textspClear.indexOf('.') > -1 && textspClear.indexOf('.') + 1 < textspClear.length) textspClear = textspClear.substring(textspClear.indexOf('.') + 1); textspClear = textspClear.Length > 250 ? textspClear.Substring(0, 250) + "..." : textspClear; $('.persons-popups .simple-block.big-block.big-change-size .description .short').html(textspClear); thisclass.PersonMouseOver.x = $(this).offset().left; thisclass.PersonMouseOver.y = $(this).offset().top; var x = thisclass.PersonMouseOver.x; var y = thisclass.PersonMouseOver.y; if (thisclass.PersonMouseOver.x > 1400) x = thisclass.PersonMouseOver.x - 280; else if (thisclass.PersonMouseOver.x > 1250) x = thisclass.PersonMouseOver.x - 140; var top = ('olympicgames' == thisclass.Type) ? thisclass.PersonMouseOver.y - 147 : thisclass.PersonMouseOver.y - 255; $('.persons-popups .simple-block.big-block.big-change-size').show(); $('.persons-popups .simple-block.big-block.big-change-size').css({ top: top + 'px', left: x - $('.content .atlet-wrap').offset().left - 3 + 'px' }); } } else { $('.persons-popups .simple-block.big-block.big-change-size').hide(); $('.persons-popups .simple-block.big-block.huge-block').hide(); } }); $('.persons-popups .simple-block.big-block.huge-block, .persons-popups .simple-block.big-block.big-change-size').on('mousemove', function (e) { if (e.pageX < thisclass.PersonMouseOver.x || e.pageX > thisclass.PersonMouseOver.x + 136 || e.pageY < thisclass.PersonMouseOver.y || e.pageY > thisclass.PersonMouseOver.y + 136) $(this).hide(); }); $(".persons-popups .simple-block.big-block.huge-block, .persons-popups .simple-block.big-block.big-change-size").on('mouseout', function (e) { if ($(e.target).is('.persons-popups .simple-block.big-block.huge-block tbody,.persons-popups .simple-block.big-block.huge-block table, .persons-popups .simple-block.big-block.huge-block tr, .persons-popups .simple-block.big-block.huge-block td, .persons-popups .simple-block.big-block.huge-block strong, .persons-popups .simple-block.big-block.huge-block div, .persons-popups .simple-block.big-block.huge-block span, .persons-popups .simple-block.big-block.huge-block img, .persons-popups .simple-block.big-block.huge-block a, .persons-popups .simple-block.big-block.huge-block p, .persons-popups .simple-block.big-block.huge-block b')) return false; if ($(e.target).is('.persons-popups .simple-block.big-block.big-change-size tbody,.persons-popups .simple-block.big-block.big-change-size table, .persons-popups .simple-block.big-block.big-change-size tr, .persons-popups .simple-block.big-block.big-change-size td, .persons-popups .simple-block.big-block.big-change-size strong, .persons-popups .simple-block.big-block.big-change-size div, .persons-popups .simple-block.big-block.big-change-size span, .persons-popups .simple-block.big-block.big-change-size img, .persons-popups .simple-block.big-block.big-change-size a')) return false; $(this).hide(); }); }, AtletPopupToggle: function (el) { var thisclass = this; var bg = $(".atlet-popup-bg"); bg.css({ top: 0, height: $(document).outerHeight() }); bg.show(); if (thisclass.PersonsLastById[el.data('personid')] != undefined) { thisclass.SetAtletPopupToggle(this.PersonsLast[thisclass.PersonsLastById[el.data('personid')]]); } else if (thisclass.PersonsTempById[el.data('personid')] != undefined) { thisclass.SetAtletPopupToggle(this.PersonsTemp[thisclass.PersonsTempById[el.data('personid')]]); } else { $.ajax({ url: "/ajax/personsforsearch?v=" + ISCommon.GetV(), data: { PersonsIdsString: '[' + el.data('personid') + ']' }, //async: false, success: function (d) { if (d.PersonsSearch.length) { for (var i = 0; i < d.PersonsSearch.length; i++) { if (ISPerson.PersonsTempById[d.PersonsSearch[i].Id] == undefined) { ISPerson.PersonsTempById[d.PersonsSearch[i].Id] = ISPerson.PersonsTemp.length; ISPerson.PersonsTemp.push(d.PersonsSearch[i]); } } thisclass.SetAtletPopupToggle(thisclass.PersonsTemp[thisclass.PersonsTempById[el.data('personid')]]); } } }); } }, AtletPopupToggleShow: function (p) { var thisclass = this; var bg = $(".atlet-popup-bg"); var popup = $(".atlet-popup"), cont = popup.find('.atlet-content'); if (bg.is(':visible') || popup.is(':visible')) { popup.hide(); bg.hide(); } var offsetik = $(window).scrollTop(); var newWidth = ($("#container").width() < 1000) ? $("#container").width() : 1000, newHeight = $(".atlet-wrap").outerHeight(true) - $(".filter-wrap").outerHeight(true) - $(".results-count").outerHeight(true); bg.css({ top: 0, height: $(document).outerHeight() }); popup.css({ top: offsetik, width: newWidth, marginLeft: 0 - (newWidth / 2) }); bg.show(); popup.show(); bg.unbind('click'); bg.click(function () { popup.find(".close").click(); }); popup.find(".close").unbind('click'); popup.find(".close").click(function () { popup.hide(); bg.hide(); if (thisclass.History) ISHistory.Push({ id: p.Id, type: 'person', action: 'close' }, 'Российские спортсмены и специалисты', thisclass.UrlPage); return false; }); $(".atlet-popup .image").hover(function () { $(this).find('.toiningImgNew').fadeOut(200); }, function () { $(this).find('.toiningImgNew').fadeIn(200); }); }, AtletPopupToggleResize: function () { var popup = $(".atlet-popup"), bg = $(".atlet-popup-bg"), cont = popup.find('.atlet-content'); var offsetik = $(window).scrollTop(); var newWidth = ($("#container").width() < 1000) ? $("#container").width() : 1000, newHeight = $(".atlet-wrap").outerHeight(true) - $(".filter-wrap").outerHeight(true) - $(".results-count").outerHeight(true); bg.css({ top: 0, height: $(document).outerHeight() }); popup.css({ top: offsetik, width: newWidth, marginLeft: 0 - (newWidth / 2) }); }, SetAtletPopupToggle: function (p) { var thisclass = this; thisclass.ShowId = p.Id; if (thisclass.Type != 'olympicgames') this.PersonsLastAdd(p); $('.atlet-popup .wrapper .heading .heading-title').remove(); var personaldata = 0; var sportForURL = ''; var SportIdsStringSplit = p.SportIdsString.split(','); for (var i = 0; i < SportIdsStringSplit.length; i++) { var sport = ISCatalogs.SportGet(parseInt(SportIdsStringSplit[SportIdsStringSplit.length - i - 1])); if (sport) { if (sport.IsOlympic > 0) sportForURL = sport.Alias + '/'; else if (sportForURL == '') sportForURL = sport.Alias + '/'; var urlsport = "/person?" + (sport.IsOlympic > 0 && sport.SeasonsType > 0 ? (sport.SeasonsType == 1 ? "summersportid=" : "wintersportid=") : 'sportid=') + sport.Id; if (sport.Logo) $('.atlet-popup .wrapper .heading').prepend($('', { href: urlsport, 'class': 'heading-title' }).append($('', { 'class': 'sport-link' }).append($('', { src: '/content/uploads/sport/' + sport.Logo })).append($('

', { text: sport.Name })))); else $('.atlet-popup .wrapper .heading').prepend($('

', { href: urlsport, 'class': 'heading-title' }).append($('', { 'class': 'sport-link' }).append($('

', { text: sport.Name })))); } } if (thisclass.History) ISHistory.Push({ id: p.Id, type: 'person', action: 'open' }, p.Name, '/person/' + sportForURL + p.Alias); $('.atlet-popup .wrapper .heading a.print').attr('href', '/person/print/' + p.Id); $('.atlet-popup #edit-person').data('personid', p.Id); $('.atlet-popup #edit-person').attr('data-personid', p.Id); if (p.Photo) $('.popup-content.atlet-content .photo img').attr('src', '/content/uploads/personalities/133xAny/' + p.Photo); else if (p.PicFile) $('.popup-content.atlet-content .photo img').attr('src', 'http://old.infosport.ru/images/photo/' + p.PicFile); else if (p.IsPhotoNotFound) $('.popup-content.atlet-content .photo img').attr('src', '/content/images/photo_not_found.jpg'); else $('.popup-content.atlet-content .photo img').attr('src', '/content/images/person_no_photo.jpg'); if (p.LName && $.trim(p.LName) != '') { $('.popup-content.atlet-content #LastName').show(); $('.popup-content.atlet-content #LastName td h1').text(p.LName); } else { $('.popup-content.atlet-content #LastName').hide(); $('.popup-content.atlet-content #LastName td h1').text(''); } if (p.FName && $.trim(p.FName) != '') { $('.popup-content.atlet-content tr#FirstName').show(); $('.popup-content.atlet-content tr#FirstName td h1').text(p.FName); } else { $('.popup-content.atlet-content tr#FirstName').hide(); $('.popup-content.atlet-content tr#FirstName td h1').text(''); } if (p.SName && $.trim(p.SName) != '') { $('.popup-content.atlet-content tr#SecondName').show(); $('.popup-content.atlet-content tr#SecondName td h1').text(p.SName); } else { $('.popup-content.atlet-content tr#SecondName td h1').text(''); $('.popup-content.atlet-content tr#SecondName').hide(); } $('.popup-content.atlet-content tr#Category').hide(); $('.popup-content.atlet-content .half-right.text-description').html(p.Text); $('.popup-content.atlet-content #socialslabel').html(p.FName + ' ' + p.LName + ' в соцсетях: '); var URLLName = p.LName && p.LName.length > 1 ? p.LName.substr(0, 1) + p.LName.substr(1).toLowerCase() : ''; $('.popup-content.atlet-content .socials .search-links #search-google').attr('href', 'https://www.google.ru/search?q=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .search-links #search-bing').attr('href', 'http://www.bing.com/search?q=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .search-links #search-yandex').attr('href', 'https://yandex.ru/search/?text=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .search-links #search-mail').attr('href', 'https://go.mail.ru/search?q=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .search-links #search-rambler').attr('href', 'https://nova.rambler.ru/search?query=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .search-links #search-yahoo').attr('href', 'https://search.yahoo.com/search?p=' + URLLName + ' ' + p.FName + ' ' + p.SName); $('.popup-content.atlet-content .socials .atlet-social-links').html(''); if (p.SocialNetworksFacebook) $('.popup-content.atlet-content .socials .atlet-social-links ').append($('', { href: p.SocialNetworksFacebook, target: "_blank" }).append($('', { src: '/content/images/socials/facebook.png' }))) if (p.SocialNetworksVK) $('.popup-content.atlet-content .socials .atlet-social-links').append($('', { href: p.SocialNetworksVK, target: "_blank" }).append($('', { src: '/content/images/socials/vkontakte.png' }))) if (p.SocialNetworksTwitter) $('.popup-content.atlet-content .socials .atlet-social-links').append($('', { href: p.SocialNetworksTwitter, target: "_blank" }).append($('', { src: '/content/images/socials/twitter.png' }))) if (p.SocialNetworksGooglePlus) $('.popup-content.atlet-content .socials .atlet-social-links').append($('', { href: p.SocialNetworksGooglePlus, target: "_blank" }).append($('', { src: '/content/images/socials/gplus.png' }))) if (p.SocialNetworksOK) $('.popup-content.atlet-content .socials .atlet-social-links').append($('', { href: p.SocialNetworksOK, target: "_blank" }).append($('', { src: '/content/images/socials/ok.png' }))) if (p.SocialNetworksFacebook || p.SocialNetworksVK || p.SocialNetworksTwitter || p.SocialNetworksGooglePlus || p.SocialNetworksOK) $('.popup-content.atlet-content .socials').show(); else $('.popup-content.atlet-content .socials').hide(); $('.popup-content.atlet-content .socials.search-box').show(); $('.popup-content.atlet-content tr#InternationalRatings td').eq(1).text(p.InternationalRatings ? p.InternationalRatings : ''); $('.popup-content.atlet-content tr#RussianRatings td').eq(1).text(p.RussianRatings ? p.RussianRatings : ''); if (p.InternationalRatings || p.RussianRatings) $('.popup-content.atlet-content tr#BoxRatings').show(); else $('.popup-content.atlet-content tr#BoxRatings').hide(); if (p.InternationalRatings) $('.popup-content.atlet-content tr#InternationalRatings').show(); else $('.popup-content.atlet-content tr#InternationalRatings').hide(); if (p.RussianRatings) $('.popup-content.atlet-content tr#RussianRatings').show(); else $('.popup-content.atlet-content tr#RussianRatings').hide(); if (p.BirthDate) { $('.popup-content.atlet-content tr#BirthDate').show(); $('.popup-content.atlet-content tr#BirthDate td').eq(1).text(p.BirthDate); personaldata++; } else if (p.BirthYear) { $('.popup-content.atlet-content tr#BirthDate').show(); $('.popup-content.atlet-content tr#BirthDate td').eq(1).text(p.BirthYear); personaldata++; } else { $('.popup-content.atlet-content tr#BirthDate').hide(); $('.popup-content.atlet-content tr#BirthDate td').eq(1).text(''); } $('.popup-content.atlet-content tr#PlaceOfBirth td').eq(1).text(p.PlaceOfBirth ? p.PlaceOfBirth : ''); if (p.PlaceOfBirth) { $('.popup-content.atlet-content tr#PlaceOfBirth').show(); personaldata++; } else $('.popup-content.atlet-content tr#PlaceOfBirth').hide(); $('.popup-content.atlet-content tr#Locations td').eq(1).text(p.Locations ? p.Locations : ''); if (p.Locations) { $('.popup-content.atlet-content tr#Locations').show(); personaldata++; } else $('.popup-content.atlet-content tr#Locations').hide(); $('.popup-content.atlet-content tr#HeightAthlete td').eq(1).text(p.HeightAthlete ? p.HeightAthlete : ''); if (p.HeightAthlete) { $('.popup-content.atlet-content tr#HeightAthlete').show(); personaldata++; } else $('.popup-content.atlet-content tr#HeightAthlete').hide(); $('.popup-content.atlet-content tr#WeightAthlete td').eq(1).text(p.WeightAthlete ? p.WeightAthlete : ''); if (p.WeightAthlete) { $('.popup-content.atlet-content tr#WeightAthlete').show(); personaldata++; } else $('.popup-content.atlet-content tr#WeightAthlete').hide(); $('.popup-content.atlet-content tr#Education td').eq(1).text(p.Education ? p.Education : ''); if (p.Education) { $('.popup-content.atlet-content tr#Education').show(); personaldata++; } else $('.popup-content.atlet-content tr#Education').hide(); $('.popup-content.atlet-content tr#Coach td').eq(1).html(p.Coach ? p.Coach : ''); if (p.Coach) { $('.popup-content.atlet-content tr#Coach').show(); personaldata++; } else $('.popup-content.atlet-content tr#Coach').hide(); if (!p.BirthDate && !p.PlaceOfBirth && !p.Locations && !p.HeightAthlete && !p.WeightAthlete && !p.Education && !p.Coach && !p.Coachs) $('.popup-content.atlet-content .half-left .wrapper h2').text(''); else $('.popup-content.atlet-content .half-left .wrapper h2').text('Личные данные'); var sportsdata = 0; $('.popup-content.atlet-content .half-right .wrapper table.striped').show(); $('.popup-content.atlet-content tr#Coachs td').eq(1).html(p.Coachs ? p.Coachs : ''); if (p.Coachs) { sportsdata++; $('.popup-content.atlet-content tr#Coachs').show(); } else $('.popup-content.atlet-content tr#Coachs').hide(); $('.popup-content.atlet-content tr#Ranks td').eq(1).text(''); for (var i = 0; i < p.RanksIds.length; i++) $('.popup-content.atlet-content tr#Ranks td').eq(1).append((i > 0 ? '
' : '') + this.RanksById[p.RanksIds[i]].Name); if (p.RanksIds.length == 0) $('.popup-content.atlet-content tr#Ranks').hide(); else { sportsdata++; $('.popup-content.atlet-content tr#Ranks').show(); } $('.popup-content.atlet-content tr#Disciplines td').eq(1).text(''); var sportId = 0, disciplines = ""; for (var i = 0; i < p.DisciplinesForAjaxList.length; i++) { var sport = ISCatalogs.SportGet(p.DisciplinesForAjaxList[i].SportId); if (p.DisciplinesForAjaxList[i].SportId != sportId) disciplines += (i > 0 ? "
" : "") + sport.Name + ': ' + p.DisciplinesForAjaxList[i].Name; else disciplines += ', ' + p.DisciplinesForAjaxList[i].Name; sportId = p.DisciplinesForAjaxList[i].SportId; } $('.popup-content.atlet-content tr#Disciplines td').eq(1).append(disciplines); if (disciplines == "") $('.popup-content.atlet-content tr#Disciplines').hide(); else { sportsdata++; $('.popup-content.atlet-content tr#Disciplines').show(); } $('.popup-content.atlet-content tr#Composition td').eq(1).text(p.Composition ? p.Composition : ''); if (p.Composition) { sportsdata++; $('.popup-content.atlet-content tr#Composition').show(); } else $('.popup-content.atlet-content tr#Composition').hide(); $('.popup-content.atlet-content tr#CompositionWithYear td').eq(1).text(p.CompositionWithYear ? p.CompositionWithYear : ''); if (p.CompositionWithYear) { sportsdata++; $('.popup-content.atlet-content tr#CompositionWithYear').show(); } else $('.popup-content.atlet-content tr#CompositionWithYear').hide(); $('.popup-content.atlet-content .scroll-wrap .description').css({ 'margin-bottom': '20px', 'padding-bottom': '30px' }); if ((p.RanksIds.length == 0 && disciplines == "" && !p.Composition && !p.CompositionWithYear && !p.Coachs) || sportsdata < 1) { $('.popup-content.atlet-content .half-right .wrapper h2').text(''); $('.popup-content.atlet-content .half-right .wrapper table.striped').hide(); if (personaldata == 0 && p.MedalsForAjaxList.length == 0 && p.ProtocolsForAjaxList.length == 0 && p.SocietiesForAjaxList.length == 0) $('.popup-content.atlet-content .scroll-wrap .description').css({ 'border': '0', 'margin-bottom': '0px', 'padding-bottom': '0px' }); } else $('.popup-content.atlet-content .half-right .wrapper h2').text('Спортивные данные'); $('.popup-content.atlet-content #boxmedals .table-with-heading').remove(); var gold = 0, silver = 0, bronze = 0, nontopborder = false; var eventid = 0; for (var i = 0; i < p.MedalsForAjaxList.length; i++) { var m = p.MedalsForAjaxList[i]; if (m.Type == 0) gold++; else if (m.Type == 1) silver++; else if (m.Type == 2) bronze++; if (eventid != m.EventId) { var div = $('

', { 'class': 'table-with-heading', id: 'tablemedalsid_' + m.EventId }) .append($('

', { 'class': 'table-heading' + (nontopborder ? " non-top-border" : ""), text: this.Events[m.EventId].Name })) .append( $('

', { 'class': 'not-striped' }) .append( $('').append( $('') .append($('').append( $('') .append($('') .append($('
', { text: 'Год' })) .append($(' ', { text: 'Место проведения' })) .append($(' ', { text: 'Занятое место', 'class': 'centered' })) .append($(' ', { text: 'Дисциплина' })) ) ) .append( $('
', { text: m.Year })) .append($(' ', { text: m.Place ? m.Place : '' })) .append( $(' ', { 'class': 'centered' }) .append($('', { 'class': 'medal ' + this.MedalType[m.Type], html: (m.Type + 1) })) ) .append($(' ', { text: m.Discipline })) ) ) ); $('.popup-content.atlet-content #boxmedals').append(div); nontopborder = true; } else $('#tablemedalsid_' + m.EventId + ' tbody').append( $('
', { text: m.Year })) .append($(' ', { text: m.Place ? m.Place : '' })) .append( $(' ', { 'class': 'centered' }) .append($('', { 'class': 'medal ' + this.MedalType[m.Type], html: (m.Type + 1) })) ) .append($(' ', { text: m.Discipline })) ) eventid = m.EventId; } $('.popup-content.atlet-content .medals .gold').text(gold); $('.popup-content.atlet-content .medals .silver').text(silver); $('.popup-content.atlet-content .medals .bronze').text(bronze); $('.popup-content.atlet-content .medals .total').text(p.MedalsForAjaxList.length); if (p.MedalsForAjaxList.length == 0) { $('.atlet-popup .popup-content.atlet-content .medals').hide(); $('.popup-content.atlet-content #boxmedals').hide(); } else { $('.atlet-popup .popup-content.atlet-content .medals').show(); $('.popup-content.atlet-content #boxmedals').show(); } if (p.PIY > 0 && p.PIYP > 0) { $('.atlet-popup .popup-content.atlet-content .links.rating.popularity').show(); if (p.PIWP > 0 && p.PIW > 0) $('.atlet-popup .popup-content.atlet-content .links.rating.popularity a#popularity-index-w span.v').html((p.PIWP > 0 ? p.PIWP : ' —') + ' место (' + (p.PIW > 0 ? p.PIW : ' —') + ' ' + this.GetWordForViews(p.PIW) + ')'); else $('.atlet-popup .popup-content.atlet-content .links.rating.popularity a#popularity-index-w span.v').html('отсутствует'); if (p.PIMP > 0 && p.PIM > 0) $('.atlet-popup .popup-content.atlet-content .links.rating.popularity a#popularity-index-m span.v').html((p.PIMP > 0 ? p.PIMP : ' —') + ' место (' + (p.PIM > 0 ? p.PIM : ' —') + ' ' + this.GetWordForViews(p.PIM) + ')'); else $('.atlet-popup .popup-content.atlet-content .links.rating.popularity a#popularity-index-m span.v').html('отсутствует'); $('.atlet-popup .popup-content.atlet-content .links.rating.popularity a#popularity-index-y span.v').html((p.PIYP > 0 ? p.PIYP : ' —') + ' место (' + (p.PIY > 0 ? p.PIY : ' —') + ' ' + this.GetWordForViews(p.PIY) + ')'); } else $('.atlet-popup .popup-content.atlet-content .links.rating.popularity').hide(); if (p.CIY > 0 && p.CIYP > 0) { $('.atlet-popup .popup-content.atlet-content .links.rating.citation').show(); if (p.CIWP > 0 && p.CIW > 0) $('.atlet-popup .popup-content.atlet-content .links.rating.citation a#citation-index-w span.v').html((p.CIWP > 0 ? p.CIWP : ' —') + ' место (' + (p.CIW > 0 ? p.CIW : ' —') + ' ' + this.GetWordForReferences(p.CIW) + ')'); else $('.atlet-popup .popup-content.atlet-content .links.rating.citation a#citation-index-w span.v').html('отсутствует'); if (p.CIMP > 0 && p.CIM > 0) $('.atlet-popup .popup-content.atlet-content .links.rating.citation a#citation-index-m span.v').html((p.CIMP > 0 ? p.CIMP : ' —') + ' место (' + (p.CIM > 0 ? p.CIM : ' —') + ' ' + this.GetWordForReferences(p.CIM) + ')'); else $('.atlet-popup .popup-content.atlet-content .links.rating.citation a#citation-index-m span.v').html('отсутствует'); $('.atlet-popup .popup-content.atlet-content .links.rating.citation a#citation-index-y span.v').html((p.CIYP > 0 ? p.CIYP : ' —') + ' место (' + (p.CIY > 0 ? p.CIY : ' —') + ' ' + this.GetWordForReferences(p.CIY) + ')'); } else $('.atlet-popup .popup-content.atlet-content .links.rating.citation').hide(); if (p.PStId > 0 && p.NumberOfNews > 0) { $('.atlet-popup .popup-content.atlet-content .links.news').show(); $('.atlet-popup .popup-content.atlet-content .links.news a').attr('href', '/person?fio=' + p.LName + ' ' + p.FName + '&Id=' + p.Id + '&type=NewsOfPerson#news-view'); $('.atlet-popup .popup-content.atlet-content .links.news a').html(p.FName + ' ' + p.LName.toUpperCase() + ' в Новостях:
'); } else if (p.NumberOfNews > 0) { $('.atlet-popup .popup-content.atlet-content .links.news').show(); $('.atlet-popup .popup-content.atlet-content .links.news a').attr('href', '/person?fio=' + p.LName + ' ' + p.FName + '#news-view'); $('.atlet-popup .popup-content.atlet-content .links.news a').html(p.FName + ' ' + p.LName.toUpperCase() + ' в Новостях:
'); } else { $('.atlet-popup .popup-content.atlet-content .links.news').hide(); $('.atlet-popup .popup-content.atlet-content .links.news a').attr('href', '/person?fio=' + p.LName + ' ' + p.FName + '#news-view'); $('.atlet-popup .popup-content.atlet-content .links.news a').html(p.FName + ' ' + p.LName.toUpperCase() + ' в Новостях:
'); } $('#boxprotocols').html(''); var ogid = 0; if (p.ProtocolsForAjaxList.length > 0) for (var i = 0; i < p.ProtocolsForAjaxList.length; i++) { var pro = p.ProtocolsForAjaxList[i]; if (ogid != pro.OlympicGameId) { var protocolname = pro.Name ? pro.Name : ''; if (pro.Year == 2012) protocolname = 'Результаты выступлений на Играх XXX Олимпиады в Лондоне'; else if (pro.Year == 2016) protocolname = 'Результаты выступлений на Играх XXXI Олимпиады в Рио-Де-Жанейро'; $('#boxprotocols').append($('

', { text: protocolname })); } var titleclear = pro.Title && $.trim(pro.Title) != '' ? $.trim(pro.Title) : ''; if (titleclear != '' && titleclear.length > 0) { if (titleclear.substr(titleclear.length - 1, 1) == '-') { titleclear = $.trim(titleclear.substr(0, titleclear.length - 1)); if (titleclear.substr(titleclear.length - 1, 1) == '-') titleclear = $.trim(titleclear.substr(0, titleclear.length - 1)); } } var stageclear = pro.Stage && $.trim(pro.Stage) != '' ? $.trim(pro.Stage) : ''; if (stageclear != '' && stageclear.substr(0, 1) == '-') stageclear = stageclear.substr(1, stageclear.length - 1).replace('(', ' ').replace(')', ' '); if (pro.EtapComments && pro.EtapComments.length > 0) { var EtapComments = pro.EtapComments; if (pro.Year == 2010) EtapComments = EtapComments.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); else if (pro.Year == 2012) { EtapComments = EtapComments.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); EtapComments = EtapComments.replace(new RegExp("/img/logo/", 'g'), "http://london2012.infosport.ru/img/logo/"); } else if (pro.Year == 2014) EtapComments = EtapComments.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/sochi2014/"); else if (pro.Year == 2016) EtapComments = EtapComments.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/rio2016/"); stageclear = stageclear + ' (' + EtapComments + ')'; } $('#boxprotocols').append( $('

', { 'class': 'special-table-heading' }) .append($('', { 'class': 'sex', text: titleclear })) .append($('', { 'class': 'type', html: stageclear })) .append($('', { href: '#', 'class': 'protocol', text: 'протокол', 'data-schedulerid': pro.SchedulerId })) ); var protocol = pro.Protocol; if (protocol != null) { if (pro.Year == 2010) protocol = protocol.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); else if (pro.Year == 2012) { protocol = protocol.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); protocol = protocol.replace(new RegExp("/img/logo/", 'g'), "http://london2012.infosport.ru/img/logo/"); protocol = protocol.replace(new RegExp("http://www.london2012.com/imgml/icons/ct/", 'g'), "/content/uploads/olympflags/london2012/sport/"); } else if (pro.Year == 2014) protocol = protocol.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/sochi2014/"); else if (pro.Year == 2016) protocol = protocol.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/rio2016/"); } var jqprotocol = $(protocol); jqprotocol.addClass('year-' + pro.Year); $('#boxprotocols').append(jqprotocol); ogid = pro.OlympicGameId; } $('#boxprotocols table.year-2010 tr td a,#boxprotocols table.year-2012 tr td a,#boxprotocols table.year-2014 tr td a').each(function (e) { if (typeof ($(this).attr("href")) == 'undefined' || ($(this).attr("href") != "" && $(this).attr("href").indexOf("infosport.ru") == -1)) { $(this).after($(this).html()); $(this).remove(); } }); $('#boxprotocols table.year-2016 a').each(function (e) { if (typeof ($(this).attr("href")) == 'undefined' || ($(this).attr("href") == "/person/" + p.Id)) { $(this).after($(this).html()); $(this).remove(); } }); if (p.SocietiesForAjaxList.length) $('.popup-content.atlet-content #boxsocieties').show(); else $('.popup-content.atlet-content #boxsocieties').hide(); $('#boxsocieties tbody').html(''); if (p.SocietiesForAjaxList.length > 0) for (var i = 0; i < p.SocietiesForAjaxList.length; i++) { var soc = p.SocietiesForAjaxList[i]; $('#boxsocieties tbody').append( $('') .append($('', { 'class': 'sex', text: STitle })) .append($('', { 'class': 'type', html: EtapText })) ); var protocol = S.ProtocolHtml; //.replace(new RegExp("/content/uploads/olympflags/", 'g'), "http://sochi2014.infosport.ru/content/uploads/olympflags/"); if (S.Year == 2010) protocol = protocol.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/vancouver2010/"); else if (S.Year == 2012) { protocol = protocol.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); protocol = protocol.replace(new RegExp("http://www.london2012.com/imgml/icons/ct/", 'g'), "/content/uploads/olympflags/london2012/sport/"); } else if (S.Year == 2014) protocol = protocol.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/sochi2014/"); else if (S.Year == 2016) protocol = protocol.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/rio2016/"); $('.atlet-popup.level2 .scroll-wrap #boxprotocols').append(protocol); $('.atlet-popup.level2 .scroll-wrap #boxprotocols table').addClass('year-' + S.Year); if (S.Year == 2016) { $('.atlet-popup.level2 #boxprotocols table tr td a').each(function (e) { if (typeof ($(this).attr("href")) == 'undefined' || ($(this).attr("href") == "/person/" + ISPerson.ShowId)) { $(this).after($(this).html()); $(this).remove(); } }); } else $('.atlet-popup.level2 #boxprotocols table tr td a').each(function (e) { if (typeof ($(this).attr("href")) == 'undefined' || ($(this).attr("href") != "" && $(this).attr("href").indexOf("infosport.ru") == -1)) { $(this).after($(this).html()); $(this).remove(); } }); $('.atlet-popup.level2').css({ top: $(window).scrollTop(), width: ($("#container").width() < 1000) ? $("#container").width() : 1000 }); $('.atlet-popup.level2 a.close').unbind('click'); $('.atlet-popup.level2 a.close').click(function () { $('.atlet-popup.level2').remove(); $('.atlet-popup-bg.level2').remove(); return false; }); } } }); } return false; }); }, TextClickOnLink: function (el) { var thisclass = this; var href = el.attr('href'); var id = 0; if (href.toLowerCase().indexOf('allbdpro/doc.asp?') > -1) id = parseInt(href.substring(21)); else if (href.toLowerCase().indexOf('/person/') > -1) id = parseInt(href.substring(8)); if (id > 0) { if (thisclass.PersonsLastById[id] != undefined) { //thisclass.SetAtletPopupToggle(this.PersonsLast[thisclass.PersonsLastById[id]]); thisclass.AtletPopupToggle({ data: function (str) { return '' + id; } }); $(".atlet-popup").css('z-index', '3003'); $(".atlet-popup-bg").css('z-index', '2008'); } else { $.ajax({ url: "/ajax/personsforsearch?v=" + ISCommon.GetV(), data: { PersonsIdsString: '[' + id + ']' }, success: function (d) { if (d.PersonsSearch.length) { var plastById = {}; for (var i = 0; i < d.PersonsSearch.length; i++) plastById[d.PersonsSearch[i].Id] = i; var p = d.PersonsSearch[plastById[parseInt(id)]]; thisclass.PersonsLastById[p.Id] = thisclass.PersonsLast.length; thisclass.PersonsLast.push(p); if (thisclass.PersonsLastById[p.Id] != undefined) { $(".atlet-popup").css({ top: $(window).scrollTop() }); $(".atlet-popup-bg").css({ top: $(window).scrollTop() }); thisclass.AtletPopupToggle({ data: function (str) { return '' + p.Id; } }); $(".atlet-popup").css('z-index', '3003'); $(".atlet-popup-bg").css('z-index', '2008'); } } } }); } return false; } return true; }, PersonsLastInit: function () { var thisclass = this; $(".atlet-view-history .simple-block").hover(function () { $(this).find('img.black-white').stop().animate({ "opacity": "0" }, "slow"); }, function () { $(this).find('img.black-white').stop().animate({ "opacity": "1" }, "slow"); }); $(".atlet-view-history a.simple-block").click(function () { thisclass.AtletPopupToggle($(this)); return false; }); }, PersonsLastAdd: function (p) { var thisclass = this; var cookie = p.Id; var pnew = []; this.PersonsLastById = {}; pnew.push(p); this.PersonsLastById[p.Id] = 0; $('.atlet-view-history').show(); $('.atlet-history-list .simple-block[data-personid=' + p.Id + ']').remove(); for (i = 0; i < this.PersonsLast.length; i++) if (p.Id != this.PersonsLast[i].Id && pnew.length < 9) { this.PersonsLastById[this.PersonsLast[i].Id] = pnew.length; pnew.push(this.PersonsLast[i]); cookie += '-' + this.PersonsLast[i].Id; } this.PersonsLast = pnew; var a = thisclass.GetASimpleBlockByP(p, 'history'); $('.atlet-history-list').prepend(a); $('.atlet-history-list .simple-block').eq(9).remove(); $.cookie('PersonsLastView', cookie, { path: '/person', expires: 366 }); this.PersonsLastInit(); }, PersonsLastGet: function () { var thisclass = this; var data = $.cookie('PersonsLastView'); if (data != null && data != "" && data.indexOf('-') > -1) { $('.atlet-view-history').show(); var strIds = data.split("-"); $.ajax({ url: "/ajax/personsforsearch?v=" + ISCommon.GetV(), data: { PersonsIdsString: JSON.stringify(strIds) }, success: function (d) { thisclass.PersonsLast = []; var plastById = {}; for (var i = 0; i < d.PersonsSearch.length; i++) plastById[d.PersonsSearch[i].Id] = i; $('.atlet-history-list').html(''); for (var i = 0; i < strIds.length; i++) if (strIds[i] != "" && plastById[parseInt(strIds[i])] != undefined) { var p = d.PersonsSearch[plastById[parseInt(strIds[i])]]; thisclass.PersonsLastById[p.Id] = thisclass.PersonsLast.length; thisclass.PersonsLast.push(p); var a = thisclass.GetASimpleBlockByP(p, 'history'); $('.atlet-history-list').append(a); } $('.atlet-history-list').append($('

', { 'class': 'clear' })); thisclass.PersonsLastInit(); } }); } else $('.atlet-view-history').hide(); }, BindBigBlocks: function () { var thisclass = this; $(".atlet-results .results-list .simple-block img").css('height', 'auto'); $(".wrap-block").each(function () { thisclass.BindBigBlocksItem($(this)); }); var Take = 0; var last = $('.content .page-content .atlet-results .results-list .simple-block:last'); var map = { 10: 8, 150: 7, 290: 6, 430: 5, 570: 4, 710: 3, 850: 2, 990: 1, 1130: 0 }; if (last.length && parseInt(last.css('left').replace('px')) < 1130) { Take = map[parseInt(last.css('left').replace('px'))]; if (last.hasClass('huge-block')) Take = Take - 4; else if (last.hasClass('big-block')) Take = Take - 2; } $('.atlet-results #button-open').show(); return false; /* if (Take > 0 && thisclass.Type == 'person') $.ajax({ url: "/ajax/personsforsearchform?v=" + ISCommon.GetV(), data: { Take: Take, SearchSkip: thisclass.PersonsSearchViewCount, ProfessionId: $('.atlet-filter #ProfessionId').val(), LocationsRegionId: $('.atlet-filter #LocationsRegionId').val(), PlaceOfBirthRegionId: $('.atlet-filter #PlaceOfBirthRegionId').val(), WinterSportId: $('.atlet-filter #WinterSportId').val(), SummerSportId: $('.atlet-filter #SummerSportId').val(), SportId: $('.atlet-filter #SportId').val(), FIO: $('.atlet-filter #FIO').val(), YearFrom: $('.atlet-filter #YearFrom').val(), YearTo: $('.atlet-filter #YearTo').val(), ChampionId: $('.atlet-filter #ChampionId').val(), RankId: $('.atlet-filter #RankId').val() }, success: function (d) { thisclass.PersonsSearchCount = d.PersonsSearchCount; thisclass.PersonsSearchFirst = d.PersonsForAjaxList; thisclass.PersonsSearchViewCount = thisclass.PersonsSearchViewCount + d.PersonsForAjaxList.length; thisclass.BindBigBlocksFirst(); } }); */ }, BindBigBlocksFirst: function () { var thisclass = this; if (ISCatalogs.Sport.length > 0) { for (var i = 0; i < thisclass.PersonsSearchFirst.length; i++) { var a = thisclass.GetASimpleBlockByP(thisclass.PersonsSearchFirst[i]); $('div.results-list div.resultbottom').before(a); $('.atlet-results .results-list').masonry().masonry('appended', a);//.masonry(); } thisclass.ResultsListInit(); if (thisclass.PersonsSearchCount == thisclass.PersonsIds.length + thisclass.PersonsSearchFirst.length) $('.atlet-results #button-open').hide(); } else setTimeout(function () { thisclass.BindBigBlocksFirst(); }, 100); }, BindBigBlocksItem: function (el) { if (!el.parent().hasClass('huge-block')) { var startLft = el.position().left, startLftOffset = el.parent().position().left + 10, width = el.outerWidth(true); el.unbind('mouseover').unbind('mouseout'); el.on('mouseover', function () { $(this).parent().css({ 'z-index': 1001 }); $('.content-wrap .page-content').css({ 'overflow': 'visible' }); //$(this).addClass('active'); if ($("#container").width() <= startLftOffset + width) $(this).addClass('showleft'); var ch = 0; while ($(this).find('.full').outerHeight() > 365 && ch < 10) { //$(this).find('.sport-link').text($(this).find('.full').outerHeight()); $(this).find('.full p:last').remove(); $(this).find('.full p:last').append('..'); ch++; } }); el.on('mouseout', function () { var startLft = $(this).data('startLft'), startLftOffset = $(this).data('startLftOffset'), width = $(this).data('startLftwidth'); $(this).parent().css({ 'z-index': 1000 }); $('.content-wrap .page-content').css({ 'overflow': 'hidden' }); $(this).removeClass('active'); /* if ($("#container").width() <= startLftOffset + width) $(this).css('left', (startLft)); */ }); /* var parent = el.parent(); if (parseInt(parent.css('top').replace('px')) > 10) parent.addClass('inwardly'); */ } }, GetASimpleBlockByP: function (p, t) { var thisclass = this; var photoblack = p.Photo ? '/InfoSport.aspx?s=' + p.Photo : (p.PicFile != null && p.PicFile != '' ? '/InfoSport.aspx?photo=' + p.PicFile : '/content/images/person_no_photo.jpg'); var photocolor = p.Photo ? '/content/uploads/personalities/small/' + p.Photo : (p.PicFile != null && p.PicFile != '' ? 'http://old.infosport.ru/images/photo/' + p.PicFile : '/content/images/person_no_photo.jpg'); var imgclass = ""; if (p.Photo == null || p.Photo.length == 0) { if (p.PicFile != null && p.PicFile != '') imgclass = "oldinfosport"; else if (p.IsPhotoNotFound) { imgclass = "photo-not-found"; photoblack = '/content/images/photo_not_found.jpg'; photocolor = photoblack; } else imgclass = "no-photo"; } if (t != 'history') { var sportspan = $('', { 'class': 'sport-link' }) if (p.SportIds.length > 0) { sportspan.append($('', { src: '/content/uploads/sport/' + ISCatalogs.SportGet(p.SportIds[0]).Logo })).append(ISCatalogs.SportGet(p.SportIds[0]).Name); if (ISCatalogs.SportGet(p.SportIds[0]).Name.length > 20) sportspan.attr('style', 'line-height:21px;'); } } var templateByType = { 0: 'BlackAndWhite', 1: 'Color', 2: 'BigChangeSize', 3: 'BigWithBlue' }; var a = $(' ', { 'class': 'simple-block', href: '/person/' + p.Id, 'data-personid': p.Id, 'data-template': templateByType[p.TemplateType] }); if (0 == p.TemplateType && (p.Photo || p.PicFile)) a.append($('', { src: photoblack, 'class': 'black-white ' + imgclass })); a.append($('', { src: photocolor, 'class': 'color ' + imgclass })) .append($('

', { 'class': 'block-fio' }).append($('', { html: p.FName + '
' + p.LName }))); return a; }, FilterInit: function () { var thisclass = this; thisclass.FilterLoadGroupBySport(0); if ($('#SummerSportId').val() > 0) thisclass.FilterLoadGroupBySport($('#SummerSportId').val()); if ($('#WinterSportId').val() > 0) thisclass.FilterLoadGroupBySport($('#WinterSportId').val()); $('#ProfessionId').change(function () { thisclass.FilterChange("ProfessionId"); }); $('#ChampionId').change(function () { thisclass.FilterChange("ChampionId"); }); $('#RankId').change(function () { thisclass.FilterChange("RankId"); }); $('#ScientificId').change(function () { thisclass.FilterChange("ScientificId"); }); $('#LocationsRegionId').change(function () { thisclass.FilterChange("LocationsRegionId"); }); $('#PlaceOfBirthRegionId').change(function () { thisclass.FilterChange("PlaceOfBirthRegionId"); }); $('#RegionId').change(function () { thisclass.FilterChange("RegionId"); }); $('#YearFrom').change(function () { thisclass.FilterChange("YearFrom"); }); $('#YearTo').change(function () { thisclass.FilterChange("YearTo"); }); $('#SummerSportId').change(function () { if ($(this).val() > 0 && !thisclass.GroupBy[$(this).val()]) $.ajax({ url: "/ajax/getfilterforperson?v=" + ISCommon.GetV(), data: { SportId: $(this).val() }, success: function (d) { thisclass.GroupBy[d.s] = d.f; thisclass.FilterChange("SummerSportId"); } }); else thisclass.FilterChange("SummerSportId"); }); $('#WinterSportId').change(function () { if ($(this).val() > 0 && !thisclass.GroupBy[$(this).val()]) $.ajax({ url: "/ajax/getfilterforperson?v=" + ISCommon.GetV(), data: { SportId: $(this).val() }, success: function (d) { thisclass.GroupBy[d.s] = d.f; thisclass.FilterChange("WinterSportId"); } }); else thisclass.FilterChange("WinterSportId"); }); }, FilterLoadGroupBySport: function (sport) { var thisclass = this; $.ajax({ url: "/ajax/getfilterforperson?v=" + ISCommon.GetV(), data: { SportId: sport }, success: function (d) { thisclass.GroupBy[d.s] = d.f; thisclass.FilterChange(''); } }); }, FilterChange: function (t) { var thisclass = this; var sportIds = [];//$('#SummerSportId').val() > 0 ? $('#SummerSportId').val() : $('#WinterSportId').val(); if ($('#SummerSportId').val() > 0) sportIds.push($('#SummerSportId').val()); if ($('#WinterSportId').val() > 0) sportIds.push($('#WinterSportId').val()); if ( $('#ChampionId').val() > 0 || $('#ProfessionId').val() > 0 || $('#RankId').val() > 0 || $('#ScientificId').val() > 0 || $('#LocationsRegionId').val() > 0 || $('#PlaceOfBirthRegionId').val() > 0 || $('#RegionId').val() > 0 || $('#YearFrom').val() > 0 || $('#YearTo').val() > 0 ) { $.ajax({ type: "post", url: "/ajax/getsportbyfilter?v=" + ISCommon.GetV(), data: { C : $('#ChampionId').val(), P : $('#ProfessionId').val(), R : $('#RankId').val(), S : $('#ScientificId').val(), L : $('#LocationsRegionId').val(), B : $('#PlaceOfBirthRegionId').val(), O : $('#RegionId').val(), Y : $('#YearFrom').val(), M : $('#YearTo').val() }, success: function (d) { if ( d.C == $('#ChampionId').val() && d.P == $('#ProfessionId').val() && d.R == $('#RankId').val() && d.S == $('#ScientificId').val() && d.L == $('#LocationsRegionId').val() && d.B == $('#PlaceOfBirthRegionId').val() && d.O == $('#RegionId').val() && d.Y == $('#YearFrom').val() && d.M == $('#YearTo').val() ) { $('#sport-title-abc').html('Виды спорта (' + d.Sport.length + '):'); $('.atlet-filter .letters a').each(function () { var view = false; $(".atlet-filter .sportLinks a[letter=" + "'" + $(this).html().toUpperCase() + "'" + "]").each(function () { if ($.inArray($(this).data('sport'), d.Sport) > -1) { $(this).removeClass('empty'); view = true; } else { $(this).addClass('empty'); } }); if ($(this).hasClass('sportLetter')) { if (view) $(this).removeClass('empty'); else $(this).addClass('empty'); } }); $('#SummerSportId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), d.Sport) > -1) $(this).show(); else $(this).hide(); }); $('#SummerSportId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); $('#WinterSportId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), d.Sport) > -1) $(this).show(); else $(this).hide(); }); $('#WinterSportId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } } }); } else { $('#sport-title-abc').html('Виды спорта (' + $('.atlet-filter .sportLinks a').length + '):'); $('.atlet-filter .sportLinks a').removeClass('empty'); $('.atlet-filter .letters a').each(function () { var view = false; $(".atlet-filter .sportLinks a[letter=" + "'" + $(this).html().toUpperCase() + "'" + "]").each(function () { if (!$(this).hasClass('empty')) view = true; }); if ($(this).hasClass('sportLetter')) { if (view) $(this).removeClass('empty'); else $(this).addClass('empty'); } }); $('#SummerSportId').parent().find('li').show(); $('#WinterSportId').parent().find('li').show(); } var group = [];//sportIds.length == 0 ? thisclass.FilterGroup(0) : thisclass.FilterGroup(sportIds[0]); if (sportIds.length == 0) group = thisclass.FilterGroup(0, t); else if (sportIds.length == 1) group = thisclass.FilterGroup(sportIds[0], t); else if(sportIds.length > 1) { var gr0 = thisclass.FilterGroup(sportIds[0], t); var gr1 = thisclass.FilterGroup(sportIds[1], t); var c = [], p = [], r = [], l = [], b = [], o = [], y = 2017, m = 0; for (var i = 0; i < gr0.c.length; i++) if ($.inArray(gr0.c[i], gr1.c) > -1) c.push(gr0.c[i]); for (var i = 0; i < gr0.p.length; i++) if ($.inArray(gr0.p[i], gr1.p) > -1) p.push(gr0.p[i]); for (var i = 0; i < gr0.r.length; i++) if ($.inArray(gr0.r[i], gr1.r) > -1) r.push(gr0.r[i]); for (var i = 0; i < gr0.l.length; i++) if ($.inArray(gr0.l[i], gr1.l) > -1) l.push(gr0.l[i]); for (var i = 0; i < gr0.b.length; i++) if ($.inArray(gr0.b[i], gr1.b) > -1) b.push(gr0.b[i]); for (var i = 0; i < gr0.o.length; i++) if ($.inArray(gr0.o[i], gr1.o) > -1) o.push(gr0.o[i]); for (var i = 0; i < gr0.y.length; i++) if ($.inArray(gr0.y[i], gr1.y) > -1) y.push(gr0.y[i]); for (var i = 0; i < gr0.m.length; i++) if ($.inArray(gr0.m[i], gr1.m) > -1) m.push(gr0.m[i]); group = { c:c, p:p, r:r, l:l, b:b, o:o, y:y, m:m }; } if ("ChampionId" != t){ $('#ChampionId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.c) > -1) $(this).show(); else $(this).hide(); }); $('#ChampionId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("ProfessionId" != t) { $('#ProfessionId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.p) > -1) $(this).show(); else $(this).hide(); }); $('#ProfessionId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("RankId" != t) { $('#RankId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.r) > -1) $(this).show(); else $(this).hide(); }); $('#RankId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("ScientificId" != t) { $('#ScientificId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.r) > -1) $(this).show(); else $(this).hide(); }); $('#ScientificId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("LocationsRegionId" != t) { $('#LocationsRegionId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.l) > -1) $(this).show(); else $(this).hide(); }); $('#LocationsRegionId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("PlaceOfBirthRegionId" != t) { $('#PlaceOfBirthRegionId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.b) > -1) $(this).show(); else $(this).hide(); }); $('#PlaceOfBirthRegionId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("RegionId" != t) { $('#RegionId').parent().find('li').each(function () { if ($(this).data('value') == 0 || $.inArray($(this).data('value'), group.o) > -1) $(this).show(); else $(this).hide(); }); $('#RegionId').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("YearFrom" != t) { $('#YearFrom').parent().find('li').each(function () { if ($(this).data('value') == 0 || (group.m >= $(this).data('value') && $(this).data('value') >= group.y)) $(this).show(); else $(this).hide(); }); $('#YearFrom').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } if ("YearTo" != t) { $('#YearTo').parent().find('li').each(function () { if ($(this).data('value') == 0 || (group.y <= $(this).data('value') && $(this).data('value') <= group.m)) $(this).show(); else $(this).hide(); }); $('#YearTo').parent().find('ul').css({ height: 'auto', 'max-height': '400px' }); } }, FilterGroup: function (sportId, t) { var thisclass = this; var C = $('#ChampionId').val(), P = $('#ProfessionId').val(), R = $('#RankId').val(), S = $('#ScientificId').val(), L = $('#LocationsRegionId').val(), B = $('#PlaceOfBirthRegionId').val(), O = $('#RegionId').val(), Y = $('#YearFrom').val(), M = $('#YearTo').val(); var c = [], p = [], r = [], l = [], b = [], o = [], y = 2017, m = 0; if (thisclass.GroupBy && thisclass.GroupBy[sportId]) for (var i = 0; i < thisclass.GroupBy[sportId].length; i++) { if ( "YearFrom" != t && (thisclass.GroupBy[sportId][i].Y && thisclass.GroupBy[sportId][i].Y < y) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) y = thisclass.GroupBy[sportId][i].Y; if ( "YearTo" != t && (thisclass.GroupBy[sportId][i].Y && thisclass.GroupBy[sportId][i].M > m) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) m = thisclass.GroupBy[sportId][i].M; if ( "ChampionId" != t && (thisclass.GroupBy[sportId][i].C && $.inArray(thisclass.GroupBy[sportId][i].C, c) == -1) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) c.push(thisclass.GroupBy[sportId][i].C); if ( "ProfessionId" != t && (thisclass.GroupBy[sportId][i].P && $.inArray(thisclass.GroupBy[sportId][i].P, p) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) p.push(thisclass.GroupBy[sportId][i].P); if ( "RankId" != t && (thisclass.GroupBy[sportId][i].R && $.inArray(thisclass.GroupBy[sportId][i].R, r) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) r.push(thisclass.GroupBy[sportId][i].R); if ( "ScientificId" != t && (thisclass.GroupBy[sportId][i].R && $.inArray(thisclass.GroupBy[sportId][i].R, r) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) r.push(thisclass.GroupBy[sportId][i].R); if ( "LocationsRegionId" != t && (thisclass.GroupBy[sportId][i].L && $.inArray(thisclass.GroupBy[sportId][i].L, l) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) l.push(thisclass.GroupBy[sportId][i].L); if ( "PlaceOfBirthRegionId" != t && (thisclass.GroupBy[sportId][i].B && $.inArray(thisclass.GroupBy[sportId][i].B, b) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (O == 0 || O == thisclass.GroupBy[sportId][i].O) ) b.push(thisclass.GroupBy[sportId][i].B); if ( "RegionId" != t && (thisclass.GroupBy[sportId][i].O && $.inArray(thisclass.GroupBy[sportId][i].O, o) == -1) && (C == 0 || C == thisclass.GroupBy[sportId][i].C) && (P == 0 || P == thisclass.GroupBy[sportId][i].P) && (R == 0 || R == thisclass.GroupBy[sportId][i].R) && (S == 0 || S == thisclass.GroupBy[sportId][i].R) && (L == 0 || L == thisclass.GroupBy[sportId][i].L) && (B == 0 || B == thisclass.GroupBy[sportId][i].B) ) o.push(thisclass.GroupBy[sportId][i].O); } return { c:c, p:p, r:r, l:l, b:b, o:o, y:y, m:m}; }, FilterClear: function () { var thisclass = this; $("#WinterSportId, #ProfessionId, #SummerSportId, .atlet-filter #ChampionId, .atlet-filter #RankId, .atlet-filter #ScientificId, #RegionId, #PlaceOfBirthRegionId, #LocationsRegionId, #YearFrom, #YearTo").each(function () { $(this).val(0); $(this).data("selectik").refreshCS(); if ($(this).attr('name') == "SummerSportId") $(this).parent().find('.custom-text').text('Летние'); else if ($(this).attr('name') == "WinterSportId") $(this).parent().find('.custom-text').text('Зимние'); else if ($(this).attr('name') == "YearFrom") $(this).parent().find('.custom-text').text('от'); else if ($(this).attr('name') == "YearTo") $(this).parent().find('.custom-text').text('до'); else $(this).parent().find('.custom-text').text('Не выбран'); }); $('#FIO').val(''); $('#SportId').val(''); if ($('.atlet-filter .form-element.letters .linkItem.selectedItem').length > 0) { $('.atlet-filter .form-element.letters .linkItem.selectedItem').removeClass('selectedItem').addClass('hideLink'); $('.atlet-filter .form-element.letters .linkItem.active_item').removeClass('active_item').addClass('hideLink'); } $('#sport-title-abc').html('Виды спорта (' + $('.atlet-filter .sportLinks a').length + '):'); $('.atlet-filter .sportLinks a').removeClass('empty'); $('.atlet-filter .letters a').each(function () { var view = false; $(".atlet-filter .sportLinks a[letter=" + "'" + $(this).html().toUpperCase() + "'" + "]").each(function () { if (!$(this).hasClass('empty')) view = true; }); if ($(this).hasClass('sportLetter')) { if (view) $(this).removeClass('empty'); else $(this).addClass('empty'); } }); $('#SummerSportId').parent().find('li').show(); $('#WinterSportId').parent().find('li').show(); }, FirstName: function (Name) { if (Name.indexOf('(') > -1) return Name.split(" ")[2]; return Name.split(" ")[1]; }, LastName: function (Name) { if (Name.indexOf('(') > -1) return Name.split(" ")[0] + ' ' + Name.split(" ")[1]; return Name.split(" ")[0]; }, SecondName: function (Name) { if (Name.indexOf('(') > -1) return Name.split(" ")[3]; return Name.split(" ")[2]; }, PersonClick: function (Id) { var thisclass = this; if ($.inArray(Id, ISPerson.Clicks) == -1) { ISPerson.Clicks.push(Id); $.ajax({ type: "post", url: "/ajax/personclick?v=" + ISCommon.GetV(), data: { Id: Id }, success: function (d) { if (d != null && d.Id > 0) { if (thisclass.PersonsLastById[d.Id] != undefined) { thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIW++; thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIM++; thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIY++; } else if (thisclass.PersonsTempById[d.Id] != undefined) { thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIW++; thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIM++; thisclass.PersonsLast[thisclass.PersonsLastById[d.Id]].PIY++; } } } }); } }, GetWordForViews: function (Count) { var d = Count % 10; if (d == 1) return "просмотр"; else if (d > 1 && d < 5 && (Count < 10 || Count > 20)) return "просмотра"; else return "просмотров"; }, GetWordForReferences: function (Count) { var d = Count % 10; if (d == 1) return "упоминание"; else if (d > 1 && d < 5 && (Count < 10 || Count > 20)) return "упоминания"; else return "упоминаний"; } }

', { text: soc.District })) .append($(' ', { text: soc.Region })) .append($(' ', { text: soc.City })) .append($(' ', { text: soc.Society })) .append($(' ', { text: soc.Club })) ) } var ch = 0; $('.popup-content.atlet-content .half-left .wrapper tr,.popup-content.atlet-content .half-right .wrapper tr').removeClass('even').removeClass('odd'); $('.popup-content.atlet-content .half-left .wrapper tr').each(function () { if ($(this).css('display') != 'none') { ch++; if (ch % 2 == 1) $(this).addClass('even'); else $(this).addClass('odd'); } }); ch = 0; $('.popup-content.atlet-content .half-right .wrapper tr').each(function () { if ($(this).css('display') != 'none') { ch++; if (ch % 2 == 1) $(this).addClass('even'); else $(this).addClass('odd'); } }); thisclass.SetAtletPopupToggleBind(); thisclass.AtletPopupToggleShow(p); }, SetAtletPopupToggleBind: function () { var thisclass = this; $('.popup-content.atlet-content .half-right.text-description a').unbind('click'); $('.popup-content.atlet-content .half-right.text-description a').click(function () { return thisclass.TextClickOnLink($(this)) }); $('.popup-content.atlet-content #boxprotocols .protocol').unbind('click'); $('.popup-content.atlet-content #boxprotocols .protocol').click(function () { if ($(this).data('schedulerid') > 0) { $.ajax({ url: "/ajax/scheduler?v=" + ISCommon.GetV(), data: { Id: $(this).data('schedulerid') }, async: false, success: function (d) { if (d.Result == "yes") { var S = d.Scheduler; $('body').append($('
', { 'class': 'atlet-popup-bg level2' })); $('.atlet-popup-bg.level2').show().css({ top: 0, height: $(document).outerHeight(), width: $(document).outerWidth() }); $('.atlet-popup').clone().addClass('level2').appendTo("body"); $('.atlet-popup.level2 .heading .heading-title').remove(); $('.atlet-popup.level2 .heading .print').remove(); $('.atlet-popup.level2 .scroll-wrap').html(''); $('.atlet-popup.level2 .scroll-wrap').append($('
', { 'class': 'tables' }).append($('
', { 'class': 'columns-2', id: 'boxprotocols' }))); $('.atlet-popup.level2 .scroll-wrap #boxprotocols').append($('

', { text: S.Title ? S.Title : "" })); var STitle = ''; if (S.Sport != '') STitle += S.Sport + ': '; var sexsplit = ''; if (S.Sex != null && S.Sex != '' && $.trim(S.Sex) != '-') { STitle += S.Sex; sexsplit = ' - '; } if (S.Discipline != '' && $.trim(S.Discipline) != '-') STitle += sexsplit + S.Discipline; var EtapText = ''; if (S.Etap != null && $.trim(S.Etap) != '' && $.trim(S.Etap) != '-') EtapText = $.trim(S.Etap); if (S.EtapComments && $.trim(S.EtapComments) != '') { var EtapComments = S.EtapComments; if (S.Year == 2010) EtapComments = EtapComments.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); else if (S.Year == 2012) { EtapComments = EtapComments.replace(new RegExp("/img/olympflags/", 'g'), "/content/uploads/olympflags/london2012/"); EtapComments = EtapComments.replace(new RegExp("/img/logo/", 'g'), "http://london2012.infosport.ru/img/logo/"); } else if (S.Year == 2014) EtapComments = EtapComments.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/sochi2014/"); else if (S.Year == 2016) EtapComments = EtapComments.replace(new RegExp("/content/uploads/olympflags/", 'g'), "/content/uploads/olympflags/rio2016/"); EtapText += EtapText != '' ? ' (' + $.trim(EtapComments) + ')' : $.trim(EtapComments); } $('.atlet-popup.level2 .scroll-wrap #boxprotocols').append( $('

', { 'class': 'special-table-heading' }) .append($('