commit 09930e727594c2a1db31134b2d41cd788613302d
Author: root <root@hub.scroll.pub> Date: 2025-01-04 06:44:34 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..2b41fa9 --- /dev/null +++ b/body.html @@ -0,0 +1,17 @@ +<header> + <h1>NewsFlash</h1> + <p>Your window to the world's most important news</p> + <div class="language-switcher"> + <button id="lang-en" class="active">English</button> + <button id="lang-cn">中文</button> + </div> +</header> + +<main> + <div class="loading">Fetching the latest news...</div> + <div class="news-container" aria-live="polite"></div> +</main> + +<footer> + <p>Stay informed. Stay ahead.</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..870b59c --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://newsflash.scroll.pub +metaTags +editButton /edit.html +title NewsFlash - Global News at Your Fingertips +style.css +body.html +script.js \ No newline at end of file diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..0e18b0a --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "7fcb1548-f54c-4bf8-b8fc-02d3af2e9e58", + "object": "chat.completion", + "created": 1735973055, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\nnewsflash.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://newsflash.scroll.pub\nmetaTags\neditButton /edit.html\ntitle NewsFlash - Global News at Your Fingertips\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>NewsFlash</h1>\n <p>Your window to the world's most important news</p>\n <div class=\"language-switcher\">\n <button id=\"lang-en\" class=\"active\">English</button>\n <button id=\"lang-cn\">中文</button>\n </div>\n</header>\n\n<main>\n <div class=\"loading\">Fetching the latest news...</div>\n <div class=\"news-container\" aria-live=\"polite\"></div>\n</main>\n\n<footer>\n <p>Stay informed. Stay ahead.</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #1a73e8;\n --text-color: #202124;\n --bg-color: #ffffff;\n --border-color: #dadce0;\n --hover-color: #f1f3f4;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n color: var(--text-color);\n background-color: var(--bg-color);\n line-height: 1.6;\n padding: 1rem;\n max-width: 800px;\n margin: 0 auto;\n}\n\nheader {\n text-align: center;\n margin-bottom: 2rem;\n}\n\nh1 {\n color: var(--primary-color);\n font-size: 2.5rem;\n margin-bottom: 0.5rem;\n}\n\n.language-switcher {\n margin-top: 1rem;\n}\n\nbutton {\n background: none;\n border: 1px solid var(--border-color);\n padding: 0.5rem 1rem;\n margin: 0 0.5rem;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n}\n\nbutton.active {\n background-color: var(--primary-color);\n color: white;\n border-color: var(--primary-color);\n}\n\nbutton:hover {\n background-color: var(--hover-color);\n}\n\n.news-container {\n display: grid;\n gap: 1.5rem;\n}\n\n.news-item {\n border: 1px solid var(--border-color);\n border-radius: 8px;\n padding: 1rem;\n transition: transform 0.2s ease;\n}\n\n.news-item:hover {\n transform: translateY(-2px);\n}\n\n.news-title {\n color: var(--primary-color);\n margin-bottom: 0.5rem;\n font-size: 1.2rem;\n}\n\n.news-summary {\n color: var(--text-color);\n margin-bottom: 0.5rem;\n}\n\n.news-link {\n color: var(--primary-color);\n text-decoration: none;\n font-weight: 500;\n}\n\n.news-link::after {\n content: \"→\";\n margin-left: 0.5rem;\n transition: margin 0.2s ease;\n}\n\n.news-link:hover::after {\n margin-left: 1rem;\n}\n\n.loading {\n text-align: center;\n padding: 2rem;\n color: #5f6368;\n}\n\nfooter {\n text-align: center;\n margin-top: 2rem;\n padding: 1rem;\n color: #5f6368;\n}\n\n@media (max-width: 600px) {\n h1 {\n font-size: 2rem;\n }\n \n .news-container {\n gap: 1rem;\n }\n \n .news-item {\n padding: 0.75rem;\n }\n}\n---script.js---\nconst newsContainer = document.querySelector('.news-container');\nconst loading = document.querySelector('.loading');\nconst langEnBtn = document.getElementById('lang-en');\nconst langCnBtn = document.getElementById('lang-cn');\n\nlet currentLanguage = 'en';\n\n// Fetch news from multiple sources\nasync function fetchNews() {\n try {\n // Replace with actual API endpoints\n const response = await fetch('/api/news');\n const data = await response.json();\n displayNews(data);\n } catch (error) {\n console.error('Error fetching news:', error);\n loading.textContent = 'Failed to load news. Please try again later.';\n }\n}\n\nfunction displayNews(newsItems) {\n loading.style.display = 'none';\n newsContainer.innerHTML = newsItems.slice(0, 20).map(item => `\n <article class=\"news-item\">\n <h2 class=\"news-title\">${item.title}</h2>\n <p class=\"news-summary\">${item.summary}</p>\n <a href=\"${item.url}\" class=\"news-link\" target=\"_blank\" rel=\"noopener\">\n Read more\n </a>\n </article>\n `).join('');\n}\n\nfunction translateContent(language) {\n // Implement translation logic here\n // This would involve sending text to a translation API\n // and updating the content accordingly\n console.log(`Switching to ${language}`);\n}\n\nlangEnBtn.addEventListener('click', () => {\n if (currentLanguage !== 'en') {\n currentLanguage = 'en';\n langEnBtn.classList.add('active');\n langCnBtn.classList.remove('active');\n translateContent('en');\n }\n});\n\nlangCnBtn.addEventListener('click', () => {\n if (currentLanguage !== 'cn') {\n currentLanguage = 'cn';\n langCnBtn.classList.add('active');\n langEnBtn.classList.remove('active');\n translateContent('cn');\n }\n});\n\n// Initial load\nfetchNews();\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 275, + "completion_tokens": 1282, + "total_tokens": 1557, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 275 + }, + "system_fingerprint": "fp_3a5770e1b4" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..a6e3c3d --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# newsflash.scroll.pub +Website generated by DeepSeek from prompt: 实时读取全球各大新闻网站重要新闻,以标题、摘要重新组织后显示最新的20条并提供每条新闻的原始链接。提供选项将所有内容以中文或者英文显示(必要时先翻译)。 \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..c86a6dd --- /dev/null +++ b/script.js @@ -0,0 +1,60 @@ +const newsContainer = document.querySelector('.news-container'); +const loading = document.querySelector('.loading'); +const langEnBtn = document.getElementById('lang-en'); +const langCnBtn = document.getElementById('lang-cn'); + +let currentLanguage = 'en'; + +// Fetch news from multiple sources +async function fetchNews() { + try { + // Replace with actual API endpoints + const response = await fetch('/api/news'); + const data = await response.json(); + displayNews(data); + } catch (error) { + console.error('Error fetching news:', error); + loading.textContent = 'Failed to load news. Please try again later.'; + } +} + +function displayNews(newsItems) { + loading.style.display = 'none'; + newsContainer.innerHTML = newsItems.slice(0, 20).map(item => ` + <article class="news-item"> + <h2 class="news-title">${item.title}</h2> + <p class="news-summary">${item.summary}</p> + <a href="${item.url}" class="news-link" target="_blank" rel="noopener"> + Read more + </a> + </article> + `).join(''); +} + +function translateContent(language) { + // Implement translation logic here + // This would involve sending text to a translation API + // and updating the content accordingly + console.log(`Switching to ${language}`); +} + +langEnBtn.addEventListener('click', () => { + if (currentLanguage !== 'en') { + currentLanguage = 'en'; + langEnBtn.classList.add('active'); + langCnBtn.classList.remove('active'); + translateContent('en'); + } +}); + +langCnBtn.addEventListener('click', () => { + if (currentLanguage !== 'cn') { + currentLanguage = 'cn'; + langCnBtn.classList.add('active'); + langEnBtn.classList.remove('active'); + translateContent('cn'); + } +}); + +// Initial load +fetchNews(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..8a8893b --- /dev/null +++ b/style.css @@ -0,0 +1,128 @@ +:root { + --primary-color: #1a73e8; + --text-color: #202124; + --bg-color: #ffffff; + --border-color: #dadce0; + --hover-color: #f1f3f4; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + color: var(--text-color); + background-color: var(--bg-color); + line-height: 1.6; + padding: 1rem; + max-width: 800px; + margin: 0 auto; +} + +header { + text-align: center; + margin-bottom: 2rem; +} + +h1 { + color: var(--primary-color); + font-size: 2.5rem; + margin-bottom: 0.5rem; +} + +.language-switcher { + margin-top: 1rem; +} + +button { + background: none; + border: 1px solid var(--border-color); + padding: 0.5rem 1rem; + margin: 0 0.5rem; + cursor: pointer; + border-radius: 4px; + transition: all 0.2s ease; +} + +button.active { + background-color: var(--primary-color); + color: white; + border-color: var(--primary-color); +} + +button:hover { + background-color: var(--hover-color); +} + +.news-container { + display: grid; + gap: 1.5rem; +} + +.news-item { + border: 1px solid var(--border-color); + border-radius: 8px; + padding: 1rem; + transition: transform 0.2s ease; +} + +.news-item:hover { + transform: translateY(-2px); +} + +.news-title { + color: var(--primary-color); + margin-bottom: 0.5rem; + font-size: 1.2rem; +} + +.news-summary { + color: var(--text-color); + margin-bottom: 0.5rem; +} + +.news-link { + color: var(--primary-color); + text-decoration: none; + font-weight: 500; +} + +.news-link::after { + content: "→"; + margin-left: 0.5rem; + transition: margin 0.2s ease; +} + +.news-link:hover::after { + margin-left: 1rem; +} + +.loading { + text-align: center; + padding: 2rem; + color: #5f6368; +} + +footer { + text-align: center; + margin-top: 2rem; + padding: 1rem; + color: #5f6368; +} + +@media (max-width: 600px) { + h1 { + font-size: 2rem; + } + + .news-container { + gap: 1rem; + } + + .news-item { + padding: 0.75rem; + } +} \ No newline at end of file