window.fbAsyncInit = function() { FB.init({ appId: "116656161708917", cookie: true, // these two are not required for partners that status: true, // only rely on stk plugins and don't use connect xfbml: true, channelUrl: document.location.protocol + '//' + document.domain + '/facebook/channel.html' }); jQuery(document).ready(function () { FB.XFBML.parse(); FB.Event.subscribe('edge.create', function(href, widget) { if(typeof anTrackLink === 'function') { anTrackLink(jQuery('.fb_iframe_widget')[0],'espn','facebook','like'); } }); /* jQuery('.fshare').live('click',function(e) { var moreSettings = jQuery(this).metadata(); var fbShareSettings = { "method": "feed", "display":"popup", "name": 'The Herd Hollywood Bracket', "link": "http://espn.go.com/espnradio/bracket?id=7619043", "picture": "null", "caption": "ESPN.com", "description": "The Herd Hollywood Bracket" }; fbShareSettings = jQuery.extend({}, fbShareSettings, moreSettings); settingsCopy = jQuery.extend({}, fbShareSettings); FB.ui(fbShareSettings, function(){ fbShareSettings = settingsCopy; }); e.preventDefault(); });*/ }); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); (function($) { function checkHasVoted (poll) { var hasVoted = false, pollBit = poll % 256 % 64 % 4, bitArray = [8,1,2,4], cookieId = (poll - (poll % 256)) / 256, cookieName = "POLL" + cookieId.toString(), pollCookie = espn.cookie.get(cookieName), thisCookie = espn.cookie.get('ALLPOLL'), comma = ','; if (pollCookie !== null) { var cookiePosition = pollCookie.length - Math.ceil((poll % 256 )/ 4), cookieValue = pollCookie.substring(cookiePosition, cookiePosition + 1), cookieAsHex = "0x" + cookieValue.toString(1); if ((bitArray[pollBit] & cookieAsHex) == bitArray[pollBit]) { hasVoted = true; if(thisCookie !== null) { if (thisCookie.indexOf(poll) === -1) { thisCookie = thisCookie + comma + poll.toString(10); } } else { thisCookie = poll.toString(10); } //espn.cookie.set('ALLPOLL',thisCookie,1); var currentDate = new Date(); expirationDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1, 0, 0, 0); $.cookie('ALLPOLL', thisCookie, {expires: expirationDate, domain: '.go.com'}) $.cookie(cookieName, pollCookie, {expires: expirationDate, domain: '.go.com'}) } } if (thisCookie !== null) { if (thisCookie.indexOf(',') !== -1) { var thisPolls = thisCookie.split(','); for (var i=0, x=thisPolls.length; i 0) { $answerBar.width(0).show(); $answerPct.html('0%').show(); $answerInput.hide(); $answerBar.animate({ width: '+' + width + 'px' }, { step: function (now, fx) { $answerPct.html(Math.round((parseInt(now, 10) / stage) * 100) + '%'); }, duration: 2000 }); } else { $answer.hide(); } }); $('.submit-poll').hide(); $('.total-votes').attr('style', 'display:block'); } else { console.log('no'); }*/ } } function displayVoteContent(html) { $('#mvc-vote-container').css('overflow','visible'); $('#mvc-vote-container').html(html); $('#mvc-vote-container #mvc-vote-content').fadeIn(); $('.video-placeholder').each(function() { loadVideoIframe($(this)); }); loadPoll(); updateVoteMatchupViews(); var pageName = $('#pageName').html(); if (typeof anTrackPage === 'function') { anTrackPage(0,'espn','brackets','feature','','poll',pageName,'en',''); } } function openVoteContainer(html) { if ($('#mvc-vote-container').length === 0) { if (html.indexOf('mcv12-finals-votes') === -1) { $('
').appendTo($('#mcv-container')); } else { $('
').appendTo($('#mcv-container')); } $('#mvc-vote-container').animate({ top: '-=178px', left: '-=390px', width: "924px", height: "494px" },{ complete: function() { displayVoteContent(html); } }); } else { $('#mvc-vote-container #mvc-vote-content').fadeOut(); displayVoteContent(html); } } function closeVoteContainer(html) { updateMatchupViews(); $('#mvc-vote-container').removeClass('mcv-matchup-finals').remove(); $('#mvc-vote-container #mvc-vote-content').fadeOut(400, function() { $('#mvc-vote-container').animate({ top: '+=140px', left: '+=390px', width: "146px", height: "159px" },{ complete: function() { $('#mvc-vote-container').remove(); } }); }); } function loadVideoIframe(element) { var videoId = $(element).attr('data-videoid'); if (!!videoId) { $(element).append(''); } } function updateMatchupViews() { if($('.round-active li').length > 0) { $('.round-active li').each(function () { var $this = $(this), pollId = $this.attr('data-pollid'); if (!!pollId) { pollId = parseInt(pollId,10); if(checkHasVoted(pollId)) { $this.find('.vote-view').hide(); $this.find('.matchup-view').show(); } } }); } else { $('.round-active').each(function () { var $this = $(this); var pollId = 0; if(jQuery('.round-active').hasClass('round-4a')) { pollId = $this.find('.p1').attr('data-pollid'); } if (!!pollId) { pollId = parseInt(pollId,10); if(checkHasVoted(pollId)) { $this.find('.vote-view').hide(); $this.find('.matchup-view').show(); } } }); } } function updateVoteMatchupViews() { $('.more-matchups li').each(function () { var $this = $(this), pollId = $this.attr('data-pollid'); if (!!pollId) { pollId = parseInt(pollId,10); if(checkHasVoted(pollId)) { $this.addClass('voted'); } } }); $('.more-matchups').show(); } function tweetButton(target, lang, url, originalUrl, text, count) { if (!!url && !!text) { var tweetButtonIframe = [''); tweetButtonIframe = tweetButtonIframe.join(''); jQuery(target).html(tweetButtonIframe); } } function trackClicks(linkname) { //console.log('tracking '+linkname); s_omni.linkTrackVars = 'channel, prop3, eVar2, eVar13, events'; s_omni.linkTrackEvents = 'linkclick'; //Set Variables s_omni.eVar2 = linkname; // name of link s_omni.prop3 = s_omni.eVar2; s_omni.eVar13 = s_omni.channel + ':madden2013cover'; s_omni.events = 'linkclick'; s_omni.tl(true, 'o', 'madden2013cover:' + linkname); } $('document').ready(function() { if(typeof(loadurl) !== 'undefined') { $.ajax({ type: "GET", url: loadurl, dataType: "html", cache: true, success: function (response) { openVoteContainer($.trim(response)); } }); } if ($('#mvc-vote-container').length > 0) { $('.video-placeholder').each(function() { loadVideoIframe($(this)); }); loadPoll(); updateVoteMatchupViews(); } $('.matchup-link').live('click', function(e) { e.preventDefault(); url = $(this).attr('href'); if (typeof(url) === 'undefined') { url = $(this).find('a').attr('href'); } $.ajax({ type: "GET", url: url, dataType: "html", cache: true, success: function (response) { openVoteContainer($.trim(response)); } }); return false; }); $('#close-btn').live('click', function(e) { e.preventDefault(); closeVoteContainer(); }); $('#next-btn').live('click', function(e) { e.preventDefault(); $active = $('.more-matchups .active'); var $next = $active.next(); if ($next.length === 0 || $next.hasClass('hidden')) { $next = $('.more-matchups li').first(); } $next.find('a').trigger('click'); }); $('#prev-btn').live('click', function(e) { e.preventDefault(); $active = $('.more-matchups .active'); var $prev = $active.prev(); if ($prev.length === 0 || $prev.hasClass('hidden')) { $prev = $('.more-matchups li').last(); } $prev.find('a').trigger('click'); }); $('.retweet').live('click',function(e) { window.open($(this).attr('href'),'reweet','width=550,height=400,scrollbars=no,resizable=yes'); e.preventDefault(); }); $('.gamestop-link a').live('click', function(e) { trackClicks('gamestop'); anTrackLink(this,'espn','sportsnation/madden2013', 'gamestop_outbound'); }); tweetButton($('.twitter-button'), "EN", 'http://es.pn/wyJqfS', 'http://espn.go.com/espnradio/bracket?id=7619043', "The Herd Hollywood Bracket", true); updateMatchupViews(); }); })(jQuery);