{"id":3298,"date":"2026-04-14T10:08:20","date_gmt":"2026-04-14T10:08:20","guid":{"rendered":"https:\/\/ev.clinic\/?page_id=3298"},"modified":"2026-04-14T10:10:51","modified_gmt":"2026-04-14T10:10:51","slug":"3298-2","status":"publish","type":"page","link":"https:\/\/ev.clinic\/index.php\/3298-2\/","title":{"rendered":"TEST UNLOCK TSLA"},"content":{"rendered":"\n        <style>\n        .tesla-unlock-container {\n            max-width: 600px;\n            margin: 0 auto;\n            padding: 20px;\n            font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n        }\n        \n        .tesla-unlock-header {\n            text-align: center;\n            margin-bottom: 30px;\n            padding: 25px;\n            background: linear-gradient(135deg, #cc0000 0%, #990000 100%);\n            color: white;\n            border-radius: 12px;\n            box-shadow: 0 4px 15px rgba(204, 0, 0, 0.3);\n        }\n        \n        .tesla-unlock-header h2 {\n            margin: 0 0 10px 0;\n            font-size: 1.8em;\n            font-weight: 600;\n        }\n        \n        .tesla-unlock-header p {\n            margin: 0;\n            opacity: 0.9;\n            font-size: 1em;\n        }\n        \n        .tesla-wallet-container {\n            display: grid;\n            grid-template-columns: 1fr 1fr;\n            gap: 15px;\n            margin-bottom: 25px;\n        }\n        \n        @media (max-width: 600px) {\n            .tesla-wallet-container {\n                grid-template-columns: 1fr;\n            }\n        }\n        \n        .tesla-wallet-section {\n            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);\n            color: white;\n            padding: 20px;\n            border-radius: 10px;\n            text-align: center;\n        }\n        \n        .tesla-buy-tokens-section {\n            background: linear-gradient(135deg, #007cba 0%, #0073aa 100%);\n            color: white;\n            padding: 20px;\n            border-radius: 10px;\n            text-align: center;\n            text-decoration: none;\n            display: flex;\n            flex-direction: column;\n            justify-content: center;\n            transition: all 0.3s ease;\n        }\n        \n        .tesla-buy-tokens-section:hover {\n            transform: translateY(-2px);\n            box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);\n            color: white;\n            text-decoration: none;\n        }\n        \n        .tesla-wallet-value {\n            font-size: 2em;\n            font-weight: bold;\n            margin-bottom: 5px;\n        }\n        \n        .tesla-wallet-label {\n            font-size: 0.95em;\n            opacity: 0.9;\n        }\n        \n        .tesla-form-section {\n            background: white;\n            padding: 30px;\n            border-radius: 12px;\n            box-shadow: 0 4px 20px rgba(0,0,0,0.1);\n            margin-bottom: 25px;\n        }\n        \n        .tesla-form-group {\n            margin-bottom: 20px;\n        }\n        \n        .tesla-form-group label {\n            display: block;\n            margin-bottom: 8px;\n            font-weight: 600;\n            color: #333;\n            font-size: 1.05em;\n        }\n        \n        .tesla-form-group input {\n            width: 100%;\n            padding: 14px 16px;\n            border: 2px solid #e0e0e0;\n            border-radius: 8px;\n            font-size: 1.1em;\n            font-family: \"Consolas\", \"Monaco\", monospace;\n            transition: border-color 0.3s ease, box-shadow 0.3s ease;\n            box-sizing: border-box;\n        }\n        \n        #tesla-vin {\n            text-transform: uppercase;\n        }\n        \n        .tesla-form-group input:focus {\n            outline: none;\n            border-color: #cc0000;\n            box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);\n        }\n        \n        .tesla-form-group input::placeholder {\n            text-transform: none;\n            color: #aaa;\n        }\n        \n        .tesla-form-hint {\n            font-size: 0.85em;\n            color: #666;\n            margin-top: 5px;\n        }\n        \n        .tesla-btn {\n            display: inline-block;\n            padding: 14px 28px;\n            border: none;\n            border-radius: 8px;\n            font-size: 1.1em;\n            font-weight: 600;\n            cursor: pointer;\n            transition: all 0.3s ease;\n            text-decoration: none;\n            text-align: center;\n        }\n        \n        .tesla-btn-calculate {\n            background: linear-gradient(135deg, #cc0000 0%, #990000 100%);\n            color: white;\n            width: 100%;\n            margin-bottom: 15px;\n        }\n        \n        .tesla-btn-calculate:hover:not(:disabled) {\n            transform: translateY(-2px);\n            box-shadow: 0 6px 20px rgba(204, 0, 0, 0.4);\n        }\n        \n        .tesla-btn-calculate:disabled {\n            background: #ccc;\n            cursor: not-allowed;\n            transform: none;\n            box-shadow: none;\n        }\n        \n        .tesla-btn-unlock-diag {\n            background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);\n            color: white;\n            width: 100%;\n            margin-top: 15px;\n            display: none;\n        }\n        \n        .tesla-btn-unlock-diag:hover:not(:disabled) {\n            transform: translateY(-2px);\n            box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);\n        }\n        \n        .tesla-btn-unlock-diag.active {\n            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);\n            animation: pulse 2s infinite;\n        }\n        \n        .tesla-btn-unlock-diag.active:hover {\n            box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);\n        }\n        \n        @keyframes pulse {\n            0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }\n            50% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }\n        }\n        \n        .tesla-result-section {\n            display: none;\n            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);\n            padding: 25px;\n            border-radius: 12px;\n            margin-top: 25px;\n            border: 2px solid #28a745;\n        }\n        \n        .tesla-result-section.show {\n            display: block;\n        }\n        \n        .tesla-result-title {\n            text-align: center;\n            color: #28a745;\n            margin-bottom: 20px;\n            font-size: 1.2em;\n        }\n        \n        .tesla-token-display {\n            background: #1a1a2e;\n            color: #00ff88;\n            padding: 20px;\n            border-radius: 8px;\n            text-align: center;\n            font-family: \"Consolas\", \"Monaco\", monospace;\n            font-size: 1.8em;\n            letter-spacing: 3px;\n            margin-bottom: 20px;\n            word-break: break-all;\n            user-select: all;\n            cursor: pointer;\n            transition: all 0.3s ease;\n            text-transform: lowercase;\n        }\n        \n        .tesla-token-display:hover {\n            background: #2a2a4e;\n        }\n        \n        .tesla-token-parts {\n            display: grid;\n            grid-template-columns: 1fr 1fr;\n            gap: 15px;\n            margin-bottom: 20px;\n        }\n        \n        .tesla-token-part {\n            background: white;\n            padding: 15px;\n            border-radius: 8px;\n            text-align: center;\n            border: 1px solid #ddd;\n        }\n        \n        .tesla-token-part-label {\n            font-size: 0.85em;\n            color: #666;\n            margin-bottom: 5px;\n        }\n        \n        .tesla-token-part-value {\n            font-family: \"Consolas\", \"Monaco\", monospace;\n            font-size: 1.3em;\n            font-weight: bold;\n            color: #333;\n        }\n        \n        .tesla-copy-btn {\n            background: #007bff;\n            color: white;\n            border: none;\n            padding: 10px 20px;\n            border-radius: 6px;\n            cursor: pointer;\n            font-size: 0.95em;\n            transition: all 0.3s ease;\n            margin-right: 10px;\n        }\n        \n        .tesla-copy-btn:hover {\n            background: #0056b3;\n        }\n        \n        .tesla-udp-status {\n            margin-top: 15px;\n            padding: 12px;\n            border-radius: 6px;\n            text-align: center;\n            font-size: 0.95em;\n            display: none;\n        }\n        \n        .tesla-udp-status.sending {\n            display: block;\n            background: #d4edda;\n            color: #155724;\n            border: 1px solid #c3e6cb;\n        }\n        \n        .tesla-udp-status.error {\n            display: block;\n            background: #f8d7da;\n            color: #721c24;\n            border: 1px solid #f5c6cb;\n        }\n        \n        .tesla-insufficient-funds {\n            background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);\n            color: white;\n            padding: 15px;\n            border-radius: 8px;\n            text-align: center;\n            margin-bottom: 20px;\n        }\n        \n        .tesla-login-required {\n            background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);\n            color: #212529;\n            padding: 20px;\n            border-radius: 8px;\n            text-align: center;\n            margin-bottom: 20px;\n            font-weight: 500;\n        }\n        \n        .tesla-spinner {\n            display: inline-block;\n            width: 20px;\n            height: 20px;\n            border: 3px solid rgba(255,255,255,0.3);\n            border-radius: 50%;\n            border-top-color: white;\n            animation: spin 1s linear infinite;\n            margin-right: 10px;\n            vertical-align: middle;\n        }\n        \n        @keyframes spin {\n            to { transform: rotate(360deg); }\n        }\n        \n        .tesla-helper-info {\n            background: #fff3cd;\n            border: 1px solid #ffc107;\n            color: #856404;\n            padding: 15px;\n            border-radius: 8px;\n            margin-top: 15px;\n            font-size: 0.9em;\n        }\n        \n        .tesla-helper-info a {\n            color: #533f03;\n            font-weight: bold;\n        }\n        <\/style>        \n        <div class=\"tesla-unlock-container\">\n            <div class=\"tesla-unlock-header\">\n                <h2>\ud83d\udd13 Tesla Unlock<\/h2>\n                <p>Calculate unlock token from TOKEN1 and VIN<\/p>\n            <\/div>\n            \n                            <div class=\"tesla-login-required\">\n                    \u26a0\ufe0f Please <a href=\"https:\/\/ev.clinic\/wp-login.php?redirect_to=https%3A%2F%2Fev.clinic%2Findex.php%2F3298-2%2F\">log in<\/a> to use this calculator.\n                <\/div>\n                        \n            <div class=\"tesla-wallet-container\">\n                <div class=\"tesla-wallet-section\">\n                    <div class=\"tesla-wallet-value\" id=\"tesla-available-tokens\">\n                        --                    <\/div>\n                    <div class=\"tesla-wallet-label\">Available EVC Tokens<\/div>\n                <\/div>\n                <a href=\"\/shop\/\" class=\"tesla-buy-tokens-section\">\n                    <div class=\"tesla-wallet-value\">\ud83d\uded2<\/div>\n                    <div class=\"tesla-wallet-label\">Buy More Tokens<\/div>\n                <\/a>\n            <\/div>\n            \n            <div class=\"tesla-form-section\">\n                <form id=\"tesla-unlock-form\">\n                    <input type=\"hidden\" name=\"nonce\" value=\"8225fb44f8\">\n                    <input type=\"hidden\" name=\"price\" value=\"0\">\n                    \n                    <div class=\"tesla-form-group\">\n                        <label for=\"tesla-token1\">\ud83d\udd11 TOKEN1<\/label>\n                        <input type=\"text\" \n                               id=\"tesla-token1\" \n                               name=\"token1\" \n                               placeholder=\"Enter TOKEN1 from inverter\"\n                               maxlength=\"32\"\n                               required\n                               disabled>\n                        <div class=\"tesla-form-hint\">tesla1 code read from Tesla MCU or using EVC method from manual.<\/div>\n                    <\/div>\n                    \n                    <div class=\"tesla-form-group\">\n                        <label for=\"tesla-vin\">\ud83d\ude97 VIN Number<\/label>\n                        <input type=\"text\" \n                               id=\"tesla-vin\" \n                               name=\"vin\" \n                               placeholder=\"Enter 17-character VIN\"\n                               maxlength=\"17\"\n                               required\n                               disabled>\n                        <div class=\"tesla-form-hint\">Vehicle Identification Number (exactly 17 characters)<\/div>\n                    <\/div>\n                    \n                    <button type=\"submit\" \n                            class=\"tesla-btn tesla-btn-calculate\" \n                            id=\"tesla-calculate-btn\"\n                            disabled>\n                        \ud83d\udd10 Calculate Unlock Token (0.0 EVC Token)\n                    <\/button>\n                <\/form>\n                \n                <div class=\"tesla-result-section\" id=\"tesla-result-section\">\n                    <div class=\"tesla-result-title\">\u2705 Unlock Token Generated Successfully!<\/div>\n                    \n                    <div class=\"tesla-token-display\" id=\"tesla-unlock-token\" title=\"Click to copy\">\n                        ----------------\n                    <\/div>\n                    \n                    <div class=\"tesla-token-parts\">\n                        <div class=\"tesla-token-part\">\n                            <div class=\"tesla-token-part-label\">DIAG KEY<\/div>\n                            <div class=\"tesla-token-part-value\" id=\"tesla-token1-part1\">----<\/div>\n                        <\/div>\n                        <div class=\"tesla-token-part\">\n                            <div class=\"tesla-token-part-label\">DEV KEY<\/div>\n                            <div class=\"tesla-token-part-value\" id=\"tesla-token1-part2\">----<\/div>\n                        <\/div>\n                    <\/div>\n                    \n                    <div style=\"text-align: center;\">\n                        <button type=\"button\" class=\"tesla-copy-btn\" id=\"tesla-copy-btn\">\ud83d\udccb Copy Token<\/button>\n                    <\/div>\n                    \n                    <button type=\"button\" \n                            class=\"tesla-btn tesla-btn-unlock-diag\" \n                            id=\"tesla-unlock-diag-btn\"\n                            style=\"display: none;\">\n                        \ud83d\udce1 Unlock Diag - Start UDP Broadcast\n                    <\/button>\n                    \n                    <div class=\"tesla-udp-status\" id=\"tesla-udp-status\"><\/div>\n                    \n                    <div class=\"tesla-helper-info\">\n                        <strong>\ud83d\udca1 UDP Broadcast:<\/strong> To send the unlock token via UDP to your local network,\n                        you need the <a href=\"https:\/\/ev.clinic\/wp-content\/plugins\/tesla-unlock-calculator\/helper\/TeslaUnlockHelper.exe\" download>Tesla Unlock Helper<\/a> \n                        application running on your PC. The helper listens on port 8765 \n                        and broadcasts to 192.168.90.255:18466                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n        \n        <script>\n        jQuery(document).ready(function($) {\n            var unlockToken = '';\n            var udpInterval = null;\n            var helperPort = 8765;\n            var udpPort = 18466;\n            var udpAddress = '192.168.90.255';\n            var udpTimerMs = 5000;\n            \n            \/\/ Form submission - ONLY calculates token\n            $('#tesla-unlock-form').on('submit', function(e) {\n                e.preventDefault();\n                \n                var $btn = $('#tesla-calculate-btn');\n                var $form = $(this);\n                \n                $btn.prop('disabled', true).html('<span class=\"tesla-spinner\"><\/span> Calculating...');\n                \n                $.ajax({\n                    url: 'https:\/\/ev.clinic\/wp-admin\/admin-ajax.php',\n                    type: 'POST',\n                    data: {\n                        action: 'tesla_calculate_token',\n                        nonce: $form.find('[name=\"nonce\"]').val(),\n                        token1: $('#tesla-token1').val(),\n                        vin: $('#tesla-vin').val().toUpperCase(),\n                        price: $form.find('[name=\"price\"]').val()\n                    },\n                    success: function(response) {\n                        if (response.success) {\n                            unlockToken = response.data.unlock_token.toLowerCase();\n                            \n                            $('#tesla-unlock-token').text(unlockToken);\n                            $('#tesla-token1-part1').text(response.data.token1_part1 || '----');\n                            $('#tesla-token1-part2').text(response.data.token1_part2 || '----');\n                            $('#tesla-available-tokens').text(parseFloat(response.data.new_balance).toFixed(1));\n                            \n                            $('#tesla-result-section').addClass('show');\n                            $('#tesla-unlock-diag-btn').show(); \/\/ Show Unlock Diag button\n                            \n                            $btn.html('\ud83d\udd10 Calculate Another Token (0.0 EVC Token)');\n                        } else {\n                            alert(response.data.message || 'Error calculating token');\n                            $btn.html('\ud83d\udd10 Calculate Unlock Token (0.0 EVC Token)');\n                        }\n                        $btn.prop('disabled', false);\n                    },\n                    error: function() {\n                        alert('Server error. Please try again.');\n                        $btn.prop('disabled', false).html('\ud83d\udd10 Calculate Unlock Token (0.0 EVC Token)');\n                    }\n                });\n            });\n            \n            \/\/ Copy token\n            $('#tesla-copy-btn, #tesla-unlock-token').on('click', function() {\n                if (!unlockToken) return;\n                \n                navigator.clipboard.writeText(unlockToken).then(function() {\n                    var $btn = $('#tesla-copy-btn');\n                    $btn.text('\u2705 Copied!');\n                    setTimeout(function() {\n                        $btn.text('\ud83d\udccb Copy Token');\n                    }, 2000);\n                }).catch(function() {\n                    \/\/ Fallback\n                    var $temp = $('<input>');\n                    $('body').append($temp);\n                    $temp.val(unlockToken).select();\n                    document.execCommand('copy');\n                    $temp.remove();\n                    \n                    $('#tesla-copy-btn').text('\u2705 Copied!');\n                    setTimeout(function() {\n                        $('#tesla-copy-btn').text('\ud83d\udccb Copy Token');\n                    }, 2000);\n                });\n            });\n            \n            \/\/ Unlock Diag button - starts\/stops UDP broadcast\n            $('#tesla-unlock-diag-btn').on('click', function() {\n                var $btn = $(this);\n                var $status = $('#tesla-udp-status');\n                \n                if ($btn.hasClass('active')) {\n                    \/\/ Stop broadcasting\n                    if (udpInterval) {\n                        clearInterval(udpInterval);\n                        udpInterval = null;\n                    }\n                    $btn.removeClass('active').html('\ud83d\udce1 Unlock Diag - Start UDP Broadcast');\n                    $status.removeClass('sending error').hide();\n                } else {\n                    \/\/ Start broadcasting\n                    $btn.addClass('active').html('\ud83d\uded1 Stop UDP Broadcast');\n                    sendUdpBroadcast(); \/\/ Send immediately\n                    udpInterval = setInterval(sendUdpBroadcast, udpTimerMs);\n                }\n            });\n            \n            function sendUdpBroadcast() {\n                var $status = $('#tesla-udp-status');\n                \n                $.ajax({\n                    url: 'http:\/\/127.0.0.1:' + helperPort + '\/broadcast',\n                    type: 'POST',\n                    contentType: 'application\/json',\n                    data: JSON.stringify({\n                        message: 'key ' + unlockToken + '\\n',\n                        address: udpAddress,\n                        port: udpPort\n                    }),\n                    timeout: 2000,\n                    success: function() {\n                        $status.removeClass('error').addClass('sending')\n                               .html('\ud83d\udce1 Broadcasting: <strong>key ' + unlockToken + '<\/strong> every ' + (udpTimerMs\/1000) + 's')\n                               .show();\n                    },\n                    error: function() {\n                        $status.removeClass('sending').addClass('error')\n                               .html('\u26a0\ufe0f Helper app not running. Please start TeslaUnlockHelper on your PC.')\n                               .show();\n                    }\n                });\n            }\n            \n            \/\/ Auto uppercase only for VIN (TOKEN1 stays as entered)\n            $('#tesla-vin').on('input', function() {\n                this.value = this.value.toUpperCase();\n            });\n            \n            \/\/ VIN validation feedback\n            $('#tesla-vin').on('input', function() {\n                var len = this.value.length;\n                var $hint = $(this).siblings('.tesla-form-hint');\n                if (len > 0 && len < 17) {\n                    $hint.html('VIN: ' + len + '\/17 characters').css('color', '#dc3545');\n                } else if (len === 17) {\n                    $hint.html('\u2705 VIN: 17\/17 characters').css('color', '#28a745');\n                } else {\n                    $hint.html('Vehicle Identification Number (exactly 17 characters)').css('color', '#666');\n                }\n            });\n        });\n        <\/script>\n        \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-3298","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/pages\/3298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/comments?post=3298"}],"version-history":[{"count":2,"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/pages\/3298\/revisions"}],"predecessor-version":[{"id":3300,"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/pages\/3298\/revisions\/3300"}],"wp:attachment":[{"href":"https:\/\/ev.clinic\/index.php\/wp-json\/wp\/v2\/media?parent=3298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}