diff --git a/DynamicBibleIonic/src/app/app.module.ts b/DynamicBibleIonic/src/app/app.module.ts index 9b26f6ef..f0ef45af 100644 --- a/DynamicBibleIonic/src/app/app.module.ts +++ b/DynamicBibleIonic/src/app/app.module.ts @@ -21,6 +21,7 @@ import { Words } from "../components/words/words"; import { Error } from "../components/error/error"; import { StrongsModal } from "../components/strongs-modal/strongs-modal"; import { ErrorMessage } from '../components/error-message/error-message'; +import { VersePickerModal} from '../components/verse-picker/verse-picker'; @NgModule({ declarations: [ @@ -32,6 +33,7 @@ import { ErrorMessage } from '../components/error-message/error-message'; Passage, Strongs, StrongsModal, + VersePickerModal, Words, Error, ErrorMessage @@ -51,6 +53,7 @@ import { ErrorMessage } from '../components/error-message/error-message'; Passage, Strongs, StrongsModal, + VersePickerModal, Words, Error, ErrorMessage diff --git a/DynamicBibleIonic/src/components/passage/passage.html b/DynamicBibleIonic/src/components/passage/passage.html index 516e3fd1..5b909f06 100644 --- a/DynamicBibleIonic/src/components/passage/passage.html +++ b/DynamicBibleIonic/src/components/passage/passage.html @@ -34,7 +34,7 @@ - diff --git a/DynamicBibleIonic/src/components/passage/passage.ts b/DynamicBibleIonic/src/components/passage/passage.ts index 532d9072..e5ef287d 100644 --- a/DynamicBibleIonic/src/components/passage/passage.ts +++ b/DynamicBibleIonic/src/components/passage/passage.ts @@ -114,9 +114,9 @@ export class Passage implements OnInit else this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - this.data.lastverse).toString(); - if (this.ref.Section.end.chapter === (this.ref.Section.end.lastchapter + 1).toString()) + if (this.ref.Section.end.chapter === (this.ref.Section.end.book.last_chapter + 1).toString()) { - this.ref.Section.end.chapter = this.ref.Section.end.lastchapter.toString(); + this.ref.Section.end.chapter = this.ref.Section.end.book.last_chapter.toString(); this.ref.Section.end.verse = this.data.lastverse.toString(); } } diff --git a/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts b/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts index d996cc02..bcc3490d 100644 --- a/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts +++ b/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts @@ -1,11 +1,11 @@ -import { EventEmitter, Component, Output, OnInit } from "@angular/core"; +import { EventEmitter, Component, Output, OnInit } from '@angular/core'; import { Platform, NavParams, ViewController } from 'ionic-angular'; import { Reference } from '../../libs/Reference'; import { StrongsResult, StrongsService } from '../../services/strongs-service'; @Component({ - selector: "strongs-modal", - templateUrl: "strongs-modal.html", + selector: 'strongs-modal', + templateUrl: 'strongs-modal.html', providers: [StrongsService] }) export class StrongsModal implements OnInit @@ -50,7 +50,7 @@ export class StrongsModal implements OnInit makePassage(p: string) { - return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2]; + return Reference.bookName(parseInt(p.split(';')[0])).name + ' ' + p.split(';')[1] + ':' + p.split(';')[2]; } openPassage(p: string) @@ -58,4 +58,4 @@ export class StrongsModal implements OnInit let ref = this.makePassage(p); this.onItemClicked.emit(ref); } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/components/strongs/strongs.ts b/DynamicBibleIonic/src/components/strongs/strongs.ts index b7ffa3a4..9882fdf5 100644 --- a/DynamicBibleIonic/src/components/strongs/strongs.ts +++ b/DynamicBibleIonic/src/components/strongs/strongs.ts @@ -1,11 +1,11 @@ -import { HostListener, EventEmitter, Component, Input, Output, OnInit, AfterViewChecked, ElementRef } from "@angular/core"; +import { HostListener, EventEmitter, Component, Input, Output, OnInit, AfterViewChecked, ElementRef } from '@angular/core'; import { Reference } from '../../libs/Reference'; -import { OpenData, CardItem } from "../../pages/search/search"; +import { OpenData, CardItem } from '../../pages/search/search'; import { StrongsResult, StrongsService } from '../../services/strongs-service'; @Component({ - selector: "strongs", - templateUrl: "strongs.html", + selector: 'strongs', + templateUrl: 'strongs.html', providers: [StrongsService] }) export class Strongs implements AfterViewChecked, OnInit @@ -28,13 +28,13 @@ export class Strongs implements AfterViewChecked, OnInit @HostListener('window:resize', ['$event']) onResize(evt) { - $("strongs ion-scroll").each((i, el) => + $('strongs ion-scroll').each((i, el) => { - let len = $(el).find(".scroll-content .scroll-zoom-wrapper dl span").length; - len += $(el).find(".scroll-content .scroll-zoom-wrapper dl dd").length; + let len = $(el).find('.scroll-content .scroll-zoom-wrapper dl span').length; + len += $(el).find('.scroll-content .scroll-zoom-wrapper dl dd').length; if (len < 20) - $(el).css("height", Math.ceil(len / 3) * 30 + 30); + $(el).css('height', Math.ceil(len / 3) * 30 + 30); }); } @@ -60,7 +60,7 @@ export class Strongs implements AfterViewChecked, OnInit fill: 'forwards', duration: d, iterations: 1, - easing: 'ease-in-out', + easing: 'ease-in-out' }); setTimeout(() => { @@ -75,7 +75,7 @@ export class Strongs implements AfterViewChecked, OnInit makePassage(p: string) { - return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2]; + return Reference.bookName(parseInt(p.split(';')[0])).name + ' ' + p.split(';')[1] + ':' + p.split(';')[2]; } openPassage(p: string) @@ -83,4 +83,4 @@ export class Strongs implements AfterViewChecked, OnInit let ref = this.makePassage(p); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/components/verse-picker/verse-picker.html b/DynamicBibleIonic/src/components/verse-picker/verse-picker.html index a60ab6db..f0545a06 100644 --- a/DynamicBibleIonic/src/components/verse-picker/verse-picker.html +++ b/DynamicBibleIonic/src/components/verse-picker/verse-picker.html @@ -1,7 +1,7 @@ - Error:Strongs: {{item.prefix}}{{item.sn}} + Verse Picker +

{{book.name}}

+
+ {{i}} +
+ - + diff --git a/DynamicBibleIonic/src/components/verse-picker/verse-picker.scss b/DynamicBibleIonic/src/components/verse-picker/verse-picker.scss index d5d56169..29b819e6 100644 --- a/DynamicBibleIonic/src/components/verse-picker/verse-picker.scss +++ b/DynamicBibleIonic/src/components/verse-picker/verse-picker.scss @@ -1,25 +1,36 @@ -strongs-modal { - a { - cursor: pointer !important; - color: black; - border-bottom: 1px dotted #b3bfd0; +verse-picker { + .button { + color: #fff; + font-size: 1em; + float: left; + padding: .5em; + background-color: #1c2e4c; + margin: .3em; + text-align: center; + width: 65px; } - .bar-button-ios { - padding-right: 25px; - padding-left: 9px; + .backbutton { + width: 100%; + font-family: inherit; + text-transform: inherit; } - .bar-button-md, .bar-button-wp { - padding-left: 25px; - padding-right: 9px; + .backbutton:hover:not(.disable-hover) { + background-color: #2b4166; } - .scroll-content { - line-height: 1.5em; - } + ion-content { + div, h3 { + clear: both; + } - dd { - line-height: 1.7em; + div { + margin: 1em; + } + + h3 { + padding-top: .5em; + } } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/components/verse-picker/verse-picker.ts b/DynamicBibleIonic/src/components/verse-picker/verse-picker.ts index 06233d0d..9b9b9e22 100644 --- a/DynamicBibleIonic/src/components/verse-picker/verse-picker.ts +++ b/DynamicBibleIonic/src/components/verse-picker/verse-picker.ts @@ -1,41 +1,53 @@ -import { EventEmitter, Component, Output, OnInit } from "@angular/core"; +import { EventEmitter, Component, Output, OnInit } from '@angular/core'; import { Platform, NavParams, ViewController } from 'ionic-angular'; +import { Book, Reference } from '../../libs/Reference'; @Component({ - selector: "verse-picker", - templateUrl: "verse-picker.html" + selector: 'verse-picker', + templateUrl: 'verse-picker.html' }) -export class VersePickerModal implements OnInit +export class VersePickerModal { @Output() onItemClicked = new EventEmitter(); + books: Array; + hasBook: boolean = false; + book: Book; constructor( public platform: Platform, public params: NavParams, public viewCtrl: ViewController - ) + ) { + this.hasBook = false; + this.books = Reference.Books; this.onItemClicked.subscribe(item => { let pg = this.params.get('onItemClicked'); - pg.updateUIwithItems(item, false); + pg.updateUIwithItems(item, false); }); } - ngOnInit(): void - { - + toBooks() + { + this.hasBook = false; + this.book = null; } - - dismiss() + + dismiss() { this.viewCtrl.dismiss(); } - - openItem(p: string) + setBook(book: Book) { - this.onItemClicked.emit(p); + this.hasBook = true; + this.book = book; + } + setChapter(chapter: number) + { + // close the control, trigger the passage event. + this.onItemClicked.emit(this.book.name + ' ' + chapter); this.dismiss(); } } diff --git a/DynamicBibleIonic/src/components/words/words.ts b/DynamicBibleIonic/src/components/words/words.ts index d17953fc..f4ff6a9e 100644 --- a/DynamicBibleIonic/src/components/words/words.ts +++ b/DynamicBibleIonic/src/components/words/words.ts @@ -1,12 +1,12 @@ -/// -import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from "@angular/core"; +/// +import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from '@angular/core'; import { Reference } from '../../libs/Reference'; -import { OpenData, CardItem } from "../../pages/search/search"; +import { OpenData, CardItem } from '../../pages/search/search'; import { WordLookupResult, WordService } from '../../services/word-service'; @Component({ - selector: "words", - templateUrl: "words.html", + selector: 'words', + templateUrl: 'words.html', providers: [WordService] }) export class Words implements AfterViewChecked, OnInit @@ -31,40 +31,40 @@ export class Words implements AfterViewChecked, OnInit @HostListener('window:resize', ['$event']) onResize(evt) { - $("words ion-scroll").each((i, el) => + $('words ion-scroll').each((i, el) => { - let wr = $(el).find(".scroll-content .scroll-zoom-wrapper")[0]; - let len = $(el).find(".scroll-zoom-wrapper a").length; + let wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0]; + let len = $(el).find('.scroll-zoom-wrapper a').length; if (wr.scrollWidth < 500) // 1 col { // 5 rows - len < 6 ? $(el).css("height", len * 44.4 + 25) : $(el).css("height", 250); + len < 6 ? $(el).css('height', len * 44.4 + 25) : $(el).css('height', 250); } else if (wr.scrollWidth < 699) // 2 col { // 6 rows - len < 13 ? $(el).css("height", Math.ceil(len / 2) * 44.4 + 25) : $(el).css("height", 300); + len < 13 ? $(el).css('height', Math.ceil(len / 2) * 44.4 + 25) : $(el).css('height', 300); } else if (wr.scrollWidth < 799) // 3 col { // 7 rows - len < 22 ? $(el).css("height", Math.ceil(len / 3) * 44.4 + 25) : $(el).css("height", 350); + len < 22 ? $(el).css('height', Math.ceil(len / 3) * 44.4 + 25) : $(el).css('height', 350); } else if (wr.scrollWidth < 899) // 4 col { // 7 rows - len < 29 ? $(el).css("height", Math.ceil(len / 4) * 44.4 + 25) : $(el).css("height", 375); + len < 29 ? $(el).css('height', Math.ceil(len / 4) * 44.4 + 25) : $(el).css('height', 375); } else if (wr.scrollWidth < 1199) // 5 col { // 8 rows - len < 41 ? $(el).css("height", Math.ceil(len / 5) * 44.4 + 25) : $(el).css("height", 400); + len < 41 ? $(el).css('height', Math.ceil(len / 5) * 44.4 + 25) : $(el).css('height', 400); } else // 6 col { // 8 rows - len < 49 ? $(el).css("height", Math.ceil(len / 6) * 44.4 + 25) : $(el).css("height", 425); + len < 49 ? $(el).css('height', Math.ceil(len / 6) * 44.4 + 25) : $(el).css('height', 425); } }); } @@ -89,7 +89,7 @@ export class Words implements AfterViewChecked, OnInit fill: 'forwards', duration: d, iterations: 1, - easing: 'ease-in-out', + easing: 'ease-in-out' }); setTimeout(() => { @@ -99,7 +99,7 @@ export class Words implements AfterViewChecked, OnInit makePassage(p: string) { - return Reference.bookName(parseInt(p.split(":")[0])) + ' ' + p.split(":")[1] + ":" + p.split(":")[2]; + return Reference.bookName(parseInt(p.split(':')[0])).name + ' ' + p.split(':')[1] + ':' + p.split(':')[2]; } openPassage(p: string) @@ -107,4 +107,4 @@ export class Words implements AfterViewChecked, OnInit let ref = this.makePassage(p); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/libs/Reference.ts b/DynamicBibleIonic/src/libs/Reference.ts index 499a7810..ca0fe672 100644 --- a/DynamicBibleIonic/src/libs/Reference.ts +++ b/DynamicBibleIonic/src/libs/Reference.ts @@ -1,4 +1,4 @@ -// This code was written by Jeremy and Jason Wall. +// This code was written by Jeremy and Jason Wall. // Feel free to use, and if you can, include a link back to www.walljm.com // Jason@walljm.com // www.walljm.com // Jeremy@marzhillstudios.com // jeremy.marzhillstudios.com @@ -32,18 +32,12 @@ export class Reference { this.Section = { start: { - book: -1, - bookname: '', - longbookname: '', - lastchapter: -1, + book: null, chapter: '', verse: '' }, end: { - book: -1, - bookname: '', - longbookname: '', - lastchapter: -1, + book: null, chapter: '', verse: '' } @@ -51,19 +45,16 @@ export class Reference this.ref = reference.toLowerCase().trim(); this.parseReference(); - if (this.Section.end.book === -1) + if (this.Section.end.book === null) { this.Section.end.book = this.Section.start.book; - this.Section.end.bookname = this.Section.start.bookname; - this.Section.end.longbookname = this.Section.start.longbookname; - this.Section.end.lastchapter = this.Section.start.lastchapter; } if (this.Section.end.chapter === '') this.Section.end.chapter = this.Section.start.chapter; if ( Number(this.Section.start.verse) > Number(this.Section.end.verse) && this.Section.start.chapter === this.Section.end.chapter && - this.Section.start.book === this.Section.end.book + this.Section.start.book.name === this.Section.end.book.name ) this.Section.end.verse = this.Section.start.verse; if (this.Section.start.verse === '') this.Section.start.verse = '1'; if (this.Section.end.verse === '') this.Section.end.verse = '*'; @@ -91,8 +82,8 @@ export class Reference if (!fbook) fbook = this.ref; this.ref = this.ref.slice(this.ref.search(/\w\s+\d/i) + 1); - if (isEnd) this.Section.end = Reference.parseBook(fbook); - else this.Section.start = Reference.parseBook(fbook); + if (isEnd) this.Section.end.book = Reference.parseBook(fbook); + else this.Section.start.book = Reference.parseBook(fbook); } private parseFirstNum(isEnd: boolean) @@ -177,9 +168,6 @@ export class Reference if (this.ref.search(/\w\s+\d/i) === -1) { this.Section.end.book = this.Section.start.book; - this.Section.end.bookname = this.Section.start.bookname; - this.Section.end.longbookname = this.Section.start.longbookname; - this.Section.end.lastchapter = this.Section.start.lastchapter; } else { @@ -201,7 +189,7 @@ export class Reference let self = this; return this.maybeDo(() => { - if (self.Section.end.book === self.Section.start.book) + if (self.Section.end.book.name === self.Section.start.book.name) { if (self.ref.search(/:/) !== -1 || foundSecondBook || !foundFirstVerse) { @@ -240,506 +228,300 @@ export class Reference return Reference.toString(this.Section); }; - public static parseBook(fbook: string) + public static parseBook(fbook: string): Book { - let thing = { - book: 0, - bookname: '', - longbookname: '', - lastchapter: 0, - chapter: '', - verse: '' - }; if (fbook.search(/\b(genesis|gen|ge|gn)\b/i) !== -1) { - thing.book = 1; - thing.bookname = 'Genesis'; - thing.longbookname = 'Genesis'; - thing.lastchapter = 50; + return this.bookName(1); } if (fbook.search(/\b(exodus|ex|exo|exod|exd)\b/i) !== -1) { - thing.book = 2; - thing.bookname = 'Exodus'; - thing.longbookname = 'Exodus'; - thing.lastchapter = 40; + return this.bookName(2); } if (fbook.search(/\b(leviticus|lev|le|levi|lv)\b/i) !== -1) { - thing.book = 3; - thing.bookname = 'Leviticus'; - thing.longbookname = 'Leviticus'; - thing.lastchapter = 27; + return this.bookName(3); } if (fbook.search(/\b(numbers|num|nu|numb|number)\b/i) !== -1) { - thing.book = 4; - thing.bookname = 'Numbers'; - thing.longbookname = 'Book_of_Numbers'; - thing.lastchapter = 36; + return this.bookName(4); } if (fbook.search(/\b(deuteronomy|deut|de|dt|deu)\b/i) !== -1) { - thing.book = 5; - thing.bookname = 'Deuteronomy'; - thing.longbookname = 'Deuteronomy'; - thing.lastchapter = 34; + return this.bookName(5); } if (fbook.search(/\b(joshua|josh|jos)\b/i) !== -1) { - thing.book = 6; - thing.bookname = 'Joshua'; - thing.longbookname = 'Book_of_Joshua'; - thing.lastchapter = 24; + return this.bookName(6); } if (fbook.search(/\b(judges|jud|jdg|judg)\b/i) !== -1) { - thing.book = 7; - thing.bookname = 'Judges'; - thing.longbookname = 'Book_of_Judges'; - thing.lastchapter = 21; + return this.bookName(7); } if (fbook.search(/\b(ruth|ru)\b/i) !== -1) { - thing.book = 8; - thing.bookname = 'Ruth'; - thing.longbookname = 'Book_of_Ruth'; - thing.lastchapter = 4; + return this.bookName(8); } if (fbook.search(/\b(1|i|1st|first)\s*(samuel|sa|sam|sml)\b/i) !== -1) { - thing.book = 9; - thing.bookname = '1 Samuel'; - thing.longbookname = 'First_Samuel'; - thing.lastchapter = 31; + return this.bookName(9); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(samuel|sa|sam|sml)\b/i) !== -1) { - thing.book = 10; - thing.bookname = '2 Samuel'; - thing.longbookname = 'Second_Samuel'; - thing.lastchapter = 24; + return this.bookName(10); } if (fbook.search(/\b(1|i|1st|first)\s*(kings|king|kgs|kn|k|ki)\b/i) !== -1) { - thing.book = 11; - thing.bookname = '1 Kings'; - thing.longbookname = 'First_Kings'; - thing.lastchapter = 22; + return this.bookName(11); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(kings|king|kgs|kn|k|ki)\b/i) !== -1) { - thing.book = 12; - thing.bookname = '2 Kings'; - thing.longbookname = 'Second_Kings'; - thing.lastchapter = 25; + return this.bookName(12); } if (fbook.search(/\b(1|i|1st|first)\s*(chronicles|chron|ch|chr)\b/i) !== -1) { - thing.book = 13; - thing.bookname = '1 Chronicles'; - thing.longbookname = 'First_Chronicles'; - thing.lastchapter = 29; + return this.bookName(13); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(chronicles|chron|ch|chr)\b/i) !== -1) { - thing.book = 14; - thing.bookname = '2 Chronicles'; - thing.longbookname = 'Second_Chronicles'; - thing.lastchapter = 36; + return this.bookName(14); } if (fbook.search(/\b(ezra|ezr)\b/i) !== -1) { - thing.book = 15; - thing.bookname = 'Ezra'; - thing.longbookname = 'Book_of_Ezra'; - thing.lastchapter = 10; + return this.bookName(15); } if (fbook.search(/\b(nehemiah|neh|ne|nehamiah)\b/i) !== -1) { - thing.book = 16; - thing.bookname = 'Nehemiah'; - thing.longbookname = 'Book_of_Nehemiah'; - thing.lastchapter = 13; + return this.bookName(16); } if (fbook.search(/\b(esther|est|es|esth)\b/i) !== -1) { - thing.book = 17; - thing.bookname = 'Esther'; - thing.longbookname = 'Book_of_Esther'; - thing.lastchapter = 10; + return this.bookName(17); } if (fbook.search(/\b(job|jo|jb)\b/i) !== -1) { - thing.book = 18; - thing.bookname = 'Job'; - thing.longbookname = 'Book_of_Job'; - thing.lastchapter = 42; + return this.bookName(18); } if (fbook.search(/\b(psalms|ps|psa|psalm|psm)\b/i) !== -1) { - thing.book = 19; - thing.bookname = 'Psalm'; - thing.longbookname = 'Psalm'; - thing.lastchapter = 150; + return this.bookName(19); } if (fbook.search(/\b(proverbs|prov|pr|pro|proverb|prv|prvbs)\b/i) !== -1) { - thing.book = 20; - thing.bookname = 'Proverbs'; - thing.longbookname = 'Book_of_Proverbs'; - thing.lastchapter = 31; + return this.bookName(20); } if (fbook.search(/\b(ecclesiastes|eccl|ecc|eccles|ec|ecl|ecclesiaste)\b/i) !== -1) { - thing.book = 21; - thing.bookname = 'Ecclesiastes'; - thing.longbookname = 'Ecclesiastes'; - thing.lastchapter = 12; + return this.bookName(21); } if (fbook.search(/\b(song\sof\ssolomon|song\sof\ssongs|sos|ss|son|so|song|songs)\b/i) !== -1) { - thing.book = 22; - thing.bookname = 'Song of Solomon'; - thing.longbookname = 'Song_of_Solomon'; - thing.lastchapter = 8; + return this.bookName(22); } if (fbook.search(/\b(isaiah|is|isah|isai|ia)\b/i) !== -1) { - thing.book = 23; - thing.bookname = 'Isaiah'; - thing.longbookname = 'Book_of_Isaiah'; - thing.lastchapter = 66; + return this.bookName(23); } if (fbook.search(/\b(jerimiah|jeremiah|jer|je|jere)\b/i) !== -1) { - thing.book = 24; - thing.bookname = 'Jeremiah'; - thing.longbookname = 'Book_of_Jeremiah'; - thing.lastchapter = 52; + return this.bookName(24); } if (fbook.search(/\b(lamentations|lam|la|lamentation)\b/i) !== -1) { - thing.book = 25; - thing.bookname = 'Lamentations'; - thing.longbookname = 'Book_of_Lamentations'; - thing.lastchapter = 5; + return this.bookName(25); } if (fbook.search(/\b(ezekiel|eze|ezk|ezek)\b/i) !== -1) { - thing.book = 26; - thing.bookname = 'Ezekiel'; - thing.longbookname = 'Book_of_Ezekiel'; - thing.lastchapter = 48; + return this.bookName(26); } if (fbook.search(/\b(daniel|dan|dn|dl|da)\b/i) !== -1) { - thing.book = 27; - thing.bookname = 'Daniel'; - thing.longbookname = 'Book_of_Daniel'; - thing.lastchapter = 12; + return this.bookName(27); } if (fbook.search(/\b(hosea|hos|ho)\b/i) !== -1) { - thing.book = 28; - thing.bookname = 'Hosea'; - thing.longbookname = 'Book_of_Hosea'; - thing.lastchapter = 14; + return this.bookName(28); } if (fbook.search(/\b(joel|joe|jl)\b/i) !== -1) { - thing.book = 29; - thing.bookname = 'Joel'; - thing.longbookname = 'Book_of_Joel'; - thing.lastchapter = 3; + return this.bookName(29); } if (fbook.search(/\b(amos|am|amo)\b/i) !== -1) { - thing.book = 30; - thing.bookname = 'Amos'; - thing.longbookname = 'Book_of_Amos'; - thing.lastchapter = 9; + return this.bookName(30); } if (fbook.search(/\b(obadiah|oba|ob|obad)\b/i) !== -1) { - thing.book = 31; - thing.bookname = 'Obadiah'; - thing.longbookname = 'Book_of_Obadiah'; - thing.lastchapter = 1; + return this.bookName(31); } if (fbook.search(/\b(jonah|jnh|jon)\b/i) !== -1) { - thing.book = 32; - thing.bookname = 'Jonah'; - thing.longbookname = 'Book_of_Jonah'; - thing.lastchapter = 4; + return this.bookName(32); } if (fbook.search(/\b(micah|mic|mi)\b/i) !== -1) { - thing.book = 33; - thing.bookname = 'Micah'; - thing.longbookname = 'Book_of_Micah'; - thing.lastchapter = 7; + return this.bookName(33); } if (fbook.search(/\b(nahum|nah|na)\b/i) !== -1) { - thing.book = 34; - thing.bookname = 'Nahum'; - thing.longbookname = 'Book_of_Nahum'; - thing.lastchapter = 3; + return this.bookName(34); } if (fbook.search(/\b(habakkuk|hab|ha|habakuk)\b/i) !== -1) { - thing.book = 35; - thing.bookname = 'Habakkuk'; - thing.longbookname = 'Book_of_Habakkuk'; - thing.lastchapter = 3; + return this.bookName(35); } if (fbook.search(/\b(zephaniah|zeph|zep)\b/i) !== -1) { - thing.book = 36; - thing.bookname = 'Zephaniah'; - thing.longbookname = 'Book_of_Zephaniah'; - thing.lastchapter = 3; + return this.bookName(36); } if (fbook.search(/\b(haggia|hag|hg|haggai)\b/i) !== -1) { - thing.book = 37; - thing.bookname = 'Haggai'; - thing.longbookname = 'Book_of_Haggai'; - thing.lastchapter = 2; + return this.bookName(37); } if (fbook.search(/\b(zechariah|zech|zch|zec)\b/i) !== -1) { - thing.book = 38; - thing.bookname = 'Zechariah'; - thing.longbookname = 'Book_of_Zechariah'; - thing.lastchapter = 14; + return this.bookName(38); } if (fbook.search(/\b(malachi|mal)\b/i) !== -1) { - thing.book = 39; - thing.bookname = 'Malachi'; - thing.longbookname = 'Book_of_Malachi'; - thing.lastchapter = 4; + return this.bookName(39); } if (fbook.search(/\b(matthew|mt|matt|mat)\b/i) !== -1) { - thing.book = 40; - thing.bookname = 'Matthew'; - thing.longbookname = 'Gospel_of_Matthew'; - thing.lastchapter = 28; + return this.bookName(40); } if (fbook.search(/\b(mark|mrk|mk|mr)\b/i) !== -1) { - thing.book = 41; - thing.bookname = 'Mark'; - thing.longbookname = 'Gospel_of_Mark'; - thing.lastchapter = 16; + return this.bookName(41); } if (fbook.search(/\b(luke|lu|lke|luk|lk)\b/i) !== -1) { - thing.book = 42; - thing.bookname = 'Luke'; - thing.longbookname = 'Gospel_of_Luke'; - thing.lastchapter = 24; + return this.bookName(42); } if (fbook.search(/\b(john|jn|jhn)\b/i) !== -1) { - thing.book = 43; - thing.bookname = 'John'; - thing.longbookname = 'Gospel_of_John'; - thing.lastchapter = 21; + return this.bookName(43); } if (fbook.search(/\b(acts|ac|act)\b/i) !== -1) { - thing.book = 44; - thing.bookname = 'Acts'; - thing.longbookname = 'Acts_of_the_Apostles'; - thing.lastchapter = 28; + return this.bookName(44); } if (fbook.search(/\b(romans|rom|ro|rm|roman)\b/i) !== -1) { - thing.book = 45; - thing.bookname = 'Romans'; - thing.longbookname = 'Epistle_to_the_Romans'; - thing.lastchapter = 16; + return this.bookName(45); } if (fbook.search(/\b(1|i|1st|first)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) !== -1) { - thing.book = 46; - thing.bookname = '1 Corinthians'; - thing.longbookname = 'First_Epistle_to_the_Corinthians'; - thing.lastchapter = 16; + return this.bookName(46); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) !== -1) { - thing.book = 47; - thing.bookname = '2 Corinthians'; - thing.longbookname = 'Second_Epistle_to_the_Corinthians'; - thing.lastchapter = 13; + return this.bookName(47); } if (fbook.search(/\b(galatians|galatian|galations|gal|ga|gala|galation|galat)\b/i) !== -1) { - thing.book = 48; - thing.bookname = 'Galatians'; - thing.longbookname = 'Epistle_to_the_Galatians'; - thing.lastchapter = 6; + return this.bookName(48); } if (fbook.search(/\b(ephesians|eph|ep|ephes|ephe|ephs)\b/i) !== -1) { - thing.book = 49; - thing.bookname = 'Ephesians'; - thing.longbookname = 'Epistle_to_the_Ephesians'; - thing.lastchapter = 6; + return this.bookName(49); } if (fbook.search(/\b(philippians|phi|phil|ph|philip)\b/i) !== -1) { - thing.book = 50; - thing.bookname = 'Philippians'; - thing.longbookname = 'Epistle_to_the_Philippians'; - thing.lastchapter = 4; + return this.bookName(50); } if (fbook.search(/\b(colossians|col|co|colossian|colos|coloss)\b/i) !== -1) { - thing.book = 51; - thing.bookname = 'Colossians'; - thing.longbookname = 'Epistle_to_the_Colossians'; - thing.lastchapter = 4; + return this.bookName(51); } if (fbook.search(/\b(1|i|1st|first)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) !== -1) { - thing.book = 52; - thing.bookname = '1 Thessalonians'; - thing.longbookname = 'First_Epistle_to_the_Thessalonians'; - thing.lastchapter = 5; + return this.bookName(52); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) !== -1) { - thing.book = 53; - thing.bookname = '2 Thessalonians'; - thing.longbookname = 'Second_Epistle_to_the_Thessalonians'; - thing.lastchapter = 3; + return this.bookName(53); } if (fbook.search(/\b(1|i|1st|first)\s*(timothy|tim|ti|timoth|tm)\b/i) !== -1) { - thing.book = 54; - thing.bookname = '1 Timothy'; - thing.longbookname = 'First_Epistle_to_Timothy'; - thing.lastchapter = 6; + return this.bookName(54); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(timothy|tim|timoth|tm)\b/i) !== -1) { - thing.book = 55; - thing.bookname = '2 Timothy'; - thing.longbookname = 'Second_Epistle_to_Timothy'; - thing.lastchapter = 4; + return this.bookName(55); } if (fbook.search(/\b(titus|tit)\b/i) !== -1) { - thing.book = 56; - thing.bookname = 'Titus'; - thing.longbookname = 'Epistle_to_Titus'; - thing.lastchapter = 3; + return this.bookName(56); } if (fbook.search(/\b(philemon|phlmn|phl|phm|phile|philem)\b/i) !== -1) { - thing.book = 57; - thing.bookname = 'Philemon'; - thing.longbookname = 'Epistle_to_Philemon'; - thing.lastchapter = 1; + return this.bookName(57); } if (fbook.search(/\b(hebrews|heb|he|hebrew)\b/i) !== -1) { - thing.book = 58; - thing.bookname = 'Hebrews'; - thing.longbookname = 'Epistle_to_the_Hebrews'; - thing.lastchapter = 13; + return this.bookName(58); } if (fbook.search(/\b(james|jam|ja|jas|jms|jame|jm)\b/i) !== -1) { - thing.book = 59; - thing.bookname = 'James'; - thing.longbookname = 'Epistle_of_James'; - thing.lastchapter = 5; + return this.bookName(59); } if (fbook.search(/\b(1|i|1st|first)\s*(peter|pe|pet|pete|pt|p)\b/i) !== -1) { - thing.book = 60; - thing.bookname = '1 Peter'; - thing.longbookname = 'First_Epistle_of_Peter'; - thing.lastchapter = 5; + return this.bookName(60); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(peter|pe|pet|pete|pt|p)\b/i) !== -1) { - thing.book = 61; - thing.bookname = '2 Peter'; - thing.longbookname = 'Second_Epistle_of_Peter'; - thing.lastchapter = 3; + return this.bookName(61); } if (fbook.search(/\b(1|i|1st|first)\s*(john|jn|jo)\b/i) !== -1) { - thing.book = 62; - thing.bookname = '1 John'; - thing.longbookname = 'First_Epistle_of_John'; - thing.lastchapter = 5; + return this.bookName(62); } if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(john|jn|jo)\b/i) !== -1) { - thing.book = 63; - thing.bookname = '2 John'; - thing.longbookname = 'Second_Epistle_of_John'; - thing.lastchapter = 1; + return this.bookName(63); } if (fbook.search(/\b(3|iii|3rd|third)\s*(john|jn|jo)\b/i) !== -1) { - thing.book = 64; - thing.bookname = '3 John'; - thing.longbookname = 'Third_Epistle_of_John'; - thing.lastchapter = 1; + return this.bookName(64); } if (fbook.search(/\b(jude|ju)\b/i) !== -1) { - thing.book = 65; - thing.bookname = 'Jude'; - thing.longbookname = 'Epistle_of_Jude'; - thing.lastchapter = 1; + return this.bookName(65); } if (fbook.search(/\b(revelation|rev|re|revelations|rv)\b/i) !== -1) { - thing.book = 66; - thing.bookname = 'Revelation'; - thing.longbookname = 'Book_of_Revelations'; - thing.lastchapter = 22; - } + return this.bookName(66); + } - return thing; + return this.bookName(0); } public static toString(section: Section) { // get the starting book, chapter, verse - let ref = section.start.bookname.concat(' '). + let ref = section.start.book.name.concat(' '). concat(section.start.chapter).concat(':'). concat(section.start.verse); if (section.start.chapter === section.end.chapter && section.start.verse === section.end.verse && - section.start.book === section.end.book) + section.start.book.name === section.end.book.name) { return ref; } if (section.start.chapter === section.end.chapter && section.start.verse !== section.end.verse && - section.start.book === section.end.book) + section.start.book.name === section.end.book.name) { return ref.concat(' - ').concat(section.end.verse); } - if (section.start.book !== section.end.book) + if (section.start.book.name !== section.end.book.name) { - ref = ref.concat(' - ').concat(section.end.bookname).concat(' '); + ref = ref.concat(' - ').concat(section.end.book.name).concat(' '); } else { @@ -750,97 +532,568 @@ export class Reference return ref.concat(section.end.verse); } + + public static Books: Array = [ + { + name: 'Unkown', + short_name: 'Unk', + long_name: 'Unknown', + book_number: 0, + last_chapter: 0, + chapters: [0] + }, + { + name: 'Genesis', + short_name: 'Gen', + long_name: 'Book of Genesis', + book_number: 1, + last_chapter: 66, + chapters: [0, 31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26] + }, + { + book_number: 2, + short_name: 'Exo', + name: 'Exodus', + long_name: 'Book of Exodus', + last_chapter: 40, + chapters: [0, 22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38] + }, + { + book_number: 3, + name: 'Leviticus', + short_name: 'Lev', + long_name: 'Leviticus', + last_chapter: 27, + chapters: [0, 17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34] + }, + { + book_number: 4, + name: 'Numbers', + short_name: 'Num', + long_name: 'Book of Numbers', + last_chapter: 36, + chapters: [0, 54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13] + }, + { + book_number: 5, + name: 'Deuteronomy', + short_name: 'Deut', + long_name: 'Book of Deuteronomy', + last_chapter: 34, + chapters: [0, 46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22, 19, 19, 26, 68, 29, 20, 30, 52, 29, 12] + }, + { + book_number: 6, + name: 'Joshua', + short_name: 'Joshua', + long_name: 'Book of Joshua', + last_chapter: 24, + chapters: [0, 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33] + }, + { + book_number: 7, + name: 'Judges', + short_name: 'Judges', + long_name: 'Book of Judges', + last_chapter: 21, + chapters: [0, 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25] + }, + { + book_number: 8, + name: 'Ruth', + short_name: 'Ruth', + long_name: 'Book of Ruth', + last_chapter: 4, + chapters: [0, 22, 23, 18, 22] + }, + { + book_number: 9, + name: '1 Samuel', + short_name: '1 Sam', + long_name: 'First Book of Samuel', + last_chapter: 31, + chapters: [0, 28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22, 44, 25, 12, 25, 11, 31, 13] + }, + { + book_number: 10, + name: '2 Samuel', + short_name: '2 Sam', + long_name: 'Second Book of Samuel', + last_chapter: 24, + chapters: [0, 27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25] + }, + { + book_number: 11, + name: '1 Kings', + short_name: '1 Kngs', + long_name: 'First Book of Kings', + last_chapter: 22, + chapters: [0, 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53] + }, + { + book_number: 12, + name: '2 Kings', + short_name: '2 Kngs', + long_name: 'Second Book of Kings', + last_chapter: 25, + chapters: [0, 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30] + }, + { + book_number: 13, + name: '1 Chronicles', + short_name: '1 Chr', + long_name: 'First Book of Chronicles', + last_chapter: 29, + chapters: [0, 54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30] + }, + { + book_number: 14, + name: '2 Chronicles', + short_name: '2 Chr', + long_name: 'Second Book of Chronicles', + last_chapter: 36, + chapters: [0, 17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23] + }, + { + book_number: 15, + name: 'Ezra', + short_name: 'Ezra', + long_name: 'Book of Ezra', + last_chapter: 10, + chapters: [0, 11, 70, 13, 24, 17, 22, 28, 36, 15, 44] + }, + { + book_number: 16, + name: 'Nehemiah', + short_name: 'Neh', + long_name: 'Book of Nehemiah', + last_chapter: 13, + chapters: [0, 11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31] + }, + { + book_number: 17, + name: 'Esther', + short_name: 'Esther', + long_name: 'Book of Esther', + last_chapter: 10, + chapters: [0, 22, 23, 15, 17, 14, 14, 10, 17, 32, 3] + }, + { + book_number: 18, + name: 'Job', + short_name: 'Job', + long_name: 'Book of Job', + last_chapter: 42, + chapters: [0, 22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17] + }, + { + book_number: 19, + name: 'Psalms', + short_name: 'Psalm', + long_name: 'Book of Psalms', + last_chapter: 150, + chapters: [0, 6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14, 9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6, 7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72, 13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35, 45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6] + }, + { + book_number: 20, + name: 'Proverbs', + short_name: 'Prov', + long_name: 'Book of Proverbs', + last_chapter: 31, + chapters: [0, 33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31] + }, + { + book_number: 21, + name: 'Ecclesiastes', + short_name: 'Eccl', + long_name: 'Book of Ecclesiastes', + last_chapter: 12, + chapters: [0, 18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14] + }, + { + book_number: 22, + name: 'Song of Solomon', + short_name: 'Song', + long_name: 'Song of Solomon', + last_chapter: 8, + chapters: [0, 17, 17, 11, 16, 16, 13, 13, 14] + }, + { + book_number: 23, + name: 'Isaiah', + short_name: 'Isaiah', + long_name: 'Book of Isaiah', + last_chapter: 66, + chapters: [0, 31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24] + }, + { + book_number: 24, + name: 'Jeremiah', + short_name: 'Jer', + long_name: 'Book of Jeremiah', + last_chapter: 52, + chapters: [0, 19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34] + }, + { + book_number: 25, + name: 'Lamentations', + short_name: 'Lam', + long_name: 'Book of Lamentations', + last_chapter: 5, + chapters: [0, 22, 22, 66, 22, 22] + }, + { + book_number: 26, + name: 'Ezekiel', + short_name: 'Eze', + long_name: 'Book of Ezekiel', + last_chapter: 48, + chapters: [0, 28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35] + }, + { + book_number: 27, + name: 'Daniel', + short_name: 'Daniel', + long_name: 'Book of Daniel', + last_chapter: 12, + chapters: [0, 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13] + }, + { + book_number: 28, + name: 'Hosea', + short_name: 'Hosea', + long_name: 'Book of Hosea', + last_chapter: 14, + chapters: [0, 11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9] + }, + { + book_number: 29, + name: 'Joel', + short_name: 'Joel', + long_name: 'Book of Joel', + last_chapter: 3, + chapters: [0, 20, 32, 21] + }, + { + book_number: 30, + name: 'Amos', + short_name: 'Amos', + long_name: 'Book of Amos', + last_chapter: 9, + chapters: [0, 15, 16, 15, 13, 27, 14, 17, 14, 15] + }, + { + book_number: 31, + name: 'Obadiah', + short_name: 'Oba', + long_name: 'Book of Obadiah', + last_chapter: 1, + chapters: [0, 21] + }, + { + book_number: 32, + name: 'Jonah', + short_name: 'Jonah', + long_name: 'Book of Jonah', + last_chapter: 4, + chapters: [0, 17, 10, 10, 11] + }, + { + book_number: 33, + name: 'Micah', + short_name: 'Micah', + long_name: 'Book of Micah', + last_chapter: 7, + chapters: [0, 16, 13, 12, 13, 15, 16, 20] + }, + { + book_number: 34, + name: 'Nahum', + short_name: 'Nahum', + long_name: 'Book of Nahum', + last_chapter: 3, + chapters: [0, 15, 13, 19] + }, + { + book_number: 35, + name: 'Habakkuk', + short_name: 'Hab', + long_name: 'Book of Habakkuk', + last_chapter: 3, + chapters: [0, 17, 20, 19] + }, + { + book_number: 36, + name: 'Zephaniah', + short_name: 'Zeph', + long_name: 'Book of Zephaniah', + last_chapter: 3, + chapters: [0, 18, 15, 20] + }, + { + book_number: 37, + name: 'Haggai', + short_name: 'Hag', + long_name: 'Book of Haggai', + last_chapter: 2, + chapters: [0, 15, 23] + }, + { + book_number: 38, + name: 'Zechariah', + short_name: 'Zech', + long_name: 'Book of Zechariah', + last_chapter: 14, + chapters: [0, 21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21] + }, + { + book_number: 39, + name: 'Malachi', + short_name: 'Mal', + long_name: 'Book of Malachi', + last_chapter: 4, + chapters: [0, 14, 17, 18, 6] + }, + { + book_number: 40, + name: 'Matthew', + short_name: 'Matt', + long_name: 'Gospel of Matthew', + last_chapter: 28, + chapters: [0, 25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51, 46, 75, 66, 20] + }, + { + book_number: 41, + name: 'Mark', + short_name: 'Mark', + long_name: 'Gospel of Mark', + last_chapter: 16, + chapters: [0, 45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20] + }, + { + book_number: 42, + name: 'Luke', + short_name: 'Luke', + long_name: 'Gospel of Luke', + last_chapter: 24, + chapters: [0, 80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53] + }, + { + book_number: 43, + name: 'John', + short_name: 'John', + long_name: 'Gospel of John', + last_chapter: 21, + chapters: [0, 51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25] + }, + { + book_number: 44, + name: 'Acts', + short_name: 'Acts', + long_name: 'Acts of the Apostles', + last_chapter: 28, + chapters: [0, 26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27, 32, 44, 31] + }, + { + book_number: 45, + name: 'Romans', + short_name: 'Rom', + long_name: 'Epistle to the Romans', + last_chapter: 16, + chapters: [0, 32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27] + }, + { + book_number: 46, + name: '1 Corinthians', + short_name: '1 Cor', + long_name: 'First Epistle to the Corinthians', + last_chapter: 16, + chapters: [0, 31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24] + }, + { + book_number: 47, + name: '2 Corinthians', + short_name: '2 Cor', + long_name: 'Second Epistle to the Corinthians', + last_chapter: 13, + chapters: [0, 24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14] + }, + { + book_number: 48, + name: 'Galatians', + short_name: 'Gal', + long_name: 'Epistle to the Galatians', + last_chapter: 6, + chapters: [0, 24, 21, 29, 31, 26, 18] + }, + { + book_number: 49, + name: 'Ephesians', + short_name: 'Eph', + long_name: 'Epistle to the Ephesians', + last_chapter: 6, + chapters: [0, 23, 22, 21, 32, 33, 24] + }, + { + book_number: 50, + name: 'Philippians', + short_name: 'Phil', + long_name: 'Epistle to the Philippians', + last_chapter: 4, + chapters: [0, 30, 30, 21, 23] + }, + { + book_number: 51, + name: 'Colossians', + short_name: 'Col', + long_name: 'Epistle to the Colossians', + last_chapter: 4, + chapters: [0, 29, 23, 25, 18] + }, + { + book_number: 52, + name: '1 Thessalonians', + short_name: '1 Thess', + long_name: 'First Epistle to the Thessalonians', + last_chapter: 5, + chapters: [0, 10, 20, 13, 18, 28] + }, + { + book_number: 53, + name: '2 Thessalonians', + short_name: '2 Thess', + long_name: 'Second Epistle to the Thessalonians', + last_chapter: 3, + chapters: [0, 12, 17, 18] + }, + { + book_number: 54, + name: '1 Timothy', + short_name: '1 Tim', + long_name: 'First Epistle to Timothy', + last_chapter: 6, + chapters: [0, 20, 15, 16, 16, 25, 21] + }, + { + book_number: 55, + name: '2 Timothy', + short_name: '2 Tim', + long_name: 'Second Epistle to Timothy', + last_chapter: 4, + chapters: [0, 18, 26, 17, 22] + }, + { + book_number: 56, + name: 'Titus', + short_name: 'Titis', + long_name: 'Epistle to Titus', + last_chapter: 3, + chapters: [0, 16, 15, 15] + }, + { + book_number: 57, + name: 'Philemon', + short_name: 'Phi', + long_name: 'Epistle to Philemon', + last_chapter: 1, + chapters: [0, 25] + }, + { + book_number: 58, + name: 'Hebrews', + short_name: 'Heb', + long_name: 'Epistle to the Hebrews', + last_chapter: 13, + chapters: [0, 14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25] + }, + { + book_number: 59, + name: 'James', + short_name: 'James', + long_name: 'Epistle of James', + last_chapter: 5, + chapters: [0, 27, 26, 18, 17, 20] + }, + { + book_number: 60, + name: '1 Peter', + short_name: '1 Pe', + long_name: 'First Epistle of Peter', + last_chapter: 5, + chapters: [0, 25, 25, 22, 19, 14] + }, + { + book_number: 61, + name: '2 Peter', + short_name: '2 Pe', + long_name: 'Second Epistle of Peter', + last_chapter: 3, + chapters: [0, 21, 22, 18] + }, + { + book_number: 62, + name: '1 John', + short_name: '1 Jn', + long_name: 'First Epistle of John', + last_chapter: 5, + chapters: [0, 10, 29, 24, 21, 21] + }, + { + book_number: 63, + name: '2 John', + short_name: '2 Jn', + long_name: 'Second Epistle of John', + last_chapter: 1, + chapters: [0, 13] + }, + { + book_number: 64, + name: '3 John', + short_name: '3 Jn', + long_name: 'Third Epistle of John', + last_chapter: 1, + chapters: [0, 14] + }, + { + book_number: 65, + name: 'Jude', + short_name: 'Jude', + long_name: 'Epistle to Jude', + last_chapter: 1, + chapters: [0, 25] + }, + { + book_number: 66, + name: 'Revelation', + short_name: 'Rev', + long_name: 'Book of Revelations', + last_chapter: 22, + chapters: [0, 20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21] + } + ]; - public static bookName(booknum: number): string + public static bookName(booknum: number): Book { - let book = new Array(); - book[0] = ''; - book[1] = 'Genesis'; - book[2] = 'Exodus'; - book[3] = 'Leviticus'; - book[4] = 'Numbers'; - book[5] = 'Deuteronomy'; - book[6] = 'Joshua'; - book[7] = 'Judges'; - book[8] = 'Ruth'; - book[9] = '1 Samuel'; - book[10] = '2 Samuel'; - book[11] = '1 Kings'; - book[12] = '2 Kings'; - book[13] = '1 Chronicles'; - book[14] = '2 Chronicles'; - book[15] = 'Ezra'; - book[16] = 'Nehemiah'; - book[17] = 'Esther'; - book[18] = 'Job'; - book[19] = 'Psalm'; - book[20] = 'Proverbs'; - book[21] = 'Ecclesiastes'; - book[22] = 'Song of Songs'; - book[23] = 'Isaiah'; - book[24] = 'Jeremiah'; - book[25] = 'Lamentations'; - book[26] = 'Ezekiel'; - book[27] = 'Daniel'; - book[28] = 'Hosea'; - book[29] = 'Joel'; - book[30] = 'Amos'; - book[31] = 'Obadiah'; - book[32] = 'Jonah'; - book[33] = 'Micah'; - book[34] = 'Nahum'; - book[35] = 'Habakkuk'; - book[36] = 'Zephaniah'; - book[37] = 'Haggai'; - book[38] = 'Zechariah'; - book[39] = 'Malachi'; - book[40] = 'Matthew'; - book[41] = 'Mark'; - book[42] = 'Luke'; - book[43] = 'John'; - book[44] = 'Acts'; - book[45] = 'Romans'; - book[46] = '1 Corinthians'; - book[47] = '2 Corinthians'; - book[48] = 'Galatians'; - book[49] = 'Ephesians'; - book[50] = 'Philippians'; - book[51] = 'Colossians'; - book[52] = '1 Thessalonians'; - book[53] = '2 Thessalonians'; - book[54] = '1 Timothy'; - book[55] = '2 Timothy'; - book[56] = 'Titus'; - book[57] = 'Philemon'; - book[58] = 'Hebrews'; - book[59] = 'James'; - book[60] = '1 Peter'; - book[61] = '2 Peter'; - book[62] = '1 John'; - book[63] = '2 John'; - book[64] = '3 John'; - book[65] = 'Jude'; - book[66] = 'Revelation'; - - return book[booknum]; + return this.Books[booknum]; } } +export type Book = { + name: string, + short_name: string, + long_name: string, + book_number: number, + last_chapter: number, + chapters: [number], +}; + export type Section = { - start: { - book: number, - bookname: string, - longbookname: string, - lastchapter: number, - chapter: string, - verse: string, - }, - end: { - book: number, - bookname: string, - longbookname: string, - lastchapter: number, - chapter: string, - verse: string, - } -}; \ No newline at end of file + start: Location, + end: Location, +}; + +export type Location = { + book: Book, + chapter: string, + verse: string, +} diff --git a/DynamicBibleIonic/src/libs/UserProfile.ts b/DynamicBibleIonic/src/libs/UserProfile.ts index 858af537..b1305e69 100644 --- a/DynamicBibleIonic/src/libs/UserProfile.ts +++ b/DynamicBibleIonic/src/libs/UserProfile.ts @@ -1,5 +1,5 @@ -import { Storage } from '@ionic/storage'; -import { CardItem } from "../pages/search/search"; +import { Storage } from '@ionic/storage'; +import { CardItem } from '../pages/search/search'; export class UserProfile { @@ -12,7 +12,7 @@ export class UserProfile public textSizeChanged() { - $("html").css("font-size", this.user.font_size + "px"); + $('html').css('font-size', this.user.font_size + 'px'); } public update(t: UserProfile, local: Storage) @@ -83,10 +83,10 @@ export type User = { insert_next_to_item: boolean, font_size: number, saved_pages: SavedPage[], - verses_on_new_line: boolean + verses_on_new_line: boolean, } export type SavedPage = { queries: CardItem[], - title: string + title: string, } diff --git a/DynamicBibleIonic/src/pages/search/search.html b/DynamicBibleIonic/src/pages/search/search.html index 840539eb..10e586c7 100644 --- a/DynamicBibleIonic/src/pages/search/search.html +++ b/DynamicBibleIonic/src/pages/search/search.html @@ -59,6 +59,9 @@ + @@ -85,4 +88,4 @@ [cardItem]="item" (onClose)="removeItem($event)"> - \ No newline at end of file + diff --git a/DynamicBibleIonic/src/pages/search/search.ts b/DynamicBibleIonic/src/pages/search/search.ts index def47a5e..b209fde0 100644 --- a/DynamicBibleIonic/src/pages/search/search.ts +++ b/DynamicBibleIonic/src/pages/search/search.ts @@ -3,10 +3,11 @@ import { Loading, LoadingController, ModalController, NavParams, AlertController import { Storage } from '@ionic/storage'; import { StrongsModal } from '../../components/strongs-modal/strongs-modal'; -import { PagesService } from "../../services/pages-service"; +import { PagesService } from '../../services/pages-service'; import { UserProfile } from '../../libs/UserProfile'; import { Reference } from '../../libs/Reference'; +import { VersePickerModal } from '../../components/verse-picker/verse-picker'; @Component({ templateUrl: 'search.html' @@ -64,16 +65,16 @@ export class SearchPage implements OnInit for (let i in u.user.items) { let ci = u.user.items[i]; - if (ci["data"] !== undefined) + if (ci['data'] !== undefined) { - if (ci["data"].qry !== undefined) - u.user.items[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type }; - else if (ci["data"].ref !== undefined) - u.user.items[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type }; - else if (ci["data"].word !== undefined) - u.user.items[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type }; - else if (ci["data"].sn !== undefined) - u.user.items[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type }; + if (ci['data'].qry !== undefined) + u.user.items[i] = { qry: ci['data'].qry, dict: ci.dict, type: ci.type }; + else if (ci['data'].ref !== undefined) + u.user.items[i] = { qry: ci['data'].ref, dict: ci.dict, type: ci.type }; + else if (ci['data'].word !== undefined) + u.user.items[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type }; + else if (ci['data'].sn !== undefined) + u.user.items[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type }; has_migrated = true; } @@ -84,16 +85,16 @@ export class SearchPage implements OnInit for (let i in pg.queries) { let ci = pg.queries[i]; - if (ci["data"] !== undefined) + if (ci['data'] !== undefined) { - if (ci["data"].qry !== undefined) - pg.queries[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type }; - else if (ci["data"].ref !== undefined) - pg.queries[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type }; - else if (ci["data"].word !== undefined) - pg.queries[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type }; - else if (ci["data"].sn !== undefined) - pg.queries[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type }; + if (ci['data'].qry !== undefined) + pg.queries[i] = { qry: ci['data'].qry, dict: ci.dict, type: ci.type }; + else if (ci['data'].ref !== undefined) + pg.queries[i] = { qry: ci['data'].ref, dict: ci.dict, type: ci.type }; + else if (ci['data'].word !== undefined) + pg.queries[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type }; + else if (ci['data'].sn !== undefined) + pg.queries[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type }; has_migrated = true; } @@ -107,7 +108,7 @@ export class SearchPage implements OnInit this.userProfile.user.items = this.params.data.queries.slice(); if (this.params.data.title === undefined) - this.title = "Search"; + this.title = 'Search'; else this.title = this.params.data.title; @@ -143,7 +144,7 @@ export class SearchPage implements OnInit { text: 'Cancel', role: 'cancel', - handler: data => + handler: (): void => { console.log('Cancel clicked'); } @@ -198,6 +199,12 @@ export class SearchPage implements OnInit return t === 'Words'; } + versePicker() + { + let modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this }); + modal.present(); + } + removeItem(item) { let idx = this.userProfile.user.items.indexOf(item); @@ -235,10 +242,10 @@ export class SearchPage implements OnInit this.last = data.card; this.updateUIwithItems(data.qry, data.from_search_bar); } - + getItemList(search: string): Promise { - return new Promise((resolve, reject) => + return new Promise((resolve) => { let list: CardItem[] = []; @@ -274,7 +281,7 @@ export class SearchPage implements OnInit if (q.trim() !== '') { let myref = new Reference(q.trim()); - list.push({ qry: myref.toString(), dict: myref.Section.start.book > 39 ? 'G' : 'H', type: 'Passage' }); + list.push({ qry: myref.toString(), dict: myref.Section.start.book.book_number > 39 ? 'G' : 'H', type: 'Passage' }); } } } @@ -305,7 +312,7 @@ export class SearchPage implements OnInit { for (let item of lst) { - if (item.type === "Strongs" && this.userProfile.user.strongs_modal && !from_search_bar) + if (item.type === 'Strongs' && this.userProfile.user.strongs_modal && !from_search_bar) { let modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(item.qry), dict: item.dict, onItemClicked: this }); modal.present(); @@ -330,4 +337,4 @@ class Item data: any; type: Type; dict: string; -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/services/bible-service.ts b/DynamicBibleIonic/src/services/bible-service.ts index b1d19e19..17b743de 100644 --- a/DynamicBibleIonic/src/services/bible-service.ts +++ b/DynamicBibleIonic/src/services/bible-service.ts @@ -1,4 +1,4 @@ -/// +/// /// import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; @@ -18,7 +18,7 @@ export class BibleService getResultAsPromise(section: Section): Promise { - return new Promise((resolve, reject) => { resolve(this.getResult(section)); }); + return new Promise((resolve) => { resolve(this.getResult(section)); }); } getResult(section: Section): BiblePassageResult @@ -36,17 +36,17 @@ export class BibleService lastverse: 0 }; - if (Number(section.start.chapter) > section.start.lastchapter) + if (Number(section.start.chapter) > section.start.book.last_chapter) { self.result.status = -1; - self.result.msg = 'The requested chapter for ' + section.start.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.start.lastchapter + '.'; + self.result.msg = 'The requested chapter for ' + section.start.book.name + ' is out of range. Please pick a chapter between 1 and ' + section.start.book.last_chapter + '.'; return self.result; } - if (Number(section.end.chapter) > section.end.lastchapter) + if (Number(section.end.chapter) > section.end.book.last_chapter) { self.result.status = -1; - self.result.msg = 'The requested chapter for ' + section.end.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.end.lastchapter + '.'; + self.result.msg = 'The requested chapter for ' + section.end.book.name + ' is out of range. Please pick a chapter between 1 and ' + section.end.book.last_chapter + '.'; return self.result; } @@ -54,7 +54,7 @@ export class BibleService for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++) { - const url = 'data/bibles/kjv_strongs/' + section.start.book + '-' + i + '.json'; + const url = 'data/bibles/kjv_strongs/' + section.start.book.book_number + '-' + i + '.json'; $.ajax({ async: false, @@ -125,7 +125,7 @@ export class BibleService } - if (section.start.book >= 40) + if (section.start.book.book_number >= 40) this.result.testament = 'new'; else this.result.testament = 'old'; @@ -161,4 +161,4 @@ type BibleVerse = { t: string, s: string, } ], -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/services/pages-service.ts b/DynamicBibleIonic/src/services/pages-service.ts index 75ec22ee..659aaaec 100644 --- a/DynamicBibleIonic/src/services/pages-service.ts +++ b/DynamicBibleIonic/src/services/pages-service.ts @@ -1,10 +1,10 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; import { Storage } from '@ionic/storage'; -import { SearchPage } from "../pages/search/search"; -import { SettingsPage } from "../pages/settings/settings"; -import { HelpPage } from "../pages/help/help"; +import { SearchPage } from '../pages/search/search'; +import { SettingsPage } from '../pages/settings/settings'; +import { HelpPage } from '../pages/help/help'; -import { SavedPage } from "../libs/UserProfile"; +import { SavedPage } from '../libs/UserProfile'; @Injectable() export class PagesService @@ -15,9 +15,9 @@ export class PagesService constructor(public local: Storage) { this.pages = [ - { title: 'Search', component: SearchPage, params: { queries: [], title: "Search" }, icon: "search" }, - { title: 'Settings', component: SettingsPage, params: {}, icon: "settings" }, - { title: 'Help', component: HelpPage, params: {}, icon: "help-circle" } + { title: 'Search', component: SearchPage, params: { queries: [], title: 'Search' }, icon: 'search' }, + { title: 'Settings', component: SettingsPage, params: {}, icon: 'settings' }, + { title: 'Help', component: HelpPage, params: {}, icon: 'help-circle' } ]; this.savedPages = []; } @@ -46,4 +46,4 @@ export class PagesService this.savedPages.push({ title: p.title, component: SearchPage, params: { queries: p.queries, title: p.title } }); } } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/src/services/strongs-service.ts b/DynamicBibleIonic/src/services/strongs-service.ts index 796aa91e..df85ee62 100644 --- a/DynamicBibleIonic/src/services/strongs-service.ts +++ b/DynamicBibleIonic/src/services/strongs-service.ts @@ -1,6 +1,6 @@ /// -import { Injectable } from "@angular/core"; -import { Http } from "@angular/http"; +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; @Injectable() export class StrongsService @@ -21,20 +21,20 @@ export class StrongsService { const self = this; this.result = { - prefix: "", + prefix: '', sn: -1, strongs: [], def: null, rmac: null, crossrefs: null, - rmaccode: "", + rmaccode: '', status: 0, - msg: ":)" + msg: ':)' }; - let url = dict + Math.ceil(sn / 100) + ".json"; - if (dict === "grk") + let url = dict + Math.ceil(sn / 100) + '.json'; + if (dict === 'grk') { - self.result.prefix = "G"; + self.result.prefix = 'G'; if (sn > 5624 || sn < 1) { self.result.status = -1; @@ -43,7 +43,7 @@ export class StrongsService } else { - self.result.prefix = "H"; + self.result.prefix = 'H'; if (sn > 8674 || sn < 1) { self.result.status = -1; @@ -52,14 +52,14 @@ export class StrongsService } this.result.sn = sn; - if (self.result.status == -1) + if (self.result.status === -1) return self.result; $.ajax({ async: false, - type: "GET", - url: "data/strongs/" + url, - dataType: "json", + type: 'GET', + url: 'data/strongs/' + url, + dataType: 'json', success(d: StrongsDefinition[], t, x) { self.result.strongs = d; @@ -80,9 +80,9 @@ export class StrongsService $.ajax({ async: false, - type: "GET", - url: "data/strongscr/cr" + url, - dataType: "json", + type: 'GET', + url: 'data/strongscr/cr' + url, + dataType: 'json', success(d: StrongsCrossReference[], t, x) { for (let cr of d) @@ -105,17 +105,17 @@ export class StrongsService if (self.result.status === -1) return self.result; - if (dict === "grk") + if (dict === 'grk') { - url = "data/rmac/rs" + (Math.ceil(sn / 1000)) + ".json"; + url = 'data/rmac/rs' + (Math.ceil(sn / 1000)) + '.json'; let rmac_cross_references: RMACCrossReference[]; // rmac is a two get process. $.ajax({ async: false, - type: "GET", + type: 'GET', url: url, - dataType: "json", + dataType: 'json', success(d: RMACCrossReference[], t, x) { rmac_cross_references = d; @@ -127,8 +127,8 @@ export class StrongsService }); // deal with RMAC - let tmp = $.grep(rmac_cross_references, (el, i) => { return el.i === sn + "" ? true : false; }); - if (tmp.length == 0) + let tmp = $.grep(rmac_cross_references, (el, i) => { return el.i === sn + ''; }); + if (tmp.length === 0) return this.result; this.result.rmaccode = tmp[0].r; @@ -137,9 +137,9 @@ export class StrongsService url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`; $.ajax({ async: false, - type: "GET", + type: 'GET', url: url, - dataType: "json", + dataType: 'json', success(d: RMACDefinition[], t, x) { for (let rmac of d) @@ -171,7 +171,7 @@ export type StrongsResult = crossrefs: StrongsCrossReference, rmaccode: string, status: number, - msg: string + msg: string, }; type StrongsDefinition = { n: number, i: string, tr: string, de: StrongsDefinitionPart[], lemma: string, p: string } @@ -186,9 +186,9 @@ type StrongsCrossReference = w: string, rs: [ { r: string } - ] + ], } - ] + ], } type RMACDefinition = { id: string, d: string[] } diff --git a/DynamicBibleIonic/src/services/word-service.ts b/DynamicBibleIonic/src/services/word-service.ts index 7115d3e1..6d957b0e 100644 --- a/DynamicBibleIonic/src/services/word-service.ts +++ b/DynamicBibleIonic/src/services/word-service.ts @@ -1,6 +1,6 @@ -/// -import { Injectable } from "@angular/core"; -import { Http } from "@angular/http"; +/// +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; @Injectable() export class WordService @@ -13,7 +13,7 @@ export class WordService { qry = qry.toLowerCase(); // TODO(jeremy): Should we strip punctuation as well? - return qry.replace(/'/g, "").replace(/\s+/g, " ").split(" "); + return qry.replace(/'/g, '').replace(/\s+/g, ' ').split(' '); } getResultAsPromise(qry: string): Promise @@ -39,7 +39,7 @@ export class WordService { if (q <= words[w]) { - results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q)); + results.unshift(this.getSearchReferences('data/index/' + words[w] + 'idx.json', q)); break; } } @@ -47,7 +47,7 @@ export class WordService { if (q <= words[w] && q > words[w - 1]) { - results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q)); + results.unshift(this.getSearchReferences('data/index/' + words[w] + 'idx.json', q)); break; } } @@ -57,7 +57,7 @@ export class WordService // Now we need to test results. If there is more than one item in the array, we need to find the set // that is shared by all of them. IF not, we can just return those refs. if (results.length === 0) - return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." }; + return { word: qry, refs: [], status: -1, msg: 'No passages found for query: ' + qry + '.' }; let shared: string[]; if (results.length === 1) { @@ -68,9 +68,9 @@ export class WordService } if (shared == null || shared.length === 0) - return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." }; + return { word: qry, refs: [], status: -1, msg: 'No passages found for query: ' + qry + '.' }; - return { word: qry, refs: shared, status: 0, msg: ":)" }; + return { word: qry, refs: shared, status: 0, msg: ':)' }; } /** @@ -86,9 +86,9 @@ export class WordService $.ajax({ async: false, - type: "GET", + type: 'GET', url: url, - dataType: "json", + dataType: 'json', success(d: IndexResult[], t, x) { r = d; @@ -377,7 +377,7 @@ export class WordService { for (let i = 0; i < refs.length; i++) { - let r = refs[i].split(":"); + let r = refs[i].split(':'); // convert references to single integers. // Book * 100000000, Chapter * 10000, Verse remains same, add all together. let ref = r[0] * 100000000; @@ -401,7 +401,7 @@ export class WordService for (let i = 0; i < result.length; i++) { let ref = result[i]; - result[i] = Math.floor(ref / 100000000) + ":" + Math.floor((ref % 100000000) / 10000) + ":" + Math.floor((ref % 100000000) % 10000); + result[i] = Math.floor(ref / 100000000) + ':' + Math.floor((ref % 100000000) / 10000) + ':' + Math.floor((ref % 100000000) % 10000); } return result; @@ -459,4 +459,4 @@ export type WordLookupResult = { type IndexResult = { refs: string[]; word: string; -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/www/assets/fonts/ionicons.eot b/DynamicBibleIonic/www/assets/fonts/ionicons.eot new file mode 100644 index 00000000..94ba2be3 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/ionicons.eot differ diff --git a/DynamicBibleIonic/www/assets/fonts/ionicons.scss b/DynamicBibleIonic/www/assets/fonts/ionicons.scss new file mode 100644 index 00000000..436a3091 --- /dev/null +++ b/DynamicBibleIonic/www/assets/fonts/ionicons.scss @@ -0,0 +1,50 @@ + +// Ionicons Icon Font CSS +// -------------------------- +// Ionicons CSS for Ionic's element +// ionicons-icons.scss has the icons and their unicode characters + +$ionicons-font-path: $font-path !default; + +@import "ionicons-icons"; +@import "ionicons-variables"; + + +@font-face { + font-family: "Ionicons"; + src: url("#{$ionicons-font-path}/ionicons.woff2?v=#{$ionicons-version}") format("woff2"), + url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"), + url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype"); + font-weight: normal; + font-style: normal; +} + +ion-icon { + display: inline-block; + + font-family: "Ionicons"; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + font-style: normal; + font-variant: normal; + font-weight: normal; + line-height: 1; + text-rendering: auto; + text-transform: none; + speak: none; + + @include rtl() { + &[aria-label^="arrow"]::before, + &[flip-rtl]::before { + transform: scaleX(-1); + } + + &[unflip-rtl]::before { + transform: scaleX(1); + } + } + + &::before { + display: inline-block; + } +} diff --git a/DynamicBibleIonic/www/assets/fonts/ionicons.svg b/DynamicBibleIonic/www/assets/fonts/ionicons.svg new file mode 100644 index 00000000..908c39b8 --- /dev/null +++ b/DynamicBibleIonic/www/assets/fonts/ionicons.svg @@ -0,0 +1,2630 @@ + + + + + +Created by FontForge 20150913 at Mon Jan 11 15:33:02 2016 + By Adam Bradley +Copyright (c) 2016, Adam Bradley + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DynamicBibleIonic/www/assets/fonts/ionicons.ttf b/DynamicBibleIonic/www/assets/fonts/ionicons.ttf new file mode 100644 index 00000000..307ad889 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/ionicons.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.ttf b/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.ttf new file mode 100644 index 00000000..6e00cdce Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.woff b/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.woff new file mode 100644 index 00000000..6a67f6e2 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/noto-sans-bold.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.ttf b/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.ttf new file mode 100644 index 00000000..9dd10199 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.woff b/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.woff new file mode 100644 index 00000000..8245f8b3 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/noto-sans-regular.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/noto-sans.scss b/DynamicBibleIonic/www/assets/fonts/noto-sans.scss new file mode 100644 index 00000000..cb8602d7 --- /dev/null +++ b/DynamicBibleIonic/www/assets/fonts/noto-sans.scss @@ -0,0 +1,34 @@ +// Noto Sans Font +// Google +// Apache License, version 2.0 +// http://www.apache.org/licenses/LICENSE-2.0.html + +$noto-sans-font-path: $font-path !default; + +@font-face { + font-family: "Noto Sans"; + font-style: normal; + font-weight: 300; + src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Noto Sans"; + font-style: normal; + font-weight: 400; + src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Noto Sans"; + font-style: normal; + font-weight: 500; + src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype"); +} + +@font-face { + font-family: "Noto Sans"; + font-style: normal; + font-weight: 700; + src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype"); +} diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-bold.ttf b/DynamicBibleIonic/www/assets/fonts/roboto-bold.ttf new file mode 100644 index 00000000..4e35166a Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-bold.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff b/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff new file mode 100644 index 00000000..3143de29 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff2 b/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff2 new file mode 100644 index 00000000..e9d591eb Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-bold.woff2 differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-light.ttf b/DynamicBibleIonic/www/assets/fonts/roboto-light.ttf new file mode 100644 index 00000000..5e26ccdb Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-light.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-light.woff b/DynamicBibleIonic/www/assets/fonts/roboto-light.woff new file mode 100644 index 00000000..1bff3ec4 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-light.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-light.woff2 b/DynamicBibleIonic/www/assets/fonts/roboto-light.woff2 new file mode 100644 index 00000000..94a60b95 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-light.woff2 differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-medium.ttf b/DynamicBibleIonic/www/assets/fonts/roboto-medium.ttf new file mode 100644 index 00000000..03471063 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-medium.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff b/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff new file mode 100644 index 00000000..d3c82e18 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff2 b/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff2 new file mode 100644 index 00000000..74aaff44 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-medium.woff2 differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-regular.ttf b/DynamicBibleIonic/www/assets/fonts/roboto-regular.ttf new file mode 100644 index 00000000..05037ed5 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-regular.ttf differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff b/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff new file mode 100644 index 00000000..5e353cf4 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff2 b/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff2 new file mode 100644 index 00000000..96a60155 Binary files /dev/null and b/DynamicBibleIonic/www/assets/fonts/roboto-regular.woff2 differ diff --git a/DynamicBibleIonic/www/assets/fonts/roboto.scss b/DynamicBibleIonic/www/assets/fonts/roboto.scss new file mode 100644 index 00000000..ea297073 --- /dev/null +++ b/DynamicBibleIonic/www/assets/fonts/roboto.scss @@ -0,0 +1,34 @@ +// Roboto Font +// Google +// Apache License, version 2.0 +// http://www.apache.org/licenses/LICENSE-2.0.html + +$roboto-font-path: $font-path !default; + +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 300; + src: local("Roboto Light"), local("Roboto-Light"), url("#{$roboto-font-path}/roboto-light.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-light.woff") format("woff"), url("#{$roboto-font-path}/roboto-light.ttf") format("truetype"); +} + +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 400; + src: local("Roboto"), local("Roboto-Regular"), url("#{$roboto-font-path}/roboto-regular.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-regular.woff") format("woff"), url("#{$roboto-font-path}/roboto-regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 500; + src: local("Roboto Medium"), local("Roboto-Medium"), url("#{$roboto-font-path}/roboto-medium.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-medium.woff") format("woff"), url("#{$roboto-font-path}/roboto-medium.ttf") format("truetype"); +} + +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 700; + src: local("Roboto Bold"), local("Roboto-Bold"), url("#{$roboto-font-path}/roboto-bold.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-bold.woff") format("woff"), url("#{$roboto-font-path}/roboto-bold.ttf") format("truetype"); +} diff --git a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs index 9bf79cc9..15f93ad3 100644 --- a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs +++ b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs @@ -227,11 +227,28 @@ namespace DynamicBibleUtility _thread.Start(); } + private class ChapterRecord + { + public int Number { get; set; } + public int Last { get; set; } + } + + private class BookRecord + { + public int Number { get; set; } + public string ShortName { get; set; } = string.Empty; + public string LongName { get; set; } = string.Empty; + public int LastChapter { get; set; } + public List Chapters { get; set; } = new List(); + + } + private void CreateText() { // iterate through text, output json format. var ofd = new OpenFileDialog(); var bbl = new List(); + var book_records = new List(); if (ofd.ShowDialog() == DialogResult.OK) { @@ -245,12 +262,17 @@ namespace DynamicBibleUtility if (el.Name != "BIBLEBOOK") continue; var bk = new Book { bk = Convert.ToInt32(el.FirstAttribute.Value) }; + var br = new BookRecord {Number = bk.bk}; + book_records.Add(br); + br.Chapters.Add(0); foreach (XElement chn in el.Nodes()) { var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) }; + var last = 0; foreach (XElement vs in chn.Nodes()) { var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) }; + last = v.v; foreach (var o in vs.Nodes()) { v.w.AddRange(ProcessText(o)); @@ -297,7 +319,7 @@ namespace DynamicBibleUtility ch.vss.Add(v); } bk.chs.Add(ch); - + br.Chapters.Add(last); File.WriteAllText(bk.bk + "-" + ch.ch + ".json", JSON.Serialize(ch).Replace(",\"s\":\"\"", "")); } bbl.Add(bk); @@ -305,6 +327,7 @@ namespace DynamicBibleUtility UpdateStatus("Book: " + bk.bk + "\r\n"); } // finished. + File.WriteAllText("books.json", JSON.Serialize(book_records)); } }