{"id":26911032,"url":"https://github.com/sauravrwt/thoughts","last_synced_at":"2026-04-18T17:02:16.665Z","repository":{"id":211933244,"uuid":"721941403","full_name":"SauRavRwT/Thoughts","owner":"SauRavRwT","description":"To generate a random quote from a text file, you can use a random number generator to select a line from the file. ","archived":false,"fork":false,"pushed_at":"2024-05-20T14:09:06.000Z","size":248,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:43:21.120Z","etag":null,"topics":["bootstrap","css","javascript","thoughts","txt-files"],"latest_commit_sha":null,"homepage":"https://sauravrwt.github.io/Thoughts/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SauRavRwT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-22T05:13:14.000Z","updated_at":"2024-05-20T14:09:10.000Z","dependencies_parsed_at":"2024-03-24T08:22:04.598Z","dependency_job_id":"240c76e1-a5db-4165-8b91-7be3ea3d1f56","html_url":"https://github.com/SauRavRwT/Thoughts","commit_stats":null,"previous_names":["sauravrwt/thoughts-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SauRavRwT/Thoughts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SauRavRwT%2FThoughts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SauRavRwT%2FThoughts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SauRavRwT%2FThoughts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SauRavRwT%2FThoughts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SauRavRwT","download_url":"https://codeload.github.com/SauRavRwT/Thoughts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SauRavRwT%2FThoughts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31976805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T16:27:12.723Z","status":"ssl_error","status_checked_at":"2026-04-18T16:27:11.140Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","css","javascript","thoughts","txt-files"],"created_at":"2025-04-01T14:36:24.482Z","updated_at":"2026-04-18T17:02:16.646Z","avatar_url":"https://github.com/SauRavRwT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Random Quotes\r\n\r\nTo generate a **random quote** from a text file, you can use a random number generator to select a line from the file. By reading the text file line by line and storing each line in an array or list, you can then generate a random index within the range of the array's length. This index will correspond to a randomly chosen quote from the file. You can then display this quote to the user.\r\n\r\n_Pagination -_\r\n\r\n    let currentPage = 1;\r\n    let pageSize = 12;\r\n\r\n_Change File Path -_\r\n\r\n    const response = await fetch(\"Your_file.txt\");\r\n\r\n_Function to display quotes for the current page -_\r\n\r\n    async function displayQuotesForPage() {\r\n      const { quotesForPage, totalQuotes } = await fetchQuotesForPage(currentPage);\r\n      if (quotesForPage.length === 0 \u0026\u0026 currentPage \u003e 1) {\r\n        // If no quotes are available and not on the first page, go back to page 1\r\n        currentPage = 1;\r\n        await displayQuotesForPage();\r\n        return;\r\n      }\r\n\r\n_Function to create a quote element -_\r\n\r\n    quoteElement.innerHTML = `\r\n    \u003cdiv class=\"card rounded-4\"\u003e\r\n      \u003cdiv class=\"card-body\"\u003e\r\n        \u003cp class=\"card-text font-monospace\"\u003e\"${quote}\"\u003c/p\u003e\r\n      \u003c/div\u003e\r\n    \u003c/div\u003e\r\n    `;\r\n    \r\n_Function to display modal with the clicked quote -_\r\n\r\n    function displayModal(quote) {\r\n      const modalBody = document.getElementById(\"quoteModalBody\");\r\n      modalBody.textContent = quote;\r\n      const modal = new bootstrap.Modal(document.getElementById(\"quoteModal\"));\r\n      modal.show();\r\n    }\r\n\r\n_Function to load the next page of quotes -_\r\n\r\n    async function loadNextPage() {\r\n      currentPage++;\r\n      const { quotesForPage } = await fetchQuotesForPage(currentPage);\r\n      if (quotesForPage.length === 0) {\r\n        // Reset to page 1 if no quotes are available\r\n        currentPage = 1;\r\n      }\r\n      await displayQuotesForPage();\r\n    }\r\n\r\n---\r\n\r\n![](./assets/Thoughts.png)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsauravrwt%2Fthoughts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsauravrwt%2Fthoughts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsauravrwt%2Fthoughts/lists"}