mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -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"
|
"ionic_source_map": "source-map"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "ionic clean",
|
"clean": "ionic-app-scripts clean",
|
||||||
"build": "ionic build",
|
"build": "ionic-app-scripts build",
|
||||||
|
"ionic:build": "ionic-app-scripts build",
|
||||||
|
"ionic:serve": "ionic-app-scripts serve",
|
||||||
"start": "ionic serve",
|
"start": "ionic serve",
|
||||||
"serve": "ionic serve",
|
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"test-coverage": "ng test --code-coverage"
|
"test-coverage": "ng test --code-coverage"
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<br>
|
<br>
|
||||||
<p>{{cardItem.data}}</p>
|
<p>{{cardItem.qry}}</p>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
<button ion-button icon-left clear small (click)="close()">
|
<button ion-button icon-left clear small (click)="close()">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<ion-item class="title passage-title" (swipe)="close()">
|
<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()">
|
<button ion-button icon-only item-right large clear (click)="close()">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-card-content>
|
<ion-card-content *ngIf="data !== undefined">
|
||||||
<br>
|
<br>
|
||||||
|
<div class="passage-text" *ngFor="let ch of data.cs">
|
||||||
<div class="passage-text" *ngFor="let ch of cardItem.data.cs">
|
<h2 *ngIf="data.cs.length > 1">
|
||||||
<h2 *ngIf="cardItem.data.cs.length > 1">
|
|
||||||
<b>Chapter {{ch.ch}}</b>
|
<b>Chapter {{ch.ch}}</b>
|
||||||
</h2>
|
</h2>
|
||||||
<span *ngFor="let vs of ch.vss">
|
<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 { OpenData, CardItem } from "../../pages/search/search";
|
||||||
|
import { BiblePassageResult, BibleService } from '../../services/bible-service';
|
||||||
|
import { Reference } from '../../libs/Reference';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "passage",
|
selector: "passage",
|
||||||
templateUrl: "passage.html"
|
templateUrl: "passage.html",
|
||||||
|
providers: [BibleService]
|
||||||
})
|
})
|
||||||
export class Passage
|
export class Passage implements OnInit
|
||||||
{
|
{
|
||||||
@Output()
|
@Output()
|
||||||
onItemClicked = new EventEmitter<OpenData>();
|
onItemClicked = new EventEmitter<OpenData>();
|
||||||
@ -14,14 +17,22 @@ export class Passage
|
|||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
cardItem: CardItem;
|
cardItem: CardItem;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
versesOnNewLine: boolean;
|
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()
|
close()
|
||||||
{
|
{
|
||||||
this.onClose.emit(this.cardItem);
|
this.onClose.emit(this.cardItem);
|
||||||
@ -31,11 +42,11 @@ export class Passage
|
|||||||
{
|
{
|
||||||
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs });
|
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs });
|
||||||
}
|
}
|
||||||
|
|
||||||
openMenu(strongs: string)
|
openMenu(strongs: string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
isPunct(c: string)
|
isPunct(c: string)
|
||||||
{
|
{
|
||||||
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
|
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title>
|
<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-title>
|
||||||
<ion-buttons start>
|
<ion-buttons start>
|
||||||
<button ion-button (click)="dismiss()" large>
|
<button ion-button (click)="dismiss()" large>
|
||||||
@ -10,9 +10,9 @@
|
|||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content padding>
|
<ion-content padding *ngIf="item !== undefined">
|
||||||
<br>
|
<br>
|
||||||
<h2>Strongs Definitition</h2>
|
<h2>Strong's Definitition</h2>
|
||||||
<p>
|
<p>
|
||||||
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b>
|
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b>
|
||||||
- {{item.def.p}} - {{item.def.lemma}} -
|
- {{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 { Platform, NavParams, ViewController } from 'ionic-angular';
|
||||||
import { Reference } from '../../libs/Reference';
|
import { Reference } from '../../libs/Reference';
|
||||||
import { StrongsResult } 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"
|
||||||
})
|
})
|
||||||
export class StrongsModal
|
export class StrongsModal implements OnInit
|
||||||
{
|
{
|
||||||
|
sn: number;
|
||||||
|
dict: string;
|
||||||
item: StrongsResult;
|
item: StrongsResult;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onItemClicked = new EventEmitter<string>();
|
onItemClicked = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(private strongsService: StrongsService,
|
||||||
public platform: Platform,
|
public platform: Platform,
|
||||||
public params: NavParams,
|
public params: NavParams,
|
||||||
public viewCtrl: ViewController
|
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.onItemClicked.subscribe(item =>
|
||||||
this.params.get('onItemClicked').getItems(item)
|
this.params.get('onItemClicked').getItems(item)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
this.strongsService.getResultAsPromise(this.sn, this.dict).then(data => this.item = data);
|
||||||
|
}
|
||||||
|
|
||||||
dismiss()
|
dismiss()
|
||||||
{
|
{
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
openItem(p: string)
|
openItem(p: string)
|
||||||
{
|
{
|
||||||
this.onItemClicked.emit(p);
|
this.onItemClicked.emit(p);
|
||||||
|
this.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
makePassage(p: string)
|
makePassage(p: string)
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
<ion-item class="title strongs-title" padding (swipe)="close()">
|
<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()">
|
<button ion-button icon-only item-right large clear (click)="close()">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-card-content>
|
<ion-card-content *ngIf="data !== undefined">
|
||||||
<br>
|
<br>
|
||||||
<div class="strongs-def">
|
<div class="strongs-def">
|
||||||
<h2>Strongs Definitition</h2>
|
<h2>Strong's Definitition</h2>
|
||||||
<p>
|
<p >
|
||||||
<b>{{cardItem.data.def.tr}} <template [ngIf]="cardItem.data.def.sn != null">({{cardItem.data.def.sn}})</template></b>
|
<b>{{data.def.tr}} <template [ngIf]="data.def.sn != null">({{data.def.sn}})</template></b>
|
||||||
- {{cardItem.data.def.p}} - {{cardItem.data.def.lemma}} -
|
- {{data.def.p}} - {{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>
|
<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>
|
</p>
|
||||||
<template [ngIf]="cardItem.data.rmac !== null">
|
<template [ngIf]="data.rmac !== null">
|
||||||
<h2>RMAC</h2>
|
<h2>RMAC</h2>
|
||||||
<b>{{cardItem.data.rmac.id}}</b>
|
<b>{{data.rmac.id}}</b>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let c of cardItem.data.rmac.d">
|
<li *ngFor="let c of data.rmac.d">
|
||||||
{{c}}
|
{{c}}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -28,14 +28,15 @@
|
|||||||
<h2>Cross References</h2>
|
<h2>Cross References</h2>
|
||||||
<ion-scroll scrollY="true">
|
<ion-scroll scrollY="true">
|
||||||
<dl>
|
<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>
|
<b>{{wrd.w}}</b>: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</ion-scroll>
|
</ion-scroll>
|
||||||
</div>
|
</div>
|
||||||
|
<br style="clear: both"> <!-- because you load with a promise, the height of the box doesn't get set properly-->
|
||||||
</ion-card-content>
|
</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>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
<div>Close</div>
|
<div>Close</div>
|
||||||
</button>
|
</button>
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
strongs {
|
strongs {
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 200px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.strongs-def {
|
.strongs-def {
|
||||||
@ -47,7 +47,7 @@ strongs {
|
|||||||
@media screen and (min-width: 750px) {
|
@media screen and (min-width: 750px) {
|
||||||
strongs {
|
strongs {
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 250px;
|
height: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.strongs-def {
|
.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 { 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({
|
@Component({
|
||||||
selector: "strongs",
|
selector: "strongs",
|
||||||
templateUrl: "strongs.html"
|
templateUrl: "strongs.html",
|
||||||
|
providers: [StrongsService]
|
||||||
})
|
})
|
||||||
export class Strongs
|
export class Strongs implements OnInit
|
||||||
{
|
{
|
||||||
@Output()
|
@Output()
|
||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onItemClicked = new EventEmitter<OpenData>();
|
onItemClicked = new EventEmitter<OpenData>();
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
cardItem: CardItem;
|
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()
|
close()
|
||||||
{
|
{
|
||||||
this.onClose.emit(this.cardItem);
|
this.onClose.emit(this.cardItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
openItem(p: string)
|
openItem(p: string)
|
||||||
{
|
{
|
||||||
this.onItemClicked.emit({ card: this.cardItem, qry: p });
|
this.onItemClicked.emit({ card: this.cardItem, qry: p });
|
||||||
}
|
}
|
||||||
|
|
||||||
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])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
|
||||||
@ -41,5 +53,4 @@ export class Strongs
|
|||||||
let ref = this.makePassage(p);
|
let ref = this.makePassage(p);
|
||||||
this.onItemClicked.emit({ card: this.cardItem, qry: ref });
|
this.onItemClicked.emit({ card: this.cardItem, qry: ref });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
<ion-item class="title words-title" padding (swipe)="close()">
|
<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()">
|
<button ion-button icon-only item-right large clear (click)="close()">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-card-content>
|
<ion-card-content *ngIf="data !== undefined">
|
||||||
<ion-scroll scrollY="true" overflow-scroll="true">
|
<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-scroll>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
<button ion-button icon-left clear small (click)="close()">
|
<button ion-button icon-left clear small (click)="close()">
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
/// <reference path="../../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <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 { 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({
|
@Component({
|
||||||
selector: "words",
|
selector: "words",
|
||||||
templateUrl: "words.html"
|
templateUrl: "words.html",
|
||||||
|
providers: [WordService]
|
||||||
})
|
})
|
||||||
export class Words implements AfterViewChecked
|
export class Words implements AfterViewChecked, OnInit
|
||||||
{
|
{
|
||||||
@Output()
|
@Output()
|
||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
@ -20,7 +22,9 @@ export class Words implements AfterViewChecked
|
|||||||
|
|
||||||
$: any;
|
$: any;
|
||||||
|
|
||||||
constructor()
|
data: WordLookupResult;
|
||||||
|
|
||||||
|
constructor(private wordService: WordService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +84,11 @@ export class Words implements AfterViewChecked
|
|||||||
{
|
{
|
||||||
this.onResize(null);
|
this.onResize(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
this.wordService.getResultAsPromise(this.cardItem.qry).then(data => this.data = data);
|
||||||
|
}
|
||||||
|
|
||||||
close()
|
close()
|
||||||
{
|
{
|
||||||
|
@ -3,18 +3,13 @@ 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 { 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 { 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';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'search.html',
|
templateUrl: 'search.html'
|
||||||
providers: [BibleService, StrongsService, WordService]
|
|
||||||
})
|
})
|
||||||
export class SearchPage
|
export class SearchPage
|
||||||
{
|
{
|
||||||
@ -25,10 +20,7 @@ export class SearchPage
|
|||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private strongsService: StrongsService
|
private pagesService: PagesService
|
||||||
, private bibleService: BibleService
|
|
||||||
, private wordService: WordService
|
|
||||||
, private pagesService: PagesService
|
|
||||||
, private alertCtrl: AlertController
|
, private alertCtrl: AlertController
|
||||||
, private menu: MenuController
|
, private menu: MenuController
|
||||||
, public loadingCtrl: LoadingController
|
, public loadingCtrl: LoadingController
|
||||||
@ -97,10 +89,10 @@ export class SearchPage
|
|||||||
|
|
||||||
updatePage()
|
updatePage()
|
||||||
{
|
{
|
||||||
let page = this.userProfile.user.saved_pages.find(
|
let page = this.userProfile.user.saved_pages.find(
|
||||||
i=>
|
i =>
|
||||||
i.title == this.params.data.title
|
i.title == this.params.data.title
|
||||||
);
|
);
|
||||||
page.queries = this.userProfile.user.items.slice();
|
page.queries = this.userProfile.user.items.slice();
|
||||||
this.userProfile.save(this.local);
|
this.userProfile.save(this.local);
|
||||||
}
|
}
|
||||||
@ -108,6 +100,8 @@ export class SearchPage
|
|||||||
initializeItems(u: UserProfile)
|
initializeItems(u: UserProfile)
|
||||||
{
|
{
|
||||||
this.userProfile = u;
|
this.userProfile = u;
|
||||||
|
|
||||||
|
// initialize the pages.
|
||||||
this.pagesService.initializePages(u.user.saved_pages);
|
this.pagesService.initializePages(u.user.saved_pages);
|
||||||
if (this.params.data.queries !== undefined)
|
if (this.params.data.queries !== undefined)
|
||||||
this.userProfile.user.items = this.params.data.queries.slice();
|
this.userProfile.user.items = this.params.data.queries.slice();
|
||||||
@ -115,12 +109,26 @@ export class SearchPage
|
|||||||
this.title = "Search";
|
this.title = "Search";
|
||||||
else
|
else
|
||||||
this.title = this.params.data.title;
|
this.title = this.params.data.title;
|
||||||
}
|
|
||||||
|
// migrate old way of storing card items to the new.
|
||||||
presentStrongsModal(strongs: StrongsResult)
|
let has_migrated = false;
|
||||||
{
|
for (let i in u.user.items)
|
||||||
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs, onItemClicked: this });
|
{
|
||||||
modal.present();
|
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)
|
setQuery(searchbar)
|
||||||
@ -158,7 +166,7 @@ export class SearchPage
|
|||||||
return t === 'Words';
|
return t === 'Words';
|
||||||
}
|
}
|
||||||
|
|
||||||
addItemToList(item)
|
addItemToList(item: CardItem)
|
||||||
{
|
{
|
||||||
if (this.userProfile.user.append_to_bottom)
|
if (this.userProfile.user.append_to_bottom)
|
||||||
{
|
{
|
||||||
@ -191,9 +199,7 @@ export class SearchPage
|
|||||||
|
|
||||||
getItems(search)
|
getItems(search)
|
||||||
{
|
{
|
||||||
this.loader = this.loadingCtrl.create({
|
this.loader = this.loadingCtrl.create({ content: 'Looking up query...' });
|
||||||
content: 'Looking up query...'
|
|
||||||
});
|
|
||||||
this.loader.present().then(
|
this.loader.present().then(
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
@ -209,36 +215,25 @@ export class SearchPage
|
|||||||
{
|
{
|
||||||
// its a search term.
|
// its a search term.
|
||||||
if (q.search(/[0-9]/i) === -1)
|
if (q.search(/[0-9]/i) === -1)
|
||||||
{
|
this.addItemToList({ qry: q, dict: 'na', type: 'Words' });
|
||||||
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' });
|
|
||||||
}
|
|
||||||
else if (q.search(/(H|G)[0-9]/i) !== -1)
|
else if (q.search(/(H|G)[0-9]/i) !== -1)
|
||||||
{
|
{
|
||||||
// its a strongs lookup
|
// its a strongs lookup
|
||||||
let dict = q.substring(0, 1);
|
let dict = q.substring(0, 1);
|
||||||
|
|
||||||
if (dict.search(/h/i) !== -1)
|
if (dict.search(/h/i) !== -1)
|
||||||
{
|
|
||||||
dict = 'heb';
|
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
|
else
|
||||||
|
dict = 'grk';
|
||||||
|
|
||||||
|
q = q.substring(1, q.length);
|
||||||
|
if (this.userProfile.user.strongs_modal)
|
||||||
{
|
{
|
||||||
if (this.userProfile.user.strongs_modal)
|
let modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(q), dict: dict, onItemClicked: this });
|
||||||
this.presentStrongsModal(result);
|
modal.present();
|
||||||
else
|
|
||||||
this.addItemToList({ data: result, type: 'Strongs', dict: 'na' });
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
this.addItemToList({ qry: q, dict: dict, type: 'Strongs' });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -246,12 +241,7 @@ export class SearchPage
|
|||||||
if (q.trim() !== '')
|
if (q.trim() !== '')
|
||||||
{
|
{
|
||||||
let myref = new Reference(q.trim());
|
let myref = new Reference(q.trim());
|
||||||
let r = this.bibleService.getResult(myref.Section);
|
this.addItemToList({ qry: myref.toString(), dict: myref.Section.start.book > 39 ? 'G' : 'H', type: 'Passage' });
|
||||||
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' });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +254,7 @@ export class SearchPage
|
|||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
{
|
{
|
||||||
this.addItemToList({ data: error, type: 'Error', dict: 'na' });
|
this.addItemToList({ qry: error, type: 'Error', dict: 'na' });
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -278,7 +268,7 @@ export class SearchPage
|
|||||||
|
|
||||||
export type OpenData = { card: CardItem, qry: string }
|
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
|
class Item
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,11 @@ export class BibleService
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getResultAsPromise(section:Section): Promise<BiblePassageResult>
|
||||||
|
{
|
||||||
|
return Promise.resolve(this.getResult(section));
|
||||||
|
}
|
||||||
|
|
||||||
getResult(section: Section): BiblePassageResult
|
getResult(section: Section): BiblePassageResult
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -11,6 +11,11 @@ export class StrongsService
|
|||||||
constructor(private http: Http)
|
constructor(private http: Http)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getResultAsPromise(sn: number, dict: string): Promise<StrongsResult>
|
||||||
|
{
|
||||||
|
return Promise.resolve(this.getResult(sn, dict));
|
||||||
|
}
|
||||||
|
|
||||||
getResult(sn: number, dict: string): StrongsResult
|
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
|
getResult(qry: string): WordLookupResult
|
||||||
{
|
{
|
||||||
qry = qry.toLowerCase();
|
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
|
// 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 || results == null || results == undefined)
|
if (results.length == 0 || results == null || results == undefined)
|
||||||
{
|
|
||||||
return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
|
return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
|
||||||
}
|
|
||||||
|
|
||||||
let shared: string[];
|
let shared: string[];
|
||||||
if (results.length == 1)
|
if (results.length == 1)
|
||||||
@ -59,9 +62,8 @@ export class WordService
|
|||||||
shared = this.findSharedSet(results);
|
shared = this.findSharedSet(results);
|
||||||
|
|
||||||
if (shared == null || shared == undefined || shared.length == 0)
|
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: null, 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: ":)" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,13 +98,11 @@ export class WordService
|
|||||||
{
|
{
|
||||||
return o.word == query;
|
return o.word == query;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (refs.length > 0)
|
if (refs.length > 0)
|
||||||
{
|
|
||||||
return refs[0].refs;
|
return refs[0].refs;
|
||||||
} else
|
else
|
||||||
{
|
|
||||||
return [];
|
return [];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildIndexArray()
|
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