This commit is contained in:
Adam Skotarczak 2025-05-09 00:10:28 +02:00
parent ea006686d4
commit 882703a1e7
17 changed files with 15681 additions and 181 deletions

3
.gitignore vendored
View File

@ -4,7 +4,8 @@ node_modules/
dist/
releases/
tools/
*.min.map
*.*.map
# Logs
logs

17
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
// Diese Erweiterungen werden empfohlen, wenn das Projekt geöffnet wird
"recommendations": [
"dbaeumer.vscode-eslint", // ESLint Linter
"esbenp.prettier-vscode", // Prettier Formatter
"christian-kohler.path-intellisense", // Autovervollständigung für Pfade
"xabikos.javascriptsnippets", // JS-Snippets
"dsznajder.es7-react-js-snippets", // Nützlich für spätere Projekte
"formulahendry.auto-close-tag", // HTML/JSX Support
"formulahendry.auto-rename-tag", // HTML/JSX Support
"ms-vscode.vscode-typescript-next", // Aktuelle TS-Features (optional)
],
// Optional: Erweiterungen, die eher nicht genutzt werden sollten
"unwantedRecommendations": []
}

13
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "open index.html",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/electron/main.js"
}
]
}

14
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "typescript"],
"files.eol": "\n",
"files.exclude": {
"**/node_modules": true
},
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always"
}

View File

@ -1,138 +0,0 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="author" content="Adam Skotarczak">
<title>Avorion distance calculator</title>
<link rel="stylesheet" href="css/main.css" type="text/css">
<!-- Material Design Lite begin -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.orange-deep_orange.min.css" />
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!-- Material Design Lite end -->
<!-- jQuery Einbindung: -->
<script src="libs/jquery-3.7.1.min.js"></script>
<script src="main.js"></script>
$(document).ready(function(){
/* Hier der jQuery-Code */
});
</script>
<!--Hier wird die externe JavaScript-Datei zum berechnen eingebunden -->
<script src="main.js"></script>
</head>
<body onload="start();">
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">&nbsp;</span>
<nav class="mdl-navigation">
<!-- left Menue
<a class="mdl-navigation__link" href="">Link</a>
-->
</nav>
</div>
<main class="mdl-layout__content">
<div class="page-content">
<!-- Your content goes here begin -->
<!-- Numeric Textfield with Floating Label -->
<div class="Titel">
Avorion distance calculator
</div>
<div class="Feldbeschreibung">
Starting coordinates:
</div>
<form action="#" onsubmit="calculate(); return false;">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="koordinateX">
<label class="mdl-textfield__label" for="koordinateX">Koordinate X ...</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="koordinateY">
<label class="mdl-textfield__label" for="koordinateY">Koordinate Y ...</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
<!-- Raised button with ripple -->
<button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">Calculate</button>
</form>
<div style="padding-top: 25px;">
<table class="tabelle-ergebniss">
<tbody>
<tr>
<td>
<div class="Ergebniss">Result:</div>
</td>
<td style="width: 100%;">
<div class="Ergebniss" id="result">
- &nbsp;
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
&nbsp;
</div>
<div>
<!-- Distanztabelle -->
<table class="distanztabelle">
<tbody>
<tr style="background-color:#FFB380;">
<td class="distaceTableColumn">Iron:</td>
<td class="distaceTableColumn">overall</td>
</tr>
<tr style="background-color:#FFFFFF;">
<td class="distaceTableColumn">Titanium:</td>
<td class="distaceTableColumn">from 420 sectors to the center</td>
</tr>
<tr style="background-color:#4DFF4D;">
<td class="distaceTableColumn">Naonit:</td>
<td class="distaceTableColumn">from 360 sectors to the center</td>
</tr>
<tr style="background-color:dodgerblue">
<td class="distaceTableColumn">Trinium:</td>
<td class="distaceTableColumn">from 290 sectors to the center</td>
</tr>
<tr style="background-color:gold;">
<td class="distaceTableColumn">Xanion:</td>
<td class="distaceTableColumn">from 210 sectors to the center</td>
</tr>
<tr style="background-color:coral;">
<td class="distaceTableColumn">Orgonit:</td>
<td class="distaceTableColumn">from 145 sectors to the center</td>
</tr>
<tr style="background-color:#FF2626;">
<td class="distaceTableColumn">Avorion:</td>
<td class="distaceTableColumn">from 75 sectors to the center</td>
</tr>
</tbody>
</table>
</div>
<hr>
<div>
<p class="version" id="version">
</p>
<!-- Your content goes here end -->
</div>
</div>
</main>
</div>
</body>
</html>

View File

