Traditional Muay Thai purists are losing their minds watching Aliff Sor Dechapan incorporate boxing head movement into elite-level fights. While everyone’s been taught that slipping punches gets you kneed unconscious, this 62-fight veteran from Malaysia is making it work against world-class competition. His journey from limited resources forced creative training methods that traditional Thai camps never developed. The technical reality: he’s not abandoning Muay Thai fundamentals, he’s adding boxing footwork and subtle angles that create offensive opportunities while minimizing traditional risks. His victory over Ramadan Ondash showcased systematic destruction through head movement-based distance management. But here’s the question — does this survive against Prajanchai’s 400+ fight experience, or does it become a cautionary tale? Within three years, we’ll know if Muay Thai’s DNA is ready to accept this new code.
How Aliff Sor Dechapan Is Rewriting Muay Thai's DNA
Support the Ringside Report Network

Traditional Muay Thai purists are losing their minds right now, and I get it. Aliff Sor Dechapan is out here moving his head like he’s training at Mayweather’s gym, and it’s working. The 62-fight veteran from Malaysia is making elite Thai fighters miss while everyone’s been told for decades that head movement gets you elbowed into next week. So what’s actually happening here — evolution or suicide mission?

Here’s the reality: This isn’t just another fighter with unorthodox technique. Aliff’s journey from Thailand’s struggling regional circuits to ONE Championship stardom makes his head movement revolution even more remarkable. While traditional camps drilled the same fundamentals that had worked for generations, this kid was figuring out how to blend boxing footwork with Muay Thai fundamentals because he had to stand out somehow.

Why Traditional Muay Thai Hates Head Movement

Muay Thai developed in a specific context. You stand tall, you check kicks, you counter with knees and elbows when someone gets close. Head movement? That’s how you eat a knee or get caught with an elbow you never saw coming. The orthodox stance exists for legitimate tactical reasons — it’s not just stubborn tradition.

Support the Ringside Report Network
Support the Ringside Report Network
Rash Guards

But Aliff’s doing something different. He’s not just ducking wild haymakers. He’s incorporating subtle shifts and angles that create offensive opportunities while minimizing the traditional risks. That’s the thing — he’s not abandoning Muay Thai fundamentals; he’s adding a layer that most fighters haven’t yet developed a counter for.

What makes this even more interesting is where Aliff came from. This isn’t some privileged fighter who trained at elite camps his entire career. His father-son partnership in the gym meant adapting and innovating when they couldn’t afford the same resources as traditional Thai powerhouses. Limited equipment and financial constraints forced creative training methods — including that head movement that’s now disrupting the entire sport.

Support the Ringside Report Network

Up to 40% Off Great Gifts

Thai-Malaysian Phenom Aliff Is A MUST-SEE Fighter

The Technical Reality Nobody’s Discussing

What separates Aliff from previous fighters who tried this? Timing and distance management. He’s not slipping punches in the pocket where elbows live. He’s using head movement at range to create angles for his boxing combinations, then returning to traditional Muay Thai posture when the clinch or knee range opens up. It’s tactical code-switching, and most fighters can’t process it fast enough.

Against Ramadan Ondash, Aliff showcased this perfectly:

  • Distance management – Used long teeps to prevent Ondash from initiating brawls
  • Timing precision – Landed clean counters when Ondash overcommitted
  • Body work focus – Targeted kicks to drain Ondash’s explosive power
  • Finishing instinct – Delivered a spectacular flying knee when the opening appeared

The boxing-influenced footwork is the real story here. You can’t have effective head movement without your feet in position to move your whole body. Aliff is generating power from positions that traditional Muay Thai fighters don’t train to defend because those positions theoretically shouldn’t exist in this sport.

His 30-27 unanimous decision victory wasn’t just about winning rounds — it was a systematic dismantling that exposed how unprepared elite-level fighters are for this hybrid approach. The flying knee knockout of Ondash became the highlight, but the head movement that set up that opportunity is what really matters long-term.

From Humble Beginnings to Technical Revolution

