FEATURE: Added a verse picker

This commit is contained in:
jason.wall 2017-08-23 17:53:03 -04:00
parent 72138ae018
commit e3b84c7913
40 changed files with 3631 additions and 576 deletions

View File

@ -21,6 +21,7 @@ import { Words } from "../components/words/words";
import { Error } from "../components/error/error";
import { StrongsModal } from "../components/strongs-modal/strongs-modal";
import { ErrorMessage } from '../components/error-message/error-message';
import { VersePickerModal} from '../components/verse-picker/verse-picker';
@NgModule({
declarations: [
@ -32,6 +33,7 @@ import { ErrorMessage } from '../components/error-message/error-message';
Passage,
Strongs,
StrongsModal,
VersePickerModal,
Words,
Error,
ErrorMessage
@ -51,6 +53,7 @@ import { ErrorMessage } from '../components/error-message/error-message';
Passage,
Strongs,
StrongsModal,
VersePickerModal,
Words,
Error,
ErrorMessage

View File

@ -34,7 +34,7 @@
<button ion-button icon-center clear (click)="expand()">
<ion-icon name="code-working"></ion-icon>
</button>
<button ion-button icon-center clear (click)="next()" *ngIf="ref !== undefined && ref.Section.end.chapter !== ref.Section.end.lastchapter.toString()">
<button ion-button icon-center clear (click)="next()" *ngIf="ref !== undefined && ref.Section.end.chapter !== ref.Section.end.book.last_chapter.toString()">
<ion-icon name="fastforward"></ion-icon>
</button>
</div>

View File

@ -114,9 +114,9 @@ export class Passage implements OnInit
else
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())
if (this.ref.Section.end.chapter === (this.ref.Section.end.book.last_chapter + 1).toString())
{
this.ref.Section.end.chapter = this.ref.Section.end.lastchapter.toString();
this.ref.Section.end.chapter = this.ref.Section.end.book.last_chapter.toString();
this.ref.Section.end.verse = this.data.lastverse.toString();
}
}

View File

@ -1,11 +1,11 @@
import { EventEmitter, Component, Output, OnInit } from "@angular/core";
import { EventEmitter, Component, Output, OnInit } from '@angular/core';
import { Platform, NavParams, ViewController } from 'ionic-angular';
import { Reference } from '../../libs/Reference';
import { StrongsResult, StrongsService } from '../../services/strongs-service';
@Component({
selector: "strongs-modal",
templateUrl: "strongs-modal.html",
selector: 'strongs-modal',
templateUrl: 'strongs-modal.html',
providers: [StrongsService]
})
export class StrongsModal implements OnInit
@ -50,7 +50,7 @@ export class StrongsModal implements OnInit
makePassage(p: string)
{
return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
return Reference.bookName(parseInt(p.split(';')[0])).name + ' ' + p.split(';')[1] + ':' + p.split(';')[2];
}
openPassage(p: string)
@ -58,4 +58,4 @@ export class StrongsModal implements OnInit
let ref = this.makePassage(p);
this.onItemClicked.emit(ref);
}
}
}

View File