@ -1,6 +1,25 @@
# AvorionDistanceCalculator
# **Avorion Distance Calculator 2.0**
![Screenshot](./assets/screenshot.png)
[![GitHub release (latest by semver)](https://img.shields.io/github/v/release/realAscot/AvorionDistanceCalculator?sort=semver)](https://github.com/realAscot/AvorionDistanceCalculator/releases)
![ADC-Logo](./assets/512x512.png)
## Inhalt
- [**Avorion Distance Calculator 2.0**](#avorion-distance-calculator-20)
- [Inhalt](#inhalt)
- [Was ist anders und was neu?](#was-ist-anders-und-was-neu)
- [Installation](#installation)
- [Linux](#linux)
- [Windows](#windows)
- [MAC](#mac)
- [Geplante zukünftige Features](#geplante-zukünftige-features)
---
## Was ist anders und was neu?
---
**HTML/CSS/JavaScript web application**
@ -16,7 +35,17 @@ Nutzt jQuery und Material Design Lite
## Installation
> keine Installation nötig, einfach die [index.html](index.html) im Browser öffnen und loslegen.
> **[PLATZHALTER]**
### Linux
### Windows
### MAC
> - keine Ahnung, habe kein MAC aber wäre an Feedback interessiert!
---
## Geplante zukünftige Features

BIN
assets/512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

View File

@ -1,23 +1,32 @@
require('dotenv').config();
const { app, BrowserWindow } = require('electron');
const path = require('path');
const isDev = process.env.DEBUG === 'true'
function createWindow() {
const mainWindow = new BrowserWindow({
width: 1000,
height: 700,
width: parseInt(process.env.WINDOW_WIDTH || '820'),
height: parseInt(process.env.WINDOW_HEIGHT || '640'),
icon: path.join(__dirname, '../assets/icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
sandbox: false, // Wichtig für Electron 25+
contextIsolation: true,
nodeIntegration: false
}
});
// Lade die HTML-Datei aus dem Web-Verzeichnis
mainWindow.loadFile(path.join(__dirname, '../web/index.html'));
// Optional: DevTools öffnen
// mainWindow.webContents.openDevTools();
if (isDev) {
mainWindow.webContents.openDevTools();
}
// Menue deaktivieren:
mainWindow.setMenu(null);
// Lade die HTML-Datei aus dem Web-Verzeichnis:
mainWindow.loadFile(path.join(__dirname, '../web/index.html'));
}
// App bereit
@ -29,6 +38,13 @@ app.whenReady().then(() => {
});
});
const { ipcMain } = require('electron');
ipcMain.on("test-message", (event, data) => {
console.log("IPC empfangen:", data);
event.sender.send("test-reply", "Pong vom Main-Prozess");
});
// App schließen (außer auf macOS)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();

29
package-lock.json generated
View File

@ -1,13 +1,16 @@
{
"name": "avoriondistancecalculator",
"name": "adc",
"version": "2.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "avoriondistancecalculator",
"name": "adc",
"version": "2.0.0",
"license": "MIT",
"dependencies": {
"dotenv": "^16.5.0"
},
"devDependencies": {
"electron": "^29.4.6",
"electron-builder": "^24.13.3"
@ -1743,13 +1746,15 @@
}
},
"node_modules/dotenv": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz",
"integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==",
"dev": true,
"version": "16.5.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz",
"integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=10"
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dotenv-expand": {
@ -3353,6 +3358,16 @@
"node": ">=12.0.0"
}
},
"node_modules/read-config-file/node_modules/dotenv": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz",
"integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=10"
}
},
"node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",

View File

@ -1,5 +1,5 @@
{
"name": "avoriondistancecalculator",
"name": "adc",
"version": "2.0.0",
"description": "Electron-basierter Avorion Distance Calculator",
"main": "electron/main.js",
@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/AJaquet/AvorionDistanceCalculator.git"
"url": "git+https://github.com/realAscot/AvorionDistanceCalculator.git"
},
"author": "Adam Skotarczak",
"license": "MIT",
@ -18,9 +18,13 @@
"electron": "^29.4.6",
"electron-builder": "^24.13.3"
},
"bugs": {
"url": "https://github.com/realAscot/AvorionDistanceCalculator/issues"
},
"homepage": "https://github.com/realAscot/AvorionDistanceCalculator#readme",
"build": {
"appId": "com.realascot.avoriondistance",
"productName": "Avorion Distance Calculator",
"productName": "Avorion Distance Calculator 2.0",
"directories": {
"output": "dist"
},
@ -37,5 +41,8 @@
"icon": "assets/icon.png",
"target": "nsis"
}
},
"dependencies": {
"dotenv": "^16.5.0"
}
}

View File

@ -15,7 +15,8 @@
}
.Ergebniss {
font-size:x-large;
font-weight: bold;
font-size:large;
padding:10px;
}

