MAID: tighten up syntax per the linter, fix a couple of minor display issues

with verse picker, removed call to stemmer.js in index.html, updated
  to ng-template tag as template had been deprecated
This commit is contained in:
jason.wall 2017-08-24 10:54:15 -04:00
parent 0bd82de4ac
commit 83b33958c4
24 changed files with 264 additions and 205 deletions

View File

@ -2,9 +2,9 @@ import { Component, ViewChild } from '@angular/core';
import { Platform, MenuController, Nav } from 'ionic-angular'; import { Platform, MenuController, Nav } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar'; import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen'; import { SplashScreen } from '@ionic-native/splash-screen';
import { SearchPage } from "../pages/search/search"; import { SearchPage } from '../pages/search/search';
import { PagesService } from "../services/pages-service"; import { PagesService } from '../services/pages-service';
@Component({ @Component({
templateUrl: 'app.html', templateUrl: 'app.html',

View File

@ -1,5 +1,5 @@
import { NgModule, ErrorHandler } from '@angular/core'; import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule} from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http'; import { HttpModule } from '@angular/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
@ -10,18 +10,18 @@ import { SplashScreen } from '@ionic-native/splash-screen';
import { MyApp } from './app.component'; import { MyApp } from './app.component';
import { SearchPage } from "../pages/search/search"; import { SearchPage } from '../pages/search/search';
import { SettingsPage } from "../pages/settings/settings"; import { SettingsPage } from '../pages/settings/settings';
import { HelpPage } from "../pages/help/help"; import { HelpPage } from '../pages/help/help';
import { ComponentLoader } from "../components/component-loader/component-loader"; import { ComponentLoader } from '../components/component-loader/component-loader';
import { Passage } from "../components/passage/passage"; import { Passage } from '../components/passage/passage';
import { Strongs } from "../components/strongs/strongs"; import { Strongs } from '../components/strongs/strongs';
import { Words } from "../components/words/words"; import { Words } from '../components/words/words';
import { Error } from "../components/error/error"; import { Error } from '../components/error/error';
import { StrongsModal } from "../components/strongs-modal/strongs-modal"; import { StrongsModal } from '../components/strongs-modal/strongs-modal';
import { ErrorMessage } from '../components/error-message/error-message'; import { ErrorMessage } from '../components/error-message/error-message';
import { VersePickerModal} from '../components/verse-picker/verse-picker'; import { VersePickerModal } from '../components/verse-picker/verse-picker';
@NgModule({ @NgModule({
declarations: [ declarations: [

View File

@ -1,4 +1,4 @@
//our root app component // our root app component
import {Component, Compiler, ViewContainerRef, ViewChild, Input, ComponentRef, ComponentFactoryResolver, ChangeDetectorRef} from '@angular/core' import {Component, Compiler, ViewContainerRef, ViewChild, Input, ComponentRef, ComponentFactoryResolver, ChangeDetectorRef} from '@angular/core'
// Helper component to add dynamic components // Helper component to add dynamic components
@ -11,7 +11,7 @@ export class ComponentLoader {
@Input() type; @Input() type;
@Input() data; @Input() data;
cmpRef: ComponentRef<any>; cmpRef: ComponentRef<any>;
private isViewInitialized: boolean = false; private isViewInitialized = false;
constructor(private componentFactoryResolver: ComponentFactoryResolver, private compiler: Compiler, constructor(private componentFactoryResolver: ComponentFactoryResolver, private compiler: Compiler,
private cdRef: ChangeDetectorRef) { } private cdRef: ChangeDetectorRef) { }
@ -24,7 +24,7 @@ export class ComponentLoader {
this.cmpRef.destroy(); this.cmpRef.destroy();
} }
let factory = this.componentFactoryResolver.resolveComponentFactory(this.type); const factory = this.componentFactoryResolver.resolveComponentFactory(this.type);
this.cmpRef = this.target.createComponent(factory); this.cmpRef = this.target.createComponent(factory);
// to access the created instance use // to access the created instance use
// this.compRef.instance.someProperty = 'someValue'; // this.compRef.instance.someProperty = 'someValue';

View File

@ -1,4 +1,4 @@
import { Component, Input} from "@angular/core"; import { Component, Input} from '@angular/core';
@Component({ @Component({
selector: 'error-message', selector: 'error-message',
@ -11,6 +11,6 @@ export class ErrorMessage
constructor() constructor()
{ {
this.msg = ""; this.msg = '';
} }
} }

View File

@ -1,9 +1,9 @@
import { EventEmitter, Component, Input, Output, ElementRef } from "@angular/core"; import { EventEmitter, Component, Input, Output, ElementRef } from '@angular/core';
import { CardItem } from "../../pages/search/search"; import { CardItem } from '../../pages/search/search';
@Component({ @Component({
selector: "error", selector: 'error',
templateUrl: "error.html" templateUrl: 'error.html'
}) })
export class Error export class Error
{ {
@ -19,7 +19,7 @@ export class Error
close() close()
{ {
let d = 275; const d = 275;
this.elementRef.nativeElement.parentElement.animate({ this.elementRef.nativeElement.parentElement.animate({
transform: ['none', 'translate3d(110%, 0, 0)'] transform: ['none', 'translate3d(110%, 0, 0)']
}, { }, {

View File

@ -12,8 +12,8 @@
</h2> </h2>
<span *ngFor="let vs of ch.vss"> <span *ngFor="let vs of ch.vss">
<b>{{vs.v}}.</b> <span *ngFor="let w of vs.w"> <b>{{vs.v}}.</b> <span *ngFor="let w of vs.w">
<template [ngIf]="!isPunct(w.t)"> </template><a *ngIf="w.s != null" (click)="openStrongs(w.s)" (press)="openMenu(w.s)">{{w.t}}</a> <ng-template [ngIf]="!isPunct(w.t)"> </ng-template><a *ngIf="w.s != null" (click)="openStrongs(w.s)" (press)="openMenu(w.s)">{{w.t}}</a>
<template [ngIf]="w.s == null">{{w.t}}</template> <ng-template [ngIf]="w.s == null">{{w.t}}</ng-template>
</span><br *ngIf="versesOnNewLine"> </span><br *ngIf="versesOnNewLine">
</span> </span>
</div> </div>

View File

@ -53,7 +53,7 @@ export class Passage implements OnInit
next() next()
{ {
let last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)].toString(); const last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)].toString();
if (this.ref.Section.end.verse !== '*' && this.ref.Section.end.verse !== last_verse_for_end) if (this.ref.Section.end.verse !== '*' && this.ref.Section.end.verse !== last_verse_for_end)
this.ref.Section.end.chapter = this.ref.Section.end.chapter; this.ref.Section.end.chapter = this.ref.Section.end.chapter;
@ -93,7 +93,7 @@ export class Passage implements OnInit
expand() expand()
{ {
let last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)]; const last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)];
// if your verse is at the beginning, to go the prev chapter and add 3 verses from that // 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) < 4) if (parseInt(this.ref.Section.start.verse) < 4)

View File

@ -14,11 +14,11 @@
<br> <br>
<h2>Strong's Definitition</h2> <h2>Strong's Definitition</h2>
<p> <p>
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b> <b>{{item.def.tr}} <ng-template [ngIf]="item.def.sn != null">({{item.def.sn}})</ng-template></b>
- {{item.def.p}} - {{item.def.lemma}} - - {{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> <span *ngFor="let part of item.def.de"><ng-template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></ng-template><ng-template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></ng-template></span><br>
</p> </p>
<template [ngIf]="item.rmac !== null"> <ng-template [ngIf]="item.rmac !== null">
<h2>RMAC</h2> <h2>RMAC</h2>
<b>{{item.rmac.id}}</b> <b>{{item.rmac.id}}</b>
<br> <br>
@ -27,7 +27,7 @@
{{c}} {{c}}
</li> </li>
</ul> </ul>
</template> </ng-template>
<div class="strongs-cross" *ngIf="item.crossrefs != null && item.crossrefs.ss != null"> <div class="strongs-cross" *ngIf="item.crossrefs != null && item.crossrefs.ss != null">
<h2>Cross References</h2> <h2>Cross References</h2>
&nbsp;&nbsp;&nbsp;Translated as {{item.crossrefs.ss.length}} words &nbsp;&nbsp;&nbsp;Translated as {{item.crossrefs.ss.length}} words

View File

@ -9,11 +9,11 @@
<div class="strongs-def"> <div class="strongs-def">
<h2>Strong's Definitition</h2> <h2>Strong's Definitition</h2>
<p > <p >
<b>{{data.def.tr}} <template [ngIf]="data.def.sn != null">({{data.def.sn}})</template></b> <b>{{data.def.tr}} <ng-template [ngIf]="data.def.sn != null">({{data.def.sn}})</ng-template></b>
- {{data.def.p}} - {{data.def.lemma}} - - {{data.def.p}} - {{data.def.lemma}} -
<span *ngFor="let part of data.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> <span *ngFor="let part of data.def.de"><ng-template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></ng-template><ng-template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></ng-template></span><br>
</p> </p>
<template [ngIf]="data.rmac !== null"> <ng-template [ngIf]="data.rmac !== null">
<h2>RMAC</h2> <h2>RMAC</h2>
<b>{{data.rmac.id}}</b> <b>{{data.rmac.id}}</b>
<br> <br>
@ -22,7 +22,7 @@
{{c}} {{c}}
</li> </li>
</ul> </ul>
</template> </ng-template>
</div> </div>
<div class="strongs-cross" *ngIf="data.crossrefs != null && data.crossrefs.ss != null"> <div class="strongs-cross" *ngIf="data.crossrefs != null && data.crossrefs.ss != null">
<h2>Cross References</h2> <h2>Cross References</h2>

View File

@ -53,7 +53,7 @@ export class Strongs implements AfterViewChecked, OnInit
close() close()
{ {
let d = 275; const d = 275;
this.elementRef.nativeElement.parentElement.animate({ this.elementRef.nativeElement.parentElement.animate({
transform: ['none', 'translate3d(110%, 0, 0)'] transform: ['none', 'translate3d(110%, 0, 0)']
}, { }, {
@ -80,7 +80,7 @@ export class Strongs implements AfterViewChecked, OnInit
openPassage(p: string) openPassage(p: string)
{ {
let ref = this.makePassage(p); const ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
} }
} }

View File

@ -11,7 +11,7 @@ export class VersePickerModal
@Output() @Output()
onItemClicked = new EventEmitter<string>(); onItemClicked = new EventEmitter<string>();
books: Array<Book>; books: Array<Book>;
hasBook: boolean = false; hasBook = false;
book: Book; book: Book;
constructor( constructor(

View File

@ -33,8 +33,8 @@ export class Words implements AfterViewChecked, OnInit
{ {
$('words ion-scroll').each((i, el) => $('words ion-scroll').each((i, el) =>
{ {
let wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0]; const wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0];
let len = $(el).find('.scroll-zoom-wrapper a').length; const len = $(el).find('.scroll-zoom-wrapper a').length;
if (wr.scrollWidth < 500) // 1 col if (wr.scrollWidth < 500) // 1 col
{ {
@ -82,7 +82,7 @@ export class Words implements AfterViewChecked, OnInit
close() close()
{ {
let d = 275; const d = 275;
this.elementRef.nativeElement.parentElement.animate({ this.elementRef.nativeElement.parentElement.animate({
transform: ['none', 'translate3d(110%, 0, 0)'] transform: ['none', 'translate3d(110%, 0, 0)']
}, { }, {
@ -104,7 +104,7 @@ export class Words implements AfterViewChecked, OnInit
openPassage(p: string) openPassage(p: string)
{ {
let ref = this.makePassage(p); const ref = this.makePassage(p);
this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false }); this.onItemClicked.emit({ card: this.cardItem, qry: ref, from_search_bar: false });
} }
} }

View File

@ -34,6 +34,5 @@
<script src="lib/math.min.js"></script> <script src="lib/math.min.js"></script>
<script src="lib/jquery.min.js"></script> <script src="lib/jquery.min.js"></script>
<script src="lib/web-animations.min.js"></script> <script src="lib/web-animations.min.js"></script>
<script src="lib/stemmer.js"></script>
</body> </body>
</html> </html>

View File

@ -24,9 +24,8 @@ class StringUtils
export class Reference export class Reference
{ {
private ref: string; private ref: string;
public Section: Section; Section: Section;
errAcc: string;
public errAcc: string;
constructor(reference: string) constructor(reference: string)
{ {
@ -64,10 +63,10 @@ export class Reference
{ {
this.parseBook(false); this.parseBook(false);
this.parseFirstNum(false); this.parseFirstNum(false);
let foundFirstVerse = this.ref.search(/:.*-/) !== -1; const foundFirstVerse = this.ref.search(/:.*-/) !== -1;
this.maybeParseSecondNum(false); this.maybeParseSecondNum(false);
this.maybeParseRangeSep(); this.maybeParseRangeSep();
let foundSecondBook = this.ref.search(/\w\s+\d/i) !== -1; const foundSecondBook = this.ref.search(/\w\s+\d/i) !== -1;
this.maybeParseBook(true); this.maybeParseBook(true);
this.maybeParseFirstNumOrVerse(foundSecondBook, foundFirstVerse, true); this.maybeParseFirstNumOrVerse(foundSecondBook, foundFirstVerse, true);
@ -95,7 +94,7 @@ export class Reference
let found = false; let found = false;
for (let i = 0; i <= this.ref.length; i++) for (let i = 0; i <= this.ref.length; i++)
{ {
let c = this.ref.charAt(i); const c = this.ref.charAt(i);
// Grab characters until we hit a non digit. // Grab characters until we hit a non digit.
if ('0'.charAt(0) <= c && c <= '9'.charAt(0)) if ('0'.charAt(0) <= c && c <= '9'.charAt(0))
{ {
@ -141,9 +140,9 @@ export class Reference
this.ref = this.ref.slice(1); this.ref = this.ref.slice(1);
return; return;
} }
for (var i = 0; i <= this.ref.length; i++) for (let i = 0; i <= this.ref.length; i++)
{ {
let c = this.ref.charAt(i); const c = this.ref.charAt(i);
if ('0'.charAt(0) <= c && c <= '9'.charAt(0)) if ('0'.charAt(0) <= c && c <= '9'.charAt(0))
{ {
thing.verse = thing.verse.concat(c); thing.verse = thing.verse.concat(c);
@ -186,7 +185,7 @@ export class Reference
private maybeParseFirstNumOrVerse(foundSecondBook: boolean, foundFirstVerse: boolean, isEnd: boolean) private maybeParseFirstNumOrVerse(foundSecondBook: boolean, foundFirstVerse: boolean, isEnd: boolean)
{ {
let self = this; const self = this;
return this.maybeDo(() => return this.maybeDo(() =>
{ {
if (self.Section.end.book.name === self.Section.start.book.name) if (self.Section.end.book.name === self.Section.start.book.name)
@ -202,7 +201,7 @@ export class Reference
private maybeParseRangeSep() private maybeParseRangeSep()
{ {
let self = this; const self = this;
return this.maybeDo(() => return this.maybeDo(() =>
{ {
if (self.ref[0] === '-') if (self.ref[0] === '-')
@ -214,7 +213,7 @@ export class Reference
private maybeDo(f) private maybeDo(f)
{ {
let func = f; const func = f;
this.ref = StringUtils.ltrim(this.ref.toLowerCase()); this.ref = StringUtils.ltrim(this.ref.toLowerCase());
if (this.ref !== '') if (this.ref !== '')
{ {
@ -585,7 +584,7 @@ export class Reference
{ {
book_number: 6, book_number: 6,
name: 'Joshua', name: 'Joshua',
short_name: 'Joshua', short_name: 'Josh',
long_name: 'Book of Joshua', long_name: 'Book of Joshua',
last_chapter: 24, last_chapter: 24,
chapters: [0, 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33] chapters: [0, 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33]
@ -593,7 +592,7 @@ export class Reference
{ {
book_number: 7, book_number: 7,
name: 'Judges', name: 'Judges',
short_name: 'Judges', short_name: 'Jud',
long_name: 'Book of Judges', long_name: 'Book of Judges',
last_chapter: 21, last_chapter: 21,
chapters: [0, 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25] chapters: [0, 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25]
@ -625,7 +624,7 @@ export class Reference
{ {
book_number: 11, book_number: 11,
name: '1 Kings', name: '1 Kings',
short_name: '1 Kngs', short_name: '1 Kng',
long_name: 'First Book of Kings', long_name: 'First Book of Kings',
last_chapter: 22, last_chapter: 22,
chapters: [0, 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53] chapters: [0, 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53]
@ -633,7 +632,7 @@ export class Reference
{ {
book_number: 12, book_number: 12,
name: '2 Kings', name: '2 Kings',
short_name: '2 Kngs', short_name: '2 Kng',
long_name: 'Second Book of Kings', long_name: 'Second Book of Kings',
last_chapter: 25, last_chapter: 25,
chapters: [0, 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30] chapters: [0, 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30]
@ -721,7 +720,7 @@ export class Reference
{ {
book_number: 23, book_number: 23,
name: 'Isaiah', name: 'Isaiah',
short_name: 'Isaiah', short_name: 'Isa',
long_name: 'Book of Isaiah', long_name: 'Book of Isaiah',
last_chapter: 66, last_chapter: 66,
chapters: [0, 31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24] chapters: [0, 31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24]
@ -753,7 +752,7 @@ export class Reference
{ {
book_number: 27, book_number: 27,
name: 'Daniel', name: 'Daniel',
short_name: 'Daniel', short_name: 'Dan',
long_name: 'Book of Daniel', long_name: 'Book of Daniel',
last_chapter: 12, last_chapter: 12,
chapters: [0, 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13] chapters: [0, 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13]
@ -953,7 +952,7 @@ export class Reference
{ {
book_number: 52, book_number: 52,
name: '1 Thessalonians', name: '1 Thessalonians',
short_name: '1 Thess', short_name: '1 Thes',
long_name: 'First Epistle to the Thessalonians', long_name: 'First Epistle to the Thessalonians',
last_chapter: 5, last_chapter: 5,
chapters: [0, 10, 20, 13, 18, 28] chapters: [0, 10, 20, 13, 18, 28]
@ -961,7 +960,7 @@ export class Reference
{ {
book_number: 53, book_number: 53,
name: '2 Thessalonians', name: '2 Thessalonians',
short_name: '2 Thess', short_name: '2 Thes',
long_name: 'Second Epistle to the Thessalonians', long_name: 'Second Epistle to the Thessalonians',
last_chapter: 3, last_chapter: 3,
chapters: [0, 12, 17, 18] chapters: [0, 12, 17, 18]

View File

@ -1,9 +1,9 @@
/* Character code for `y`. */ /* Character code for `y`. */
var CC_Y = 'y'.charCodeAt(0); const CC_Y = 'y'.charCodeAt(0);
/* Standard suffix manipulations. */ /* Standard suffix manipulations. */
var step2list = { const step2list = {
ational: 'ate', ational: 'ate',
tional: 'tion', tional: 'tion',
enci: 'ence', enci: 'ence',
@ -27,7 +27,7 @@ var step2list = {
logi: 'log' logi: 'log'
}; };
var step3list = { const step3list = {
icate: 'ic', icate: 'ic',
ative: '', ative: '',
alize: 'al', alize: 'al',
@ -39,52 +39,52 @@ var step3list = {
/* Consonant-vowel sequences. */ /* Consonant-vowel sequences. */
var consonant = '[^aeiou]'; const consonant = '[^aeiou]';
var vowel = '[aeiouy]'; const vowel = '[aeiouy]';
var consonantSequence = '(' + consonant + '[^aeiouy]*)'; const consonantSequence = '(' + consonant + '[^aeiouy]*)';
var vowelSequence = '(' + vowel + '[aeiou]*)'; const vowelSequence = '(' + vowel + '[aeiou]*)';
var MEASURE_GT_0 = new RegExp( const MEASURE_GT_0 = new RegExp(
'^' + consonantSequence + '?' + vowelSequence + consonantSequence '^' + consonantSequence + '?' + vowelSequence + consonantSequence
); );
var MEASURE_EQ_1 = new RegExp( const MEASURE_EQ_1 = new RegExp(
'^' + consonantSequence + '?' + vowelSequence + consonantSequence + '^' + consonantSequence + '?' + vowelSequence + consonantSequence +
vowelSequence + '?$' vowelSequence + '?$'
); );
var MEASURE_GT_1 = new RegExp( const MEASURE_GT_1 = new RegExp(
'^' + consonantSequence + '?' + '^' + consonantSequence + '?' +
'(' + vowelSequence + consonantSequence + '){2,}' '(' + vowelSequence + consonantSequence + '){2,}'
); );
var VOWEL_IN_STEM = new RegExp( const VOWEL_IN_STEM = new RegExp(
'^' + consonantSequence + '?' + vowel '^' + consonantSequence + '?' + vowel
); );
var CONSONANT_LIKE = new RegExp( const CONSONANT_LIKE = new RegExp(
'^' + consonantSequence + vowel + '[^aeiouwxy]$' '^' + consonantSequence + vowel + '[^aeiouwxy]$'
); );
/* Exception expressions. */ /* Exception expressions. */
var SUFFIX_LL = /ll$/; const SUFFIX_LL = /ll$/;
var SUFFIX_E = /^(.+?)e$/; const SUFFIX_E = /^(.+?)e$/;
var SUFFIX_Y = /^(.+?)y$/; const SUFFIX_Y = /^(.+?)y$/;
var SUFFIX_ION = /^(.+?(s|t))(ion)$/; const SUFFIX_ION = /^(.+?(s|t))(ion)$/;
var SUFFIX_ED_OR_ING = /^(.+?)(ed|ing)$/; const SUFFIX_ED_OR_ING = /^(.+?)(ed|ing)$/;
var SUFFIX_AT_OR_BL_OR_IZ = /(at|bl|iz)$/; const SUFFIX_AT_OR_BL_OR_IZ = /(at|bl|iz)$/;
var SUFFIX_EED = /^(.+?)eed$/; const SUFFIX_EED = /^(.+?)eed$/;
var SUFFIX_S = /^.+?[^s]s$/; const SUFFIX_S = /^.+?[^s]s$/;
var SUFFIX_SSES_OR_IES = /^.+?(ss|i)es$/; const SUFFIX_SSES_OR_IES = /^.+?(ss|i)es$/;
var SUFFIX_MULTI_CONSONANT_LIKE = /([^aeiouylsz])\1$/; const SUFFIX_MULTI_CONSONANT_LIKE = /([^aeiouylsz])\1$/;
var STEP_2 = new RegExp( const STEP_2 = new RegExp(
'^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|' + '^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|' +
'ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|' + 'ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|' +
'biliti|logi)$' 'biliti|logi)$'
); );
var STEP_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; const STEP_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
var STEP_4 = new RegExp( const STEP_4 = new RegExp(
'^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|' + '^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|' +
'iti|ous|ive|ize)$' 'iti|ous|ive|ize)$'
); );
@ -92,8 +92,8 @@ var STEP_4 = new RegExp(
/* Stem `value`. */ /* Stem `value`. */
export function stemmer(value) export function stemmer(value)
{ {
var firstCharacterWasLowerCaseY; let firstCharacterWasLowerCaseY;
var match; let match;
value = String(value).toLowerCase(); value = String(value).toLowerCase();

View File

@ -63,6 +63,8 @@ export class SearchPage implements OnInit
// migrate old way of storing card items to the new. // migrate old way of storing card items to the new.
let has_migrated = false; let has_migrated = false;
for (let i in u.user.items) for (let i in u.user.items)
{
if (u.user.items.hasOwnProperty(i))
{ {
let ci = u.user.items[i]; let ci = u.user.items[i];
if (ci['data'] !== undefined) if (ci['data'] !== undefined)
@ -74,15 +76,22 @@ export class SearchPage implements OnInit
else if (ci['data'].word !== undefined) else if (ci['data'].word !== undefined)
u.user.items[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type }; u.user.items[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type };
else if (ci['data'].sn !== undefined) else if (ci['data'].sn !== undefined)
u.user.items[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type }; u.user.items[i] = {
qry: ci['data'].sn,
dict: ci['prefix'] === 'G' ? 'grk' : 'heb',
type: ci.type
};
has_migrated = true; has_migrated = true;
} }
} }
}
for (let pg of u.user.saved_pages) for (let pg of u.user.saved_pages)
{ {
for (let i in pg.queries) for (let i in pg.queries)
{
if (pg.queries.hasOwnProperty(i))
{ {
let ci = pg.queries[i]; let ci = pg.queries[i];
if (ci['data'] !== undefined) if (ci['data'] !== undefined)
@ -94,12 +103,17 @@ export class SearchPage implements OnInit
else if (ci['data'].word !== undefined) else if (ci['data'].word !== undefined)
pg.queries[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type }; pg.queries[i] = { qry: ci['data'].word, dict: ci.dict, type: ci.type };
else if (ci['data'].sn !== undefined) else if (ci['data'].sn !== undefined)
pg.queries[i] = { qry: ci['data'].sn, dict: ci['prefix'] === 'G' ? 'grk' : 'heb', type: ci.type }; pg.queries[i] = {
qry: ci['data'].sn,
dict: ci['prefix'] === 'G' ? 'grk' : 'heb',
type: ci.type
};
has_migrated = true; has_migrated = true;
} }
} }
} }
}
// initialize the pages. // initialize the pages.
this.pagesService.initializePages(u.user.saved_pages); this.pagesService.initializePages(u.user.saved_pages);
@ -132,7 +146,7 @@ export class SearchPage implements OnInit
addPage() addPage()
{ {
let alert = this.alertCtrl.create({ const alert = this.alertCtrl.create({
title: 'Save Search as Page', title: 'Save Search as Page',
inputs: [ inputs: [
{ {
@ -153,7 +167,7 @@ export class SearchPage implements OnInit
text: 'Save', text: 'Save',
handler: data => handler: data =>
{ {
let p = { queries: this.userProfile.user.items.slice(), title: data.title }; const p = { queries: this.userProfile.user.items.slice(), title: data.title };
this.userProfile.user.saved_pages.push(p); this.userProfile.user.saved_pages.push(p);
this.userProfile.save(this.local); this.userProfile.save(this.local);
this.pagesService.addPage(p); this.pagesService.addPage(p);
@ -163,9 +177,10 @@ export class SearchPage implements OnInit
}); });
alert.present(); alert.present();
} }
updatePage() updatePage()
{ {
let page = this.userProfile.user.saved_pages.find( const page = this.userProfile.user.saved_pages.find(
i => i =>
i.title === this.params.data.title i.title === this.params.data.title
); );
@ -201,13 +216,13 @@ export class SearchPage implements OnInit
versePicker() versePicker()
{ {
let modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this }); const modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this });
modal.present(); modal.present();
} }
removeItem(item) removeItem(item)
{ {
let idx = this.userProfile.user.items.indexOf(item); const idx = this.userProfile.user.items.indexOf(item);
this.userProfile.user.items.splice(idx, 1); this.userProfile.user.items.splice(idx, 1);
// save the users settings. // save the users settings.
@ -219,20 +234,18 @@ export class SearchPage implements OnInit
{ {
if (this.last != null && this.userProfile.user.insert_next_to_item) if (this.last != null && this.userProfile.user.insert_next_to_item)
{ {
let idx = this.userProfile.user.items.indexOf(this.last); const idx = this.userProfile.user.items.indexOf(this.last);
this.userProfile.user.items.splice(idx + 1, 0, item); this.userProfile.user.items.splice(idx + 1, 0, item);
} } else
else
this.userProfile.user.items.push(item); this.userProfile.user.items.push(item);
} }
else else
{ {
if (this.last != null && this.userProfile.user.insert_next_to_item) if (this.last != null && this.userProfile.user.insert_next_to_item)
{ {
let idx = this.userProfile.user.items.indexOf(this.last); const idx = this.userProfile.user.items.indexOf(this.last);
this.userProfile.user.items.splice(idx, 0, item); this.userProfile.user.items.splice(idx, 0, item);
} } else
else
this.userProfile.user.items.unshift(item); this.userProfile.user.items.unshift(item);
} }
this.last = null; this.last = null;
@ -247,11 +260,11 @@ export class SearchPage implements OnInit
{ {
return new Promise((resolve) => return new Promise((resolve) =>
{ {
let list: CardItem[] = []; const list: CardItem[] = [];
try try
{ {
let qs = search.split(';'); const qs = search.split(';');
for (let x in qs) for (let x in qs)
{ {
if (qs.hasOwnProperty(x)) if (qs.hasOwnProperty(x))
@ -280,7 +293,7 @@ export class SearchPage implements OnInit
// its a verse reference. // its a verse reference.
if (q.trim() !== '') if (q.trim() !== '')
{ {
let myref = new Reference(q.trim()); const myref = new Reference(q.trim());
list.push({ qry: myref.toString(), dict: myref.Section.start.book.book_number > 39 ? 'G' : 'H', type: 'Passage' }); list.push({ qry: myref.toString(), dict: myref.Section.start.book.book_number > 39 ? 'G' : 'H', type: 'Passage' });
} }
} }
@ -314,10 +327,9 @@ export class SearchPage implements OnInit
{ {
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 }); const modal = this.modalCtrl.create(StrongsModal, { sn: parseInt(item.qry), dict: item.dict, onItemClicked: this });
modal.present(); modal.present();
} } else
else
this.addItemToList(item); this.addItemToList(item);
} }
this.loader.dismiss(); this.loader.dismiss();

View File

@ -7,7 +7,7 @@
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<template [ngIf]="userProfile.user"> <ng-template [ngIf]="userProfile.user">
<h4>Search Settings</h4> <h4>Search Settings</h4>
<ion-item> <ion-item>
<button ion-button (click)="reset()">Reset Settings</button> <button ion-button (click)="reset()">Reset Settings</button>
@ -53,5 +53,5 @@
</button> </button>
</ion-item> </ion-item>
</ion-list> </ion-list>
</template> </ng-template>
</ion-content> </ion-content>

View File

@ -1,4 +1,4 @@
/// <reference path="../../../typings/globals/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';
@ -10,7 +10,7 @@ import { SavedPage, UserProfile } from '../../libs/UserProfile';
}) })
export class SettingsPage export class SettingsPage
{ {
textSize: number = 0; textSize = 0;
userProfile: UserProfile; userProfile: UserProfile;
constructor( constructor(

View File

@ -1,11 +1,11 @@
import { Pipe, PipeTransform } from "@angular/core"; import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ @Pipe({
name: "reverse" name: 'reverse'
}) })
export class ReversePipe implements PipeTransform export class ReversePipe implements PipeTransform
{ {
transform(value: any[]) : any[] transform(value: any[]): any[]
{ {
return value.slice().reverse(); return value.slice().reverse();
} }

View File

@ -9,7 +9,7 @@ export class BibleService
{ {
chapters: BiblePassage[]; chapters: BiblePassage[];
result: BiblePassageResult; result: BiblePassageResult;
count: number = 0; count = 0;
$: any; $: any;
constructor(private http: Http) constructor(private http: Http)
@ -25,7 +25,7 @@ export class BibleService
{ {
try try
{ {
var self = this; const self = this;
this.chapters = []; // the verses from the chapter. this.chapters = []; // the verses from the chapter.
this.result = { this.result = {
cs: [], cs: [],
@ -60,11 +60,11 @@ export class BibleService
type: 'GET', type: 'GET',
url: url, url: url,
dataType: 'json', dataType: 'json',
success(d: BiblePassage, t, x) success(d: BiblePassage)
{ {
self.chapters.push(d); self.chapters.push(d);
}, },
error(request, status, error) 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 + '.';
@ -117,8 +117,8 @@ export class BibleService
vss.push(this.chapters[j].vss[i - 1]); vss.push(this.chapters[j].vss[i - 1]);
this.result.cs.push({ this.result.cs.push({
"ch": this.chapters[j].ch, ch: this.chapters[j].ch,
"vss": vss vss: vss
}); });
} }

View File

@ -38,7 +38,7 @@ export class StrongsService
if (sn > 5624 || sn < 1) if (sn > 5624 || sn < 1)
{ {
self.result.status = -1; self.result.status = -1;
self.result.msg = "Strong's Number G" + sn + " is out of range. Strong's numbers range from 1 - 5624 in the New Testament."; self.result.msg = 'Strong\'s Number G' + sn + ' is out of range. Strong\'s numbers range from 1 - 5624 in the New Testament.';
} }
} }
else else
@ -47,7 +47,7 @@ export class StrongsService
if (sn > 8674 || sn < 1) if (sn > 8674 || sn < 1)
{ {
self.result.status = -1; self.result.status = -1;
self.result.msg = "Strong's Number H" + sn + " is out of range. Strong's numbers range from 1 - 8674 in the Old Testament."; self.result.msg = 'Strong\'s Number H' + sn + ' is out of range. Strong\'s numbers range from 1 - 8674 in the Old Testament.';
} }
} }
this.result.sn = sn; this.result.sn = sn;
@ -68,7 +68,7 @@ export class StrongsService
{ {
console.log(error); console.log(error);
self.result.status = -1; self.result.status = -1;
self.result.msg = "Unable to retrieve Strong's Data for " + self.result.prefix + self.result.sn; self.result.msg = 'Unable to retrieve Strong\'s Data for ' + self.result.prefix + self.result.sn;
} }
}); });
@ -98,7 +98,7 @@ export class StrongsService
{ {
console.log(error); console.log(error);
self.result.status = -1; self.result.status = -1;
self.result.msg = "Unable to retrieve Strong's Cross References for " + self.result.prefix + self.result.sn; self.result.msg = 'Unable to retrieve Strong\'s Cross References for ' + self.result.prefix + self.result.sn;
} }
}); });
@ -132,7 +132,7 @@ export class StrongsService
return this.result; return this.result;
this.result.rmaccode = tmp[0].r; this.result.rmaccode = tmp[0].r;
if (this.result.rmaccode != undefined) if (this.result.rmaccode !== undefined)
{ {
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`; url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
$.ajax({ $.ajax({

View File

@ -114,7 +114,7 @@ export class WordService
private buildIndexArray() private buildIndexArray()
{ {
let words = new Array(); const words = new Array();
words.unshift('abishur'); words.unshift('abishur');
words.unshift('achor'); words.unshift('achor');
words.unshift('adoni'); words.unshift('adoni');
@ -358,8 +358,8 @@ export class WordService
// declare terminator // declare terminator
let t = (x.length < y.length) ? x.length : y.length; let t = (x.length < y.length) ? x.length : y.length;
// sort the arrays // sort the arrays
x.sort((x, y) => x - y); x.sort((a, b) => a - b);
y.sort((x, y) => x - y); y.sort((a, b) => a - b);
// in this loop, we remove from the arrays, the // in this loop, we remove from the arrays, the
// values that aren't shared between them. // values that aren't shared between them.
while (i < t) while (i < t)

View File

@ -1,9 +1,59 @@
{ {
"rules": { "rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"forin": true,
"import-blacklist": [ true, "rxjs" ],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"label-position": true,
"member-access": false,
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-unused-variable": [ "no-empty": false,
false "no-eval": true,
] "no-inferrable-types": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"quotemark": [
true,
"single"
],
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false
}, },
"rulesDirectory": [ "rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules" "node_modules/tslint-eslint-rules/dist/rules"

View File

@ -37,6 +37,5 @@
<script src="lib/math.min.js"></script> <script src="lib/math.min.js"></script>
<script src="lib/jquery.min.js"></script> <script src="lib/jquery.min.js"></script>
<script src="lib/web-animations.min.js"></script> <script src="lib/web-animations.min.js"></script>
<script src="lib/stemmer.js"></script>
</body> </body>
</html> </html>