Merge pull request #3 from btcforplebs/vite

not vite
This commit is contained in:
Logen
2025-09-25 11:31:14 -04:00
committed by GitHub
5 changed files with 82 additions and 67 deletions

View File

@@ -1,31 +1,31 @@
// Folder Toggle Function
function toggleFolder(folderId, buttonId) {
document.addEventListener('DOMContentLoaded', () => {
function toggleFolder(folderId, buttonId) {
const folder = document.getElementById(folderId);
const button = document.getElementById(buttonId);
// Close other folders and deactivate buttons
document.querySelectorAll('.links').forEach(link => {
if (link.id !== folderId) {
link.style.display = 'none';
}
if (link.id !== folderId) {
link.style.display = 'none';
}
});
document.querySelectorAll('.button').forEach(btn => {
if (btn.id !== buttonId) {
btn.classList.remove('active');
}
if (btn.id !== buttonId) {
btn.classList.remove('active');
}
});
// Toggle the selected folder
if (folder.style.display === 'block') {
folder.style.display = 'none';
button.classList.remove('active');
folder.style.display = 'none';
button.classList.remove('active');
} else {
folder.style.display = 'block';
button.classList.add('active');
folder.style.display = 'block';
button.classList.add('active');
}
}
// Section Navigation Function
function navigateToSection(select) {
const sectionId = select.value;
if (sectionId) {
@@ -33,70 +33,73 @@ function navigateToSection(select) {
}
}
// Function to prefetch a URL
function prefetch(url) {
// Function to prefetch a URL
function prefetch(url) {
const link = document.createElement('link');
link.rel = 'prefetch';
link.href = url;
document.head.appendChild(link);
}
// Add event listeners to your links
const links = document.querySelectorAll('a.prefetch');
// Add event listeners to your links
const links = document.querySelectorAll('a.prefetch');
links.forEach(link => {
link.addEventListener('mouseenter', () => {
const url = link.href; // Get the link URL
prefetch(url); // Call prefetch function
const url = link.href; // Get the link URL
prefetch(url); // Call prefetch function
});
});
// Footer Loader and Event Listeners
fetch('/parts/footer.html')
// Footer Loader and Event Listeners
fetch('/parts/footer.html')
.then(response => response.text())
.then(data => {
document.getElementById('footer').innerHTML = data;
// Attach event listeners after footer is loaded
const onChainButton = document.getElementById('onChainButton');
const lightningButton = document.getElementById('lightningButton');
const qrCodes = document.getElementById('qrCodes');
const onChainQRCode = document.getElementById('onChainQRCode');
const lightningQRCode = document.getElementById('lightningQRCode');
// Attach event listeners after footer is loaded
const onChainButton = document.getElementById('onChainButton');
const lightningButton = document.getElementById('lightningButton');
const qrCodes = document.getElementById('qrCodes');
const onChainQRCode = document.getElementById('onChainQRCode');
const lightningQRCode = document.getElementById('lightningQRCode');
// Initially hide the QR codes section
qrCodes.style.display = 'none';
// Initially hide the QR codes section
qrCodes.style.display = 'none';
onChainButton.addEventListener('click', function () {
// Toggle visibility of On-Chain QR Code
const isOnChainVisible = onChainQRCode.style.display === 'block';
qrCodes.style.display = 'block'; // Show QR codes section
onChainQRCode.style.display = isOnChainVisible ? 'none' : 'block'; // Toggle On-Chain
lightningQRCode.style.display = 'none'; // Hide Lightning QR code
});
onChainButton.addEventListener('click', function () {
// Toggle visibility of On-Chain QR Code
const isOnChainVisible = onChainQRCode.style.display === 'block';
qrCodes.style.display = 'block'; // Show QR codes section
onChainQRCode.style.display = isOnChainVisible ? 'none' : 'block'; // Toggle On-Chain
lightningQRCode.style.display = 'none'; // Hide Lightning QR code
});
lightningButton.addEventListener('click', function () {
// Toggle visibility of Lightning QR Code
const isLightningVisible = lightningQRCode.style.display === 'block';
qrCodes.style.display = 'block'; // Show QR codes section
lightningQRCode.style.display = isLightningVisible ? 'none' : 'block'; // Toggle Lightning
onChainQRCode.style.display = 'none'; // Hide On-Chain QR code
});
lightningButton.addEventListener('click', function () {
// Toggle visibility of Lightning QR Code
const isLightningVisible = lightningQRCode.style.display === 'block';
qrCodes.style.display = 'block'; // Show QR codes section
lightningQRCode.style.display = isLightningVisible ? 'none' : 'block'; // Toggle Lightning
onChainQRCode.style.display = 'none'; // Hide On-Chain QR code
});
})
.catch(error => console.error('Error loading footer:', error));
// Fetch the latest commit information from GitHub
fetch('https://api.github.com/repos/btcforplebs/BTCforPlebs.com/commits/main')
.then(response => response.json())
.then(data => {
const lastUpdate = new Date(data.commit.author.date); // Commit date
const formattedDate = lastUpdate.toLocaleDateString();
const formattedTime = lastUpdate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
fetch('https://api.github.com/repos/btcforplebs/BTCforPlebs.com/commits/main')
.then(response => response.json())
.then(data => {
const lastUpdate = new Date(data.commit.author.date); // Commit date
const formattedDate = lastUpdate.toLocaleDateString();
const formattedTime = lastUpdate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
// Update the text content of the last-updated-text element
document.getElementById('last-updated-text').textContent = `Website last updated: ${formattedDate} ${formattedTime}`;
})
.catch(error => {
console.error('Error fetching last update:', error);
document.getElementById('last-updated-text').textContent = 'Last update: Error fetching data.';
});
});
// Update the text content of the last-updated-text element
document.getElementById('last-updated-text').textContent = `Website last updated: ${formattedDate} ${formattedTime}`;
})
.catch(error => {
console.error('Error fetching last update:', error);
document.getElementById('last-updated-text').textContent = 'Last update: Error fetching data.';
});

View File

@@ -20,8 +20,7 @@
<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">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" rel="stylesheet">
</head>
<body>
@@ -42,14 +41,18 @@
<button class="button" id="bitcoin-folder-btn" onclick="toggleFolder('folder2', 'bitcoin-folder-btn')">Use Bitcoin <span style="color: #F7931A;"></span></button>
<div class="links" id="folder2">
<a href="https://lightning.btcforplebs.com" target="_blank" class="prefetch">Lightning</a>
<a href="https://mempool.space" target="_blank" class="prefetch">Mempool</a>
<a href="https://kibo.money" target="_blank" class="prefetch">Charts</a>
<a href="https://mempool.btcforplebs.com" target="_blank" class="prefetch">Mempool</a>
<a href="https://bitview.space/" target="_blank" class="prefetch">Charts</a>
</div>
<button class="button" id="nostr-folder-btn" onclick="toggleFolder('folder1', 'nostr-folder-btn')">Use Nostr <span style="color: #F7931A;"></span></button>
<div class="links" id="folder1">
<a href="https://nostr.btcforplebs.com" target="_blank" class="prefetch">Nostr Client</a>
<a href="https://nostrapps.com" target="_blank">More Nostr Apps</a>
All apps hosted by BTCforPlebs<br></br>
<a href="https://nostrudel.btcforplebs.com" target="_blank" class="prefetch">Nostrudel</a>
<a href="https://nosotros.btcforplebs.com" target="_blank" class="prefetch">Nosotros</a>
<a href="https://bloom.btcforplebs.com" target="_blank" class="prefetch">Bloom</a>
<a href="https://btcforplebs.com/relay" target="_blank" class="prefetch">Relay</a>
<a href="https://nostrapps.com" target="_blank">More</a>
</div>
<button class="button" id="cashu-folder-btn" onclick="toggleFolder('folder3', 'cashu-folder-btn')">Use Cashu <span style="color: #F7931A;"></span></button>
<div class="links" id="folder3">

View File

@@ -5,10 +5,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learn Nostr</title>
<script src='https://www.unpkg.com/nostr-login@latest/dist/unpkg.js'></script>
</head>
<!-- 1⃣ NostrLogin library -->
<script src="https://www.unpkg.com/nostr-login@latest/dist/unpkg.js"></script>
<link rel="stylesheet" href="/assets/css/main.css">
</head>
<body>
<!-- Bitcoin Price Banner -->
@@ -27,14 +29,20 @@
<div class="video-container">
<video controls playsinline width="100%" height="auto" poster="https://img.youtube.com/vi/8aZkg3OQc5c/maxresdefault.jpg">
<source src="https://player.vimeo.com/progressive_redirect/playback/920597331/rendition/1080p/file.mp4?loc=external&log_user=0&signature=679fc1e260d7c0a66c6cb9f5168b4d117e6cc79c2e895ca6c34723066c912687" type="video/mp4">
<source src="https://v.nostr.build/voby1u385n0ZwAbp.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<a href="/index.html" class="button">Home</a>
<a href="/index.html" class="button">Home</a>
</div>
<div id="footer"></div>
<!-- 2⃣ Nostr Tools library -->
<script type="module" src="/assets/js/nostr-tools.js"></script>
</body>
</html>
</html>