Skip to content

Commit 9a0a7f2

Browse files
committed
Simplified p-dialog sizing, and fixed sizing problem for dialogs on iPhone. Turned of autocorrect, autocapitalize, and autocomplete in search field Find dialog. Fixed small Firefox Find dialog layout problem. Improved testing with browser-sync. Fixed canvas sizing problem with Edge browser for clock and other digit-sequence editors. Blocked access by pre-ES6 web browsers. Fixed formatting of LICENSE.md. Fixed build script problem.
1 parent 91fd7c6 commit 9a0a7f2

21 files changed

Lines changed: 146 additions & 41 deletions

LICENSE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ END OF TERMS AND CONDITIONS
637637

638638
### Licensing and Copyright for Third Party Software Used by Sky View Café
639639

640-
#####Via `license-report --output=table`
640+
##### Via `license-report --output=table`
641+
641642
name license type link
642643
---- ------------ ----
643644
animations n/a n/a

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svc-ng",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"license": "MIT AND GPL-3.0-or-later",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {
@@ -9,8 +9,7 @@
99
"build": "ng build --prod",
1010
"test": "ng test",
1111
"lint": "ng lint",
12-
"e2e": "ng e2e",
13-
"postinstall": "bash ./dev-tools/patch-ngprime-for-ivy.sh && ivy-ngcc"
12+
"e2e": "ng e2e"
1413
},
1514
"private": true,
1615
"dependencies": {
@@ -31,7 +30,7 @@
3130
"ks-astronomy": "^1.0.5",
3231
"ks-date-time-zone": "^1.6.1",
3332
"ks-math": "^1.1.6",
34-
"ks-util": "^1.4.3",
33+
"ks-util": "^1.5.1",
3534
"lodash": "^4.17.11",
3635
"ng-busy": "^7.0.0",
3736
"primeicons": "^1.0.0",

patch-ngprime-for-ivy.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/app/app.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<p-dialog [(visible)]="displayAbout" class="about-dialog">
1+
<p-dialog [(visible)]="displayAbout" class="about-dialog" [modal]="true" [dismissableMask]=true
2+
[style]="{'max-width': '300px'}">
23
<div class="about-dialog">
34
<img src="/assets/resources/svc_lunar_eclipse.png" alt="lunar eclipse" width="64" height="64">
45
<h2>Sky View Café NP</h2>
5-
Version 1.7.0<br><br>
6+
Version 1.7.1<br><br>
67
Copyright © 2016-2019 Kerry Shetline.
78
</div>
89
</p-dialog>

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { TooltipModule } from 'primeng/tooltip';
5252
import { AppComponent } from './app.component';
5353
import { AppService } from './app.service';
5454
import { AstroDataService } from './astronomy/astro-data.service';
55+
import { KsSizerDirective } from './directives/ks-sizer.directive';
5556
import { SvcAngleEditorComponent } from './svc/svc-angle-editor.component';
5657
import { SvcAtlasDialogComponent } from './svc/svc-atlas-dialog/svc-atlas-dialog.component';
5758
import { SvcAtlasService } from './svc/svc-atlas.service';
@@ -164,7 +165,8 @@ export function busyConfigFactory(): BusyConfig {
164165
SvcTableViewOptionsComponent,
165166
SvcTimeEditorComponent,
166167
SvcTimeViewComponent,
167-
SvcZoneSelectorComponent
168+
SvcZoneSelectorComponent,
169+
KsSizerDirective
168170
],
169171
providers: [
170172
AppService,

src/app/app.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ export class AppService {
140140
private _gcDate = '1582-10-15';
141141
private _inkSaver = true;
142142
private hostname: string;
143+
private port: number;
143144

144145
constructor(astroDataService: AstroDataService, private httpClient: HttpClient, private _sanitizer: DomSanitizer,
145146
private router: Router) {
146147
this.hostname = document.location.hostname;
148+
this.port = parseInt(document.location.port, 10);
147149

148150
const savedLocationsString = localStorage.getItem('locations');
149151

@@ -434,7 +436,7 @@ export class AppService {
434436
}
435437

436438
private getLocationFromIp(): void {
437-
const localTesting = (this.hostname === 'localhost' || this.hostname === '127.0.0.1');
439+
const localTesting = (this.hostname === 'localhost' || this.hostname === '127.0.0.1' || this.port === 3000);
438440

439441
if (localTesting) {
440442
this.httpClient.jsonp('https://skyviewcafe.com/ip/json/', 'callback').subscribe((location: IpLocation) => {
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Copyright © 2019 Kerry Shetline, kerry@shetline.com.
3+
4+
This code is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This code is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this code. If not, see <http://www.gnu.org/licenses/>.
16+
17+
For commercial, proprietary, or other uses not compatible with
18+
GPL-3.0-or-later, terms of licensing for this code may be
19+
negotiated by contacting the author, Kerry Shetline, otherwise all
20+
other uses are restricted.
21+
*/
22+
23+
import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
24+
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
25+
import { isIOS, toNumber } from 'ks-util';
26+
import { Dialog } from 'primeng/dialog';
27+
28+
@Directive({
29+
selector: '[ksSizer]'
30+
})
31+
export class KsSizerDirective {
32+
@HostBinding('style') style: string | SafeStyle;
33+
34+
@Input() set ksSizer(size: string) {
35+
let [width, height] = size.split(',').map(s => s.trim());
36+
let iosWidthFix = false;
37+
38+
if (/!$/.test(width)) {
39+
iosWidthFix = true;
40+
width = width.substr(0, width.length - 1);
41+
}
42+
43+
if (toNumber(width) !== 0)
44+
width += 'px';
45+
46+
if (toNumber(height) !== 0)
47+
height += 'px';
48+
49+
if (this.pDialogHost) {
50+
const style: any = {width, height};
51+
52+
if (iosWidthFix && isIOS())
53+
style['max-width'] = width;
54+
55+
this.pDialogHost.style = style;
56+
}
57+
else {
58+
const style = `width: ${width}; height: ${height};`;
59+
this.style = this.sanitizer.bypassSecurityTrustStyle(style);
60+
}
61+
}
62+
63+
constructor(
64+
private sanitizer: DomSanitizer,
65+
private elementRef: ElementRef,
66+
private pDialogHost: Dialog
67+
) { }
68+
}

src/app/svc/milky-way.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class MilkyWay {
6363

6464
if (isNumber(posOrLongitude)) {
6565
longitude = <number> posOrLongitude;
66-
latitude = (latitude ? latitude : 0);
66+
latitude = latitude || 0;
6767
}
6868
else {
6969
longitude = (<SphericalPosition> posOrLongitude).longitude.degrees;

src/app/svc/svc-atlas-dialog/svc-atlas-dialog.component.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p-dialog header="Find Latitude, Longitude, and Time Zone" [modal]="true" [(visible)]="visible" [style]="{width: '795px', height: '500px'}"
1+
<p-dialog header="Find Latitude, Longitude, and Time Zone" [modal]="true" [(visible)]="visible" ksSizer="795!,500"
22
(keyup)="onKey($event)">
33
<p-growl [value]="messages" sticky="true"></p-growl>
44
<div style="position: relative">
@@ -9,7 +9,8 @@
99
</div>
1010
<div class="search-row">
1111
<input #searchField type="text" pInputText class="city-field" [(ngModel)]="city" [disabled]="searching"
12-
(focus)="searchFocus(true)" (blur)="searchFocus(false)"/>
12+
(focus)="searchFocus(true)" (blur)="searchFocus(false)"
13+
autocorrect="off" autocapitalize="off" autocomplete="off"/>
1314
<ks-dropdown [(ngModel)]="state" [options]="states" [editable]="true" [style]="{width: '19em'}"></ks-dropdown>
1415
<button type="button" pButton icon="fas fa-search" (click)="search()" label="Search" [disabled]="searching || becomingVisible"
1516
(focus)="searchFocus(true)" (blur)="searchFocus(false)"></button>
@@ -21,7 +22,7 @@
2122
</div>
2223
<p-checkbox [(ngModel)]="extended" binary="true" label="Extended search (slower, possibly more matches)"></p-checkbox>
2324
<p-table #locationTable [value]="locations" selectionMode="single" [scrollable]="true" scrollHeight="273px"
24-
sortMode="none" [style]="{width: '446px', height: '306px', 'padding-top': '12px'}"
25+
sortMode="none" [style]="{width: '446px', height: '310px', 'padding-top': '12px'}"
2526
[(selection)]="selection" metaKeySelection="true">
2627
<ng-template pTemplate="colgroup">
2728
<colgroup>

0 commit comments

Comments
 (0)