Files
psp_panel/src/app/app.config.component.ts
T

61 lines
1.6 KiB
TypeScript
Raw Normal View History

2021-12-29 09:28:51 +03:00
import { Component, OnInit } from '@angular/core';
import { AppComponent } from './app.component';
import { AppMainComponent } from './app.main.component';
2021-12-09 17:24:42 +03:00
@Component({
selector: 'app-config',
templateUrl:'./app.config.component.html'
})
2022-01-07 12:28:15 +03:00
export class AppConfigComponent {
2021-12-09 17:24:42 +03:00
2022-01-07 12:28:15 +03:00
scale: number = 14;
2021-12-09 17:24:42 +03:00
2022-01-07 12:28:15 +03:00
scales: any[] = [12,13,14,15,16];
2021-12-09 17:24:42 +03:00
2022-01-07 12:28:15 +03:00
constructor(public app: AppComponent, public appMain: AppMainComponent) { }
2021-12-09 17:24:42 +03:00
replaceLink(linkElement, href) {
if (this.isIE()) {
linkElement.setAttribute('href', href);
}
else {
const id = linkElement.getAttribute('id');
const cloneLinkElement = linkElement.cloneNode(true);
cloneLinkElement.setAttribute('href', href);
cloneLinkElement.setAttribute('id', id + '-clone');
linkElement.parentNode.insertBefore(cloneLinkElement, linkElement.nextSibling);
cloneLinkElement.addEventListener('load', () => {
linkElement.remove();
cloneLinkElement.setAttribute('id', id);
});
}
}
isIE() {
return /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent);
}
onConfigButtonClick(event) {
this.appMain.configActive = !this.appMain.configActive;
this.appMain.configClick = true;
event.preventDefault();
}
incrementScale(){
this.scale++;
this.applyScale();
}
decrementScale(){
this.scale--;
this.applyScale();
}
applyScale(){
document.documentElement.style.fontSize = this.scale + 'px';
}
}