FEATURE: Added a verse picker

This commit is contained in:
jason.wall 2017-08-23 17:53:03 -04:00
parent 72138ae018
commit e3b84c7913
40 changed files with 3631 additions and 576 deletions

View File

@ -21,6 +21,7 @@ import { Words } from "../components/words/words";
import { Error } from "../components/error/error"; import { Error } from "../components/error/error";
import { StrongsModal } from "../components/strongs-modal/strongs-modal"; import { StrongsModal } from "../components/strongs-modal/strongs-modal";
import { ErrorMessage } from '../components/error-message/error-message'; import { ErrorMessage } from '../components/error-message/error-message';
import { VersePickerModal} from '../components/verse-picker/verse-picker';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -32,6 +33,7 @@ import { ErrorMessage } from '../components/error-message/error-message';
Passage, Passage,
Strongs, Strongs,
StrongsModal, StrongsModal,
VersePickerModal,
Words, Words,
Error, Error,
ErrorMessage ErrorMessage
@ -51,6 +53,7 @@ import { ErrorMessage } from '../components/error-message/error-message';
Passage, Passage,
Strongs, Strongs,
StrongsModal, StrongsModal,
VersePickerModal,
Words, Words,
Error, Error,
ErrorMessage ErrorMessage

View File

@ -34,7 +34,7 @@
<button ion-button icon-center clear (click)="expand()"> <button ion-button icon-center clear (click)="expand()">
<ion-icon name="code-working"></ion-icon> <ion-icon name="code-working"></ion-icon>
</button> </button>
<button ion-button icon-center clear (click)="next()" *ngIf="ref !== undefined && ref.Section.end.chapter !== ref.Section.end.lastchapter.toString()"> <button ion-button icon-center clear (click)="next()" *ngIf="ref !== undefined && ref.Section.end.chapter !== ref.Section.end.book.last_chapter.toString()">
<ion-icon name="fastforward"></ion-icon> <ion-icon name="fastforward"></ion-icon>
</button> </button>
</div> </div>

View File

@ -114,9 +114,9 @@ export class Passage implements OnInit
else else
this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - this.data.lastverse).toString(); 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(); this.ref.Section.end.verse = this.data.lastverse.toString();
} }
} }

View File

@ -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 { Platform, NavParams, ViewController } from 'ionic-angular';
import { Reference } from '../../libs/Reference'; import { Reference } from '../../libs/Reference';
import { StrongsResult, StrongsService } from '../../services/strongs-service'; import { StrongsResult, StrongsService } from '../../services/strongs-service';
@Component({ @Component({
selector: "strongs-modal", selector: 'strongs-modal',
templateUrl: "strongs-modal.html", templateUrl: 'strongs-modal.html',
providers: [StrongsService] providers: [StrongsService]
}) })
export class StrongsModal implements OnInit export class StrongsModal implements OnInit
@ -50,7 +50,7 @@ export class StrongsModal implements OnInit
makePassage(p: string) 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) openPassage(p: string)
@ -58,4 +58,4 @@ export class StrongsModal implements OnInit
let ref = this.makePassage(p); let ref = this.makePassage(p);
this.onItemClicked.emit(ref); this.onItemClicked.emit(ref);
} }
} }

View File

@ -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 { 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'; import { StrongsResult, StrongsService } from '../../services/strongs-service';
@Component({ @Component({
selector: "strongs", selector: 'strongs',
templateUrl: "strongs.html", templateUrl: 'strongs.html',
providers: [StrongsService] providers: [StrongsService]
}) })
export class Strongs implements AfterViewChecked, OnInit export class Strongs implements AfterViewChecked, OnInit
@ -28,13 +28,13 @@ export class Strongs implements AfterViewChecked, OnInit
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(evt) 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; let len = $(el).find('.scroll-content .scroll-zoom-wrapper dl span').length;
len += $(el).find(".scroll-content .scroll-zoom-wrapper dl dd").length; len += $(el).find('.scroll-content .scroll-zoom-wrapper dl dd').length;
if (len < 20) 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', fill: 'forwards',
duration: d, duration: d,
iterations: 1, iterations: 1,
easing: 'ease-in-out', easing: 'ease-in-out'
}); });
setTimeout(() => setTimeout(() =>
{ {
@ -75,7 +75,7 @@ export class Strongs implements AfterViewChecked, OnInit
makePassage(p: string) 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) openPassage(p: string)
@ -83,4 +83,4 @@ export class Strongs implements AfterViewChecked, OnInit
let ref = this.makePassage(p); let ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
} }
} }

