This commit is contained in:
Logen
2025-03-21 03:54:35 -04:00
parent e20ee5031b
commit 41b4fd652f
4 changed files with 13 additions and 51 deletions

View File

@@ -53,6 +53,7 @@ body {
margin: auto; margin: auto;
padding: 10px; padding: 10px;
padding-top: 10px;
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
background: var(--container-background); background: var(--container-background);
@@ -64,6 +65,7 @@ body {
@media (max-width: 768px) { @media (max-width: 768px) {
.container { .container {
max-width: 96%; /* Full width for mobile */ max-width: 96%; /* Full width for mobile */
padding-top: 10px;
} }
} }

View File

@@ -1,43 +1,3 @@
// Fetch Bitcoin Price, Percentage Change, and Block Time
async function fetchBitcoinData() {
try {
// Fetch Bitcoin price and percentage change from CoinDesk API
const priceResponse = await fetch('https://api.coindesk.com/v1/bpi/currentprice.json');
if (!priceResponse.ok) {
throw new Error('Failed to fetch Bitcoin price');
}
const priceData = await priceResponse.json();
const price = parseFloat(priceData.bpi.USD.rate.replace(',', '')); // Remove commas
const percentageChange = Math.random() * 4 - 2; // Mock % change as CoinDesk doesn't provide it
const updatedAt = new Date(priceData.time.updatedISO).toLocaleString();
// Fetch block height (Mocked API)
const blockResponse = await fetch('https://mempool.space/api/blocks/tip/height');
if (!blockResponse.ok) {
throw new Error('Failed to fetch block height');
}
const blockHeight = await blockResponse.json();
// Update the banner
const banner = document.getElementById('btc-price-banner');
banner.innerHTML = `
<strong>$${price.toFixed(2)}</strong>
<span style="color: ${percentageChange >= 0 ? 'green' : 'red'};">
${percentageChange >= 0 ? '⬆' : '⬇'} ${percentageChange.toFixed(2)}%
</span>
| Block #${blockHeight}
`;
} catch (error) {
console.error('Error fetching Bitcoin data:', error);
document.getElementById('btc-price-banner').textContent = 'Unable to fetch Bitcoin data.';
}
}
// Refresh Bitcoin data every 60 seconds
fetchBitcoinData();
setInterval(fetchBitcoinData, 60000);
// Folder Toggle Function // Folder Toggle Function
function toggleFolder(folderId, buttonId) { function toggleFolder(folderId, buttonId) {
const folder = document.getElementById(folderId); const folder = document.getElementById(folderId);

View File

@@ -3,8 +3,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BTCforPlebs</title> <title>BTCforPlebs</title>
<!-- Meta Description --> <!-- Meta Description -->
<meta name="description" content="BTCforPlebs is a resource to help ordinary people learn about Bitcoin. Explore guides, tools, and resources to start your Bitcoin journey."> <meta name="description" content="BTCforPlebs is a resource to help ordinary people learn about Bitcoin. Explore guides, tools, and resources to start your Bitcoin journey.">
<!-- Open Graph Meta Tags --> <!-- Open Graph Meta Tags -->
<meta property="og:title" content="BTCforPlebs"> <meta property="og:title" content="BTCforPlebs">
@@ -18,14 +18,14 @@
<!-- scripts --> <!-- scripts -->
<script src="/assets/js/scripts.js" defer></script> <script src="/assets/js/scripts.js" defer></script>
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" rel="stylesheet">
</head> </head>
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" rel="stylesheet">
<body> <body>
<!-- Bitcoin Price Banner --> <!-- Bitcoin Price Banner -->
<div id="btc-price-banner">Bitcoin price loading...</div>
<div class="container"> <div class="container">
<h1>Welcome to BTCforPlebs</h1> <h1>Welcome to BTCforPlebs</h1>
@@ -57,7 +57,7 @@
<iframe <iframe
src="https://live.btcforplebs.com/embed/video" src="https://live.btcforplebs.com/embed/video"
title="BTCforPlebs Live" title="BTCforPlebs Live"
height="350px" width="550px" height="350px" width="100%"
referrerpolicy="origin" referrerpolicy="origin"
frameborder="0" allowfullscreen autoplay> frameborder="0" allowfullscreen autoplay>
</iframe> </iframe>

View File

@@ -7,25 +7,25 @@
<priority>1.0</priority> <priority>1.0</priority>
</url> </url>
<url> <url>
<loc>https://btcforplebs.com/learn-bitcoin.html</loc> <loc>https://btcforplebs.com/learn-bitcoin</loc>
<lastmod>2024-11-19</lastmod> <lastmod>2024-11-19</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url> <url>
<loc>https://btcforplebs.com/learn-bitcoin/nodes.html</loc> <loc>https://btcforplebs.com/learn-bitcoin/nodes</loc>
<lastmod>2024-11-19</lastmod> <lastmod>2024-11-19</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url> <url>
<loc>https://btcforplebs.com/learn-nostr.html</loc> <loc>https://btcforplebs.com/learn-nostr</loc>
<lastmod>2024-11-19</lastmod> <lastmod>2024-11-19</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url> <url>
<loc>https://btcforplebs.com/learn-bitcoin/wallets.html</loc> <loc>https://btcforplebs.com/learn-bitcoin/wallets</loc>
<lastmod>2024-11-19</lastmod> <lastmod>2024-11-19</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>