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,58 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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">
<name>Dynamic Bible</name>
<description>A bible app designed for bible study</description>
<author email="jason@walljm.com" href="http://dynamicbible.com/">Dynamic Bible</author>
<content src="index.html"/>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
<splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
<icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar"/>
</feature>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
<plugin name="cordova-plugin-whitelist" spec="1.3.1"/>
<plugin name="cordova-plugin-console" spec="1.0.5"/>
<plugin name="cordova-plugin-statusbar" spec="2.2.1"/>
<plugin name="cordova-plugin-device" spec="1.1.4"/>
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1"/>
<icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
</widget>
<?xml version='1.0' encoding='utf-8'?>
<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>
<description>A bible app designed for bible study</description>
<author email="jason@walljm.com" href="http://dynamicbible.com/">Jason Wall</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<splash density="land-ldpi" src="resources\android\splash\drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources\android\splash\drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources\android\splash\drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources\android\splash\drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources\android\splash\drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources\android\splash\drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources\android\splash\drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources\android\splash\drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources\android\splash\drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources\android\splash\drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources\android\splash\drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources\android\splash\drawable-port-xxxhdpi-screen.png" />
<icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashScreen" value="screen" />
<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">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
<plugin name="cordova-plugin-whitelist" spec="1.3.1" />
<plugin name="cordova-plugin-console" spec="1.0.5" />
<plugin name="cordova-plugin-statusbar" spec="2.2.1" />
<plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
<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>

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 {Strongs} from "../components/strongs/strongs.ts";
import {Words} from "../components/words/words.ts";
import {Error} from "../components/error/error.ts";
import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
@NgModule({
@ -24,7 +25,8 @@ import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
Passage,
Strongs,
StrongsModal,
Words
Words,
Error
],
imports: [
IonicModule.forRoot(MyApp),
@ -38,7 +40,8 @@ import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
Passage,
Strongs,
StrongsModal,
Words
Words,
Error
],
providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }, Storage]
})

View File