Behind every champion’s polished technique lies a foundation built through adversity, and Aliff’s path to title contention wasn’t paved with privilege or easy opportunities. We’ve witnessed countless fighters emerge from difficult circumstances, but Aliff’s journey exemplifies how family support and personal drive can transform hardship into fuel for greatness.

ChallengeImpactResponse
Limited training resourcesDelayed skill developmentMaximized available opportunities
Financial constraintsRestricted competition accessFocused on local dominance
Equipment shortagesTechnical limitationsCreative training methods
Travel restrictionsFewer elite opponentsIntensified preparation
Sponsorship gapsCareer uncertaintyUnwavering commitment
That "creative training methods" row? That's where the head movement came from. When you can't afford to train at the best camps in Thailand, you experiment. When you're trying to make a name for yourself in Malaysian stadiums before breaking through internationally, you need something that makes you different.

Come on, we all know the script. Regional fighter grinds away, gets noticed, signs with ONE Championship, gets exposed by elite competition. Except that Aliff didn’t follow the script. His SEA Games gold medal and systematic rise through local competition built a foundation. Still, the head movement — that’s what separated him from every other talented regional fighter trying to break through.

Let’s Be Honest About the Risks

This isn’t some revolutionary technique that everyone should copy tomorrow. Aliff’s success depends on specific factors that most fighters can’t replicate. First, he’s fighting opponents who haven’t spent their entire camps preparing for this style. The element of surprise is massive here.

Second, and this is crucial — one well-timed knee or elbow ends this experiment permanently. We’ve seen it before in different forms. Remember when everyone thought Muay Thai fighters couldn’t handle wrestling-heavy MMA styles? Then the sport adapted. The same thing happens here if Aliff faces someone who’s specifically trained to counter this approach.

The Injury Factor Nobody Wants to Mention

Head movement requires neck strength and conditioning that traditional Muay Thai training doesn’t emphasize. You’re asking different muscles to fire in different sequences. What happens when Aliff’s 50 fights deep into his 62-fight career, and that neck isn’t what it used to be? Boxing has the same problem — guys who rely heavily on head movement often see that skill deteriorate faster than other aspects of their game.

Aliff’s young now, his reflexes are sharp, his neck is strong. But that flying knee against Ondash? The head movement that set it up required split-second timing that might not be there at age 35 after another 50 professional fights.

Why This Might Actually Stick

Here’s my bold prediction: Within three years, you’ll see dedicated head movement training incorporated into elite Muay Thai camps, but not the way you think. It won’t replace traditional defense — it’ll become a specialized tool for specific range and timing situations.

The sport’s already evolving, whether purists like it or not. The influence of MMA, the cross-training with boxing, the financial incentives to develop unique styles that draw attention — these forces push innovation. Aliff’s success accelerates what was already happening slowly.

Think about his journey from Malaysian regional circuits to challenging for Prajanchai’s world title. That path required standing out. Traditional Muay Thai excellence wasn’t enough — everyone at the elite level has that. The head movement became his signature, his brand, his path to a title shot.

The Economic Reality Driving Change

What do you expect when the money’s standing out? Traditional Muay Thai produces incredible fighters, but the global audience responds to innovation. Aliff’s style generates highlights that translate across combat sports. That spectacular flying knee knockout? That’s the finish, but the head movement that made Ondash overcommit is what creates those moments.

Promotions want fighters who create moments. Head movement that makes elite strikers miss badly creates moments. It’s that simple. The financial incentive structure now rewards this kind of stylistic risk-taking in ways it didn’t twenty years ago.

Aliff’s father understood this. When you’re training your son in a gym without the resources of Thai powerhouses, you’re looking for edges. The head movement wasn’t just tactical innovation — it was market differentiation that turned a regional contender into an international title challenger.

Where This Could Go Completely Wrong

Brother, I could be totally off here. Aliff faces Prajanchai for the world title, and we watch him get kneed unconscious trying to slip a jab from a 400+ fight veteran who’s seen everything twice. That would instantly end this conversation and validate every traditional coach who’s been screaming about this.

