-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavbar.component.ts
59 lines (52 loc) · 1.65 KB
/
navbar.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Component, OnInit } from '@angular/core';
import { NavbarService } from '../../services/navbar/navbar.service';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
noOpener = true;
scrumTimerWindow = null;
jiraTimerWindow = null;
private windowProps = 'resizable=no,scrollbars,status,top=0,right=0,width=';
private popupWidth = 360;
constructor(
public nav: NavbarService
) {
const hasOpener = window.opener;
let openerMessage = '';
if (hasOpener) {
this.noOpener = false;
openerMessage = 'Not Displaying popout link. already popped out';
this.nav.hide();
} else {
this.noOpener = true;
openerMessage = 'Displaying pop out link';
}
console.info(openerMessage);
}
openScrumTimer() {
const swp = this.windowProps + this.popupWidth + ',height=' + window.screen.availHeight;
this.scrumTimerWindow = window.open(window.location.origin + window.location.pathname + '#/popin', 'TimerWindowName', swp);
}
openJira(): boolean {
const jwp = this.windowProps + (window.screen.availWidth - this.popupWidth - 10) + ',height=' + window.screen.availHeight;
const url = localStorage.getItem('JiraURL');
if (url) {
this.jiraTimerWindow = window.open(url, 'StoryWindowName', jwp);
return true;
} else {
console.warn('no JiraURL in localStorage');
return false;
}
}
openWindows() {
console.debug('Opening windows');
this.openJira();
this.openScrumTimer();
}
ngOnInit() {
console.log('[Scrumtimer] Navbar init');
}
}