This commit is contained in:
William 2022-05-09 09:36:01 +00:00
parent 3058f8d81b
commit 11cba978b7
5 changed files with 87 additions and 32 deletions

View File

@ -1,7 +1,14 @@
<?php
if (!isset($focused)) {
$focused = FALSE;
}
?>
<div id="alertBox" class="alert danger hidden" role="alert"></div> <div id="alertBox" class="alert danger hidden" role="alert"></div>
<?php if ($focused == FALSE): ?>
<h1>Resultater</h1> <h1>Resultater</h1>
<br> <span class="float-right">[&nbsp;<a class="info" href="?focused=1" target="_blank">Fokusert visning</a>&nbsp;]</span>
<?php endif; ?>
<noscript> <noscript>
Denne siden krever JavaScript Denne siden krever JavaScript
@ -11,6 +18,16 @@ Denne siden krever JavaScript
Laster inn... Laster inn...
</div> </div>
<style>
.b {
animation: coolFlash 1s;
}
@keyframes coolFlash {
from { background: lightgreen; }
}
</style>
<script src="<?=$this->config['root_url']?>static/js/ResultService.js"></script> <script src="<?=$this->config['root_url']?>static/js/ResultService.js"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {

View File

@ -4,7 +4,7 @@
<hr class="hidden"> <hr class="hidden">
<div id="footer"> <div id="footer">
<small>Kopieringsrettigheter &copy; 2021-2022 <a target="_blank" href="http://willy.club">WillySoft Solutions</a></small> <small>Kopieringsrettigheter &copy; 2021-2022 <a target="_blank" href="http://willy.club">WillySoft Solutions</a>, Kvadraturen Videregående Skole 3ELDEA</small>
</div> </div>
</body> </body>

View File

@ -1,3 +1,12 @@
<?php
if (!isset($hide_nav)) {
$hide_nav = FALSE;
}
if (!isset($hide_menu)) {
$hide_menu = FALSE;
}
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -16,6 +25,7 @@
<hr class="hidden"> <hr class="hidden">
<?php if ($hide_menu == FALSE): ?>
<div id="menu"> <div id="menu">
<small> <small>
@ -29,12 +39,15 @@
</small> </small>
</div> </div>
<?php endif; ?>
<hr class="hidden"> <hr class="hidden">
<div id="container"> <div id="container">
<?php if ($hide_nav == FALSE): ?>
<div id="nav"> <div id="nav">
<h4>Felles</h4> <h4>Felles</h4>
<ul> <ul>
<li><a href="<?=$this->config['root_url']?>index.php">Forside</a></li> <li><a href="<?=$this->config['root_url']?>index.php">Forside</a></li>
@ -52,6 +65,7 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
<hr class="hidden"> <hr class="hidden">

View File

@ -1,5 +1,17 @@
<?php $app = require '../../app/inc.php'; <?php $app = require '../../app/inc.php';
$app->view('template/header', ["title" => "Resultater"]); $focused = filter_input(INPUT_GET, 'focused');
$app->view('pages/race/results');
$app->view('template/footer'); if ($focused) {
$app->view('template/header', [
"title" => "Resultater",
"hide_nav" => TRUE,
"hide_menu" => TRUE
]);
$app->view('pages/race/results', ["focused" => TRUE]);
$app->view('template/footer');
} else {
$app->view('template/header', ["title" => "Resultater"]);
$app->view('pages/race/results');
$app->view('template/footer');
}

View File

@ -14,6 +14,9 @@ class ResultService {
this.hash = 0; this.hash = 0;
// cool flashy flashy thingy
this.prevTableRowsLength = null;
this.loop(); this.loop();
} }
@ -99,11 +102,17 @@ class ResultService {
tableHTML += "<th>Passert</th>"; tableHTML += "<th>Passert</th>";
tableHTML += "</tr>"; tableHTML += "</tr>";
let tableRowsLength = tableRows.length;
if (this.prevTableRowsLength == null) {
this.prevTableRowsLength = tableRowsLength;
}
let iterator = tableRows.length + 1; let iterator = tableRows.length + 1;
tableRows.forEach(row => { tableRows.forEach(row => {
iterator--; iterator--;
tableHTML += "<tr>"; tableHTML += "<tr" + ((iterator > this.prevTableRowsLength) ? ' class="b"' : '' ) + ">";
tableHTML += "<td>" + iterator + "</td>"; tableHTML += "<td>" + iterator + "</td>";
tableHTML += "<td>" + row.team.name + "</td>"; tableHTML += "<td>" + row.team.name + "</td>";
tableHTML += "<td>" + row.team.company + "</td>"; tableHTML += "<td>" + row.team.company + "</td>";
@ -116,6 +125,9 @@ class ResultService {
tableHTML += "<table>"; tableHTML += "<table>";
this.rankingTable.innerHTML = tableHTML; this.rankingTable.innerHTML = tableHTML;
// used for cool green flashy flashy thingy
this.prevTableRowsLength = tableRowsLength;
} }
} }