@ -23,7 +23,9 @@ export class BibleService
this.result = {
cs: [],
testament: "",
ref: ""
ref: "",
status: 0,
msg: ":)"
};
this.count = Number(section.end.chapter) - Number(section.start.chapter) + 1;
@ -41,11 +43,15 @@ export class BibleService
},
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++)
{
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>
</ion-item>
<ion-card-content>
<ion-scroll scrollY="true">
<ion-grid>
<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 scrollY="true" overflow-scroll="true">
<a class="passage-button" *ngFor="let ref of item.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a>
</ion-scroll>
</ion-card-content>

View File

@ -1,5 +1,5 @@
.words-title {
background-color:#ffe0e0;
background-color:#f5b9f3;
}
words ion-scroll {
@ -17,4 +17,55 @@ ion-col .button{
ion-col {
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);
}
getColumns()
{
return Array.from(Array(Math.ceil(this.item.refs.length / 4)).keys())
}
makePassage(p: string)
{
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,9 +23,10 @@
</ion-list>-->
<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>
<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>
<button ion-button icon-left clear small (click)="removeItem(item)">
<ion-icon name="close-circle"></ion-icon>
<div>Close</div>

View File

@ -2,7 +2,7 @@
import {Type, Component} from "@angular/core";
import {Reference} from "../../Reference";
import {BibleService} from "../../bible-service";
import {LoadingController, ModalController } from "ionic-angular";
import {Loading, LoadingController, ModalController } from "ionic-angular";
import {StrongsService} from "../../strongs-service";
import {WordService} from "../../word-service";
import {StrongsModal} from "../../components/strongs-modal/strongs-modal.ts";
@ -26,6 +26,7 @@ export class SearchPage
searchQuery: string = "";
userProfile: UserProfile;
last: CardItem;
loader: Loading;
constructor(
private strongsService: StrongsService
@ -52,6 +53,7 @@ export class SearchPage
{
console.log(error);
});
}
initializeItems(u: UserProfile)
@ -83,21 +85,23 @@ export class SearchPage
this.userProfile.save(this.local);
}
isError(t: string)
{
return t === "Error";
}
isPassage(t: string)
{
return t === "Passage";
}
isStrongs(t: string)
{
return t === "Strongs";
}
isWords(t: string)
{
return t === "Words";
}
addItemToList(item)
{
if (this.userProfile.user.append_to_bottom)
@ -129,65 +133,90 @@ export class SearchPage
this.getItems(data.qry);
}
getItems(search)
{
try
{
let qs = search.split(";");
for (let x in qs)
this.loader = this.loadingCtrl.create({
content: "Looking up query..."
});
this.loader.present().then(
() =>
{
if (qs.hasOwnProperty(x))
try
{
let q = qs[x].trim();
if (q !== "")
let qs = search.split(";");
for (let x in qs)
{
// its a search term.
if (q.search(/[0-9]/i) === -1)
if (qs.hasOwnProperty(x))
{
let result = this.wordService.getResult(q);
this.addItemToList({ data: result, type: "Words", dict: "na" });
}
else if (q.search(/(H|G)[0-9]/i) !== -1)
{
// its a strongs lookup
let dict = q.substring(0, 1);
let q = qs[x].trim();
if (q !== "")
{
// 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" });
}
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 (this.userProfile.user.strongs_modal)
this.presentStrongsModal(result);
else
this.addItemToList({ data: result, type: "Strongs", dict: "na" });
}
else
{
// its a verse reference.
if (q.trim() !== "")
{
let myref = new Reference(q.trim());
let r = this.bibleService.getResult(myref.Section);
r.ref = myref.toString();
this.addItemToList({ data: r, type: "Passage", dict: r.testament == 'new' ? "G" : "H" });
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
{
if (this.userProfile.user.strongs_modal)
this.presentStrongsModal(result);
else
this.addItemToList({ data: result, type: "Strongs", dict: "na" });
}
}
else
{
// its a verse reference.
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" });
}
}
}
}
}
if (this.userProfile.user.clear_search_after_query)
$(".searchbar-input").val("");
this.userProfile.save(this.local);
}
catch (error)
{
this.addItemToList({ data: error, type: "Error", dict: "na" });
console.log(error);
}
finally
{
this.loader.dismiss();
}
}
if (this.userProfile.user.clear_search_after_query)
$(".searchbar-input").val("");
this.userProfile.save(this.local);
}
catch (error)
{
console.log(error);
}
);
}
}

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,
rmac: null,
crossrefs: null,
rmaccode: ""
rmaccode: "",
status: 0,
msg: ":)"
};
let url = dict + Math.ceil(sn / 100) + ".json";
if (dict === "grk")
{
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
{
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;
if (self.result.status == -1)
return self.result;
$.ajax({
async: false,
type: "GET",
@ -49,9 +62,14 @@ export class StrongsService
error: function (request, status, 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.strongs = [];
@ -74,9 +92,14 @@ export class StrongsService
error: function (request, status, 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")
{
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;

View File

@ -6,10 +6,9 @@
type WordLookupResult = {
refs: string[],
word: string,
status: Status,
status: number,
msg: string
}
enum Status { Success, Failure };
type IndexResult = {
refs: string[];
@ -43,7 +42,9 @@ type BibleVerse = {
type BiblePassageResult = {
cs: BiblePassage[],
testament: string,
ref: string
ref: string,
status: number,
msg: string
}
type StrongsDefinition = { n: number, i: string, tr: string, de: string, lemma: string, p: string }
@ -72,6 +73,8 @@ type StrongsResult =
rmac: RMACDefinition,
crossrefs: StrongsCrossReference,
rmaccode: string,
status: number,
msg: string
};
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
// 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: ":)" };
}
else if (results.length == 1)
{
let temp = { word: qry, refs: results[0], status: 0, msg: ":)" };
return temp;
return { word: qry, refs: null, status: -1, msg: "No passages found for query: " + qry + "." };
}
let shared: string[];
if (results.length == 1)
shared = results[0];
else
shared = this.findSharedSet(results);
if (shared == null || shared == undefined || shared.length == 0)
{
let shared = this.findSharedSet(results);
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: null, status: -1, msg: "No passages found for query: " + qry + "." };
}
return { word: qry, refs: shared, status: 0, msg: ":)" };
}
/**