$(window).load(function () { // Load SVG for FF only var firefox = !(window.mozInnerScreenX == null); if (firefox) { $('.mobile-search-expand li span, .footer-column ul li, .video-icon, #slideshow-controls a span, .wrapp a span, .news-video-icon, .video-controls .next, .video-controls .prev, .gallery-icon, .text-icon, #readspeaker_button1 a .icon, #slideshow-promo-controls span, .socialLinks ul li').addClass('svg-bg'); $('.svg-bg').addClass('ff-svg'); } }); /* Share button */ $('.shareBtn, .closeBtn').click(function (e) { if (!$('.article-share').hasClass('active')) { $('.article-share').addClass('active'); $('.article-share').find('ul').show(); /* apply overlay */ var overlay = $('
'); overlay.appendTo(document.body); } else { $('.mobile-mobile-overlay').fadeOut().remove(); $('.article-share ul').fadeOut(); $('.article-share').removeClass('active'); } }); $('.article-share ul, .shareBtn').click(function (event) { event.stopPropagation(); }); $(document).click(function () { $('.mobile-overlay').fadeOut().remove(); $('.article-share ul').fadeOut(); $('.article-share').removeClass('active'); }); $('.closeBtn').click(function () { $('.mobile-overlay').fadeOut().remove(); }); /* Share button end */ /* Carousel - hide controls if just 1 item */ if ($('#slideshow li').length <= 4) { $('#slide-pager_next').hide(); $('#slide-pager').css('margin-left','20px'); } if ($('.sidePromoSlider li').length <= 1) { $('#slideshow-promo-controls').hide(); } if ($('#slideshow li').length <= 1) { $('#slideshow-wrapper').css('margin-bottom', '2px') .find('#slideshow-controls').hide().end() .next('.wrapp').hide(); } $('.headline-wrapper h4').on('click', function () { var getUrl = $(this).parents('.headline-wrapper').children().find('a').attr('href'); window.location.href = getUrl; }); /* Search for team */ $('.search-box input.text').on({ focus: function () { if (this.value == 'Enter your post code...') this.value = ''; }, blur: function () { if (this.value == '') this.value = 'Enter your post code...'; } }); /* Video icons / anchor setup */ $('.headline-wrapper.video .image-wrapper a, .headline-wrapper.video .image-wrapper, .latestVideos a.video, .videoContainer').append(''); //$('.adaptive-body .videoContainer').hover( // function () { // $(this).addClass('active'); // }, // function () { // $(this).removeClass('active'); // } //); $('.headline-wrapper').last().addClass('last-item, last-promo'); $('.main-headlines .headlines h4, .sub-headlines .headlines h4').hover( function () { $(this).parents('.headlines').addClass('active').end().find('a').attr('href', $(this).parents('.headlines').find('.image-wrapper a').attr('href')).addClass('active'); }, function () { $(this).parents('.headlines').removeClass('active').end().children('a').removeClass('active'); } ); $('.main-headlines .image-wrapper, .sub-headlines .image-wrapper').hover( function () { $(this).parents('.headlines').addClass('active').find('h4 a').addClass('active'); }, function () { $(this).parents('.headlines').removeClass('active').find('h4 a').removeClass('active'); } ); $('.video-carousel-wrapper li h4, .video-carousel-wrapper li img, .video-carousel-wrapper li span').hover(function () { $(this).parents('.latestVideos').toggleClass('active'); }); $('li.headline-wrapper:even').css('margin-left', '0'); $('.main-headlines li:last-child, .sub-headlines.inline-headlines li:last-child, .min-headlines li:last-child').prev('li').andSelf().addClass('spacer'); /* Email forms */ $('.article-body .emailBtn').click(function () { $(this).next('.emailContainer').fadeToggle(100).css('display', 'inline-block'); $(this).toggleClass('active'); if ($(this).hasClass('active')) { $(this).parents('.socialBtns').css('margin-bottom', '0'); } else { $(this).parents('.socialBtns').css('margin-bottom', '15px'); } }); $('.article-body .email_options a').click(function () { $(this).parents('.emailContainer').fadeToggle(100); $(this).parents('.socialBtns').children().find('.emailBtn').toggleClass('active'); $(this).parents('.socialBtns').css('margin-bottom', '15px'); }); var windowWidth = $(window).width(); if (windowWidth >= 600) { $('.dropList').each(function () { var columns = $(this).siblings('.sub-nav').find('.wrapper ul').length; setWidth = columns * 190; $(this).siblings('.sub-nav').css('width', setWidth); }); } /* Adjust sponsors if none are loaded */ var sponsors = $('.adaptive-footerSponsors').length; if (sponsors == 0) { $('.footer-columns-container').css({ 'padding-bottom': '0', 'border-bottom': 'none' }); } $(document).ready(function () { /* Governance tables */ $('.gov-stats tr td:last-child').css('text-align', 'center'); $('.gov-stats .fairplay tr td:last-child').prev().css('text-align', 'center'); /* Inline table styles */ var tableCols = $('.article-container .article-body table th').length; var colWidth = 60 / tableCols; $('.article-container .article-body table th').not(':eq(1)').width(colWidth + '%'); $('.article-container .article-body table th:eq(1)').css({ 'text-align': 'left', 'padding-left': '9px' }); $('.article-container .article-body table tr').each(function () { $(this).children('td:eq(1)').css({ 'text-align': 'left', 'padding-left': '9px' }); }); if ($('.article-container .article-body p').length > 1) { if ($('.article-container .article-body p:first').find('strong').length > 0) { $('.article-container .article-body p:first').addClass('bintro'); } } function playBtn() { var heightImgSide = $('.inline-feature .videoContainer img').height(); var heightImg = $('.inner-feature .videoContainer img').height(); $('.inline-feature .videoContainer.overlay').height(heightImgSide); $('.inner-feature .videoContainer.overlay').height(heightImg); } $(window).resize(function () { if ($('.inline-feature .videoContainer, .inner-feature .videoContainer').hasClass('overlay')) { playBtn(); } }); $(window).bind("orientationchange", function (evt) { if ($('.videoContainer').hasClass('overlay')) { $('.article-hero .video-holder .videoContainer').show(); $('.article-hero .video-holder .videoPlaceholder').hide(); playBtn(); } var widthImg = $('.videoContainer img').width(); var heightImg = $('.videoContainer img').height(); $('.BCLvideoWrapper, .BCLvideoWrapper object, .BCLvideoWrapper iframe').width(widthImg); $('.BCLvideoWrapper object, .BCLvideoWrapper iframe').height(heightImg); if (window.matchMedia("(orientation: portrait)").matches) { } if (window.matchMedia("(orientation: landscape)").matches) { } }); }); $(window).load(function () { $('.videoContainer').each(function () { if ($('.videoContainer').is(':visible')) { $(this).addClass('overlay'); } if ($(this).children('img').length == 0) { $(this).hide().siblings('.videoPlaceholder').show(); } }); $('.videoPlaceholder').each(function () { if ($('.videoPlaceholder').is(':visible')) { $(this).addClass('no-overlay'); } }); }); /* Add class to odd promo containers */ $('.main-body.custom-container .promo-pods:even').addClass('even'); /* Check if News-section has a h2 */ $('.news-section').prev('h2').css('background-color', '#A01E21'); /* YOUTH */ /* Check if min headlines is on page */ if (($('.min-headlines').length == 0) && ($('.archiveBtn').length >= 1)) { $('.archiveBtn').css({'border-top' : '0', 'padding-top' : '0'}); } /* Check if Youth filter exists */ if ($('.youth-filter').length >= 0) { $('.video-carousel-wrapper').css({ 'padding-bottom': '10px', 'border-bottom': '0' }); } $('.youth-filter .sbSelector').click(function () { $('.sbOptions li:first-child').hide(); }); /* Accordion */ function ajax_accordion() { var getSelection = $('.youth-filter .sbSelector').text().split(' ')[0]; if (getSelection == "Women's") { $('#teamstat-ajaxContent #squad').addClass('womens'); } $('#teamstat-ajaxContent > div').each(function () { if (!$(this).hasClass('accordion')) { $(this).addClass('accordion'); $(this).children('h3').append(''); } }); /* Only 1st item open on load */ $('#teamstat-ajaxContent .accordion').each(function () { $('#teamstat-ajaxContent .accordion div').not('#teamstat-ajaxContent .accordion:first-child div').hide().prev('h3').find('span').addClass('open'); }); $('#teamstat-ajaxContent .accordion').unbind('click').on('click', 'h3', function () { $(this).find('.expand').toggleClass('open').parent().next().slideToggle(); }); $('.optionsBtn').unbind().click(function () { $('.moreOptions').fadeToggle(); }); /* Hide Manager image on youth squads */ $('#teamstat-ajaxContent #squad h4').each(function () { if ($(this).text() == 'Manager') { $(this).parent('li').siblings().css({'background-image':'none','padding-left':'10px'}); } }); } /* Mobile h2 fix on widget page */ if ($('.news-section').prev().is('h2')) { $('.news-section').prev('h2').addClass('widgetHeader').end().find('.headline-wrapper:first-child').css('border-top','0'); } /* Custom widget loader - FA Stats */ $('.capStats').append(''); /* Scroll for youth page */ var navLinks = $('.england-theme .adaptive-sub-navigation .secondary-nav li a').not('.england-theme .adaptive-sub-navigation .secondary-nav li ul li'); $(navLinks).each(function () { if ((($(this).text() == 'Youth')) || (($(this).text() == 'Disability'))) { $(this).parent().find('.wrapper ul li').not('.wrapper ul li:first-child').addClass('scrollTo'); } }); $('.team.active .scrollTo').on('click', function() { var hash = window.location.hash; if (hash == '#team-stats') { history.pushState("", document.title, window.location.pathname); setTimeout(function () { dest = $('#teamstat-ajaxContent').offset().top - 135; $('html,body').animate({ scrollTop: dest }, 1500, 'swing'); }, 500); } }); /* Year Validation */ $('.moreOptions input').keyup(function () { this.value = this.value.replace(/[^0-9\.]/g, ''); }); /* Position right column depending on breadcrumb */ if (!$('.breadcrumb').siblings('.widgets').length == 0) { $('.article-single-column').css('margin-top', '32px'); $('.breadcrumb').siblings('.widgets').css('margin-top', '12px'); } else if (!$('.breadcrumb').length == 0) { $('.article-single-column').css('margin-top', '40px'); } /* Get TeamID from URL and update squad */ function GetURLParameter(Param) { var PageURL = window.location.search.substring(1); var URLVariables = PageURL.split('?'); for (var i = 0; i < URLVariables.length; i++) { var ParameterName = URLVariables[i].split('='); if (ParameterName[0] == Param) { return ParameterName[1]; } } } var teamID = GetURLParameter('teamid');; $('#team-select .sbOptions li a').each(function () { if ($(this).attr('rel') == teamID) { var updateSelect = ($(this).text()); $(this).parents('.sbHolder').find('.sbSelector').text(updateSelect); } });