2014-10-10 52 views
0

您能否介紹一下如何將脫機聖經整合到基於手機差距的應用程序中?它可能需要將來的章節和詩歌的書籤。我將如何去做這件事。本地的json文件可能是?但是我找不到一個合理的json。尋找KJV聖經。也不確定如何使json方法可擴展以符合書籤。有什麼想法嗎?脫機聖經在phonegap應用程序?

回答

2

全文僅爲~4MB,這意味着在應用程序運行時將全文加載到內存中應該不成問題。然後,JSON應書籤罰款 - 因爲聖經所採用的結構,它是嵌套散列/陣列查找一個簡單的問題:

var bible = { 
    genesis: [ 
     [ // first chapter 
      "In the beginning God created the heaven and the earth.", 
      "And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.", 
      ... 
     ], 
     [ // second chapter 
      "Thus the heavens and the earth were finished, and all the host of them.", 
      "And on the seventh day God ended his work which he had made; and he rested on the seventh day from all his work which he had made.", 
      ... 
     ], 
     ... 
    ], 
    exodus: [ 
     [ // first chapter 
      "Now these are the names of the children of Israel, which came into Egypt; every man and his household came with Jacob.", 
      ... 
     ], 
     ... 
    ], 
    ... 
}; 

任何詩句應該是非常快速查找使用此結構:拉本書,這是一個散列圖查找,然後章節和詩節是數組偏移量。

相關問題