Merge pull request #49 from itzMiney/development
refactor to define helper service more accurately
This commit is contained in:
28 files changed
+78
-403
No files matched your search
@@ -1,323 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:D="DAV:" exclude-result-prefixes="D">
|
||||
<xsl:output method="html" encoding="UTF-8" />
|
||||
|
||||
<xsl:template match="D:multistatus">
|
||||
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="utf-8" ?></xsl:text>
|
||||
<D:multistatus xmlns:D="DAV:">
|
||||
<xsl:copy-of select="*"/>
|
||||
</D:multistatus>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/list">
|
||||
<xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://kit.fontawesome.com/55eb9c16a8.js"></script>
|
||||
<script type="text/javascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', function(){
|
||||
|
||||
function calculateSize(size)
|
||||
{
|
||||
var sufixes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var output = size;
|
||||
var q = 0;
|
||||
|
||||
while (size / 1024 > 1)
|
||||
{
|
||||
size = size / 1024;
|
||||
q++;
|
||||
}
|
||||
|
||||
return (Math.round(size * 100) / 100) + ' ' + sufixes[q];
|
||||
}
|
||||
|
||||
if (window.location.pathname == '/')
|
||||
{
|
||||
document.querySelector('.directory.go-up').style.display = 'none';
|
||||
}
|
||||
|
||||
var path = window.location.pathname.split('/');
|
||||
var nav = document.querySelector("nav#breadcrumbs ul");
|
||||
var pathSoFar = '';
|
||||
|
||||
for (var i=1; i<path.length-1; i++)
|
||||
{
|
||||
pathSoFar += '/' + decodeURI(path[i]);
|
||||
nav.innerHTML += '<li><a href="' + encodeURI(pathSoFar) + '">' + decodeURI(path[i]) + '</a></li>';
|
||||
}
|
||||
|
||||
var mtimes = document.querySelectorAll("table#contents td.mtime a");
|
||||
|
||||
for (var i=0; i<mtimes.length; i++)
|
||||
{
|
||||
var mtime = mtimes[i].textContent;
|
||||
if (mtime)
|
||||
{
|
||||
var d = new Date(mtime);
|
||||
mtimes[i].textContent = d.toLocaleString();
|
||||
}
|
||||
}
|
||||
|
||||
var sizes = document.querySelectorAll("table#contents td.size a");
|
||||
|
||||
for (var i=0; i<sizes.length; i++)
|
||||
{
|
||||
var size = sizes[i].textContent;
|
||||
if (size)
|
||||
{
|
||||
sizes[i].textContent = calculateSize(parseInt(size));
|
||||
}
|
||||
}
|
||||
|
||||
}, false);
|
||||
]]></script>
|
||||
|
||||
<script type="text/javascript"><![CDATA[
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', document.location, true);
|
||||
xhr.send(null);
|
||||
|
||||
xhr.addEventListener('readystatechange', function(e) {
|
||||
if (xhr.readyState == 4) {
|
||||
var headers = parseHttpHeaders(xhr.getAllResponseHeaders().toLowerCase());
|
||||
|
||||
if (!headers.hasOwnProperty('x-options')){
|
||||
document.body.classList.add('nowebdav');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var dropArea = document.getElementById('droparea');
|
||||
var progressWin = document.getElementById('progresswin');
|
||||
var progressBar = document.getElementById('progressbar');
|
||||
var progressTrack = [];
|
||||
var totalFiles = 0;
|
||||
|
||||
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
||||
dropArea.addEventListener(eventName, function (e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}, false);
|
||||
});
|
||||
|
||||
['dragenter', 'dragover'].forEach(eventName => {
|
||||
dropArea.addEventListener(eventName, function(e) {
|
||||
dropArea.classList.add('highlight');
|
||||
}, false);
|
||||
});
|
||||
|
||||
['dragleave', 'drop'].forEach(eventName => {
|
||||
dropArea.addEventListener(eventName, function(e) {
|
||||
dropArea.classList.remove('highlight')
|
||||
}, false);
|
||||
});
|
||||
|
||||
document.querySelectorAll('table#contents tr td.actions ul li a[data-action]').forEach(el => {
|
||||
el.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var source = event.target || event.srcElement;
|
||||
var action = source.getAttribute('data-action');
|
||||
var href = source.getAttribute('href');
|
||||
|
||||
if (action == 'delete') {
|
||||
deleteFile(href);
|
||||
}
|
||||
|
||||
}, false);
|
||||
});
|
||||
|
||||
dropArea.addEventListener('drop', function(e) {
|
||||
var total = 0;
|
||||
|
||||
for (var i=0; i<e.dataTransfer.files.length; i++) {
|
||||
var file = e.dataTransfer.files[i];
|
||||
progressTrack[i] = { current: 0, max: file.size };
|
||||
total += file.size;
|
||||
totalFiles++;
|
||||
uploadFile(file, i);
|
||||
}
|
||||
|
||||
progressBar.value = 0;
|
||||
progressBar.max = total;
|
||||
progressWin.classList.add('show');
|
||||
}, false);
|
||||
|
||||
function updateProgress(value, idx) {
|
||||
progressTrack[idx].value = value;
|
||||
|
||||
var current = 0;
|
||||
for (var i=0; i<progressTrack.length; i++) {
|
||||
current += progressTrack[i].value;
|
||||
}
|
||||
|
||||
progressBar.value = current || progressBar.value;
|
||||
}
|
||||
|
||||
function uploadFile(file, idx) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var formData = new FormData();
|
||||
|
||||
xhr.open('PUT', document.location.href + '/' + file.name, true);
|
||||
xhr.upload.addEventListener("progress", function(e) {
|
||||
updateProgress(e.loaded, idx);
|
||||
});
|
||||
|
||||
xhr.addEventListener('readystatechange', function(e) {
|
||||
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 201 || xhr.status == 204)) {
|
||||
totalFiles--;
|
||||
} else if (xhr.readyState == 4) {
|
||||
alert (xhr.statusText);
|
||||
console.log(xhr);
|
||||
totalFiles--;
|
||||
}
|
||||
|
||||
if (totalFiles == 0) {
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
|
||||
xhr.send(file);
|
||||
}
|
||||
|
||||
function deleteFile(path) {
|
||||
if (confirm('Are you sure you want to delete [' + path + ']?')) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('DELETE', document.location.href + '/' + path, true);
|
||||
xhr.send();
|
||||
xhr.addEventListener('readystatechange', function(e) {
|
||||
|
||||
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 201 || xhr.status == 204)) {
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function parseHttpHeaders(httpHeaders) {
|
||||
return httpHeaders.split("\n").map(x=>x.split(/: */,2)).filter(x=>x[0]).reduce((ac, x)=>{ac[x[0]] = x[1];return ac;}, {});
|
||||
}
|
||||
});
|
||||
]]></script>
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
* { box-sizing: border-box; }
|
||||
html { margin: 0px; padding: 0px; height: 100%; width: 100%; }
|
||||
body { background-color: #303030; font-family: Verdana, Geneva, sans-serif; font-size: 14px; padding: 20px; margin: 0px; height: 100%; width: 100%; }
|
||||
|
||||
table#contents td a { text-decoration: none; display: block; padding: 10px 30px 10px 30px; pointer: default; }
|
||||
table#contents { width: 50%; margin-left: auto; margin-right: auto; border-collapse: collapse; border-width: 0px; }
|
||||
table#contents td { padding: 0px; word-wrap: none; white-space: nowrap; }
|
||||
table#contents td.icon, table td.size, table td.mtime, table td.actions { width: 1px; white-space: nowrap; }
|
||||
table#contents td.icon a { padding-left: 0px; padding-right: 5px; }
|
||||
table#contents td.name a { padding-left: 5px; }
|
||||
table#contents td.size a { color: #9e9e9e }
|
||||
table#contents td.mtime a { padding-right: 0px; color: #9e9e9e }
|
||||
table#contents tr * { color: #efefef; }
|
||||
table#contents tr:hover * { color: #c1c1c1 !important; }
|
||||
table#contents tr.directory td.icon i { color: #FBDD7C !important; }
|
||||
table#contents tr.directory.go-up td.icon i { color: #BF8EF3 !important; }
|
||||
table#contents tr.separator td { padding: 10px 30px 10px 30px }
|
||||
table#contents tr.separator td hr { display: none; }
|
||||
table#contents tr td.actions ul { list-style-type: none; margin: 0px; padding: 0px; visibility: hidden; }
|
||||
table#contents tr td.actions ul li { float: left; }
|
||||
table#contents tr:hover td.actions ul { visibility: visible; }
|
||||
table#contents tr td.actions ul li a { display: inline; padding: 10px 10px 10px 10px !important; }
|
||||
table#contents tr td.actions ul li a:hover[data-action='delete'] { color: #c90000 !important; }
|
||||
body.nowebdav table#contents tr td.actions ul { display: none !important; }
|
||||
|
||||
nav#breadcrumbs { margin-bottom: 50px; display: flex; justify-content: center; align-items: center; }
|
||||
nav#breadcrumbs ul { list-style: none; display: inline-block; margin: 0px; padding: 0px; }
|
||||
nav#breadcrumbs ul .icon { font-size: 14px; }
|
||||
nav#breadcrumbs ul li { float: left; }
|
||||
nav#breadcrumbs ul li a { color: #FFF; display: block; background: #515151; text-decoration: none; position: relative; height: 40px; line-height: 40px; padding: 0 10px 0 5px; text-align: center; margin-right: 23px; }
|
||||
nav#breadcrumbs ul li:nth-child(even) a { background-color: #525252; }
|
||||
nav#breadcrumbs ul li:nth-child(even) a:before { border-color: #525252; border-left-color: transparent; }
|
||||
nav#breadcrumbs ul li:nth-child(even) a:after { border-left-color: #525252; }
|
||||
nav#breadcrumbs ul li:first-child a { padding-left: 15px; -moz-border-radius: 4px 0 0 4px; -webkit-border-radius: 4px; border-radius: 4px 0 0 4px; }
|
||||
nav#breadcrumbs ul li:first-child a:before { border: none; }
|
||||
nav#breadcrumbs ul li:last-child a { padding-right: 15px; -moz-border-radius: 0 4px 4px 0; -webkit-border-radius: 0; border-radius: 0 4px 4px 0; }
|
||||
nav#breadcrumbs ul li:last-child a:after { border: none; }
|
||||
nav#breadcrumbs ul li a:before, nav#breadcrumbs ul li a:after { content: ""; position: absolute; top: 0; border: 0 solid #515151; border-width: 20px 10px; width: 0; height: 0; }
|
||||
nav#breadcrumbs ul li a:before { left: -20px; border-left-color: transparent; }
|
||||
nav#breadcrumbs ul li a:after { left: 100%; border-color: transparent; border-left-color: #515151; }
|
||||
nav#breadcrumbs ul li a:hover { background-color: #6320aa; }
|
||||
nav#breadcrumbs ul li a:hover:before { border-color: #6320aa; border-left-color: transparent; }
|
||||
nav#breadcrumbs ul li a:hover:after { border-left-color: #6320aa; }
|
||||
nav#breadcrumbs ul li a:active { background-color: #330860; }
|
||||
nav#breadcrumbs ul li a:active:before { border-color: #330860; border-left-color: transparent; }
|
||||
nav#breadcrumbs ul li a:active:after { border-left-color: #330860; }
|
||||
|
||||
div#droparea { height: 100%; width: 100%; border: 5px solid transparent; padding: 10px; }
|
||||
div#droparea.highlight { border: 5px dashed #CACACA; }
|
||||
|
||||
div#progresswin { position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 10000; justify-content: center; align-items: center; display: none; }
|
||||
div#progresswin.show { display: flex !important; }
|
||||
div#progresswin progress#progressbar { width: 25%; }
|
||||
]]></style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="progresswin">
|
||||
<progress id="progressbar"></progress>
|
||||
</div>
|
||||
<div id="droparea">
|
||||
<nav id="breadcrumbs"><ul><li><a href="/"><i class="fa fa-home"></i></a></li></ul></nav>
|
||||
<table id="contents">
|
||||
<tbody>
|
||||
<tr class="directory go-up">
|
||||
<td class="icon"><a href="../"><i class="fa fa-arrow-up"></i></a></td>
|
||||
<td class="name"><a href="../">..</a></td>
|
||||
<td class="size"><a href="../"></a></td>
|
||||
<td class="mtime"><a href="../"></a></td>
|
||||
<td class="actions"><a href="../"></a></td>
|
||||
</tr>
|
||||
|
||||
<xsl:if test="count(directory) != 0">
|
||||
<tr class="separator directories">
|
||||
<td colspan="4"><hr/></td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:for-each select="directory">
|
||||
<tr class="directory">
|
||||
<td class="icon"><a href="{.}/"><i class="fa fa-folder"></i></a></td>
|
||||
<td class="name"><a href="{.}/"><xsl:value-of select="." /></a></td>
|
||||
<td class="size"><a href="{.}/"></a></td>
|
||||
<td class="mtime"><a href="{.}/"><xsl:value-of select="./@mtime" /></a></td>
|
||||
<td class="actions"><a href="{.}/"></a></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:if test="count(file) != 0">
|
||||
<tr class="separator files">
|
||||
<td colspan="4"><hr/></td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:for-each select="file">
|
||||
<tr class="file">
|
||||
<td class="icon"><a href="{.}" download="{.}"><i class="fa fa-file"></i></a></td>
|
||||
<td class="name"><a href="{.}" download="{.}"><xsl:value-of select="." /></a></td>
|
||||
<td class="size"><a href="{.}" download="{.}"><xsl:value-of select="./@size" /></a></td>
|
||||
<td class="mtime"><a href="{.}" download="{.}"><xsl:value-of select="./@mtime" /></a></td>
|
||||
<td class="actions">
|
||||
<ul>
|
||||
<li><a href="{.}" data-action="delete" class="fa fa-trash"></a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -7,7 +7,7 @@
|
||||
</app-parallax>
|
||||
<div class="landing-container">
|
||||
<div class="title-box">
|
||||
<h1 [ngStyle]="{'font-size': isMobile ? '4rem' : '5rem'}"><code>itzMiney</code></h1>
|
||||
<h1 [ngStyle]="{'font-size': isNarrow ? '4rem' : '5rem'}"><code>itzMiney</code></h1>
|
||||
<p class="subtitle">{{ 'ABOUT_SUB' | translate}}</p>
|
||||
</div>
|
||||
<div class="down-arrow" (click)="scrollDown()">
|
||||
@@ -17,11 +17,11 @@
|
||||
<div class="separator"></div>
|
||||
<section id="content" #contentTrigger></section>
|
||||
<div class="about-container">
|
||||
<div class="terminal" [ngStyle]="{'margin': isMobile ? '10px;' : '25px'}">
|
||||
<div class="terminal" [ngStyle]="{'margin': isNarrow ? '10px;' : '25px'}">
|
||||
<div class="titlebar">
|
||||
<div class="window-title"><p><code>Konsole</code></p></div> <div class="window-actions"><p>🟡 🟣 🔴</p></div>
|
||||
</div>
|
||||
<div class="terminal-window" [ngStyle]="{'width': isMobile ? '100%' : '900px' }">
|
||||
<div class="terminal-window" [ngStyle]="{'width': isNarrow ? '100%' : '900px' }">
|
||||
<app-terminal-emulator [bootOnVisible]="terminalShouldBoot"></app-terminal-emulator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {AfterViewInit, Component, ElementRef, HostListener, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
@@ -21,20 +21,20 @@ import {TerminalEmulatorComponent} from '../shared/terminal-emulator/terminal-em
|
||||
styleUrls: ['./about.component.css']
|
||||
})
|
||||
export class AboutComponent implements OnInit, AfterViewInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
terminalShouldBoot: boolean = false;
|
||||
|
||||
@ViewChild('contentTrigger') contentTrigger!: ElementRef;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('itzMiney\'s Home');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div id="admin-bg">
|
||||
<div class="height-container">
|
||||
<!-- Left Section: Edit/Delete Article -->
|
||||
@if (!isMobile) {
|
||||
@if (!isNarrow) {
|
||||
<div class="left-section">
|
||||
<div class="delete-article-tile">
|
||||
<h2>Delete Article</h2>
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
}
|
||||
<!-- Center Section: Admin Dashboard and Create Article Tiles -->
|
||||
<div class="center-section" [ngStyle]="{'width': isMobile ? '100%' : '33.33%'}">
|
||||
<div class="center-section" [ngStyle]="{'width': isNarrow ? '100%' : '33.33%'}">
|
||||
<div class="admin-dashboard-tile">
|
||||
<h2>Admin Dashboard</h2>
|
||||
<div class="admin-actions">
|
||||
@@ -73,7 +73,7 @@
|
||||
<button type="submit" [disabled]="createForm.invalid">Create Article</button>
|
||||
</form>
|
||||
</div>
|
||||
@if (isMobile) {
|
||||
@if (isNarrow) {
|
||||
<div class="delete-article-tile">
|
||||
<h2>Delete Article</h2>
|
||||
<form #deleteFormMobile="ngForm" id="deleteFormMobile" (ngSubmit)="deleteArticle(deleteFormMobile)">
|
||||
@@ -143,7 +143,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Right Section: Articles List Tile -->
|
||||
@if (!isMobile) {
|
||||
@if (!isNarrow) {
|
||||
<div class="right-section">
|
||||
<div class="articles-list-tile">
|
||||
<h2>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {UserService} from '../shared/services/user.service';
|
||||
import { NgStyle } from '@angular/common';
|
||||
import {Observer, Subscription, interval} from 'rxjs';
|
||||
import {FormsModule, NgForm} from '@angular/forms';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ModalComponent} from '../shared/modal/modal.component';
|
||||
import {AuthService} from '../shared/services/auth.service';
|
||||
@@ -27,7 +27,7 @@ export class AdminComponent implements OnInit, OnDestroy {
|
||||
users: any[] = [];
|
||||
noArticles: boolean = false;
|
||||
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
|
||||
title: string = '';
|
||||
content: string = '';
|
||||
@@ -47,14 +47,14 @@ export class AdminComponent implements OnInit, OnDestroy {
|
||||
private articleService: ArticleService,
|
||||
private userService: UserService,
|
||||
private router: Router,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title,
|
||||
protected authService: AuthService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Admin Panel | itzMiney')
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
this.authService.validateToken().subscribe();
|
||||
this.startTokenValidation();
|
||||
this.loadArticles();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@if (!isMobile) {
|
||||
@if (!isNarrow) {
|
||||
@if (showNavbar) {
|
||||
<app-navbar ></app-navbar>
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {ActivatedRoute, Router, RouterOutlet} from '@angular/router';
|
||||
import {NavbarComponent} from './shared/navbar/navbar.component';
|
||||
import {MobileNavbarComponent} from './shared/mobile-navbar/mobile-navbar.component';
|
||||
import {FooterComponent} from './shared/footer/footer.component';
|
||||
import {DeviceDetectorService} from './shared/services/device-detector.service';
|
||||
import {ViewportService} from './shared/services/viewport.service';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
@@ -14,14 +14,14 @@ import {TranslateService} from '@ngx-translate/core';
|
||||
styleUrl: './app.component.css',
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
showNavbar: boolean = true;
|
||||
showFooter: boolean = true;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private translate: TranslateService,
|
||||
) {
|
||||
this.translate.setDefaultLang('en');
|
||||
@@ -30,7 +30,7 @@ export class AppComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.router.events.subscribe(() => this.checkRoute())
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
checkRoute() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {ApplicationConfig, importProvidersFrom, provideZoneChangeDetection} from '@angular/core';
|
||||
import {provideRouter, withInMemoryScrolling, withViewTransitions} from '@angular/router';
|
||||
import {routes} from './app.routes';
|
||||
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
|
||||
import {provideClientHydration, withEventReplay} from '@angular/platform-browser';
|
||||
import {HttpClient, provideHttpClient} from '@angular/common/http';
|
||||
import {AuthService} from './shared/services/auth.service';
|
||||
@@ -23,7 +22,6 @@ export const appConfig: ApplicationConfig = {
|
||||
anchorScrolling: 'enabled'
|
||||
})
|
||||
),
|
||||
provideAnimationsAsync(),
|
||||
provideClientHydration(withEventReplay()),
|
||||
provideHttpClient(),
|
||||
AuthService,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
">
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="blog-header" [ngStyle]="{'margin-top': isMobile ? '72px' : '112px'}">
|
||||
<div class="blog-header" [ngStyle]="{'margin-top': isNarrow ? '72px' : '112px'}">
|
||||
<h1>Blog</h1>
|
||||
<p class="subtitle">{{ 'BLOG_SUB' | translate }}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service'
|
||||
import {ViewportService} from '../shared/services/viewport.service'
|
||||
import { DatePipe, AsyncPipe, SlicePipe, NgStyle } from '@angular/common';
|
||||
import { ArticleService } from '../shared/services/article.service';
|
||||
import { Router } from '@angular/router';
|
||||
@@ -23,9 +23,9 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
})
|
||||
export class BlogComponent implements OnInit {
|
||||
articles$: Observable<any[]> | undefined;
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private articleService: ArticleService,
|
||||
private router: Router,
|
||||
private titleService: Title
|
||||
@@ -33,7 +33,7 @@ export class BlogComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Blog | itzMiney')
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
this.articles$ = this.articleService.getAllArticles();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Component, Inject, OnInit, PLATFORM_ID} from '@angular/core';
|
||||
import {AuthService} from '../shared/services/auth.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { take } from 'rxjs/operators';
|
||||
import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
@@ -25,21 +25,21 @@ export class LoginComponent implements OnInit {
|
||||
'/admin',
|
||||
'/shortener'
|
||||
]);
|
||||
isMobile = false;
|
||||
isNarrow = false;
|
||||
redirectUrl = '/admin';
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title,
|
||||
@Inject(PLATFORM_ID) private platformId: Object
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Login | itzMiney')
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
|
||||
this.route.queryParams.pipe(take(1)).subscribe(params => {
|
||||
const raw = params['redirectUrl'];
|
||||
|
||||
@@ -12,7 +12,7 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
})
|
||||
|
||||
export class NotFoundComponent implements OnInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
constructor(
|
||||
private titleService: Title,
|
||||
) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="portfolio-container">
|
||||
<div class="portfolio-header" [ngStyle]="{'margin-top': isMobile ? '60px' : '120px'}">
|
||||
<div class="portfolio-header" [ngStyle]="{'margin-top': isNarrow ? '60px' : '120px'}">
|
||||
<h1>{{ 'PORTF_TITLE' | translate }}</h1>
|
||||
<p class="subtitle">{{ 'PORTF_SUB' | translate }}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import { CommonModule, NgStyle } from '@angular/common';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {AudioPlayerComponent} from '../shared/audio-player/audio-player.component';
|
||||
@@ -33,15 +33,15 @@ export class PortfolioComponent implements OnInit {
|
||||
];
|
||||
selectedItem: any = null;
|
||||
showModal = false;
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Portfolio | itzMiney');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
openModal(item: any) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="privacy-container">
|
||||
<div class="floating-nav" [class.hidden]="isMobile">
|
||||
<div class="floating-nav" [class.hidden]="isNarrow">
|
||||
<ul>
|
||||
<li><a href="#controller" [class.active]="activeSection === 'controller'" (click)="scrollToSection($event, 'controller')">{{ 'privacy.nav.controller' | translate }}</a></li>
|
||||
<li><a href="#what-data" [class.active]="activeSection === 'whatData'" (click)="scrollToSection($event, 'what-data')">{{ 'privacy.nav.whatData' | translate }}</a></li>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {AfterViewInit, Component, OnInit} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
@@ -15,12 +15,12 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
})
|
||||
|
||||
export class PrivacyComponent implements OnInit, AfterViewInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
activeSection: string = '';
|
||||
copiedSection: string | null = null;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title,
|
||||
) {}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class PrivacyComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Privacy Policy | itzMiney');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="services-container">
|
||||
<div class="services-header" [ngStyle]="{'margin-top': isMobile ? '60px' : '120px'}">
|
||||
<div class="services-header" [ngStyle]="{'margin-top': isNarrow ? '60px' : '120px'}">
|
||||
<h1>{{ 'SERVS_TITLE' | translate}}</h1>
|
||||
<p class="subtitle">Web Development & Design</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {NgIf, NgFor, NgStyle} from '@angular/common';
|
||||
import {TranslatePipe, TranslateService} from '@ngx-translate/core';
|
||||
@@ -21,7 +21,7 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
|
||||
export class ServicesComponent implements OnInit {
|
||||
private apiUrl = '/api/stripe/create-checkout-session';
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
activeTab: string[] = [];
|
||||
|
||||
services: {
|
||||
@@ -33,7 +33,7 @@ export class ServicesComponent implements OnInit {
|
||||
}[] = [];
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title,
|
||||
private translate: TranslateService,
|
||||
private http: HttpClient
|
||||
@@ -45,7 +45,7 @@ export class ServicesComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Services | itzMiney');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
this.loadServices();
|
||||
this.translate.onLangChange.subscribe(() => this.loadServices());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="audio-player" [ngClass]="{ mobile: isMobile }">
|
||||
<div class="audio-player" [ngClass]="{ mobile: isNarrow }">
|
||||
<div id="youtube-player"></div>
|
||||
<h3>{{ nowPlayingTitle() }}</h3>
|
||||
<div class="controls">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, AfterViewInit, signal, OnInit} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {ViewportService} from '../services/viewport.service';
|
||||
import {NgClass} from '@angular/common';
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ declare global {
|
||||
styleUrl: './audio-player.component.css'
|
||||
})
|
||||
export class AudioPlayerComponent implements AfterViewInit, OnInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
private player: any;
|
||||
|
||||
isPlayerReady = signal(false);
|
||||
isPlaying = signal(false);
|
||||
nowPlayingTitle = signal<string>('');
|
||||
|
||||
constructor(private deviceService: DeviceDetectorService) {}
|
||||
constructor(private deviceService: ViewportService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {ViewportService} from '../services/viewport.service';
|
||||
|
||||
import {NavigationEnd, Router, RouterLink} from '@angular/router';
|
||||
import {TranslatePipe, TranslateService} from '@ngx-translate/core';
|
||||
@@ -17,15 +17,15 @@ import {TranslatePipe, TranslateService} from '@ngx-translate/core';
|
||||
export class MobileNavbarComponent implements OnInit{
|
||||
currentLang: string;
|
||||
menuOpen = false;
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
activeLink: string = '';
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
this.currentLang = this.translate.currentLang || this.translate.getDefaultLang() || 'en';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {NavigationEnd, Router, RouterLink} from '@angular/router';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {ViewportService} from '../services/viewport.service';
|
||||
import {filter} from 'rxjs/operators';
|
||||
import {TranslatePipe, TranslateService} from '@ngx-translate/core';
|
||||
|
||||
@@ -16,14 +16,14 @@ import {TranslatePipe, TranslateService} from '@ngx-translate/core';
|
||||
export class NavbarComponent implements OnInit {
|
||||
currentLang: string;
|
||||
activeLink: string = '';
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private translate: TranslateService
|
||||
) {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
this.currentLang = this.translate.currentLang || this.translate.getDefaultLang() || 'en';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, PLATFORM_ID, ViewChild, Input} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {ViewportService} from '../services/viewport.service';
|
||||
import {isPlatformBrowser} from '@angular/common';
|
||||
import Parallax from 'parallax-js';
|
||||
|
||||
@@ -16,17 +16,17 @@ export class ParallaxComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
@Input() bgGradient: string =
|
||||
'radial-gradient(circle 120vw at center, rgba(90,78,130,0.32), transparent 40%), linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%)';
|
||||
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
private parallaxInstance: Parallax | null = null;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
@Inject(PLATFORM_ID) private platformId: Object
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -39,8 +39,8 @@ export class ParallaxComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
clipRelativeInput: true,
|
||||
calibrateX: true,
|
||||
calibrateY: true,
|
||||
scalarX: this.isMobile ? 6 : 12,
|
||||
scalarY: this.isMobile ? 6 : 12,
|
||||
scalarX: this.isNarrow ? 6 : 12,
|
||||
scalarY: this.isNarrow ? 6 : 12,
|
||||
frictionX: 0.1,
|
||||
frictionY: 0.1,
|
||||
});
|
||||
|
||||
+4
-4
@@ -4,8 +4,8 @@ import {isPlatformBrowser} from '@angular/common';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DeviceDetectorService {
|
||||
isMobile: boolean = false;
|
||||
export class ViewportService {
|
||||
isNarrow: boolean = false;
|
||||
|
||||
constructor(@Inject(PLATFORM_ID) private platformId: Object) {
|
||||
this.updateDeviceType();
|
||||
@@ -16,9 +16,9 @@ export class DeviceDetectorService {
|
||||
|
||||
private updateDeviceType() {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
this.isMobile = window.innerWidth <= 768;
|
||||
this.isNarrow = window.innerWidth <= 768;
|
||||
} else {
|
||||
this.isMobile = false;
|
||||
this.isNarrow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="socials-container">
|
||||
<div class="socials-header" [ngStyle]="{'margin-top': isMobile ? '80px' : '120px'}">
|
||||
<div class="socials-header" [ngStyle]="{'margin-top': isNarrow ? '80px' : '120px'}">
|
||||
<h1>Socials</h1>
|
||||
<p class="subtitle">{{ 'SOCIALS_SUB' | translate }}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {NgStyle} from '@angular/common';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
@@ -16,14 +16,14 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
styleUrl: './socials.component.css'
|
||||
})
|
||||
export class SocialsComponent implements OnInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Socials | itzMiney');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
</app-parallax>
|
||||
<div class="height-container">
|
||||
<div class="tos-container">
|
||||
<div class="floating-nav" [class.hidden]="isMobile">
|
||||
<div class="floating-nav" [class.hidden]="isNarrow">
|
||||
<ul>
|
||||
<li><a href="#introduction" [class.active]="activeSection === 'introduction'" (click)="scrollToSection($event, 'introduction')">{{ 'termsOfService.sections.introduction.title' | translate }}</a></li>
|
||||
<li><a href="#services-provided" [class.active]="activeSection === 'services-provided'" (click)="scrollToSection($event, 'services-provided')">{{ 'termsOfService.sections.servicesProvided.title' | translate }}</a></li>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {AfterViewInit, Component, OnInit,} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {ViewportService} from '../shared/services/viewport.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
@@ -17,12 +17,12 @@ import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
})
|
||||
|
||||
export class TosComponent implements OnInit, AfterViewInit {
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
activeSection: string = '';
|
||||
copiedSection: string | null = null;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
private titleService: Title
|
||||
) {}
|
||||
|
||||
@@ -41,7 +41,7 @@ export class TosComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Terms of Service | itzMiney');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
Reference in new issue
Block a user