commit 47303e7cff774c43f0d9ac2971618c6c393b541e
Author: root <root@hub.scroll.pub> Date: 2025-01-04 08:44:53 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..6f9046d --- /dev/null +++ b/body.html @@ -0,0 +1,16 @@ +<header> + <h1>CurveViz</h1> + <p>Upload your .txt file and visualize it as a beautiful curve.</p> +</header> +<main> + <section id="upload-section"> + <input type="file" id="file-input" accept=".txt"> + <label for="file-input" class="upload-button">Choose a .txt file</label> + </section> + <section id="chart-section"> + <canvas id="data-chart"></canvas> + </section> +</main> +<footer> + <p>Transform your data into insights.</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..476087c --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://curveviz.scroll.pub +metaTags +editButton /edit.html +title CurveViz - Visualize Your Data +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..51709ab --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "4bfb94d3-5236-4e2f-ba6e-b3dec39e3968", + "object": "chat.completion", + "created": 1735980277, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\ncurveviz.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://curveviz.scroll.pub\nmetaTags\neditButton /edit.html\ntitle CurveViz - Visualize Your Data\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>CurveViz</h1>\n <p>Upload your .txt file and visualize it as a beautiful curve.</p>\n</header>\n<main>\n <section id=\"upload-section\">\n <input type=\"file\" id=\"file-input\" accept=\".txt\">\n <label for=\"file-input\" class=\"upload-button\">Choose a .txt file</label>\n </section>\n <section id=\"chart-section\">\n <canvas id=\"data-chart\"></canvas>\n </section>\n</main>\n<footer>\n <p>Transform your data into insights.</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4a90e2;\n --secondary-color: #50e3c2;\n --background-color: #1a1a1a;\n --text-color: #ffffff;\n --font-family: 'Segoe UI', system-ui, sans-serif;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n background-color: var(--background-color);\n color: var(--text-color);\n font-family: var(--font-family);\n line-height: 1.6;\n padding: 20px;\n}\n\nheader {\n text-align: center;\n margin-bottom: 40px;\n}\n\nh1 {\n font-size: 2.5rem;\n color: var(--primary-color);\n margin-bottom: 10px;\n}\n\n#upload-section {\n text-align: center;\n margin-bottom: 40px;\n}\n\n.upload-button {\n display: inline-block;\n padding: 10px 20px;\n background-color: var(--primary-color);\n color: var(--text-color);\n border-radius: 5px;\n cursor: pointer;\n transition: background-color 0.3s ease;\n}\n\n.upload-button:hover {\n background-color: var(--secondary-color);\n}\n\n#file-input {\n display: none;\n}\n\n#chart-section {\n width: 100%;\n max-width: 800px;\n margin: 0 auto;\n}\n\ncanvas {\n width: 100%;\n height: 400px;\n background-color: #2a2a2a;\n border-radius: 10px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n}\n\nfooter {\n text-align: center;\n margin-top: 40px;\n font-size: 0.9rem;\n color: #666;\n}\n\n@media (max-width: 768px) {\n h1 {\n font-size: 2rem;\n }\n\n canvas {\n height: 300px;\n }\n}\n---script.js---\ndocument.getElementById('file-input').addEventListener('change', function(event) {\n const file = event.target.files[0];\n if (file && file.type === 'text/plain') {\n const reader = new FileReader();\n reader.onload = function(e) {\n const text = e.target.result;\n const data = text.split('\\n').map(Number);\n drawChart(data);\n };\n reader.readAsText(file);\n } else {\n alert('Please upload a valid .txt file.');\n }\n});\n\nfunction drawChart(data) {\n const canvas = document.getElementById('data-chart');\n const ctx = canvas.getContext('2d');\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n const padding = 20;\n const width = canvas.width - padding * 2;\n const height = canvas.height - padding * 2;\n const maxValue = Math.max(...data);\n const minValue = Math.min(...data);\n const xStep = width / (data.length - 1);\n const yScale = height / (maxValue - minValue);\n\n ctx.beginPath();\n ctx.moveTo(padding, height + padding - (data[0] - minValue) * yScale);\n ctx.strokeStyle = '#50e3c2';\n ctx.lineWidth = 2;\n\n data.forEach((value, index) => {\n const x = padding + index * xStep;\n const y = height + padding - (value - minValue) * yScale;\n ctx.lineTo(x, y);\n });\n\n ctx.stroke();\n}\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 252, + "completion_tokens": 990, + "total_tokens": 1242, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 252 + }, + "system_fingerprint": "fp_3a5770e1b4" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..40dc124 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# curveviz.scroll.pub +Website generated by DeepSeek from prompt: 建立一个可视化大屏展示网站,可以上传txt文本,并将其用曲线的形式展示出来 \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..68750a1 --- /dev/null +++ b/script.js @@ -0,0 +1,41 @@ +document.getElementById('file-input').addEventListener('change', function(event) { + const file = event.target.files[0]; + if (file && file.type === 'text/plain') { + const reader = new FileReader(); + reader.onload = function(e) { + const text = e.target.result; + const data = text.split('\n').map(Number); + drawChart(data); + }; + reader.readAsText(file); + } else { + alert('Please upload a valid .txt file.'); + } +}); + +function drawChart(data) { + const canvas = document.getElementById('data-chart'); + const ctx = canvas.getContext('2d'); + ctx.clearRect(0, 0, canvas.width, canvas.height); + + const padding = 20; + const width = canvas.width - padding * 2; + const height = canvas.height - padding * 2; + const maxValue = Math.max(...data); + const minValue = Math.min(...data); + const xStep = width / (data.length - 1); + const yScale = height / (maxValue - minValue); + + ctx.beginPath(); + ctx.moveTo(padding, height + padding - (data[0] - minValue) * yScale); + ctx.strokeStyle = '#50e3c2'; + ctx.lineWidth = 2; + + data.forEach((value, index) => { + const x = padding + index * xStep; + const y = height + padding - (value - minValue) * yScale; + ctx.lineTo(x, y); + }); + + ctx.stroke(); +} \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..55afb1a --- /dev/null +++ b/style.css @@ -0,0 +1,86 @@ +:root { + --primary-color: #4a90e2; + --secondary-color: #50e3c2; + --background-color: #1a1a1a; + --text-color: #ffffff; + --font-family: 'Segoe UI', system-ui, sans-serif; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--background-color); + color: var(--text-color); + font-family: var(--font-family); + line-height: 1.6; + padding: 20px; +} + +header { + text-align: center; + margin-bottom: 40px; +} + +h1 { + font-size: 2.5rem; + color: var(--primary-color); + margin-bottom: 10px; +} + +#upload-section { + text-align: center; + margin-bottom: 40px; +} + +.upload-button { + display: inline-block; + padding: 10px 20px; + background-color: var(--primary-color); + color: var(--text-color); + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.upload-button:hover { + background-color: var(--secondary-color); +} + +#file-input { + display: none; +} + +#chart-section { + width: 100%; + max-width: 800px; + margin: 0 auto; +} + +canvas { + width: 100%; + height: 400px; + background-color: #2a2a2a; + border-radius: 10px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +footer { + text-align: center; + margin-top: 40px; + font-size: 0.9rem; + color: #666; +} + +@media (max-width: 768px) { + h1 { + font-size: 2rem; + } + + canvas { + height: 300px; + } +} \ No newline at end of file