FIX: fixed splash/icon, fixed scroll performance issue, added loading modal

This commit is contained in:
walljm 2017-01-03 23:51:25 -05:00
parent 1ee8f63350
commit 65e8371a91
52 changed files with 304 additions and 247 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.db572483" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="com.walljm.dynamicbible" version="3.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Dynamic Bible</name> <name>Dynamic Bible</name>
<description>A bible app designed for bible study</description> <description>A bible app designed for bible study</description>
<author email="jason@walljm.com" href="http://dynamicbible.com/">Dynamic Bible</author> <author email="jason@walljm.com" href="http://dynamicbible.com/">Jason Wall</author>
<content src="index.html" /> <content src="index.html" />
<access origin="*" /> <access origin="*" />
<allow-intent href="http://*/*" /> <allow-intent href="http://*/*" />
@ -13,24 +13,24 @@
<allow-intent href="geo:*" /> <allow-intent href="geo:*" />
<platform name="android"> <platform name="android">
<allow-intent href="market:*" /> <allow-intent href="market:*" />
<splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/> <splash density="land-ldpi" src="resources\android\splash\drawable-land-ldpi-screen.png" />
<splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/> <splash density="land-mdpi" src="resources\android\splash\drawable-land-mdpi-screen.png" />
<splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/> <splash density="land-hdpi" src="resources\android\splash\drawable-land-hdpi-screen.png" />
<splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/> <splash density="land-xhdpi" src="resources\android\splash\drawable-land-xhdpi-screen.png" />
<splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> <splash density="land-xxhdpi" src="resources\android\splash\drawable-land-xxhdpi-screen.png" />
<splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> <splash density="land-xxxhdpi" src="resources\android\splash\drawable-land-xxxhdpi-screen.png" />
<splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/> <splash density="port-ldpi" src="resources\android\splash\drawable-port-ldpi-screen.png" />
<splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/> <splash density="port-mdpi" src="resources\android\splash\drawable-port-mdpi-screen.png" />
<splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/> <splash density="port-hdpi" src="resources\android\splash\drawable-port-hdpi-screen.png" />
<splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/> <splash density="port-xhdpi" src="resources\android\splash\drawable-port-xhdpi-screen.png" />
<splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> <splash density="port-xxhdpi" src="resources\android\splash\drawable-port-xxhdpi-screen.png" />
<splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> <splash density="port-xxxhdpi" src="resources\android\splash\drawable-port-xxxhdpi-screen.png" />
<icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/> <icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
<icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/> <icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
<icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/> <icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
<icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/> <icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
<icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/> <icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
<icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/> <icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
</platform> </platform>
<platform name="ios"> <platform name="ios">
<allow-intent href="itms:*" /> <allow-intent href="itms:*" />
@ -45,6 +45,13 @@
<preference name="FadeSplashScreenDuration" value="300" /> <preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashScreen" value="screen" /> <preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" /> <preference name="SplashScreenDelay" value="3000" />
<preference name="ShowSplashScreen" value="true" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="false" />
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
<feature name="StatusBar"> <feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" /> <param name="ios-package" onload="true" value="CDVStatusBar" />
</feature> </feature>
@ -55,4 +62,11 @@
<plugin name="cordova-plugin-device" spec="1.1.4" /> <plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1" /> <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
<icon src="resources\android\icon\drawable-xhdpi-icon.png" /> <icon src="resources\android\icon\drawable-xhdpi-icon.png" />
<plugin name="cordova-plugin-crosswalk-webview" spec="~2.2.0">
<variable name="XWALK_VERSION" value="22+" />
<variable name="XWALK_LITEVERSION" value="xwalk_core_library_canary:17+" />
<variable name="XWALK_COMMANDLINE" value="--disable-pull-to-refresh-effect" />
<variable name="XWALK_MODE" value="embedded" />
<variable name="XWALK_MULTIPLEAPK" value="true" />
</plugin>
</widget> </widget>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -13,6 +13,7 @@ import {ComponentLoader} from "../components/component-loader/component-loader.t
import {Passage} from "../components/passage/passage.ts"; import {Passage} from "../components/passage/passage.ts";
import {Strongs} from "../components/strongs/strongs.ts"; import {Strongs} from "../components/strongs/strongs.ts";
import {Words} from "../components/words/words.ts"; import {Words} from "../components/words/words.ts";
import {Error} from "../components/error/error.ts";
import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts"; import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
@NgModule({ @NgModule({
@ -24,7 +25,8 @@ import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
Passage, Passage,
Strongs, Strongs,
StrongsModal, StrongsModal,
Words Words,
Error
], ],
imports: [ imports: [
IonicModule.forRoot(MyApp), IonicModule.forRoot(MyApp),
@ -38,7 +40,8 @@ import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
Passage, Passage,
Strongs, Strongs,
StrongsModal, StrongsModal,
Words Words,
Error
], ],
providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }, Storage] providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }, Storage]
}) })

