forked from simrail/simrail.pro
Merge remote-tracking branch 'origin/main' into v3
# Conflicts: # packages/backend/src/http/views/_modules/footer.ejs # packages/backend/src/http/views/leaderboard/station.ejs # src/http/views/leaderboard/index.ejs # src/http/views/profiles/index.ejs # src/http/views/stations/details.ejs # src/http/views/stations/index.ejs # src/http/views/trains/details.ejs # src/http/views/trains/index.ejs
This commit is contained in:
commit
8a596d3c3a
@ -2,18 +2,15 @@
|
|||||||
<p>Made with <span style="color: red;">❤️</span> by <a href="https://www.alekswilc.dev/">alekswilc</a> for SimRail
|
<p>Made with <span style="color: red;">❤️</span> by <a href="https://www.alekswilc.dev/">alekswilc</a> for SimRail
|
||||||
Community</p>
|
Community</p>
|
||||||
<p><a href="https://git.alekswilc.dev/alekswilc/">Open Source</a></p>
|
<p><a href="https://git.alekswilc.dev/alekswilc/">Open Source</a></p>
|
||||||
<p>
|
<p><% if (version) { %>
|
||||||
<% if (version) { %>
|
Wersja: <a href="https://git.alekswilc.dev/alekswilc/simrail-logs/releases/tag/<%= version %>"><%= version %></a>
|
||||||
Wersja: <a
|
<% } %>
|
||||||
href="https://git.alekswilc.dev/alekswilc/simrail-logs/releases/tag/<%- version %>"><%- version %></a>
|
Commit: <a href="https://git.alekswilc.dev/alekswilc/simrail-logs/commit/<%= commit %>"><%= commit %></a>
|
||||||
<% } %>
|
|
||||||
Commit: <a href="https://git.alekswilc.dev/alekswilc/simrail-logs/commit/<%- commit %>"><%- commit %></a>
|
|
||||||
</p>
|
</p>
|
||||||
<% if (thanks) { %>
|
<% if (thanks) { %>
|
||||||
<p>Podziękowania dla społeczności discorda <a href="https://discord.gg/yDhy3pDrVr">Simrail24</a>, <a
|
<p>Podziękowania dla społeczności discorda <a href="https://discord.gg/yDhy3pDrVr">Simrail24</a>, <a
|
||||||
href="https://discord.com/users/1079005960653254656">AQUALYTH</a>, osób lajkujących <a
|
href="https://discord.com/users/1079005960653254656">AQUALYTH</a>, osób lajkujących <a
|
||||||
href="https://forum.simrail.eu/topic/9142-logowanie-wyj%C5%9B%C4%87-z-posterunk%C3%B3w/">posta</a>,
|
href="https://forum.simrail.eu/topic/9142-logowanie-wyj%C5%9B%C4%87-z-posterunk%C3%B3w/">posta</a>, osób
|
||||||
osób
|
|
||||||
użytkujących strone i społeczności Simrail <span style="color: red;">❤️</span></p>
|
użytkujących strone i społeczności Simrail <span style="color: red;">❤️</span></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
@ -1,9 +1,9 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><span style="color:hotpink">
|
<summary><span style="color:hotpink">
|
||||||
<%- record.steamName %>
|
<%= record.steamName %>
|
||||||
</span> <span style="color: lightskyblue">
|
</span> <span style="color: lightskyblue">
|
||||||
<%- msToTime(record.dispatcherTime) %>
|
<%= msToTime(record.dispatcherTime) %>
|
||||||
</span></summary>
|
</span> </summary>
|
||||||
<p>Spędzona liczba godzin: <%- msToTime(record.dispatcherTime, true) || 'Brak' %></p>
|
<p>Spędzona liczba godzin: <%= msToTime(record.dispatcherTime, true) || 'Brak' %></p>
|
||||||
<button onclick="location.href = '/profiles/<%- record.steam %>'">Więcej</button>
|
<button onclick="location.href = '/profiles/<%= record.steam %>'">Więcej</button>
|
||||||
</details>
|
</details>
|
@ -1,11 +1,11 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><span style="color:hotpink">
|
<summary><span style="color:hotpink">
|
||||||
<%- record.steamName %>
|
<%= record.steamName %>
|
||||||
</span> - <span style="color:lightskyblue">
|
</span> - <span style="color:lightskyblue">
|
||||||
<%- record.trainPoints %> pkt.
|
<%= record.trainPoints %> pkt.
|
||||||
</span></summary>
|
</span></summary>
|
||||||
<p>Spędzona liczba godzin: <%- msToTime(record.trainTime, true) %></p>
|
<p>Spędzona liczba godzin: <%= msToTime(record.trainTime, true) %></p>
|
||||||
<p>Przejechane kilometry: <%- record.trainDistance / 1000 %>km</p>
|
<p>Przejechane kilometry: <%= record.trainDistance / 1000 %>km</p>
|
||||||
<p>Zdobyte punkty: <%- record.trainPoints %></p>
|
<p>Zdobyte punkty: <%= record.trainPoints %></p>
|
||||||
<button onclick="location.href = '/profiles/<%- record.steam %>'">Więcej</button>
|
<button onclick="location.href = '/profiles/<%= record.steam %>'">Więcej</button>
|
||||||
</details>
|
</details>
|
77
src/http/views/leaderboard/index.ejs
Normal file
77
src/http/views/leaderboard/index.ejs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description" content="Simrail Utils">
|
||||||
|
<meta property="og:title" content="simrail.alekswilc.dev">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev/leaderboard/">
|
||||||
|
<meta property="og:description" content="Simrail Utils">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 1%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'leaderboard' }) %>
|
||||||
|
|
||||||
|
<h2 id="but">Tablica wyników</h2>
|
||||||
|
<div class="container">
|
||||||
|
<input type="text" id="search" value="<=-q%>">
|
||||||
|
|
||||||
|
<button onclick="search()">Szukaj</button>
|
||||||
|
<button onclick="clearSearch()">Wyczyść</button>
|
||||||
|
|
||||||
|
<p>Użyj przecinka, aby wyszukać wiele wartości: pl2,Łazy</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<ul>
|
||||||
|
<% records.forEach(record=> { %>
|
||||||
|
<li>
|
||||||
|
<%- type === 'train' ? include('train.ejs', { record, msToTime }) : include('station.ejs', { record, msToTime }) %>
|
||||||
|
</li>
|
||||||
|
<% }) %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if (!records.length) { %>
|
||||||
|
<h4>Nie znaleziono wyników dla twojego zapytania.</h4>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function select() {
|
||||||
|
const isTrain = "<%= type %>" === 'train'
|
||||||
|
location.href = '/leaderboard/' + (isTrain ? 'station' : 'train')
|
||||||
|
}
|
||||||
|
document.getElementById('but').textContent = ("<%= type %>" === 'train') ? 'Tablica pociągów' : 'Tablica posterunków'
|
||||||
|
function search() {
|
||||||
|
location.href = '/leaderboard/<%= type %>/?q=' + document.getElementById('search').value
|
||||||
|
}
|
||||||
|
function clearSearch() {
|
||||||
|
location.href = '/leaderboard/<%= type %>';
|
||||||
|
}
|
||||||
|
document.getElementById('search').addEventListener("keyup", (event) => {
|
||||||
|
if (event.key === "Enter")
|
||||||
|
search();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<p style="color: orange;">Dane do rankingu zbierane są od dnia 19.08.2024.</p>
|
||||||
|
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
117
src/http/views/profiles/index.ejs
Normal file
117
src/http/views/profiles/index.ejs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description"
|
||||||
|
content="<%= steam.personaname %>">
|
||||||
|
<meta property="og:title" content="Simrail Log">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev/profiles/<%= player.steam %>/">
|
||||||
|
<meta property="og:description"
|
||||||
|
content="<%= steam.personaname %>">
|
||||||
|
<meta property=" og:type" content="website">
|
||||||
|
<meta property="og:image" content="<%= steam.avatarfull %>" />
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copylink() {
|
||||||
|
navigator.clipboard.writeText("https://simrail.alekswilc.dev/players/details/<%= player.steam %>/")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'profiles' }) %>
|
||||||
|
|
||||||
|
<div class="details">
|
||||||
|
<h1><a href="<%= steam.profileurl %>"><%= steam.personaname %></a></h1>
|
||||||
|
|
||||||
|
|
||||||
|
<%if (steamStats.stats) {%>
|
||||||
|
<details open>
|
||||||
|
<summary>Statystyki Steam</summary>
|
||||||
|
<p>Zdobyte punkty: <%= steamStats.stats.find(x => x.name === 'SCORE')?.value ?? "0" %></p>
|
||||||
|
<p>Przejechane kilometry: <%= (steamStats.stats.find(x => x.name === 'DISTANCE_M')?.value / 1000) ?? "0" %></p>
|
||||||
|
<p>Czas spędzony jako dyżurny ruchu: <%= msToTime((steamStats.stats.find(x => x.name === 'DISPATCHER_TIME')?.value ?? 0)*1_000_000, true) || 'Nigdy nie wszedł w tryb dyżurnego ruchu.' %></p>
|
||||||
|
<br />
|
||||||
|
<p style="font-size: smaller;">UWAGA: powyższe statystyki udostępnia platforma STEAM, mogą one być z łatwością manipulowane.</p>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<%}%>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Statystyki pociągów</h1>
|
||||||
|
<% if (player.trainTime) {%>
|
||||||
|
<p>Spędzony czas: <%= msToTime(player.trainTime) %></p>
|
||||||
|
<p>Przejechane kilometry: <%= player.trainDistance / 1000 %>km</p>
|
||||||
|
<p>Zdobyte punkty: <%= player.trainPoints %></p>
|
||||||
|
<p>Średnia prędkość: <%= ((player.trainDistance / (player.trainTime / 1000)) * 3.6).toFixed(2) %> km/h</p>
|
||||||
|
<%}%>
|
||||||
|
<% if (player.trainStats && Object.keys(player.trainStats).length) {%>
|
||||||
|
<ul>
|
||||||
|
<% Object.keys(player.trainStats).forEach(name => {%>
|
||||||
|
<li>
|
||||||
|
<details open>
|
||||||
|
<summary><%= name %></summary>
|
||||||
|
<p>Przejechany dystans: <%= player.trainStats[name].distance / 1000 %>km</p>
|
||||||
|
<p>Spędzony czas: <%= msToTime(player.trainStats[name].time, true) %></p>
|
||||||
|
<p>Zdobyte punkty: <%= player.trainStats[name].score %></p>
|
||||||
|
<p>Średnia prędkość: <%= ((player.trainStats[name].distance / (player.trainStats[name].time / 1000)) * 3.6).toFixed(2) %> km/h</p>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<% }) %>
|
||||||
|
</ul>
|
||||||
|
<%} else {%>
|
||||||
|
<p>Brak danych</p>
|
||||||
|
<%}%>
|
||||||
|
|
||||||
|
<h1>Statystyki posterunków</h1>
|
||||||
|
<% if (player.dispatcherTime) {%>
|
||||||
|
<p>Spędzony czas: <%= msToTime(player.dispatcherTime) %></p>
|
||||||
|
<%}%>
|
||||||
|
<% if (player.dispatcherStats && Object.keys(player.dispatcherStats).length) {%>
|
||||||
|
<ul>
|
||||||
|
<% Object.keys(player.dispatcherStats).forEach(name => {%>
|
||||||
|
<li>
|
||||||
|
<details open>
|
||||||
|
<summary><%= name %></summary>
|
||||||
|
<p>Spędzony czas: <%= msToTime(player.dispatcherStats[name].time, true) %></p>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<% }) %>
|
||||||
|
</ul>
|
||||||
|
<%} else {%>
|
||||||
|
<p>Brak danych</p>
|
||||||
|
<%}%>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<p><button onclick="copylink()">Kopiuj link</button></p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<p style="color: orange;">Dane do rankingu zbierane są od dnia 19.08.2024.</p>
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
86
src/http/views/stations/details.ejs
Normal file
86
src/http/views/stations/details.ejs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description"
|
||||||
|
content="<%= record.stationName %> | <%= record.userUsername %> | <%= dayjs(record.leftDate).format('hh:mm DD/MM/YYYY') %>">
|
||||||
|
<meta property="og:title" content="Simrail Log">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev/details/<%= record.id %>/">
|
||||||
|
<meta property="og:description"
|
||||||
|
content="<%= record.stationName %> | <%= record.userUsername %> | <%= dayjs(record.leftDate).format('hh:mm DD/MM/YYYY') %>"">
|
||||||
|
<meta property=" og:type" content="website">
|
||||||
|
<meta property="og:image" content="<%= record.userAvatar %>" />
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copydata() {
|
||||||
|
navigator.clipboard.writeText(document.getElementById('data').textContent.replace(/ /g, '').split('\n').filter(x => x).join(''))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function copylink() {
|
||||||
|
navigator.clipboard.writeText("https://simrail.alekswilc.dev/stations/details/<%= record.id %>/")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'stations' }) %>
|
||||||
|
|
||||||
|
<div class="details">
|
||||||
|
|
||||||
|
<p>Użytkownik: <a href="/profiles/<%= record.userSteamId %>">
|
||||||
|
<%= record.userUsername %>
|
||||||
|
</a></p>
|
||||||
|
<p>Stacja: <%= record.stationName %>
|
||||||
|
</p>
|
||||||
|
<p>Serwer: <%= record.server.toUpperCase() %>
|
||||||
|
</p>
|
||||||
|
<p>Data wejścia: <%= record.joinedDate ? dayjs(record.joinedDate).format('HH:mm DD/MM/YYYY') : '--:-- --/--/--'
|
||||||
|
%> (<%= record.joinedDate ? dayjs(record.joinedDate).fromNow() : '--' %>)</p>
|
||||||
|
<p>Data wyjścia: <%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %> (<%= dayjs(record.leftDate).fromNow()
|
||||||
|
%>)</p>
|
||||||
|
<p>Spędzony czas: <%= record.joinedDate ? msToTime(record.leftDate - record.joinedDate, true) : '--' %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<code class="clickable" style="white-space: pre-line" onclick="copydata()" id="data">;station: <%= record.stationName %>
|
||||||
|
;steam: <%= record.userSteamId %>
|
||||||
|
;server: <%= record.server %>
|
||||||
|
;name: <%= record.userUsername %>
|
||||||
|
;joined: <%=record.joinedDate ? dayjs(record.joinedDate).format() : 'no-data'%>
|
||||||
|
;left: <%=dayjs(record.leftDate).format()%>
|
||||||
|
;url: https://simrail.alekswilc.dev/stations/details/<%= record.id %>/
|
||||||
|
</code>
|
||||||
|
<br />
|
||||||
|
<p><button onclick="copylink()">Kopiuj link</button></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
91
src/http/views/stations/index.ejs
Normal file
91
src/http/views/stations/index.ejs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description" content="Simrail Utils">
|
||||||
|
<meta property="og:title" content="simrail.alekswilc.dev">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev">
|
||||||
|
<meta property="og:description" content="Simrail Utils">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 1%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'stations' }) %>
|
||||||
|
|
||||||
|
<h2>Wyszukaj posterunek, osobe lub serwer</h2>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<input type="text" id="search" value="<%=q%>">
|
||||||
|
<button onclick="search()">Szukaj</button>
|
||||||
|
<button onclick="clearSearch()">Wyczyść</button>
|
||||||
|
|
||||||
|
<p>Użyj przecinka, aby wyszukać wiele wartości: pl2,Łazy</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% records.forEach(record=> { %>
|
||||||
|
<li>
|
||||||
|
<details>
|
||||||
|
<summary>[<span style="color:lightskyblue">
|
||||||
|
<%= record.server.toUpperCase() %>
|
||||||
|
</span>] <span style="color: lightskyblue">
|
||||||
|
<%= record.stationName %>
|
||||||
|
</span> - <span style="color:hotpink">
|
||||||
|
<%= record.userUsername %>
|
||||||
|
</span>
|
||||||
|
<p style="margin-bottom: 0; opacity: 0.5;">
|
||||||
|
<%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %>
|
||||||
|
</p>
|
||||||
|
</summary>
|
||||||
|
<p>Data dołączenia: <%= record.joinedDate ? dayjs(record.joinedDate).format('HH:mm DD/MM/YYYY')
|
||||||
|
: '--:-- --/--/--' %> (<%= record.joinedDate ? dayjs(record.joinedDate).fromNow() : '--' %>)
|
||||||
|
</p>
|
||||||
|
<p>Data wyjścia: <%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %> (<%=
|
||||||
|
dayjs(record.leftDate).fromNow() %>)</p>
|
||||||
|
<p>Spędzony czas: <%= record.joinedDate ? msToTime(record.leftDate - record.joinedDate) : '--' %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href="/stations/details/<%= record.id %>">
|
||||||
|
<button>Więcej</button>
|
||||||
|
</a>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
<% }) %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if (!records.length) { %>
|
||||||
|
<h4>Nie znaleziono wyników dla twojego zapytania.</h4>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function search() {
|
||||||
|
location.href = '/stations/?q=' + document.getElementById('search').value
|
||||||
|
}
|
||||||
|
function clearSearch() {
|
||||||
|
console.log('test')
|
||||||
|
location.href = '/stations/';
|
||||||
|
}
|
||||||
|
document.getElementById('search').addEventListener("keyup", (event) => {
|
||||||
|
if (event.key === "Enter")
|
||||||
|
search();
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
93
src/http/views/trains/details.ejs
Normal file
93
src/http/views/trains/details.ejs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description"
|
||||||
|
content="<%= record.stationName %> | <%= record.userUsername %> | <%= dayjs(record.leftDate).format('hh:mm DD/MM/YYYY') %>">
|
||||||
|
<meta property="og:title" content="Simrail Log">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev/details/<%= record.id %>/">
|
||||||
|
<meta property="og:description"
|
||||||
|
content="<%= record.stationName %> | <%= record.userUsername %> | <%= dayjs(record.leftDate).format('hh:mm DD/MM/YYYY') %>"">
|
||||||
|
<meta property=" og:type" content="website">
|
||||||
|
<meta property="og:image" content="<%= record.userAvatar %>" />
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copydata() {
|
||||||
|
navigator.clipboard.writeText(document.getElementById('data').textContent.replace(/ /g, '').split('\n').filter(x => x).join(''))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function copylink() {
|
||||||
|
navigator.clipboard.writeText("https://simrail.alekswilc.dev/trains/details/<%= record.id %>/")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'trains' }) %>
|
||||||
|
|
||||||
|
<div class="details">
|
||||||
|
|
||||||
|
<p>Użytkownik: <a href="/profiles/<%= record.userSteamId %>">
|
||||||
|
<%= record.userUsername %>
|
||||||
|
</a></p>
|
||||||
|
|
||||||
|
<p>Pociąg: <%= record.trainName %> <%= record.trainNumber %>
|
||||||
|
</p>
|
||||||
|
<p>Data wejścia: <%= record.joinedDate ? dayjs(record.joinedDate).format('HH:mm DD/MM/YYYY') : '--:-- --/--/--'
|
||||||
|
%> (<%= record.joinedDate ? dayjs(record.joinedDate).fromNow() : '--' %>)</p>
|
||||||
|
<p>Data wyjścia: <%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %> (<%= dayjs(record.leftDate).fromNow()
|
||||||
|
%>)</p>
|
||||||
|
<p>Spędzony czas: <%= record.joinedDate ? msToTime(record.leftDate - record.joinedDate, true) : '--' %>
|
||||||
|
</p>
|
||||||
|
<% if (record.distance) { %>
|
||||||
|
<p>Przejechane kilometry: <%= record.distance / 1000 %></p>
|
||||||
|
<p>Zdobyte punkty: <%= record.points %></p>
|
||||||
|
<p>Średnia prędkość: <%= ((record.distance / ((record.leftDate - record.joinedDate) / 1000)) * 3.6).toFixed(2) %> km/h</p>
|
||||||
|
<% } %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<code class="clickable" style="white-space: pre-line" onclick="copydata()" id="data">;train: <%= record.trainNumber %>
|
||||||
|
;steam: <%= record.userSteamId %>
|
||||||
|
;server: <%= record.server %>
|
||||||
|
;name: <%= record.userUsername %>
|
||||||
|
;joined: <%=record.joinedDate ? dayjs(record.joinedDate).format() : 'no-data'%>
|
||||||
|
;left: <%=dayjs(record.leftDate).format()%><%if (record.distance) {%>
|
||||||
|
;distance: <%= record.distance / 1000 %>
|
||||||
|
;points: <%= record.points %><%}%>
|
||||||
|
;url: https://simrail.alekswilc.dev/trains/details/<%= record.id %>/
|
||||||
|
</code>
|
||||||
|
<br />
|
||||||
|
<p><button onclick="copylink()">Kopiuj link</button></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
97
src/http/views/trains/index.ejs
Normal file
97
src/http/views/trains/index.ejs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>simrail.alekswilc.dev</title>
|
||||||
|
<meta name="description" content="Simrail Utils">
|
||||||
|
<meta property="og:title" content="simrail.alekswilc.dev">
|
||||||
|
<meta property="og:url" content="https://simrail.alekswilc.dev">
|
||||||
|
<meta property="og:description" content="Simrail Utils">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
margin: 1%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%- include('../_modules/header.ejs', { section: 'trains' }) %>
|
||||||
|
|
||||||
|
<h2>Wyszukaj pociąg, osobe lub serwer</h2>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<input type="text" id="search" value="<%=q%>">
|
||||||
|
<button onclick="search()">Szukaj</button>
|
||||||
|
<button onclick="clearSearch()">Wyczyść</button>
|
||||||
|
|
||||||
|
<p>Użyj przecinka, aby wyszukać wiele wartości: pl2,1413</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% records.forEach(record=> { %>
|
||||||
|
<li>
|
||||||
|
<details>
|
||||||
|
<summary>[<span style="color:lightskyblue">
|
||||||
|
<%= record.server.toUpperCase() %>
|
||||||
|
</span>] <span style="color: lightskyblue">
|
||||||
|
<%= record.trainName %>
|
||||||
|
</span> - <span style="color: lightskyblue">
|
||||||
|
<%= record.trainNumber %>
|
||||||
|
</span> - <span style="color:hotpink">
|
||||||
|
<%= record.userUsername %>
|
||||||
|
</span>
|
||||||
|
<p style="margin-bottom: 0; opacity: 0.5;">
|
||||||
|
<%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %>
|
||||||
|
</p>
|
||||||
|
</summary>
|
||||||
|
<p>Data dołączenia: <%= record.joinedDate ? dayjs(record.joinedDate).format('HH:mm DD/MM/YYYY')
|
||||||
|
: '--:-- --/--/--' %> (<%= record.joinedDate ? dayjs(record.joinedDate).fromNow() : '--' %>)
|
||||||
|
</p>
|
||||||
|
<p>Data wyjścia: <%= dayjs(record.leftDate).format('HH:mm DD/MM/YYYY') %> (<%=
|
||||||
|
dayjs(record.leftDate).fromNow() %>)</p>
|
||||||
|
<p>Spędzony czas: <%= record.joinedDate ? msToTime(record.leftDate - record.joinedDate) : '--' %>
|
||||||
|
<% if (record.distance) { %>
|
||||||
|
<p>Przejechane kilometry: <%= record.distance / 1000 %></p>
|
||||||
|
<p>Zdobyte punkty: <%= record.points %></p>
|
||||||
|
<% } %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href="/trains/details/<%= record.id %>">
|
||||||
|
<button>Więcej</button>
|
||||||
|
</a>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
<% }) %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if (!records.length) { %>
|
||||||
|
<h4>Nie znaleziono wyników dla twojego zapytania.</h4>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<%- include('../_modules/footer.ejs', { thanks: false, version, commit }) %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function search() {
|
||||||
|
location.href = '/trains/?q=' + document.getElementById('search').value
|
||||||
|
}
|
||||||
|
function clearSearch() {
|
||||||
|
console.log('test')
|
||||||
|
location.href = '/trains/';
|
||||||
|
}
|
||||||
|
document.getElementById('search').addEventListener("keyup", (event) => {
|
||||||
|
if (event.key === "Enter")
|
||||||
|
search();
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user