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 { StatusBar } from '@ionic-native/status-bar';
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({
templateUrl: 'app.html',

View File

@ -1,27 +1,27 @@
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule} from '@angular/platform-browser';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { IonicStorageModule } from '@ionic/storage';
import { IonicStorageModule } from '@ionic/storage';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { MyApp } from './app.component';
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 { ComponentLoader } from "../components/component-loader/component-loader";
import { Passage } from "../components/passage/passage";
import { Strongs } from "../components/strongs/strongs";
import { Words } from "../components/words/words";
import { Error } from "../components/error/error";
import { StrongsModal } from "../components/strongs-modal/strongs-modal";
import { ComponentLoader } from '../components/component-loader/component-loader';
import { Passage } from '../components/passage/passage';
import { Strongs } from '../components/strongs/strongs';
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';
import { VersePickerModal } from '../components/verse-picker/verse-picker';
@NgModule({
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'
// Helper component to add dynamic components
@ -11,7 +11,7 @@ export class ComponentLoader {
@Input() type;
@Input() data;
cmpRef: ComponentRef<any>;
private isViewInitialized: boolean = false;
private isViewInitialized = false;
constructor(private componentFactoryResolver: ComponentFactoryResolver, private compiler: Compiler,
private cdRef: ChangeDetectorRef) { }
@ -24,7 +24,7 @@ export class ComponentLoader {
this.cmpRef.destroy();
}
let factory = this.componentFactoryResolver.resolveComponentFactory(this.type);
const factory = this.componentFactoryResolver.resolveComponentFactory(this.type);
this.cmpRef = this.target.createComponent(factory);
// to access the created instance use
// this.compRef.instance.someProperty = 'someValue';
@ -49,4 +49,4 @@ export class ComponentLoader {
this.cmpRef.destroy();
}
}
}
}

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ export class Passage implements OnInit
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)
this.ref.Section.end.chapter = this.ref.Section.end.chapter;
@ -93,7 +93,7 @@ export class Passage implements OnInit
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 (parseInt(this.ref.Section.start.verse) < 4)

View File

@ -14,11 +14,11 @@
<br>
<h2>Strong's Definitition</h2>
<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}} -
<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>
<template [ngIf]="item.rmac !== null">
<ng-template [ngIf]="item.rmac !== null">
<h2>RMAC</h2>
<b>{{item.rmac.id}}</b>
<br>
@ -27,7 +27,7 @@
{{c}}
</li>
</ul>
</template>
</ng-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

View File

@ -9,11 +9,11 @@
<div class="strongs-def">
<h2>Strong's Definitition</h2>
<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}} -
<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>
<template [ngIf]="data.rmac !== null">
<ng-template [ngIf]="data.rmac !== null">
<h2>RMAC</h2>
<b>{{data.rmac.id}}</b>
<br>
@ -22,7 +22,7 @@
{{c}}
</li>
</ul>
</template>
</ng-template>
</div>
<div class="strongs-cross" *ngIf="data.crossrefs != null && data.crossrefs.ss != null">
<h2>Cross References</h2>

View File

@ -8,7 +8,7 @@ import { StrongsResult, StrongsService } from '../../services/strongs-service';
templateUrl: 'strongs.html',
providers: [StrongsService]
})
export class Strongs implements AfterViewChecked, OnInit
export class Strongs implements AfterViewChecked, OnInit
{
@Output()
onClose = new EventEmitter<CardItem>();
@ -53,7 +53,7 @@ export class Strongs implements AfterViewChecked, OnInit
close()
{
let d = 275;
const d = 275;
this.elementRef.nativeElement.parentElement.animate({
transform: ['none', 'translate3d(110%, 0, 0)']
}, {
@ -78,9 +78,9 @@ export class Strongs implements AfterViewChecked, OnInit
return Reference.bookName(parseInt(p.split(';')[0])).name + ' ' + p.split(';')[1] + ':' + p.split(';')[2];
}
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 });
}
}

View File

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

View File

