Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
1John419 committed May 17, 2024
1 parent 9859f34 commit 4ae5c56
Show file tree
Hide file tree
Showing 37 changed files with 492 additions and 480 deletions.
402 changes: 211 additions & 191 deletions bundle.js

Large diffs are not rendered by default.

54 changes: 18 additions & 36 deletions help/overview.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<div class="topic topic--overview">
<h1>Design</h1>
<p>This is an offline application. Once downloaded, an internet connection is not required to use it.</p>
<p>The application supports Android, Linux, or Windows platforms with the latest version of a Chromium-based browser.
</p>
<p>It should also support the latest version of the Safari browser, but has not been extensively tested on Mac/iOS
platforms.</p>
<p>The application supports Android, Linux, or Windows platforms with the latest version of a Chromium-based browser.</p>
<p>It should also support the latest version of the Safari browser, but has not been extensively tested on Mac/iOS platforms.</p>
<h1>Layout And Icons</h1>
<p>The application uses seven main windows: Read, Navigator, Bookmark, Search, Strong, Setting, and Help.</p>
<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>
<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>
<ul class="tree">
<li class="tree--window">
<div class="tree-entry tree-entry--window">
Expand All @@ -35,11 +32,9 @@ <h1>Layout And Icons</h1>
</ul>
</li>
</ul>
<p>All windows have an upper and lower toolbar. These provide context information and buttons to access other
features.</p>
<p>All windows have an upper and lower toolbar. These provide context information and buttons to access other features.</p>
<p>The Read window lower toolbar contains buttons to open the other windows.</p>
<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>
<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>
<div class="entry entry--icon">
<div class="icon-description">Back</div>
<div class="icon-holder">
Expand Down Expand Up @@ -81,8 +76,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Book</title>
<use class="icon-holder__use icon-holder__use--navigator-book" xlink:href="icons.svg#navigator-book">
</use>
<use class="icon-holder__use icon-holder__use--navigator-book" xlink:href="icons.svg#navigator-book"></use>
</svg>
</div>
<div class="tree-description">Book</div>
Expand All @@ -93,8 +87,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Chapter</title>
<use class="icon-holder__use icon-holder__use--navigator-chapter"
xlink:href="icons.svg#navigator-chapter"></use>
<use class="icon-holder__use icon-holder__use--navigator-chapter" xlink:href="icons.svg#navigator-chapter"></use>
</svg>
</div>
<div class="tree-description">Chapter</div>
Expand All @@ -118,8 +111,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>List</title>
<use class="icon-holder__use icon-holder__use--bookmark-list" xlink:href="icons.svg#bookmark-list">
</use>
<use class="icon-holder__use icon-holder__use--bookmark-list" xlink:href="icons.svg#bookmark-list"></use>
</svg>
</div>
<div class="tree-description">List</div>
Expand All @@ -143,8 +135,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Folder</title>
<use class="icon-holder__use icon-holder__use--bookmark-folder" xlink:href="icons.svg#bookmark-folder">
</use>
<use class="icon-holder__use icon-holder__use--bookmark-folder" xlink:href="icons.svg#bookmark-folder"></use>
</svg>
</div>
<div class="tree-description">Folder</div>
Expand Down Expand Up @@ -177,8 +168,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Add</title>
<use class="icon-holder__use icon-holder__use--bookmark-folder-add"
xlink:href="icons.svg#bookmark-folder-add"></use>
<use class="icon-holder__use icon-holder__use--bookmark-folder-add" xlink:href="icons.svg#bookmark-folder-add"></use>
</svg>
</div>
<div class="tree-description">Add</div>
Expand Down Expand Up @@ -226,8 +216,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Lookup</title>
<use class="icon-holder__use icon-holder__use--search-lookup" xlink:href="icons.svg#search-lookup">
</use>
<use class="icon-holder__use icon-holder__use--search-lookup" xlink:href="icons.svg#search-lookup"></use>
</svg>
</div>
<div class="tree-description">Lookup</div>
Expand Down Expand Up @@ -284,8 +273,7 @@ <h1>Layout And Icons</h1>
<div class="tree-icon">
<svg class="icon-svg">
<title>Lookup</title>
<use class="icon-holder__use icon-holder__use--strong-lookup" xlink:href="icons.svg#strong-lookup">
</use>
<use class="icon-holder__use icon-holder__use--strong-lookup" xlink:href="icons.svg#strong-lookup"></use>
</svg>
</div>
<div class="tree-description">Lookup</div>
Expand Down Expand Up @@ -421,8 +409,7 @@ <h1>Action Menus</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Cancel</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel">
</use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel"></use>
</svg>
</div>
</div>
Expand Down Expand Up @@ -451,8 +438,7 @@ <h1>Action Menus</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Delete</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--delete" xlink:href="icons.svg#delete">
</use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--delete" xlink:href="icons.svg#delete"></use>
</svg>
</div>
</div>
Expand All @@ -461,8 +447,7 @@ <h1>Action Menus</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Rename</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--rename" xlink:href="icons.svg#rename">
</use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--rename" xlink:href="icons.svg#rename"></use>
</svg>
</div>
</div>
Expand All @@ -471,8 +456,7 @@ <h1>Action Menus</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Move/Copy</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--move-copy"
xlink:href="icons.svg#move-copy"></use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--move-copy" xlink:href="icons.svg#move-copy"></use>
</svg>
</div>
</div>
Expand Down Expand Up @@ -513,8 +497,7 @@ <h1>Toolbar Menu</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Cancel</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel">
</use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use--cancel" xlink:href="icons.svg#cancel"></use>
</svg>
</div>
</div>
Expand All @@ -534,8 +517,7 @@ <h1>Toolbar Menu</h1>
<div class="icon-holder">
<svg class="icon-holder icon-svg">
<title>Setting</title>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use-setting" xlink:href="icons.svg#setting">
</use>
<use class="icon-holder icon-holder__use icon-holder icon-holder__use-setting" xlink:href="icons.svg#setting"></use>
</svg>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion js/Controller/BookmarkController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';

