Skip to content

Commit 4ae5c56

Browse files
committed
Refactor
1 parent 9859f34 commit 4ae5c56

37 files changed

+492
-480
lines changed

bundle.js

Lines changed: 211 additions & 191 deletions
Large diffs are not rendered by default.

help/overview.html

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
<div class="topic topic--overview">
22
<h1>Design</h1>
33
<p>This is an offline application. Once downloaded, an internet connection is not required to use it.</p>
4-
<p>The application supports Android, Linux, or Windows platforms with the latest version of a Chromium-based browser.
5-
</p>
6-
<p>It should also support the latest version of the Safari browser, but has not been extensively tested on Mac/iOS
7-
platforms.</p>
4+
<p>The application supports Android, Linux, or Windows platforms with the latest version of a Chromium-based browser.</p>
5+
<p>It should also support the latest version of the Safari browser, but has not been extensively tested on Mac/iOS platforms.</p>
86
<h1>Layout And Icons</h1>
97
<p>The application uses seven main windows: Read, Navigator, Bookmark, Search, Strong, Setting, and Help.</p>
10-
<p>Each window contains one or more task panes. Task panes may also have Action Menu (see below) and/or auxiliary task
11-
panes. This can be visualized as follows:</p>
8+
<p>Each window contains one or more task panes. Task panes may also have Action Menu (see below) and/or auxiliary task panes. This can be visualized as follows:</p>
129
<ul class="tree">
1310
<li class="tree--window">
1411
<div class="tree-entry tree-entry--window">
@@ -35,11 +32,9 @@ <h1>Layout And Icons</h1>
3532
</ul>
3633
</li>
3734
</ul>
38-
<p>All windows have an upper and lower toolbar. These provide context information and buttons to access other
39-
features.</p>
35+
<p>All windows have an upper and lower toolbar. These provide context information and buttons to access other features.</p>
4036
<p>The Read window lower toolbar contains buttons to open the other windows.</p>
41-
<p>On smaller devices, only one window is visible at a time. Tap the desired button to display that window. Tap the
42-
Back button to return to the Read window.</p>
37+
<p>On smaller devices, only one window is visible at a time. Tap the desired button to display that window. Tap the Back button to return to the Read window.</p>
4338
<div class="entry entry--icon">
4439
<div class="icon-description">Back</div>
4540
<div class="icon-holder">
@@ -81,8 +76,7 @@ <h1>Layout And Icons</h1>
8176
<div class="tree-icon">
8277
<svg class="icon-svg">
8378
<title>Book</title>
84-
<use class="icon-holder__use icon-holder__use--navigator-book" xlink:href="icons.svg#navigator-book">
85-
</use>
79+
<use class="icon-holder__use icon-holder__use--navigator-book" xlink:href="icons.svg#navigator-book"></use>
8680
</svg>
8781
</div>
8882
<div class="tree-description">Book</div>
@@ -93,8 +87,7 @@ <h1>Layout And Icons</h1>
9387
<div class="tree-icon">
9488
<svg class="icon-svg">
9589
<title>Chapter</title>
96-
<use class="icon-holder__use icon-holder__use--navigator-chapter"
97-
xlink:href="icons.svg#navigator-chapter"></use>
90+
<use class="icon-holder__use icon-holder__use--navigator-chapter" xlink:href="icons.svg#navigator-chapter"></use>
9891
</svg>
9992
</div>
10093
<div class="tree-description">Chapter</div>
@@ -118,8 +111,7 @@ <h1>Layout And Icons</h1>
118111
<div class="tree-icon">
119112
<svg class="icon-svg">
120113
<title>List</title>
121-
<use class="icon-holder__use icon-holder__use--bookmark-list" xlink:href="icons.svg#bookmark-list">
122-
</use>
114+
<use class="icon-holder__use icon-holder__use--bookmark-list" xlink:href="icons.svg#bookmark-list"></use>
123115
</svg>
124116
</div>
125117
<div class="tree-description">List</div>
@@ -143,8 +135,7 @@ <h1>Layout And Icons</h1>
143135
<div class="tree-icon">
144136
<svg class="icon-svg">
145137
<title>Folder</title>
146-
<use class="icon-holder__use icon-holder__use--bookmark-folder" xlink:href="icons.svg#bookmark-folder">
147-
</use>
138+
<use class="icon-holder__use icon-holder__use--bookmark-folder" xlink:href="icons.svg#bookmark-folder"></use>
148139
</svg>
149140
</div>
150141
<div class="tree-description">Folder</div>
@@ -177,8 +168,7 @@ <h1>Layout And Icons</h1>
177168
<div class="tree-icon">
178169
<svg class="icon-svg">
179170
<title>Add</title>
180-
<use class="icon-holder__use icon-holder__use--bookmark-folder-add"
181-
xlink:href="icons.svg#bookmark-folder-add"></use>
171+
<use class="icon-holder__use icon-holder__use--bookmark-folder-add" xlink:href="icons.svg#bookmark-folder-add"></use>
182172
</svg>
183173
</div>
184174
<div class="tree-description">Add</div>
@@ -226,8 +216,7 @@ <h1>Layout And Icons</h1>
226216
<div class="tree-icon">
227217
<svg class="icon-svg">
228218
<title>Lookup</title>
229-
<use class="icon-holder__use icon-holder__use--search-lookup" xlink:href="icons.svg#search-lookup">
230-
</use>
219+
<use class="icon-holder__use icon-holder__use--search-lookup" xlink:href="icons.svg#search-lookup"></use>
231220
</svg>
232221
</div>
233222
<div class="tree-description">Lookup</div>
@@ -284,8 +273,7 @@ <h1>Layout And Icons</h1>
284273
<div class="tree-icon">
285274
<svg class="icon-svg">
286275
<title>Lookup</title>
287-
<use class="icon-holder__use icon-holder__use--strong-lookup" xlink:href="icons.svg#strong-lookup">
288-
</use>
276+
<use class="icon-holder__use icon-holder__use--strong-lookup" xlink:href="icons.svg#strong-lookup"></use>
289277
</svg>
290278
</div>
291279
<div class="tree-description">Lookup</div>
@@ -421,8 +409,7 @@ <h1>Action Menus</h1>
421409
<div class="icon-holder">
422410
<svg class="icon-holder icon-svg">
423411
<title>Cancel</title>
424-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel">
425-
</use>
412+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel"></use>
426413
</svg>
427414
</div>
428415
</div>
@@ -451,8 +438,7 @@ <h1>Action Menus</h1>
451438
<div class="icon-holder">
452439
<svg class="icon-holder icon-svg">
453440
<title>Delete</title>
454-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--delete" xlink:href="icons.svg#delete">
455-
</use>
441+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--delete" xlink:href="icons.svg#delete"></use>
456442
</svg>
457443
</div>
458444
</div>
@@ -461,8 +447,7 @@ <h1>Action Menus</h1>
461447
<div class="icon-holder">
462448
<svg class="icon-holder icon-svg">
463449
<title>Rename</title>
464-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--rename" xlink:href="icons.svg#rename">
465-
</use>
450+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--rename" xlink:href="icons.svg#rename"></use>
466451
</svg>
467452
</div>
468453
</div>
@@ -471,8 +456,7 @@ <h1>Action Menus</h1>
471456
<div class="icon-holder">
472457
<svg class="icon-holder icon-svg">
473458
<title>Move/Copy</title>
474-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--move-copy"
475-
xlink:href="icons.svg#move-copy"></use>
459+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--move-copy" xlink:href="icons.svg#move-copy"></use>
476460
</svg>
477461
</div>
478462
</div>
@@ -513,8 +497,7 @@ <h1>Toolbar Menu</h1>
513497
<div class="icon-holder">
514498
<svg class="icon-holder icon-svg">
515499
<title>Cancel</title>
516-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel">
517-
</use>
500+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel"></use>
518501
</svg>
519502
</div>
520503
</div>
@@ -534,8 +517,7 @@ <h1>Toolbar Menu</h1>
534517
<div class="icon-holder">
535518
<svg class="icon-holder icon-svg">
536519
<title>Setting</title>
537-
<use class="icon-holder icon-holder__use icon-holder icon-holder__use-setting" xlink:href="icons.svg#setting">
538-
</use>
520+
<use class="icon-holder icon-holder__use icon-holder icon-holder__use-setting" xlink:href="icons.svg#setting"></use>
539521
</svg>
540522
</div>
541523
</div>

