v2.0.0-Alpha1

- erste Version funktioniert soweit und jetzt gehts am die Optimierung
This commit is contained in:
Adam Skotarczak 2025-05-12 02:34:53 +02:00
parent 0d9a91a31e
commit 785953c750
Signed by: realAscot
GPG Key ID: 4CB9B8D93A96A538
11 changed files with 83 additions and 57 deletions

4
.env-template Normal file
View File

@ -0,0 +1,4 @@
DEBUG=true
WINDOW_WIDTH=820
WINDOW_HEIGHT=640

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
media/
node_modules/
dist/
releases/
release/
tools/
*.*.map

View File

@ -1 +1 @@
2.0.0
2.0.0-Alpha1

BIN
assets/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

6
desktop.ini Normal file
View File

@ -0,0 +1,6 @@
[.ShellClassInfo]
IconResource=.\assets\favicon.ico,0
[ViewState]
Mode=
Vid=
FolderType=Documents

View File

@ -6,12 +6,12 @@ const isDev = process.env.DEBUG === 'true'
function createWindow() {
const mainWindow = new BrowserWindow({
width: parseInt(process.env.WINDOW_WIDTH || '820'),
height: parseInt(process.env.WINDOW_HEIGHT || '640'),
width: parseInt(process.env.WINDOW_WIDTH || '820', 10),
height: parseInt(process.env.WINDOW_HEIGHT || '640', 10),
icon: path.join(__dirname, '../assets/icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
sandbox: false, // Wichtig für Electron 25+
sandbox: true, // Wichtig für Electron 25+ (ist per default true ab 25)
contextIsolation: true,
nodeIntegration: false
}

View File

@ -24,7 +24,7 @@
"homepage": "https://github.com/realAscot/AvorionDistanceCalculator#readme",
"build": {
"appId": "com.realascot.avoriondistance",
"productName": "Avorion Distance Calculator 2.0",
"productName": "Avorion Distance Calculator",
"directories": {
"output": "dist"
},

View File

@ -3,52 +3,49 @@
<head lang="en">
<meta charset="UTF-8">
<meta name="author" content="Adam Skotarczak">
<!--
<!-- -->
<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>
content="default-src 'self' 'unsafe-inline';
script-src 'self' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
img-src 'self' data:;
object-src 'none';">
<title>Avorion Distance Calculator</title>
<link rel="stylesheet" href="css/main.css" type="text/css">
<!-- Material Design Lite begin -->
<link rel="stylesheet" href="libs/material.orange-deep_orange.min.css" />
<link rel="stylesheet" href="libs/material.orange-deep_orange.min.css" />
<script defer src="libs/material.1-3-0.min.js"></script>
<!-- Material Design Lite end -->
<script src="libs/jquery-3.6.0.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();">
<div class="layout">
<div class="layout__drawer">
<span class="layout-title">&nbsp;</span>
<nav class="navigation">
<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="layout__content">
<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 2.0
Avorion Distance Calculator
</div>
<!-- GitHub Button
<div>
<p>
<a href="https://github.com/realAscot/AvorionDistanceCalculator/releases">
@ -56,25 +53,26 @@
</a>
</p>
</div>
-->
<div class="Feldbeschreibung">
Starting coordinates:
</div>
<form action="#" onsubmit="calculate(); return false;">
<div class="input">
<input class="textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="koordinateX">
<label class="textfield__label" for="koordinateX">Koordinate X ...</label>
<span class="textfield__error">Input is not a number!</span>
<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="input">
<input class="textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="koordinateY">
<label class="textfield__label" for="koordinateY">Koordinate Y ...</label>
<span class="textfield__error">Input is not a number!</span>
<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="button_calculate">Calculate</button>
<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">
@ -130,22 +128,14 @@
</tr>
</tbody>
</table>
</div>
<hr>
<div>
<p class="classVersion" id="classVersion">
<p class="version" id="version">
&nbsp;
</p>
</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>
</div>
</main>
</div>

View File

@ -8,8 +8,8 @@
*/
// bei Änderungen Version eintragen!
const MAJOR = 1; // +1 wenn inkompatibel zur vorherigen Version
const MINOR = 2; // +1 wenn neue Funktionen implementiert
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
@ -22,6 +22,23 @@ const DEBUG = false;
// Ab hier nichts mehr konfigurieren!
//
/**
* Escapes a string for safe use with innerHTML.
*
* Converts characters like < > " ' & to their HTML entities to prevent injection.
*
* @param {string} unsafe - The raw string that may contain HTML.
* @returns {string} - The escaped, safe string.
*/
function escapeHTML(unsafe) {
return unsafe
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#039;");
}
function start() {
/* sollte onload vom Body des HTML Dokuments geladen werden
* start() und goVersion() sind für den eigentlichen Zweck des Programms überflüssig
@ -42,7 +59,7 @@ function start() {
function goVersion() {
// Es wird die Version des Programs generiert und die ID=version im HTML geaendert.
const VERSION = MAJOR + "." + MINOR + "." + PATCH;
classVersion.innerHTML += `
version.innerHTML += `
Script-Version: ${VERSION}
( <a href="https://www.ionivation.com">Ionivation.com</a> ) (C) 2022-2025 Adam Skotarczak
`;
@ -67,12 +84,11 @@ function calculate() {
let y = Math.round(koordinateY.value);
// Schickt die Daten zur Berechnung an die Funktion und schreibt in die ID (id="result") des HTML Dokuments
if (!isNaN(x) && !isNaN(y)){ // wenn x unc y Werte enthalten
result.innerHTML = `
${goDistToCenter(x, y)} sector(s) to Center 0:0
`;
// koordinateX.value = ""; koordinateY.value = "";
if (!isNaN(x) && !isNaN(y)) {
const resultText = `${goDistToCenter(x, y)} sector(s) to Center 0:0`;
document.getElementById("result").textContent = resultText;
}
// koordinateX.value = ""; koordinateY.value = "";
}
/**

10
web/libs/material.1-3-0.min.js vendored Normal file

File diff suppressed because one or more lines are too long