class BookmarkController {

Expand Down
12 changes: 6 additions & 6 deletions js/Controller/NavigatorController.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { kjvIdx } from '../data/kjvIdx.js';
import { kjvLists } from '../data/kjvLists.js';
import { tomeIdx } from '../data/tomeIdx.js';
import { tomeLists } from '../data/tomeLists.js';

class NavigatorController {

Expand All @@ -18,11 +18,11 @@ class NavigatorController {
this.lastBookIdx = bookIdx;
if (this.bookSelectPending) {
this.bookSelectPending = false;
const book = kjvLists.books[bookIdx];
this.chapterCount = book[kjvIdx.book.lastChapterIdx] -
book[kjvIdx.book.firstChapterIdx] + 1;
const book = tomeLists.books[bookIdx];
this.chapterCount = book[tomeIdx.book.lastChapterIdx] -
book[tomeIdx.book.firstChapterIdx] + 1;
if (this.panes > 1 || this.chapterCount === 1) {
const chapterIdx = kjvLists.books[bookIdx][kjvIdx.book.firstChapterIdx];
const chapterIdx = tomeLists.books[bookIdx][tomeIdx.book.firstChapterIdx];
queue.publish('chapterIdx.change', chapterIdx);
} else {
queue.publish('navigator.task.change', 'navigator-chapter');
Expand Down
2 changes: 1 addition & 1 deletion js/Controller/SearchController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';

class SearchController {

Expand Down
2 changes: 1 addition & 1 deletion js/Controller/StrongController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { chapterIdxByVerseIdx } from '../data/kjvLists.js';
import { chapterIdxByVerseIdx } from '../data/tomeLists.js';

class StrongController {

Expand Down
29 changes: 18 additions & 11 deletions js/Model/BookmarkModel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { kjvLists } from '../data/kjvLists.js';
import { kjvVerseCount } from '../data/kjvPureDb.js';
import { kjvDb } from '../Model/DbModel.js';
import { tomeLists } from '../data/tomeLists.js';
import { tomeVerseCount } from './DbModel.js';
import { tomeDb } from '../Model/DbModel.js';

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

Expand Down Expand Up @@ -253,7 +253,6 @@ class BookmarkModel {
}

initialize() {
this.maxIdx = kjvVerseCount - 1;
this.subscribe();
}

Expand All @@ -271,7 +270,7 @@ class BookmarkModel {
}

async moveCopyChange(verseIdx) {
this.moveCopyVerseObj = await kjvDb.verses.get(verseIdx);
this.moveCopyVerseObj = await tomeDb.verses.get(verseIdx);
queue.publish('bookmark.move-copy.update', this.moveCopyVerseObj);
}

Expand Down Expand Up @@ -319,6 +318,10 @@ class BookmarkModel {
await this.activeFolderChange(activeFolderName);
}

restoreDb() {
this.maxIdx = tomeVerseCount - 1;
}

restoreExpandMode() {
const defaultMode = false;
let expandMode = localStorage.getItem('bookmarkExpandMode');
Expand Down Expand Up @@ -513,8 +516,12 @@ class BookmarkModel {
this.moveCopyListChange(verseIdx);
});

queue.subscribe('name-mode.update', (nameMode) => {
this.updateNameMode(nameMode);
queue.subscribe('db.restore', () => {
this.restoreDb();
});

queue.subscribe('name-mode.update', () => {
this.updateNameMode();
});
}

Expand All @@ -536,7 +543,7 @@ class BookmarkModel {

async updateActiveFolder() {
this.activeFolder = this.getFolder(this.activeFolderName);
this.activeFolder.verseObjs = await kjvDb.verses.bulkGet(this.activeFolder.bookmarks);
this.activeFolder.verseObjs = await tomeDb.verses.bulkGet(this.activeFolder.bookmarks);
queue.publish('bookmark.active-folder.update', this.activeFolder);
}

Expand All @@ -545,7 +552,7 @@ class BookmarkModel {
}

async updateBookmarkVerseObjs() {
this.activeFolder.verseObjs = await kjvDb.verses.bulkGet(this.activeFolder.bookmarks);
this.activeFolder.verseObjs = await tomeDb.verses.bulkGet(this.activeFolder.bookmarks);
queue.publish('bookmark.verse-objs.update', this.activeFolder.verseObjs);
}

Expand All @@ -571,8 +578,8 @@ class BookmarkModel {
) {
status = 'Invalid Package Structure';
}
if (bookmarkPkg.tome !== kjvLists.name) {
status = 'KJV Mismatch';
if (bookmarkPkg.tome !== tomeLists.tomeName) {
status = 'Tome Mismatch';
}
return status;
}
Expand Down
30 changes: 16 additions & 14 deletions js/Model/DbModel.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';

import { queue } from '../CommandQueue.js';
import { kjvPureDb, kjvPureName, kjvPureWords } from '../data/kjvPureDb.js';
import { kjvNameDb, kjvNameName, kjvNameWords } from '../data/kjvNameDb.js';
import { kjvPureDb, kjvPureVerseCount, kjvPureWords } from '../data/kjvPureDb.js';
import { kjvNameDb, kjvNameVerseCount, kjvNameWords } from '../data/kjvNameDb.js';
import { strongNameDb } from '../data/strongNameDb.js';
import { strongPureDb } from '../data/strongPureDb.js';

export let kjvDb = null;
export let kjvWords = null;
export let kjvName = null;
export let tomeDb = null;
export let tomeVerseCount = null;
export let tomeWords = null;
export let dbNameMode = null;
export let strongDb = null;
export let strongName = null;
Expand All @@ -23,23 +23,23 @@ class DbModel {
this.subscribe();
}

kjvDbChange() {
tomeDbChange() {
if (this.nameMode === true) {
kjvDb = kjvNameDb;
kjvWords = kjvNameWords;
kjvName = kjvNameName;
tomeDb = kjvNameDb;
tomeVerseCount = kjvNameVerseCount;
tomeWords = kjvNameWords;
} else {
kjvDb = kjvPureDb;
kjvWords = kjvPureWords;
kjvName = kjvPureName;
tomeDb = kjvPureDb;
tomeVerseCount = kjvPureVerseCount;
tomeWords = kjvPureWords;
}
}

nameModeChange() {
this.nameMode = !this.nameMode;
this.saveNameMode();
dbNameMode = this.nameMode;
this.kjvDbChange();
this.tomeDbChange();
this.strongDbChange();
queue.publish('name-mode.update', this.nameMode);
}
Expand All @@ -63,7 +63,9 @@ class DbModel {
nameMode = defaultNameMode;
}
}
this.kjvDbChange();
this.nameMode = nameMode;
dbNameMode = this.nameMode;
this.tomeDbChange();
this.strongDbChange();
}

Expand Down
Loading

0 comments on commit 4ae5c56

Please sign in to comment.