/* Prediction Page: Plugin: plugins/predictions-page/ Template file: single-predictions-page.php Sample URL: http://www.goldderby.com/awardshows/expert-predictions/oscars-2015-nominations/best-picture/ */ function get_prediction_page_league() { var prediction_page_league = jQuery( '#prediction_page_league' ).val(); var prediction_page_user = jQuery( '#prediction_page_user' ).val(); var sort_by = jQuery( '#prediction_page_sort' ).val(); if ( ! prediction_page_league ) { return false; } var URL = '/awardshows/' + prediction_page_user + '-predictions/' + prediction_page_league + '/'; if (sort_by) { URL += 'sort/' + sort_by + '/'; } jQuery( '#prediction_page_league' ).prop( "disabled", true ); jQuery( '#prediction_page_category' ).prop( "disabled", true ); jQuery( '#prediction_page_user' ).prop( "disabled", true ); jQuery( '#prediction_page_sort' ).prop( "disabled", true ); window.location = URL; } function get_prediction_page_sort() { var prediction_page_league = jQuery( '#prediction_page_league' ).val(); var prediction_page_category = jQuery( '#prediction_page_category' ).val(); var prediction_page_user = jQuery( '#prediction_page_user' ).val(); var sort_by = jQuery( '#prediction_page_sort' ).val(); if ( ! prediction_page_league ) { return false; } var URL = '/awardshows/' + prediction_page_user + '-predictions/' + prediction_page_league + '/'; if (prediction_page_category ) { URL += prediction_page_category + '/'; } if (sort_by) { URL += 'sort/' + sort_by + '/'; } jQuery( '#prediction_page_league' ).prop( "disabled", true ); jQuery( '#prediction_page_category' ).prop( "disabled", true ); jQuery( '#prediction_page_user' ).prop( "disabled", true ); jQuery( '#prediction_page_sort' ).prop( "disabled", true ); window.location = URL; } function get_prediction_page_category() { var prediction_page_league = jQuery( '#prediction_page_league' ).val(); var prediction_page_category = jQuery( '#prediction_page_category' ).val(); var prediction_page_user = jQuery( '#prediction_page_user' ).val(); var sort_by = jQuery( '#prediction_page_sort' ).val(); if ( ! prediction_page_league ) { return false; } var URL = '/awardshows/' + prediction_page_user + '-predictions/' + prediction_page_league + '/'; if (prediction_page_category ) { URL += prediction_page_category + '/'; } if (sort_by) { URL += 'sort/' + sort_by + '/'; } jQuery( '#prediction_page_league' ).prop( "disabled", true ); jQuery( '#prediction_page_category' ).prop( "disabled", true ); jQuery( '#prediction_page_user' ).prop( "disabled", true ); jQuery( '#prediction_page_sort' ).prop( "disabled", true ); window.location = URL; } (function($) { function get_season_long_leaderboard_page() { if ( $( '#season_long_tvshow' ).val() && '' === $( '#season_long_tvshow_league' ).val() ) { var URL = '/season-long-leaderboard/' + $( '#season_long_tvshow' ).val() + '/'; } if ( $( '#season_long_tvshow' ).val() && $( '#season_long_tvshow_league' ).val() ) { var URL = '/season-long-leaderboard/' + $( '#season_long_tvshow' ).val() + '/' + $( '#season_long_tvshow_league' ).val() + '/'; } window.location = URL; } })(jQuery); ; (function($) { // If not predictions page, bail. if ( ! $( document.body ).hasClass( 'predictions-page' ) ) { return; } $( function () { //Initialize the carousel $( '.carousel' ).slick().fadeIn(); //check if the slides are less than slidesToShow var count = $( '.carousel .slick-slide' ).length; var slick_options = $( '.carousel' ).slick( 'slickGetOption' ); if ( slick_options.slidesToShow > count ) { $( '.carousel .slick-slide' ).each( function(){ $( this ).on( 'click', function(){ after_change_callback(); $( '.carousel' ).slick( 'slickNext' ); } ); } ); } $( '.carousel .week-box' ).on( 'click', function () { var currnet_id = this.id; var week = currnet_id.substr( currnet_id.indexOf( "_" ) + 1 ); var days_row_id = '#' + week; //$('#week-slider-navigation').hide(); $( '#week-slider-navigation' ).removeClass( 'display-block' ); $( '#week-slider-navigation' ).addClass( 'display-none' ); $( '.days' ).show(); $( days_row_id ).show(); } ); $( '.day-navigation .back-icon' ).on( 'click', function () { $( '.day_box_div' ).hide(); $( '.days' ).hide(); //$('#week-slider-navigation').show(); $( '#week-slider-navigation' ).removeClass( 'display-none' ); $( '#week-slider-navigation' ).addClass( 'display-block' ); } ); $( '.day-box:not(.disabled)' ).on( 'click', function () { $( '.day-box:not(.disabled)' ).removeClass( 'active' ); $( '.day:not(.disabled), .date-range:not(.disabled), .no-change:not(.disabled)' ).removeClass( 'active' ).addClass( 'normal' ); $( this ).removeClass( 'normal' ).addClass( 'active' ); $( this ).find( '.day, .date-range, .no-change' ).removeClass( 'normal' ).addClass( 'active' ); //Get clicked date, currnet game_slag, category_id, user_type etc. var prediction_date = this.id; var featured_league = $( '#prediction_page_league' ).val(); var nonce = $( '#hp-gd-past-prediction-nonce' ).val(); add_overlay(); $( '#loading-image' ).show(); if ( $( "#prediction-week-slider-wrapper" ).hasClass( "predictions-page" ) ) { var category_slug = $( '#prediction_page_category' ).val(); var user_type = $( '#prediction_page_user' ).val(); var page_sort = $( '#prediction_page_sort' ).val(); $.ajax( { method : "GET", url: GOLDDERBY.root + 'gameplay/v1/prediction-page/past_predictions', dataType: 'html', beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', GOLDDERBY.nonce ); }, data: { featured_league: featured_league, category_slug: category_slug, user_type: user_type, page_sort: page_sort, prediction_date: prediction_date, security: nonce }, success: function(data) { $( '.prediction_changed' ).removeClass( 'prediction_changed' ); $( '#odds-page' ) . html( data ); $( '#loading-image' ).hide(); remove_overlay(); } } ); } else if ( $( "#prediction-week-slider-wrapper" ).hasClass( "view-predictions-page" ) ) { var user_id = $( '#view_past_prediction_user_id' ).val(); var nonce = $( '#hp-gd-past-prediction-nonce' ).val(); $.ajax( { method : "GET", url: GOLDDERBY.root + 'gameplay/v1/prediction-page/user_past_predictions', dataType: 'html', beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', GOLDDERBY.nonce ); }, data: { featured_league: featured_league, user_id: user_id, prediction_date: prediction_date, security: nonce }, success: function(data) { $( '.prediction_changed' ).removeClass( 'prediction_changed' ); $( data ).find( '.predictions-wrapper' ).each( function() { var ajax_prediction_id = $( this ).attr( 'id' ); var page_prediction_id = '#' + ajax_prediction_id; $( '#odds-page' ) . find( page_prediction_id ).html( $( this ).html() ); } ); $( '#loading-image' ).hide(); remove_overlay(); var top_of_last_predix_changed_div = $( ".prediction_changed:last" ).offset().top; if ( ( parseInt( $( window ).scrollTop(), 10 ) + parseInt( $( window ).height(), 10 ) ) < parseInt( top_of_last_predix_changed_div, 10 ) ) { $( "#see-more-indicator" ).show(); $( "#see-more-indicator" ).css( 'top', parseInt( $( window ).scrollTop(), 10 ) + parseInt( $( window ).height(), 10 ) - 150 + 'px' ); } else { $( "#see-more-indicator" ).hide(); } $( window ).scroll( function() { $( "#see-more-indicator" ).css( 'top', parseInt( $( window ).scrollTop(), 10 ) + parseInt( $( window ).height(), 10 ) - 150 + 'px' ); if ( ( parseInt( $( window ).scrollTop(), 10 ) + parseInt( $( window ).height(), 10 ) ) < parseInt( top_of_last_predix_changed_div, 10 ) ) { $( "#see-more-indicator" ).show(); } else { $( "#see-more-indicator" ).hide(); } } ); } } ); } else if ( $( "#prediction-week-slider-wrapper" ).hasClass( "view-odds-page" ) ) { var featured_league = $( '#odds_page_league' ).val(); var featured_league_url_parts = featured_league.split( '/' ); featured_league = featured_league_url_parts[ parseInt( featured_league_url_parts.length ) - 2 ]; var user_type = $( '#odds_page_user_type' ).val(); var user_type_parts = user_type.split( '/' ); user_type = user_type_parts[2].replace( '-odds', '' ); $.ajax( { method : "GET", url: GOLDDERBY.root + 'gameplay/v1/odds-page/past_odds', dataType: 'html', beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', GOLDDERBY.nonce ); }, data: { featured_league: featured_league, prediction_date: prediction_date, user_type: user_type }, success: function(data) { $( data ).find( '.predictions-wrapper' ).each( function() { var ajax_prediction_id = $( this ).attr( 'id' ); var page_prediction_id = '#' + ajax_prediction_id; $( '#odds-page' ) . find( page_prediction_id ).html( $( this ).html() ); } ); $( '#loading-image' ).hide(); remove_overlay(); } } ); } } ); } ); // Add transparent overlay div to disable category links on carousel. function add_overlay() { var $overlay = $( '
' ); $overlay.attr( "id", "carousel-overlay" ); $( ".carousel" ).prepend( $overlay ); } // Remove the transparent overlay, so user can click on categories now. function remove_overlay() { $( "#carousel-overlay" ).remove(); } })(jQuery); ; /* * Lazy Load - jQuery plugin for lazy loading images * * Copyright (c) 2007-2012 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * http://www.appelsiini.net/projects/lazyload * * Version: 1.8.3 * */ (function(a,b,c,d){var e=a(b);a.fn.lazyload=function(c){function i(){var b=0;f.each(function(){var c=a(this);if(h.skip_invisible&&!c.is(":visible"))return;if(!a.abovethetop(this,h)&&!a.leftofbegin(this,h))if(!a.belowthefold(this,h)&&!a.rightoffold(this,h))c.trigger("appear"),b=0;else if(++b>h.failure_limit)return!1})}var f=this,g,h={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return c&&(d!==c.failurelimit&&(c.failure_limit=c.failurelimit,delete c.failurelimit),d!==c.effectspeed&&(c.effect_speed=c.effectspeed,delete c.effectspeed),a.extend(h,c)),g=h.container===d||h.container===b?e:a(h.container),0===h.event.indexOf("scroll")&&g.bind(h.event,function(a){return i()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,c.one("appear",function(){if(!this.loaded){if(h.appear){var d=f.length;h.appear.call(b,d,h)}a("").bind("load",function(){c.hide().attr("src",c.data(h.data_attribute))[h.effect](h.effect_speed),b.loaded=!0;var d=a.grep(f,function(a){return!a.loaded});f=a(d);if(h.load){var e=f.length;h.load.call(b,e,h)}}).attr("src",c.data(h.data_attribute))}}),0!==h.event.indexOf("scroll")&&c.bind(h.event,function(a){b.loaded||c.trigger("appear")})}),e.bind("resize",function(a){i()}),/iphone|ipod|ipad.*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent.persisted&&f.each(function(){a(this).trigger("appear")})}),a(b).load(function(){i()}),this},a.belowthefold=function(c,f){var g;return f.container===d||f.container===b?g=e.height()+e.scrollTop():g=a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return f.container===d||f.container===b?g=e.width()+e.scrollLeft():g=a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return f.container===d||f.container===b?g=e.scrollTop():g=a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return f.container===d||f.container===b?g=e.scrollLeft():g=a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!a.rightoffold(b,c)&&!a.leftofbegin(b,c)&&!a.belowthefold(b,c)&&!a.abovethetop(b,c)},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})})(jQuery,window,document) ; (function($) { $( 'body' ).on( 'click', '.second-nav-item', function() { var current_score_type_id = $(this).attr('id'); if ( current_score_type_id === 'season_scores' ) { $( '#season_scores' ).addClass( 'active' ); $( '#week_scores' ).removeClass( 'active' ); } else { $( '#season_scores' ).removeClass( 'active' ); $( '#week_scores' ).addClass( 'active' ); } } ); $( document ).ready( function () { $( 'body' ).on( 'click', '.best-predix-scores-widget .top-nav-item', function() { var current_game_type_id = $(this).attr('id'); var no_of_events = $( '#best-predix-no_of_events' ).val(); var url = ''; $( '.best-predix-scores-widget #best-predix-loading-image' ).css("display", 'block'); game_type = current_game_type_id; url = '/wp-json/gameplay-api/v1/app/best-prediction-scores/' + game_type + '/' + 'league-data' + '/' + no_of_events; if ( current_game_type_id === 'tvshow' ) { $( '.best-predix-scores-widget #awards' ).removeClass( 'active-desktop-main-top active' ); $( '.best-predix-scores-widget #awards' ).addClass( 'inactive-desktop-main-top inactive' ); $( '.best-predix-scores-widget #tvshow' ).removeClass( 'inactive-desktop-main-top inactive' ); $( '.best-predix-scores-widget #tvshow' ).addClass( 'active-desktop-main-top active' ); } else { $( '.best-predix-scores-widget #tvshow' ).removeClass( 'active-desktop-main-top active' ); $( '.best-predix-scores-widget #tvshow' ).addClass( 'inactive-desktop-main-top inactive' ); $( '.best-predix-scores-widget #awards' ).removeClass( 'inactive-desktop-main-top inactive' ); $( '.best-predix-scores-widget #awards' ).addClass( 'active-desktop-main-top active' ); } $.ajax( { method: "GET", url: url, success: function (response) { success_callback( response.response, game_type, 'league-data' ); }, fail: function (response) { } } ); }, ); $( 'body' ).on( 'click', '.best-predix-scores-widget .second-nav-item', function() { var current_score_type_id = $(this).attr('id'); var no_of_events = $( '#best-predix-no_of_events' ).val(); $( '.best-predix-scores-widget #best-predix-loading-image2' ).css("display", 'block'); if ( current_score_type_id === 'season_scores' ) { $( '.best-predix-scores-widget #season_scores' ).addClass( 'active' ); $( '.best-predix-scores-widget #week_scores' ).removeClass( 'active' ); url = '/wp-json/gameplay-api/v1/app/best-prediction-scores/tvshow/' + 'season-data' + '/' + no_of_events; data_type = 'season-data'; } else { $( '.best-predix-scores-widget #season_scores' ).removeClass( 'active' ); $( '.best-predix-scores-widget #week_scores' ).addClass( 'active' ); url = '/wp-json/gameplay-api/v1/app/best-prediction-scores/tvshow/' + 'league-data'; data_type = 'league-data'; } $.ajax( { method: "GET", url: url, success: function (response) { success_callback( response.response, 'tvshow', data_type ); }, fail: function (response) { } } ); } ); } ); function success_callback( response, game_type, data_type ){ $( '.best-predix-scores-widget #best-predix-loading-image' ).css("display", 'none'); $( '.best-predix-scores-widget #best-predix-loading-image2' ).css("display", 'none'); $( '.best-predix-scores-widget .second-nav-container' ).empty(); $( '.best-predix-scores-widget #week_score_data' ).empty(); $( '.best-predix-scores-widget .links-container' ).remove(); $( '.best-predix-scores-widget #best-predix-data-container-main' ).empty(); var $data_outer_div_class = 'best-predix-container best-predix-container-awards'; if( game_type == 'tvshow' ) { $data_outer_div_class = 'best-predix-container best-predix-container-tv'; } var $wrapper = $( '
' ).attr( 'class', 'data-container' ); $wrapper.attr( 'id', 'best-predix-data-container' ); var $loading_img_div = $( '
' ).attr( 'id', 'best-predix-loading-image' ); $loading_img_div.css( 'display', 'none' ); $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $loading_img_div.append( $loadin_img ); $wrapper.append( $loading_img_div ); var $second_nav_container = $( '
' ).attr( 'class', 'second-nav-container' ); var $loading_img_div2 = $( '
' ).attr( 'id', 'best-predix-loading-image2' ); $loading_img_div2.css( 'display', 'none' ); $loadin_img2 = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img2.attr( 'alt', 'Loading...' ); $loading_img_div2.append( $loadin_img2 ); if( game_type == 'tvshow' ) { season_score_nav_class = 'second-nav-item'; week_score_nav_class = 'second-nav-item active'; if ( 'season-data' == data_type ) { season_score_nav_class = 'second-nav-item active'; week_score_nav_class = 'second-nav-item'; } var $second_nav = $( '
' ).attr( 'class', 'second-nav' ); var $second_nav_item_1 = $( '
' ).attr( 'class', season_score_nav_class ); $second_nav_item_1.attr( 'id', 'season_scores' ); $second_nav_item_1.text( 'Season Scores' ); $second_nav.append( $second_nav_item_1 ); var $second_nav_item_2 = $( '
' ).attr( 'class', week_score_nav_class ); $second_nav_item_2.attr( 'id', 'week_scores' ); $second_nav_item_2.text( 'Recent Week Scores' ); $second_nav.append( $second_nav_item_2 ); $second_nav_container.append( $second_nav ); $wrapper.append( $second_nav_container ); $wrapper.append( $loading_img_div2 ); if ( 'season-data' == data_type ) { var $season_score_data = $( '
' ).attr( 'id', 'season_score_data' ); var $best_predix_container = $( '
' ).attr( 'class', $data_outer_div_class ); $.each( response.season_data, function (i, events) { if (events.game_event_name) { $league_name = $( '
' ).attr( 'class', 'league-name' ); $league_name.text( events.game_event_name ); $best_predix_container.append( $league_name ); $data_header_container = $( '
' ).attr( 'class', 'data-header-container' ); $head1 = $( '
' ).attr( 'class', 'head1' ); $head1.text( 'Username' ); $data_header_container.append( $head1 ); $head2 = $( '
' ).attr( 'class', 'head2' ); $head2.text( 'Accuracy %' ); $data_header_container.append( $head2 ); $head3 = $( '
' ).attr( 'class', 'head2' ); $head3.text( 'Points Won' ); $data_header_container.append( $head3 ); $best_predix_container.append( $data_header_container ); $.each( events.scores, function (j, score) { $user_data_container = $( '
' ).attr( 'class', 'user-data-container' ); $data1 = $( '
' ).attr( 'class', 'data1' ); $data1.text( parseInt(j) + 1 + '.' ); $user_data_container.append( $data1 ); $data2 = $( '
' ).attr( 'class', 'data2' ); $img = $( '' ).attr( 'src', response.user_info[score.user_id]['image'] ); $data2.append( $img ); $user_data_container.append( $data2 ); $data3 = $( '
' ).attr( 'class', 'data3' ); $data3.text( response.user_info[score.user_id]['display_name'] ); $user_data_container.append( $data3 ); $data4 = $( '
' ).attr( 'class', 'data4' ); $data4.text( score.average_accuracy ); $user_data_container.append( $data4 ); $data5 = $( '
' ).attr( 'class', 'data4' ); $data5.text( score.total_points_won ); $user_data_container.append( $data5 ); $best_predix_container.append( $user_data_container ); } ); $see_more_container = $( '
' ).attr( 'class', 'see-more-container' ); $see_more = $( '
' ).attr( 'class', 'see-more' ); $link_url = '/all-leaderboards/tvshows/recent/'; $see_more_link = $( '' ).attr( 'href', $link_url ); $see_more_link.text( 'See more' ); $see_more.append( $see_more_link ); $see_more_container.append( $see_more ); $see_more_arrow_container = $( '
' ).attr( 'class', 'right-arrow-container' ); $see_more_arrow = $( '
' ).attr( 'class', 'right-arrow' ); $see_more_arrow_container.append( $see_more_arrow ); $see_more_container.append( $see_more_arrow_container ); $best_predix_container.append( $see_more_container ); } } ); $season_score_data.append( $best_predix_container ); $wrapper.append( $season_score_data ); } } if ( 'league-data' == data_type ) { $wrapper.append( $loading_img_div2 ); var $week_score_data = $( '
' ).attr( 'id', 'week_score_data' ); var $best_predix_container = $( '
' ).attr( 'class', $data_outer_div_class ); $.each( response.league_data, function (i, events) { if (events.game_event_name) { $event_name = events.game_event_name; $week_name = ''; if( game_type == 'tvshow' ) { $event_week_name = $event_name.split( ': ' ); $event_name = $event_week_name[0]; $week_name = $event_week_name[1]; } $league_name = $( '
' ).attr( 'class', 'league-name' ); $league_name.text( $event_name ); $best_predix_container.append( $league_name ); $episode_name = $( '
' ).attr( 'class', 'episode-name' ); $episode_name.text( $week_name ); $best_predix_container.append( $episode_name ); $data_header_container = $( '
' ).attr( 'class', 'data-header-container' ); $head1 = $( '
' ).attr( 'class', 'head1' ); $head1.text( 'Username' ); $data_header_container.append( $head1 ); $head2 = $( '
' ).attr( 'class', 'head2' ); $head2.text( 'Accuracy %' ); $data_header_container.append( $head2 ); $head3 = $( '
' ).attr( 'class', 'head2' ); $head3.text( 'Points Won' ); $data_header_container.append( $head3 ); $best_predix_container.append( $data_header_container ); $.each( events.scores, function (j, score) { $user_data_container = $( '
' ).attr( 'class', 'user-data-container' ); $data1 = $( '
' ).attr( 'class', 'data1' ); $data1.text( parseInt(j) + 1 + '.' ); $user_data_container.append( $data1 ); $data2 = $( '
' ).attr( 'class', 'data2' ); $img = $( '' ).attr( 'src', response.user_info[score.user_id]['image'] ); $data2.append( $img ); $user_data_container.append( $data2 ); $data3 = $( '
' ).attr( 'class', 'data3' ); $data3.text( response.user_info[score.user_id]['display_name'] ); $user_data_container.append( $data3 ); $data4 = $( '
' ).attr( 'class', 'data4' ); $data4.text( score.game_summary_accuracy ); $user_data_container.append( $data4 ); $data5 = $( '
' ).attr( 'class', 'data4' ); $data5.text( score.game_summary_total_points_won ); $user_data_container.append( $data5 ); $best_predix_container.append( $user_data_container ); } ); $see_more_container = $( '
' ).attr( 'class', 'see-more-container' ); $see_more = $( '
' ).attr( 'class', 'see-more' ); $link_url = '/leaderboard/' + events.league_slug; $see_more_link = $( '' ).attr( 'href', $link_url ); $see_more_link.text( 'See more' ); $see_more.append( $see_more_link ); $see_more_container.append( $see_more ); $see_more_arrow_container = $( '
' ).attr( 'class', 'right-arrow-container' ); $see_more_arrow = $( '
' ).attr( 'class', 'right-arrow' ); $see_more_arrow_container.append( $see_more_arrow ); $see_more_container.append( $see_more_arrow_container ); $best_predix_container.append( $see_more_container ); } } ); $week_score_data.append( $best_predix_container ); $wrapper.append( $week_score_data ); } /*****See all leaderboard link code start here******/ var $links_container = $( '
' ).attr( 'class', 'links-container' ); var $see_all_leaderboards_link_container = $( '
' ).attr( 'id', 'see-all-leaderboards-link-container' ); var $see_all_leaderboard_link = $( '
' ).attr( 'class', 'see-all-leaderboard-link' ); if( game_type == 'tvshow' ) { var $link = $( '' ).attr( 'href', '/all-leaderboards/tvshows/recent/' ); $link.text( 'See All TV Shows Leaderboards' ); } else { var $link = $( '' ).attr( 'href', '/all-leaderboards/awardshows/recent/' ); $link.text( 'See All Awardshow Leaderboards' ); } $see_all_leaderboard_link.append( $link ); var $right_arrow_container = $( '
' ).attr( 'class', 'right-arrow-container' ); var $right_arrow = $( '
' ).attr( 'class', 'right-arrow' ); $right_arrow_container.append( $right_arrow ); $see_all_leaderboards_link_container.append( $see_all_leaderboard_link ); $see_all_leaderboards_link_container.append( $right_arrow_container ); $links_container.append( $see_all_leaderboards_link_container ); $wrapper.append( $links_container ); /*****See all leaderboard link code ends here******/ var $predix_button_container_main = $( '
' ).attr( 'class', 'predix-button-container-main' ); var $predix_button_container = $( '
' ).attr( 'class', 'predix-button-container' ); var $link = $( '' ).attr( 'href', '/leagues' ); var $predix_button = $( '
' ).attr( 'class', 'predix-button' ); $predix_button.text( 'Make My Predictions' ); $link.append( $predix_button ); $predix_button_container.append( $link ); $predix_button_container_main.append( $predix_button_container ); $wrapper.append( $predix_button_container_main ); $( '.best-predix-scores-widget #best-predix-data-container-main' ).append( $wrapper ); return; } })(jQuery); ; /* * Script for custom comments functionality. */ (function($) { $( document ).ready( function() { if ( 0 == $( '.custom-comments' ).length ) { // return if we are not on correct page. return; } /** * Read More, Comment and Reply Buttons click events */ $( '.custom-comments .read-more, .custom-comments .comments, .custom-comments .reply, .custom-comments .add-a-comment' ).on( 'click', function (e) { var form_id = $(this).parents('.custom-comments').attr('id'); $( '#comments-area-' + form_id ).toggle().css('display', 'flex'); $( '#read-more-area-' + form_id ).toggle(); // Expand reasons text on /awardshows/expert-predictions/* pages. $( '#' + form_id ).parent().children('.reasons-area').css('display', 'block').hide().show(500); } ); /** * Hide button click event */ $( '.comments-area .hide-button' ).on( 'click', function (e) { var form_id = $(this).parents('.custom-comments').attr('id'); $( '#comments-area-' + form_id ).slideToggle(); $( '#read-more-area-' + form_id ).slideToggle(); // Collapse reasons text on /awardshows/expert-predictions/* pages. $( '#' + form_id ).parent().children('.reasons-area').css('display', '-webkit-box'); } ); /** * Submit button OnClick event */ $( '.comments-area .add-reply-button' ).on( 'click', function (e) { var form_id = $(this).parents('.custom-comments').attr('id'); var nonce = $( '#nonce-' + form_id ).val(); var identifier = $( '#identifier-' + form_id ).val(); var textarea = $( '#reply-text-' + form_id ); var reply_text = textarea.val(); var submit_buttton = $(this); if ( '' === form_id || '' === nonce || '' === textarea.val() ) { return; } // Update submit button. submit_buttton.html('Saving, please wait..'); submit_buttton.css('color', '#aaa'); // Disable input text area textarea.val(''); textarea.attr('placeholder', 'Saving..'); textarea.attr('disabled', 'true'); $.ajax( { method: "POST", url: '/wp-json/gameplay/v1/add-comment/', data: { identifier: identifier, reply_text: reply_text }, beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', nonce ); }, success: function (response) { if ( 'success' == response.message ) { // Display Comment var HTML = build_comments_html( response ); $(HTML).insertAfter( '#' + form_id + ' .header' ); // Enable input text area textarea.removeAttr('disabled'); textarea.attr('placeholder', 'Add your comment here..'); // Enable submit button submit_buttton.html(' Submit'); submit_buttton.css('color', '#0088cc'); // Animate BG color for the new comment. $('#' + response.id).hide().fadeIn(); // Add remove events again. add_remove_event(); } else { // Error } }, fail: function (response) { // Error } } ); } ); function build_comments_html( data ) { // if user can remove the comment. var trashHTML = ''; if ( true === data.remove ) { trashHTML = '
Remove
'; } var HTML = '
' + '
' + '
' + '
' + '
' + data.name + '
' + '
  - ' + data.time + '
' + '
' + '
' + '
' + data.contents + '
' + trashHTML + '
' + '
' + '
'; return HTML; } add_remove_event(); function add_remove_event() { /** * Remove a comment */ $( '.comments-area .trash' ).on( 'click', function (e) { var form_id = $(this).parents('.custom-comments').attr('id'); var comment_id = $(this).parents('.comments-row').attr('id'); var nonce = $( '#nonce-' + form_id ).val(); var form_user = $( '#form-user-' + form_id ).val(); $('#' + comment_id).fadeOut('slow'); $.ajax( { method: "POST", url: '/wp-json/gameplay/v1/delete-reply/', data: { id: comment_id, form_user: form_user}, beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', nonce ); }, success: function (response) { if ( 'success' == response.message ) { $('#' + comment_id).remove(); } else { // Error } }, fail: function (response) { // Error } } ); } ); } /** * Show more comments */ $( '.show-more-comments' ).on( 'click', function (e) { var form_id = $(this).parents('.custom-comments').attr('id'); var form_user = $( '#form-user-' + form_id ).val(); var nonce = $( '#nonce-' + form_id ).val(); $('#show-more-link-' + form_id ).hide(); $('#loading-' + form_id ).show(); // Find last comment id ( comments are loaded in DESC form) var last_comment_id = $( '#' + form_id + ' .comments-row').last().attr('id'); if ( '' === last_comment_id ) { return; } $.ajax( { method: "POST", url: '/wp-json/gameplay/v1/more-comments/', data: { id: last_comment_id, form_user: form_user }, beforeSend: function (xhr) { xhr.setRequestHeader( 'X-WP-Nonce', nonce ); }, success: function (response) { if ( 'success' == response.message ) { var array_length = response.comments.length; for ( var i = 0; i < array_length; i++ ) { var HTML = build_comments_html( response.comments[i] ); $('#more-comments-' + form_id ).append( HTML ); $('#loading-' + form_id ).hide(); } if ( response.total_replies === array_length ) { $('#show-more-link-' + form_id ).hide(); } else { $('#show-more-link-' + form_id ).show(); } add_remove_event(); } else { // Error $('#loading-' + form_id ).hide(); $('#show-more-link-' + form_id ).hide(); } }, fail: function (response) { // Error } } ); } ); // To Do: } ); })(jQuery); ; (function($) { $('body #top-ten-gallery-container').on( 'click', '.ui-sortable li .ttg-arrow-cont .fa-chevron-up', function (index) { var $curr = $( this ); var $first_element = $curr.closest( 'li' ); var $first_element_content = $first_element.html(); var $first_element_pos = $first_element.attr( 'data-pos' ); var $first_element_item_id = $first_element.attr( 'data-gallery_item_id' ); var $second_element = ''; var $previous_element = $first_element.prev(); if ( $previous_element.is( "li" ) ) { $second_element = $first_element.prev( 'li' ); } else { $second_element = $first_element.prev().prev( 'li' ); } var $second_element_content = $second_element.html(); var $second_element_pos = $second_element.attr( 'data-pos' ); var $second_element_item_id = $second_element.attr( 'data-gallery_item_id' ); if ( $first_element_content != 'undefined' && $second_element_content != 'undefined' ) { $first_element.html( $second_element_content ); $sno_element = $first_element.find('.ttg-rec-sno'); $sno_element.html($first_element_pos + '.'); $first_element.attr( 'data-gallery_item_id', $second_element_item_id ); $second_element.html($first_element_content); $sno_element = $second_element.find('.ttg-rec-sno'); $sno_element.html($second_element_pos + '.'); $second_element.attr( 'data-gallery_item_id', $first_element_item_id ); } } ); $('body #top-ten-gallery-container').on( 'click', '.ui-sortable li .ttg-arrow-cont .fa-chevron-down', function (index) { var $curr = $( this ); var $first_element = $curr.closest( 'li' ); var $first_element_content = $first_element.html(); var $first_element_pos = $first_element.attr( 'data-pos' ); var $first_element_item_id = $first_element.attr( 'data-gallery_item_id' ); var $second_element = ''; var $previous_element = $first_element.next(); if ( $previous_element.is( "li" ) ) { $second_element = $first_element.next( 'li' ); } else { $second_element = $first_element.next().next( 'li' ); } var $second_element_content = $second_element.html(); var $second_element_pos = $second_element.attr('data-pos'); var $second_element_item_id = $second_element.attr( 'data-gallery_item_id' ); if ( $first_element_content != 'undefined' && $second_element_content != 'undefined' ) { $first_element.html($second_element_content); $sno_element = $first_element.find('.ttg-rec-sno'); $sno_element.html($first_element_pos + '.'); $first_element.attr( 'data-gallery_item_id', $second_element_item_id ); $second_element.html($first_element_content); $sno_element = $second_element.find('.ttg-rec-sno'); $sno_element.html($second_element_pos + '.'); $second_element.attr( 'data-gallery_item_id', $first_element_item_id ); } } ); $('body').on( 'click', '.ttg-btn-container .ttg-btn.ttg-btn-enabled', function () { var $u_id = $('#u_id').val(); var $total_items = $('#total_items').val(); var $gallery_id = $('#gallery_id').val(); var $nonce = $('#top_ten_widget_nonce').val(); var $choices = []; /***** Loading image starts here ******/ $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $('.msg-container').html( $loadin_img ); /***** Loading image ends here ******/ // Disable Save button $('.btn-cont button').removeClass('ttg-btn-enabled'); $('.btn-cont button').addClass('ttg-btn-disabled'); if (parseInt($total_items) > 0) { var $first_li_element = $('#top-ten-gallery-container').find('li'); var $next_li_element = $first_li_element; var $item_id = $($first_li_element).attr('data-gallery_item_id'); $choices[0] = $item_id; for (var i = 1; i < parseInt($total_items); i++) { $next_li_element = $next_li_element.next('li'); $item_id = $($next_li_element).attr('data-gallery_item_id'); $choices[i] = $item_id; } } $.ajax( { method: "POST", url: '/wp-json/top-ten/v1/top-ten-save-choices/', data: { user_id: $u_id, gallery_id: $gallery_id, choices: $choices }, beforeSend: function (xhr) { xhr.setRequestHeader('X-WP-Nonce', $nonce); }, success: function (response) { if ( 'success' === response.message ) { // Success $('.ttg-btn-container').css('display', 'none'); $sec_txt_div = $('
').attr('class', 'sec-txt-cont'); $sec_txt_sub_div = $('
').attr('class', 'sec-txt-sub-cont'); $sec_txt_sub_div.html('If your list is final, click last save below. or go back to change.'); $sec_txt_div.append($sec_txt_sub_div); $sec_btns_div = $('
').attr('class', 'sec-btns-cont'); $sec_btn1_div = $('
').attr('class', 'sec-btn1-cont'); $sec_btn1 = $('').attr('class', 'ttg-btn ttg-btn-enabled'); $btn.attr('type', 'button'); $btn.attr('data-gallery_id', gallery.ID); $btn.html('Enter '); $tick_icon = $('').attr('class', 'fa fa-angle-right'); $tick_icon.attr('aria-hidden', 'true'); $btn.append($tick_icon); $more_top10_btn.append($btn); $more_top10_data.append($more_top10_btn); $more_top10_row.append($more_top10_data); $more_top10_container.append($more_top10_row); }); $result_container.append($more_top10_container); } else { // Error $('.msg-container').html( 'Failed to save your final choices!' ); } }, fail: function (response) { $('.msg-container').html( 'Failed to save your final choices!' ); // Error } } ); } ); $('body').on( 'click', '.ttg-more-top10-btn .ttg-btn.ttg-btn-enabled', function () { var $gallery_id = $(this).attr('data-gallery_id'); var $nonce = $('#top_ten_widget_nonce').val(); $.ajax( { method: "POST", url: '/wp-json/top-ten/v1/get-top-ten-gallery/', data: { gallery_id: $gallery_id, }, beforeSend: function (xhr) { xhr.setRequestHeader('X-WP-Nonce', $nonce); }, success: function (response) { if ( 'success' === response.message ) { // Success $('#gallery_id').attr('value', $gallery_id); $nominee_class = 'ui-sortable'; $data = response.data; $main_cont = $('#top-ten-gallery-container'); $main_cont.html(''); $head_cont = $('
').attr('class', 'ttg-head-container'); $head_title = $('
').attr('class', 'ttg-head-title'); $head_title.html($data.gallery_title); $head_cont.append($head_title); $head_close_icon_cont = $('
').attr('class', 'ttg-close-icon-container'); $close_icon = $('').attr('class', 'fa fa-times-circle close-icon'); $close_icon.attr('aria-hidden', 'true'); $head_close_icon_cont.append($close_icon); $head_cont.append($head_close_icon_cont); $main_cont.append($head_cont); if (0 == $data.final_save) { $desc_cont = $('
').attr('class', 'ttg-desc-container'); $desc_sub_cont = $('
').attr('class', 'ttg-desc-sub-container'); $img_cont = $('
').attr('class', 'img-container'); $image = $data.gallery_image; $img_cont.append($image); $desc_sub_cont.append($img_cont); $desc_txt_cont = $('
').attr('class', 'desc-container'); $desc_txt_cont.html('Below are our Editors\' favorites. Create your ranking using the up/down arrows.'); $desc_sub_cont.append($desc_txt_cont); $desc_cont.append($desc_sub_cont); $main_cont.append($desc_cont); } else { $succ_msg_cont = $('
').attr('class', 'ttg-succ-msg-cont'); $icon = $('').attr('class', 'fa fa-check'); $icon.attr('aria-hidden', 'true'); $succ_msg_cont.append($icon); $succ_msg = $('
').attr('class', 'succ-msg-cont'); $succ_msg.html('Great! You have already saved your choices.'); $succ_msg_cont.append($succ_msg); $main_cont.append($succ_msg_cont); $nominee_class = 'ui-sortable disable-div'; } $ul_cont = $('').attr('class', $nominee_class); $counter = 0; $user_choices = $data.user_choices; $topten_gallery_items = $data.topten_gallery_items; // console.log($user_choices); // console.log($topten_gallery_items); Object.entries($user_choices).forEach(entry => { const [key, value] = entry; // $nominee_detail = $topten_gallery_items[key]['gallery_id']; $li_cont = $('
  • ').attr('data-pos', ( $counter + 1 ) ); $li_cont.attr('data-gallery_item_id', value); $rec_cont = $('
    ').attr('class', 'ttg-rec-container'); $rec_sno = $('
    ').attr('class', 'ttg-rec-sno'); $rec_sno.html( ( $counter + 1 ) + '.'); $rec_cont.append($rec_sno); $img_title_cont = $('
    ').attr('class', 'ttg-img-title-container'); $img_cont = $('
    ').attr('class', 'img-cont'); $img_cont.attr("style", "background-image:url('"+ $topten_gallery_items[value]['image'] +"');"); $img_title_cont.append($img_cont); $title = $('
    ').attr('class', 'title'); $title.html($topten_gallery_items[value]['title']); $img_title_cont.append($title); $rec_cont.append($img_title_cont); $arrow_cont = $('
    ').attr('class', 'ttg-arrow-cont'); $div = $('
    '); $div2 = $('
    ').attr('class', 'arrow-up'); $up_icon = $('').attr('class', 'fa fa-chevron-up arrow-color'); $up_icon.attr('aria-hidden', 'true'); $div2.append($up_icon) $div.append($div2) $div3 = $('
    '); $down_icon = $('').attr('class', 'fa fa-chevron-down arrow-color'); $down_icon.attr('aria-hidden', 'true'); $div3.append($down_icon) $div.append($div3) $arrow_cont.append($div) $rec_cont.append($arrow_cont) $li_cont.append($rec_cont); $ul_cont.append($li_cont); $counter = $counter + 1; }); $total_item_input = $('').attr('name', 'total_items'); $total_item_input.attr('id', 'total_items'); $total_item_input.attr('value', $counter); $total_item_input.attr('type', 'hidden'); $ul_cont.append($total_item_input); $main_cont.append($ul_cont); if (0 == $data.final_save) { $btn_container = $('
    ').attr('class', 'ttg-btn-container'); $btn_cont = $('
    ').attr('class', 'btn-cont'); $btn = $('').attr('class', 'ttg-btn ttg-btn-enabled'); $btn.html('Save'); $tick_icon = $('').attr('class', 'fa fa-check'); $tick_icon.attr('aria-hidden', 'true'); $btn.append($tick_icon); $btn_cont.append($btn); $btn_container.append($btn_cont); $msg_cont = $('
    ').attr('class', 'msg-container'); $btn_container.append($msg_cont); $main_cont.append($btn_container); } else { $result_container = $('
    ').attr('class', 'ttg-result-container'); $result_head_container = $('
    ').attr('class', 'ttg-result-head'); $result_head_container.html('See your choices vs. all Derbytes '); $icon = $('').attr('class', 'fa fa-angle-right'); $icon.attr('aria-hidden', 'true'); $result_head_container.append($icon); $result_container.append($result_head_container); $counter = 1; Object.entries($data.nominees).forEach(entry => { const [key, nominee] = entry; $result_row = $('
    ').attr('class', 'ttg-result-row'); $result_img_row = $('
    ').attr('class', 'ttg-result-img'); $result_img_row.attr("style", "background-image:url('"+ nominee.image +"');"); $result_row.append($result_img_row); $result_data_cont = $('
    ').attr('class', 'ttg-result-data-cont'); $result_bar = $('
    ').attr('class', 'ttg-result-bar'); $result_bar_chart = $('
    ').attr('class', 'ttg-result-bar-chart'); $result_bar_chart.attr('style', 'width:' + nominee.bar_percent + '%'); $result_bar.append($result_bar_chart); $result_bar_txt = $('
    ').attr('class', 'ttg-result-txt'); $result_bar_txt.html(nominee.total + ' Choices'); $result_bar.append($result_bar_txt); $result_data_cont.append($result_bar); $result_nom_title = $('
    ').attr('class', 'ttg-nominee-title'); $result_nom_title.html('#' + $counter + ' ' + nominee.title ); $result_data_cont.append($result_nom_title); $result_row.append($result_data_cont); $result_container.append($result_row); $counter = $counter + 1; }); $main_cont.append($result_container); $more_top10_container = $('
    ').attr('class', 'ttg-more-top10-rankings'); $more_top10_head = $('
    ').attr('class', 'ttg-more-top10-title'); $more_top10_head.html('Create more top 10 rankings! Choose below...'); $more_top10_container.append($more_top10_head); Object.entries($data.other_galleries).forEach(entry => { const [key, gallery] = entry; $more_top10_row = $('
    ').attr('class', 'ttg-more-top10-row'); $more_top10_img = $('
    ').attr('class', 'ttg-more-top10-img'); $more_top10_img.html(gallery.image); $more_top10_row.append($more_top10_img); $more_top10_data = $('
    ').attr('class', 'ttg-more-top10-data'); $more_top10_title = $('
    ').attr('class', 'ttg-more-top10-gallery-title'); $more_top10_title.html(gallery.post_title); $more_top10_data.append($more_top10_title); $more_top10_btn = $('
    ').attr('class', 'ttg-more-top10-btn'); $btn = $('').attr('class', 'ttg-btn ttg-btn-enabled'); $btn.attr('type', 'button'); $btn.attr('data-gallery_id', gallery.ID); $btn.html('Enter '); $tick_icon = $('').attr('class', 'fa fa-angle-right'); $tick_icon.attr('aria-hidden', 'true'); $btn.append($tick_icon); $more_top10_btn.append($btn); $more_top10_data.append($more_top10_btn); $more_top10_row.append($more_top10_data); $more_top10_container.append($more_top10_row); }); $result_container.append($more_top10_container); } // $main_cont.removeClass('ttg-desc-container'); // $main_cont.addClass('ttg-succ-msg-cont'); } else { // Error $('.msg-container').html( 'Failed to get gallery!' ); } }, fail: function (response) { $('.msg-container').html( 'Failed to get gallery!' ); // Error } } ); } ); })(jQuery); ; /*! jQuery UI - v1.13.3 - 2024-04-26 * https://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3", /*! * jQuery UI :data 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}), /*! * jQuery UI Disable Selection 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}), /*! * jQuery UI Focusable 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)}, /*! * jQuery UI Form Reset Mixin 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), /*! * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license * */ x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}), /*! * jQuery UI Keycode 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}, /*! * jQuery UI Labels 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o
    ")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthW(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;e.collisionWidth>n?0o?0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o' ).attr( 'id', 'latest-odds-widget-container' ); /***** Loading image starts here ******/ var $loading_img_div = $( '
    ' ).attr( 'id', 'latest-odds-loading-image' ); $loading_img_div.css( 'display', 'none' ); $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $loading_img_div.append( $loadin_img ); $wrapper.append( $loading_img_div ); /***** Loading image ends here ******/ var $latest_odds_dynamic_area = $( '
    ' ).attr( 'id', 'latest-odds-dynamic-area' ); /***** Game names (top navigation) starts here ******/ var $top_navitation = $( '
    ' ).attr( 'class', 'top-navigation top-navigation-desktop-home-top' ); $.each( response.top_navigation, function (i, nav_item) { cl = 'item'; if ( nav_item.league_id == response.selected_league_id ) { cl = 'item active'; } $item = $( '
    ' ).attr( 'class', cl ); $item.attr( 'id', nav_item.league_id ); $item.text( nav_item.title ); $top_navitation.append( $item ); } ); $latest_odds_dynamic_area.append( $top_navitation ); /***** Game names (top navigation) ends here ******/ } else if ( 'second' == resp_type ){ $top_div.find( '#second_sec' ).empty(); } else { $top_div.find( '.latest-odds-user-data-container' ).empty(); } if ( 'third' !== resp_type ) { $second_sec = $( '
    ' ).attr( 'id', 'second_sec' ); /***** Loading image in second_sec starts here ******/ var $loading_img_div = $( '
    ' ).attr( 'id', 'latest-odds-loading-image2' ); $loading_img_div.css( 'display', 'none' ); $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $loading_img_div.append( $loadin_img ); $second_sec.append( $loading_img_div ); /***** Loading image in second_sec ends here ******/ /***** Current League Title starts here ******/ $league_title = $( '
    ' ).attr( 'class', 'league_title league_title_desktop_home_top' ); $league_title.text( response.selected_league_title ); $second_sec.append( $league_title ); /***** Current League Title ends here ******/ $cat_usertype_dropdown_div = $( '
    ' ).attr( 'class', 'cat-usertype-dropdown-div cat-usertype-dropdown-div-desktop-home-top' ); /***** Category dropdown starts here ******/ $custom_dropdown = $( '' ).attr( 'class', 'custom-dropdown cat-dropdown custom-dropdown-desktop-main-top' ); $select = $( '' ).attr( 'id', 'category_dropdown' ); $.each( response.categories, function (i, cat) { $option = $( '' ).attr( 'value', cat.category_id ); $option.text( cat.category_title ); $select.append( $option ); } ); $custom_dropdown.append( $select ); $cat_usertype_dropdown_div.append( $custom_dropdown ); /***** Category dropdown ends here ******/ /***** user type dropdown starts here ******/ var sortData = [ { value: "combined" }, { value: "editor" }, { value: "top24" }, { value: "star24" }, { value: "users" }, ]; if ( 'awardshows' == game_type ) { sortData = [ { value: "combined" }, { value: "expert" }, { value: "editor" }, { value: "top24" }, { value: "star24" }, { value: "users" }, ]; } $custom_dropdown = $( '' ).attr( 'class', 'custom-dropdown custom-dropdown-desktop-main-top flr' ); $select = $( '' ).attr( 'id', 'user_type_dropdown' ); $.each( sortData, function (i, usertype) { if ( usertype.value == response.selected_user_type ) { $option = $( '' ).attr( 'value', usertype.value ); } else { $option = $( '' ).attr( 'value', usertype.value ); } $option.text( usertype.value ); $select.append( $option ); } ); $custom_dropdown.append( $select ); $cat_usertype_dropdown_div.append( $custom_dropdown ); /***** user type dropdown ends here ******/ $second_sec.append( $cat_usertype_dropdown_div ); /******** Data heading starts here ********/ $data_heading = $( '
    ' ).attr( 'class', 'data-heading' ); $f_column = $( '
    ' ).attr( 'class', 'f_column' ); $f_column.text( 'Nominees' ); $data_heading.append( $f_column ); $s_column = $( '
    ' ).attr( 'class', 's_column' ); $s_column.text( 'Top Choice' ); $data_heading.append( $s_column ); $t_column = $( '
    ' ).attr( 'class', 't_column' ); $t_column.text( 'Odds' ); $data_heading.append( $t_column ); $second_sec.append( $data_heading ); /******** Data heading ends here ********/ } /******** Main data container starts here ********/ if ( $top_div.find( '.latest-odds-user-data-container' ).length && $top_div.find( ".latest-odds-user-data-container" ).text() == '' ) { $user_data_container = $( '
    ' ).attr( 'class', 'latest-odds-user-data-container2' ); } else { $user_data_container = $( '
    ' ).attr( 'class', 'latest-odds-user-data-container latest-odds-user-data-container-desktop-main-top' ); } /***** Loading image in second_sec starts here ******/ var $loading_img_div = $( '
    ' ).attr( 'id', 'latest-odds-loading-image3' ); $loading_img_div.css( 'display', 'none' ); $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $loading_img_div.append( $loadin_img ); $user_data_container.append( $loading_img_div ); /***** Loading image in second_sec ends here ******/ $.each( response.odds, function (i, odd) { $user_data = $( '
    ' ).attr( 'class', 'user-data' ); $data1 = $( '
    ' ).attr( 'class', 'data1' ); $data1.text( parseInt(i) + 1 + '.' ); $user_data.append( $data1 ); $data2 = $( '
    ' ).attr( 'class', 'data2' ); $img = $( '' ).attr( 'src', odd.nominee_image ); $data2.append( $img ); $user_data.append( $data2 ); $data3 = $( '
    ' ).attr( 'class', 'data3' ); $data3.text( odd.candidate_title ); $user_data.append( $data3 ); $data4 = $( '
    ' ).attr( 'class', 'data4' ); $data4.text( odd.top_choice ); $user_data.append( $data4 ); $data5 = $( '
    ' ).attr( 'class', 'data5' ); $data5.text( odd.fractional_odds ); $user_data.append( $data5 ); $user_data_container.append( $user_data ); } ); /********* Add hiddend data starts here ************/ $hidden1 = $( '
    ' ).attr( 'id', 'odds_widget_current_event' ); $hidden1.css( 'display', 'none' ); $hidden1.text( response.selected_league_id ); $user_data_container.append( $hidden1 ); $hidden1 = $( '
    ' ).attr( 'id', 'odds_widget_current_category_id' ); $hidden1.css( 'display', 'none' ); $hidden1.text( response.selected_category_id ); $user_data_container.append( $hidden1 ); $hidden1 = $( '
    ' ).attr( 'id', 'odds_widget_current_user_type' ); $hidden1.css( 'display', 'none' ); $hidden1.text( response.selected_user_type ); $user_data_container.append( $hidden1 ); $hidden1 = $( '
    ' ).attr( 'id', 'odds_widget_current_game_type' ); $hidden1.css( 'display', 'none' ); $hidden1.text( game_type ); $user_data_container.append( $hidden1 ); /********* Add hiddend data ends here ************/ if ( 'third' !== resp_type ) { $second_sec.append( $user_data_container ); } /******** Main data container ends here ********/ if ( 'first' == resp_type ) { $latest_odds_dynamic_area.append( $second_sec ); $wrapper.append( $latest_odds_dynamic_area ); } if ( 'first' == resp_type ) { $top_div.find( '#latest-odds-data-container-main' ).append( $wrapper ); } else if ( 'second' == resp_type ) { $top_div.find( '#second_sec' ).append( $second_sec ); } else { $top_div.find( '.latest-odds-user-data-container' ).append( $user_data_container ); } $top_div.find( '.lateset-odds-widget-more-link-text a' ).attr( 'href', '/odds/' + response.selected_user_type + '-odds/' + response.selected_league_slug + '/' ); return; } function success_callback2( response, game_type, data_type, cur_this ){ var $top_div = cur_this.closest('.latest-odds-n-best-scores-widget'); $top_div.find( '#best_predix_main_div #best-predix-loading-image' ).css("display", 'none'); $top_div.find( '#best_predix_main_div #best-predix-loading-image2' ).css("display", 'none'); $top_div.find( '#best_predix_main_div .second-nav-container' ).empty(); $top_div.find( '#best_predix_main_div #week_score_data' ).empty(); $top_div.find( '#best_predix_main_div .links-container' ).remove(); $top_div.find( '#best_predix_main_div #best-predix-data-container-main' ).empty(); var $data_outer_div_class = 'best-predix-container best-predix-container-awards'; if( game_type == 'tvshow' ) { $data_outer_div_class = 'best-predix-container best-predix-container-tv'; } var $wrapper = $( '
    ' ).attr( 'id', 'best-predix-data-container' ); var $loading_img_div = $( '
    ' ).attr( 'id', 'best-predix-loading-image' ); $loading_img_div.css( 'display', 'none' ); $loadin_img = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img.attr( 'alt', 'Loading...' ); $loading_img_div.append( $loadin_img ); $wrapper.append( $loading_img_div ); var $second_nav_container = $( '
    ' ).attr( 'class', 'second-nav-container' ); var $loading_img_div2 = $( '
    ' ).attr( 'id', 'best-predix-loading-image2' ); $loading_img_div2.css( 'display', 'none' ); $loadin_img2 = $( '' ).attr( 'src', '/wp-content/themes/vip/pmc-goldderby/assets/images/loading.gif' ); $loadin_img2.attr( 'alt', 'Loading...' ); $loading_img_div2.append( $loadin_img2 ); if( game_type == 'tvshow' ) { season_score_nav_class = 'second-nav-item-desktop-main-top'; week_score_nav_class = 'second-nav-item-desktop-main-top active-desktop-main-top'; if ( 'season-data' == data_type ) { season_score_nav_class = 'second-nav-item-desktop-main-top active-desktop-main-top'; week_score_nav_class = 'second-nav-item-desktop-main-top'; } var $second_nav = $( '
    ' ).attr( 'class', 'second-nav' ); var $second_nav_item_1 = $( '
    ' ).attr( 'class', season_score_nav_class ); $second_nav_item_1.attr( 'id', 'season_scores' ); $second_nav_item_1.text( 'Season Scores' ); $second_nav.append( $second_nav_item_1 ); var $second_nav_item_2 = $( '
    ' ).attr( 'class', week_score_nav_class ); $second_nav_item_2.attr( 'id', 'week_scores' ); $second_nav_item_2.text( 'Recent Week Scores' ); $second_nav.append( $second_nav_item_2 ); $second_nav_container.append( $second_nav ); $wrapper.append( $second_nav_container ); $wrapper.append( $loading_img_div2 ); if ( 'season-data' == data_type ) { var $season_score_data = $( '
    ' ).attr( 'id', 'season_score_data' ); var $best_predix_container = $( '
    ' ).attr( 'class', $data_outer_div_class ); $.each( response.season_data, function (i, events) { if (events.game_event_name) { $league_name = $( '
    ' ).attr( 'class', 'league-name' ); $league_name.text( events.game_event_name ); $best_predix_container.append( $league_name ); $data_header_container = $( '
    ' ).attr( 'class', 'data-header-container' ); $head1 = $( '
    ' ).attr( 'class', 'head1' ); $head1.text( 'Username' ); $data_header_container.append( $head1 ); $head2 = $( '
    ' ).attr( 'class', 'head2' ); $head2.text( 'Accuracy %' ); $data_header_container.append( $head2 ); $head3 = $( '
    ' ).attr( 'class', 'head2' ); $head3.text( 'Points Won' ); $data_header_container.append( $head3 ); $best_predix_container.append( $data_header_container ); $.each( events.scores, function (j, score) { $user_data_container = $( '
    ' ).attr( 'class', 'user-data-container' ); $data1 = $( '
    ' ).attr( 'class', 'data1' ); $data1.text( parseInt(j) + 1 + '.' ); $user_data_container.append( $data1 ); $data2 = $( '
    ' ).attr( 'class', 'data2' ); $img = $( '' ).attr( 'src', response.user_info[score.user_id]['image'] ); $data2.append( $img ); $user_data_container.append( $data2 ); $data3 = $( '
    ' ).attr( 'class', 'data3' ); $data3.text( response.user_info[score.user_id]['display_name'] ); $user_data_container.append( $data3 ); $data4 = $( '
    ' ).attr( 'class', 'data4' ); $data4.text( score.average_accuracy ); $user_data_container.append( $data4 ); $data5 = $( '
    ' ).attr( 'class', 'data4' ); $data5.text( score.total_points_won ); $user_data_container.append( $data5 ); $best_predix_container.append( $user_data_container ); } ); $see_more_container = $( '
    ' ).attr( 'class', 'see-more-container see-more-container-desktop-main-top' ); $see_more = $( '
    ' ).attr( 'class', 'see-more' ); $link_url = '/all-leaderboards/tvshows/recent/'; $see_more_link = $( '' ).attr( 'href', $link_url ); $see_more_link.text( 'See more' ); $see_more.append( $see_more_link ); $see_more_container.append( $see_more ); $see_more_arrow_container = $( '
    ' ).attr( 'class', 'right-arrow-container' ); $see_more_arrow = $( '
    ' ).attr( 'class', 'right-arrow' ); $see_more_arrow_container.append( $see_more_arrow ); $see_more_container.append( $see_more_arrow_container ); $best_predix_container.append( $see_more_container ); } } ); $season_score_data.append( $best_predix_container ); $wrapper.append( $season_score_data ); } } if ( 'league-data' == data_type ) { $wrapper.append( $loading_img_div2 ); var $week_score_data = $( '
    ' ).attr( 'id', 'week_score_data' ); var $best_predix_container = $( '
    ' ).attr( 'class', $data_outer_div_class ); $.each( response.league_data, function (i, events) { if (events.game_event_name) { $event_name = events.game_event_name; $week_name = ''; if( game_type == 'tvshow' ) { $event_week_name = $event_name.split( ': ' ); $event_name = $event_week_name[0]; $week_name = $event_week_name[1]; } $league_name = $( '
    ' ).attr( 'class', 'league-name league-name-desktop-main-top' ); $league_name.text( $event_name ); $best_predix_container.append( $league_name ); $episode_name = $( '
    ' ).attr( 'class', 'episode-name episode-name-desktop-main-top' ); $episode_name.text( $week_name ); $best_predix_container.append( $episode_name ); $data_header_container = $( '
    ' ).attr( 'class', 'data-header-container' ); $head1 = $( '
    ' ).attr( 'class', 'head1' ); $head1.text( 'Username' ); $data_header_container.append( $head1 ); $head2 = $( '
    ' ).attr( 'class', 'head2' ); $head2.text( 'Accuracy %' ); $data_header_container.append( $head2 ); $head3 = $( '
    ' ).attr( 'class', 'head2' ); $head3.text( 'Points Won' ); $data_header_container.append( $head3 ); $best_predix_container.append( $data_header_container ); $.each( events.scores, function (j, score) { $user_data_container = $( '
    ' ).attr( 'class', 'user-data-container' ); $data1 = $( '
    ' ).attr( 'class', 'data1' ); $data1.text( parseInt(j) + 1 + '.' ); $user_data_container.append( $data1 ); $data2 = $( '
    ' ).attr( 'class', 'data2' ); $img = $( '' ).attr( 'src', response.user_info[score.user_id]['image'] ); $data2.append( $img ); $user_data_container.append( $data2 ); $data3 = $( '
    ' ).attr( 'class', 'data3' ); $data3.text( response.user_info[score.user_id]['display_name'] ); $user_data_container.append( $data3 ); $data4 = $( '
    ' ).attr( 'class', 'data4' ); $data4.text( score.game_summary_accuracy ); $user_data_container.append( $data4 ); $data5 = $( '
    ' ).attr( 'class', 'data4' ); $data5.text( score.game_summary_total_points_won ); $user_data_container.append( $data5 ); $best_predix_container.append( $user_data_container ); } ); $see_more_container = $( '
    ' ).attr( 'class', 'see-more-container see-more-container-desktop-main-top' ); $see_more = $( '
    ' ).attr( 'class', 'see-more' ); $link_url = '/leaderboard/' + events.league_slug; $see_more_link = $( '' ).attr( 'href', $link_url ); $see_more_link.text( 'See more' ); $see_more.append( $see_more_link ); $see_more_container.append( $see_more ); $see_more_arrow_container = $( '
    ' ).attr( 'class', 'right-arrow-container' ); $see_more_arrow = $( '
    ' ).attr( 'class', 'right-arrow' ); $see_more_arrow_container.append( $see_more_arrow ); $see_more_container.append( $see_more_arrow_container ); $best_predix_container.append( $see_more_container ); } } ); $week_score_data.append( $best_predix_container ); $wrapper.append( $week_score_data ); } /*****See all leaderboard link code start here******/ var $links_container = $( '
    ' ).attr( 'class', 'links-container-desktop-main-top' ); var $see_all_leaderboards_link_container = $( '
    ' ).attr( 'id', 'see-all-leaderboards-link-container' ); var $see_all_leaderboard_link = $( '
    ' ).attr( 'class', 'see-all-leaderboard-link-desktop-main-top' ); if( game_type == 'tvshow' ) { var $link = $( '' ).attr( 'href', '/all-leaderboards/tvshows/recent/' ); $link.text( 'See All TV Shows Leaderboards' ); } else { var $link = $( '' ).attr( 'href', '/all-leaderboards/awardshows/recent/' ); $link.text( 'See All Awardshow Leaderboards' ); } $see_all_leaderboard_link.append( $link ); var $right_arrow_container = $( '
    ' ).attr( 'class', 'right-arrow-container' ); var $right_arrow = $( '
    ' ).attr( 'class', 'right-arrow-desktop-main-top' ); $right_arrow_container.append( $right_arrow ); $see_all_leaderboards_link_container.append( $see_all_leaderboard_link ); $see_all_leaderboards_link_container.append( $right_arrow_container ); $links_container.append( $see_all_leaderboards_link_container ); $wrapper.append( $links_container ); /*****See all leaderboard link code ends here******/ /*****Make or Updare my predix link code start here******/ var $links_container = $( '
    ' ).attr( 'class', 'links-container-desktop-main-top' ); var $make_update_predix_link_container = $( '
    ' ).attr( 'id', 'make-update-predix-link-container' ); var $make_update_predix_link = $( '
    ' ).attr( 'class', 'make-update-predix-link-desktop-main-top' ); var $link = $( '' ).attr( 'href', '/leagues/' ); $link.text( 'Make or update my predictions' ); $make_update_predix_link.append( $link ); var $right_arrow_container = $( '
    ' ).attr( 'class', 'right-arrow-container' ); var $right_arrow = $( '
    ' ).attr( 'class', 'right-arrow-desktop-main-top' ); $right_arrow_container.append( $right_arrow ); $make_update_predix_link_container.append( $make_update_predix_link ); $make_update_predix_link_container.append( $right_arrow_container ); $links_container.append( $make_update_predix_link_container ); $wrapper.append( $links_container ); /*****Make or Updare my predix link code ends here******/ $top_div.find( '#best_predix_main_div #best-predix-data-container-main' ).append( $wrapper ); return; } function error_callback( response, cur_div ) { var $top_div = cur_div.closest('.latest-odds-n-best-scores-widget'); var $dynamic_div = $top_div.find( '#latest-odds-dynamic-area' ); $dynamic_div.prop( 'style', 'height: 374px;padding: 10px; text-align:center;' ); if ( 'Error 102: Sorry, no records found.' === response.message ) { $dynamic_div.text('No data found!'); } $top_div.find('#latest_odds_main_div #latest-odds-loading-image').css("display", 'none'); $top_div.find('#latest_odds_main_div #latest-odds-loading-image').css("display", 'none'); $top_div.find('.latest-odds-widget-more-link-main-div').html(''); $top_div.find('.links-container-desktop-main-top').html(''); } })(jQuery); ; (function($) { $( document ).ready( function () { $('#expert-predictions-v2.expert-predictions-v2').show(); $( '#expert-predictions-v2.expert-predictions-v2' ).slick( { dots: true, infinite: true, slidesToScroll: 1, centerMode: false, autoplay: true, autoplaySpeed: 5000, arrows: false, variableWidth: true, slidesToShow: 1, } ); $('#latest-odds-widget-v2').show(); $( '#latest-odds-widget-v2' ).slick( { dots: true, infinite: true, slidesToScroll: 1, centerMode: false, autoplay: true, autoplaySpeed: 5000, arrows: false, variableWidth: true, slidesToShow: 1, } ); } ); })(jQuery); ; /** * GD gallery thumbsup */ jQuery( document ).ready( function() { jQuery( '.gallery-thumbsup' ).click( function ( e ) { var nxt_act = ''; var cls = ''; var link = this; var id = jQuery( link ).attr( 'id' ); var userid = jQuery( link ).attr( 'data-userid' ); var nonce = jQuery( link ).attr( 'data-nonce' ); var act = jQuery( link ).attr( 'data-action' ); if ( 'unlike' == act ) { nxt_act = 'like'; cls = 'unliked'; } else { nxt_act = 'unlike'; cls = 'liked'; } $obj = jQuery(link).closest('.fs-item-likes'); if ('0' === userid) { $err_obj = $obj.find('.error'); $err_obj.show(); setTimeout(function() { $err_obj.hide(); }, 5000); return; } $img_obj = $obj.find('.processing'); $img_obj.show(); $thumbsup_obj = $obj.find('.gallery-thumbsup'); $likes_count_obj = $obj.find('.fs-like-counter'); // This is what we are sending the server var data = { pid: id, uid: userid, nonce: nonce }; // Send request to like/unlike the gallery jQuery.ajax( { method: "POST", url: '/wp-json/gallery-api/v1/gd_gallery_thumbs_up/', data: data, beforeSend: function (xhr) { xhr.setRequestHeader('X-WP-Nonce', nonce); }, success: function (response) { var total_likes = response.supplemental.total_likes; if ( cls == 'liked' ) { $thumbsup_obj.removeClass( 'unliked' ); } else { $thumbsup_obj.removeClass( 'liked' ); } $thumbsup_obj.addClass( cls ); $thumbsup_obj.attr( 'data-action', nxt_act ); $likes_count_obj.text( total_likes ); $img_obj.hide(); }, fail: function (response) { $img_obj.hide(); }, error: function (response) { $img_obj.hide(); alert('Unable to process, please try later!'); } } ); // Prevent the default behavior for the link e.preventDefault(); } ); } ); ; var pmc_contextual_player={player_main_div:".pmc-contextual-player",message_pattern:"pmcadm:dfp:isdirect=true",init:function(){this.bind_events()},bind_events:function(){var self=this;self.pause_triggered=false;jQuery(window).on("message",function(wrappedEvent){var event=wrappedEvent.originalEvent;if("string"===typeof event.data){if(event.data.substring(0,self.message_pattern.length)===self.message_pattern){if("object"!==typeof pmc_adm_config||"string"!==typeof pmc_adm_config.contextual_on_direct_sold||"show"!==pmc_adm_config.contextual_on_direct_sold){self.remove_contextual_player()}}else if(event.data==="pmc_show_interrupt_ads"){if(window.contextual_player){try{if(window.contextual_player.getState()!=="playing"){var jwconfig=window.contextual_player.getConfig();if(jwconfig.autostart==="viewable"&&jwconfig.viewable){self.pause_triggered=true}}else{self.pause_triggered=true}if(self.pause_triggered){window.contextual_player.pause()}}catch(e){}}}else if(event.data==="pmc_hide_interrupt_ads"){if(self.pause_triggered){window.contextual_player.play();self.pause_triggered=false}}}});if("object"===typeof contextual_player){contextual_player.on("play",self.current_playing);contextual_player.on("adPlay",self.current_playing);contextual_player.on("relatedReady",function(){var relatedPlugin=contextual_player.getPlugin("related");if("object"===typeof relatedPlugin){relatedPlugin.on("feedShown",function(){self.create_playlist_nav();jQuery(".pmc-contextual-player .jw-related-control").on("click",self.current_playing)})}});contextual_player.on("ready",function(){var relatedPlugin=contextual_player.getPlugin("related");if("object"===typeof relatedPlugin){relatedPlugin.on("feedShown",function(){self.create_playlist_nav();jQuery(".pmc-contextual-player .jw-related-control").on("click",self.current_playing)})}})}},remove_contextual_player:function(){var player=jQuery(this.player_main_div);if(0VIEWING');if("object"===typeof current_item&&1===current_item.length){current_item.addClass("is-active")}if(0===jQuery(".jw-related-shelf-item[data-jw-index="+playlist_index+"] .contextual-self-now-playing").length){current_item.find(".jw-related-shelf-item-image").append(now_playing)}},create_playlist_nav:function(){if(0===jQuery(".pmc-contextual-player .l-adm-contextual-video__shadow").length){var shadow_left=jQuery('
    '),shadow_right=jQuery('
    ');jQuery(".pmc-contextual-player .jw-related-control-left").prepend(shadow_left);jQuery(".pmc-contextual-player .jw-related-control-right").prepend(shadow_right)}}};pmc_contextual_player.init();; (()=>{"use strict";const t=window;t.blogherads=t.blogherads||{},t.blogherads.adq=t.blogherads.adq||[];const e=()=>t.blogherads,n=window,d=()=>"function"==typeof n.blogherads?.reloadAds,a=t=>Boolean(t?.domId?.length),s=window,i=s.document;class o{constructor(t){t.forEach((t=>this.push(t)))}push(t){try{t.call(null)}catch(t){}}attachConnatix(t){i.documentElement.classList.contains("floatingplayer-nofloat")?t.disableFloatingMode():s.addEventListener("message",(({data:e})=>{"pmcadm:floatingplayer=nofloat"===e&&t.disableFloatingMode()}),!1)}}const r=window;if(r.pmc=r.pmc||{},r.pmc.adm=r.pmc.adm||[],Array.isArray(r.pmc.adm)){const t=r.pmc.adm;r.pmc.adm=new o(t)}const c=()=>r.pmc,l=window,m=c();m.displayAds=new function(){const t=e();this.init=function(){this.bind_events()}.bind(this),this.bind_events=function(){const e=c();e.hooks?.add_action?.("pmc_gallery_rotate_ads",this.rotate_ads_for_gallery),e.hooks?.add_action?.("pmc_rotate_ads",this.rotate_ads),"loading"!==document.readyState?this.display():document.addEventListener("DOMContentLoaded",this.display),l.addEventListener("message",this.direct_sold_ad_event_listener,!1),t.addEventListener("blankAdServed",this.blank_ad_event_listener),t.addEventListener("slotRefresh",this.slot_refresh_event_listener)}.bind(this),this.rotate_ads=function(e){if(!e||this.is_direct_sold||!d())return;const n=[];jQuery("div.slot-rotate-"+e).each((function(){let e="";e=1===parseInt(jQuery(this).data("is-adhesion-ad"))?"skm-ad-bottom":jQuery(this).attr("id");const d=t.getSlotById(e);d&&n.push(d)})),n&&n.length&&t.reloadAds(n)}.bind(this),this.rotate_ads_for_gallery=function(){if(!d())return;const e=l.pmc_meta;"mobile"===e?.env?t.reloadAds(t.getSlots()):t.reloadAds()}.bind(this),this.display=function(){""!==function(){const t=document.querySelector("#pmc-adm-ad-interrupts div.pmc-adm-boomerang-pub-div div");let e="";return t&&(e=t.id),e}()?l.pmc_admanager.show_interrupt_ads():t.getSlots().forEach((function(t){t.removeBlock("gallery"),t.display()}))}.bind(this),this.has_ads=function(e){return!!t.getSlots().find((t=>function(t,e){return Boolean(t&&"object"==typeof t&&"string"==typeof t.subAdUnitPath&&t.subAdUnitPath.includes(e))}(t,e)))}.bind(this),this.direct_sold_ad_event_listener=function(e){const n=c();if(!n.hooks||"string"!=typeof e.data)return;"pmcadm:dfp:isdirect=true"===e.data.substring(0,24)&&(this.is_direct_sold=!0,l.document.documentElement.classList.add("pmcadm-direct-sold"),t.getSlots().forEach((t=>t.setAutoRefreshTime(0))),n.hooks.do_action?.("pmc_adm_dfp_direct_sold",e))}.bind(this),this.blank_ad_event_listener=function(t){if(!a(t))return;let e=l.document.getElementById(t.domId);for(;e&&!e.matches(".adma");)e=e.parentElement;if(e&&e.matches(".adma")){for(e.classList.add("ad-empty");e&&!e.matches('[data-component="ad-unit"]');)e=e.parentElement;e&&e.setAttribute("data-ad-empty",!0)}}.bind(this),this.slot_refresh_event_listener=function(t){if(!a(t))return;let e=l.document.getElementById(t.domId);for(;e&&!e.matches(".adma");)e=e.parentElement;if(e&&e.matches(".ad-empty")){for(e.classList.remove("ad-empty");e&&!e.matches('[data-component="ad-unit"]');)e=e.parentElement;e&&e.matches("[data-ad-empty]")&&e.removeAttribute("data-ad-empty")}}.bind(this)},e().adq.push((function(){m.displayAds.init()}))})();; var gdbbPressTools = { storage: { }, get_selection: function() { var t = ''; if (window.getSelection){ t = window.getSelection(); } else if (document.getSelection){ t = document.getSelection(); } else if (document.selection){ t = document.selection.createRange().text; } return jQuery.trim(t.toString()); }, init: function() { jQuery(document).on("click", ".d4p-bbt-quote-link", function(e){ e.preventDefault(); if (jQuery("#bbp_reply_content").length > 0) { var qout = gdbbPressTools.get_selection(); var id = jQuery(this).attr("href").substr(1); var quote_id = '#d4p-bbp-quote-' + id; if (qout === "") { qout = jQuery(quote_id).html(); } qout = qout.replace(/(\r\n|\n|\r)/gm,"*****"); qout = qout.replace(/ /g, " "); qout = qout.trim(); qout = qout.replace(//, ''); qout = qout.replace(/

    |
    /g, ""); qout = qout.replace(/<\/\s*p>/g, "\n"); qout = qout.replace(/\*\*\*\*\*/g, "\n" ); if (gdbbPressToolsInit.quote_method === "bbcode") { qout = "[quote quote=" + id + "]" + qout + "[/quote]"; } else { var title = '

    '; qout = '
    ' + title + qout + '
    '; } if (gdbbPressToolsInit.wp_editor == 1 && !jQuery("#bbp_reply_content").is(":visible")) { if (gdbbPressToolsInit.wp_version > 38) { tinymce.get("bbp_reply_content").execCommand("mceInsertContent", false, qout); } else { tinyMCE.execInstanceCommand("bbp_reply_content", "mceInsertContent", false, qout); } } else { var txtr = jQuery("#bbp_reply_content"); var cntn = txtr.val(); if (jQuery.trim(cntn) != '') { qout = "\n\n" + qout; } txtr.val(cntn + qout); } var old_ie = jQuery.browser.msie && parseInt(jQuery.browser.version) < 9; if (!old_ie) { jQuery("html, body").animate({scrollTop: jQuery("#new-post").offset().top}, 1000); } else { document.location.href = "#new-post"; } } }); } }; jQuery(document).ready(function() { gdbbPressTools.init(); }); ;