View File

@ -23,7 +23,9 @@ export class BibleService
this.result = { this.result = {
cs: [], cs: [],
testament: "", testament: "",
ref: "" ref: "",
status: 0,
msg: ":)"
}; };
this.count = Number(section.end.chapter) - Number(section.start.chapter) + 1; this.count = Number(section.end.chapter) - Number(section.start.chapter) + 1;
@ -41,11 +43,15 @@ export class BibleService
}, },
error: function (request, status, error) error: function (request, status, error)
{ {
console.log(error); self.result.status = -1;
self.result.msg = "Unable to retrieve bible passage " + self.result.ref + ".";
} }
}); });
} }
if (self.result.status == -1)
return self.result;
for (let j = 0; j < this.chapters.length; j++) for (let j = 0; j < this.chapters.length; j++)
{ {
const vss: BibleVerse[] = []; const vss: BibleVerse[] = [];

View File

@ -0,0 +1,10 @@
<ion-item class="title error-title" padding>
Error
<button ion-button icon-only item-right large clear (click)="close()">
<ion-icon name="close-circle"></ion-icon>
</button>
</ion-item>
<ion-card-content>
<br>
<p>{{item}}</p>
</ion-card-content>

View File

@ -0,0 +1,3 @@
.error-title {
background-color:#fad0b2;
}

View File

@ -0,0 +1,26 @@
import { EventEmitter, Component, Input, Output } from "@angular/core";
@Component({
selector: "error",
templateUrl: "error.html"
})
export class Error
{
@Output()
onClose = new EventEmitter<CardItem>();
@Input()
item: string;
@Input()
cardItem: CardItem;
constructor()
{
}
close()
{
this.onClose.emit(this.cardItem);
}
}

View File

@ -5,11 +5,7 @@
</button> </button>
</ion-item> </ion-item>
<ion-card-content> <ion-card-content>
<ion-scroll scrollY="true"> <ion-scroll scrollY="true" overflow-scroll="true">
<ion-grid> <a class="passage-button" *ngFor="let ref of item.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a>
<ion-row responsive-sm responsive-md wrap *ngFor="let i of getColumns()">
<ion-col width-25 *ngFor="let ref of item.refs | slice:(i*4):(i+1)*4" (click)="openPassage(ref)"><span class="button">{{makePassage(ref)}}</span></ion-col>
</ion-row>
</ion-grid>
</ion-scroll> </ion-scroll>
</ion-card-content> </ion-card-content>

View File

@ -1,5 +1,5 @@
.words-title { .words-title {
background-color:#ffe0e0; background-color:#f5b9f3;
} }
words ion-scroll { words ion-scroll {
@ -18,3 +18,54 @@ ion-col .button{
ion-col { ion-col {
margin-bottom: 0px !important; margin-bottom: 0px !important;
} }
@media screen and (max-width: 499px) {
words .passage-button
{
width: 100%;
}
}
@media screen and (max-width: 699px) and (min-width: 500px) {
words .passage-button
{
width: 46%;
}
}
@media screen and (max-width: 799px) and (min-width: 700px) {
words .passage-button
{
width: 31%;
}
}
@media screen and (max-width: 899px) and (min-width: 800px) {
words .passage-button
{
width: 23%;
}
}
@media screen and (max-width: 1199px) and (min-width: 900px) {
words .passage-button
{
width: 18%;
}
}
@media screen and (min-width: 1200px) {
words .passage-button
{
width: 13.5%;
}
}
words .passage-button
{
font-size: 1em;
float: left;
padding: .5em;
background-color: #fceeee;
margin: .3em;
text-align: center;
}

View File

@ -25,11 +25,6 @@ export class Words {
this.onClose.emit(this.cardItem); this.onClose.emit(this.cardItem);
} }
getColumns()
{
return Array.from(Array(Math.ceil(this.item.refs.length / 4)).keys())
}
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];

View File

@ -1,82 +0,0 @@
export class ConfigMock
{
public get(): any
{
return '';
}
public getBoolean(): boolean
{
return true;
}
public getNumber(): number
{
return 1;
}
}
export class FormMock
{
public register(): any
{
return true;
}
}
export class NavMock
{
public pop(): any
{
return new Promise(function (resolve: Function): void
{
resolve();
});
}
public push(): any
{
return new Promise(function (resolve: Function): void
{
resolve();
});
}
public getActive(): any
{
return {
'instance': {
'model': 'something',
},
};
}
public setRoot(): any
{
return true;
}
}
export class PlatformMock
{
public ready(): any
{
return new Promise((resolve: Function) =>
{
resolve();
});
}
}
export class MenuMock
{
public close(): any
{
return new Promise((resolve: Function) =>
{
resolve();
});
}
}

View File

@ -23,6 +23,7 @@
</ion-list>--> </ion-list>-->
<ion-card *ngFor="let item of userProfile.user.items"> <ion-card *ngFor="let item of userProfile.user.items">
<error *ngIf="isError(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)"></error>
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItemsNextToCard($event)"></passage> <passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItemsNextToCard($event)"></passage>
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></strongs> <strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></strongs>
<words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></words> <words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></words>

View File

@ -2,7 +2,7 @@
import {Type, Component} from "@angular/core"; import {Type, Component} from "@angular/core";
import {Reference} from "../../Reference"; import {Reference} from "../../Reference";
import {BibleService} from "../../bible-service"; import {BibleService} from "../../bible-service";
import {LoadingController, ModalController } from "ionic-angular"; import {Loading, LoadingController, ModalController } from "ionic-angular";
import {StrongsService} from "../../strongs-service"; import {StrongsService} from "../../strongs-service";
import {WordService} from "../../word-service"; import {WordService} from "../../word-service";
import {StrongsModal} from "../../components/strongs-modal/strongs-modal.ts"; import {StrongsModal} from "../../components/strongs-modal/strongs-modal.ts";
@ -26,6 +26,7 @@ export class SearchPage
searchQuery: string = ""; searchQuery: string = "";
userProfile: UserProfile; userProfile: UserProfile;
last: CardItem; last: CardItem;
loader: Loading;
constructor( constructor(
private strongsService: StrongsService private strongsService: StrongsService
@ -52,6 +53,7 @@ export class SearchPage
{ {
console.log(error); console.log(error);
}); });
} }
initializeItems(u: UserProfile) initializeItems(u: UserProfile)
@ -83,16 +85,18 @@ export class SearchPage
this.userProfile.save(this.local); this.userProfile.save(this.local);
} }
isError(t: string)
{
return t === "Error";
}
isPassage(t: string) isPassage(t: string)
{ {
return t === "Passage"; return t === "Passage";
} }
isStrongs(t: string) isStrongs(t: string)
{ {
return t === "Strongs"; return t === "Strongs";
} }
isWords(t: string) isWords(t: string)
{ {
return t === "Words"; return t === "Words";
@ -129,7 +133,14 @@ export class SearchPage
this.getItems(data.qry); this.getItems(data.qry);
} }
getItems(search) getItems(search)
{
this.loader = this.loadingCtrl.create({
content: "Looking up query..."
});
this.loader.present().then(
() =>
{ {
try try
{ {
@ -145,7 +156,10 @@ export class SearchPage
if (q.search(/[0-9]/i) === -1) if (q.search(/[0-9]/i) === -1)
{ {
let result = this.wordService.getResult(q); let result = this.wordService.getResult(q);
if (result.status == 0)
this.addItemToList({ data: result, type: "Words", dict: "na" }); 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)
{ {
@ -161,11 +175,16 @@ export class SearchPage
} }
q = q.substring(1, q.length); q = q.substring(1, q.length);
let result = this.strongsService.getResult(parseInt(q), dict); let result = this.strongsService.getResult(parseInt(q), dict);
if (result.status == -1)
this.addItemToList({ data: result.msg, type: "Error", dict: "na" });
else
{
if (this.userProfile.user.strongs_modal) if (this.userProfile.user.strongs_modal)
this.presentStrongsModal(result); this.presentStrongsModal(result);
else else
this.addItemToList({ data: result, type: "Strongs", dict: "na" }); this.addItemToList({ data: result, type: "Strongs", dict: "na" });
} }
}
else else
{ {
// its a verse reference. // its a verse reference.
@ -174,7 +193,10 @@ export class SearchPage
let myref = new Reference(q.trim()); let myref = new Reference(q.trim());
let r = this.bibleService.getResult(myref.Section); let r = this.bibleService.getResult(myref.Section);
r.ref = myref.toString(); r.ref = myref.toString();
if (r.status == 0)
this.addItemToList({ data: r, type: "Passage", dict: r.testament == 'new' ? "G" : "H" }); this.addItemToList({ data: r, type: "Passage", dict: r.testament == 'new' ? "G" : "H" });
else
this.addItemToList({ data: r.msg, type: "Error", dict: "na" });
} }
} }
} }
@ -187,7 +209,14 @@ export class SearchPage
} }
catch (error) catch (error)
{ {
this.addItemToList({ data: error, type: "Error", dict: "na" });
console.log(error); console.log(error);
} }
finally
{
this.loader.dismiss();
}
}
);
} }
} }

