Skip to content

Commit

Permalink
Přidán základní prohlížeč
Browse files Browse the repository at this point in the history
  • Loading branch information
Numax-cz committed Aug 19, 2022
1 parent 34a31ff commit 6f8b1c4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/app/Sys/Systems/NapicuOS/Apps/browser/browser.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<p>browser works!</p>
<section class="WindowContent ConsoleThemeFeraDark BackgroundColor BrowserView">
<div>
<input #input class="NapicuOSSimpleInput" [ngModel]="iframePath" (keydown.enter)="goToPage(input.value)">
</div>


<div class="BrowserIframe">
<iframe [src]="iframePath | safe" title="Preview" ></iframe>
</div>

</section>
20 changes: 20 additions & 0 deletions src/app/Sys/Systems/NapicuOS/Apps/browser/browser.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.BackgroundColor {
background-color: var(--NapicuClassicDark2);
}

.BrowserView{
display: flex;
flex-direction: column;
}

.BrowserIframe{
width: 100%;
height: 100%;
iframe{
width: 100%;
height: 100%;
border: none;
outline: none;
}

}
22 changes: 21 additions & 1 deletion src/app/Sys/Systems/NapicuOS/Apps/browser/browser.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit, Pipe, PipeTransform} from '@angular/core';
import {DomSanitizer} from "@angular/platform-browser";
import {UrlChecker} from "../../scripts/UrlChecker";

@Pipe({ name: 'safe' })
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) { }
transform(url: string) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}

@Component({
selector: 'app-browser',
Expand All @@ -7,9 +17,19 @@ import { Component, OnInit } from '@angular/core';
})
export class BrowserComponent implements OnInit {

public iframePath: string = "https://google.com";
public pageHistory: string[] = [];

constructor() { }

ngOnInit(): void {
}


public goToPage(url: string): void {
let u = UrlChecker(url);
this.pageHistory.push(u);
this.iframePath = u;
}

}
5 changes: 3 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
import {CounterInputComponent} from './Sys/Systems/NapicuOS/template/counter-input/counter-input.component';
import { AppWindowComponent } from './Sys/Systems/NapicuOS/template/app-window/app-window.component';
import { CalculatorComponent } from './Sys/Systems/NapicuOS/Apps/calculator/calculator.component';
import { BrowserComponent } from './Sys/Systems/NapicuOS/Apps/browser/browser.component';
import {BrowserComponent, SafePipe} from './Sys/Systems/NapicuOS/Apps/browser/browser.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -102,7 +102,8 @@ import { BrowserComponent } from './Sys/Systems/NapicuOS/Apps/browser/browser.co
CounterInputComponent,
AppWindowComponent,
CalculatorComponent,
BrowserComponent
BrowserComponent,
SafePipe
],
imports: [
BrowserModule,
Expand Down

0 comments on commit 6f8b1c4

Please sign in to comment.