Or maybe the real issue is durability. Aliff’s young now, his reflexes are sharp, his neck is strong. Check back in five years of brutal championship-level fights. Can this style sustain over a complete career, or does it have a shelf life that traditional Muay Thai defense doesn’t?

The Adaptation Problem

The other scenario: Thai fighters adapt faster than expected. Someone figures out the timing, develops specific counters, and suddenly Aliff’s signature advantage disappears. Combat sports history is full of revolutionary techniques that worked brilliantly until everyone learned the counter.

That’s the thing about Prajanchai — 400+ fights means he’s seen everything. The head movement might surprise him for a round, maybe two. But betting against that level of experience, adapting mid-fight? That’s a dangerous game.

The Title Shot That Tests Everything

If you’ve followed our coverage at Ringside Report, you know we don’t do safe predictions. Here’s what I think happens: Aliff’s head movement gives Prajanchai problems early. The champions have never faced this exact style combination, and rounds one and two could be competitive. But championship experience and that insane 400+ fight resume mean Prajanchai finds the timing by round three.

Aliff wants this fight in Kuala Lumpur, intends to bring ONE Championship back to Malaysia, and wants to win for his gym and father. That emotional investment matters. The home crowd advantage matters. But that head movement — the very thing that got him this title shot — gets tested against the most experienced Muay Thai fighter on the planet.

If Aliff wins, we’re watching the beginning of a genuine evolution in Muay Thai. Fighters worldwide are starting to incorporate head movement into traditional camps. The sport changes fundamentally.

If he gets stopped, everyone goes back to traditional methods, and Aliff becomes a cautionary tale about abandoning proven techniques. The head movement experiment gets filed away as “interesting but ultimately flawed.”

What Happens Next

But here’s the complicated part — even if Aliff eventually gets caught and this specific approach doesn’t become standard, he’s already proven that the theoretical limitations of head movement in Muay Thai aren’t as absolute as everyone claimed. That opens doors for other fighters to experiment with their own variations.

Young fighters across Malaysia and Southeast Asia now have a blueprint. Technical excellence combined with innovation can compete against traditional Thai dominance. Aliff’s 62-victory career demonstrates that regional fighters can develop unique styles and challenge for world titles.

When he declares his intention to win for his gym and father, he’s not just talking about family pride. He’s representing every fighter who came from limited resources and had to innovate to compete. The head movement isn’t just technique — it’s proof that the traditional path isn’t the only path.

The DNA of Muay Thai isn’t changing overnight. But it’s definitely introducing some new genetic material into the pool. Whether that mutation survives or gets selected out? That’s what makes this fascinating to watch unfold.

The sport’s at an inflection point, and Aliff’s either ahead of the curve or about to learn why that curve exists in the first place. Within two years, we’ll have our answer. Either camps worldwide are teaching head-movement fundamentals, or we’re showing the flying-knee knockout as a cautionary tale about getting too clever for your own good.

That’s the thing about evolution in combat sports — you never really know if something’s revolutionary until someone gets hit in the face with it enough times. We’re in the early rounds of that process right now, and Aliff Sor Dechapan is the test case for whether Muay Thai’s DNA is ready to accept this new code.

Come on, how can you not be excited to see what happens next?

