feat: add meta data (embeds) #49

Merged
alekswilc merged 5 commits from v3 into preview 2024-11-09 13:18:51 +01:00
6 changed files with 0 additions and 561 deletions
Showing only changes of commit 003d27f8e6 - Show all commits

View File

@ -1,77 +0,0 @@
<!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>

View File

@ -1,117 +0,0 @@
<!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>

View File

@ -1,86 +0,0 @@
<!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>

View File

@ -1,91 +0,0 @@
<!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>

View File

@ -1,93 +0,0 @@
<!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>

View File

@ -1,97 +0,0 @@
<!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>