Bible.js is a javascript library to partially load JSON bible chapter to the client browser for further processing, without the need to rely on server-side processing. The data is between 1-10Kb, allowing fast loading for further usage and ideal to be cached for CDN. The JSON passage data can be accessed directly as github allows CORS.
Initially the library was prepared was using LZW compressed JSON to reduce the size. However, the decompression process may become very slow for old phones. Plain JSON allowing fast loading and text cached by the browser, further processing such as regenating the entire database on client storage.
See Lzbible and fork it or contribute to the repository.
- javscript bible app
- mobile application
// available bibles
http://[url]/db/bibles.json
// book index
http://[url]/db/[bible]/books.json
e.g. http://bible.js.org/db/kjv/books.json
// bible chapters
http://[url]/db/[bible]/[book]_[chapter].json
e.g. http://[url]/db/kjv/1_1.json
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="../js/jsonbible.js"></script>
var bibles = await JsonBible.Init('http://bible.js.org/db/');
JsonBible.SetBible(bibles[0]);
var books = await JsonBible.GetBooks();
var chapters = JsonBible.GetChapters(0..65);
var verses = await JsonBible.GetPassages(bookIdx, chapterIdx);
var verses = await JsonBible.GetPassages(1, 1); // genesis, ch 1
- convert more bibles
- more test cases