document.addEventListener("DOMContentLoaded", function() { const CACHE_KEY = 'geo_state_cache'; const CACHE_DURATION = 24 * 60 * 60 * 1000; // 24 hours (1 day) const allowedStates = ["CO","IA","IL","IN","KS","MI","MN","MO","ND","NE","NY","OH","PA","SD","WI"]; const stateMap = { 'Colorado': 'CO', 'Iowa': 'IA', 'Illinois': 'IL', 'Indiana': 'IN', 'Kansas': 'KS', 'Michigan': 'MI', 'Minnesota': 'MN', 'Missouri': 'MO', 'North Dakota': 'ND', 'Nebraska': 'NE', 'New York': 'NY', 'Ohio': 'OH', 'Pennsylvania': 'PA', 'South Dakota': 'SD', 'Wisconsin': 'WI' }; const SHEETS_WEBHOOK_URL = 'https://script.google.com/macros/s/AKfycby7po461m4RiHNPH62Ea4MaG5guQ5MKEYpWhTRpfMlOaXH62pLzgAOLdFcl38auGqCO1w/exec'; function getCachedState() { const cache = localStorage.getItem(CACHE_KEY); if (!cache) return null; try { const parsed = JSON.parse(cache); if (Date.now() - parsed.timestamp > CACHE_DURATION) { localStorage.removeItem(CACHE_KEY); return null; } return parsed.stateCode; } catch (e) { localStorage.removeItem(CACHE_KEY); return null; } } function setCachedState(stateCode) { localStorage.setItem(CACHE_KEY, JSON.stringify({ stateCode, timestamp: Date.now() })); } function logStateToServer(stateCode) { fetch(SHEETS_WEBHOOK_URL, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ state: stateCode }) }).catch(() => {}); } function showAdIfAllowed(stateCode, adDivId, adHtml) { const banner = document.getElementById(adDivId); if (!banner) return; if (allowedStates.includes(stateCode)) { banner.innerHTML = adHtml; } else { banner.innerHTML = ''; } } // Ad HTML for each size/location (with your real placement codes) const adHtml728x90 = ` `; const adHtml300x600 = ` `; const adHtml300x250 = ` `; function updateAllAds(stateCode) { showAdIfAllowed(stateCode, "banner-ad-728x90", adHtml728x90); showAdIfAllowed(stateCode, "banner-ad-300x600", adHtml300x600); showAdIfAllowed(stateCode, "banner-ad-300x250", adHtml300x250); } // Main logic const cachedState = getCachedState(); if (cachedState) { updateAllAds(cachedState); } else if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { const lat = position.coords.latitude; const lon = position.coords.longitude; fetch(`https://api.openweathermap.org/geo/1.0/reverse?lat=${lat}&lon=${lon}&limit=1&appid=d6bd072896114a3cfdebcbe098657019`) .then(res => res.json()) .then(data => { if (data && data.length > 0 && data[0].state) { const abbr = stateMap[data[0].state] || ''; setCachedState(abbr); logStateToServer(abbr); updateAllAds(abbr); } else { updateAllAds(""); } }) .catch(() => { updateAllAds(""); }); }, function() { updateAllAds(""); }); } else { updateAllAds(""); } });

Wednesday, August 6th, 2025 Podcast

8625-mt-new-youtube-thumbnail-1

It was another mixed to lower day on Wednesday in the grain and oilseed complex as the trade continues to seemingly focus on big U.S. supplies more than anything. We dive into the charts, balance sheets and more for wheat and corn along with a look at cattle and energy on today’s show with Mike Zuzolo from Global Commodity Analytics. More at https://www.globalcommresearch.com.

Recommended Posts

Loading...