@ -9,7 +9,7 @@ import { WordLookupResult, WordService } from '../../services/word-service';
templateUrl: 'words.html',
providers: [WordService]
})
export class Words implements AfterViewChecked, OnInit
export class Words implements AfterViewChecked, OnInit
{
@Output()
onClose = new EventEmitter<CardItem>();
@ -33,8 +33,8 @@ export class Words implements AfterViewChecked, OnInit
{
$('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;
const wr = $(el).find('.scroll-content .scroll-zoom-wrapper')[0];
const len = $(el).find('.scroll-zoom-wrapper a').length;
if (wr.scrollWidth < 500) // 1 col
{
@ -82,7 +82,7 @@ export class Words implements AfterViewChecked, OnInit
close()
{
let d = 275;
const d = 275;
this.elementRef.nativeElement.parentElement.animate({
transform: ['none', 'translate3d(110%, 0, 0)']
}, {
@ -104,7 +104,7 @@ export class Words implements AfterViewChecked, OnInit
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 });
}
}

View File

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

View File

@ -24,9 +24,8 @@ class StringUtils
export class Reference
{
private ref: string;
public Section: Section;
public errAcc: string;
Section: Section;
errAcc: string;
constructor(reference: string)
{
@ -64,10 +63,10 @@ export class Reference
{
this.parseBook(false);
this.parseFirstNum(false);
let foundFirstVerse = this.ref.search(/:.*-/) !== -1;
const foundFirstVerse = this.ref.search(/:.*-/) !== -1;
this.maybeParseSecondNum(false);
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.maybeParseFirstNumOrVerse(foundSecondBook, foundFirstVerse, true);
@ -95,7 +94,7 @@ export class Reference
let found = false;
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.
if ('0'.charAt(0) <= c && c <= '9'.charAt(0))
{
@ -141,9 +140,9 @@ export class Reference
this.ref = this.ref.slice(1);
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))
{
thing.verse = thing.verse.concat(c);
@ -186,7 +185,7 @@ export class Reference
private maybeParseFirstNumOrVerse(foundSecondBook: boolean, foundFirstVerse: boolean, isEnd: boolean)
{
let self = this;
const self = this;
return this.maybeDo(() =>
{
if (self.Section.end.book.name === self.Section.start.book.name)
@ -202,7 +201,7 @@ export class Reference
private maybeParseRangeSep()
{
let self = this;
const self = this;
return this.maybeDo(() =>
{
if (self.ref[0] === '-')
@ -214,7 +213,7 @@ export class Reference
private maybeDo(f)
{
let func = f;
const func = f;
this.ref = StringUtils.ltrim(this.ref.toLowerCase());
if (this.ref !== '')
{
@ -585,7 +584,7 @@ export class Reference
{
book_number: 6,
name: 'Joshua',
short_name: 'Joshua',
short_name: 'Josh',
long_name: 'Book of Joshua',
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]
@ -593,7 +592,7 @@ export class Reference
{
book_number: 7,
name: 'Judges',
short_name: 'Judges',
short_name: 'Jud',
long_name: 'Book of Judges',
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]
@ -625,7 +624,7 @@ export class Reference
{
book_number: 11,
name: '1 Kings',
short_name: '1 Kngs',
short_name: '1 Kng',
long_name: 'First Book of Kings',
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]
@ -633,7 +632,7 @@ export class Reference
{
book_number: 12,
name: '2 Kings',
short_name: '2 Kngs',
short_name: '2 Kng',
long_name: 'Second Book of Kings',
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]
@ -721,7 +720,7 @@ export class Reference
{
book_number: 23,
name: 'Isaiah',
short_name: 'Isaiah',
short_name: 'Isa',
long_name: 'Book of Isaiah',
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]
@ -753,7 +752,7 @@ export class Reference
{
book_number: 27,
name: 'Daniel',
short_name: 'Daniel',
short_name: 'Dan',
long_name: 'Book of Daniel',
last_chapter: 12,
chapters: [0, 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13]
@ -953,7 +952,7 @@ export class Reference
{
book_number: 52,
name: '1 Thessalonians',
short_name: '1 Thess',
short_name: '1 Thes',
long_name: 'First Epistle to the Thessalonians',
last_chapter: 5,
chapters: [0, 10, 20, 13, 18, 28]
@ -961,7 +960,7 @@ export class Reference
{
book_number: 53,
name: '2 Thessalonians',
short_name: '2 Thess',
short_name: '2 Thes',
long_name: 'Second Epistle to the Thessalonians',
last_chapter: 3,
chapters: [0, 12, 17, 18]

View File

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

View File

@ -64,41 +64,55 @@ export class SearchPage implements OnInit
let has_migrated = false;
for (let i in u.user.items)
{
let ci = u.user.items[i];
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 };
has_migrated = true;
}
}
if (u.user.items.hasOwnProperty(i))
{
let ci = u.user.items[i];
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
};
has_migrated = true;
}
}
}
for (let pg of u.user.saved_pages)
{
for (let i in pg.queries)
{
let ci = pg.queries[i];
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 };
has_migrated = true;
}
}
if (pg.queries.hasOwnProperty(i))
{
let ci = pg.queries[i];
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
};
has_migrated = true;
}
}
}
}
// initialize the pages.
@ -130,44 +144,45 @@ export class SearchPage implements OnInit
this.menu.open('actions');
}
addPage()
addPage()
{
let alert = this.alertCtrl.create({
title: 'Save Search as Page',
inputs: [
{
name: 'title',
placeholder: 'Page Title'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: (): void =>
{
console.log('Cancel clicked');
}
},
{
text: 'Save',
handler: data =>
{
let p = { queries: this.userProfile.user.items.slice(), title: data.title };
const alert = this.alertCtrl.create({
title: 'Save Search as Page',
inputs: [
{
name: 'title',
placeholder: 'Page Title'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: (): void =>
{
console.log('Cancel clicked');
}
},
{
text: 'Save',
handler: data =>
{
const p = { queries: this.userProfile.user.items.slice(), title: data.title };
this.userProfile.user.saved_pages.push(p);
this.userProfile.save(this.local);
this.pagesService.addPage(p);
}
}
]
});
this.pagesService.addPage(p);
}
}
]
});
alert.present();
}
updatePage()
{
let page = this.userProfile.user.saved_pages.find(
const page = this.userProfile.user.saved_pages.find(
i =>
i.title === this.params.data.title
i.title === this.params.data.title
);
page.queries = this.userProfile.user.items.slice();
this.userProfile.save(this.local);
@ -201,13 +216,13 @@ export class SearchPage implements OnInit
versePicker()
{
let modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this });
const modal = this.modalCtrl.create(VersePickerModal, { onItemClicked: this });
modal.present();
}
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);
// save the users settings.
@ -219,20 +234,18 @@ export class SearchPage implements OnInit
{
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);
}
else
} else
this.userProfile.user.items.push(item);
}
else
{
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);
}
else
} else
this.userProfile.user.items.unshift(item);
}
this.last = null;
@ -247,11 +260,11 @@ export class SearchPage implements OnInit
{
return new Promise((resolve) =>
{
let list: CardItem[] = [];
const list: CardItem[] = [];
try
{
let qs = search.split(';');
const qs = search.split(';');
for (let x in qs)
{
if (qs.hasOwnProperty(x))
@ -280,7 +293,7 @@ export class SearchPage implements OnInit
// its a verse reference.
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' });
}
}
@ -314,10 +327,9 @@ export class SearchPage implements OnInit
{
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();
}
else
} else
this.addItemToList(item);
}
this.loader.dismiss();

View File

@ -7,7 +7,7 @@
</ion-navbar>
</ion-header>
<ion-content padding>
<template [ngIf]="userProfile.user">
<ng-template [ngIf]="userProfile.user">
<h4>Search Settings</h4>
<ion-item>
<button ion-button (click)="reset()">Reset Settings</button>
@ -53,5 +53,5 @@
</button>
</ion-item>
</ion-list>
</template>
</ng-template>
</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 { NavController, AlertController } from 'ionic-angular';
import { Storage } from '@ionic/storage';
@ -10,7 +10,7 @@ import { SavedPage, UserProfile } from '../../libs/UserProfile';
})
export class SettingsPage
{
textSize: number = 0;
textSize = 0;
userProfile: UserProfile;
constructor(
@ -80,4 +80,4 @@ export class SettingsPage
});
alert.present();
}
}
}

View File

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

View File

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

View File

@ -38,7 +38,7 @@ export class StrongsService
if (sn > 5624 || sn < 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
@ -47,7 +47,7 @@ export class StrongsService
if (sn > 8674 || sn < 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;
@ -68,7 +68,7 @@ export class StrongsService
{
console.log(error);
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);
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;
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`;
$.ajax({

View File

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

View File

@ -1,11 +1,61 @@
{
"rules": {
"no-duplicate-variable": true,
"no-unused-variable": [
false
]
},
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/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-empty": 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": [
"node_modules/tslint-eslint-rules/dist/rules"
]
}

View File

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