ISCommon = { Url: '', Guid: '', GetV: function () { //ISCommon.GetV() return (Math.random() + '').substr(2); }, Run: function (setting) { var document_location = document.location; if (document_location != document_location.toString().toLowerCase()) window.history.pushState({}, '', document_location.toString().toLowerCase()); this.Url = typeof setting.Url == "undefined" ? document_location.toString().toLowerCase() : setting.Url.toLowerCase(); this.Guid = (typeof $.cookie('guid') == "undefined" || $.cookie('guid') == null) ? '' : $.cookie('guid'); $("[data-namesystem]").click(function () { $.ajax({ type: "post", url: "/ajax/moduleclick?v=" + ISCommon.GetV(), data: { G: ISCommon.Guid, namesystem: $(this).data("namesystem") }, success: function (d) { if (d.result == 'yes' && ISCommon.Guid == '') ISCommon.SetGuid(d.guid); } }); }); $(".specialproject_click").click(function () { $.ajax({ url: "/ajax/specialprojectclick?v=" + ISCommon.GetV(), data: { Id: $(this).data("specialprojectid") }, async: false, success: function (d) { } }); return true; }); $('a').each(function () { var href = $(this).attr('href'); var target = $(this).attr('target'); if (href && href != '' && href.indexOf('http://') > -1 && href.indexOf('infosport.ru') == -1) $(this).attr('target', '_blank'); }); this.Visit(); this.AddNews(); }, DisabledPage: function () { $('.disabled-popup-bg').show(); $(".disabled-popup-bg").css({ top: 0, height: $(document).outerHeight() }); $(window).on('resize', function () { if ($('.disabled-popup-bg').is(":visible")) $(".disabled-popup-bg").css({ top: 0, height: $(document).outerHeight() }); }); }, IncludedPage: function () { $('.disabled-popup-bg').hide(); }, ValidateEmail: function (email) { var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; return re.test(email); }, Visit: function () { $.ajax({ url: "/ajax/visit?v=" + ISCommon.GetV(), data: { G: ISCommon.Guid, Url: this.Url, Referer: document.referrer }, success: function (d) { if (d.result == 'yes' && ISCommon.Guid == '') ISCommon.SetGuid(d.guid); } }); }, SetGuid: function (guid) { $.cookie('guid', guid, { expires: 365, path: '/', }); }, GetGuid: function () { ISCommon.Guid = (typeof $.cookie('guid') == "undefined" || $.cookie('guid') == null) ? '' : $.cookie('guid'); return ISCommon.Guid; }, AddNews: function () { $('#button-open-downloadnews').unbind('click'); $('#button-open-downloadnews').click(function () { var el = $(this); el.hide(); el.attr('disabled', 'disabled'); var data = { Page: el.data('page') + 1, type: el.data('type'), PStId: el.data('PStId') }; if (el.data('type') == 'search') data.Search = $('.header-wrap #q').val(); else if (el.data('type') == 'organizations') data.Search = $('.org-filter #Name').val(); else data.Search = $('.atlet-filter #FIO').val(); $.ajax({ url: '/ajax/addnews?v=' + ISCommon.GetV(), data: data, success: function (d) { el.attr('data-page', d.Page); el.data('page', d.Page); el.data('pages', d.Pages); //thisclass.News.Page = d.Page; //thisclass.News.Pages = d.Pages; if (d.NewsList.length > 0) { $('#button-open-downloadnews').before('
'); var leftcount = (d.NewsList.length + (d.NewsList.length % 2 == 1 ? 1 : 0)) / 2; for (var i = 0; i < d.NewsList.length; i++) { var N = d.NewsList[i]; var element = $('
', { 'class': 'element' }) .append($('', { href: N.URL, 'class': 'fio', 'target': '_blank', text: N.Title })) .append($('

', { 'class': 'description', html: N.Mini })); if (N.RId != 1) element.append($('', { 'class': "project", html: '(Проект:

' + N.SiteName + ')' })); element.append($('', { href: N.URL, 'class': "atlet-text-date", text: N.DateTextFormat })); if (i < leftcount) $('.atlet-search-text-list .half-left:last .wrapper').append(element); else $('.atlet-search-text-list .half-right:last .wrapper').append(element); } } if (el.data('page') < el.data('pages')) { el.show(); el.removeAttr('disabled'); } else el.hide(); } }); return false; }); }, GetParameterByName: function (name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); }, ValidateEmail: function (email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } } IShelp = { Init: function () { $('.run-help').unbind('click'); $('.run-help').click(function () { IShelp.Load($(this).data('url')); return false; }); }, Load: function (url) { $.ajax({ type: "POST", url: "/ajax/gethelp?v=" + ISCommon.GetV(), data: { Url: url }, async: false, success: function (d) { if (d.help && d.help.Name && d.help.Name != '') IShelp.Show(d.help.Name, d.help.Text); } }); }, Show: function (Name, Text) { if ($('.edit-popup.help').length == 0) { $('body').append($('
', { 'class': 'edit-popup help', style: 'min-height: 300px;z-index: 3000;' })); $('.edit-popup.help').html( '
' + '
' ); } $('.edit-popup.help .popup-content').css({ 'max-height': 440 }); $('.edit-popup.help .heading .title').html(Name); $('.edit-popup.help .popup-content').html(Text); $('.edit-popup.help').show(); $('.edit-popup.help').css({ bottom: 0, width: 850, marginLeft: 0 }); $('.edit-popup.help .close-icon').unbind('click'); $('.edit-popup.help .close-icon').click(function () { $('.edit-popup.help').hide(); return false; }); } } ISMail = { Init: function () { $('.footer .subscribe form #button').click(function () { $.ajax({ type: "POST", url: "/ajax/mailadd?v=" + ISCommon.GetV(), data: { Email: $('.footer .subscribe form #email').val() }, async: false, success: function (d) { if (1 == d.status) $('.footer .subscribe form #messageemail').text($('.footer .subscribe form #email').val() + " - такой адрес уже есть в базе данных!"); else if (2 == d.status) { $('.footer .subscribe form #messageemail').text(" Ваш e-mail " + $('.footer .subscribe form #email').val() + " успешно подписан на рассылку новостей ИА \"Стадион\""); setTimeout(function () { //$('.footer .subscribe form #messageemail').text(""); }, 5000); } else if (3 == d.status) $('.footer .subscribe form #messageemail').text($('.footer .subscribe form #email').val() + " В вашем E-mail ошибка!"); } }); return false; }); } } ISWidgetBlockStatic = { Init: function () { $(".outer-link, .block").mouseover(function () { $(this).find('.hidden-text').stop().slideDown(250); $(this).find('.hidden-plus').stop().slideDown(250); }); $(".outer-link, .block").mouseout(function () { $(this).find('.hidden-text').stop().slideUp(250); $(this).find('.hidden-plus').stop().slideUp(250); }); } }