FEATURE: Added support for changing the font.

This commit is contained in:
walljm 2018-03-16 19:21:43 -04:00
parent 374af296d3
commit 9335b1f9c9
13 changed files with 58 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -34,4 +34,8 @@ ion-card .title {
.button-wp, .button-md, .button-ios { .button-wp, .button-md, .button-ios {
margin-right: -6px; margin-right: -6px;
} }
}
html {
--card-font: Roboto, Helvetica, Arial, sans-serif;
} }

View File

@ -1,3 +1,3 @@
err-message { error-message {
font-family: var(--card-font);
} }

View File

@ -3,6 +3,8 @@ passage {
user-select: text !important; user-select: text !important;
cursor: pointer; cursor: pointer;
} }
font-family: var(--card-font);
} }
passage .button { passage .button {

View File

@ -1,4 +1,5 @@
strongs-modal { strongs-modal {
font-family: var(--card-font);
a { a {
cursor: pointer !important; cursor: pointer !important;
color: black; color: black;

View File

@ -7,6 +7,8 @@
} }
strongs { strongs {
font-family: var(--card-font);
ion-scroll { ion-scroll {
height: 250px; height: 250px;
} }

View File

@ -1,4 +1,5 @@
words { words {
font-family: var(--card-font);
.button { .button {
color: #632761; color: #632761;
} }

View File

@ -65,22 +65,32 @@
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-range min="6" max="20" step="1" snaps="true" [(ngModel)]="this.profileService.profile().font_size" (ionChange)="textSizeChanged()"> <ion-range min="6" max="20" step="1" snaps="true" [(ngModel)]="this.profileService.profile().font_size" (ionChange)="textSizeChanged()">
<ion-label range-left class="small-text">A</ion-label> <ion-label range-left class="small-text">a</ion-label>
<ion-label range-right>A</ion-label> <ion-label range-right>A</ion-label>
</ion-range> </ion-range>
</ion-item> </ion-item>
<ion-item>
<ion-label>Font Family</ion-label>
<ion-select [(ngModel)]="this.profileService.profile().font_family" (ionChange)="fontFamilyChanged()">
<ion-option value="Roboto, Helvetica, Arial, sans-serif">Sans Serif</ion-option>
<ion-option value="'Times New Roman', serif">Times</ion-option>
<ion-option value="Georgia, serif">Georgia</ion-option>
<ion-option value="Merriweather, serif">Merriweather</ion-option>
<ion-option value="Consolas, monotype">Monospaced</ion-option>
</ion-select>
</ion-item>
</ion-list> </ion-list>
<ion-list-header><ion-icon name="log-in" item-left></ion-icon>Login/Logout</ion-list-header> <ion-list-header><ion-icon name="log-in" item-left></ion-icon>Login/Logout</ion-list-header>
<ng-template [ngIf]="!profileService.currentUser()"> <ng-template [ngIf]="!profileService.currentUser()">
<ion-item center> <ion-item center>
<button ion-button full (click)="profileService.authenticate()">Login With Google</button> <button ion-button block (click)="profileService.authenticate()">Login With Google</button>
</ion-item> </ion-item>
</ng-template> </ng-template>
<ng-template [ngIf]="profileService.currentUser()"> <ng-template [ngIf]="profileService.currentUser()">
<ion-item center> <ion-item center>
<button ion-button full (click)="profileService.logout()">Logout</button> <button ion-button block (click)="profileService.logout()">Logout</button>
</ion-item> </ion-item>
</ng-template> </ng-template>
</ion-content> </ion-content>

View File

@ -30,7 +30,6 @@ body {
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
} }
font-family: "Roboto", "Arial", "Helvetica", sans-serif;
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
} }

View File

@ -148,7 +148,11 @@ export class SearchPage implements OnInit
this.profileService.textSizeChanged(); this.profileService.textSizeChanged();
this.profileService.localSave(); this.profileService.localSave();
} }
fontFamilyChanged()
{
this.profileService.fontFamilyChanged();
this.profileService.localSave();
}
actionsMenu() actionsMenu()
{ {
this.menu.open('actions'); this.menu.open('actions');

View File

@ -54,11 +54,21 @@
<ion-list-header><ion-icon name="text" item-left></ion-icon>Adjust Text</ion-list-header> <ion-list-header><ion-icon name="text" item-left></ion-icon>Adjust Text</ion-list-header>
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-range min="6" max="20" step="1" snaps="true" [(ngModel)]="profileService.profile().font_size" (ionChange)="textSizeChanged()"> <ion-range min="6" max="20" step="1" snaps="true" [(ngModel)]="this.profileService.profile().font_size" (ionChange)="textSizeChanged()">
<ion-label range-left class="small-text">A</ion-label> <ion-label range-left class="small-text">a</ion-label>
<ion-label range-right>A</ion-label> <ion-label range-right>A</ion-label>
</ion-range> </ion-range>
</ion-item> </ion-item>
<ion-item>
<ion-label>Font Family</ion-label>
<ion-select [(ngModel)]="this.profileService.profile().font_family" (ionChange)="fontFamilyChanged()">
<ion-option value="Roboto, Helvetica, Arial, sans-serif">Sans Serif</ion-option>
<ion-option value="'Times New Roman', serif">Times</ion-option>
<ion-option value="Georgia, serif">Georgia</ion-option>
<ion-option value="Merriweather, serif">Merriweather</ion-option>
<ion-option value="Consolas, monotype">Monospaced</ion-option>
</ion-select>
</ion-item>
</ion-list> </ion-list>
<ion-list-header><ion-icon name="log-in" item-left></ion-icon>Login/Logout</ion-list-header> <ion-list-header><ion-icon name="log-in" item-left></ion-icon>Login/Logout</ion-list-header>

View File

@ -23,6 +23,11 @@ export class SettingsPage
this.profileService.localSave(); this.profileService.localSave();
} }
fontFamilyChanged()
{
this.profileService.fontFamilyChanged();
this.profileService.localSave();
}
reset() reset()
{ {
this.profileService.reset() this.profileService.reset()

View File

@ -263,6 +263,7 @@ export class ProfileService
user[k] = t[k]; user[k] = t[k];
this.textSizeChanged(); this.textSizeChanged();
this.fontFamilyChanged();
return updated; return updated;
} }
@ -305,12 +306,19 @@ export class ProfileService
$('html').css('font-size', this.profile().font_size + 'px'); $('html').css('font-size', this.profile().font_size + 'px');
} }
fontFamilyChanged()
{
document.querySelector('html').style.cssText = '--card-font: '+this.profile().font_family;
this.textSizeChanged();
}
static createDefaultUser(): User static createDefaultUser(): User
{ {
return { return {
username: DEFAULT_USER_NAME, username: DEFAULT_USER_NAME,
uid: null, uid: null,
font_size: 10, font_size: 10,
font_family: 'roboto, helvetica, arial, sans-serif',
saved_pages: [], saved_pages: [],
items: [], items: [],
@ -344,6 +352,7 @@ export type User = {
append_to_bottom: boolean, append_to_bottom: boolean,
insert_next_to_item: boolean, insert_next_to_item: boolean,
font_size: number, font_size: number,
font_family: string,
saved_pages: SavedPage[], saved_pages: SavedPage[],
verses_on_new_line: boolean, verses_on_new_line: boolean,
show_verse_numbers: boolean, show_verse_numbers: boolean,