mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-12-23 14:09:22 +00:00
refactor: translate comments, add TODOs for future dynamic data loading
Enhances code clarity by translating German comments to English and adding comments and TODOs for dynamic data loading and generation of currencies, API data, language files, and HTML elements. This will reduce hardcoded values and improve maintainability. Also, adds a reminder to move scripts to separate files and add OpenGraph tags in the HTML. No breaking changes, but dynamically loading these values will be essential for improving the codebase in future iterations.
This commit is contained in:
parent
39c1551972
commit
220d5dde1d
1 changed files with 16 additions and 4 deletions
20
index.php
20
index.php
|
@ -4,6 +4,8 @@ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
||||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
|
|
||||||
|
// Array of supported currencies
|
||||||
|
// TODO: Load dynamically from the API data
|
||||||
$array = array("EUR",
|
$array = array("EUR",
|
||||||
"USD",
|
"USD",
|
||||||
"GBP",
|
"GBP",
|
||||||
|
@ -57,14 +59,16 @@ $array = array("EUR",
|
||||||
|
|
||||||
include('coingecko.php');
|
include('coingecko.php');
|
||||||
|
|
||||||
// Holt die API Daten
|
// Fetches the API data from the JSON file
|
||||||
|
// TODO: This doesn't exist on first load, so it will display warnings
|
||||||
$api_cg = json_decode(file_get_contents('coingecko.json'));
|
$api_cg = json_decode(file_get_contents('coingecko.json'));
|
||||||
|
|
||||||
// Holt die Zeit der letzten Abfrage
|
// Fetches the time of the last API data update
|
||||||
$time_cg = date("H:i:s", $api_cg->time);
|
$time_cg = date("H:i:s", $api_cg->time);
|
||||||
$time = $time_cg;
|
$time = $time_cg;
|
||||||
|
|
||||||
// Holt die einzelnen Werte für die Berechnung
|
// Fetches the individual currency values from the API data
|
||||||
|
// TODO: Make that dynamic
|
||||||
$BTC = $api_cg->btc->lastValue;
|
$BTC = $api_cg->btc->lastValue;
|
||||||
$EUR = $api_cg->eur->lastValue;
|
$EUR = $api_cg->eur->lastValue;
|
||||||
$USD = $api_cg->usd->lastValue;
|
$USD = $api_cg->usd->lastValue;
|
||||||
|
@ -116,7 +120,7 @@ $CZK = $api_cg->czk->lastValue;
|
||||||
$DKK = $api_cg->dkk->lastValue;
|
$DKK = $api_cg->dkk->lastValue;
|
||||||
$MXN = $api_cg->mxn->lastValue;
|
$MXN = $api_cg->mxn->lastValue;
|
||||||
|
|
||||||
// Lädt die Sprachdatei, nach der Sprache die im Browser eingestellt wurde
|
// Load the language file based on the browser language
|
||||||
if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)){
|
if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)){
|
||||||
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||||
}else{
|
}else{
|
||||||
|
@ -255,6 +259,8 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
<meta name="description" lang="<?php echo $lang_meta; ?>" content="<?php echo $meta_description; ?>"/>
|
<meta name="description" lang="<?php echo $lang_meta; ?>" content="<?php echo $meta_description; ?>"/>
|
||||||
<meta name="keywords" lang="<?php echo $lang_meta; ?>" content="<?php echo $meta_keywords; ?>"/>
|
<meta name="keywords" lang="<?php echo $lang_meta; ?>" content="<?php echo $meta_keywords; ?>"/>
|
||||||
|
|
||||||
|
<!-- TODO: Add corresponding OpenGraph tags -->
|
||||||
|
|
||||||
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="img/apple-touch-icon-57x57.png" />
|
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="img/apple-touch-icon-57x57.png" />
|
||||||
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/apple-touch-icon-114x114.png" />
|
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/apple-touch-icon-114x114.png" />
|
||||||
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/apple-touch-icon-72x72.png" />
|
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/apple-touch-icon-72x72.png" />
|
||||||
|
@ -306,6 +312,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
<h1 lang="<?php echo $lang_meta; ?>"><span style="color:#4d4d4d;">↓</span> <span style="color:#ff6600;" title="Monero">XMR</span> <?php echo $title_h1;?> <span style="color:#4d4d4d;">↓</span></h1>
|
<h1 lang="<?php echo $lang_meta; ?>"><span style="color:#4d4d4d;">↓</span> <span style="color:#ff6600;" title="Monero">XMR</span> <?php echo $title_h1;?> <span style="color:#4d4d4d;">↓</span></h1>
|
||||||
<div class="fiat-btns table-responsive">
|
<div class="fiat-btns table-responsive">
|
||||||
<table class="table table-sm table-borderless">
|
<table class="table table-sm table-borderless">
|
||||||
|
<!-- TODO: Generate this table dynamically -->
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><button type="button" class="btn btn-light" title="<a class='text-decoration-none fiat-tooltip' href='/'><b><?php echo $l_eur; ?></b></a>" data-toggle="tooltip" data-bs-html="true" data-placement="top">EUR</button></td>
|
<td><button type="button" class="btn btn-light" title="<a class='text-decoration-none fiat-tooltip' href='/'><b><?php echo $l_eur; ?></b></a>" data-toggle="tooltip" data-bs-html="true" data-placement="top">EUR</button></td>
|
||||||
|
@ -457,6 +464,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
echo '<option value="'.$xmr_in.'">'.$xmr_in.'</option>';
|
echo '<option value="'.$xmr_in.'">'.$xmr_in.'</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<!-- TODO: Populate this select box dynamically -->
|
||||||
<option value="EUR" label="<?php echo $l_eur; ?>">EUR</option>
|
<option value="EUR" label="<?php echo $l_eur; ?>">EUR</option>
|
||||||
<option value="USD" label="<?php echo $l_usd; ?>">USD</option>
|
<option value="USD" label="<?php echo $l_usd; ?>">USD</option>
|
||||||
<option value="GBP" label="<?php echo $l_gbp; ?>">GBP</option>
|
<option value="GBP" label="<?php echo $l_gbp; ?>">GBP</option>
|
||||||
|
@ -524,6 +532,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TODO: Move these scripts to a separate file -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function fiatConvert(value)
|
function fiatConvert(value)
|
||||||
{
|
{
|
||||||
|
@ -531,6 +540,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
let xmrValue = document.getElementById("xmrInput");
|
let xmrValue = document.getElementById("xmrInput");
|
||||||
let selectBox = document.getElementById("selectBox").value;
|
let selectBox = document.getElementById("selectBox").value;
|
||||||
|
|
||||||
|
// TODO: Do this dynamically
|
||||||
if (selectBox == "BTC") {
|
if (selectBox == "BTC") {
|
||||||
let value = fiatAmount / <?php echo $BTC; ?>;
|
let value = fiatAmount / <?php echo $BTC; ?>;
|
||||||
xmrValue.value = value.toFixed(12);
|
xmrValue.value = value.toFixed(12);
|
||||||
|
@ -692,6 +702,8 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");
|
||||||
let fiatValue = document.getElementById("fiatInput");
|
let fiatValue = document.getElementById("fiatInput");
|
||||||
let selectBox = document.getElementById("selectBox").value;
|
let selectBox = document.getElementById("selectBox").value;
|
||||||
|
|
||||||
|
// TODO: Do this dynamically
|
||||||
|
|
||||||
if (selectBox == "BTC") {
|
if (selectBox == "BTC") {
|
||||||
let value = xmrAmount * <?php echo $BTC; ?>;
|
let value = xmrAmount * <?php echo $BTC; ?>;
|
||||||
fiatValue.value = value.toFixed(8);
|
fiatValue.value = value.toFixed(8);
|
||||||
|
|
Loading…
Reference in a new issue