2017-01-24 16:43:58 -05:00
|
|
|
import { Component, EventEmitter, Output, Input, OnInit } from "@angular/core";
|
2017-01-18 17:51:06 -05:00
|
|
|
import { OpenData, CardItem } from "../../pages/search/search";
|
2017-01-24 16:43:58 -05:00
|
|
|
import { BiblePassageResult, BibleService } from '../../services/bible-service';
|
|
|
|
import { Reference } from '../../libs/Reference';
|
2017-01-18 17:51:06 -05:00
|
|
|
|
2016-12-01 10:39:04 -05:00
|
|
|
@Component({
|
|
|
|
selector: "passage",
|
2017-01-24 16:43:58 -05:00
|
|
|
templateUrl: "passage.html",
|
|
|
|
providers: [BibleService]
|
2016-12-01 10:39:04 -05:00
|
|
|
})
|
2017-01-24 16:43:58 -05:00
|
|
|
export class Passage implements OnInit
|
2017-01-18 17:51:06 -05:00
|
|
|
{
|
2016-12-01 10:39:04 -05:00
|
|
|
@Output()
|
2017-01-20 18:57:02 -05:00
|
|
|
onItemClicked = new EventEmitter<OpenData>();
|
2016-12-01 10:39:04 -05:00
|
|
|
@Output()
|
2016-12-01 15:21:07 -05:00
|
|
|
onClose = new EventEmitter<CardItem>();
|
2016-12-01 10:39:04 -05:00
|
|
|
|
2016-12-01 15:21:07 -05:00
|
|
|
@Input()
|
|
|
|
cardItem: CardItem;
|
2017-01-24 16:43:58 -05:00
|
|
|
|
2017-01-21 02:21:44 -05:00
|
|
|
@Input()
|
|
|
|
versesOnNewLine: boolean;
|
2016-12-01 15:21:07 -05:00
|
|
|
|
2017-01-24 16:43:58 -05:00
|
|
|
data: BiblePassageResult;
|
|
|
|
|
|
|
|
constructor(private bibleService: BibleService)
|
2017-01-18 17:51:06 -05:00
|
|
|
{
|
2016-12-01 10:39:04 -05:00
|
|
|
}
|
|
|
|
|
2017-01-24 16:43:58 -05:00
|
|
|
ngOnInit(): void
|
|
|
|
{
|
|
|
|
let myref = new Reference(this.cardItem.qry);
|
|
|
|
this.bibleService.getResultAsPromise(myref.Section).then(data => this.data = data);
|
|
|
|
}
|
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
close()
|
|
|
|
{
|
2016-12-01 15:21:07 -05:00
|
|
|
this.onClose.emit(this.cardItem);
|
2016-12-01 10:39:04 -05:00
|
|
|
}
|
2017-01-20 18:57:02 -05:00
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
openStrongs(strongs: string)
|
|
|
|
{
|
2017-01-26 01:16:26 -05:00
|
|
|
this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs, from_search_bar: false });
|
2016-12-01 10:39:04 -05:00
|
|
|
}
|
2017-01-24 16:43:58 -05:00
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
openMenu(strongs: string)
|
|
|
|
{
|
2017-01-04 17:17:56 -05:00
|
|
|
}
|
2017-01-24 16:43:58 -05:00
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
isPunct(c: string)
|
|
|
|
{
|
2016-12-01 13:40:04 -05:00
|
|
|
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
|
|
|
|
}
|
2016-12-01 10:39:04 -05:00
|
|
|
}
|