View File

@ -1,19 +0,0 @@
// This file includes polyfills needed by Angular 2 and is loaded before
// the app. You can add your own extra polyfills to this file.
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';

View File

@ -23,20 +23,33 @@ export class StrongsService
def: null, def: null,
rmac: null, rmac: null,
crossrefs: null, crossrefs: null,
rmaccode: "" rmaccode: "",
status: 0,
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) return this.result; if (sn > 5624 || sn < 1)
{
self.result.status = -1;
self.result.msg = "Strongs Number G" + sn + " is out of range.";
}
} else } else
{ {
self.result.prefix = "H"; self.result.prefix = "H";
if (sn > 8674) return this.result; if (sn > 8674 || sn < 1)
{
self.result.status = -1;
self.result.msg = "Strongs Number H" + sn + " is out of range.";
}
} }
this.result.sn = sn; this.result.sn = sn;
if (self.result.status == -1)
return self.result;
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: "GET",
@ -49,9 +62,14 @@ export class StrongsService
error: function (request, status, error) error: function (request, status, error)
{ {
console.log(error); console.log(error);
self.result.status = -1;
self.result.msg = "Unable to retrieve Strongs Data for " + self.result.prefix + self.result.sn;
} }
}); });
if (self.result.status === -1)
return self.result;
self.result.def = self.result.strongs.find(el => (el.i === this.result.prefix + this.result.sn)); self.result.def = self.result.strongs.find(el => (el.i === this.result.prefix + this.result.sn));
self.result.strongs = []; self.result.strongs = [];
@ -74,9 +92,14 @@ export class StrongsService
error: function (request, status, error) error: function (request, status, error)
{ {
console.log(error); console.log(error);
self.result.status = -1;
self.result.msg = "Unable to retrieve Strongs Cross References for " + self.result.prefix + self.result.sn;
} }
}); });
if (self.result.status === -1)
return self.result;
if (dict === "grk") if (dict === "grk")
{ {
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`; url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;

View File

@ -6,10 +6,9 @@
type WordLookupResult = { type WordLookupResult = {
refs: string[], refs: string[],
word: string, word: string,
status: Status, status: number,
msg: string msg: string
} }
enum Status { Success, Failure };
type IndexResult = { type IndexResult = {
refs: string[]; refs: string[];
@ -43,7 +42,9 @@ type BibleVerse = {
type BiblePassageResult = { type BiblePassageResult = {
cs: BiblePassage[], cs: BiblePassage[],
testament: string, testament: string,
ref: string ref: string,
status: number,
msg: string
} }
type StrongsDefinition = { n: number, i: string, tr: string, de: string, lemma: string, p: string } type StrongsDefinition = { n: number, i: string, tr: string, de: string, lemma: string, p: string }
@ -72,6 +73,8 @@ type StrongsResult =
rmac: RMACDefinition, rmac: RMACDefinition,
crossrefs: StrongsCrossReference, crossrefs: StrongsCrossReference,
rmaccode: string, rmaccode: string,
status: number,
msg: string
}; };
type Section = { type Section = {

View File

@ -47,24 +47,22 @@ 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 || results == null || results == undefined)
{ {
return { word: qry, refs: null, status: 1, msg: ":)" }; return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
}
else if (results.length == 1)
{
let temp = { word: qry, refs: results[0], status: 0, msg: ":)" };
return temp;
} }
let shared: string[];
if (results.length == 1)
shared = results[0];
else else
shared = this.findSharedSet(results);
if (shared == null || shared == undefined || shared.length == 0)
{ {
let shared = this.findSharedSet(results); return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
if (shared == null)
{
return { word: qry, refs: null, status: 1, msg: "No passages found." };
}
return { word: qry, refs: shared[0], status: 0, msg: ":)" };
} }
return { word: qry, refs: shared, status: 0, msg: ":)" };
} }
/** /**