mirror of
https://github.com/myronblair/tomtomgames
synced 2026-06-30 17:51:08 -05:00
Fix platforms/payment methods not rendering due to Cloudflare Rocket Loader
Rocket Loader defers our main script, causing DOMContentLoaded to fire before our listener is registered — so buildPlatforms(), buildPaymentMethods() etc. never run. Adding Cache-Control: no-transform tells Cloudflare not to rewrite the response, disabling Rocket Loader for this page. Also adds buildPaymentMethods() to showApp() alongside buildPlatforms() so payment methods are guaranteed to render when the user logs in, regardless of fetch timing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,8 @@ ob_start();
|
||||
require_once __DIR__ . '/../includes/config.php';
|
||||
require_once __DIR__ . '/../includes/square.php';
|
||||
ob_end_clean();
|
||||
// Prevent Cloudflare Rocket Loader from deferring our scripts (breaks DOMContentLoaded listener)
|
||||
header('Cache-Control: no-transform');
|
||||
$_appVersion = '1.0.2';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -1317,10 +1319,13 @@ function showApp() {
|
||||
var app = document.getElementById('main-app');
|
||||
if (auth) auth.setAttribute('style', 'display:none');
|
||||
if (app) app.setAttribute('style', 'display:block;min-height:100vh;');
|
||||
// Rebuild platform grid now that app is visible (covers race where me.php resolves before platforms fetch)
|
||||
// Rebuild dynamic UI now that app is visible (covers race where me.php resolves before data fetches)
|
||||
if (CFG.platforms && CFG.platforms.length) {
|
||||
try { buildPlatforms(); buildCashoutPlatforms(); } catch(e) {}
|
||||
}
|
||||
if (CFG.payMethods && CFG.payMethods.length) {
|
||||
try { buildPaymentMethods(); } catch(e) {}
|
||||
}
|
||||
try { updateUI(); } catch(e) { console.warn('updateUI err:', e); }
|
||||
try { loadCashoutHistory(); } catch(e) { console.warn('cashout err:', e); }
|
||||
try { pollChatBadge(); } catch(e) { console.warn('badge err:', e); }
|
||||
|
||||
Reference in New Issue
Block a user