@ -1,11 +1,11 @@
import { HostListener, EventEmitter, Component, Input, Output, OnInit, AfterViewChecked, ElementRef } from "@angular/core";
import { HostListener, EventEmitter, Component, Input, Output, OnInit, AfterViewChecked, ElementRef } from '@angular/core';
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({
selector: "strongs",
templateUrl: "strongs.html",
selector: 'strongs',
templateUrl: 'strongs.html',
providers: [StrongsService]
})
export class Strongs implements AfterViewChecked, OnInit
@ -28,13 +28,13 @@ export class Strongs implements AfterViewChecked, OnInit
@HostListener('window:resize', ['$event'])
onResize(evt)
{
$("strongs ion-scroll").each((i, el) =>
$('strongs ion-scroll').each((i, el) =>
{
let len = $(el).find(".scroll-content .scroll-zoom-wrapper dl span").length;
len += $(el).find(".scroll-content .scroll-zoom-wrapper dl dd").length;
let len = $(el).find('.scroll-content .scroll-zoom-wrapper dl span').length;
len += $(el).find('.scroll-content .scroll-zoom-wrapper dl dd').length;
if (len < 20)
$(el).css("height", Math.ceil(len / 3) * 30 + 30);
$(el).css('height', Math.ceil(len / 3) * 30 + 30);
});
}
@ -60,7 +60,7 @@ export class Strongs implements AfterViewChecked, OnInit
fill: 'forwards',
duration: d,
iterations: 1,
easing: 'ease-in-out',
easing: 'ease-in-out'
});
setTimeout(() =>
{
@ -75,7 +75,7 @@ export class Strongs implements AfterViewChecked, OnInit
makePassage(p: string)
{
return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
return Reference.bookName(parseInt(p.split(';')[0])).name + ' ' + p.split(';')[1] + ':' + p.split(';')[2];
}
openPassage(p: string)
@ -83,4 +83,4 @@ export class Strongs implements AfterViewChecked, OnInit
let ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
}
}
}

View File

@ -1,7 +1,7 @@
<ion-header>
<ion-toolbar>
<ion-title>
<ion-icon name="paper" item-start></ion-icon> <span *ngIf="item !== undefined"><span *ngIf="item.status === -1">Error:</span>Strongs: {{item.prefix}}{{item.sn}}</span>
<ion-icon name="albums" item-start></ion-icon> Verse Picker
</ion-title>
<ion-buttons start>
<button ion-button (click)="dismiss()" large>
@ -10,34 +10,29 @@
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding *ngIf="item !== undefined && item.status === 0">
<br>
<h2>Strong's Definitition</h2>
<p>
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b>
- {{item.def.p}} - {{item.def.lemma}} -
<span *ngFor="let part of item.def.de"><template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></template><template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></template></span><br>
</p>
<template [ngIf]="item.rmac !== null">
<h2>RMAC</h2>
<b>{{item.rmac.id}}</b>
<br>
<ul>
<li *ngFor="let c of item.rmac.d">
{{c}}
</li>
</ul>
</template>
<div class="strongs-cross" *ngIf="item.crossrefs != null && item.crossrefs.ss != null">
<h2>Cross References</h2>
&nbsp;&nbsp;&nbsp;Translated as {{item.crossrefs.ss.length}} words
<dl>
<dd *ngFor="let wrd of item.crossrefs.ss">
<strong>{{wrd.w}}:</strong> <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
</dd>
</dl>
</div>
<ion-content>
<span *ngIf="hasBook === false">
<h3>Old Testament</h3>
<div>
<span *ngFor="let bk of this.books"><a class="button" (click)="setBook(bk)" *ngIf="bk.book_number !== 0 && bk.book_number < 40">{{bk.short_name}}</a></span>
</div>
<h3>New Testament</h3>
<div>
<span *ngFor="let bk of this.books"><a class="button" (click)="setBook(bk)" *ngIf="bk.book_number !== 0 && bk.book_number > 39">{{bk.short_name}}</a></span>
</div>
</span>
<br /><br />
<span *ngIf="hasBook === true">
<button class="backbutton" ion-button (click)="toBooks()" block icon-left>
<ion-icon name="backspace"></ion-icon>
Return to Books
</button>
<h3>{{book.name}}</h3>
<div>
<span *ngFor="let bk of book.chapters; index as i"><a class="button" (click)="setChapter(i)" *ngIf="i !== 0">{{i}}</a></span>
</div>
</span>
</ion-content>
<ion-content *ngIf="item !== undefined && item.status === -1">
<ion-content *ngIf="item !== undefined && item.status === -1">
<error-message [msg]="item.msg"></error-message>
</ion-content>

View File

