$(document).ready(function () { $("html").removeClass("no-js").addClass("js"); // Scripts for nav-subNavHeader /* $('.nav-subNavHeader ul li a').click( function () { $('.nav-subNavHeader ul li').attr('class', ''); $(this).parent().attr('class', 'actual'); return false; } ); */ // Nav $('.mod-nav a.sub').click(function () { var menuSub$ = $(".mod-nav .subMenuBox"); if (menuSub$.is(':hidden')) { menuSub$.show(); $(this).addClass("active"); } else { menuSub$.hide(); $(this).removeClass("active"); } }); $('.mod-nav').click(function (event) { event.stopPropagation(); }); $(document).keypress(function (e) { if (e.keyCode == 27) { $(".mod-nav .subMenuBox").hide(); $(".custom-validation-error").hide(); $(".field-validation-error span,#subscribeSuccessfullyMessage").hide(); $(".mod-nav li a").removeClass("active"); } }); var navHeight = $('header nav').children('div').height(); var minHeight = 53; if (navHeight > minHeight) { $('header nav').children('div').addClass('altNav'); } // Nav end // Nav TheFACup $(".mod-nav-theFaCup .sub,.mod-nav-theFaCup .sub ul").hide(); $('.t6 a').click(function () { var menuSub$ = $(".mod-nav-theFaCup .sub,.mod-nav-theFaCup .sub ul,.sub-ie7-shadow,.sub-ie8-shadow"); if (menuSub$.is(':hidden')) { menuSub$.show(); $(this).addClass("active-FaCup"); } else { menuSub$.hide(); $(this).removeClass("active-FaCup"); } }); $('body,.mod-nav-theFaCup .sub ul li a').click(function () { $(".mod-nav-theFaCup .sub,.sub-ie7-shadow,.sub-ie8-shadow").hide(); $(".mod-nav-theFaCup li.t6 a").removeClass("active-FaCup"); }); $('.mod-nav-theFaCup').click(function (event) { event.stopPropagation(); }); // FaCup Navigation, adds wrapper for IE7,IE8 subnavigation, for getting drop shadow affect. if ($.browser.msie && parseInt($.browser.version) == 8) { $('.mod-nav-theFaCup .sub').wrap('
'); } else if ($.browser.msie && parseInt($.browser.version) == 7) { $('.mod-nav-theFaCup .sub').wrap('
'); } $(document).keypress(function (e) { if (e.keyCode == 27) { $(".mod-nav-theFaCup .sub").hide(); $(".mod-nav-theFaCup li a").removeClass("active-FaCup"); } }); $('span.nav-right').each(function () { var buttonWidth = $(this).width(); $(this).parent().siblings().width(buttonWidth + 15); }); if ($.browser.msie && parseInt($.browser.version) == 7) { var buttonWidth = $(".ie7 .nav-right").outerWidth(); var buttonHeight = $(".ie7 .nav-right").outerHeight(); $('.ie7 .nav-right').wrap('').after(''); $(".ie7 .ieshadow").width(buttonWidth); $(".ie7 .ieshadow").height(parseInt(buttonHeight) + 2 + 'px'); } else if ($.browser.msie && parseInt($.browser.version) == 8) { var buttonWidth = $(".ie8 .nav-right").outerWidth(); var buttonHeight = $(".ie8 .nav-right").outerHeight(); $('.ie8 .nav-right').wrap('').after(''); $(".ie8 .ieshadow").width(buttonWidth); $(".ie8 .ieshadow").height(buttonHeight); } $('.mod-nav-theFaCup .t6 .sub').each(function () { var buttonWidth = $(this).width(); //Getting button width sublevel container when adds width value to .t6 list item $(".mod-nav-theFaCup .t6").width(buttonWidth); }); $('.mod-nav-theFaCup ul li').last().addClass('lastItem'); $('.mod-nav-theFaCup ul ul li:last').addClass('lastItem'); // Nav TheFACup end // News Nav $('.nav-catDropLink').click(function () { $('.sub').hide(); $('.nav-catDropdowns .active').removeClass(); var width = $(this).width(); var sub = $(this).parent().find('.sub'); $('ul li a', sub).width($(this).width() + 30); $(this).parent().addClass('active'); $(sub).show(); return false; }); $('.nav-catEmptyLink').click(function () { $('.sub').hide(); $('.nav-catDropdowns .actual').removeClass(); $(this).parent().addClass('actual'); return false; }); // News Nav end $('.sub').hover( function () { }, function () { $('.nav-catDropdowns .sub').hide(); } ); $('.nav-otherNewsLink').click(function () { $('.actual').removeClass(); $(this).closest('.active').attr('class', 'actual'); $('.sub').hide(); return false; }); $('body').click(function () { $(".mod-nav .subMenuBox").hide(); $(".mod-nav li a").removeClass("active"); }); // Custom checkboxes //Custom checkboxes plugin /*-------------------------------------------------------------------- * Article: http://www.filamentgroup.com/lab/accessible_custom_designed_checkbox_radio_button_inputs_styled_css_jquery/ --------------------------------------------------------------------*/ jQuery.fn.customInput = function () { $(this).each(function (i) { if ($(this).is('[type=checkbox],[type=radio]')) { var input = $(this); var label = $('label[for=' + input.attr('id') + ']'); var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio'; $('
').insertBefore(input).append(input, label); var allInputs = $('input[name=' + input.attr('name') + ']'); label.hover( function () { $(this).addClass('hover'); if (inputType == 'checkbox' && input.is(':checked')) { $(this).addClass('checkedHover'); } }, function () { $(this).removeClass('hover checkedHover'); } ); input.bind('updateState', function () { if (input.is(':checked')) { if (input.is(':radio')) { allInputs.each(function () { $('label[for=' + $(this).attr('id') + ']').removeClass('checked'); }); }; label.addClass('checked'); } else { label.removeClass('checked checkedHover checkedFocus'); } }) .trigger('updateState') .click(function () { $(this).trigger('updateState'); }) .focus(function () { label.addClass('focus'); if (inputType == 'checkbox' && input.is(':checked')) { $(this).addClass('checkedFocus'); } }) .blur(function () { label.removeClass('focus checkedFocus'); }); } }); }; //End //Tooltip $(".tooltip").live('click', function () { $(this).siblings().children().toggleClass('tooltip-outer-active'); $(".tooltip-outer-active").show(); return false; }); $('.tooltip').each(function () { $(this).replaceWith("" + $(this).attr('title') + "" + "
" + $(this).attr('title') + "
"); }); // History page The Final area results toggle $('.mod-searchHistoryDetails a').click(function () { if ($(this).attr('class') == 'closed') { $('.hiddenCells').hide(); $('.hiddenCells').slideDown('slow'); $(this).attr('class', 'opened'); $(".mod-searchBarHistory-details").height("auto"); } else { $('.hiddenCells').slideUp('slow'); $(this).attr('class', 'closed'); $(".mod-searchBarHistory-details").height("183px"); } return false; }); $('.mod-footerSponsors li').last().addClass("last"); /* text truncation */ $.fn.truncateText = function (options) { var defaultVals = { maxLength: 500 }; return this.each(function () { truncateCopyText($(this), $.extend({}, defaultVals, options)); }); } function truncateCopyText($item, defaultVals) { if (defaultVals == null) { defaultVals = { maxLength: 1000 }; } return $item.each(function () { if ($(this).text().length > defaultVals.maxLength) { var cutText = $(this).text().substring(0, defaultVals.maxLength); $(this).text(cutText + "..."); } }); } $('.mod-hero #hero-slider ul.mod-sliderLinks li a strong').truncateText({ maxLength: 28 }); $('.mod-hero #hero-slider ul.mod-sliderLinks li a span').truncateText({ maxLength: 95 }); $('.mod-hero #hero-slider .slider-body ul li.panel .itemLink ul li a').truncateText({ maxLength: 240 }); if ($('#header-title a').text().length > 25) { $('#header-title').addClass('longTitle'); }; //KEYBOARD FOR HERO //When key esc, tab, arrow, shift or spacebar is presses /* var keyPressed = ''; $(document).keydown(function (e) { code = e.keyCode ? e.keyCode : e.which; switch (code) { //case 9: keyPressed = 'tab'; //break; case 13: keyPressed = 'enter'; break; case 27: keyPressed = 'escape'; break; case 32: keyPressed = 'spacebar'; break; case 37: keyPressed = 'arrow left'; break; case 38: keyPressed = 'arrow up'; break; case 39: keyPressed = 'arrow right'; break; case 40: keyPressed = 'arrow down'; break; } if (keyPressed != '') { alert('You pressed ' + keyPressed + '!\n\nIf user clicks esc, tab, spacebar, shift or one of arrow keys, the keyboard-legend should be displayed. It should base on cookie, so it will appear for the first time only.'); keyPressed = ''; return false; } }); */ if ($('.mod-FaCup-results')) { $('.mod-FaCup-results .gTable tr td.last a').attr('class', 'closed'); expandedCells(); } // Hover effect for Club Wall video $(".mod-cw-videoContainer .playbtn").hover( function () { $(this).addClass("playbtn-hover"); }, function () { $(this).removeClass("playbtn-hover"); } ); $('body').keypress(function() { if ($('.t8 a').is(':focus')) { } else { $('.t8 .sub').hide(); } }); // Nav TheFACup $(".mod-nav-theFaCup .sub,.mod-nav-theFaCup .sub ul").hide(); if (isTouchDevice()) { $('.t8 a').click(function () { var menuSub$ = $(this).parent().find(".sub,.sub ul,.sub-ie7-shadow,.sub-ie8-shadow"); if (menuSub$.is(':hidden')) { $('.active-FaCup').removeClass(); $('.sub').hide(); menuSub$.show(); var buttonWidth = parseInt($(this).parent().width()); $(this).addClass('active-FaCup').width(buttonWidth - 45 + 'px'); //$(this).parent().find('.sub ul li').width(200 + 'px'); if (buttonWidth > $(this).parent().find('.sub ul li').width()) { $(this).parent().find('.sub ul li').css('width', buttonWidth - 5 + 'px'); } else { $(this).parent().find('.sub').css({ 'box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-moz-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-webkit-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-ms-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)' }); $(this).parent().find('.sub ul').css('border-right', 'solid 1px #f3f3f3'); } } else { menuSub$.hide(); $(this).removeClass("active-FaCup"); } $('.sub ul li a, a.active-FaCup').click( function () { window.location = $(this).attr('href'); } ); return false; }); } else { $('a[rel=sub]').hover( function () { $('.sub').hide(); $('.active-FaCup').removeClass(); } ); $('.t8 a').live("hover focus", function (event) { var menuSub$ = $(this).parent().find(".sub,.sub ul,.sub-ie7-shadow,.sub-ie8-shadow"); if (menuSub$.is(':hidden')) { $('.active-FaCup').removeClass(); $('.sub').hide(); menuSub$.show(); if ($(this).attr('href')) { var buttonWidth = parseInt($(this).parent().width()); $(this).addClass('active-FaCup').width(buttonWidth - 45 + 'px'); //$(this).parent().find('.sub ul li').width(200 + 'px'); if (buttonWidth > $(this).parent().find('.sub ul li').width()) { $(this).parent().find('.sub ul li').css('width', buttonWidth - 5 + 'px'); } else { $(this).parent().find('.sub').css({ 'box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-moz-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-webkit-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)', '-ms-box-shadow': '-2px 0 4px rgba(0, 0, 0, 0.1)' }); $(this).parent().find('.sub ul').css('border-right', 'solid 1px #f3f3f3'); } } } else { //menuSub$.hide(); //$(this).removeClass("active-FaCup"); } if ($(this).attr('href')) { $(this).css('z-index', '2000'); } return false; }); // $('.t8 ul, .t8 ul li').hover( $('.t8').hover( function () { $('.sub').hide(); $('.t8 a').removeClass(); } ); } $('body,.mod-nav-theFaCup .sub ul li a').click(function () { $(".mod-nav-theFaCup .sub,.sub-ie7-shadow,.sub-ie8-shadow").hide(); $(".mod-nav-theFaCup li.t8 a").removeClass("active-FaCup"); }); $('.mod-nav-theFaCup').click(function (event) { event.stopPropagation(); }); // FaCup Navigation, adds wrapper for IE7,IE8 subnavigation, for getting drop shadow affect. if ($.browser.msie && parseInt($.browser.version) == 8) { $('.mod-nav-theFaCup .sub').wrap('
'); } else if ($.browser.msie && parseInt($.browser.version) == 7) { $('.mod-nav-theFaCup .sub').wrap('
'); } $(document).keypress(function (e) { if (e.keyCode == 27) { $(".mod-nav-theFaCup .sub").hide(); $(".mod-nav-theFaCup li a").removeClass("active-FaCup"); } }); $('.mod-nav-theFaCup ul li').last().addClass('lastItem'); $('.mod-nav-theFaCup ul ul li:last').addClass('lastItem'); // Nav TheFACup end $('.mod-FaCup-history .mod-gTableRound .gTable-data').each(function (i, el) { //el.id = ("gTable0") + i; //This might be used if require to show last two round results // FACup-History.aspx //console.log("added auto increment value to gTable ID +1") }); $('.mod-FaCup-history .mod-gTableRound .gTable-data').hide(); function gTableToggle(el) { if ($(el).closest('.mod-gTableRound').find('.gTable-data').css('display') == 'none') { $(el).parent().parent().parent().addClass("gTableActive"); $(el).closest('.mod-gTableRound').children('.gTable-data').delay('300').slideDown('300'); $('.gTable-data').not(el).hide(); $('.mod-gTableRound h4 a, .mod-gTableRound h5 a').removeClass('toggleShowHide'); $(el).find("h5 a, h4 a").addClass('toggleShowHide'); } else { $('.mod-gTableRound h4 a,.mod-gTableRound h5 a').removeClass('toggleShowHide'); $(el).parent().parent().parent().removeClass("gTableActive"); $(el).closest('.mod-gTableRound').children('.gTable-data').delay('300').slideUp('300'); } } $(".mod-FaCup-history .gTable-title").bind('click', function () { gTableToggle(this); return false; } ); /* $(".mod-FaCup-history .gTable-title").toggle( function () { $(this).parent().parent().parent().addClass("gTableActive"); $(this).closest('.mod-gTableRound').children('.gTable-data').delay('300').slideDown('300'); $('.gTable-data').not(this).hide(); $('.mod-gTableRound h4 a, .mod-gTableRound h5 a').removeClass('toggleShowHide'); $(this).find("h5 a, h4 a").addClass('toggleShowHide'); console.log("toggle clicked first time") }, function () { $('.mod-gTableRound h4 a').removeClass('toggleShowHide'); $(this).parent().parent().parent().removeClass("gTableActive"); $(this).closest('.mod-gTableRound').children('.gTable-data').delay('300').slideUp('300'); console.log("toggle clicked first time") }); */ // Button's IE7 and IE8 // FaCup Navigation, adds wrapper for IE7,IE8 subnavigation, for getting drop shadow affect. // if ($.browser.msie && parseInt($.browser.version) == 8) { // $('.ie8 .btn').wrap(''); // $('.ie8 .btn').before(''); // $('.ie8 .btn').each(function () { // var buttonWidth = $(this).width(); // //Getting button width // $(this).parent().width(buttonWidth + 33); // //alert(buttonWidth); // }); // } else if ($.browser.msie && parseInt($.browser.version) == 7) { // $('.ie7 .btn').wrap(''); // $('.ie7 .btn').before(''); // $('.ie7 .btn').each(function () { // var buttonWidth = $(this).width(); // //Getting button width // $(this).parent().width(buttonWidth + 17); // $('.ie7 .ui-tabs-panel .ie7-shadowContainer').width(87); // }); // } //SITEMAP var root = ''; var rootWidth = ''; var ul = ''; var liArray = ''; $('.mod-sitemap-inner h4 a').click( function () { root = $(this).closest('.cp-sitemapList-root'); rootWidth = $(this).closest('.cp-sitemapList-root').width(); ul = $('.cp-sitemapList', $(this).closest('.mod-sitemap-inner')); liArray = $('li', ul); if (liArray.length) { if ($(ul).is(':visible')) { return true; } else { $('.cp-sitemapList-root').removeAttr('style'); $('.mod-sitemap-inner h4').removeClass(); $('.cp-closeLink').remove(); var closeLink = 'close'; $(this).closest('h4').addClass('active').append(closeLink); $('.cp-sitemapList').hide(); $(ul).slideDown(); $('.cp-closeLink').click( function () { $(ul).slideUp(); $(this).closest('h4').removeClass(); $('.cp-closeLink').remove(); return false; } ); return false; } } else { return true; } } ); searchDropdown(); }); //SEARCH DROPDOWN FUNCTION function searchDropdown(){ //SORTING DROPDOWN EFFECT $('.nav-dropdown ul li a').click( function () { $('.nav-dropdown ul li a').removeAttr('class'); $(this).attr('class', 'active'); $('.nav-dropdown-head span.nav-right').text($(this).text()); } ); //search drop down $(".nav-dropdown ol li ul").addClass("hidden"); $('.nav-dropdown-head').click(function () { var menuSub$ = $(this).parent().find("ul"); if (menuSub$.is(':hidden')) { menuSub$.show(); $(this).addClass("active"); } else { menuSub$.hide(); $(this).removeClass("active"); } }); $(document).keypress(function (e) { if (e.keyCode == 27) { $(".nav-dropdown ol li .active").removeClass("active"); $(".nav-dropdown ol li ul").removeClass("hidden").css("display", "none"); } }); $('body').click(function () { $(".nav-dropdown ol li .active").removeClass("active"); $(".nav-dropdown ol li ul").removeClass("hidden").css("display", "none"); }); $('.nav-dropdown-head').click(function (event) { event.stopPropagation(); }); //search drop down end //detecting Safari var is_safari = navigator.userAgent.indexOf("Safari") > -1; var is_chrome = navigator.userAgent.indexOf('Chrome') > -1; if ((is_chrome) && (is_safari)) { is_safari = false; } if (is_safari) { $('.mod-find fieldset .input-text, .nav-searchBox').css('line-height', '1em'); }; } // RESULTS TABLE - EXPANDED CELLS function expandedCells() { $('.mod-FaCup-results .gTable tr td.last a').click( function () { var cell = ''; var new_position = ''; var tr = $(this).closest('tr'); var tr2 = $(this).closest('.gTable').find('.cp-matchDescriptionRow'); var tbody = $(tr).parent(); if ($(tr).attr('class') != 'marked') { var trClass = $(tr).attr('class'); $(tbody).attr('class', trClass); } else { var trClass = $(tbody).attr('class'); } var section = $(this).closest('section'); if ($(this).attr('class') == 'closed') { $('.mod-FaCup-results .gTable tr.marked').removeAttr('class'); $(tr).attr('class', 'marked'); $(tr2).attr('class', 'cp-matchDescriptionRow marked'); $('.mod-FaCup-results .gTable tr td.last a').attr('class', 'closed'); $('.mod-cw-fixturesTableArea .hiddenCells, .mod-cw-cups-resultsTableArea .hiddenCells').remove(); $('.hiddenCells', section).slideDown('slow'); $(this).attr('class', 'opened'); $(this).closest('tr').find('td.cSix a.tooltip').css('background-position', '-34px 0'); new_position = $(this).offset(); } else { $(tr).removeAttr('class'); if (trClass != 'cp-matchDescriptionBody') { $(tr).attr('class', trClass); } $(tr2).attr('class', 'cp-matchDescriptionRow'); $('.hiddenCells', section).slideUp('slow'); $('.mod-cw-fixturesTableArea .hiddenCells, .mod-cw-cups-resultsTableArea .hiddenCells').remove(); $(this).attr('class', 'closed'); new_position = $(this).offset(); $(this).closest('tr').find('td.cSix a.tooltip').removeAttr('style'); } //window.scrollTo(new_position.left, new_position.top - 50); return false; }); } function isTouchDevice() { return "ontouchstart" in window; }