View File

@ -1,7 +1,7 @@
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<ion-title> <ion-title>
<ion-icon name="paper" item-start></ion-icon> <span *ngIf="item !== undefined"><span *ngIf="item.status === -1">Error:</span>Strongs: {{item.prefix}}{{item.sn}}</span> <ion-icon name="albums" item-start></ion-icon> Verse Picker
</ion-title> </ion-title>
<ion-buttons start> <ion-buttons start>
<button ion-button (click)="dismiss()" large> <button ion-button (click)="dismiss()" large>
@ -10,34 +10,29 @@
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content padding *ngIf="item !== undefined && item.status === 0"> <ion-content>
<br> <span *ngIf="hasBook === false">
<h2>Strong's Definitition</h2> <h3>Old Testament</h3>
<p> <div>
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b> <span *ngFor="let bk of this.books"><a class="button" (click)="setBook(bk)" *ngIf="bk.book_number !== 0 && bk.book_number < 40">{{bk.short_name}}</a></span>
- {{item.def.p}} - {{item.def.lemma}} - </div>
<span *ngFor="let part of item.def.de"><template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></template><template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></template></span><br> <h3>New Testament</h3>
</p> <div>
<template [ngIf]="item.rmac !== null"> <span *ngFor="let bk of this.books"><a class="button" (click)="setBook(bk)" *ngIf="bk.book_number !== 0 && bk.book_number > 39">{{bk.short_name}}</a></span>
<h2>RMAC</h2> </div>
<b>{{item.rmac.id}}</b> </span>
<br> <br /><br />
<ul> <span *ngIf="hasBook === true">
<li *ngFor="let c of item.rmac.d"> <button class="backbutton" ion-button (click)="toBooks()" block icon-left>
{{c}} <ion-icon name="backspace"></ion-icon>
</li> Return to Books
</ul> </button>
</template> <h3>{{book.name}}</h3>
<div class="strongs-cross" *ngIf="item.crossrefs != null && item.crossrefs.ss != null"> <div>
<h2>Cross References</h2> <span *ngFor="let bk of book.chapters; index as i"><a class="button" (click)="setChapter(i)" *ngIf="i !== 0">{{i}}</a></span>
&nbsp;&nbsp;&nbsp;Translated as {{item.crossrefs.ss.length}} words </div>
<dl> </span>
<dd *ngFor="let wrd of item.crossrefs.ss">
<strong>{{wrd.w}}:</strong> <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
</dd>
</dl>
</div>
</ion-content> </ion-content>
<ion-content *ngIf="item !== undefined && item.status === -1"> <ion-content *ngIf="item !== undefined && item.status === -1">
<error-message [msg]="item.msg"></error-message> <error-message [msg]="item.msg"></error-message>
</ion-content> </ion-content>

View File

@ -1,25 +1,36 @@
strongs-modal { verse-picker {
a { .button {
cursor: pointer !important; color: #fff;
color: black; font-size: 1em;
border-bottom: 1px dotted #b3bfd0; float: left;
padding: .5em;
background-color: #1c2e4c;
margin: .3em;
text-align: center;
width: 65px;
} }
.bar-button-ios { .backbutton {
padding-right: 25px; width: 100%;
padding-left: 9px; font-family: inherit;
text-transform: inherit;
} }
.bar-button-md, .bar-button-wp { .backbutton:hover:not(.disable-hover) {
padding-left: 25px; background-color: #2b4166;
padding-right: 9px;
} }
.scroll-content { ion-content {
line-height: 1.5em; div, h3 {
} clear: both;
}
dd { div {
line-height: 1.7em; margin: 1em;
}
h3 {
padding-top: .5em;
}
} }
} }

View File

