{"id":25655,"date":"2025-12-01T13:18:25","date_gmt":"2025-12-01T13:18:25","guid":{"rendered":"https:\/\/casino2.myrwds.net\/sportsplay\/"},"modified":"2026-03-23T17:09:33","modified_gmt":"2026-03-23T17:09:33","slug":"sportsplay","status":"publish","type":"page","link":"https:\/\/gustabets.com\/tr\/sportsplay\/","title":{"rendered":"SportsPlay"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container has-pattern-background has-mask-background hundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-padding-right:0px;--awb-padding-left:0px;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start\" style=\"width:104% !important;max-width:104% !important;margin-left: calc(-4% \/ 2 );margin-right: calc(-4% \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;\"><div class=\"fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-text fusion-text-1\">\n<style>\n#sb_widget_frame.sb-betby-container { overflow: visible !important; }\n<\/style>\n<div id=\"sb_widget_frame\" class=\"sb-betby-container\" style=\"width:100%; min-height:900px; margin-top:0;\"><\/div>\n\n<script src=\"https:\/\/ui.invisiblesport.com\/bt-renderer.min.js\"><\/script>\n\n<script>\ndocument.addEventListener(\"DOMContentLoaded\", async () => {\n\n    \n    const player_id = \"3a031231-2f39-4122-abaf-2af94c53705e_1AEC694D-3933-44B1-BD61-5D0D6B629676_gustabets.com\";\n    const isLoggedIn = false;\n    const sbLang = \"tr\";\n    const headerLang = (document.documentElement && document.documentElement.lang) ? document.documentElement.lang.split(\/[-_]\/)[0] : sbLang;\n    const headerHeight = 70;\n    const footerHeight = 0;\n\n    let token = null;\n    if (isLoggedIn) {\n        const initUrl = \"https:\/\/gustabets.com\/wp-admin\/admin-ajax.php?action=sportsplay_auto_init&lang=\" + (document.documentElement.lang ? document.documentElement.lang.split(\/[-_]\/)[0] : sbLang);\n        let res = await fetch(initUrl);\n        let data = await res.json();\n        if (data._debug) {\n            console.log(\"[Sports Betting Init DEBUG]\", data._debug);\n        }\n        if (!data.token) {\n            alert(\"Failed to initialize Sports Betting Widget\");\n            console.error(\"[Sports Betting] API response:\", data);\n            return;\n        }\n        token = data.token;\n    } else {\n        fetch(\"https:\/\/gustabets.com\/wp-admin\/admin-ajax.php?action=sportsplay_auto_init&lang=\" + (document.documentElement.lang ? document.documentElement.lang.split(\/[-_]\/)[0] : sbLang))\n            .then(function(r) { return r.json(); })\n            .then(function(data) {\n                if (data._debug) {\n                    console.log(\"[Sports Betting Init DEBUG - Guest]\", data._debug);\n                }\n            })\n            .catch(function(e) { console.warn(\"[Sports Betting] Guest init fetch failed:\", e); });\n    }\n\n    const onTokenExpired = isLoggedIn ? async () => {\n        const refreshUrl = \"https:\/\/gustabets.com\/wp-admin\/admin-ajax.php?action=sportsplay_auto_init&lang=\" + (document.documentElement.lang ? document.documentElement.lang.split(\/[-_]\/)[0] : sbLang);\n        let r = await fetch(refreshUrl);\n        let d = await r.json();\n        return d.token;\n    } : undefined;\n\n    const SB_PATH_KEY = \"sportsplay_last_path\";\n    const baseName = \"\/tr\/sportsplay\";\n    const baseTrimmed = baseName.replace(\/\\\/+$\/, \"\");\n\n    \/**\n     * Map internal BetBy paths to operator URL tail under basename.\n     * Strips \/sportsbook\/{layout}\/\u2026 (classic, sidebar, etc.) so subcategories stay, e.g.\n     * \/sportsbook\/sidebar\/soccer\/italy\/serie-a-\u2026 \u2192 \/soccer\/italy\/serie-a-\u2026\n     *\/\n    function toOperatorWidgetPath(pathOnly) {\n        if (!pathOnly || pathOnly === \"\/\") return pathOnly;\n        let p = String(pathOnly).split(\"?\")[0].split(\"#\")[0].trim();\n        if (p.charAt(0) !== \"\/\") p = \"\/\" + p;\n        const segments = p.split(\"\/\").filter(function (s) { return s.length > 0; });\n        if (segments.length >= 2 && segments[0] === \"sportsbook\") {\n            if (segments.length === 2) return \"\/\";\n            p = \"\/\" + segments.slice(2).join(\"\/\");\n        }\n        return p.replace(\/\\\/+$\/, \"\") || \"\/\";\n    }\n\n    \/**\n     * BetBy uses numeric sport slugs (tennis-5, soccer-1). Bare paths like \/tennis load the shell but return \"sport is empty\" on cold start.\n     * IDs align with BetBy demo selectedSports (basketball-2, tennis-5, ice-hockey-4, cricket-21, \u2026).\n     *\/\n    const BETBY_BARE_SPORT_TO_ID = {\n        \"soccer\": \"soccer-1\",\n        \"football\": \"soccer-1\",\n        \"tennis\": \"tennis-5\",\n        \"basketball\": \"basketball-2\",\n        \"cricket\": \"cricket-21\",\n        \"ice-hockey\": \"ice-hockey-4\",\n        \"icehockey\": \"ice-hockey-4\",\n        \"hockey\": \"ice-hockey-4\"\n    };\n\n    \/** Bare sport name \u2192 BetBy sport id on first segment only; keeps league\/country tail (subcategories). *\/\n    function canonicalizeSportSectionSlug(pathOnly) {\n        if (!pathOnly || pathOnly === \"\/\") return pathOnly;\n        let p = String(pathOnly).split(\"?\")[0].split(\"#\")[0].trim();\n        if (p.charAt(0) !== \"\/\") p = \"\/\" + p;\n        const segments = p.split(\"\/\").filter(function (s) { return s.length > 0; });\n        if (segments.length === 0) return \"\/\";\n        const slug = segments[0];\n        if (\/^[a-z0-9][a-z0-9-]*-\\d+$\/i.test(slug)) {\n            return p.replace(\/\\\/+$\/, \"\") || \"\/\";\n        }\n        const low = slug.toLowerCase();\n        if (BETBY_BARE_SPORT_TO_ID[low]) {\n            segments[0] = BETBY_BARE_SPORT_TO_ID[low];\n            return (\"\/\" + segments.join(\"\/\")).replace(\/\\\/+$\/, \"\") || \"\/\";\n        }\n        return p.replace(\/\\\/+$\/, \"\") || \"\/\";\n    }\n\n    function pathIsEventBuilderSection(normPath) {\n        if (!normPath) return false;\n        return normPath.split(\"?\")[0].toLowerCase().indexOf(\"event-builder\") !== -1;\n    }\n\n    \/** Trim only; preserve full path for subcategories (leagues, regions under a sport). *\/\n    function normalizeWidgetPathSegments(pathOnly) {\n        if (!pathOnly) return '';\n        let path = String(pathOnly).split('#')[0].trim();\n        if (!path) return '';\n        if (path.charAt(0) !== '\/') path = '\/' + path;\n        const segments = path.split('\/').filter(function (s) { return s.length > 0; });\n        if (segments.length === 0) return '\/';\n        return path.replace(\/\\\/+$\/, '') || '\/';\n    }\n\n    \/**\n     * Persisted route: basename + path (sport, subcategory segments) + optional query (event-builder only).\n     * Internal \/sportsbook\/{layout}\/\u2026 is stripped in toOperatorWidgetPath.\n     *\/\n    function normalizePersistedWidgetRoute(raw) {\n        if (!raw) return '';\n        const clean = String(raw).split('#')[0].trim();\n        const qPos = clean.indexOf('?');\n        let pathPart = (qPos === -1 ? clean : clean.slice(0, qPos)).trim();\n        const queryPart = qPos === -1 ? '' : clean.slice(qPos);\n        if (pathPart && pathPart.charAt(0) !== '\/') pathPart = '\/' + pathPart;\n        pathPart = toOperatorWidgetPath(pathPart);\n        const pathCanon = pathPart.replace(\/\\\/+$\/, '') || '\/';\n        let normPath = normalizeWidgetPathSegments(pathCanon);\n        normPath = canonicalizeSportSectionSlug(normPath);\n        const collapsed = normPath !== pathCanon;\n        let out;\n        if (collapsed && queryPart) {\n            out = normPath;\n        } else {\n            out = normPath + queryPart;\n        }\n        if (!pathIsEventBuilderSection(normPath)) {\n            const ox = out.indexOf('?');\n            if (ox !== -1) {\n                out = out.slice(0, ox);\n            }\n        }\n        return out;\n    }\n\n    const BETBY_PARENT_QUERY_KEYS = ['selectedSports', 'live'];\n\n    function mergeParentBetbyParamsIntoRoute(pathOnlyNorm) {\n        let route = pathOnlyNorm;\n        try {\n            const pathCheck = route.indexOf('?') === -1 ? route : route.slice(0, route.indexOf('?'));\n            if (!pathIsEventBuilderSection(pathCheck)) {\n                return pathCheck;\n            }\n            const existingKeys = {};\n            const qPos = route.indexOf('?');\n            if (qPos !== -1) {\n                new URLSearchParams(route.slice(qPos + 1)).forEach(function (_, k) {\n                    existingKeys[k] = true;\n                });\n            }\n            const sp = new URLSearchParams(window.location.search);\n            const append = [];\n            BETBY_PARENT_QUERY_KEYS.forEach(function (key) {\n                if (existingKeys[key]) return;\n                const val = sp.get(key);\n                if (val !== null && val !== '') {\n                    append.push(encodeURIComponent(key) + '=' + encodeURIComponent(val));\n                }\n            });\n            if (append.length) {\n                const sep = route.indexOf('?') === -1 ? '?' : '&';\n                route += sep + append.join('&');\n            }\n        } catch (e) {}\n        return route;\n    }\n\n    function getWidgetPathFromBrowser() {\n        const pathname = window.location.pathname.replace(\/\\\/+$\/, \"\");\n        if (pathname.startsWith(baseTrimmed)) {\n            const rest = pathname.slice(baseTrimmed.length).replace(\/^\\\/+\/, \"\");\n            const pathOnly = rest ? ('\/' + rest.split('?')[0]) : '\/';\n            const merged = mergeParentBetbyParamsIntoRoute(normalizePersistedWidgetRoute(pathOnly));\n            return normalizePersistedWidgetRoute(merged);\n        }\n        try {\n            const urlParams = new URLSearchParams(window.location.search);\n            const btPath = urlParams.get('bt-path');\n            if (btPath) {\n                let p = btPath.trim();\n                try { p = decodeURIComponent(p); } catch (e) {}\n                if (p.indexOf('?') !== -1) {\n                    return normalizePersistedWidgetRoute(p);\n                }\n                p = p.charAt(0) === '\/' ? p : '\/' + p;\n                const pathNorm = normalizePersistedWidgetRoute(p);\n                return normalizePersistedWidgetRoute(mergeParentBetbyParamsIntoRoute(pathNorm));\n            }\n        } catch (e) {}\n        return null;\n    }\n\n    \/**\n     * Drops pathname to basename only (hub \/ home). Preserves utm_* on non\u2013event-builder pages.\n     *\/\n    function ensureOperatorHubUrl() {\n        const basePath = baseTrimmed.replace(\/\\\/+$\/, '');\n        const url = new URL(window.location.href);\n        url.pathname = basePath + '\/';\n        const utmKeep = new URLSearchParams();\n        try {\n            const cur = new URLSearchParams(window.location.search);\n            cur.forEach(function (val, key) {\n                if (key.indexOf('utm_') === 0) utmKeep.set(key, val);\n            });\n        } catch (e0) {}\n        url.search = utmKeep.toString();\n        if (url.toString() !== window.location.href) {\n            history.replaceState(null, '', url.toString());\n        }\n    }\n\n    \/** Support format: basename\/page (e.g. \/sportsplay\/soccer-1). Drops bt-path to avoid conflicts with pathname routing. *\/\n    function ensureUrlMatchesWidgetRoute(route) {\n        const fullNorm = normalizePersistedWidgetRoute(route == null ? '' : String(route));\n        if (!fullNorm || fullNorm === '\/') {\n            ensureOperatorHubUrl();\n            return;\n        }\n        const qi = fullNorm.indexOf('?');\n        const pathOnly = qi === -1 ? fullNorm : fullNorm.slice(0, qi);\n        const tail = pathOnly.replace(\/^\\\/+\/, '').replace(\/\\\/+$\/, '');\n        const basePath = baseTrimmed.replace(\/\\\/+$\/, '');\n        const url = new URL(window.location.href);\n        url.pathname = tail ? (basePath + '\/' + tail) : (basePath + '\/');\n        if (!pathIsEventBuilderSection(pathOnly)) {\n            const utmKeep = new URLSearchParams();\n            try {\n                const cur = new URLSearchParams(window.location.search);\n                cur.forEach(function (val, key) {\n                    if (key.indexOf('utm_') === 0) utmKeep.set(key, val);\n                });\n            } catch (e0) {}\n            url.search = utmKeep.toString();\n        } else {\n            const preserved = new URLSearchParams();\n            try {\n                const cur = new URLSearchParams(window.location.search);\n                cur.forEach(function (val, key) {\n                    if (key === 'bt-path' || BETBY_PARENT_QUERY_KEYS.indexOf(key) !== -1) return;\n                    preserved.set(key, val);\n                });\n            } catch (e) {}\n            if (qi !== -1) {\n                try {\n                    new URLSearchParams(fullNorm.slice(qi + 1)).forEach(function (val, key) {\n                        if (val !== null && val !== '') preserved.set(key, val);\n                    });\n                } catch (e2) {}\n            }\n            url.search = preserved.toString();\n        }\n        if (url.toString() !== window.location.href) {\n            history.replaceState(null, '', url.toString());\n        }\n    }\n\n    document.addEventListener('click', function (e) {\n        const link = e.target.closest('a[data-target=\".fusion-modal.login\"], a[data-target=\".fusion-modal.signup\"]');\n        if (link && (window.location.pathname.indexOf('sportsplay') !== -1)) {\n            try { (window.top || window).sessionStorage.setItem('login_redirect', (window.top || window).location.href); } catch (x) {}\n        }\n    }, true);\n\n    const qs = window.location.search;\n    if (qs && (qs.match(\/\\?live=\/g) || []).length > 1) {\n        const m = qs.match(\/[?&]live=([^&]+)\/);\n        history.replaceState(null, \"\", window.location.pathname + (m ? \"?live=\" + m[1] : \"\"));\n    }\n\n    const pathFromUrl = getWidgetPathFromBrowser();\n    const storedRaw = sessionStorage.getItem(SB_PATH_KEY);\n    const storedNorm = storedRaw ? normalizePersistedWidgetRoute(storedRaw) : '';\n    let loadNorm = null;\n    if (pathFromUrl !== null && pathFromUrl !== undefined) {\n        const normFromUrl = normalizePersistedWidgetRoute(pathFromUrl);\n        if (normFromUrl && normFromUrl !== '\/') {\n            loadNorm = normFromUrl;\n            sessionStorage.setItem(SB_PATH_KEY, loadNorm);\n        } else if (storedNorm && storedNorm !== '\/') {\n            loadNorm = storedNorm;\n            sessionStorage.setItem(SB_PATH_KEY, loadNorm);\n        } else {\n            try { sessionStorage.removeItem(SB_PATH_KEY); } catch (eR0) {}\n        }\n    } else if (storedNorm && storedNorm !== '\/') {\n        loadNorm = storedNorm;\n        sessionStorage.setItem(SB_PATH_KEY, loadNorm);\n    }\n    if (loadNorm && loadNorm !== '\/') {\n        ensureUrlMatchesWidgetRoute(loadNorm);\n    }\n\n    let initialBetbyPath = null;\n    if (loadNorm && loadNorm !== \"\/\") {\n        const qj = loadNorm.indexOf(\"?\");\n        initialBetbyPath = qj === -1 ? loadNorm : loadNorm.slice(0, qj);\n    }\n\n    \/** BetBy passes the new path into onRouteChange (string or location-like object). handlePageChange is not used (deprecated). *\/\n    function coalesceBetByRouteArg(arg) {\n        if (arg == null) {\n            return null;\n        }\n        if (typeof arg === 'string') {\n            return arg;\n        }\n        if (typeof arg === 'object' && typeof arg.pathname === 'string') {\n            return arg.pathname + (arg.search || '');\n        }\n        return null;\n    }\n\n    function applyWidgetRouteFromBetBy(routeArg) {\n        var full = coalesceBetByRouteArg(routeArg);\n        if (full != null && full !== '') {\n            full = String(full).trim();\n            if (full.indexOf('http:\/\/') === 0 || full.indexOf('https:\/\/') === 0) {\n                try {\n                    var ux = new URL(full);\n                    full = ux.pathname + ux.search;\n                } catch (eHu) {}\n            }\n            if (full.charAt(0) !== '\/' && full.indexOf('?') !== 0) {\n                full = '\/' + full;\n            }\n        } else {\n            full = getWidgetPathFromBrowser();\n            if (full === null) {\n                full = '\/';\n            }\n        }\n        var toStore = normalizePersistedWidgetRoute(full);\n        if (!toStore || toStore === '\/') {\n            try { sessionStorage.removeItem(SB_PATH_KEY); } catch (eSt) {}\n            ensureUrlMatchesWidgetRoute('\/');\n            return;\n        }\n        sessionStorage.setItem(SB_PATH_KEY, toStore);\n        ensureUrlMatchesWidgetRoute(toStore);\n    }\n\n    const sbRendererOpts = {\n        brand_id: \"2597101495270907909\",\n        token: token,\n        basename: baseName,\n        themeName: \"default\",\n        lang: sbLang,\n        target: document.getElementById(\"sb_widget_frame\"),\n        minFrameHeight: 900,\n        betSlipOffsetTop: headerHeight,\n        betSlipOffsetBottom: footerHeight,\n        betslipZIndex: 999,\n        stickyTop: headerHeight,\n        onTokenExpired: onTokenExpired,\n        onSessionRefresh: isLoggedIn ? async function () {\n            const refreshUrl = \"https:\/\/gustabets.com\/wp-admin\/admin-ajax.php?action=sportsplay_auto_init&lang=\" + (document.documentElement.lang ? document.documentElement.lang.split(\/[-_]\/)[0] : sbLang);\n            const r = await fetch(refreshUrl);\n            const d = await r.json();\n            return d.token;\n        } : undefined,\n        onRecharge: function () {\n            if (!isLoggedIn) { alert(\"You must login first\"); return; }\n            document.querySelector('a[data-target=\".fusion-modal.depositmodal\"]')?.click();\n        },\n        onOutcomeClick: function () {\n            if (!isLoggedIn) alert(\"You must login first\");\n        },\n        onLogin: function () {\n            try { (window.top || window).sessionStorage.setItem('login_redirect', (window.top || window).location.href); } catch (e) {}\n            document.querySelector('a[data-target=\".fusion-modal.login\"]')?.click();\n        },\n        onRegister: function () {\n            try { (window.top || window).sessionStorage.setItem('login_redirect', (window.top || window).location.href); } catch (e) {}\n            document.querySelector('a[data-target=\".fusion-modal.signup\"]')?.click();\n        },\n        onRouteChange: function (routePayload) {\n            applyWidgetRouteFromBetBy(routePayload);\n        }\n    };\n    if (initialBetbyPath) {\n        sbRendererOpts.url = initialBetbyPath;\n    }\n\n    const bt = new BTRenderer().initialize(sbRendererOpts);\n\n    \n    const navbarTopPx = 70;\n    let attempts = 0;\n    const maxAttempts = 100;\n    const navbarInterval = setInterval(function () {\n        attempts++;\n        if (attempts > maxAttempts) { clearInterval(navbarInterval); return; }\n        const container = document.querySelector(\"#sb_widget_frame\");\n        if (!container) return;\n        const host = container.querySelector('div[style*=\"background-color\"]');\n        if (!host || !host.shadowRoot) return;\n        const navbar = host.shadowRoot.querySelector('[data-editor-id=\"navbar\"]');\n        if (navbar) {\n            navbar.style.top = navbarTopPx + \"px\";\n            navbar.setAttribute(\"data-navbar-adjusted\", navbarTopPx);\n            if (!host.shadowRoot.querySelector('#sportsplay-lang-menu-style')) {\n                const langMenuBg = \"#1e1e1e\";\n                const style = document.createElement('style');\n                style.id = 'sportsplay-lang-menu-style';\n                style.textContent = `[data-editor-id=\"navbar\"] [role=\"menu\"],[data-editor-id=\"navbar\"] [role=\"listbox\"],[data-editor-id=\"navbar\"] [class*=\"dropdown\"] [class*=\"menu\"],[data-editor-id=\"navbar\"] [class*=\"popover\"],[data-editor-id=\"navbar\"] [class*=\"Menu\"]{background:`+langMenuBg+`!important;background-color:`+langMenuBg+`!important}`;\n                host.shadowRoot.appendChild(style);\n            }\n            if (!host.shadowRoot.querySelector('#sportsplay-content-padding-style')) {\n                const contentTop = navbarTopPx + 38;\n                const contentStyle = document.createElement('style');\n                contentStyle.id = 'sportsplay-content-padding-style';\n                contentStyle.textContent = `[data-editor-id=\"content\"]{padding-top:`+contentTop+`px !important}[data-editor-id=\"navbar\"]+*{padding-top:`+contentTop+`px !important}`;\n                host.shadowRoot.appendChild(contentStyle);\n            }\n            clearInterval(navbarInterval);\n        }\n    }, 300);\n});\n<\/script>\n\n\n\n<\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-25655","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/pages\/25655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/comments?post=25655"}],"version-history":[{"count":3,"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/pages\/25655\/revisions"}],"predecessor-version":[{"id":25888,"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/pages\/25655\/revisions\/25888"}],"wp:attachment":[{"href":"https:\/\/gustabets.com\/tr\/wp-json\/wp\/v2\/media?parent=25655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}