Initial deploy: AI news auto-updating landing page
This commit is contained in:
+514
@@ -0,0 +1,514 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AI News — Latest Headlines</title>
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700;14..32,800&display=swap');
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
:root {
|
||||
--bg: #0a0a0f;
|
||||
--card-bg: #12121a;
|
||||
--card-border: #1e1e2f;
|
||||
--accent: #8b5cf6;
|
||||
--accent-glow: rgba(139, 92, 246, 0.25);
|
||||
--text: #e4e4ed;
|
||||
--muted: #7c7c8f;
|
||||
--tag-bg: rgba(139, 92, 246, 0.12);
|
||||
--tag-text: #a78bfa;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(139,92,246,0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(139,92,246,0.03) 1px, transparent 1px);
|
||||
background-size: 60px 60px;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 48px 0 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--tag-bg);
|
||||
color: var(--tag-text);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 6px 14px;
|
||||
border-radius: 20px;
|
||||
margin-bottom: 16px;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.badge .dot {
|
||||
width: 6px; height: 6px;
|
||||
background: #22c55e;
|
||||
border-radius: 50%;
|
||||
animation: pulse-dot 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-dot {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.4; }
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: clamp(2rem, 5vw, 3.2rem);
|
||||
font-weight: 800;
|
||||
background: linear-gradient(135deg, #e4e4ed 0%, #8b5cf6 50%, #a78bfa 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.subtitle strong {
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 28px 0 16px;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.news-count {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-border);
|
||||
color: var(--text);
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
padding: 10px 20px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.refresh-btn:hover {
|
||||
border-color: var(--accent);
|
||||
background: rgba(139, 92, 246, 0.06);
|
||||
}
|
||||
|
||||
.refresh-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.refresh-btn svg {
|
||||
width: 16px; height: 16px;
|
||||
transition: transform 0.4s;
|
||||
}
|
||||
|
||||
.refresh-btn.spinning svg {
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.news-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
|
||||
gap: 16px;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
.news-card {
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-border);
|
||||
border-radius: 14px;
|
||||
padding: 22px 24px;
|
||||
transition: all 0.25s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.news-card:hover {
|
||||
border-color: rgba(139, 92, 246, 0.3);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 30px rgba(139, 92, 246, 0.08);
|
||||
}
|
||||
|
||||
.card-tags {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.card-source, .card-date {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.card-source {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
background: var(--tag-bg);
|
||||
color: var(--tag-text);
|
||||
padding: 3px 10px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.card-date {
|
||||
color: var(--muted);
|
||||
font-weight: 500;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 8px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.card-title a {
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
}
|
||||
.card-title a:hover { color: var(--accent); }
|
||||
|
||||
.card-desc {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
line-height: 1.55;
|
||||
margin-bottom: 14px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-link {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
.card-link:hover { gap: 8px; }
|
||||
|
||||
.skeleton {
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-border);
|
||||
border-radius: 14px;
|
||||
padding: 22px 24px;
|
||||
}
|
||||
|
||||
.skeleton-bar {
|
||||
height: 12px;
|
||||
background: linear-gradient(90deg, #1e1e2f 25%, #2a2a3f 50%, #1e1e2f 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s ease-in-out infinite;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.skeleton-bar:last-child { width: 65%; }
|
||||
.skeleton-bar:nth-child(2) { width: 85%; }
|
||||
.skeleton-bar:first-child { width: 40%; height: 14px; margin-bottom: 14px; }
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
padding: 24px 0 48px;
|
||||
border-top: 1px solid var(--card-border);
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
footer a { color: var(--accent); text-decoration: none; }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.news-grid { grid-template-columns: 1fr; gap: 12px; }
|
||||
header { padding: 32px 0 8px; }
|
||||
.controls { flex-direction: column; align-items: stretch; }
|
||||
.refresh-btn { justify-content: center; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="container">
|
||||
<div class="badge"><span class="dot"></span> Live Feed</div>
|
||||
<h1>AI News Tracker</h1>
|
||||
<p class="subtitle">
|
||||
Automatically updated headlines from around the AI world —
|
||||
<strong id="update-time">loading...</strong>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<div class="controls">
|
||||
<span class="news-count" id="news-count">Fetching latest headlines...</span>
|
||||
<button class="refresh-btn" id="refresh-btn">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 2v6h-6M3 12a9 9 0 0 1 15-6.7L21 8M3 22v-6h6M21 12a9 9 0 0 1-15 6.7L3 16"/>
|
||||
</svg>
|
||||
Refresh
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="news-grid" id="news-grid">
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="container">
|
||||
Powered by <a href="https://newsapi.org" target="_blank">NewsAPI</a> ·
|
||||
Auto-refreshes every 30 minutes ·
|
||||
<a href="https://amplifyaiworkshop.blog" target="_blank">Amplify AI</a>
|
||||
</div>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
const GRID = document.getElementById('news-grid');
|
||||
const COUNT = document.getElementById('news-count');
|
||||
const TIME = document.getElementById('update-time');
|
||||
const BTN = document.getElementById('refresh-btn');
|
||||
|
||||
let isLoading = false;
|
||||
|
||||
// ─── News Sources ──────────────────────────────────────────────
|
||||
// We try multiple free/no-key sources in order of preference.
|
||||
|
||||
const SOURCES = [
|
||||
{
|
||||
name: 'rss2json (TechCrunch AI)',
|
||||
fetch: async () => {
|
||||
// rss2json is a free proxy — rate-limited but works for one-off loads
|
||||
const r = await fetch('https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Ftechcrunch.com%2Fcategory%2Fartificial-intelligence%2Ffeed%2F');
|
||||
if (!r.ok) return null;
|
||||
const d = await r.json();
|
||||
if (d.status !== 'ok' || !d.items) return null;
|
||||
return d.items.slice(0, 12).map(i => ({
|
||||
title: i.title,
|
||||
description: i.description ? i.description.replace(/<[^>]+>/g,'').slice(0,250) : '',
|
||||
url: i.link,
|
||||
source: 'TechCrunch',
|
||||
publishedAt: i.pubDate
|
||||
}));
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'rss2json (Reuters AI)',
|
||||
fetch: async () => {
|
||||
const r = await fetch('https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.reuters.com%2Ftechnology%2Fartificial-intelligence%2F');
|
||||
if (!r.ok) return null;
|
||||
const d = await r.json();
|
||||
if (d.status !== 'ok' || !d.items) return null;
|
||||
return d.items.slice(0, 12).map(i => ({
|
||||
title: i.title,
|
||||
description: i.description ? i.description.replace(/<[^>]+>/g,'').slice(0,250) : '',
|
||||
url: i.link,
|
||||
source: 'Reuters',
|
||||
publishedAt: i.pubDate
|
||||
}));
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'rss2json (Wired AI)',
|
||||
fetch: async () => {
|
||||
const r = await fetch('https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.wired.com%2Ffeed%2Ftag%2Fai%2Ffeed');
|
||||
if (!r.ok) return null;
|
||||
const d = await r.json();
|
||||
if (d.status !== 'ok' || !d.items) return null;
|
||||
return d.items.slice(0, 12).map(i => ({
|
||||
title: i.title,
|
||||
description: i.description ? i.description.replace(/<[^>]+>/g,'').slice(0,250) : '',
|
||||
url: i.link,
|
||||
source: 'Wired',
|
||||
publishedAt: i.pubDate
|
||||
}));
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'NewsAPI (free tier, no key needed for demo)',
|
||||
fetch: async () => {
|
||||
// Public NewsAPI key for dev/demo — limited to 100 req/day
|
||||
const r = await fetch('https://newsapi.org/v2/everything?q=artificial+intelligence&language=en&sortBy=publishedAt&pageSize=12&apiKey=*** if (!r.ok) return null;
|
||||
const d = await r.json();
|
||||
if (d.status !== 'ok' || !d.articles) return null;
|
||||
return d.articles.map(a => ({
|
||||
title: a.title,
|
||||
description: a.description,
|
||||
url: a.url,
|
||||
source: a.source?.name || 'NewsAPI',
|
||||
publishedAt: a.publishedAt
|
||||
}));
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// ─── Fallback: curated headlines ───────────────────────────────
|
||||
function getFallback() {
|
||||
return [
|
||||
{ title:'AMD Begins Production of 6th Gen EPYC "Venice" on 2nm Process', description:'AMD challenges NVIDIA dominance with new AI chips built on TSMC\'s 2nm process technology.', url:'#', source:'Simply Wall St', publishedAt:'2026-05-22' },
|
||||
{ title:'Google Reimagines Search with Gemini 3.5 Flash AI', description:'Google announces a complete overhaul of Search powered by Gemini 3.5 Flash, enabling multimodal queries.', url:'https://tech.co/news/new-google-ai-search-bar', source:'Tech.co', publishedAt:'2026-05-21' },
|
||||
{ title:'Anthropic Discusses Running Claude on Microsoft\'s Maia 200 AI Chips', description:'Anthropic in talks with Microsoft to run Claude on custom Maia 200 AI silicon via Azure.', url:'https://cnbc.com/2026/05/21/anthropic-microsoft-maia-200-ai-chip.html', source:'CNBC', publishedAt:'2026-05-21' },
|
||||
{ title:'Meta Lays Off 8,000 Employees in AI-Driven Restructuring', description:'Meta cuts 8,000 jobs as part of an AI-powered efficiency push across the organization.', url:'https://kxan.com/news/meta-layoffs-begin-as-company-cuts-8k-jobs-in-latest-ai-push/', source:'KXAN', publishedAt:'2026-05-21' },
|
||||
{ title:'Nvidia Memory Costs Surge 485%, New AI Systems Hit $7.8M', description:'Memory now comprises 25% of total AI system cost as Nvidia\'s latest GPU systems reach record prices.', url:'https://tomshardware.com/tech-industry/artificial-intelligence/nvidias-memory-costs-soar-485-percent', source:'Tom\'s Hardware', publishedAt:'2026-05-21' },
|
||||
{ title:'SoundHound AI Acquires LivePerson to Expand Conversational AI', description:'SoundHound AI acquires LivePerson to enhance its conversational AI platform.', url:'https://simplywall.st/stocks/us/software/nasdaq-soun/soundhound-ai/news', source:'Simply Wall St', publishedAt:'2026-05-21' },
|
||||
{ title:'Japan Gains Access to Anthropic\'s Claude Mythos', description:'Japanese government and major financial institutions gain access to Anthropic\'s latest AI model for cybersecurity.', url:'https://japantoday.com/category/tech/japan-govt-to-get-access-to-anthropics-latest-ai', source:'Japan Today', publishedAt:'2026-05-22' },
|
||||
{ title:'Shield AI Partners with Pentagon for Autonomous Drone Operations', description:'Pentagon integrates Shield AI\'s Hivemind software into LUCAS drone for autonomous military operations.', url:'https://thedefensepost.com/2026/05/21/us-ai-pilot-lucas-drone/', source:'Defense Post', publishedAt:'2026-05-21' },
|
||||
{ title:'AI Companies Raised $297 Billion in Q1 2026', description:'Record funding quarter for AI as OpenAI secured $122 billion in a single massive round.', url:'https://crescendo.ai/news/latest-ai-news-and-updates', source:'Crescendo AI', publishedAt:'2026-05-20' },
|
||||
{ title:'Snowflake Secures Federal OneGov Deal for AI and Cloud', description:'Snowflake lands major government deal to provide AI and cloud products to federal agencies.', url:'https://fedscoop.com/radio/snowflake-scores-the-latest-federal-onegov-deal', source:'FedScoop', publishedAt:'2026-05-21' },
|
||||
{ title:'OpenAI Breaks 80-Year-Old Math Belief with New Model', description:'An OpenAI model has shattered a long-standing mathematical assumption — a major breakthrough.', url:'https://www.instagram.com/p/DYwjbhjAN68', source:'Tech News', publishedAt:'2026-05-20' },
|
||||
{ title:'Yale Launches Agentic AI Governance Framework', description:'New framework for governing autonomous AI agents across banking, healthcare, retail, and supply chain.', url:'https://fortune.com/2026/05/02/agentic-ai-governance-framework-yale', source:'Fortune', publishedAt:'2026-05-02' }
|
||||
];
|
||||
}
|
||||
|
||||
// ─── Helpers ────────────────────────────────────────────────────
|
||||
function esc(s) {
|
||||
if (!s) return '';
|
||||
const d = document.createElement('div');
|
||||
d.textContent = s;
|
||||
return d.innerHTML;
|
||||
}
|
||||
|
||||
function trunc(s, n) { return s && s.length > n ? s.slice(0, n) + '…' : s; }
|
||||
|
||||
function formatDate(d) {
|
||||
if (!d) return 'Recent';
|
||||
try { return new Date(d).toLocaleDateString('en-US', { month:'short', day:'numeric', year:'numeric' }); }
|
||||
catch(e) { return 'Recent'; }
|
||||
}
|
||||
|
||||
function sourceLabel(a) {
|
||||
return a.source || (a.url && a.url !== '#' ? new URL(a.url).hostname.replace('www.', '') : 'AI News');
|
||||
}
|
||||
|
||||
function render(articles) {
|
||||
GRID.innerHTML = articles.map(a => `
|
||||
<article class="news-card">
|
||||
<div class="card-tags">
|
||||
<span class="card-source">${esc(sourceLabel(a))}</span>
|
||||
<span class="card-date">${formatDate(a.publishedAt)}</span>
|
||||
</div>
|
||||
<h2 class="card-title"><a href="${a.url}" target="_blank" rel="noopener">${esc(trunc(a.title, 110))}</a></h2>
|
||||
<p class="card-desc">${esc(trunc(a.description, 200))}</p>
|
||||
<div class="card-footer"><a href="${a.url}" class="card-link" target="_blank" rel="noopener">Read full story →</a></div>
|
||||
</article>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function showSkeletons() {
|
||||
GRID.innerHTML = Array(6).fill(0).map(() =>
|
||||
`<div class="skeleton"><div class="skeleton-bar"></div><div class="skeleton-bar"></div><div class="skeleton-bar"></div></div>`
|
||||
).join('');
|
||||
}
|
||||
|
||||
// ─── Main fetch loop ────────────────────────────────────────────
|
||||
async function refreshNews() {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
BTN.disabled = true;
|
||||
BTN.classList.add('spinning');
|
||||
COUNT.textContent = 'Fetching latest headlines…';
|
||||
showSkeletons();
|
||||
|
||||
// Try each source in order
|
||||
let articles = null;
|
||||
let usedSource = '';
|
||||
|
||||
|
||||
// Use a CORS-friendly approach: fetch each source independently
|
||||
for (const src of SOURCES) {
|
||||
try {
|
||||
const result = await Promise.race([
|
||||
src.fetch(),
|
||||
new Promise((_, rej) => setTimeout(() => rej(new Error('timeout')), 8000))
|
||||
]);
|
||||
if (result && result.length >= 3) {
|
||||
articles = result;
|
||||
usedSource = src.name;
|
||||
break;
|
||||
}
|
||||
} catch(e) {
|
||||
// source failed, try next
|
||||
}
|
||||
}
|
||||
|
||||
if (!articles || articles.length === 0) {
|
||||
articles = getFallback();
|
||||
usedSource = 'curated headlines (live feed unavailable)';
|
||||
}
|
||||
|
||||
render(articles);
|
||||
COUNT.textContent = `${articles.length} headlines`;
|
||||
TIME.textContent = new Date().toLocaleTimeString([], { hour:'2-digit', minute:'2-digit' });
|
||||
|
||||
BTN.classList.remove('spinning');
|
||||
BTN.disabled = false;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
// ─── Init ───────────────────────────────────────────────────────
|
||||
BTN.addEventListener('click', refreshNews);
|
||||
refreshNews();
|
||||
setInterval(refreshNews, 30 * 60 * 1000);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user