@ -1,25 +1,36 @@
strongs-modal {
a {
cursor: pointer !important;
color: black;
border-bottom: 1px dotted #b3bfd0;
verse-picker {
.button {
color: #fff;
font-size: 1em;
float: left;
padding: .5em;
background-color: #1c2e4c;
margin: .3em;
text-align: center;
width: 65px;
}
.bar-button-ios {
padding-right: 25px;
padding-left: 9px;
.backbutton {
width: 100%;
font-family: inherit;
text-transform: inherit;
}
.bar-button-md, .bar-button-wp {
padding-left: 25px;
padding-right: 9px;
.backbutton:hover:not(.disable-hover) {
background-color: #2b4166;
}
.scroll-content {
line-height: 1.5em;
}
ion-content {
div, h3 {
clear: both;
}
dd {
line-height: 1.7em;
div {
margin: 1em;
}
h3 {
padding-top: .5em;
}
}
}
}

View File

@ -1,41 +1,53 @@
import { EventEmitter, Component, Output, OnInit } from "@angular/core";
import { EventEmitter, Component, Output, OnInit } from '@angular/core';
import { Platform, NavParams, ViewController } from 'ionic-angular';
import { Book, Reference } from '../../libs/Reference';
@Component({
selector: "verse-picker",
templateUrl: "verse-picker.html"
selector: 'verse-picker',
templateUrl: 'verse-picker.html'
})
export class VersePickerModal implements OnInit
export class VersePickerModal
{
@Output()
onItemClicked = new EventEmitter<string>();
books: Array<Book>;
hasBook: boolean = false;
book: Book;
constructor(
public platform: Platform,
public params: NavParams,
public viewCtrl: ViewController
)
)
{
this.hasBook = false;
this.books = Reference.Books;
this.onItemClicked.subscribe(item =>
{
let pg = this.params.get('onItemClicked');
pg.updateUIwithItems(item, false);
pg.updateUIwithItems(item, false);
});
}
ngOnInit(): void
{
toBooks()
{
this.hasBook = false;
this.book = null;
}
dismiss()
dismiss()
{
this.viewCtrl.dismiss();
}
openItem(p: string)
setBook(book: Book)
{
this.onItemClicked.emit(p);
this.hasBook = true;
this.book = book;
}
setChapter(chapter: number)
{
// close the control, trigger the passage event.
this.onItemClicked.emit(this.book.name + ' ' + chapter);
this.dismiss();
}
}

View File

@ -1,12 +1,12 @@
/// <reference path="../../../typings/globals/jquery/index.d.ts" />
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from "@angular/core";
/// <reference path="../../../typings/globals/jquery/index.d.ts" />
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from '@angular/core';
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({
selector: "words",
templateUrl: "words.html",
selector: 'words',
templateUrl: 'words.html',
providers: [WordService]
})
export class Words implements AfterViewChecked, OnInit
@ -31,40 +31,40 @@ export class Words implements AfterViewChecked, OnInit
@HostListener('window:resize', ['$event'])
onResize(evt)
{
$("words ion-scroll").each((i, el) =>
$('words ion-scroll').each((i, el) =>
{
let wr = $(el).find(".scroll-content .scroll-zoom-wrapper")[0];
let len = $(el).find(".scroll-zoom-wrapper a").length;
let wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0];
let len = $(el).find('.scroll-zoom-wrapper a').length;
if (wr.scrollWidth < 500) // 1 col
{
// 5 rows
len < 6 ? $(el).css("height", len * 44.4 + 25) : $(el).css("height", 250);
len < 6 ? $(el).css('height', len * 44.4 + 25) : $(el).css('height', 250);
}
else if (wr.scrollWidth < 699) // 2 col
{
// 6 rows
len < 13 ? $(el).css("height", Math.ceil(len / 2) * 44.4 + 25) : $(el).css("height", 300);
len < 13 ? $(el).css('height', Math.ceil(len / 2) * 44.4 + 25) : $(el).css('height', 300);
}
else if (wr.scrollWidth < 799) // 3 col
{
// 7 rows
len < 22 ? $(el).css("height", Math.ceil(len / 3) * 44.4 + 25) : $(el).css("height", 350);
len < 22 ? $(el).css('height', Math.ceil(len / 3) * 44.4 + 25) : $(el).css('height', 350);
}
else if (wr.scrollWidth < 899) // 4 col
{
// 7 rows
len < 29 ? $(el).css("height", Math.ceil(len / 4) * 44.4 + 25) : $(el).css("height", 375);
len < 29 ? $(el).css('height', Math.ceil(len / 4) * 44.4 + 25) : $(el).css('height', 375);
}
else if (wr.scrollWidth < 1199) // 5 col
{
// 8 rows
len < 41 ? $(el).css("height", Math.ceil(len / 5) * 44.4 + 25) : $(el).css("height", 400);
len < 41 ? $(el).css('height', Math.ceil(len / 5) * 44.4 + 25) : $(el).css('height', 400);
}
else // 6 col
{
// 8 rows
len < 49 ? $(el).css("height", Math.ceil(len / 6) * 44.4 + 25) : $(el).css("height", 425);
len < 49 ? $(el).css('height', Math.ceil(len / 6) * 44.4 + 25) : $(el).css('height', 425);
}
});
}
@ -89,7 +89,7 @@ export class Words implements AfterViewChecked, OnInit
fill: 'forwards',
duration: d,
iterations: 1,
easing: 'ease-in-out',
easing: 'ease-in-out'
});
setTimeout(() =>
{
@ -99,7 +99,7 @@ export class Words implements AfterViewChecked, OnInit
makePassage(p: string)
{
return Reference.bookName(parseInt(p.split(":")[0])) + ' ' + p.split(":")[1] + ":" + p.split(":")[2];
return Reference.bookName(parseInt(p.split(':')[0])).name + ' ' + p.split(':')[1] + ':' + p.split(':')[2];
}
openPassage(p: string)
@ -107,4 +107,4 @@ export class Words implements AfterViewChecked, OnInit
let ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { Storage } from '@ionic/storage';
import { CardItem } from "../pages/search/search";
import { Storage } from '@ionic/storage';
import { CardItem } from '../pages/search/search';
export class UserProfile
{
@ -12,7 +12,7 @@ export class UserProfile
public textSizeChanged()
{
$("html").css("font-size", this.user.font_size + "px");
$('html').css('font-size', this.user.font_size + 'px');
}
public update(t: UserProfile, local: Storage)
@ -83,10 +83,10 @@ export type User = {
insert_next_to_item: boolean,
font_size: number,
saved_pages: SavedPage[],
verses_on_new_line: boolean
verses_on_new_line: boolean,
}
export type SavedPage = {
queries: CardItem[],
title: string
title: string,
}

View File

@ -59,6 +59,9 @@
</button>
<ion-searchbar (search)="getQuery($event)" (input)="setQuery($event)" [showCancelButton]="true"></ion-searchbar>
<ion-buttons right>
<button ion-button icon-only secondary (click)="versePicker()">
<ion-icon name="albums" large></ion-icon>
</button>
<button ion-button icon-only secondary (click)="actionsMenu()">
<ion-icon name="apps" large></ion-icon>
</button>
@ -85,4 +88,4 @@
[cardItem]="item"
(onClose)="removeItem($event)"></error>
</ion-card>
</ion-content>
</ion-content>

View File

@ -3,10 +3,11 @@ import { Loading, LoadingController, ModalController, NavParams, AlertController
import { Storage } from '@ionic/storage';
import { StrongsModal } from '../../components/strongs-modal/strongs-modal';
import { PagesService } from "../../services/pages-service";
import { PagesService } from '../../services/pages-service';
import { UserProfile } from '../../libs/UserProfile';
import { Reference } from '../../libs/Reference';
import { VersePickerModal } from '../../components/verse-picker/verse-picker';
@Component({
templateUrl: 'search.html'
@ -64,16 +65,16 @@ export class SearchPage implements OnInit
for (let i in u.user.items)
{
let ci = u.user.items[i];
if (ci["data"] !== undefined)
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 (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 };
has_migrated = true;
}
@ -84,16 +85,16 @@ export class SearchPage implements OnInit
for (let i in pg.queries)
{
let ci = pg.queries[i];
if (ci["data"] !== undefined)
if (ci['data'] !== undefined)
{
if (ci["data"].qry !== undefined)
pg.queries[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type };
else if (ci["data"].ref !== undefined)
pg.queries[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type };
else if (ci["data"].word !== undefined)
pg.queries[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type };
else if (ci["data"].sn !== undefined)
pg.queries[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type };
if (ci['data'].qry !== undefined)
pg.queries[i] = { qry: ci['data'].qry, dict: ci.dict, type: ci.type };
else if (ci['data'].ref !== undefined)
pg.queries[i] = { qry: ci['data'].ref, dict: ci.dict, type: ci.type };
else if (ci['data'].word !== undefined)
pg.queries[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type };
else if (ci['data'].sn !== undefined)
pg.queries[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type };
has_migrated = true;
}
@ -107,7 +108,7 @@ export class SearchPage implements OnInit
this.userProfile.user.items = this.params.data.queries.slice();
if (this.params.data.title === undefined)
this.title = "Search";
this.title = 'Search';
else
this.title = this.params.data.title;
@ -143,7 +144,7 @@ export class SearchPage implements OnInit
{
text: 'Cancel',
role: 'cancel',
handler: data =>
handler: (): void =>
{
console.log('Cancel clicked');
}
@ -198,6 +199,12 @@ export class SearchPage implements OnInit
return t === 'Words';
}
versePicker()
{
let modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this });
modal.present();
}
removeItem(item)
{
let idx = this.userProfile.user.items.indexOf(item);
@ -235,10 +242,10 @@ export class SearchPage implements OnInit
this.last = data.card;
this.updateUIwithItems(data.qry, data.from_search_bar);
}
getItemList(search: string): Promise<CardItem[]>
{
return new Promise((resolve, reject) =>
return new Promise((resolve) =>
{
let list: CardItem[] = [];
@ -274,7 +281,7 @@ export class SearchPage implements OnInit
if (q.trim() !== '')
{
let myref = new Reference(q.trim());
list.push({ qry: myref.toString(), dict: myref.Section.start.book > 39 ? 'G' : 'H', type: 'Passage' });
list.push({ qry: myref.toString(), dict: myref.Section.start.book.book_number > 39 ? 'G' : 'H', type: 'Passage' });
}
}
}
@ -305,7 +312,7 @@ export class SearchPage implements OnInit
{
for (let item of lst)
{
if (item.type === "Strongs" && this.userProfile.user.strongs_modal && !from_search_bar)
if (item.type === 'Strongs' && this.userProfile.user.strongs_modal && !from_search_bar)
{
let modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(item.qry), dict: item.dict, onItemClicked: this });
modal.present();
@ -330,4 +337,4 @@ class Item
data: any;
type: Type<any>;
dict: string;
}
}

View File

@ -1,4 +1,4 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" />
/// <reference path="../../typings/globals/jquery/index.d.ts" />
/// <reference path="../../typings/globals/mathjs/index.d.ts" />
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@ -18,7 +18,7 @@ export class BibleService
getResultAsPromise(section: Section): Promise<BiblePassageResult>
{
return new Promise((resolve, reject) => { resolve(this.getResult(section)); });
return new Promise((resolve) => { resolve(this.getResult(section)); });
}
getResult(section: Section): BiblePassageResult
@ -36,17 +36,17 @@ export class BibleService
lastverse: 0
};
if (Number(section.start.chapter) > section.start.lastchapter)
if (Number(section.start.chapter) > section.start.book.last_chapter)
{
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.book.name + ' is out of range. Please pick a chapter between 1 and ' + section.start.book.last_chapter + '.';
return self.result;
}
if (Number(section.end.chapter) > section.end.lastchapter)
if (Number(section.end.chapter) > section.end.book.last_chapter)
{
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.book.name + ' is out of range. Please pick a chapter between 1 and ' + section.end.book.last_chapter + '.';
return self.result;
}
@ -54,7 +54,7 @@ export class BibleService
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.book_number + '-' + i + '.json';
$.ajax({
async: false,
@ -125,7 +125,7 @@ export class BibleService
}
if (section.start.book >= 40)
if (section.start.book.book_number >= 40)
this.result.testament = 'new';
else
this.result.testament = 'old';
@ -161,4 +161,4 @@ type BibleVerse = {
t: string, s: string,
}
],
}
}

View File

@ -1,10 +1,10 @@
import { Injectable } from "@angular/core";
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
import { SearchPage } from "../pages/search/search";
import { SettingsPage } from "../pages/settings/settings";
import { HelpPage } from "../pages/help/help";
import { SearchPage } from '../pages/search/search';
import { SettingsPage } from '../pages/settings/settings';
import { HelpPage } from '../pages/help/help';
import { SavedPage } from "../libs/UserProfile";
import { SavedPage } from '../libs/UserProfile';
@Injectable()
export class PagesService
@ -15,9 +15,9 @@ export class PagesService
constructor(public local: Storage)
{
this.pages = [
{ title: 'Search', component: SearchPage, params: { queries: [], title: "Search" }, icon: "search" },
{ title: 'Settings', component: SettingsPage, params: {}, icon: "settings" },
{ title: 'Help', component: HelpPage, params: {}, icon: "help-circle" }
{ title: 'Search', component: SearchPage, params: { queries: [], title: 'Search' }, icon: 'search' },
{ title: 'Settings', component: SettingsPage, params: {}, icon: 'settings' },
{ title: 'Help', component: HelpPage, params: {}, icon: 'help-circle' }
];
this.savedPages = [];
}
@ -46,4 +46,4 @@ export class PagesService
this.savedPages.push({ title: p.title, component: SearchPage, params: { queries: p.queries, title: p.title } });
}
}
}
}

View File

@ -1,6 +1,6 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" />
import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class StrongsService
@ -21,20 +21,20 @@ export class StrongsService
{
const self = this;
this.result = {
prefix: "",
prefix: '',
sn: -1,
strongs: [],
def: null,
rmac: null,
crossrefs: null,
rmaccode: "",
rmaccode: '',
status: 0,
msg: ":)"
msg: ':)'
};
let url = dict + Math.ceil(sn / 100) + ".json";
if (dict === "grk")
let url = dict + Math.ceil(sn / 100) + '.json';
if (dict === 'grk')
{
self.result.prefix = "G";
self.result.prefix = 'G';
if (sn > 5624 || sn < 1)
{
self.result.status = -1;
@ -43,7 +43,7 @@ export class StrongsService
}
else
{
self.result.prefix = "H";
self.result.prefix = 'H';
if (sn > 8674 || sn < 1)
{
self.result.status = -1;
@ -52,14 +52,14 @@ export class StrongsService
}
this.result.sn = sn;
if (self.result.status == -1)
if (self.result.status === -1)
return self.result;
$.ajax({
async: false,
type: "GET",
url: "data/strongs/" + url,
dataType: "json",
type: 'GET',
url: 'data/strongs/' + url,
dataType: 'json',
success(d: StrongsDefinition[], t, x)
{
self.result.strongs = d;
@ -80,9 +80,9 @@ export class StrongsService
$.ajax({
async: false,
type: "GET",
url: "data/strongscr/cr" + url,
dataType: "json",
type: 'GET',
url: 'data/strongscr/cr' + url,
dataType: 'json',
success(d: StrongsCrossReference[], t, x)
{
for (let cr of d)
@ -105,17 +105,17 @@ export class StrongsService
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';
let rmac_cross_references: RMACCrossReference[];
// rmac is a two get process.
$.ajax({
async: false,
type: "GET",
type: 'GET',
url: url,
dataType: "json",
dataType: 'json',
success(d: RMACCrossReference[], t, x)
{
rmac_cross_references = d;
@ -127,8 +127,8 @@ export class StrongsService
});
// deal with RMAC
let tmp = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { return el.i === sn + "" ? true : false; });
if (tmp.length == 0)
let tmp = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { return el.i === sn + ''; });
if (tmp.length === 0)
return this.result;
this.result.rmaccode = tmp[0].r;
@ -137,9 +137,9 @@ export class StrongsService
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
$.ajax({
async: false,
type: "GET",
type: 'GET',
url: url,
dataType: "json",
dataType: 'json',
success(d: RMACDefinition[], t, x)
{
for (let rmac of d)
@ -171,7 +171,7 @@ export type StrongsResult =
crossrefs: StrongsCrossReference,
rmaccode: string,
status: number,
msg: string
msg: string,
};
type StrongsDefinition = { n: number, i: string, tr: string, de: StrongsDefinitionPart[], lemma: string, p: string }
@ -186,9 +186,9 @@ type StrongsCrossReference =
w: string,
rs: [
{ r: string }
]
],
}
]
],
}
type RMACDefinition = { id: string, d: string[] }

View File

@ -1,6 +1,6 @@
/// <reference path="../../typings/globals/jquery/index.d.ts" />
import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
/// <reference path="../../typings/globals/jquery/index.d.ts" />
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class WordService
@ -13,7 +13,7 @@ export class WordService
{
qry = qry.toLowerCase();
// TODO(jeremy): Should we strip punctuation as well?
return qry.replace(/'/g, "").replace(/\s+/g, " ").split(" ");
return qry.replace(/'/g, '').replace(/\s+/g, ' ').split(' ');
}
getResultAsPromise(qry: string): Promise<WordLookupResult>
@ -39,7 +39,7 @@ export class WordService
{
if (q <= words[w])
{
results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q));
results.unshift(this.getSearchReferences('data/index/' + words[w] + 'idx.json', q));
break;
}
}
@ -47,7 +47,7 @@ export class WordService
{
if (q <= words[w] && q > words[w - 1])
{
results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q));
results.unshift(this.getSearchReferences('data/index/' + words[w] + 'idx.json', q));
break;
}
}
@ -57,7 +57,7 @@ export class WordService
// Now we need to test results. If there is more than one item in the array, we need to find the set
// that is shared by all of them. IF not, we can just return those refs.
if (results.length === 0)
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[];
if (results.length === 1) {
@ -68,9 +68,9 @@ export class WordService
}
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: ':)' };
}
/**
@ -86,9 +86,9 @@ export class WordService
$.ajax({
async: false,
type: "GET",
type: 'GET',
url: url,
dataType: "json",
dataType: 'json',
success(d: IndexResult[], t, x)
{
r = d;
@ -377,7 +377,7 @@ export class WordService
{
for (let i = 0; i < refs.length; i++)
{
let r = refs[i].split(":");
let r = refs[i].split(':');
// convert references to single integers.
// Book * 100000000, Chapter * 10000, Verse remains same, add all together.
let ref = r[0] * 100000000;
@ -401,7 +401,7 @@ export class WordService
for (let i = 0; i < result.length; i++)
{
let ref = result[i];
result[i] = Math.floor(ref / 100000000) + ":" + Math.floor((ref % 100000000) / 10000) + ":" + Math.floor((ref % 100000000) % 10000);
result[i] = Math.floor(ref / 100000000) + ':' + Math.floor((ref % 100000000) / 10000) + ':' + Math.floor((ref % 100000000) % 10000);
}
return result;
@ -459,4 +459,4 @@ export type WordLookupResult = {
type IndexResult = {
refs: string[];
word: string;
}
}

Binary file not shown.

View File

@ -0,0 +1,50 @@
// Ionicons Icon Font CSS
// --------------------------
// Ionicons CSS for Ionic's <ion-icon> element
// ionicons-icons.scss has the icons and their unicode characters
$ionicons-font-path: $font-path !default;
@import "ionicons-icons";
@import "ionicons-variables";
@font-face {
font-family: "Ionicons";
src: url("#{$ionicons-font-path}/ionicons.woff2?v=#{$ionicons-version}") format("woff2"),
url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"),
url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype");
font-weight: normal;
font-style: normal;
}
ion-icon {
display: inline-block;
font-family: "Ionicons";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-rendering: auto;
text-transform: none;
speak: none;
@include rtl() {
&[aria-label^="arrow"]::before,
&[flip-rtl]::before {
transform: scaleX(-1);
}
&[unflip-rtl]::before {
transform: scaleX(1);
}
}
&::before {
display: inline-block;
}
}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
// Noto Sans Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$noto-sans-font-path: $font-path !default;
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 300;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 400;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 500;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 700;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
// Roboto Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$roboto-font-path: $font-path !default;
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: local("Roboto Light"), local("Roboto-Light"), url("#{$roboto-font-path}/roboto-light.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-light.woff") format("woff"), url("#{$roboto-font-path}/roboto-light.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local("Roboto"), local("Roboto-Regular"), url("#{$roboto-font-path}/roboto-regular.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-regular.woff") format("woff"), url("#{$roboto-font-path}/roboto-regular.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"), url("#{$roboto-font-path}/roboto-medium.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-medium.woff") format("woff"), url("#{$roboto-font-path}/roboto-medium.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 700;
src: local("Roboto Bold"), local("Roboto-Bold"), url("#{$roboto-font-path}/roboto-bold.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-bold.woff") format("woff"), url("#{$roboto-font-path}/roboto-bold.ttf") format("truetype");
}

View File

@ -227,11 +227,28 @@ namespace DynamicBibleUtility
_thread.Start();
}
private class ChapterRecord
{
public int Number { get; set; }
public int Last { get; set; }
}
private class BookRecord
{
public int Number { get; set; }
public string ShortName { get; set; } = string.Empty;
public string LongName { get; set; } = string.Empty;
public int LastChapter { get; set; }
public List<int> Chapters { get; set; } = new List<int>();
}
private void CreateText()
{
// iterate through text, output json format.
var ofd = new OpenFileDialog();
var bbl = new List<Book>();
var book_records = new List<BookRecord>();
if (ofd.ShowDialog() == DialogResult.OK)
{
@ -245,12 +262,17 @@ namespace DynamicBibleUtility
if (el.Name != "BIBLEBOOK") continue;
var bk = new Book { bk = Convert.ToInt32(el.FirstAttribute.Value) };
var br = new BookRecord {Number = bk.bk};
book_records.Add(br);
br.Chapters.Add(0);
foreach (XElement chn in el.Nodes())
{
var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) };
var last = 0;
foreach (XElement vs in chn.Nodes())
{
var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) };
last = v.v;
foreach (var o in vs.Nodes())
{
v.w.AddRange(ProcessText(o));
@ -297,7 +319,7 @@ namespace DynamicBibleUtility
ch.vss.Add(v);
}
bk.chs.Add(ch);
br.Chapters.Add(last);
File.WriteAllText(bk.bk + "-" + ch.ch + ".json", JSON.Serialize(ch).Replace(",\"s\":\"\"", ""));
}
bbl.Add(bk);
@ -305,6 +327,7 @@ namespace DynamicBibleUtility
UpdateStatus("Book: " + bk.bk + "\r\n");
}
// finished.
File.WriteAllText("books.json", JSON.Serialize(book_records));
}
}