1function switchScoutPicks(competition) { 2 // Hide all scout picks widgets (only those with scout-picks-selector) 3 var containers = document.querySelectorAll(".scout-picks-selector"); 4 for (var i = 0; i < containers.length; i++) { 5 var container = containers[i].closest('.scout-picks-dropdown').parentNode; 6 var allPicks = container.querySelectorAll(".scout-picks[class*='scout-picks-']"); 7 for (var j = 0; j < allPicks.length; j++) { 8 allPicks[j].style.display = "none"; 9 } 10 } 11 12 // Show selected competition 13 var selectedPicks = document.querySelectorAll(".scout-picks-" + competition); 14 for (var i = 0; i < selectedPicks.length; i++) { 15 selectedPicks[i].style.display = "block"; 16 } 17} 18 19function switchScoutPicksWithUrl(competition) { 20 // Update URL parameter 21 var url = new URL(window.location); 22 if (competition && competition !== "fpl") { 23 url.searchParams.set("scout_picks_competition", competition); 24 } else { 25 url.searchParams.delete("scout_picks_competition"); 26 } 27 28 window.history.replaceState({}, "", url); 29 switchScoutPicks(competition); 30} 31 32function initScoutPicks() { 33 // Set default selection if dropdown exists 34 var selector = document.querySelector(".scout-picks-selector"); 35 if (selector) { 36 // Check for URL parameter first 37 var urlParams = new URLSearchParams(window.location.search); 38 var competition = urlParams.get("scout_picks_competition"); 39 40 var selectedCompetition = null; 41 42 if (competition) { 43 // Check if the competition option exists 44 var optionExists = false; 45 for (var i = 0; i < selector.options.length; i++) { 46 if (selector.options[i].value === competition) { 47 optionExists = true; 48 break; 49 } 50 } 51 52 if (optionExists) { 53 selectedCompetition = competition; 54 } 55 } 56 57 // If no valid URL parameter, default to first option 58 if (!selectedCompetition && selector.options.length > 0) { 59 selectedCompetition = selector.options[0].value; 60 } 61 62 // Set the selection and update display 63 if (selectedCompetition) { 64 selector.value = selectedCompetition; 65 switchScoutPicks(selectedCompetition); 66 } 67 } 68} 69 70document.addEventListener("DOMContentLoaded", function () { 71 setTimeout(function () { 72 initScoutPicks(); 73 }, 100); 74}); 75 76window.addEventListener("pageshow", function (event) { 77 // Check if page is being restored from bfcache 78 if (event.persisted) { 79 // Small delay to ensure DOM is ready after bfcache restoration 80 setTimeout(function () { 81 initScoutPicks(); 82 }, 100); 83 } 84});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.