mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 00:09:54 -04:00
PERF: Moved query logic into components and used promises
* this should keep the memory foot print lower when saving pages * fixed some strongs display issues TODO: need to put error display logic in the individual components
This commit is contained in:
parent
066cf5bcd8
commit
755aa28c3b
@ -8,10 +8,11 @@
|
||||
"ionic_source_map": "source-map"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "ionic clean",
|
||||
"build": "ionic build",
|
||||
"clean": "ionic-app-scripts clean",
|
||||
"build": "ionic-app-scripts build",
|
||||
"ionic:build": "ionic-app-scripts build",
|
||||
"ionic:serve": "ionic-app-scripts serve",
|
||||
"start": "ionic serve",
|
||||
"serve": "ionic serve",
|
||||
"test": "ng test",
|
||||
"test-coverage": "ng test --code-coverage"
|
||||
},
|
||||
|
@ -6,7 +6,7 @@
|
||||
</ion-item>
|
||||
<ion-card-content>
|
||||
<br>
|
||||
<p>{{cardItem.data}}</p>
|
||||
<p>{{cardItem.qry}}</p>
|
||||
</ion-card-content>
|
||||
<button ion-button icon-left clear small (click)="close()">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
|
@ -1,14 +1,13 @@
|
||||
<ion-item class="title passage-title" (swipe)="close()">
|
||||
<ion-icon name="book" item-left></ion-icon> {{cardItem.data.ref}}
|
||||
<ion-icon name="book" item-left></ion-icon> <span *ngIf="data !== undefined">{{data.ref}}</span>
|
||||
<button ion-button icon-only item-right large clear (click)="close()">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
</button>
|
||||
</ion-item>
|
||||
<ion-card-content>
|
||||
<ion-card-content *ngIf="data !== undefined">
|
||||
<br>
|
||||
|
||||
<div class="passage-text" *ngFor="let ch of cardItem.data.cs">
|
||||
<h2 *ngIf="cardItem.data.cs.length > 1">
|
||||
<div class="passage-text" *ngFor="let ch of data.cs">
|
||||
<h2 *ngIf="data.cs.length > 1">
|
||||
<b>Chapter {{ch.ch}}</b>
|
||||
</h2>
|
||||
<span *ngFor="let vs of ch.vss">
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { Component, EventEmitter, Output, Input } from "@angular/core";
|
||||
import { Component, EventEmitter, Output, Input, OnInit } from "@angular/core";
|
||||
import { OpenData, CardItem } from "../../pages/search/search";
|
||||
import { BiblePassageResult, BibleService } from '../../services/bible-service';
|
||||
import { Reference } from '../../libs/Reference';
|
||||
|
||||
@Component({
|
||||
selector: "passage",
|
||||
templateUrl: "passage.html"
|
||||
templateUrl: "passage.html",
|
||||
providers: [BibleService]
|
||||
})
|
||||
export class Passage
|
||||
export class Passage implements OnInit
|
||||
{
|
||||
@Output()
|
||||
onItemClicked = new EventEmitter<OpenData>();
|
||||
@ -14,14 +17,22 @@ export class Passage
|
||||
|
||||
@Input()
|
||||
cardItem: CardItem;
|
||||
|
||||
|
||||
@Input()
|
||||
versesOnNewLine: boolean;
|
||||
|
||||
constructor()
|
||||
data: BiblePassageResult;
|
||||
|
||||
constructor(private bibleService: BibleService)
|
||||
{
|
||||
}
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
let myref = new Reference(this.cardItem.qry);
|
||||
this.bibleService.getResultAsPromise(myref.Section).then(data => this.data = data);
|
||||
}
|
||||
|
||||
close()
|
||||
{
|
||||
this.onClose.emit(this.cardItem);
|
||||
@ -31,11 +42,11 @@ export class Passage
|
||||
{
|
||||
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs });
|
||||
}
|
||||
|
||||
|
||||
openMenu(strongs: string)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
isPunct(c: string)
|
||||
{
|
||||
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>
|
||||
<ion-icon name="paper" item-left></ion-icon> Strongs: {{item.prefix}}{{item.sn}}
|
||||
<ion-icon name="paper" item-left></ion-icon> <span *ngIf="item !== undefined">Strongs: {{item.prefix}}{{item.sn}}</span>
|
||||
</ion-title>
|
||||
<ion-buttons start>
|
||||
<button ion-button (click)="dismiss()" large>
|
||||
@ -10,9 +10,9 @@
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content padding>
|
||||
<ion-content padding *ngIf="item !== undefined">
|
||||
<br>
|
||||
<h2>Strongs Definitition</h2>
|
||||
<h2>Strong's Definitition</h2>
|
||||
<p>
|
||||
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b>
|
||||
- {{item.def.p}} - {{item.def.lemma}} -
|
||||
|
@ -1,39 +1,48 @@
|
||||
import { EventEmitter, Component, Output } 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 } from "../../services/strongs-service";
|
||||
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
||||
|
||||
@Component({
|
||||
selector: "strongs-modal",
|
||||
templateUrl: "strongs-modal.html"
|
||||
})
|
||||
export class StrongsModal
|
||||
export class StrongsModal implements OnInit
|
||||
{
|
||||
sn: number;
|
||||
dict: string;
|
||||
item: StrongsResult;
|
||||
|
||||
@Output()
|
||||
onItemClicked = new EventEmitter<string>();
|
||||
|
||||
constructor(
|
||||
constructor(private strongsService: StrongsService,
|
||||
public platform: Platform,
|
||||
public params: NavParams,
|
||||
public viewCtrl: ViewController
|
||||
)
|
||||
{
|
||||
this.item = this.params.get('strongsid') as StrongsResult;
|
||||
this.sn = this.params.get('sn') as number;
|
||||
this.dict = this.params.get('dict') as string;
|
||||
this.onItemClicked.subscribe(item =>
|
||||
this.params.get('onItemClicked').getItems(item)
|
||||
)
|
||||
}
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.strongsService.getResultAsPromise(this.sn, this.dict).then(data => this.item = data);
|
||||
}
|
||||
|
||||
dismiss()
|
||||
{
|
||||
this.viewCtrl.dismiss();
|
||||
}
|
||||
|
||||
|
||||
openItem(p: string)
|
||||
{
|
||||
this.onItemClicked.emit(p);
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
makePassage(p: string)
|
||||
|
@ -1,24 +1,24 @@
|
||||
<ion-item class="title strongs-title" padding (swipe)="close()">
|
||||
<ion-icon name="paper" item-left></ion-icon> {{cardItem.data.prefix}}{{cardItem.data.sn}}
|
||||
<ion-icon name="paper" item-left></ion-icon> <span *ngIf="data !== undefined">{{data.prefix}}{{data.sn}}</span>
|
||||
<button ion-button icon-only item-right large clear (click)="close()">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
</button>
|
||||
</ion-item>
|
||||
<ion-card-content>
|
||||
<ion-card-content *ngIf="data !== undefined">
|
||||
<br>
|
||||
<div class="strongs-def">
|
||||
<h2>Strongs Definitition</h2>
|
||||
<p>
|
||||
<b>{{cardItem.data.def.tr}} <template [ngIf]="cardItem.data.def.sn != null">({{cardItem.data.def.sn}})</template></b>
|
||||
- {{cardItem.data.def.p}} - {{cardItem.data.def.lemma}} -
|
||||
<span *ngFor="let part of cardItem.data.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>
|
||||
<h2>Strong's Definitition</h2>
|
||||
<p >
|
||||
<b>{{data.def.tr}} <template [ngIf]="data.def.sn != null">({{data.def.sn}})</template></b>
|
||||
- {{data.def.p}} - {{data.def.lemma}} -
|
||||
<span *ngFor="let part of data.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>
|
||||
</p>
|
||||
<template [ngIf]="cardItem.data.rmac !== null">
|
||||
<template [ngIf]="data.rmac !== null">
|
||||
<h2>RMAC</h2>
|
||||
<b>{{cardItem.data.rmac.id}}</b>
|
||||
<b>{{data.rmac.id}}</b>
|
||||
<br>
|
||||
<ul>
|
||||
<li *ngFor="let c of cardItem.data.rmac.d">
|
||||
<li *ngFor="let c of data.rmac.d">
|
||||
{{c}}
|
||||
</li>
|
||||
</ul>
|
||||
@ -28,14 +28,15 @@
|
||||
<h2>Cross References</h2>
|
||||
<ion-scroll scrollY="true">
|
||||
<dl>
|
||||
<dd *ngFor="let wrd of cardItem.data.crossrefs.ss">
|
||||
<dd *ngFor="let wrd of data.crossrefs.ss">
|
||||
<b>{{wrd.w}}</b>: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
|
||||
</dd>
|
||||
</dl>
|
||||
</ion-scroll>
|
||||
</div>
|
||||
<br style="clear: both"> <!-- because you load with a promise, the height of the box doesn't get set properly-->
|
||||
</ion-card-content>
|
||||
<button ion-button icon-left clear small (click)="close()">
|
||||
<button ion-button item-left icon-left clear small (click)="close()">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
<div>Close</div>
|
||||
</button>
|
@ -8,7 +8,7 @@
|
||||
|
||||
strongs {
|
||||
ion-scroll {
|
||||
height: 200px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.strongs-def {
|
||||
@ -47,7 +47,7 @@ strongs {
|
||||
@media screen and (min-width: 750px) {
|
||||
strongs {
|
||||
ion-scroll {
|
||||
height: 250px;
|
||||
height: 260px;
|
||||
}
|
||||
|
||||
.strongs-def {
|
||||
|
@ -1,36 +1,48 @@
|
||||
import { EventEmitter, Component, Input, Output } from "@angular/core";
|
||||
import { EventEmitter, Component, Input, Output, OnInit } from "@angular/core";
|
||||
import { Reference } from '../../libs/Reference';
|
||||
import { OpenData, CardItem } from "../../pages/search/search";
|
||||
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
||||
|
||||
@Component({
|
||||
selector: "strongs",
|
||||
templateUrl: "strongs.html"
|
||||
templateUrl: "strongs.html",
|
||||
providers: [StrongsService]
|
||||
})
|
||||
export class Strongs
|
||||
export class Strongs implements OnInit
|
||||
{
|
||||
@Output()
|
||||
onClose = new EventEmitter<CardItem>();
|
||||
|
||||
@Output()
|
||||
onItemClicked = new EventEmitter<OpenData>();
|
||||
|
||||
|
||||
@Input()
|
||||
cardItem: CardItem;
|
||||
|
||||
constructor()
|
||||
data: StrongsResult;
|
||||
|
||||
constructor(private strongsService: StrongsService)
|
||||
{
|
||||
}
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.strongsService.getResultAsPromise(parseInt(this.cardItem.qry), this.cardItem.dict)
|
||||
.then(data =>
|
||||
this.data = data
|
||||
);
|
||||
}
|
||||
|
||||
close()
|
||||
{
|
||||
this.onClose.emit(this.cardItem);
|
||||
}
|
||||
|
||||
|
||||
openItem(p: string)
|
||||
{
|
||||
this.onItemClicked.emit({ card: this.cardItem, qry: p });
|
||||
}
|
||||
|
||||
|
||||
makePassage(p: string)
|
||||
{
|
||||
return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
|
||||
@ -41,5 +53,4 @@ export class Strongs
|
||||
let ref = this.makePassage(p);
|
||||
this.onItemClicked.emit({ card: this.cardItem, qry: ref });
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
<ion-item class="title words-title" padding (swipe)="close()">
|
||||
<ion-icon name="grid" item-left></ion-icon> {{cardItem.data.refs.length}} results for {{cardItem.data.word}}
|
||||
<ion-icon name="grid" item-left></ion-icon> <span *ngIf="data !== undefined">{{data.refs.length}}" results for {{data.word}}</span>
|
||||
<button ion-button icon-only item-right large clear (click)="close()">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
</button>
|
||||
</ion-item>
|
||||
<ion-card-content>
|
||||
<ion-card-content *ngIf="data !== undefined">
|
||||
<ion-scroll scrollY="true" overflow-scroll="true">
|
||||
<a class="passage-button" *ngFor="let ref of cardItem.data.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a>
|
||||
<a class="passage-button" *ngFor="let ref of data.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a>
|
||||
</ion-scroll>
|
||||
</ion-card-content>
|
||||
<button ion-button icon-left clear small (click)="close()">
|
||||
|
@ -1,13 +1,15 @@
|
||||
/// <reference path="../../../typings/browser/ambient/jquery/index.d.ts" />
|
||||
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked } from "@angular/core";
|
||||
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit } from "@angular/core";
|
||||
import { Reference } from '../../libs/Reference';
|
||||
import { OpenData, CardItem } from "../../pages/search/search";
|
||||
import { WordLookupResult, WordService } from '../../services/word-service';
|
||||
|
||||
@Component({
|
||||
selector: "words",
|
||||
templateUrl: "words.html"
|
||||
templateUrl: "words.html",
|
||||
providers: [WordService]
|
||||
})
|
||||
export class Words implements AfterViewChecked
|
||||
export class Words implements AfterViewChecked, OnInit
|
||||
{
|
||||
@Output()
|
||||
onClose = new EventEmitter<CardItem>();
|
||||
@ -20,7 +22,9 @@ export class Words implements AfterViewChecked
|
||||
|
||||
$: any;
|
||||
|
||||
constructor()
|
||||
data: WordLookupResult;
|
||||
|
||||
constructor(private wordService: WordService)
|
||||
{
|
||||
}
|
||||
|
||||
@ -80,6 +84,11 @@ export class Words implements AfterViewChecked
|
||||
{
|
||||
this.onResize(null);
|
||||
}
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.wordService.getResultAsPromise(this.cardItem.qry).then(data => this.data = data);
|
||||
}
|
||||
|
||||
close()
|
||||
{
|
||||
|
@ -3,18 +3,13 @@ import { Loading, LoadingController, ModalController, NavParams, AlertController
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
import { StrongsModal } from '../../components/strongs-modal/strongs-modal';
|
||||
|
||||
import { BibleService } from '../../services/bible-service';
|
||||
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
||||
import { WordService } from '../../services/word-service';
|
||||
import { PagesService } from "../../services/pages-service";
|
||||
|
||||
import { UserProfile } from '../../libs/UserProfile';
|
||||
import { Reference } from '../../libs/Reference';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'search.html',
|
||||
providers: [BibleService, StrongsService, WordService]
|
||||
templateUrl: 'search.html'
|
||||
})
|
||||
export class SearchPage
|
||||
{
|
||||
@ -25,10 +20,7 @@ export class SearchPage
|
||||
title: string;
|
||||
|
||||
constructor(
|
||||
private strongsService: StrongsService
|
||||
, private bibleService: BibleService
|
||||
, private wordService: WordService
|
||||
, private pagesService: PagesService
|
||||
private pagesService: PagesService
|
||||
, private alertCtrl: AlertController
|
||||
, private menu: MenuController
|
||||
, public loadingCtrl: LoadingController
|
||||
@ -97,10 +89,10 @@ export class SearchPage
|
||||
|
||||
updatePage()
|
||||
{
|
||||
let page = this.userProfile.user.saved_pages.find(
|
||||
i=>
|
||||
let page = this.userProfile.user.saved_pages.find(
|
||||
i =>
|
||||
i.title == this.params.data.title
|
||||
);
|
||||
);
|
||||
page.queries = this.userProfile.user.items.slice();
|
||||
this.userProfile.save(this.local);
|
||||
}
|
||||
@ -108,6 +100,8 @@ export class SearchPage
|
||||
initializeItems(u: UserProfile)
|
||||
{
|
||||
this.userProfile = u;
|
||||
|
||||
// initialize the pages.
|
||||
this.pagesService.initializePages(u.user.saved_pages);
|
||||
if (this.params.data.queries !== undefined)
|
||||
this.userProfile.user.items = this.params.data.queries.slice();
|
||||
@ -115,12 +109,26 @@ export class SearchPage
|
||||
this.title = "Search";
|
||||
else
|
||||
this.title = this.params.data.title;
|
||||
}
|
||||
|
||||
presentStrongsModal(strongs: StrongsResult)
|
||||
{
|
||||
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs, onItemClicked: this });
|
||||
modal.present();
|
||||
|
||||
// migrate old way of storing card items to the new.
|
||||
let has_migrated = false;
|
||||
for (let i in u.user.items)
|
||||
{
|
||||
let ci = u.user.items[i];
|
||||
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 (has_migrated)
|
||||
this.userProfile.save(this.local);
|
||||
}
|
||||
|
||||
setQuery(searchbar)
|
||||
@ -158,7 +166,7 @@ export class SearchPage
|
||||
return t === 'Words';
|
||||
}
|
||||
|
||||
addItemToList(item)
|
||||
addItemToList(item: CardItem)
|
||||
{
|
||||
if (this.userProfile.user.append_to_bottom)
|
||||
{
|
||||
@ -191,9 +199,7 @@ export class SearchPage
|
||||
|
||||
getItems(search)
|
||||
{
|
||||
this.loader = this.loadingCtrl.create({
|
||||
content: 'Looking up query...'
|
||||
});
|
||||
this.loader = this.loadingCtrl.create({ content: 'Looking up query...' });
|
||||
this.loader.present().then(
|
||||
() =>
|
||||
{
|
||||
@ -209,36 +215,25 @@ export class SearchPage
|
||||
{
|
||||
// its a search term.
|
||||
if (q.search(/[0-9]/i) === -1)
|
||||
{
|
||||
let result = this.wordService.getResult(q);
|
||||
if (result.status === 0)
|
||||
this.addItemToList({ data: result, type: 'Words', dict: 'na' });
|
||||
else
|
||||
this.addItemToList({ data: result.msg, type: 'Error', dict: 'na' });
|
||||
}
|
||||
this.addItemToList({ qry: q, dict: 'na', type: 'Words' });
|
||||
else if (q.search(/(H|G)[0-9]/i) !== -1)
|
||||
{
|
||||
// its a strongs lookup
|
||||
let dict = q.substring(0, 1);
|
||||
|
||||
if (dict.search(/h/i) !== -1)
|
||||
{
|
||||
dict = 'heb';
|
||||
} else
|
||||
{
|
||||
dict = 'grk';
|
||||
}
|
||||
q = q.substring(1, q.length);
|
||||
let result = this.strongsService.getResult(parseInt(q), dict);
|
||||
if (result.status === -1)
|
||||
this.addItemToList({ data: result.msg, type: 'Error', dict: 'na' });
|
||||
else
|
||||
dict = 'grk';
|
||||
|
||||
q = q.substring(1, q.length);
|
||||
if (this.userProfile.user.strongs_modal)
|
||||
{
|
||||
if (this.userProfile.user.strongs_modal)
|
||||
this.presentStrongsModal(result);
|
||||
else
|
||||
this.addItemToList({ data: result, type: 'Strongs', dict: 'na' });
|
||||
let modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(q), dict: dict, onItemClicked: this });
|
||||
modal.present();
|
||||
}
|
||||
else
|
||||
this.addItemToList({ qry: q, dict: dict, type: 'Strongs' });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -246,12 +241,7 @@ export class SearchPage
|
||||
if (q.trim() !== '')
|
||||
{
|
||||
let myref = new Reference(q.trim());
|
||||
let r = this.bibleService.getResult(myref.Section);
|
||||
r.ref = myref.toString();
|
||||
if (r.status === 0)
|
||||
this.addItemToList({ data: r, type: 'Passage', dict: r.testament === 'new' ? 'G' : 'H' });
|
||||
else
|
||||
this.addItemToList({ data: r.msg, type: 'Error', dict: 'na' });
|
||||
this.addItemToList({ qry: myref.toString(), dict: myref.Section.start.book > 39 ? 'G' : 'H', type: 'Passage' });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +254,7 @@ export class SearchPage
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
this.addItemToList({ data: error, type: 'Error', dict: 'na' });
|
||||
this.addItemToList({ qry: error, type: 'Error', dict: 'na' });
|
||||
console.log(error);
|
||||
}
|
||||
finally
|
||||
@ -278,7 +268,7 @@ export class SearchPage
|
||||
|
||||
export type OpenData = { card: CardItem, qry: string }
|
||||
|
||||
export type CardItem = { data: any, type: string, dict: string }
|
||||
export type CardItem = { qry: string, type: string, dict: string }
|
||||
|
||||
class Item
|
||||
{
|
||||
|
@ -15,6 +15,11 @@ export class BibleService
|
||||
{
|
||||
}
|
||||
|
||||
getResultAsPromise(section:Section): Promise<BiblePassageResult>
|
||||
{
|
||||
return Promise.resolve(this.getResult(section));
|
||||
}
|
||||
|
||||
getResult(section: Section): BiblePassageResult
|
||||
{
|
||||
try
|
||||
|
@ -11,6 +11,11 @@ export class StrongsService
|
||||
constructor(private http: Http)
|
||||
{
|
||||
}
|
||||
|
||||
getResultAsPromise(sn: number, dict: string): Promise<StrongsResult>
|
||||
{
|
||||
return Promise.resolve(this.getResult(sn, dict));
|
||||
}
|
||||
|
||||
getResult(sn: number, dict: string): StrongsResult
|
||||
{
|
||||
|
@ -9,6 +9,11 @@ export class WordService
|
||||
{
|
||||
}
|
||||
|
||||
getResultAsPromise(qry: string): Promise<WordLookupResult>
|
||||
{
|
||||
return Promise.resolve(this.getResult(qry));
|
||||
}
|
||||
|
||||
getResult(qry: string): WordLookupResult
|
||||
{
|
||||
qry = qry.toLowerCase();
|
||||
@ -48,9 +53,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 || results == null || results == undefined)
|
||||
{
|
||||
return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
|
||||
}
|
||||
|
||||
let shared: string[];
|
||||
if (results.length == 1)
|
||||
@ -59,9 +62,8 @@ export class WordService
|
||||
shared = this.findSharedSet(results);
|
||||
|
||||
if (shared == null || shared == undefined || shared.length == 0)
|
||||
{
|
||||
return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
|
||||
}
|
||||
|
||||
return { word: qry, refs: shared, status: 0, msg: ":)" };
|
||||
}
|
||||
|
||||
@ -96,13 +98,11 @@ export class WordService
|
||||
{
|
||||
return o.word == query;
|
||||
});
|
||||
|
||||
if (refs.length > 0)
|
||||
{
|
||||
return refs[0].refs;
|
||||
} else
|
||||
{
|
||||
else
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private buildIndexArray()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 1.9 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
[{"n":3201,"i":"G3201","p":"mem'-fom-ahee","lemma":"μέμφομαι","tr":"memphomai","de":[{"w":"Middle voice of an apparently primary verb; to <b> <em>blame:</em> </b> - find fault."}]},{"n":3202,"i":"G3202","p":"mem-psim'-oy-ros","lemma":"μεμψίμοιρος","tr":"mempsimoiros","de":[{"w":"From a presumed derivative of "},{"sn":"G3201"},{"w":" and <greek>μοῖρα</greek> moira (<em>fate</em>; akin to the base of "},{"sn":"G3313"},{"w":"); <br /> <em>blaming fate</em> that is <em>querulous</em> (<em>discontented</em>): - complainer."}]},{"n":3303,"i":"G3303","p":"men","lemma":"μέν","tr":"men","de":[{"w":"A primary particle; properly indicative of <em>affirmation</em> or <em>concession</em> (<em>in fact</em>); usually followed by a <em>contrasted</em> clause with "},{"sn":"G1161"},{"w":" (<em>this</em> one the <em>former</em> <b>etc.:</b> - even indeed so some truly verily. Often compounded with other particles in an <em>intensive</em> or <em>asseverative</em> sense."}]}]
|
||||
[{"n":3201,"i":"G3201","p":"mem'-fom-ahee","lemma":"μέμφομαι","tr":"memphomai","de":[{"w":"Middle voice of an apparently primary verb; to <b> <em>blame:</em> </b> - find fault."}]},{"n":3202,"i":"G3202","p":"mem-psim'-oy-ros","lemma":"μεμψίμοιρος","tr":"mempsimoiros","de":[{"w":"From a presumed derivative of "},{"sn":"G3201"},{"w":" and <greek>μοῖρα</greek> moira (<em>fate</em>; akin to the base of "},{"sn":"G3313"},{"w":"); <em>blaming fate</em> that is <em>querulous</em> (<em>discontented</em>): - complainer."}]},{"n":3303,"i":"G3303","p":"men","lemma":"μέν","tr":"men","de":[{"w":"A primary particle; properly indicative of <em>affirmation</em> or <em>concession</em> (<em>in fact</em>); usually followed by a <em>contrasted</em> clause with "},{"sn":"G1161"},{"w":" (<em>this</em> one the <em>former</em> <b>etc.:</b> - even indeed so some truly verily. Often compounded with other particles in an <em>intensive</em> or <em>asseverative</em> sense."}]}]
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user