Ringside Report Network’s Combat Sports Gym Finder .gym-finder * { margin: 0; padding: 0; box-sizing: border-box; } .gym-finder { width: 100% !important; max-width: 700px !important; margin: 0 auto !important; background: #04010E !important; border-radius: 16px !important; overflow: hidden !important; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important; border: 2px solid #4a6fa5 !important; font-family: -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, Oxygen, Ubuntu, sans-serif !important; } .gym-finder-header { background: linear-gradient(135deg, #283655 0%, #336699 100%) !important; padding: 20px 24px !important; } .gym-finder-header h2 { color: #FFFFFF !important; font-size: 24px !important; font-weight: 700 !important; display: flex !important; align-items: center !important; gap: 10px !important; text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important; margin: 0 !important; padding: 0 !important; } .gym-finder-header p { color: #FFFFFF !important; font-size: 14px !important; margin-top: 6px !important; opacity: 0.95 !important; font-weight: 500 !important; } .gym-finder-content { padding: 24px !important; background: #04010E !important; } .gym-finder .search-row { display: flex !important; gap: 10px !important; margin-bottom: 14px !important; } .gym-finder .search-input-wrapper { flex: 1 !important; position: relative !important; } .gym-finder .search-input { width: 100% !important; padding: 16px 16px 16px 48px !important; background: #FFFFFF !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; color: #1a1a2e !important; font-size: 16px !important; font-weight: 500 !important; transition: all 0.2s !important; } .gym-finder .search-select { width: 100% !important; padding: 16px !important; background: #FFFFFF !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; color: #1a1a2e !important; font-size: 16px !important; font-weight: 500 !important; transition: all 0.2s !important; cursor: pointer !important; appearance: none !important; background-image: url(“data:image/svg+xml,%3Csvg width=’12’ height=’12’ viewBox=’0 0 24 24′ fill=’none’ stroke=’%231a1a2e’ stroke-width=’3′ xmlns=’http://www.w3.org/2000/svg’%3E%3Cpath d=’m6 9 6 6 6-6’/%3E%3C/svg%3E”) !important; background-repeat: no-repeat !important; background-position: right 16px center !important; } .gym-finder .search-input:focus, .gym-finder .search-select:focus { outline: none !important; border-color: #32B258 !important; box-shadow: 0 0 0 4px rgba(50, 178, 88, 0.3) !important; } .gym-finder .search-input::placeholder { color: #666677 !important; font-weight: 400 !important; } .gym-finder .search-icon { position: absolute !important; left: 16px !important; top: 50% !important; transform: translateY(-50%) !important; color: #336699 !important; } .gym-finder .options-row { display: flex !important; gap: 10px !important; margin-bottom: 18px !important; flex-wrap: wrap !important; } .gym-finder .country-select-wrapper { flex: 1 !important; min-width: 150px !important; } .gym-finder .unit-toggle { display: flex !important; background: #FFFFFF !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; overflow: hidden !important; } .gym-finder .unit-btn { padding: 16px 20px !important; background: transparent !important; border: none !important; color: #1a1a2e !important; font-size: 14px !important; font-weight: 700 !important; cursor: pointer !important; transition: all 0.2s !important; } .gym-finder .unit-btn.active { background: #336699 !important; color: #FFFFFF !important; } .gym-finder .unit-btn:hover:not(.active) { background: #e8f0f8 !important; } .gym-finder .btn { padding: 16px 20px !important; border: none !important; border-radius: 12px !important; font-size: 14px !important; font-weight: 700 !important; cursor: pointer !important; transition: all 0.2s !important; display: flex !important; align-items: center !important; gap: 8px !important; } .gym-finder .btn-primary { background: #32B258 !important; color: #FFFFFF !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; } .gym-finder .btn-primary:hover { background: #28a04a !important; } .gym-finder .btn-secondary { background: #336699 !important; color: #FFFFFF !important; } .gym-finder .btn-secondary:hover { background: #4080b8 !important; } .gym-finder .btn:disabled { opacity: 0.5 !important; cursor: not-allowed !important; } .gym-finder .filter-toggle { background: #1a2744 !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; color: #FFFFFF !important; font-size: 14px !important; font-weight: 700 !important; cursor: pointer !important; display: flex !important; align-items: center !important; gap: 10px !important; padding: 14px 18px !important; transition: all 0.2s !important; width: 100% !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; } .gym-finder .filter-toggle:hover { background: #253350 !important; border-color: #32B258 !important; } .gym-finder .filters { display: none; flex-wrap: wrap !important; gap: 10px !important; padding: 20px !important; background: #0d1520 !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; margin-top: 14px !important; margin-bottom: 18px !important; } .gym-finder .filters.show { display: flex !important; } .gym-finder .filter-btn { padding: 12px 20px !important; border: none !important; border-radius: 25px !important; font-size: 14px !important; font-weight: 700 !important; cursor: pointer !important; transition: all 0.2s !important; background: #FFFFFF !important; color: #1a1a2e !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; } .gym-finder .filter-btn:hover { background: #e8f0f8 !important; transform: translateY(-1px) !important; } .gym-finder .filter-btn.active { background: #32B258 !important; color: #FFFFFF !important; box-shadow: 0 4px 12px rgba(50, 178, 88, 0.4) !important; } .gym-finder .select-all-row { width: 100% !important; display: flex !important; gap: 10px !important; margin-bottom: 14px !important; padding-bottom: 14px !important; border-bottom: 2px solid #4a6fa5 !important; } .gym-finder .select-all-btn { padding: 10px 18px !important; border: none !important; border-radius: 8px !important; font-size: 13px !important; font-weight: 700 !important; cursor: pointer !important; background: #336699 !important; color: #FFFFFF !important; transition: all 0.2s !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; } .gym-finder .select-all-btn:hover { background: #4080b8 !important; } .gym-finder .error { padding: 14px 18px !important; background: #3d1a1f !important; border: 2px solid #ff6b7a !important; border-radius: 12px !important; color: #ff8a95 !important; font-size: 14px !important; font-weight: 600 !important; margin-bottom: 16px !important; } .gym-finder .warning { padding: 14px 18px !important; background: #3d3a1a !important; border: 2px solid #ffd54f !important; border-radius: 12px !important; color: #ffe082 !important; font-size: 14px !important; font-weight: 600 !important; margin-bottom: 16px !important; } .gym-finder .info { padding: 14px 18px !important; background: #1a2d3d !important; border: 2px solid #64b5f6 !important; border-radius: 12px !important; color: #90caf9 !important; font-size: 14px !important; font-weight: 600 !important; margin-bottom: 16px !important; } .gym-finder .results { margin-top: 20px !important; } .gym-finder .results-header { color: #FFFFFF !important; font-size: 18px !important; font-weight: 700 !important; margin-bottom: 16px !important; display: flex !important; align-items: center !important; gap: 10px !important; } .gym-finder .results-header svg { color: #32B258 !important; } .gym-finder .map-container { border-radius: 12px !important; overflow: hidden !important; border: 2px solid #4a6fa5 !important; margin-bottom: 16px !important; } .gym-finder .map-container iframe { display: block !important; width: 100% !important; height: 220px !important; border: none !important; } .gym-finder .gym-links { display: flex !important; flex-direction: column !important; gap: 10px !important; } .gym-finder .gym-link { display: flex !important; align-items: center !important; justify-content: space-between !important; padding: 18px 20px !important; background: #FFFFFF !important; border: 2px solid #4a6fa5 !important; border-radius: 12px !important; text-decoration: none !important; transition: all 0.2s !important; } .gym-finder .gym-link:hover { background: #e8f8ec !important; border-color: #32B258 !important; transform: translateY(-2px) !important; box-shadow: 0 4px 12px rgba(50, 178, 88, 0.2) !important; } .gym-finder .gym-link-text { color: #1a1a2e !important; font-weight: 700 !important; font-size: 16px !important; } .gym-finder .gym-link-subtext { color: #336699 !important; font-size: 14px !important; margin-left: 8px !important; font-weight: 500 !important; } .gym-finder .gym-link svg { color: #336699 !important; transition: color 0.2s !important; flex-shrink: 0 !important; } .gym-finder .gym-link:hover svg { color: #32B258 !important; } .gym-finder .results-footer { text-align: center !important; color: #FFFFFF !important; font-size: 13px !important; margin-top: 20px !important; font-weight: 500 !important; opacity: 0.8 !important; } .gym-finder .initial-state { text-align: center !important; padding: 50px 20px !important; } .gym-finder .initial-state-icon { width: 80px !important; height: 80px !important; background: #1a2744 !important; border: 2px solid #4a6fa5 !important; border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important; margin: 0 auto 20px !important; } .gym-finder .initial-state-icon svg { color: #FFFFFF !important; opacity: 0.7 !important; } .gym-finder .initial-state p { color: #FFFFFF !important; font-size: 16px !important; font-weight: 500 !important; line-height: 1.6 !important; } .gym-finder-footer { padding: 16px 24px !important; background: #0d1520 !important; border-top: 2px solid #4a6fa5 !important; text-align: center !important; } .gym-finder-footer p { color: #FFFFFF !important; font-size: 13px !important; font-weight: 500 !important; opacity: 0.7 !important; } .gym-finder .spinner { animation: gym-finder-spin 1s linear infinite !important; } @keyframes gym-finder-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } /* MOBILE STYLES */ @media (max-width: 600px) { .gym-finder { border-radius: 12px !important; margin: 0 8px !important; } .gym-finder-header { padding: 16px 18px !important; } .gym-finder-header h2 { font-size: 20px !important; } .gym-finder-header h2 svg { width: 20px !important; height: 20px !important; } .gym-finder-content { padding: 16px !important; } .gym-finder .search-row { flex-wrap: wrap !important; } .gym-finder .search-input-wrapper { width: 100% !important; flex: none !important; } .gym-finder .search-input { padding: 16px 16px 16px 48px !important; font-size: 16px !important; } .gym-finder .btn { padding: 16px !important; } .gym-finder .btn-text { display: none !important; } .gym-finder .options-row { flex-direction: column !important; gap: 10px !important; } .gym-finder .country-select-wrapper { width: 100% !important; } .gym-finder .search-select { padding: 16px !important; font-size: 16px !important; } .gym-finder .unit-toggle { width: 100% !important; justify-content: center !important; } .gym-finder .unit-btn { flex: 1 !important; padding: 16px !important; font-size: 15px !important; } .gym-finder .filter-toggle { padding: 14px 16px !important; font-size: 13px !important; } .gym-finder .filters { padding: 16px !important; gap: 8px !important; } .gym-finder .filter-btn { padding: 12px 16px !important; font-size: 12px !important; flex-grow: 1 !important; text-align: center !important; min-width: calc(33% – 8px) !important; } .gym-finder .select-all-row { flex-wrap: wrap !important; } .gym-finder .select-all-btn { flex: 1 !important; text-align: center !important; padding: 12px !important; } .gym-finder .results-header { font-size: 16px !important; } .gym-finder .map-container iframe { height: 180px !important; } .gym-finder .gym-link { padding: 16px !important; } .gym-finder .gym-link-text { font-size: 14px !important; } .gym-finder .gym-link-subtext { display: none !important; } .gym-finder .initial-state { padding: 40px 16px !important; } .gym-finder .initial-state-icon { width: 64px !important; height: 64px !important; } .gym-finder .initial-state-icon svg { width: 28px !important; height: 28px !important; } .gym-finder .initial-state p { font-size: 14px !important; } .gym-finder-footer { padding: 14px 18px !important; } } /* Extra small screens */ @media (max-width: 380px) { .gym-finder .filter-btn { min-width: calc(50% – 6px) !important; font-size: 11px !important; padding: 10px 12px !important; } }

Ringside Report Network’s Combat Sports Gym Finder

Find BJJ, Boxing, Muay Thai & more near you

All Countries United States Canada United Kingdom Australia Brazil Germany France Japan Mexico Netherlands Ireland New Zealand Philippines Poland Russia South Africa South Korea Spain Sweden Thailand

Enter your location, select disciplines,
then search to find combat sports gyms nearby

(function() { // State let coordinates = null; let locationName = ”; let selectedTypes = []; let distanceUnit = ‘miles’; // Elements const locationInput = document.getElementById(‘locationInput’); const countrySelect = document.getElementById(‘countrySelect’); const searchBtn = document.getElementById(‘searchBtn’); const gpsBtn = document.getElementById(‘gpsBtn’); const filterToggle = document.getElementById(‘filterToggle’); const filters = document.getElementById(‘filters’); const filterCount = document.getElementById(‘filterCount’); const errorEl = document.getElementById(‘error’); const warningEl = document.getElementById(‘warning’); const infoEl = document.getElementById(‘info’); const initialState = document.getElementById(‘initialState’); const results = document.getElementById(‘results’); const locationNameEl = document.getElementById(‘locationName’); const mapFrame = document.getElementById(‘mapFrame’); const gymLinks = document.getElementById(‘gymLinks’); const filterBtns = document.querySelectorAll(‘.filter-btn’); const unitKm = document.getElementById(‘unitKm’); const unitMiles = document.getElementById(‘unitMiles’); const selectAllBtn = document.getElementById(‘selectAllBtn’); const clearAllBtn = document.getElementById(‘clearAllBtn’); // Icons const searchIcon = ”; const spinnerIcon = ”; const externalIcon = ”; // Functions function showError(message) { errorEl.textContent = message; errorEl.style.display = ‘block’; warningEl.style.display = ‘none’; infoEl.style.display = ‘none’; } function hideError() { errorEl.style.display = ‘none’; } function showWarning() { warningEl.style.display = ‘block’; errorEl.style.display = ‘none’; infoEl.style.display = ‘none’; } function hideWarning() { warningEl.style.display = ‘none’; } function showInfo(message) { infoEl.textContent = message; infoEl.style.display = ‘block’; } function hideInfo() { infoEl.style.display = ‘none’; } function setLoading(isLoading) { searchBtn.disabled = isLoading; gpsBtn.disabled = isLoading; searchBtn.innerHTML = isLoading ? spinnerIcon + ‘Searching…‘ : searchIcon + ‘Search‘; } function updateFilterCount() { filterCount.textContent = selectedTypes.length; if (selectedTypes.length > 0) { hideWarning(); } } function showResults() { if (selectedTypes.length === 0) { showWarning(); return; } hideWarning(); hideInfo(); initialState.style.display = ‘none’; results.style.display = ‘block’; // Show friendly location name const displayName = locationName.split(‘,’)[0].trim(); locationNameEl.textContent = displayName; // Update map const bbox = `${coordinates.lng – 0.05},${coordinates.lat – 0.05},${coordinates.lng + 0.05},${coordinates.lat + 0.05}`; mapFrame.src = `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${coordinates.lat},${coordinates.lng}`; // Update gym links gymLinks.innerHTML = ”; filterBtns.forEach(btn => { if (selectedTypes.includes(btn.dataset.type)) { const searchTerm = btn.dataset.search; const label = btn.textContent; const query = encodeURIComponent(`${searchTerm} near ${locationName}`); const url = `https://www.google.com/maps/search/${query}/@${coordinates.lat},${coordinates.lng},13z`; const link = document.createElement(‘a’); link.href = url; link.target = ‘_blank’; link.rel = ‘noopener noreferrer’; link.className = ‘gym-link’; link.innerHTML = `
${label} Gyms near you
${externalIcon} `; gymLinks.appendChild(link); } }); } // Geocoding with multiple fallback attempts async function geocodeLocation(query, country) { const searchQueries = []; // Build search queries in order of specificity if (country) { searchQueries.push(`${query}, ${country}`); } searchQueries.push(query); // If query looks like an address, also try just the city/region part if (query.includes(‘,’)) { const parts = query.split(‘,’).map(p => p.trim()); if (parts.length >= 2) { // Try city, country if (country) { searchQueries.push(`${parts[1]}, ${country}`); } searchQueries.push(parts[1]); } } // Try postal code pattern (for Canada: A1A 1A1, for US: 12345) const postalMatch = query.match(/[A-Za-z]\d[A-Za-z]\s*\d[A-Za-z]\d|\d{5}/); if (postalMatch && country) { searchQueries.push(`${postalMatch[0]}, ${country}`); } for (const searchQuery of searchQueries) { try { const response = await fetch( `https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(searchQuery)}&format=json&limit=1&addressdetails=1`, { headers: { ‘Accept’: ‘application/json’ } } ); if (!response.ok) continue; const data = await response.json(); if (data.length > 0) { return { lat: parseFloat(data[0].lat), lng: parseFloat(data[0].lon), displayName: data[0].display_name, searchUsed: searchQuery }; } } catch (err) { console.log(‘Geocode attempt failed for:’, searchQuery); continue; } } return null; } async function searchLocation() { const query = locationInput.value.trim(); const country = countrySelect.value; if (!query) { showError(‘Please enter a location’); return; } if (selectedTypes.length === 0) { showWarning(); return; } hideError(); hideWarning(); hideInfo(); setLoading(true); try { const result = await geocodeLocation(query, country); if (result) { coordinates = { lat: result.lat, lng: result.lng }; locationName = result.displayName.split(‘,’).slice(0, 3).join(‘,’); // Update input with friendly name const friendlyName = result.displayName.split(‘,’)[0].trim(); locationInput.value = friendlyName; showResults(); } else { showError(‘Location not found. Try a city name or postal code.’); } } catch (err) { showError(‘Error searching for location. Please try again.’); } setLoading(false); } function useGeolocation() { if (!navigator.geolocation) { showError(‘Geolocation is not supported by your browser’); return; } if (selectedTypes.length === 0) { showWarning(); return; } hideError(); hideWarning(); hideInfo(); setLoading(true); navigator.geolocation.getCurrentPosition( async (position) => { coordinates = { lat: position.coords.latitude, lng: position.coords.longitude }; try { const response = await fetch( `https://nominatim.openstreetmap.org/reverse?lat=${coordinates.lat}&lon=${coordinates.lng}&format=json&addressdetails=1` ); const data = await response.json(); const city = data.address?.city || data.address?.town || data.address?.village || data.address?.municipality || ”; const state = data.address?.state || data.address?.province || ”; const country = data.address?.country || ”; locationName = [city, state, country].filter(Boolean).join(‘, ‘); locationInput.value = city || locationName; } catch { locationName = `${coordinates.lat.toFixed(4)}, ${coordinates.lng.toFixed(4)}`; locationInput.value = locationName; } setLoading(false); showResults(); }, (err) => { let errorMsg = ‘Unable to get your location. ‘; if (err.code === 1) { errorMsg += ‘Please allow location access or enter your location manually.’; } else if (err.code === 2) { errorMsg += ‘Position unavailable. Please enter your location manually.’; } else { errorMsg += ‘Please enter your location manually.’; } showError(errorMsg); setLoading(false); }, { enableHighAccuracy: true, timeout: 10000 } ); } // Event Listeners searchBtn.addEventListener(‘click’, searchLocation); locationInput.addEventListener(‘keydown’, (e) => { if (e.key === ‘Enter’) searchLocation(); }); gpsBtn.addEventListener(‘click’, useGeolocation); filterToggle.addEventListener(‘click’, () => { filters.classList.toggle(‘show’); }); filterBtns.forEach(btn => { btn.addEventListener(‘click’, () => { const type = btn.dataset.type; if (btn.classList.contains(‘active’)) { selectedTypes = selectedTypes.filter(t => t !== type); btn.classList.remove(‘active’); } else { selectedTypes.push(type); btn.classList.add(‘active’); } updateFilterCount(); if (coordinates && selectedTypes.length > 0) { showResults(); } }); }); selectAllBtn.addEventListener(‘click’, () => { selectedTypes = []; filterBtns.forEach(btn => { btn.classList.add(‘active’); selectedTypes.push(btn.dataset.type); }); updateFilterCount(); if (coordinates) showResults(); }); clearAllBtn.addEventListener(‘click’, () => { selectedTypes = []; filterBtns.forEach(btn => { btn.classList.remove(‘active’); }); updateFilterCount(); }); // Unit toggle unitKm.addEventListener(‘click’, () => { distanceUnit = ‘km’; unitKm.classList.add(‘active’); unitMiles.classList.remove(‘active’); }); unitMiles.addEventListener(‘click’, () => { distanceUnit = ‘miles’; unitMiles.classList.add(‘active’); unitKm.classList.remove(‘active’); }); })();

Tags

LinkedIn
Pinterest
Facebook
X

In the Ring

The Ringside Report Network website contains links to affiliate websites, and we receive an affiliate commission for any purchases you make on the affiliate website using such links, including Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn advertising fees by linking to Amazon.com and affiliated websites.

The Latest