(()=>{"use strict";document.addEventListener("DOMContentLoaded",(()=>{const e=document.querySelector(".closeShare"),t=document.querySelector(".showShareMore"),n=document.querySelector(".btn-print"),o=document.querySelector(".btn-whatsapp"),r=document.querySelector(".share-container .shareMore");e&&e.addEventListener("click",(function(e){e.preventDefault(),r.style.display="none"})),t&&t.addEventListener("click",(function(e){e.preventDefault(),r.style.display="block"})),n&&n.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),window.print()})),o&&o.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),window.location.href="whatsapp://send?text="+encodeURIComponent(window.location.href)}))}))})();; "undefined"!=typeof ga&&{is_mobile:!1,permalink:null,share_list:null,init:function(){this.permalink=window.pmc_share_bar_lob_ga_tracking.permalink,this.is_mobile=window.pmc_share_bar_lob_ga_tracking.is_mobile,this.share_list=window.pmc_share_bar_lob_ga_tracking.share_list,this.bind_ui_click()},bind_ui_click:function(){const e=this;Object.entries(e.share_list).forEach((function([t,n]){const i=document.querySelector("."+n.class);i&&(i.addEventListener("click",(function(o){if("1"===e.is_mobile)e.track_social_click(t,"click",e.permalink);else if(!1===n.popup)e.track_social_click(t,"click",e.permalink);else{o.preventDefault();const r={height:570,width:530,left:"50%",top:"28%",location:1,resizable:0,menubar:0,toolbar:0,personalbar:0,status:0},l={source_el:i,title:n.popup_title};if(e.open_popup(l,r))return e.track_social_click(t,"click",e.permalink),!1}})),i.addEventListener("mouseover",(function(){return e.track_social_mouseover(t),!1}),{once:!0}))}))},track_social_click:function(e,t,n){"undefined"!=typeof gtag&>ag("event",String(e+"-"+t).substring(0,39),{eventCategory:String(e).substring(0,99),eventAction:t,eventLabel:String(n).substring(0,99)});const i=pmc.hooks.apply_filters("pmc_event_tracking_social_data",null,e);null!==i&&"undefined"!=typeof gtag&>ag("event",String(i.eventCategory+"-"+i.eventAction).substring(0,39),{eventCategory:String(i.eventCategory).substring(0,99),eventAction:String(i.eventAction).substring(0,99),eventLabel:String(i.eventLabel).substring(0,99),eventValue:String(i.eventValue).substring(0,99),nonInteraction:String(i.nonInteraction).substring(0,99)})},track_social_mouseover:function(e){"undefined"!=typeof gtag&>ag("event","social_bar-mouse-over",{eventAction:"mouse-over",eventCategory:"social_bar",eventLabel:e,eventValue:1})},open_popup:function(e,t){let n,i,o,r=[],l=!1,a=!1;const s=["menubar","toolbar","location","personalbar","status","resizable","scrollbars","dependent","dialog","minimizable"];for(e=Object.assign({source_el:!1,url:!1,title:"Window",reuse:!0},e),t=Object.assign({left:"50%",top:"25%",height:300,width:500,menubar:0,toolbar:0,location:1,personalbar:0,status:0,resizable:1,scrollbars:1,dependent:0,dialog:0,minimizable:0},t),e.source_el&&(l=document.querySelector(e.source_el),l||(l=!1)),t.left.toString().indexOf("%")&&(i=window.screenLeft||window.screenX,t.left=t.left.replace("%","")/100,t.left=Math.round(i+window.innerWidth*t.left-t.width/2)),r.push("left="+t.left),t.top.toString().indexOf("%")&&(o=window.screenTop||window.screenY,t.top=Math.round(o+window.innerHeight*t.top.replace("%","")/100)),r.push("top="+t.top),r.push("width="+t.width),r.push("height="+t.height),n=0;nm.options.maxWidth){if(!h()||!M){p();H.trigger("preUnfixed.ScrollToFixed");l();H.trigger("unfixed.ScrollToFixed")}}else{if(m.options.bottom==-1){if(K>0&&N>=K-t()){if(!L&&(!y()||!M)){p();H.trigger("preAbsolute.ScrollToFixed");b();H.trigger("unfixed.ScrollToFixed")}}else{if(N>=E-t()){if(!q()||!M){p();H.trigger("preFixed.ScrollToFixed");x();f=-1;H.trigger("fixed.ScrollToFixed")}w(J)}else{if(!h()||!M){p();H.trigger("preUnfixed.ScrollToFixed");l();H.trigger("unfixed.ScrollToFixed")}}}}else{if(K>0){if(N+a(window).height()-H.outerHeight(true)>=K-(t()||-n())){if(q()){p();H.trigger("preUnfixed.ScrollToFixed");if(F==="absolute"){b()}else{l()}H.trigger("unfixed.ScrollToFixed")}}else{if(!q()){p();H.trigger("preFixed.ScrollToFixed");x()}w(J);H.trigger("fixed.ScrollToFixed")}}else{w(J)}}}}}function n(){if(!m.options.bottom){return 0}return m.options.bottom}function p(){var J=H.css("position");if(J=="absolute"){H.trigger("postAbsolute.ScrollToFixed")}else{if(J=="fixed"){H.trigger("postFixed.ScrollToFixed")}else{H.trigger("postUnfixed.ScrollToFixed")}}}var D=function(J){if(H.is(":visible")){c=false;B()}else{l()}};var G=function(J){(!!window.requestAnimationFrame)?requestAnimationFrame(B):B()};var C=function(){var K=document.body;if(document.createElement&&K&&K.appendChild&&K.removeChild){var M=document.createElement("div");if(!M.getBoundingClientRect){return null}M.innerHTML="x";M.style.cssText="position:fixed;top:100px;";K.appendChild(M);var N=K.style.height,O=K.scrollTop;K.style.height="3000px";K.scrollTop=500;var J=M.getBoundingClientRect().top;K.style.height=N;var L=(J===100);K.removeChild(M);K.scrollTop=O;return L}return null};var s=function(J){J=J||window.event;if(J.preventDefault){J.preventDefault()}J.returnValue=false};m.init=function(){m.options=a.extend({},a.ScrollToFixed.defaultOptions,i);z=H.css("z-index");m.$el.css("z-index",m.options.zIndex);u=a("
");I=H.css("position");F=H.css("position");k=H.css("float");e=H.css("top");if(h()){m.$el.after(u)}a(window).bind("resize.ScrollToFixed",D);a(window).bind("scroll.ScrollToFixed",G);if("ontouchmove" in window){a(window).bind("touchmove.ScrollToFixed",B)}if(m.options.preFixed){H.bind("preFixed.ScrollToFixed",m.options.preFixed)}if(m.options.postFixed){H.bind("postFixed.ScrollToFixed",m.options.postFixed)}if(m.options.preUnfixed){H.bind("preUnfixed.ScrollToFixed",m.options.preUnfixed)}if(m.options.postUnfixed){H.bind("postUnfixed.ScrollToFixed",m.options.postUnfixed)}if(m.options.preAbsolute){H.bind("preAbsolute.ScrollToFixed",m.options.preAbsolute)}if(m.options.postAbsolute){H.bind("postAbsolute.ScrollToFixed",m.options.postAbsolute)}if(m.options.fixed){H.bind("fixed.ScrollToFixed",m.options.fixed)}if(m.options.unfixed){H.bind("unfixed.ScrollToFixed",m.options.unfixed)}if(m.options.spacerClass){u.addClass(m.options.spacerClass)}H.bind("resize.ScrollToFixed",function(){u.height(H.height())});H.bind("scroll.ScrollToFixed",function(){H.trigger("preUnfixed.ScrollToFixed");l();H.trigger("unfixed.ScrollToFixed");B()});H.bind("detach.ScrollToFixed",function(J){s(J);H.trigger("preUnfixed.ScrollToFixed");l();H.trigger("unfixed.ScrollToFixed");a(window).unbind("resize.ScrollToFixed",D);a(window).unbind("scroll.ScrollToFixed",G);H.unbind(".ScrollToFixed");u.remove();m.$el.removeData("ScrollToFixed")});D()};m.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000,baseClassName:"scroll-to-fixed-fixed"};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery);; jQuery(document).ready(function(i){({$sticky:i(".pmc-sticky-sidebar"),$footer:i("footer"),$top_bar:i("#wpadminbar"),update_sticky_sidebar_position:{},init:function(){var t=this;"undefined"!=typeof pmc_sticky_sidebar_js&&"footer_selector"in pmc_sticky_sidebar_js&&(t.$footer=i(pmc_sticky_sidebar_js.footer_selector)),"undefined"!=typeof pmc_sticky_sidebar_js&&"top_bar_selector"in pmc_sticky_sidebar_js&&(t.$top_bar=i(pmc_sticky_sidebar_js.top_bar_selector)),this.update_sticky_sidebar_position=_.debounce(function(){t.start_scroll()},300),i(window).on("scroll",t.update_sticky_sidebar_position)},reset_scroll:function(){this.$sticky.trigger("resetScroll"),this.$sticky.trigger("detach.ScrollToFixed"),this.$sticky.attr("style","")},start_scroll:function(){var t=this;t.reset_scroll(),t.$sticky.scrollToFixed({marginTop:function(){return(t.$top_bar.outerHeight()||0)+10},removeOffsets:!0,limit:function(){return t.$footer.offset().top-t.$sticky.outerHeight(!0)-10},fixed:function(){i(window).off("scroll",t.update_sticky_sidebar_position)},postAbsolute:function(){t.$sticky.attr("style","")},unfixed:function(){t.$sticky.hasClass("scroll-to-fixed-fixed")&&(t.$sticky.parent().attr("style","position: relative;"),t.$sticky.attr("style","position: absolute; z-index:unset; top: unset; bottom: 5px;"))}})}}).init()}); ; ; (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/v1/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) { $( '.best-predix-scores-widget #best-predix-loading-image' ).css("display", 'none'); } } ); }, ); $( '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/v1/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/v1/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) { $( '.best-predix-scores-widget #best-predix-loading-image2' ).css("display", 'none'); } } ); } ); } ); 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); ; (function($) { $( document ).ready( function () { $( 'body' ).on( 'click', '.select-items', function() { var cur_div = $(this); var category_id = $(this).prev('.select-selected').attr('data'); var league_id = document.getElementById( 'league_id' ).value; var user_type = $( '.user-type-box.active' ).find('div').text().toLowerCase(); user_type = user_type.substring( 0, user_type.length - 1 ); /***** Loading image starts here ******/ var $pw_custom_select_div = cur_div.closest('.pw-container'); var $pw_data_container = $pw_custom_select_div.find('.pw-data-container'); $pw_data_container.html(''); var $loading_img_div = $( '
' ).attr( 'class', 'loading' ); $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 ); $pw_data_container.append( $loading_img_div ); /***** Loading image ends here ******/ url = '/wp-json/gdwidget-api/v1/app/predictions-data/' + league_id + '/' + category_id + '/' + user_type + '/', $.ajax( { method: "GET", url: url, success: function (response) { success_callback( response, cur_div ); }, fail: function (response) { }, error: function (response) { } } ); }, ); $( 'body' ).on( 'click', '.user-type-box', function() { var cur_div = $(this); $(".user-type-box").attr('class', 'user-type-box'); $( this ).addClass('active'); var league_id = document.getElementById( 'league_id' ).value; var user_type = $( this ).find('div').text().toLowerCase(); user_type = user_type.substring( 0, user_type.length - 1 ); var pw_container = $(this).closest('.pw-container'); var pw_custom_select = pw_container.find('.pw-custom-select'); var category_id = pw_custom_select.find('.select-selected').attr('data'); var $pw_data_container = pw_container.find('.pw-data-container'); $pw_data_container.html(''); var $loading_img_div = $( '
' ).attr( 'class', 'loading' ); $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 ); $pw_data_container.append( $loading_img_div ); url = '/wp-json/gdwidget-api/v1/app/predictions-data/' + league_id + '/' + category_id + '/' + user_type + '/', $.ajax( { method: "GET", url: url, success: function (response) { success_callback( response, cur_div ); }, fail: function (response) { }, error: function (response) { } } ); }, ); } ); function success_callback( response, cur_this ){ var $pw_custom_select_div = cur_this.closest('.pw-container'); var $pw_data_container = $pw_custom_select_div.find('.pw-data-container'); $pw_data_container.html(''); $.each( response.predictions, function (i, prediction) { if ( i > 2 ) { return; } var user_data_container = $( '
' ).attr( 'class', 'user-data-container' ); /***** user info container starts here ******/ var user_info_container = $( '
' ).attr( 'class', 'user-info-container' ); var user_img_div = $( '
' ).attr( 'class', 'user-img-div' ); var img_src = $( '' ).attr( 'src', response.users_img[ prediction.user_id ] ); user_img_div.append( img_src ); user_info_container.append( user_img_div ); user_data_container.append( user_info_container ); var user_info = $( '
' ).attr( 'class', 'user-info' ); var user_name = $( '
' ).attr( 'class', 'user-name' ); user_name.text( prediction[ 'display_name' ] ); user_info.append( user_name ); var user_publication = $( '
' ).attr( 'class', 'user-publication' ); user_publication.text( response.publications[ prediction.user_id ] ); user_info.append( user_publication ); user_info_container.append( user_info ); user_data_container.append( user_info_container ); // user_data_container.append( user_info_container ); /***** user info container ends here ******/ for (var x = 1; x < 4; x++) { // $prediction[ 'pos' . $i . '_post_id' ] if ( prediction['pos' + x + '_post_id'] ) { // alert(prediction['pos' + i + '_post_id']); /***** nominee data container starts here ******/ var nominee_data_container = $( '
' ).attr( 'class', 'nominee-data-container' ); var nominee_data_sno = $( '
' ).attr( 'class', 'nominee-data-sno' ); nominee_data_sno.text( x + '.' ); nominee_data_container.append( nominee_data_sno ); var nominee_data_img = $( '
' ).attr( 'class', 'nominee-data-img' ); var img_src = $( '' ).attr( 'src', response.nominee_thumbnail[ prediction['pos' + x + '_post_id'] ] ); nominee_data_img.append( img_src ); nominee_data_container.append( nominee_data_img ); var nominee_data = $( '
' ).attr( 'class', 'nominee-data' ); var nominee_name = $( '
' ).attr( 'class', 'nominee-name' ); nominee_name.text( response.nominees[ prediction['pos' + x + '_post_id'] ] ); nominee_data.append( nominee_name ); var nominee_movie = $( '
' ).attr( 'class', 'nominee-movie' ); nominee_movie.text(''); nominee_data.append( nominee_movie ); nominee_data_container.append( nominee_data ); user_data_container.append( nominee_data_container ); /***** user data container ends here ******/ } } $pw_data_container.append( user_data_container ); } ); $see_more_div = $pw_custom_select_div.find('.more-predictions'); $see_more_div.children().attr( 'href', response.see_more_link_url ); return; } })(jQuery); var x, i, j, l, ll, selElmnt, a, b, c; /*look for any elements with the class "custom-select":*/ x = document.getElementsByClassName("pw-custom-select"); l = x.length; for (i = 0; i < l; i++) { selElmnt = x[i].getElementsByTagName("select")[0]; ll = selElmnt.length; /*for each element, create a new DIV that will act as the selected item:*/ a = document.createElement("DIV"); a.setAttribute("class", "select-selected"); a.setAttribute("data", selElmnt.value); a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML; x[i].appendChild(a); /*for each element, create a new DIV that will contain the option list:*/ b = document.createElement("DIV"); b.setAttribute("class", "select-items select-hide"); for (j = 1; j < ll; j++) { /*for each option in the original select element, create a new DIV that will act as an option item:*/ c = document.createElement("DIV"); c.innerHTML = selElmnt.options[j].innerHTML; c.addEventListener("click", function(e) { /*when an item is clicked, update the original select box, and the selected item:*/ var y, i, k, s, h, sl, yl; s = this.parentNode.parentNode.getElementsByTagName("select")[0]; sl = s.length; h = this.parentNode.previousSibling; for (i = 0; i < sl; i++) { if (s.options[i].innerHTML == this.innerHTML) { s.selectedIndex = i; h.innerHTML = this.innerHTML; a.setAttribute("data", s.options[i].value); y = this.parentNode.getElementsByClassName("same-as-selected"); yl = y.length; for (k = 0; k < yl; k++) { y[k].removeAttribute("class"); } this.setAttribute("class", "same-as-selected"); break; } } h.click(); }); b.appendChild(c); } x[i].appendChild(b); a.addEventListener("click", function(e) { /*when the select box is clicked, close any other select boxes, and open/close the current select box:*/ e.stopPropagation(); closeAllSelect(this); this.nextSibling.classList.toggle("select-hide"); this.classList.toggle("select-arrow-active"); }); } function closeAllSelect(elmnt) { /*a function that will close all select boxes in the document, except the current select box:*/ var x, y, i, xl, yl, arrNo = []; x = document.getElementsByClassName("select-items"); y = document.getElementsByClassName("select-selected"); xl = x.length; yl = y.length; for (i = 0; i < yl; i++) { if (elmnt == y[i]) { arrNo.push(i) } else { y[i].classList.remove("select-arrow-active"); } } for (i = 0; i < xl; i++) { if (arrNo.indexOf(i)) { x[i].classList.add("select-hide"); } } } /*if the user clicks anywhere outside the select box, then close all select boxes:*/ document.addEventListener("click", closeAllSelect); ; (function($) { $( document ).ready( function () { // Return if the widget does not exist on page. if ( 0 === $( '#gd-poll-widget' ).length ) { return; } // View Results. $("#gd-poll-widget .view-results").click(function(e){ e.stopPropagation(); $( '.' + $(this).data('class') + " .vote").hide(); $( '.' + $(this).data('class') + " .results").show(0); }) // Return to Poll. $("#gd-poll-widget .return-to-poll").click(function(e){ e.stopPropagation(); $( '.' + $(this).data('class') + " .vote").show(); $( '.' + $(this).data('class') + " .results").hide(); }) $("#gd-poll-widget .vote-button").click(function(e){ e.stopPropagation(); let vote_button = $(this); let widget_class = vote_button.data('class'); let login_state = vote_button.data('state'); let data = $( '.' + widget_class ).data('data'); let spinner = $( '.' + widget_class + ' .spinner'); let show_vote_count = $( '.' + widget_class ).data('vote-count'); let choices = parseInt( $( '.' + widget_class ).data('choices') ); let selected_options = 0; if ( 1 === choices ) { // User can select only one choice using a radio button. selected_options = $( '.' + widget_class + " input[name='option-" + widget_class + "']:checked").val(); } else { // User can select multiple checkbox options. selected_options = $('.' + widget_class + " input[type='checkbox']:checked").map(function() { return $(this).data('id'); }).get(); if ( selected_options.length > choices ) { alert( 'Only ' + choices + ' choices are allowed!' ); return; } } if ( 'login' === login_state ) { $( '.' + widget_class + " .login-button-area").show(200); return; } // if user has not selected anything and trying to submit. if ( 'undefined' === typeof selected_options || ! selected_options.length ) { return; } vote_button.attr('disabled', true); vote_button.css('color', '#aaa'); spinner.show().css('display', 'block'); $.ajax( { method: "POST", url: '/wp-json/gameplay/v1/gd-polls/submit/', data: { data: data, selected_option: selected_options, }, success: function (response) { // Show Results page. $( '.' + widget_class + " .vote").hide(200); $( '.' + widget_class + " .results").show(200); // Show thanks message $( '.' + widget_class + " .message").show(); // Remove class 'selected-option' from all options in the widget. $( '.' + widget_class + " label").removeClass('selected-option'); // Add class 'selected-option' for the selected options. if ( 1 === choices ) { selected_options = $( '.' + widget_class + " input[name='option-" + widget_class + "']:checked").parent().addClass('selected-option'); } else { selected_options = $('.' + widget_class + " input[type='checkbox']:checked").parent().addClass('selected-option'); } spinner.hide(); vote_button.attr('disabled', false); vote_button.css('color', '#000'); if( 'success' == response.message ) { $( '.' + widget_class + " .bar-container").remove(); $.each(response.data, function(index, row) { let percentage = row[3] + '% '; if ( show_vote_count ) { percentage += '(' + row[2] + ' votes)'; } let HTML = `
`+row[1]+`
`+ percentage + `
` $( '.' + widget_class + " .return-to-poll").before(HTML); }); } }, fail: function (response) { spinner.hide(); } }); // $.ajax }); } ); })(jQuery); ; (()=>{"use strict";const t=window;t.blogherads=t.blogherads||{adq:[]};const e=()=>t.blogherads,n=()=>"function"==typeof e().reloadAds,d=t=>Boolean(t?.domId?.length);function s(t,...e){console.debug.bind(null,t)(...e)}const o=(()=>{let t=1;return{send:function(e,n,d){const s={type:"SKMBoomerangMessageRequest",requestId:t++,data:d,method:n};e.postMessage(s,"*")}}})(),a=window,i=a.document;class l{constructor(t){t.forEach((t=>this.push(t)))}push(t){try{t.call(null)}catch(t){}}attachConnatix(t){if(i.documentElement.classList.contains("floatingplayer-nofloat"))t.disableFloatingMode();else{a.addEventListener("message",(({data:e})=>{"pmcadm:floatingplayer=nofloat"===e&&t.disableFloatingMode()}),!1);const n=e();n.adq.push((()=>{n.trackVideoPlayerFloatingState&&n.trackVideoPlayerFloatingState(t)}))}}sendAtlasMessage(t,e){o.send(a,t,e)}}const r=window;if(r.pmc=r.pmc||{adm:[]},r.pmc.adm=r.pmc.adm||[],Array.isArray(r.pmc.adm)){const t=r.pmc.adm;r.pmc.adm=new l(t)}const c=()=>r.pmc,m=window,h=c();h.displayAds=new function(){const t=e();this.init=function(){this.bind_events(),this.handle_delay_loading()}.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),m.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||!n())return;const d=[];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 n=t.getSlotById(e);n&&d.push(n)})),d&&d.length&&t.reloadAds(d)}.bind(this),this.rotate_ads_for_gallery=function(){if(!n())return;const e=m.pmc_meta;"mobile"===e?.env?t.reloadAds(t.getSlots()):t.reloadAds()}.bind(this),this.handle_delay_loading=function(){if(!n())return;if(void 0===window?.pmc_adm_display_ads?.delay_loading)return;const e=window.pmc_adm_display_ads.delay_loading;Object.keys(e).forEach((n=>{const d=e[n],o=[];void 0!==d.time&&d.time>0&&o.push(new Promise((t=>{s(`Delay loading set time: ${d.time}`,n),setTimeout((()=>{t("time")}),1e3*d.time)}))),void 0!==d.scroll_depth&&d.scroll_depth>0&&o.push(new Promise((t=>{function e(){const a=window.innerHeight,i=d.scroll_depth*a;window.scrollY>i&&(s("Delay loading add scroll depth hit",n),"onscrollend"in window?window.removeEventListener("scrollend",e):window.removeEventListener("scroll",o),t("scroll_depth"))}const o=function(t){let e;return(...n)=>{clearTimeout(e),e=setTimeout((()=>{t.apply(this,n)}),100)}}(e);s(`Delay loading add scroll depth listener: ${d.time}`,n),"onscrollend"in window?window.addEventListener("scrollend",e):window.addEventListener("scroll",o)}))),o.length>0&&Promise.race(o).then((e=>{s(`Delay loading winner: ${e}`,n),t.getSlotById(n).removeBlock("pmc-adm-v2-delay-loading")}))}))}.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}()?m.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,m.document.documentElement.classList.add("pmcadm-direct-sold"),t.getSlots().forEach((t=>t.setAutoRefreshTime(0))),n.hooks.do_action?.("pmc_adm_dfp_direct_sold",e));"pmcadm:dfp:isFullySponsored=true"===e.data.substring(0,32)&&(this.is_fully_sponsored=!0,m.document.documentElement.classList.add("pmcadm-fully-sponsored"),n.hooks.do_action?.("pmc_adm_dfp_fully_sponsored",e))}.bind(this),this.blank_ad_event_listener=function(t){if(!d(t))return;let e=m.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(!d(t))return;let e=m.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(){h.displayAds.init()}))})();; (()=>{"use strict";class t{constructor(t){this.el=t,this.eleHeight=this.el.offsetHeight,this.stickyOffset=this.el.offsetTop-this.eleHeight,this.stickyClass="is-cover-sticky",this.toggleSticky=this.toggleSticky.bind(this),this.toggleSticky(),window.addEventListener("scroll",this.toggleSticky)}toggleSticky(){if(window.scrollY>=this.stickyOffset){let t=0;const e=".header .js-Header-contents .header-sticky";[document.querySelector(e),document.getElementById("wpadminbar")].forEach((e=>{e&&(t+=e.offsetHeight)})),document.body.style.paddingTop=this.eleHeight+"px",this.el.style.top=t+"px",document.body.classList.add(this.stickyClass)}else this.el.style.top="0px",document.body.classList.remove(this.stickyClass),document.body.style.paddingTop="0px"}}window.addEventListener("load",(()=>{!function(){const e=document.querySelectorAll(".single-pmc-hubs-pro .header-cover-sticky");if(e.length>0)new t(e[0])}()}))})();;