1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-06-08 02:16:36 +00:00
farside/index.eex
2022-09-17 16:16:15 -07:00

92 lines
2.1 KiB
Elixir

<head>
<title>Farside</title>
<style>
html {
font-family: monospace;
font-size: 16px;
color: #66397C;
}
#parent-div {
text-align: center;
}
#child-div {
text-align: left;
width: 50%;
display: inline-block;
}
hr {
border: 1px dashed;
}
a:link, a:visited {
color: #66397C;
}
@media only screen and (max-width: 1000px) {
#child-div {
width: 90%;
}
}
ul {
margin: 10px;
}
.services{
list-style-type: none;
}
li.link{
list-style-type: none;
}
li.link > a{
color: #0066cc
}
li.link > a:hover{
font-size: xx-large;
color: #004d2e
}
</style>
</head>
<body>
<div id="parent-div">
<div id="child-div">
<h1>Farside [<a href="https://sr.ht/~benbusby/farside">SourceHut</a>, <a href="https://github.com/benbusby/farside">GitHub</a>]</h1>
<hr>
<h3>Last synced <span id="last_updated"><%= DateTime.truncate(last_updated, :second) %></span></h2>
<div>
<ul class = "services">
<%= for service <- services do %>
<li><%= service.type %></li>
<ul>
<%= for url <- service.instances do %>
<li class = "link"><a href="<%= url %>"><%= url %></a></li>
<% end%>
<li class = "link"><a href="<%= service.fallback %>"><%= service.fallback %></a></li>
</ul>
<% end %>
</ul>
</div>
</div>
</div>
<script>
var client_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
var options = {
timeZone: client_timezone,
year: 'numeric', month: 'numeric', day: 'numeric',
hour: 'numeric', minute: 'numeric', second: 'numeric'
};
var formatter = new Intl.DateTimeFormat([], options);
var time = "<%= DateTime.truncate(last_updated, :second) %>";
var element_to_write = document.getElementById("last_updated");
var localized_time = formatter.format(new Date(time));
element_to_write.innerHTML = localized_time;
</script>
</body>