js/Controller/BookmarkController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
4+
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';
55

66
class BookmarkController {
77

js/Controller/NavigatorController.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { kjvIdx } from '../data/kjvIdx.js';
5-
import { kjvLists } from '../data/kjvLists.js';
4+
import { tomeIdx } from '../data/tomeIdx.js';
5+
import { tomeLists } from '../data/tomeLists.js';
66

77
class NavigatorController {
88

@@ -18,11 +18,11 @@ class NavigatorController {
1818
this.lastBookIdx = bookIdx;
1919
if (this.bookSelectPending) {
2020
this.bookSelectPending = false;
21-
const book = kjvLists.books[bookIdx];
22-
this.chapterCount = book[kjvIdx.book.lastChapterIdx] -
23-
book[kjvIdx.book.firstChapterIdx] + 1;
21+
const book = tomeLists.books[bookIdx];
22+
this.chapterCount = book[tomeIdx.book.lastChapterIdx] -
23+
book[tomeIdx.book.firstChapterIdx] + 1;
2424
if (this.panes > 1 || this.chapterCount === 1) {
25-
const chapterIdx = kjvLists.books[bookIdx][kjvIdx.book.firstChapterIdx];
25+
const chapterIdx = tomeLists.books[bookIdx][tomeIdx.book.firstChapterIdx];
2626
queue.publish('chapterIdx.change', chapterIdx);
2727
} else {
2828
queue.publish('navigator.task.change', 'navigator-chapter');

js/Controller/SearchController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
4+
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';
55

66
class SearchController {
77

js/Controller/StrongController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
4+
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';
55

66
class StrongController {
77

js/Model/BookmarkModel.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { kjvLists } from '../data/kjvLists.js';
5-
import { kjvVerseCount } from '../data/kjvPureDb.js';
6-
import { kjvDb } from '../Model/DbModel.js';
4+
import { tomeLists } from '../data/tomeLists.js';
5+
import { tomeVerseCount } from './DbModel.js';
6+
import { tomeDb } from '../Model/DbModel.js';
77

88
const numSortAscend = (a, b) => a - b;
99

@@ -253,7 +253,6 @@ class BookmarkModel {
253253
}
254254

255255
initialize() {
256-
this.maxIdx = kjvVerseCount - 1;
257256
this.subscribe();
258257
}
259258

@@ -271,7 +270,7 @@ class BookmarkModel {
271270
}
272271

273272
async moveCopyChange(verseIdx) {
274-
this.moveCopyVerseObj = await kjvDb.verses.get(verseIdx);
273+
this.moveCopyVerseObj = await tomeDb.verses.get(verseIdx);
275274
queue.publish('bookmark.move-copy.update', this.moveCopyVerseObj);
276275
}
277276

@@ -319,6 +318,10 @@ class BookmarkModel {
319318
await this.activeFolderChange(activeFolderName);
320319
}
321320

321+
restoreDb() {
322+
this.maxIdx = tomeVerseCount - 1;
323+
}
324+
322325
restoreExpandMode() {
323326
const defaultMode = false;
324327
let expandMode = localStorage.getItem('bookmarkExpandMode');
@@ -513,8 +516,12 @@ class BookmarkModel {
513516
this.moveCopyListChange(verseIdx);
514517
});
515518

516-
queue.subscribe('name-mode.update', (nameMode) => {
517-
this.updateNameMode(nameMode);
519+
queue.subscribe('db.restore', () => {
520+
this.restoreDb();
521+
});
522+
523+
queue.subscribe('name-mode.update', () => {
524+
this.updateNameMode();
518525
});
519526
}
520527

@@ -536,7 +543,7 @@ class BookmarkModel {
536543

537544
async updateActiveFolder() {
538545
this.activeFolder = this.getFolder(this.activeFolderName);
539-
this.activeFolder.verseObjs = await kjvDb.verses.bulkGet(this.activeFolder.bookmarks);
546+
this.activeFolder.verseObjs = await tomeDb.verses.bulkGet(this.activeFolder.bookmarks);
540547
queue.publish('bookmark.active-folder.update', this.activeFolder);
541548
}
542549

@@ -545,7 +552,7 @@ class BookmarkModel {
545552
}
546553

547554
async updateBookmarkVerseObjs() {
548-
this.activeFolder.verseObjs = await kjvDb.verses.bulkGet(this.activeFolder.bookmarks);
555+
this.activeFolder.verseObjs = await tomeDb.verses.bulkGet(this.activeFolder.bookmarks);
549556
queue.publish('bookmark.verse-objs.update', this.activeFolder.verseObjs);
550557
}
551558

@@ -571,8 +578,8 @@ class BookmarkModel {
571578
) {
572579
status = 'Invalid Package Structure';
573580
}
574-
if (bookmarkPkg.tome !== kjvLists.name) {
575-
status = 'KJV Mismatch';
581+
if (bookmarkPkg.tome !== tomeLists.tomeName) {
582+
status = 'Tome Mismatch';
576583
}
577584
return status;
578585
}

js/Model/DbModel.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

33
import { queue } from '../CommandQueue.js';
4-
import { kjvPureDb, kjvPureName, kjvPureWords } from '../data/kjvPureDb.js';
5-
import { kjvNameDb, kjvNameName, kjvNameWords } from '../data/kjvNameDb.js';
4+
import { kjvPureDb, kjvPureVerseCount, kjvPureWords } from '../data/kjvPureDb.js';
5+
import { kjvNameDb, kjvNameVerseCount, kjvNameWords } from '../data/kjvNameDb.js';
66
import { strongNameDb } from '../data/strongNameDb.js';
77
import { strongPureDb } from '../data/strongPureDb.js';
88

9-
export let kjvDb = null;
10-
export let kjvWords = null;
11-
export let kjvName = null;
9+
export let tomeDb = null;
10+
export let tomeVerseCount = null;
11+
export let tomeWords = null;
1212
export let dbNameMode = null;
1313
export let strongDb = null;
1414
export let strongName = null;
@@ -23,23 +23,23 @@ class DbModel {
2323
this.subscribe();
2424
}
2525

26-
kjvDbChange() {
26+
tomeDbChange() {
2727
if (this.nameMode === true) {
28-
kjvDb = kjvNameDb;
29-
kjvWords = kjvNameWords;
30-
kjvName = kjvNameName;
28+
tomeDb = kjvNameDb;
29+
tomeVerseCount = kjvNameVerseCount;
30+
tomeWords = kjvNameWords;
3131
} else {
32-
kjvDb = kjvPureDb;
33-
kjvWords = kjvPureWords;
34-
kjvName = kjvPureName;
32+
tomeDb = kjvPureDb;
33+
tomeVerseCount = kjvPureVerseCount;
34+
tomeWords = kjvPureWords;
3535
}
3636
}
3737

3838
nameModeChange() {
3939
this.nameMode = !this.nameMode;
4040
this.saveNameMode();
4141
dbNameMode = this.nameMode;
42-
this.kjvDbChange();
42+
this.tomeDbChange();
4343
this.strongDbChange();
4444
queue.publish('name-mode.update', this.nameMode);
4545
}
@@ -63,7 +63,9 @@ class DbModel {
6363
nameMode = defaultNameMode;
6464
}
6565
}
66-
this.kjvDbChange();
66+
this.nameMode = nameMode;
67+
dbNameMode = this.nameMode;
68+
this.tomeDbChange();
6769
this.strongDbChange();
6870
}
6971

0 commit comments

Comments
 (0)