11476
web/css/material.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,27 +3,35 @@
<head lang="en">
<meta charset="UTF-8">
<meta name="author" content="Adam Skotarczak">
<title>Avorion distance calculator</title>
<!-- -->
<meta http-equiv="Content-Security-Policy"
content="default-src 'self';
script-src 'self';
style-src 'self' 'unsafe-inline';
img-src 'self' data:;
object-src 'none';">
<title>Avorion Distance Calculator 2.0</title>
<link rel="stylesheet" href="css/main.css" type="text/css">
<!-- Material Design Lite begin -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.orange-deep_orange.min.css" />
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> -->
<link rel="stylesheet" href="css/material.css" />
<script defer src="js/libs/material.js"></script>
<!-- Material Design Lite end -->
<!-- jQuery Einbindung:
<!-- jQuery Einbindung: -->
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/libs/jquery-3.7.1.min.js"></script>
<script>
$(document).ready(function(){
/* Hier der jQuery-Code */
});
</script>
-->
<!--Hier wird die externe JavaScript-Datei zum berechnen eingebunden -->
<script src="js/logic.js"></script>
<script src="js/main.js"></script>
</head>
<body onload="start();">
@ -46,7 +54,7 @@
<!-- Numeric Textfield with Floating Label -->
<div class="Titel">
Avorion distance calculator
Avorion Distance Calculator 2.0
</div>
<div class="Feldbeschreibung">
Starting coordinates:
@ -127,10 +135,17 @@
<hr>
<div>
<p class="version" id="version">
<p class="classVersion" id="classVersion">
</p>
<!-- Your content goes here end -->
</div>
<!-- Debug IPC Test
<div>
<button id="ipc-test-btn">IPC-Test starten</button>
<p id="ipc-test-result"></p>
</div>
-->
<!-- Your content goes here end -->
</div>
</main>
</div>

View File

@ -8,12 +8,12 @@
*/
// bei Änderungen Version eintragen!
const MAJOR = 1; // +1 wenn inkompatibel zur vorherigen Version
const MINOR = 1; // +1 wenn neue Funktionen implementiert
const PATCH = 4; // +1 wenn Änderungen ohne neue Funktionen
const MAJOR = 2; // +1 wenn inkompatibel zur vorherigen Version
const MINOR = 0; // +1 wenn neue Funktionen implementiert
const PATCH = 0; // +1 wenn Änderungen ohne neue Funktionen
// letzte Veröffentlichung
const LASTDEV = '2025-05-01 20:00 Thursday';
const LASTDEV = '2025-05-08';
// debug-modus ON/ OFF
const DEBUG = false;
@ -31,12 +31,11 @@ function start() {
function goVersion() {
// Es wird die Version des Programs generiert und die ID=version im HTML geaendert.
const VERSION = MAJOR + "." + MINOR + "." + PATCH;
version.innerHTML += `
const VERSION = MAJOR + "." + MINOR + "." + PATCH;
classVersion.innerHTML += `
Script-Version: ${VERSION}
( <a href="https://www.ionivation.com">Ionivation.com</a> ) (C) 2022-2025 Adam Skotarczak [![GitHub release (latest by semver)](https://img.shields.io/github/v/release/realAscot/AvorionDistanceCalculator?sort=semver)](https://github.com/realAscot/AvorionDistanceCalculator/releases)
`;
( <a href="https://www.ionivation.com">Ionivation.com</a> ) (C) 2022-2025 Adam Skotarczak
`;
}
function calculate() {
@ -54,13 +53,23 @@ function calculate() {
}
}
/**
* Berechnet die Entfernung zum Mittelpunkt der Galaxie
*
* @param {*} INT x
* @param {*} INT y
* @returns INT (Entfernung)
*/
function goDistToCenter(x, y){
// Berechnet Entfernung zum Zentrum und schickt Ergebnis zurück
let result;
result = Math.round (Math.sqrt( Math.round(x * x) + Math.round(y * y) ));
// Nur zum debuggen der Ergebnisse wenn DEBUG=true: (1.1.0)
/**
* Nur zum debuggen der Ergebnisse wenn DEBUG=true: (seit 1.1.0)
* (muss auf .env umgestellt werden!)
*/
if (DEBUG){
console.log("");
console.log("Berechnungen ohne Rundungen aus goDistToCenter()")

19
web/js/main.js Normal file
View File

@ -0,0 +1,19 @@
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("ipc-test-btn");
const output = document.getElementById("ipc-test-result");
console.log("main.js geladen");
console.log("electronAPI verfügbar:", window.electronAPI !== undefined);
if (button && output && window.electronAPI) {
button.addEventListener("click", () => {
window.electronAPI.sendToMain("test-message", "Ping von Renderer");
});
window.electronAPI.onFromMain("test-reply", (data) => {
output.textContent = "Antwort vom Main-Prozess: " + data;
});
} else {
console.warn("Voraussetzungen für IPC-Test nicht erfüllt");
}
});

3996
web/libs/material.js Normal file

File diff suppressed because it is too large Load Diff

10
web/libs/material.min.js vendored Normal file

File diff suppressed because one or more lines are too long