mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 01:19:52 -04:00
FEATURE: added next, expand, prev actions on the passage card.
* cleaned up some files * added typings to manage typescript definitions
This commit is contained in:
parent
274cecb598
commit
433da00bf4
@ -5,7 +5,7 @@ root = true
|
|||||||
|
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
|
|
||||||
# We recommend you to keep these unchanged
|
# We recommend you to keep these unchanged
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
@ -36,9 +36,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<TypeScriptCompile Include="src\**\*.ts" />
|
<TypeScriptCompile Include="src\**\*.ts" />
|
||||||
<Content Include="*.json" />
|
<Content Include="angular-cli.json" />
|
||||||
|
<Content Include="ionic.config.json" />
|
||||||
|
<Content Include="package.json" />
|
||||||
|
<Content Include="tsconfig.json" />
|
||||||
|
<Content Include="tslint.json" />
|
||||||
<Content Include="*.js" />
|
<Content Include="*.js" />
|
||||||
<Content Include="*.xml" />
|
<Content Include="*.xml" />
|
||||||
|
<Content Include="typings.json" />
|
||||||
<Content Include="typings\**\*.json" />
|
<Content Include="typings\**\*.json" />
|
||||||
<Content Include="src\**\*.scss" />
|
<Content Include="src\**\*.scss" />
|
||||||
<Content Include="src\**\*.html" />
|
<Content Include="src\**\*.html" />
|
||||||
@ -51,6 +56,10 @@
|
|||||||
<Content Include="www\**\*.svg" />
|
<Content Include="www\**\*.svg" />
|
||||||
<Content Include="www\**\*.ico" />
|
<Content Include="www\**\*.ico" />
|
||||||
<Content Include="www\**\*.json" />
|
<Content Include="www\**\*.json" />
|
||||||
|
<TypeScriptCompile Include="typings\globals\es6-shim\index.d.ts" />
|
||||||
|
<TypeScriptCompile Include="typings\globals\jquery\index.d.ts" />
|
||||||
|
<TypeScriptCompile Include="typings\globals\mathjs\index.d.ts" />
|
||||||
|
<TypeScriptCompile Include="typings\index.d.ts" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="src" />
|
<Folder Include="src" />
|
||||||
@ -72,11 +81,10 @@
|
|||||||
<Folder Include="src\pipes" />
|
<Folder Include="src\pipes" />
|
||||||
<Folder Include="src\theme" />
|
<Folder Include="src\theme" />
|
||||||
<Folder Include="typings" />
|
<Folder Include="typings" />
|
||||||
<Folder Include="typings\browser" />
|
|
||||||
<Folder Include="typings\browser\ambient" />
|
|
||||||
<Folder Include="typings\browser\ambient\jquery" />
|
|
||||||
<Folder Include="typings\globals" />
|
<Folder Include="typings\globals" />
|
||||||
<Folder Include="typings\globals\es6-shim" />
|
<Folder Include="typings\globals\es6-shim" />
|
||||||
|
<Folder Include="typings\globals\jquery\" />
|
||||||
|
<Folder Include="typings\globals\mathjs\" />
|
||||||
<Folder Include="www" />
|
<Folder Include="www" />
|
||||||
<Folder Include="www\assets" />
|
<Folder Include="www\assets" />
|
||||||
<Folder Include="www\assets\fonts" />
|
<Folder Include="www\assets\fonts" />
|
||||||
|
@ -66,6 +66,10 @@
|
|||||||
"ionic-plugin-keyboard"
|
"ionic-plugin-keyboard"
|
||||||
],
|
],
|
||||||
"cordovaPlatforms": [],
|
"cordovaPlatforms": [],
|
||||||
"description": "Dynamic Bible: A bible made for studying scripture"
|
"description": "Dynamic Bible: A bible made for studying scripture",
|
||||||
, "-vs-binding":{"AfterBuild":["ionic:serve"]}
|
"-vs-binding": {
|
||||||
|
"AfterBuild": [
|
||||||
|
"ionic:serve"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ion-item class="title passage-title" (swipe)="close()">
|
<ion-item class="title passage-title" (swipe)="close()">
|
||||||
<ion-icon name="book" item-left></ion-icon> <span *ngIf="data !== undefined"><span *ngIf="data.status === -1">Error:</span>{{data.ref}}</span>
|
<ion-icon name="book" item-left></ion-icon> <span *ngIf="data !== undefined"><span *ngIf="data.status === -1">Error:</span>{{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>
|
||||||
@ -21,7 +21,30 @@
|
|||||||
<ion-card-content *ngIf="data !== undefined && data.status === -1">
|
<ion-card-content *ngIf="data !== undefined && data.status === -1">
|
||||||
<error-message [msg]="data.msg"></error-message>
|
<error-message [msg]="data.msg"></error-message>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
|
<ion-row>
|
||||||
|
<ion-col text-left class="col-fixed">
|
||||||
<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>
|
||||||
<div>Close</div>
|
<div>Close</div>
|
||||||
</button>
|
</button>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col text-center col-auto> </ion-col>
|
||||||
|
<ion-col text-center class="col-fixed" *ngIf="ref !== undefined && ref.Section.start.chapter !== '1'">
|
||||||
|
<button ion-button icon-left clear small (click)="prev()">
|
||||||
|
<ion-icon name="arrow-dropleft"></ion-icon>
|
||||||
|
<div>Prev</div>
|
||||||
|
</button>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col text-center class="col-fixed">
|
||||||
|
<button ion-button icon-left clear small (click)="expand()">
|
||||||
|
<ion-icon name="code-working"></ion-icon>
|
||||||
|
<div>Expand</div>
|
||||||
|
</button>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col text-center class="col-fixed" *ngIf="ref !== undefined && ref.Section.end.chapter !== ref.Section.end.lastchapter.toString()">
|
||||||
|
<button ion-button icon-right clear small (click)="next()">
|
||||||
|
<div>Next</div>
|
||||||
|
<ion-icon name="arrow-dropright"></ion-icon>
|
||||||
|
</button>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
@ -15,6 +15,12 @@ passage .passage-text {
|
|||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
passage {
|
||||||
|
.col-fixed {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 800px) {
|
@media screen and (min-width: 800px) {
|
||||||
passage .passage-text {
|
passage .passage-text {
|
||||||
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
-webkit-column-count: 2; /* Chrome, Safari, Opera */
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { Component, EventEmitter, Output, Input, OnInit, ElementRef } from "@angular/core";
|
import { Component, EventEmitter, Output, Input, OnInit, ElementRef } 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 { BiblePassageResult, BibleService } from '../../services/bible-service';
|
||||||
import { Reference } from '../../libs/Reference';
|
import { Reference } from '../../libs/Reference';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "passage",
|
selector: 'passage',
|
||||||
templateUrl: "passage.html",
|
templateUrl: 'passage.html',
|
||||||
providers: [BibleService]
|
providers: [BibleService]
|
||||||
})
|
})
|
||||||
export class Passage implements OnInit
|
export class Passage implements OnInit
|
||||||
@ -22,6 +22,7 @@ export class Passage implements OnInit
|
|||||||
versesOnNewLine: boolean;
|
versesOnNewLine: boolean;
|
||||||
|
|
||||||
data: BiblePassageResult;
|
data: BiblePassageResult;
|
||||||
|
ref: Reference;
|
||||||
|
|
||||||
constructor(private bibleService: BibleService, private elementRef: ElementRef)
|
constructor(private bibleService: BibleService, private elementRef: ElementRef)
|
||||||
{
|
{
|
||||||
@ -29,8 +30,8 @@ export class Passage implements OnInit
|
|||||||
|
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
let myref = new Reference(this.cardItem.qry);
|
this.ref = new Reference(this.cardItem.qry);
|
||||||
this.bibleService.getResultAsPromise(myref.Section).then(data => this.data = data);
|
this.bibleService.getResultAsPromise(this.ref.Section).then(data => this.data = data);
|
||||||
}
|
}
|
||||||
|
|
||||||
close()
|
close()
|
||||||
@ -42,7 +43,7 @@ export class Passage implements OnInit
|
|||||||
fill: 'forwards',
|
fill: 'forwards',
|
||||||
duration: d,
|
duration: d,
|
||||||
iterations: 1,
|
iterations: 1,
|
||||||
easing: 'ease-in-out',
|
easing: 'ease-in-out'
|
||||||
});
|
});
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
{
|
{
|
||||||
@ -50,6 +51,75 @@ export class Passage implements OnInit
|
|||||||
}, d);
|
}, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
next()
|
||||||
|
{
|
||||||
|
this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) + 1).toString();
|
||||||
|
this.ref.Section.start.verse = '1';
|
||||||
|
this.ref.Section.end.chapter = this.ref.Section.start.chapter;
|
||||||
|
this.ref.Section.end.verse = '*';
|
||||||
|
|
||||||
|
this.bibleService.getResultAsPromise(this.ref.Section).then(data =>
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
this.cardItem.qry = data.ref;
|
||||||
|
this.ref = new Reference(data.ref);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
prev()
|
||||||
|
{
|
||||||
|
this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) - 1).toString();
|
||||||
|
this.ref.Section.start.verse = '1';
|
||||||
|
this.ref.Section.end.chapter = this.ref.Section.start.chapter;
|
||||||
|
this.ref.Section.end.verse = '*';
|
||||||
|
|
||||||
|
this.bibleService.getResultAsPromise(this.ref.Section).then(data =>
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
this.cardItem.qry = data.ref;
|
||||||
|
this.ref = new Reference(data.ref);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
expand()
|
||||||
|
{
|
||||||
|
// if your verse is at the beginning, to go the prev chapter and add 3 verses from that
|
||||||
|
if (parseInt(this.ref.Section.start.verse) < 3)
|
||||||
|
{
|
||||||
|
this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) - 1).toString();
|
||||||
|
this.ref.Section.start.verse = '*-' + (3 - parseInt(this.ref.Section.start.verse));
|
||||||
|
if (this.ref.Section.start.chapter === '0')
|
||||||
|
{
|
||||||
|
this.ref.Section.start.chapter = '1';
|
||||||
|
this.ref.Section.start.verse = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // or go back 3 verses
|
||||||
|
this.ref.Section.start.verse = (parseInt(this.ref.Section.start.verse) - 3).toString();
|
||||||
|
|
||||||
|
// if your verse is at the end, go to the next chapter
|
||||||
|
if (this.ref.Section.end.verse === '*' || parseInt(this.ref.Section.end.verse) + 3 > this.data.lastverse)
|
||||||
|
{
|
||||||
|
this.ref.Section.end.chapter = (parseInt(this.ref.Section.end.chapter) + 1).toString();
|
||||||
|
this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - this.data.lastverse).toString();
|
||||||
|
|
||||||
|
if (this.ref.Section.end.chapter === (this.ref.Section.end.lastchapter + 1).toString())
|
||||||
|
{
|
||||||
|
this.ref.Section.end.chapter = this.ref.Section.end.lastchapter.toString();
|
||||||
|
this.ref.Section.end.verse = this.data.lastverse.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // or add 3 verses
|
||||||
|
this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3).toString();
|
||||||
|
|
||||||
|
this.bibleService.getResultAsPromise(this.ref.Section).then(data =>
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
this.cardItem.qry = data.ref;
|
||||||
|
this.ref = new Reference(data.ref);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
openStrongs(strongs: string)
|
openStrongs(strongs: string)
|
||||||
{
|
{
|
||||||
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs, from_search_bar: false });
|
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs, from_search_bar: false });
|
||||||
@ -61,6 +131,6 @@ export class Passage implements OnInit
|
|||||||
|
|
||||||
isPunct(c: string)
|
isPunct(c: string)
|
||||||
{
|
{
|
||||||
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
|
return new RegExp('^[\.\,\;\:\?\!]$').test(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import { EventEmitter, Component, Output, OnInit } from "@angular/core";
|
import { EventEmitter, Component, Output, OnInit } from "@angular/core";
|
||||||
import { Platform, NavParams, ViewController } from 'ionic-angular';
|
import { Platform, NavParams, ViewController } from 'ionic-angular';
|
||||||
import { Reference } from '../../libs/Reference';
|
import { Reference } from '../../libs/Reference';
|
||||||
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
||||||
@ -28,7 +28,7 @@ export class StrongsModal implements OnInit
|
|||||||
this.onItemClicked.subscribe(item =>
|
this.onItemClicked.subscribe(item =>
|
||||||
{
|
{
|
||||||
let pg = this.params.get('onItemClicked');
|
let pg = this.params.get('onItemClicked');
|
||||||
pg.updateUIwithItems(item, false)
|
pg.updateUIwithItems(item, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../../../typings/globals/jquery/index.d.ts" />
|
||||||
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from "@angular/core";
|
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from "@angular/core";
|
||||||
import { Reference } from '../../libs/Reference';
|
import { Reference } from '../../libs/Reference';
|
||||||
import { OpenData, CardItem } from "../../pages/search/search";
|
import { OpenData, CardItem } from "../../pages/search/search";
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../../../typings/globals/jquery/index.d.ts" />
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NavController, AlertController } from 'ionic-angular';
|
import { NavController, AlertController } from 'ionic-angular';
|
||||||
import { Storage } from '@ionic/storage';
|
import { Storage } from '@ionic/storage';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/// <reference path="../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../../typings/globals/jquery/index.d.ts" />
|
||||||
import { Injectable } from "@angular/core";
|
/// <reference path="../../typings/globals/mathjs/index.d.ts" />
|
||||||
import { Http } from "@angular/http";
|
import { Injectable } from '@angular/core';
|
||||||
import { Section, Reference } from "../libs/Reference";
|
import { Http } from '@angular/http';
|
||||||
|
import { Section, Reference } from '../libs/Reference';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BibleService
|
export class BibleService
|
||||||
@ -28,23 +29,24 @@ export class BibleService
|
|||||||
this.chapters = []; // the verses from the chapter.
|
this.chapters = []; // the verses from the chapter.
|
||||||
this.result = {
|
this.result = {
|
||||||
cs: [],
|
cs: [],
|
||||||
testament: "",
|
testament: '',
|
||||||
ref: Reference.toString(section),
|
ref: Reference.toString(section),
|
||||||
status: 0,
|
status: 0,
|
||||||
msg: ":)"
|
msg: ':)',
|
||||||
|
lastverse: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Number(section.start.chapter) > section.start.lastchapter)
|
if (Number(section.start.chapter) > section.start.lastchapter)
|
||||||
{
|
{
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "The requested chapter for " + section.start.bookname + " is out of range. Please pick a chapter between 1 and " + section.start.lastchapter + ".";
|
self.result.msg = 'The requested chapter for ' + section.start.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.start.lastchapter + '.';
|
||||||
return self.result;
|
return self.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number(section.end.chapter) > section.end.lastchapter)
|
if (Number(section.end.chapter) > section.end.lastchapter)
|
||||||
{
|
{
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "The requested chapter for " + section.end.bookname + " is out of range. Please pick a chapter between 1 and " + section.end.lastchapter + ".";
|
self.result.msg = 'The requested chapter for ' + section.end.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.end.lastchapter + '.';
|
||||||
return self.result;
|
return self.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,26 +54,26 @@ export class BibleService
|
|||||||
|
|
||||||
for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++)
|
for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++)
|
||||||
{
|
{
|
||||||
const url = "data/bibles/kjv_strongs/" + section.start.book + "-" + i + ".json";
|
const url = 'data/bibles/kjv_strongs/' + section.start.book + '-' + i + '.json';
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: 'GET',
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: 'json',
|
||||||
success: function (d: BiblePassage, t, x)
|
success(d: BiblePassage, t, x)
|
||||||
{
|
{
|
||||||
self.chapters.push(d);
|
self.chapters.push(d);
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error(request, status, error)
|
||||||
{
|
{
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "Unable to retrieve bible passage " + self.result.ref + ".";
|
self.result.msg = 'Unable to retrieve bible passage ' + self.result.ref + '.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.result.status == -1)
|
if (self.result.status === -1)
|
||||||
return self.result;
|
return self.result;
|
||||||
|
|
||||||
for (let j = 0; j < this.chapters.length; j++)
|
for (let j = 0; j < this.chapters.length; j++)
|
||||||
@ -82,7 +84,21 @@ export class BibleService
|
|||||||
|
|
||||||
// figure out the start verse.
|
// figure out the start verse.
|
||||||
if (j === 0)
|
if (j === 0)
|
||||||
|
{
|
||||||
|
if (section.start.verse.indexOf('*') !== -1) // you sometimes use this as a shortcut to the last verse
|
||||||
|
{
|
||||||
|
// replace the * with the last verse, then eval the expression.
|
||||||
|
section.start.verse = section.start.verse.replace('*', (this.chapters[j].vss.length).toString());
|
||||||
|
|
||||||
|
start = math.eval(section.start.verse);
|
||||||
|
|
||||||
|
// update the section and the ref.
|
||||||
|
section.start.verse = start.toString();
|
||||||
|
this.result.ref = Reference.toString(section);
|
||||||
|
}
|
||||||
|
else
|
||||||
start = parseInt(section.start.verse);
|
start = parseInt(section.start.verse);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
start = 1;
|
start = 1;
|
||||||
|
|
||||||
@ -90,11 +106,11 @@ export class BibleService
|
|||||||
if ((j + 1) === this.chapters.length)
|
if ((j + 1) === this.chapters.length)
|
||||||
end = section.end.verse;
|
end = section.end.verse;
|
||||||
else
|
else
|
||||||
end = "*";
|
end = '*';
|
||||||
|
|
||||||
// get the verses requested.
|
// get the verses requested.
|
||||||
const tvs = this.chapters[j].vss.length;
|
const tvs = this.chapters[j].vss.length;
|
||||||
if (end == "*" || parseInt(end) > tvs)
|
if (end === '*' || parseInt(end) > tvs)
|
||||||
end = tvs;
|
end = tvs;
|
||||||
|
|
||||||
// we're using c based indexes here, so the index is 1 less than the verse #.
|
// we're using c based indexes here, so the index is 1 less than the verse #.
|
||||||
@ -105,12 +121,14 @@ export class BibleService
|
|||||||
"ch": this.chapters[j].ch,
|
"ch": this.chapters[j].ch,
|
||||||
"vss": vss
|
"vss": vss
|
||||||
});
|
});
|
||||||
|
this.result.lastverse = this.chapters[j].vss.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (section.start.book >= 40)
|
if (section.start.book >= 40)
|
||||||
this.result.testament = "new";
|
this.result.testament = 'new';
|
||||||
else
|
else
|
||||||
this.result.testament = "old";
|
this.result.testament = 'old';
|
||||||
|
|
||||||
return this.result;
|
return this.result;
|
||||||
}
|
}
|
||||||
@ -127,19 +145,20 @@ export type BiblePassageResult = {
|
|||||||
testament: string,
|
testament: string,
|
||||||
ref: string,
|
ref: string,
|
||||||
status: number,
|
status: number,
|
||||||
msg: string
|
msg: string,
|
||||||
|
lastverse: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
type BiblePassage = {
|
type BiblePassage = {
|
||||||
ch: number,
|
ch: number,
|
||||||
vss: BibleVerse[]
|
vss: BibleVerse[],
|
||||||
}
|
}
|
||||||
|
|
||||||
type BibleVerse = {
|
type BibleVerse = {
|
||||||
v: number,
|
v: number,
|
||||||
w: [
|
w: [
|
||||||
{
|
{
|
||||||
t: string, s: string
|
t: string, s: string,
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../../typings/globals/jquery/index.d.ts" />
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../../typings/globals/jquery/index.d.ts" />
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export class WordService
|
|||||||
for (let w = 0; w < words.length; w++)
|
for (let w = 0; w < words.length; w++)
|
||||||
{
|
{
|
||||||
// If we are at the end of the array, we want to use a different test.
|
// If we are at the end of the array, we want to use a different test.
|
||||||
if (w == 0)
|
if (w === 0)
|
||||||
{
|
{
|
||||||
if (q <= words[w])
|
if (q <= words[w])
|
||||||
{
|
{
|
||||||
@ -56,18 +56,18 @@ 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)
|
||||||
return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." };
|
return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." };
|
||||||
|
|
||||||
let shared: string[];
|
let shared: string[];
|
||||||
if (results.length == 1) {
|
if (results.length === 1) {
|
||||||
shared = results[0];
|
shared = results[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
shared = this.findSharedSet(results);
|
shared = this.findSharedSet(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shared == null || shared == undefined || shared.length == 0)
|
if (shared == null || shared.length === 0)
|
||||||
return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." };
|
return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." };
|
||||||
|
|
||||||
return { word: qry, refs: shared, status: 0, msg: ":)" };
|
return { word: qry, refs: shared, status: 0, msg: ":)" };
|
||||||
@ -89,21 +89,18 @@ export class WordService
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: IndexResult[], t, x)
|
success(d: IndexResult[], t, x)
|
||||||
{
|
{
|
||||||
r = d;
|
r = d;
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error(request, status, error)
|
||||||
{
|
{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// find the right word
|
// find the right word
|
||||||
let refs = $.grep(r, function (o, i)
|
let refs = $.grep(r, (o, i) => o.word === query);
|
||||||
{
|
|
||||||
return o.word == query;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (refs.length > 0)
|
if (refs.length > 0)
|
||||||
return refs[0].refs;
|
return refs[0].refs;
|
||||||
@ -427,7 +424,7 @@ export class WordService
|
|||||||
// values that aren't shared between them.
|
// values that aren't shared between them.
|
||||||
while (i < t)
|
while (i < t)
|
||||||
{
|
{
|
||||||
if (x[i] == y[i])
|
if (x[i] === y[i])
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (x[i] < y[i])
|
if (x[i] < y[i])
|
||||||
@ -440,10 +437,10 @@ export class WordService
|
|||||||
// we have to make sure to remove any extra values
|
// we have to make sure to remove any extra values
|
||||||
// at the end of an array when we reach the end of
|
// at the end of an array when we reach the end of
|
||||||
// the other.
|
// the other.
|
||||||
if (t == i && t < x.length)
|
if (t === i && t < x.length)
|
||||||
x.splice(i, x.length - i);
|
x.splice(i, x.length - i);
|
||||||
|
|
||||||
if (t == i && t < y.length)
|
if (t === i && t < y.length)
|
||||||
y.splice(i, x.length - i);
|
y.splice(i, x.length - i);
|
||||||
}
|
}
|
||||||
// we could return y, because at this time, both arrays
|
// we could return y, because at this time, both arrays
|
||||||
@ -456,7 +453,7 @@ export type WordLookupResult = {
|
|||||||
refs: string[],
|
refs: string[],
|
||||||
word: string,
|
word: string,
|
||||||
status: number,
|
status: number,
|
||||||
msg: string
|
msg: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
type IndexResult = {
|
type IndexResult = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../typings/browser/ambient/jquery/index.d.ts" />
|
/// <reference path="../typings/globals/jquery/index.d.ts" />
|
||||||
import './polyfills.ts';
|
import './polyfills.ts';
|
||||||
|
|
||||||
import 'zone.js/dist/long-stack-trace-zone';
|
import 'zone.js/dist/long-stack-trace-zone';
|
||||||
|
7
DynamicBibleIonic/typings.json
Normal file
7
DynamicBibleIonic/typings.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"globalDependencies": {
|
||||||
|
"es6-shim": "registry:dt/es6-shim#0.31.2+20160726072212",
|
||||||
|
"jquery": "registry:dt/jquery#1.10.0+20170310222111",
|
||||||
|
"mathjs": "registry:dt/mathjs#0.0.0+20170126160507"
|
||||||
|
}
|
||||||
|
}
|
2
DynamicBibleIonic/typings/browser.d.ts
vendored
2
DynamicBibleIonic/typings/browser.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
/// <reference path="globals/es6-shim/index.d.ts" />
|
|
||||||
/// <reference path="browser/ambient/jquery/index.d.ts" />
|
|
@ -1,5 +1,5 @@
|
|||||||
// Generated by typings
|
// Generated by typings
|
||||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts
|
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts
|
||||||
declare type PropertyKey = string | number | symbol;
|
declare type PropertyKey = string | number | symbol;
|
||||||
|
|
||||||
interface IteratorResult<T> {
|
interface IteratorResult<T> {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"resolution": "main",
|
"resolution": "main",
|
||||||
"tree": {
|
"tree": {
|
||||||
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts",
|
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts",
|
||||||
"raw": "registry:dt/es6-shim#0.31.2+20160602141504",
|
"raw": "registry:dt/es6-shim#0.31.2+20160726072212",
|
||||||
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts"
|
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
8
DynamicBibleIonic/typings/globals/jquery/typings.json
Normal file
8
DynamicBibleIonic/typings/globals/jquery/typings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"resolution": "main",
|
||||||
|
"tree": {
|
||||||
|
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts",
|
||||||
|
"raw": "registry:dt/jquery#1.10.0+20170310222111",
|
||||||
|
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts"
|
||||||
|
}
|
||||||
|
}
|
2280
DynamicBibleIonic/typings/globals/mathjs/index.d.ts
vendored
Normal file
2280
DynamicBibleIonic/typings/globals/mathjs/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
DynamicBibleIonic/typings/globals/mathjs/typings.json
Normal file
8
DynamicBibleIonic/typings/globals/mathjs/typings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"resolution": "main",
|
||||||
|
"tree": {
|
||||||
|
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/11b6a6aecf429fdb7c2f013e5c1fe23a93b1fe0e/mathjs/index.d.ts",
|
||||||
|
"raw": "registry:dt/mathjs#0.0.0+20170126160507",
|
||||||
|
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/11b6a6aecf429fdb7c2f013e5c1fe23a93b1fe0e/mathjs/index.d.ts"
|
||||||
|
}
|
||||||
|
}
|
2
DynamicBibleIonic/typings/index.d.ts
vendored
2
DynamicBibleIonic/typings/index.d.ts
vendored
@ -1 +1,3 @@
|
|||||||
/// <reference path="globals/es6-shim/index.d.ts" />
|
/// <reference path="globals/es6-shim/index.d.ts" />
|
||||||
|
/// <reference path="globals/jquery/index.d.ts" />
|
||||||
|
/// <reference path="globals/mathjs/index.d.ts" />
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<!-- The bundle js is generated during the build process -->
|
<!-- The bundle js is generated during the build process -->
|
||||||
<script src="build/main.js"></script>
|
<script src="build/main.js"></script>
|
||||||
<script src="lib/jquery.min.js"></script>
|
<script src="lib/jquery.min.js"></script>
|
||||||
|
<script src="lib/math.min.js"></script>
|
||||||
<script src="lib/web-animations.min.js"></script>
|
<script src="lib/web-animations.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
55
DynamicBibleIonic/www/lib/math.min.js
vendored
Normal file
55
DynamicBibleIonic/www/lib/math.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user