Changes to readwise.scroll.pub

root
root
23 days ago
Initial commit
body.html
Changed around line 1
+
+

ReadWise

+

Upload a PDF and read it word by word with intuitive scrolling.

+
+
+
+
+
+
+
+
+
+
+
+

Designed for focused reading.

+
index.scroll
Changed around line 1
+ buildHtml
+ baseUrl https://readwise.scroll.pub
+ metaTags
+ editButton /edit.html
+ title ReadWise - Scroll & Read PDFs Word by Word
+ style.css
+ body.html
+ script.js
prompt.json
Changed around line 1
+ {
+ "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
\n

ReadWise

\n

Upload a PDF and read it word by word with intuitive scrolling.

\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n

Designed for focused reading.

\n
\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"
+ }
readme.scroll
Changed around line 1
+ # 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)
script.js
Changed around line 1
+ 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'}]
+ });
+ }
+ });
+ }
+ })
+ };
+ }
+ };
style.css
Changed around line 1
+ :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;
+ }
+ }