diff --git a/DynamicBibleIonic/app/Reference.ts b/DynamicBibleIonic/app/Reference.ts index eb6e02ea..09872fd4 100644 --- a/DynamicBibleIonic/app/Reference.ts +++ b/DynamicBibleIonic/app/Reference.ts @@ -28,19 +28,19 @@ export class Reference { this.Section = { start: { book: -1, - bookname: '', - longbookname: '', + bookname: "", + longbookname: "", lastchapter: -1, - chapter: '', - verse: '' + chapter: "", + verse: "" }, end: { book: -1, - bookname: '', - longbookname: '', + bookname: "", + longbookname: "", lastchapter: -1, - chapter: '', - verse: '' + chapter: "", + verse: "" } }; this.ref = reference.toLowerCase().trim(); @@ -53,14 +53,14 @@ export class Reference { this.Section.end.lastchapter = this.Section.start.lastchapter; } - if (this.Section.end.chapter == '') this.Section.end.chapter = this.Section.start.chapter; + if (this.Section.end.chapter == "") this.Section.end.chapter = this.Section.start.chapter; if ( Number(this.Section.start.verse) > Number(this.Section.end.verse) && this.Section.start.chapter == this.Section.end.chapter && this.Section.start.book == this.Section.end.book ) this.Section.end.verse = this.Section.start.verse; - if (this.Section.start.verse == '') this.Section.start.verse = '1'; - if (this.Section.end.verse == '') this.Section.end.verse = '*'; + if (this.Section.start.verse == "") this.Section.start.verse = "1"; + if (this.Section.end.verse == "") this.Section.end.verse = "*"; } private parseReference() { @@ -522,8 +522,8 @@ export class Reference { this.ref = this.ref.slice(1); } this.ref = StringUtils.ltrim(this.ref.toLowerCase()); - if (this.ref[0] == '*') { - thing.verse = '*'; + if (this.ref[0] == "*") { + thing.verse = "*"; this.ref = this.ref.slice(1); return; } diff --git a/DynamicBibleIonic/app/app.ts b/DynamicBibleIonic/app/app.ts index 85b129a5..8c99cea0 100644 --- a/DynamicBibleIonic/app/app.ts +++ b/DynamicBibleIonic/app/app.ts @@ -1,11 +1,11 @@ -import {Component, ViewChild} from '@angular/core'; -import {ionicBootstrap, Platform, MenuController, Nav} from 'ionic-angular'; -import {StatusBar} from 'ionic-native'; -import {SearchPage} from './pages/search/search'; +import {Component, ViewChild} from "@angular/core"; +import {ionicBootstrap, Platform, MenuController, Nav} from "ionic-angular"; +import {StatusBar} from "ionic-native"; +import {SearchPage} from "./pages/search/search"; @Component({ - templateUrl: 'build/app.html' + templateUrl: "build/app.html" }) class MyApp { diff --git a/DynamicBibleIonic/app/bible-service.ts b/DynamicBibleIonic/app/bible-service.ts index ee27331e..68800493 100644 --- a/DynamicBibleIonic/app/bible-service.ts +++ b/DynamicBibleIonic/app/bible-service.ts @@ -1,8 +1,8 @@ /// /// -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { Http, Response } from '@angular/http'; +import { Injectable } from "@angular/core"; +import { Observable } from "rxjs/Observable"; +import { Http, Response } from "@angular/http"; @Injectable() export class BibleService @@ -24,14 +24,12 @@ export class BibleService this.result = { cs: [], testament: "", - ref: "", - id: 0 + ref: "" }; this.count = Number(section.end.chapter) - Number(section.start.chapter) + 1; - for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++) - { - let url = "data/bibles/kjv_strongs/" + section.start.book + "-" + i + ".json"; + for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++) { + const url = "data/bibles/kjv_strongs/" + section.start.book + "-" + i + ".json"; jQuery.ajax({ async: false, type: "GET", @@ -50,21 +48,21 @@ export class BibleService for (let j = 0; j < this.chapters.length; j++) { - let vss: BibleVerse[] = []; - let start; + const vss: BibleVerse[] = []; + let start: number; let end; // figure out the start verse. - if (j == 0) + if (j === 0) { - start = section.start.verse; + start = parseInt(section.start.verse); } else { start = 1; } // figure out the end verse - if ((j + 1) == this.chapters.length) + if ((j + 1) === this.chapters.length) { end = section.end.verse; } else @@ -73,8 +71,8 @@ export class BibleService } // get the verses requested. - let tvs = this.chapters[j].vss.length; - if (end == "*" || end > tvs) + const tvs = this.chapters[j].vss.length; + if (end == "*" || parseInt(end) > tvs) { end = tvs; } diff --git a/DynamicBibleIonic/app/components/dcl-wrapper/dcl-wrapper.ts b/DynamicBibleIonic/app/components/dcl-wrapper/dcl-wrapper.ts new file mode 100644 index 00000000..01343573 --- /dev/null +++ b/DynamicBibleIonic/app/components/dcl-wrapper/dcl-wrapper.ts @@ -0,0 +1,54 @@ +import {ComponentFactory, Component, ComponentRef, Input, ViewContainerRef, ComponentResolver, ViewChild} from "@angular/core" + +@Component({ + selector: "dcl-wrapper", + template: `
` +}) +export class DclWrapper +{ + @ViewChild("target", { read: ViewContainerRef }) target; + @Input() type; + @Input() data; + cmpRef: ComponentRef; + private isViewInitialized: boolean = false; + + constructor(private resolver: ComponentResolver) { } + + updateComponent() + { + if (!this.isViewInitialized) + { + return; + } + if (this.cmpRef) + { + this.cmpRef.destroy(); + } + this.resolver.resolveComponent(this.type).then((factory: ComponentFactory) => + { + this.cmpRef = this.target.createComponent(factory); + //to access the created instance use + this.cmpRef.instance.item = this.data; + }); + } + + ngOnChanges() + { + this.updateComponent(); + } + + ngAfterViewInit() + { + this.isViewInitialized = true; + this.updateComponent(); + } + + ngOnDestroy() + { + if (this.cmpRef) + { + this.cmpRef.destroy(); + } + } +} + diff --git a/DynamicBibleIonic/app/components/passage/passage.html b/DynamicBibleIonic/app/components/passage/passage.html new file mode 100644 index 00000000..2ca237fd --- /dev/null +++ b/DynamicBibleIonic/app/components/passage/passage.html @@ -0,0 +1,8 @@ +{{item.ref}} + +
+
+

Chapter {{ch.ch}}

+ {{vs.v}}. {{w.t}}
+
+
diff --git a/DynamicBibleIonic/app/components/passage/passage.ts b/DynamicBibleIonic/app/components/passage/passage.ts new file mode 100644 index 00000000..c0c66fcf --- /dev/null +++ b/DynamicBibleIonic/app/components/passage/passage.ts @@ -0,0 +1,10 @@ +import { Component } from "@angular/core"; +@Component({ + selector: "passage", + templateUrl: "build/components/passage/passage.html" +}) +export class Passage { + private item: BiblePassageResult; + constructor() { + } +} diff --git a/DynamicBibleIonic/app/components/strongs/strongs.html b/DynamicBibleIonic/app/components/strongs/strongs.html new file mode 100644 index 00000000..684ec080 --- /dev/null +++ b/DynamicBibleIonic/app/components/strongs/strongs.html @@ -0,0 +1,4 @@ +{{item.prefix}}{{item.sn}} + + {{item.def.tr}} ({{item.def.sn}}) - {{item.def.p}} - {{item.def.lemma}} -
+
\ No newline at end of file diff --git a/DynamicBibleIonic/app/components/strongs/strongs.ts b/DynamicBibleIonic/app/components/strongs/strongs.ts new file mode 100644 index 00000000..2d903997 --- /dev/null +++ b/DynamicBibleIonic/app/components/strongs/strongs.ts @@ -0,0 +1,13 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "strongs", + templateUrl: "build/components/strongs/strongs.html" +}) +export class Strongs { + + private item: StrongsResult; + + constructor() { + } +} diff --git a/DynamicBibleIonic/app/pages/search/search.html b/DynamicBibleIonic/app/pages/search/search.html index e3831ebf..cc3f31ba 100644 --- a/DynamicBibleIonic/app/pages/search/search.html +++ b/DynamicBibleIonic/app/pages/search/search.html @@ -8,14 +8,7 @@ - {{item.ref}} - -
-
-

Chapter {{ch.ch}}

- {{vs.v}}. {{w.t}}
-
-
+