{"id":19,"date":"2026-04-21T12:42:56","date_gmt":"2026-04-21T12:42:56","guid":{"rendered":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php\/home\/"},"modified":"2026-04-21T12:42:56","modified_gmt":"2026-04-21T12:42:56","slug":"home","status":"publish","type":"page","link":"https:\/\/great-euclid.217-154-38-247.plesk.page\/","title":{"rendered":"Home"},"content":{"rendered":"\n<div class=\"plp-home-shell\">\n    <h2>PL Predictor<\/h2>\n    <p class=\"plp-subtext\">Private Premier League score predictor league.<\/p>\n\n            <div class=\"plp-home-section plp-home-panel\">\n            <h3>Already Registered? Log In<\/h3>\n            <form id=\"plp-home-login-form\">\n                <label>Email<\/label>\n                <input type=\"email\" name=\"login_email\" placeholder=\"you@example.com\" required>\n\n                <button type=\"submit\" class=\"plp-btn\">Log In<\/button>\n                <div id=\"plp-home-login-message\"><\/div>\n            <\/form>\n        <\/div>\n\n        <hr class=\"plp-home-divider\">\n\n        <div class=\"plp-home-section plp-home-panel\">\n            <h3>New Player?<\/h3>\n            <p class=\"plp-subtext\">Use your private invite link or invite code to sign up.<\/p>\n            <div class=\"plp-action-row\"><a class=\"plp-btn\" href=\"https:\/\/great-euclid.217-154-38-247.plesk.page\/signup\">Go to Signup<\/a><\/div>\n        <\/div>\n\n    <\/div>\n\n<script>\njQuery(function($){\n    function playerAbbrev(name) {\n        if (typeof window.plpPlayerAbbrev === 'function') {\n            return window.plpPlayerAbbrev(name);\n        }\n        const clean = String(name || '').replace(\/[^A-Za-z0-9]\/g, '');\n        return clean ? clean.substring(0, 6).toUpperCase() : '---';\n    }\n\n    function teamAbbrev(name) {\n        if (typeof window.plpTeamAbbrev === 'function') {\n            return window.plpTeamAbbrev(name);\n        }\n        const clean = String(name || '').replace(\/[^A-Za-z]\/g, '');\n        return clean ? clean.substring(0, 3).toUpperCase() : '---';\n    }\n\n    function fixtureScoreText(fixture) {\n        const status = String(fixture.status || '').toUpperCase();\n        const hasScore = fixture.home_score !== null && fixture.home_score !== undefined\n            && fixture.away_score !== null && fixture.away_score !== undefined;\n\n        if (hasScore) {\n            if (status === 'IN_PLAY' || status === 'PAUSED') {\n                return 'LIVE ' + fixture.home_score + '-' + fixture.away_score;\n            }\n            if (status === 'FINISHED') {\n                return 'FT ' + fixture.home_score + '-' + fixture.away_score;\n            }\n            return fixture.home_score + '-' + fixture.away_score;\n        }\n\n        if (status === 'IN_PLAY' || status === 'PAUSED') {\n            return 'LIVE -';\n        }\n\n        return '-';\n    }\n\n    function renderHomeMatrix(data) {\n        let html = '<table class=\"plp-matrix-table\">';\n\n        html += '<tr><th>Player<\/th>';\n        (data.fixtures || []).forEach(f => {\n            html += '<th>'\n                 + teamAbbrev(f.home_team) + ' v ' + teamAbbrev(f.away_team)\n                 + '<br><span class=\"plp-fixture-live-score\">' + fixtureScoreText(f) + '<\/span>'\n                 + '<\/th>';\n        });\n        html += '<th>Total<\/th><\/tr>';\n\n        (data.players || []).forEach(p => {\n            const isLeader = (data.leaders || []).indexOf(p.player_id) !== -1;\n            html += '<tr class=\"' + (isLeader ? 'plp-leader-row' : '') + '\">';\n            html += '<td>' + playerAbbrev(p.team_name) + '<\/td>';\n\n            (data.fixtures || []).forEach(f => {\n                const pr = p.predictions && p.predictions[f.id] ? p.predictions[f.id] : null;\n                if (!pr) {\n                    html += '<td class=\"plp-empty\">-<\/td>';\n                } else {\n                    html += '<td class=\"plp-points-' + pr.points + '\">'\n                         + pr.home_pred + '-' + pr.away_pred\n                         + '<br><span class=\"plp-points\">' + pr.points + '<\/span>'\n                         + '<\/td>';\n                }\n            });\n\n            html += '<td class=\"plp-total\">' + (p.total_points || 0) + '<\/td><\/tr>';\n        });\n\n        html += '<\/table>';\n        $('#plp-home-matrix-container').html(html);\n    }\n\n    function loadHomeMatrix() {\n        if (!$('#plp-home-matrix-container').length) return;\n        $.post(plp_ajax.url, {\n            action: 'plp_get_matrix',\n            _ajax_nonce: plp_ajax.nonce\n        }, function(res){\n            if (res.success) {\n                renderHomeMatrix(res.data);\n            }\n        });\n    }\n\n    $('#plp-home-logout-btn').on('click', function(){\n        $.post(plp_ajax.url, {\n            action: 'plp_logout',\n            _ajax_nonce: plp_ajax.nonce\n        }, function(res){\n            if (res.success) {\n                window.location.href = 'https:\/\/great-euclid.217-154-38-247.plesk.page\/home';\n            } else {\n                alert(res.data && res.data.message ? res.data.message : 'Logout failed');\n            }\n        });\n    });\n\n    $('#plp-home-login-form').on('submit', function(e){\n        e.preventDefault();\n\n        $('#plp-home-login-message').html('<p>Signing in...<\/p>');\n\n        $.post(plp_ajax.url, {\n            action: 'plp_login',\n            _ajax_nonce: plp_ajax.nonce,\n            email: $('input[name=login_email]').val()\n        }, function(res){\n            if (res.success) {\n                $('#plp-home-login-message').html('<p class=\"plp-success\">Success! Redirecting...<\/p>');\n                setTimeout(function(){\n                    window.location.href = 'https:\/\/great-euclid.217-154-38-247.plesk.page\/dashboard';\n                }, 500);\n            } else {\n                $('#plp-home-login-message').html('<p class=\"plp-error\">' + res.data.message + '<\/p>');\n            }\n        });\n    });\n\n    });\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-19","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=\/wp\/v2\/pages\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":0,"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=\/wp\/v2\/pages\/19\/revisions"}],"wp:attachment":[{"href":"https:\/\/great-euclid.217-154-38-247.plesk.page\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}