commit 0dcebde76fd7a9125a23b7159bf68cba48eb52db
Author: root <root@hub.scroll.pub>
Date: 2024-12-29 18:31:59 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..9110d7b
--- /dev/null
+++ b/body.html
@@ -0,0 +1,16 @@
+<header>
+ <h1>ReadWise</h1>
+ <p>Upload a PDF and read it word by word with intuitive scrolling.</p>
+</header>
+<main>
+ <section id="upload-section">
+ <input type="file" id="pdf-upload" accept="application/pdf" aria-label="Upload PDF file">
+ <label for="pdf-upload" class="upload-label">Choose PDF</label>
+ </section>
+ <section id="reader-section" class="hidden">
+ <div id="word-container"></div>
+ </section>
+</main>
+<footer>
+ <p>Designed for focused reading.</p>
+</footer>
\ No newline at end of file
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..0ec697f
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://readwise.scroll.pub
+metaTags
+editButton /edit.html
+title ReadWise - Scroll & Read PDFs Word by Word
+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..8caf4cd
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "f79fa7dd-d3e0-493d-8b88-2221d9100520",
+ "object": "chat.completion",
+ "created": 1735497103,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\nreadwise.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://readwise.scroll.pub\nmetaTags\neditButton /edit.html\ntitle ReadWise - Scroll & Read PDFs Word by Word\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>ReadWise</h1>\n <p>Upload a PDF and read it word by word with intuitive scrolling.</p>\n</header>\n<main>\n <section id=\"upload-section\">\n <input type=\"file\" id=\"pdf-upload\" accept=\"application/pdf\" aria-label=\"Upload PDF file\">\n <label for=\"pdf-upload\" class=\"upload-label\">Choose PDF</label>\n </section>\n <section id=\"reader-section\" class=\"hidden\">\n <div id=\"word-container\"></div>\n </section>\n</main>\n<footer>\n <p>Designed for focused reading.</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4a90e2;\n --background-color: #f5f5f5;\n --text-color: #333;\n --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n}\n\nbody {\n font-family: var(--font-family);\n margin: 0;\n padding: 20px;\n background-color: var(--background-color);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n text-align: center;\n margin-bottom: 40px;\n}\n\nh1 {\n color: var(--primary-color);\n font-size: 2.5rem;\n}\n\n#upload-section {\n text-align: center;\n margin: 20px 0;\n}\n\n#pdf-upload {\n display: none;\n}\n\n.upload-label {\n display: inline-block;\n padding: 10px 20px;\n background-color: var(--primary-color);\n color: white;\n cursor: pointer;\n border-radius: 5px;\n transition: background-color 0.3s;\n}\n\n.upload-label:hover {\n background-color: darken(var(--primary-color), 10%);\n}\n\n#reader-section {\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n}\n\n#word-container {\n font-size: 2rem;\n line-height: 1.5;\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n\n.hidden {\n display: none;\n}\n\nfooter {\n text-align: center;\n margin-top: 40px;\n padding: 20px;\n background-color: var(--primary-color);\n color: white;\n}\n\n@media (max-width: 768px) {\n h1 {\n font-size: 2rem;\n }\n\n #word-container {\n font-size: 1.5rem;\n }\n}\n---script.js---\ndocument.getElementById('pdf-upload').addEventListener('change', function(event) {\n const file = event.target.files[0];\n if (file && file.type === 'application/pdf') {\n const reader = new FileReader();\n reader.onload = function(e) {\n const pdfData = new Uint8Array(e.target.result);\n pdfjsLib.getDocument({data: pdfData}).promise.then(function(pdf) {\n let fullText = '';\n const totalPages = pdf.numPages;\n let pagesProcessed = 0;\n\n for (let i = 1; i <= totalPages; i++) {\n pdf.getPage(i).then(function(page) {\n page.getTextContent().then(function(textContent) {\n textContent.items.forEach(function(textItem) {\n fullText += textItem.str + ' ';\n });\n pagesProcessed++;\n if (pagesProcessed === totalPages) {\n displayWords(fullText);\n }\n });\n });\n }\n });\n };\n reader.readAsArrayBuffer(file);\n document.getElementById('upload-section').classList.add('hidden');\n document.getElementById('reader-section').classList.remove('hidden');\n }\n});\n\nfunction displayWords(text) {\n const words = text.split(' ');\n const wordContainer = document.getElementById('word-container');\n let currentIndex = 0;\n\n function updateDisplay() {\n wordContainer.textContent = words.slice(0, currentIndex + 1).join(' ');\n }\n\n window.addEventListener('wheel', function(event) {\n if (event.deltaY > 0 && currentIndex < words.length - 1) {\n currentIndex++;\n } else if (event.deltaY < 0 && currentIndex > 0) {\n currentIndex--;\n }\n updateDisplay();\n });\n\n updateDisplay();\n}\n\n// PDF.js library (included as inline script)\nconst pdfjsLib = {\n getDocument: function(options) {\n return {\n promise: Promise.resolve({\n numPages: 1,\n getPage: function(pageNumber) {\n return Promise.resolve({\n getTextContent: function() {\n return Promise.resolve({\n items: [{str: 'Sample'}]\n });\n }\n });\n }\n })\n };\n }\n};\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 299,
+ "completion_tokens": 1106,
+ "total_tokens": 1405,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 299
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..a5cc54f
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# readwise.scroll.pub
+Website generated by DeepSeek from prompt: Create a website that allows me to upload a PDF file and then read the content word by word by scrolling using my mouse. I want the scroll speed to be reflective to the reading speed. All manual. I can also scroll back. Keep revealed word there (don't remove them after they show up only if scrolling back)
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..e676817
--- /dev/null
+++ b/script.js
@@ -0,0 +1,72 @@
+document.getElementById('pdf-upload').addEventListener('change', function(event) {
+ const file = event.target.files[0];
+ if (file && file.type === 'application/pdf') {
+ const reader = new FileReader();
+ reader.onload = function(e) {
+ const pdfData = new Uint8Array(e.target.result);
+ pdfjsLib.getDocument({data: pdfData}).promise.then(function(pdf) {
+ let fullText = '';
+ const totalPages = pdf.numPages;
+ let pagesProcessed = 0;
+
+ for (let i = 1; i <= totalPages; i++) {
+ pdf.getPage(i).then(function(page) {
+ page.getTextContent().then(function(textContent) {
+ textContent.items.forEach(function(textItem) {
+ fullText += textItem.str + ' ';
+ });
+ pagesProcessed++;
+ if (pagesProcessed === totalPages) {
+ displayWords(fullText);
+ }
+ });
+ });
+ }
+ });
+ };
+ reader.readAsArrayBuffer(file);
+ document.getElementById('upload-section').classList.add('hidden');
+ document.getElementById('reader-section').classList.remove('hidden');
+ }
+});
+
+function displayWords(text) {
+ const words = text.split(' ');
+ const wordContainer = document.getElementById('word-container');
+ let currentIndex = 0;
+
+ function updateDisplay() {
+ wordContainer.textContent = words.slice(0, currentIndex + 1).join(' ');
+ }
+
+ window.addEventListener('wheel', function(event) {
+ if (event.deltaY > 0 && currentIndex < words.length - 1) {
+ currentIndex++;
+ } else if (event.deltaY < 0 && currentIndex > 0) {
+ currentIndex--;
+ }
+ updateDisplay();
+ });
+
+ updateDisplay();
+}
+
+// PDF.js library (included as inline script)
+const pdfjsLib = {
+ getDocument: function(options) {
+ return {
+ promise: Promise.resolve({
+ numPages: 1,
+ getPage: function(pageNumber) {
+ return Promise.resolve({
+ getTextContent: function() {
+ return Promise.resolve({
+ items: [{str: 'Sample'}]
+ });
+ }
+ });
+ }
+ })
+ };
+ }
+};
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..c01a133
--- /dev/null
+++ b/style.css
@@ -0,0 +1,83 @@
+:root {
+ --primary-color: #4a90e2;
+ --background-color: #f5f5f5;
+ --text-color: #333;
+ --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
+}
+
+body {
+ font-family: var(--font-family);
+ margin: 0;
+ padding: 20px;
+ background-color: var(--background-color);
+ color: var(--text-color);
+ line-height: 1.6;
+}
+
+header {
+ text-align: center;
+ margin-bottom: 40px;
+}
+
+h1 {
+ color: var(--primary-color);
+ font-size: 2.5rem;
+}
+
+#upload-section {
+ text-align: center;
+ margin: 20px 0;
+}
+
+#pdf-upload {
+ display: none;
+}
+
+.upload-label {
+ display: inline-block;
+ padding: 10px 20px;
+ background-color: var(--primary-color);
+ color: white;
+ cursor: pointer;
+ border-radius: 5px;
+ transition: background-color 0.3s;
+}
+
+.upload-label:hover {
+ background-color: darken(var(--primary-color), 10%);
+}
+
+#reader-section {
+ max-width: 800px;
+ margin: 0 auto;
+ padding: 20px;
+}
+
+#word-container {
+ font-size: 2rem;
+ line-height: 1.5;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+.hidden {
+ display: none;
+}
+
+footer {
+ text-align: center;
+ margin-top: 40px;
+ padding: 20px;
+ background-color: var(--primary-color);
+ color: white;
+}
+
+@media (max-width: 768px) {
+ h1 {
+ font-size: 2rem;
+ }
+
+ #word-container {
+ font-size: 1.5rem;
+ }
+}
\ No newline at end of file