{"id":10,"date":"2026-08-03T07:45:21","date_gmt":"2026-08-03T07:45:21","guid":{"rendered":"https:\/\/jegold.jejakaemastrading.com\/?page_id=10"},"modified":"2026-08-03T08:37:15","modified_gmt":"2026-08-03T08:37:15","slug":"live-price-update","status":"publish","type":"page","link":"https:\/\/jegold.jejakaemastrading.com\/","title":{"rendered":"Live Price Update"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>\ud83d\udd34 LIVE Gold Prices &#8211; Auto-Updating<\/title>\n    <style>\n        * { margin: 0; padding: 0; box-sizing: border-box; }\n        body {\n            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n            max-width: 1000px;\n            margin: 0 auto;\n            padding: 20px;\n            background: #1a1a2e;\n            color: #eee;\n            line-height: 1.6;\n        }\n        .container {\n            background: rgba(255,255,255,0.05);\n            border-radius: 15px;\n            padding: 30px;\n            box-shadow: 0 8px 32px rgba(0,0,0,0.3);\n        }\n        h1 {\n            text-align: center;\n            background: linear-gradient(45deg, #d4af37, #b8860b);\n            -webkit-background-clip: text;\n            -webkit-text-fill-color: transparent;\n            background-clip: text;\n            margin-bottom: 25px;\n            font-size: 2.5em;\n        }\n        .tael-section {\n            text-align: center;\n            padding: 25px;\n            background: rgba(212, 175, 55, 0.2);\n            border-radius: 12px;\n            margin-bottom: 25px;\n        }\n        .tael-value {\n            font-size: 3em;\n            font-weight: 800;\n            color: #FFD700;\n        }\n        .tael-label {\n            color: #aaa;\n            font-size: 1em;\n            margin-top: 8px;\n        }\n        .prices-table {\n            width: 100%;\n            border-collapse: separate;\n            border-spacing: 0 6px;\n            background: rgba(255,255,255,0.03);\n            border-radius: 10px;\n            overflow: hidden;\n        }\n        .prices-table th, .prices-table td {\n            padding: 14px 18px;\n            text-align: left;\n        }\n        .prices-table th {\n            background: rgba(212, 175, 55, 0.3);\n            color: #d4af37;\n            font-weight: 600;\n            text-transform: uppercase;\n            font-size: 0.85em;\n            letter-spacing: 1px;\n        }\n        .prices-table tr:nth-child(even) { background: rgba(255,255,255,0.05); }\n        .prices-table tr:hover {\n            transform: translateX(3px);\n            box-shadow: 0 4px 15px rgba(212, 175, 55, 0.1);\n            transition: all 0.2s;\n        }\n        .live-indicator {\n            display: inline-block;\n            width: 12px;\n            height: 12px;\n            background: #4CAF50;\n            border-radius: 50%;\n            margin-right: 10px;\n            animation: pulse 1.5s infinite;\n        }\n        @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.2); } }\n        .countdown {\n            text-align: center;\n            margin: 20px 0;\n            padding: 15px;\n            background: rgba(76, 175, 80, 0.2);\n            border-radius: 8px;\n        }\n        .countdown-value { font-size: 2em; font-weight: 700; color: #4CAF50; }\n        .status {\n            color: #888;\n            margin-top: 15px;\n            text-align: center;\n        }\n        .loading { text-align: center; padding: 20px; color: #666; }\n        .error {\n            background: rgba(255,107,107,0.2);\n            color: #ff6b6b;\n            padding: 15px;\n            border-radius: 8px;\n            margin: 15px 0;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"container\">\n        <h1>\ud83d\udd34 LIVE Gold Prices<\/h1>\n        \n        <div class=\"tael-section\">\n            <div class=\"tael-value\">\n                <span class=\"live-indicator\"><\/span>\n                <span id=\"tael-price\">Loading&#8230;<\/span>\n                <sup style=\"font-size:0.4em; opacity:0.7;\">USD\/tael<\/sup>\n            <\/div>\n            <div class=\"tael-label\">Current Tael Price (USD)<\/div>\n        <\/div>\n        \n        <table class=\"prices-table\">\n            <thead>\n                <tr>\n                    <th>Gold Type<\/th>\n<th>Purity\/Description<\/th>\n                    <th style=\"text-align:right;\">Buyback Price (RM)<\/th>\n                <\/tr>\n            <\/thead>\n            <tbody id=\"price-table\">\n                <tr><td colspan=\"3\" class=\"loading\">Loading prices&#8230;<\/td><\/tr>\n            <\/tbody>\n        <\/table>\n        \n        <div class=\"countdown\" id=\"countdown-section\">\n            Next update in: <span id=\"countdown\" class=\"countdown-value\">30<\/span>s\n        <\/div>\n        \n        <div class=\"status\" id=\"status\">\n            <span class=\"live-indicator\"><\/span>\n            Last updated: <span id=\"last-updated\">Connecting&#8230;<\/span>\n        <\/div>\n    <\/div>\n\n    <script>\n        const GOLD_TYPES = [\n            { name: 'Gold 999.9 (24K)', purity: 'Gold bar, Dinar, Coin 99.9%', mult: 1.00 },\n            { name: 'Gold 999 (24K)', purity: 'Pure Gold Jewellery 99%', mult: 0.98 },\n            { name: 'Gold 965 (23.4K)', purity: 'Gold Thailand 96.5%', mult: 0.93 },\n            { name: 'Gold 950 (23K)', purity: 'Gold Thailand 95%', mult: 0.92 },\n            { name: 'Gold 916 (22K)', purity: 'Pure Gold Jewellery 91.6%', mult: 0.90 },\n            { name: 'Gold 875 (21K)', purity: 'Pure Gold Jewellery 87.5%', mult: 0.85 },\n            { name: 'Gold 835 (20K)', purity: 'Pure Gold Jewellery 83.5%', mult: 0.79 },\n            { name: 'Gold Paun', purity: 'Pure Gold Jewellery 79%', mult: 0.75 },\n            { name: 'Gold 750 (18K)', purity: 'Pure Gold Jewellery 75%', mult: 0.69 },\n            { name: 'Gold 585 (14K)', purity: 'Pure Gold Jewellery 58.5%', mult: 0.45 },\n            { name: 'Gold 375 (9K)', purity: 'Pure Gold Jewellery 37.5%', mult: 0.25 }\n        ];\n\n        const API_URL = 'https:\/\/api.oneworksc.com\/buybackemas\/mks-price?tolak=450';\n        const REFRESH_INTERVAL = 30;\n        \n        let countdown = REFRESH_INTERVAL;\n        let countdownTimer = null;\n\n        async function fetchGoldPrice() {\n            try {\n                document.getElementById('price-table').innerHTML = '<tr><td colspan=\"3\" class=\"loading\">Loading prices...<\/td><\/tr>';\n                const response = await fetch(API_URL, { method: 'GET', cache: 'no-store' });\n                const text = await response.text();\n                const lines = text.split('\\n');\n                \n                for (const line of lines) {\n                    if (line.startsWith('data:')) {\n                        const d = JSON.parse(line.substring(5).trim());\n                        if (d.price_tael || d.tael) {\n                            const t = d.tael || d.price_tael;\n                            const ts = d.timestamp || d.ts || new Date().toISOString();\n                            updatePrices(t, ts);\n                            break;\n                        }\n                    }\n                }\n            } catch(e) { handleError(e.message); }\n        }\n\n        function updatePrices(tael, timestamp) {\n            const base = tael \/ 37.8;\n            document.getElementById('tael-price').textContent = tael.toLocaleString();\n            document.getElementById('status').innerHTML = `Last updated: <span class=\"live-indicator\"><\/span>${timestamp}`;\n            \n            document.getElementById('price-table').innerHTML = GOLD_TYPES.map(g => \n                `<tr>\n                    <td>${g.name}<\/td>\n                    <td>${g.purity}<\/td>\n                    <td>RM ${(base * g.mult).toFixed(2)}<\/td>\n                <\/tr>`\n            ).join('');\n            \n            countdown = REFRESH_INTERVAL;\n        }\n\n        function handleError(msg) {\n            document.getElementById('error-box').innerHTML = \n                `<div class=\"error\">\u26a0\ufe0f ${msg} - Retry in ${countdown}s<\/div>`;\n        }\n\n        function updateCountdown() {\n            countdown--;\n            document.getElementById('countdown').textContent = countdown;\n            if (countdown <= 0) { fetchGoldPrice(); }\n        }\n\n        setInterval(updateCountdown, 1000);\n        document.addEventListener('DOMContentLoaded', fetchGoldPrice);\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udd34 LIVE Gold Prices &#8211; Auto-Updating \ud83d\udd34 LIVE Gold Prices Loading&#8230; USD\/tael Current Tael Price (USD) Gold Type Purity\/Description Buyback Price (RM) Loading prices&#8230; Next update in: 30s Last updated: Connecting&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-10","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/pages\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":4,"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions"}],"predecessor-version":[{"id":19,"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions\/19"}],"wp:attachment":[{"href":"https:\/\/jegold.jejakaemastrading.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}