@ -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 { Platform, NavParams, ViewController } from 'ionic-angular';
import { Book, Reference } from '../../libs/Reference';
@Component({ @Component({
selector: "verse-picker", selector: 'verse-picker',
templateUrl: "verse-picker.html" templateUrl: 'verse-picker.html'
}) })
export class VersePickerModal implements OnInit export class VersePickerModal
{ {
@Output() @Output()
onItemClicked = new EventEmitter<string>(); onItemClicked = new EventEmitter<string>();
books: Array<Book>;
hasBook: boolean = false;
book: Book;
constructor( constructor(
public platform: Platform, public platform: Platform,
public params: NavParams, public params: NavParams,
public viewCtrl: ViewController public viewCtrl: ViewController
) )
{ {
this.hasBook = false;
this.books = Reference.Books;
this.onItemClicked.subscribe(item => this.onItemClicked.subscribe(item =>
{ {
let pg = this.params.get('onItemClicked'); 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(); this.viewCtrl.dismiss();
} }
setBook(book: Book)
openItem(p: string)
{ {
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(); this.dismiss();
} }
} }

View File

@ -1,12 +1,12 @@
/// <reference path="../../../typings/globals/jquery/index.d.ts" /> /// <reference path="../../../typings/globals/jquery/index.d.ts" />
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 { 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'; import { WordLookupResult, WordService } from '../../services/word-service';
@Component({ @Component({
selector: "words", selector: 'words',
templateUrl: "words.html", templateUrl: 'words.html',
providers: [WordService] providers: [WordService]
}) })
export class Words implements AfterViewChecked, OnInit export class Words implements AfterViewChecked, OnInit
@ -31,40 +31,40 @@ export class Words implements AfterViewChecked, OnInit
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(evt) 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 wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0];
let len = $(el).find(".scroll-zoom-wrapper a").length; let len = $(el).find('.scroll-zoom-wrapper a').length;
if (wr.scrollWidth < 500) // 1 col if (wr.scrollWidth < 500) // 1 col
{ {
// 5 rows // 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 else if (wr.scrollWidth < 699) // 2 col
{ {
// 6 rows // 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 else if (wr.scrollWidth < 799) // 3 col
{ {
// 7 rows // 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 else if (wr.scrollWidth < 899) // 4 col
{ {
// 7 rows // 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 else if (wr.scrollWidth < 1199) // 5 col
{ {
// 8 rows // 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 else // 6 col
{ {
// 8 rows // 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', fill: 'forwards',
duration: d, duration: d,
iterations: 1, iterations: 1,
easing: 'ease-in-out', easing: 'ease-in-out'
}); });
setTimeout(() => setTimeout(() =>
{ {
@ -99,7 +99,7 @@ export class Words implements AfterViewChecked, OnInit
makePassage(p: string) 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) openPassage(p: string)
@ -107,4 +107,4 @@ export class Words implements AfterViewChecked, OnInit
let ref = this.makePassage(p); let ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { CardItem } from "../pages/search/search"; import { CardItem } from '../pages/search/search';
export class UserProfile export class UserProfile
{ {
@ -12,7 +12,7 @@ export class UserProfile
public textSizeChanged() 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) public update(t: UserProfile, local: Storage)
@ -83,10 +83,10 @@ export type User = {
insert_next_to_item: boolean, insert_next_to_item: boolean,
font_size: number, font_size: number,
saved_pages: SavedPage[], saved_pages: SavedPage[],
verses_on_new_line: boolean verses_on_new_line: boolean,
} }
export type SavedPage = { export type SavedPage = {
queries: CardItem[], queries: CardItem[],
title: string title: string,
} }

View File

@ -59,6 +59,9 @@
</button> </button>
<ion-searchbar (search)="getQuery($event)" (input)="setQuery($event)" [showCancelButton]="true"></ion-searchbar> <ion-searchbar (search)="getQuery($event)" (input)="setQuery($event)" [showCancelButton]="true"></ion-searchbar>
<ion-buttons right> <ion-buttons right>
<button ion-button icon-only secondary (click)="versePicker()">
<ion-icon name="albums" large></ion-icon>
</button>
<button ion-button icon-only secondary (click)="actionsMenu()"> <button ion-button icon-only secondary (click)="actionsMenu()">
<ion-icon name="apps" large></ion-icon> <ion-icon name="apps" large></ion-icon>
</button> </button>
@ -85,4 +88,4 @@
[cardItem]="item" [cardItem]="item"
(onClose)="removeItem($event)"></error> (onClose)="removeItem($event)"></error>
</ion-card> </ion-card>
</ion-content> </ion-content>

View File

@ -3,10 +3,11 @@ import { Loading, LoadingController, ModalController, NavParams, AlertController
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { StrongsModal } from '../../components/strongs-modal/strongs-modal'; 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 { UserProfile } from '../../libs/UserProfile';
import { Reference } from '../../libs/Reference'; import { Reference } from '../../libs/Reference';
import { VersePickerModal } from '../../components/verse-picker/verse-picker';
@Component({ @Component({
templateUrl: 'search.html' templateUrl: 'search.html'
@ -64,16 +65,16 @@ export class SearchPage implements OnInit
for (let i in u.user.items) for (let i in u.user.items)
{ {
let ci = u.user.items[i]; let ci = u.user.items[i];
if (ci["data"] !== undefined) if (ci['data'] !== undefined)
{ {
if (ci["data"].qry !== undefined) if (ci['data'].qry !== undefined)
u.user.items[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type }; u.user.items[i] = { qry: ci['data'].qry, dict: ci.dict, type: ci.type };
else if (ci["data"].ref !== undefined) else if (ci['data'].ref !== undefined)
u.user.items[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type }; u.user.items[i] = { qry: ci['data'].ref, dict: ci.dict, type: ci.type };
else if (ci["data"].word !== undefined) else if (ci['data'].word !== undefined)
u.user.items[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type }; u.user.items[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type };
else if (ci["data"].sn !== undefined) else if (ci['data'].sn !== undefined)
u.user.items[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type }; u.user.items[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type };
has_migrated = true; has_migrated = true;
} }
@ -84,16 +85,16 @@ export class SearchPage implements OnInit
for (let i in pg.queries) for (let i in pg.queries)
{ {
let ci = pg.queries[i]; let ci = pg.queries[i];
if (ci["data"] !== undefined) if (ci['data'] !== undefined)
{ {
if (ci["data"].qry !== undefined) if (ci['data'].qry !== undefined)
pg.queries[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type }; pg.queries[i] = { qry: ci['data'].qry, dict: ci.dict, type: ci.type };
else if (ci["data"].ref !== undefined) else if (ci['data'].ref !== undefined)
pg.queries[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type }; pg.queries[i] = { qry: ci['data'].ref, dict: ci.dict, type: ci.type };
else if (ci["data"].word !== undefined) else if (ci['data'].word !== undefined)
pg.queries[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type }; pg.queries[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type };
else if (ci["data"].sn !== undefined) else if (ci['data'].sn !== undefined)
pg.queries[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type }; pg.queries[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type };
has_migrated = true; has_migrated = true;
} }
@ -107,7 +108,7 @@ export class SearchPage implements OnInit
this.userProfile.user.items = this.params.data.queries.slice(); this.userProfile.user.items = this.params.data.queries.slice();
if (this.params.data.title === undefined) if (this.params.data.title === undefined)
this.title = "Search"; this.title = 'Search';
else else
this.title = this.params.data.title; this.title = this.params.data.title;
@ -143,7 +144,7 @@ export class SearchPage implements OnInit
{ {
text: 'Cancel', text: 'Cancel',
role: 'cancel', role: 'cancel',
handler: data => handler: (): void =>
{ {
console.log('Cancel clicked'); console.log('Cancel clicked');
} }
@ -198,6 +199,12 @@ export class SearchPage implements OnInit
return t === 'Words'; return t === 'Words';
} }
versePicker()
{
let modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this });
modal.present();
}
removeItem(item) removeItem(item)
{ {
let idx = this.userProfile.user.items.indexOf(item); let idx = this.userProfile.user.items.indexOf(item);
@ -235,10 +242,10 @@ export class SearchPage implements OnInit
this.last = data.card; this.last = data.card;
this.updateUIwithItems(data.qry, data.from_search_bar); this.updateUIwithItems(data.qry, data.from_search_bar);
} }
getItemList(search: string): Promise<CardItem[]> getItemList(search: string): Promise<CardItem[]>
{ {
return new Promise((resolve, reject) => return new Promise((resolve) =>
{ {
let list: CardItem[] = []; let list: CardItem[] = [];
@ -274,7 +281,7 @@ export class SearchPage implements OnInit
if (q.trim() !== '') if (q.trim() !== '')
{ {
let myref = new Reference(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) 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 }); let modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(item.qry), dict: item.dict, onItemClicked: this });
modal.present(); modal.present();
@ -330,4 +337,4 @@ class Item
data: any; data: any;
type: Type<any>; type: Type<any>;
dict: string; dict: string;
} }

View File

@ -1,4 +1,4 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" /> /// <reference path="../../typings/globals/jquery/index.d.ts" />
/// <reference path="../../typings/globals/mathjs/index.d.ts" /> /// <reference path="../../typings/globals/mathjs/index.d.ts" />
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from '@angular/http'; import { Http } from '@angular/http';
@ -18,7 +18,7 @@ export class BibleService
getResultAsPromise(section: Section): Promise<BiblePassageResult> getResultAsPromise(section: Section): Promise<BiblePassageResult>
{ {
return new Promise((resolve, reject) => { resolve(this.getResult(section)); }); return new Promise((resolve) => { resolve(this.getResult(section)); });
} }
getResult(section: Section): BiblePassageResult getResult(section: Section): BiblePassageResult
@ -36,17 +36,17 @@ export class BibleService
lastverse: 0 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.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; 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.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; return self.result;
} }
@ -54,7 +54,7 @@ export class BibleService
for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++) 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({ $.ajax({
async: false, 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'; this.result.testament = 'new';
else else
this.result.testament = 'old'; this.result.testament = 'old';
@ -161,4 +161,4 @@ type BibleVerse = {
t: string, s: string, t: string, s: string,
} }
], ],
} }

View File

@ -1,10 +1,10 @@
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { SearchPage } from "../pages/search/search"; import { SearchPage } from '../pages/search/search';
import { SettingsPage } from "../pages/settings/settings"; import { SettingsPage } from '../pages/settings/settings';
import { HelpPage } from "../pages/help/help"; import { HelpPage } from '../pages/help/help';
import { SavedPage } from "../libs/UserProfile"; import { SavedPage } from '../libs/UserProfile';
@Injectable() @Injectable()
export class PagesService export class PagesService
@ -15,9 +15,9 @@ export class PagesService
constructor(public local: Storage) constructor(public local: Storage)
{ {
this.pages = [ this.pages = [
{ title: 'Search', component: SearchPage, params: { queries: [], title: "Search" }, icon: "search" }, { title: 'Search', component: SearchPage, params: { queries: [], title: 'Search' }, icon: 'search' },
{ title: 'Settings', component: SettingsPage, params: {}, icon: "settings" }, { title: 'Settings', component: SettingsPage, params: {}, icon: 'settings' },
{ title: 'Help', component: HelpPage, params: {}, icon: "help-circle" } { title: 'Help', component: HelpPage, params: {}, icon: 'help-circle' }
]; ];
this.savedPages = []; this.savedPages = [];
} }
@ -46,4 +46,4 @@ export class PagesService
this.savedPages.push({ title: p.title, component: SearchPage, params: { queries: p.queries, title: p.title } }); this.savedPages.push({ title: p.title, component: SearchPage, params: { queries: p.queries, title: p.title } });
} }
} }
} }

View File

@ -1,6 +1,6 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" /> /// <reference path="../../typings/globals/jquery/index.d.ts" />
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Http } from "@angular/http"; import { Http } from '@angular/http';
@Injectable() @Injectable()
export class StrongsService export class StrongsService
@ -21,20 +21,20 @@ export class StrongsService
{ {
const self = this; const self = this;
this.result = { this.result = {
prefix: "", prefix: '',
sn: -1, sn: -1,
strongs: [], strongs: [],
def: null, def: null,
rmac: null, rmac: null,
crossrefs: null, crossrefs: null,
rmaccode: "", rmaccode: '',
status: 0, status: 0,
msg: ":)" msg: ':)'
}; };
let url = dict + Math.ceil(sn / 100) + ".json"; let url = dict + Math.ceil(sn / 100) + '.json';
if (dict === "grk") if (dict === 'grk')
{ {
self.result.prefix = "G"; self.result.prefix = 'G';
if (sn > 5624 || sn < 1) if (sn > 5624 || sn < 1)
{ {
self.result.status = -1; self.result.status = -1;
@ -43,7 +43,7 @@ export class StrongsService
} }
else else
{ {
self.result.prefix = "H"; self.result.prefix = 'H';
if (sn > 8674 || sn < 1) if (sn > 8674 || sn < 1)
{ {
self.result.status = -1; self.result.status = -1;
@ -52,14 +52,14 @@ export class StrongsService
} }
this.result.sn = sn; this.result.sn = sn;
if (self.result.status == -1) if (self.result.status === -1)
return self.result; return self.result;
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: 'GET',
url: "data/strongs/" + url, url: 'data/strongs/' + url,
dataType: "json", dataType: 'json',
success(d: StrongsDefinition[], t, x) success(d: StrongsDefinition[], t, x)
{ {
self.result.strongs = d; self.result.strongs = d;
@ -80,9 +80,9 @@ export class StrongsService
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: 'GET',
url: "data/strongscr/cr" + url, url: 'data/strongscr/cr' + url,
dataType: "json", dataType: 'json',
success(d: StrongsCrossReference[], t, x) success(d: StrongsCrossReference[], t, x)
{ {
for (let cr of d) for (let cr of d)
@ -105,17 +105,17 @@ export class StrongsService
if (self.result.status === -1) if (self.result.status === -1)
return self.result; 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[]; let rmac_cross_references: RMACCrossReference[];
// rmac is a two get process. // rmac is a two get process.
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: 'GET',
url: url, url: url,
dataType: "json", dataType: 'json',
success(d: RMACCrossReference[], t, x) success(d: RMACCrossReference[], t, x)
{ {
rmac_cross_references = d; rmac_cross_references = d;
@ -127,8 +127,8 @@ export class StrongsService
}); });
// deal with RMAC // deal with RMAC
let tmp = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { return el.i === sn + "" ? true : false; }); let tmp = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { return el.i === sn + ''; });
if (tmp.length == 0) if (tmp.length === 0)
return this.result; return this.result;
this.result.rmaccode = tmp[0].r; this.result.rmaccode = tmp[0].r;
@ -137,9 +137,9 @@ export class StrongsService
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`; url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: 'GET',
url: url, url: url,
dataType: "json", dataType: 'json',
success(d: RMACDefinition[], t, x) success(d: RMACDefinition[], t, x)
{ {
for (let rmac of d) for (let rmac of d)
@ -171,7 +171,7 @@ export type StrongsResult =
crossrefs: StrongsCrossReference, crossrefs: StrongsCrossReference,
rmaccode: string, rmaccode: string,
status: number, status: number,
msg: string msg: string,
}; };
type StrongsDefinition = { n: number, i: string, tr: string, de: StrongsDefinitionPart[], lemma: string, p: string } type StrongsDefinition = { n: number, i: string, tr: string, de: StrongsDefinitionPart[], lemma: string, p: string }
@ -186,9 +186,9 @@ type StrongsCrossReference =
w: string, w: string,
rs: [ rs: [
{ r: string } { r: string }
] ],
} }
] ],
} }
type RMACDefinition = { id: string, d: string[] } type RMACDefinition = { id: string, d: string[] }

View File

@ -1,6 +1,6 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" /> /// <reference path="../../typings/globals/jquery/index.d.ts" />
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Http } from "@angular/http"; import { Http } from '@angular/http';
@Injectable() @Injectable()
export class WordService export class WordService
@ -13,7 +13,7 @@ export class WordService
{ {
qry = qry.toLowerCase(); qry = qry.toLowerCase();
// TODO(jeremy): Should we strip punctuation as well? // 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<WordLookupResult> getResultAsPromise(qry: string): Promise<WordLookupResult>
@ -39,7 +39,7 @@ export class WordService
{ {
if (q <= words[w]) 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; break;
} }
} }
@ -47,7 +47,7 @@ export class WordService
{ {
if (q <= words[w] && q > words[w - 1]) 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; 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 // 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. // that is shared by all of them. IF not, we can just return those refs.
if (results.length === 0) 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[]; let shared: string[];
if (results.length === 1) { if (results.length === 1) {
@ -68,9 +68,9 @@ export class WordService
} }
if (shared == null || shared.length === 0) 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({ $.ajax({
async: false, async: false,
type: "GET", type: 'GET',
url: url, url: url,
dataType: "json", dataType: 'json',
success(d: IndexResult[], t, x) success(d: IndexResult[], t, x)
{ {
r = d; r = d;
@ -377,7 +377,7 @@ export class WordService
{ {
for (let i = 0; i < refs.length; i++) for (let i = 0; i < refs.length; i++)
{ {
let r = refs[i].split(":"); let r = refs[i].split(':');
// convert references to single integers. // convert references to single integers.
// Book * 100000000, Chapter * 10000, Verse remains same, add all together. // Book * 100000000, Chapter * 10000, Verse remains same, add all together.
let ref = r[0] * 100000000; let ref = r[0] * 100000000;
@ -401,7 +401,7 @@ export class WordService
for (let i = 0; i < result.length; i++) for (let i = 0; i < result.length; i++)
{ {
let ref = result[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; return result;
@ -459,4 +459,4 @@ export type WordLookupResult = {
type IndexResult = { type IndexResult = {
refs: string[]; refs: string[];
word: string; word: string;
} }

Binary file not shown.

View File

@ -0,0 +1,50 @@
// Ionicons Icon Font CSS
// --------------------------
// Ionicons CSS for Ionic's <ion-icon> 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;
}
}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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");
}

View File

@ -227,11 +227,28 @@ namespace DynamicBibleUtility
_thread.Start(); _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<int> Chapters { get; set; } = new List<int>();
}
private void CreateText() private void CreateText()
{ {
// iterate through text, output json format. // iterate through text, output json format.
var ofd = new OpenFileDialog(); var ofd = new OpenFileDialog();
var bbl = new List<Book>(); var bbl = new List<Book>();
var book_records = new List<BookRecord>();
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
{ {
@ -245,12 +262,17 @@ namespace DynamicBibleUtility
if (el.Name != "BIBLEBOOK") continue; if (el.Name != "BIBLEBOOK") continue;
var bk = new Book { bk = Convert.ToInt32(el.FirstAttribute.Value) }; 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()) foreach (XElement chn in el.Nodes())
{ {
var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) }; var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) };
var last = 0;
foreach (XElement vs in chn.Nodes()) foreach (XElement vs in chn.Nodes())
{ {
var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) }; var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) };
last = v.v;
foreach (var o in vs.Nodes()) foreach (var o in vs.Nodes())
{ {
v.w.AddRange(ProcessText(o)); v.w.AddRange(ProcessText(o));
@ -297,7 +319,7 @@ namespace DynamicBibleUtility
ch.vss.Add(v); ch.vss.Add(v);
} }
bk.chs.Add(ch); bk.chs.Add(ch);
br.Chapters.Add(last);
File.WriteAllText(bk.bk + "-" + ch.ch + ".json", JSON.Serialize(ch).Replace(",\"s\":\"\"", "")); File.WriteAllText(bk.bk + "-" + ch.ch + ".json", JSON.Serialize(ch).Replace(",\"s\":\"\"", ""));
} }
bbl.Add(bk); bbl.Add(bk);
@ -305,6 +327,7 @@ namespace DynamicBibleUtility
UpdateStatus("Book: " + bk.bk + "\r\n"); UpdateStatus("Book: " + bk.bk + "\r\n");
} }
// finished. // finished.
File.WriteAllText("books.json", JSON.Serialize(book_records));
} }
} }