Siteβ―Builder
Editing:
sar-summary-BEFORE_UPDATE_JSON.html
writable 0666
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SAR Summary</title> <style> body { font-family: Arial, sans-serif; padding: 20px; } .sar-summary-container { display: flex; flex-wrap: wrap; align-items: flex-start; } .phone-details { margin-right: 20px; flex: 1; } .phone-details img { max-width: 300px; height: auto; } .phone-details p { margin: 5px 0; } .phone-details a { text-decoration: none; color: #0073aa; } .phone-details a:hover { text-decoration: underline; } .sar-summary-wrapper { flex: 2; display: flex; flex-direction: column; } .sar-summary { font-size: 16px; margin-bottom: 10px; } .sar-summary strong { font-weight: bold; } .button-container { margin-top: 10px; margin-bottom: 10px; } .button-container a { display: inline-block; padding: 10px 15px; margin-right: 10px; background-color: black; color: white; text-decoration: none; border-radius: 5px; font-size: 14px; } .button-container a:hover { background-color: #444; } @media (max-width: 768px) { .sar-summary-container { flex-direction: column; } .phone-details { margin-right: 0; margin-bottom: 20px; } .button-container a { margin-bottom: 10px; } } .sar-ranking-box { background-color: #0044cc; color: #fff; text-align: center; padding: 10px; border-radius: 5px; margin-bottom: 10px; position: relative; } .sar-ranking-box .sar-ranking { font-size: 18px; font-weight: bold; } .sar-ranking-box .sar-value { font-size: 16px; } .sar-ranking-box a { color: #fff; text-decoration: underline; font-size: 20px; font-weight: bold; } .sar-ranking-box .btn { position: absolute; top: 50%; transform: translateY(-50%); background-color: transparent; color: #fff; border: none; font-size: 20px; cursor: pointer; } .sar-ranking-box .btn.prev { left: 10px; } .sar-ranking-box .btn.next { right: 10px; } .sar-table-container { overflow-x: auto; } .sar-table { width: 100%; border-collapse: collapse; } .sar-table th, .sar-table td { border: 1px solid #ddd; padding: 8px; text-align: center; cursor: pointer; } .sar-table th { background-color: #000; color: #fff; font-weight: bold; } .sar-table .highlight { background-color: yellow; } .sar-info { text-align: center; margin-top: 10px; } .sar-info a { color: #0073aa; text-decoration: none; font-weight: bold; } .sar-info a:hover { color: #005a87; } @media (max-width: 600px) { .sar-ranking-box { padding: 5px; font-size: 14px; } .sar-table th, .sar-table td { padding: 4px; font-size: 14px; } .sar-ranking-box .btn { font-size: 16px; } } .blink-yellow { animation: blinkYellow 1s infinite; } @keyframes blinkYellow { 0% { color: white; } 50% { color: yellow; } 100% { color: white; } } .blink-red { animation: blinkRed 1s infinite; } @keyframes blinkRed { 0% { color: white; } 50% { color: red; } 100% { color: white; } } .blink-green { animation: blinkGreen 1s infinite; } @keyframes blinkGreen { 0% { color: white; } 50% { color: green; } 100% { color: white; } } </style> </head> <body> <div class="sar-summary-container"> <div class="phone-details" id="phone-details"></div> <div class="sar-summary-wrapper"> <div id="sar-summary" class="sar-summary"></div> <div id="product-details" class="phone-details"></div> <div class="button-container" id="button-container"></div> </div> </div> <div id="sar-ranking-container"></div> <script> document.addEventListener("DOMContentLoaded", function() { const testPositions = [ 'ushead', 'usbody', 'productspecific', 'simulheadus', 'simulbodyus', 'hotspot' ]; const testPositionNames = { 'ushead': 'Head SAR (Cellular Only)', 'usbody': 'Body SAR (Cellular Only)', 'productspecific': 'Hot Spot SAR (Cellular Only)', 'simulheadus': 'Head SAR (Wi-Fi + Cellular)', 'simulbodyus': 'Body SAR (Wi-Fi + Cellular)', 'hotspot': 'Hot Spot SAR (Wi-Fi + Cellular)' }; const urlParams = new URLSearchParams(window.location.search); const pid = urlParams.get('pid'); const currentPath = window.location.pathname.split('/'); const slug = currentPath[currentPath.length - 2]; fetch('/cache/sar2_cache.json') .then(response => response.json()) .then(phoneData => { const phone = phoneData.find(p => p.post_id == pid || (p.brand + ' ' + p.model).toLowerCase().replace(/ /g, '-') === slug); if (phone) { displayPhoneDetails(phone); displaySARSummary(phone); displayButtons(phone); initializeSARRanking(phone); } else { document.getElementById('sar-summary').innerHTML = '<p>Phone data not found.</p>'; } }); function displayPhoneDetails(phone) { const { brand, model, thumbnail_url, screensize, dimensions, product_permalink, product_title, product_price } = phone; const fullImageUrl = thumbnail_url.replace('-150x150', ''); const phoneDetailsHTML = ` <img src="${fullImageUrl}" alt="${brand} ${model}"> <p><strong>${brand} ${model}</strong></p> <p>Screen Size: ${screensize || 'Coming Soon'}</p> <p>Dimensions: ${dimensions || 'Coming Soon'}</p> `; const productDetailsHTML = ` <p><a href="${product_permalink || 'https://www.rfsafe.com/best-phone-case-for-smartphone-radiation-protection/'}">${product_title || 'QuantaCase'}</a></p> <p>${formatPrice(product_price)}</p> `; document.getElementById('phone-details').innerHTML = phoneDetailsHTML; document.getElementById('product-details').innerHTML = productDetailsHTML; } function displaySARSummary(phone) { const phoneName = `${phone.brand} ${phone.model}`; const fccid = phone.fccid || 'N/A'; const ushead = phone.ushead || 'N/A'; const usbody = phone.usbody || 'N/A'; const productspecific = phone.productspecific || 'N/A'; const simulheadus = phone.simulheadus || 'N/A'; const simulbodyus = phone.simulbodyus || 'N/A'; const hotspot = phone.hotspot || 'N/A'; let summaryHTML = ` <p> <strong>${phoneName} SAR Level Summary: </strong><br><br> The cellular transmission <strong>SAR values for the ${phoneName}</strong> (FCC ID ${fccid}) are <strong>${ushead} W/kg (watts per kilogram) at the head</strong> and <strong>${usbody} W/kg when worn on the body</strong>. `; if (productspecific !== '0.00') { summaryHTML += ` The hotspot/Airplay SAR level is <strong>${productspecific} W/kg</strong>. `; } if (simulheadus !== '0.00') { summaryHTML += ` The simultaneous transmission SAR values for ${phone.model} (cellular plus Wi-Fi) is <strong>${simulheadus} W/kg at the head</strong>, `; } if (simulbodyus !== '0.00') { summaryHTML += `<strong>${simulbodyus} W/kg when worn on the body</strong>, `; } if (hotspot !== '0.00') { summaryHTML += `and <strong>${hotspot} W/kg when used as a hotspot</strong> simultaneously with other transmitters active.<br><hr><br> `; } summaryHTML += '</p>'; document.getElementById('sar-summary').innerHTML = summaryHTML; } function displayButtons(phone) { const pid = phone.post_id; const buttonContainerHTML = ` <a href="phone-radiation-safety-information.html">SAR Safety Tip</a> <a href="/age/?pid=${pid}">Children</a> <a href="/compare-important-specs-first.php?pid=${pid}">Compare Phones</a> `; document.getElementById('button-container').innerHTML = buttonContainerHTML; } function formatPrice(priceString) { const [regularPrice, salePrice] = priceString.split('|'); if (salePrice && !isNaN(salePrice)) { return `<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">$</span>${regularPrice}</bdi></span></del> <ins aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">$</span>${salePrice}</bdi></span></ins>`; } else { return `<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">$</span>${regularPrice}</bdi></span></del> <span class="screen-reader-text">Check Price</span>`; } } function initializeSARRanking(phone) { let currentIndex = 0; const sarData = testPositions.map(testpos => { let rank = 'N/A'; let percent = 'N/A'; if (testpos === 'productspecific') { rank = phone['productspecific_rank'] || 'N/A'; percent = phone['productspecific_percent'] || 'N/A'; } else if (testpos === 'hotspot') { rank = phone['simulhotspot_rank'] || 'N/A'; percent = phone['simulhotspot_percent'] || 'N/A'; } else { rank = phone[`${testpos}_rank`] || 'N/A'; percent = phone[`${testpos}_percent`] || 'N/A'; } return { type: testPositionNames[testpos], link: `/compare-sar-rank.html?test=${testpos}&pid=${phone.post_id}`, rank: rank.replace('.00', ''), percent: percent, value: phone[testpos] || 'N/A' }; }); function updateRankingBox(index) { const data = sarData[index]; const percentValue = parseFloat(data.percent); let blinkClass = 'blink-yellow'; if (percentValue < 25) { blinkClass = 'blink-green'; } else if (percentValue > 75) { blinkClass = 'blink-red'; } const rankingBoxHTML = ` <div class="sar-ranking-box"> <button class="btn prev" onclick="changeRanking(-1)"><<</button> <div class="sar-ranking">${data.type}</div> <div class="sar-value"> <a href="${data.link}" class="${blinkClass}"> <strong>${data.value} W/kg</strong> </a> <a href="${data.link}" class="${blinkClass}"> <span class="rank-highlight">Ranked #<span class="rank-value">${data.rank}</span> (${data.percent}% of limit)</span> </a> </div> <button class="btn next" onclick="changeRanking(1)">>></button> </div> <div class="sar-table-container"> <table class="sar-table"> <thead> <tr> <th>Radiation Levels</th> <th>Head</th> <th>Body</th> <th>Hot Spot</th> </tr> </thead> <tbody> <tr> <td>Cellular Only</td> <td class="${data.type === 'Head SAR (Cellular Only)' ? 'highlight' : ''}" data-testpos="ushead">${phone.ushead} W/kg</td> <td class="${data.type === 'Body SAR (Cellular Only)' ? 'highlight' : ''}" data-testpos="usbody">${phone.usbody} W/kg</td> <td class="${data.type === 'Hot Spot SAR (Cellular Only)' ? 'highlight' : ''}" data-testpos="productspecific">${phone.productspecific} W/kg</td> </tr> <tr> <td>Wi-Fi + Cellular</td> <td class="${data.type === 'Head SAR (Wi-Fi + Cellular)' ? 'highlight' : ''}" data-testpos="simulheadus">${phone.simulheadus} W/kg</td> <td class="${data.type === 'Body SAR (Wi-Fi + Cellular)' ? 'highlight' : ''}" data-testpos="simulbodyus">${phone.simulbodyus} W/kg</td> <td class="${data.type === 'Hot Spot SAR (Wi-Fi + Cellular)' ? 'highlight' : ''}" data-testpos="hotspot">${phone.hotspot} W/kg</td> </tr> </tbody> </table> </div> `; document.getElementById('sar-ranking-container').innerHTML = rankingBoxHTML; attachClickHandlers(); } function attachClickHandlers() { const cells = document.querySelectorAll('.sar-table td'); cells.forEach(cell => { cell.addEventListener('click', function () { const testpos = this.getAttribute('data-testpos'); const index = testPositions.indexOf(testpos); if (index !== -1) { changeRanking(index - currentIndex); } }); }); } window.changeRanking = function (direction) { currentIndex = (currentIndex + direction + sarData.length) % sarData.length; updateRankingBox(currentIndex); }; updateRankingBox(currentIndex); } }); </script> </body> </html>
Save changes
Create folder
writable 0777
Create
Cancel