mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
add exact date to titles for dates
This commit is contained in:
parent
553be38cda
commit
0e10225f19
9 changed files with 29 additions and 17 deletions
1
public/js/dayjs.min.js
vendored
Normal file
1
public/js/dayjs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
|
||||
<span class="date">
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>" class="local-date-title" data-timestamp="<%= event.created_at.to_i %>"><%= event.created_at.ago %></a>
|
||||
</span>
|
||||
</div>
|
||||
<% elsif event.site_change_id %>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<span class="date">
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>" class="local-date-title" data-timestamp="<%= event.created_at.to_i %>"><%= event.created_at.ago %></a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
|||
<a href="/site/<%= comment_actioning_site.username %>"><img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '50x50') %>"></a>
|
||||
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><i class="fa fa-user"><% if comment_actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= comment_actioning_site.username %></a>
|
||||
<span class="date">
|
||||
<a href="/site/<%= comment_event_site.username %>?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
||||
<a href="/site/<%= comment_event_site.username %>?event_id=<%= event.id %>" class="local-date-title" data-timestamp="<%= comment.created_at.to_i %>"><%= comment.created_at.ago %></a>
|
||||
</span>
|
||||
<p><%== sanitize_comment comment.message %></p>
|
||||
</div>
|
||||
|
@ -171,3 +171,7 @@
|
|||
</div>
|
||||
|
||||
<%== erb :'_news_templates', layout: false %>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
|
||||
<span class="date">
|
||||
<a href="/site/<%= site.username %>?event_id=<%= profile_comment.event.id %>"><%= profile_comment.created_at.ago %></a>
|
||||
<a href="/site/<%= site.username %>?event_id=<%= profile_comment.event.id %>" class="local-date-title" data-timestamp="<%= profile_comment.created_at.to_i %>"><%= profile_comment.created_at.ago %></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="content"><%== sanitize_comment profile_comment.message %></div>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
|
||||
<span class="date">
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>" class="local-date-title" data-timestamp="<%= event.created_at.to_i %>"><%= event.created_at.ago %></a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</p>
|
||||
<ul>
|
||||
<% if current_site.site_updated_at %>
|
||||
<li>Last updated <%= current_site.site_updated_at.ago.downcase %></li>
|
||||
<li>Last updated <strong class="local-date-title" data-timestamp="<%= current_site.site_updated_at.to_i %>"><%= current_site.site_updated_at.ago.downcase %></strong></li>
|
||||
<% end %>
|
||||
<li>Using <strong><%= current_site.space_percentage_used %>% (<%= current_site.total_space_used.to_space_pretty %>) of your <%= current_site.maximum_space.to_space_pretty %></strong>.
|
||||
<br>
|
||||
|
|
|
@ -91,8 +91,8 @@
|
|||
<p class="site-url"><a href="<%= current_site.uri %>" target="_blank"><%= site.title %></a></p>
|
||||
<div class="stats">
|
||||
<div class="col col-50">
|
||||
<% if site.updated_at %>
|
||||
Last updated<br><strong><%= site.updated_at.ago %></strong>
|
||||
<% if site.site_updated_at %>
|
||||
Last updated<br><strong class="local-date-title" data-timestamp="<%= site.site_updated_at.to_i %>"><%= site.site_updated_at.ago %></strong>
|
||||
<% else %>
|
||||
Your new website!<br><strong><a href="/dashboard"><i class="fa fa-edit" title="Edit"></i> Start Building</a></strong>
|
||||
<% end %>
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
<link rel="stylesheet" href="/css/highlight/styles/tomorrow-night.css">
|
||||
<script>
|
||||
hljs.highlightAll()
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var eventDateElements = document.querySelectorAll('.local-date-title');
|
||||
eventDateElements.forEach(function(element) {
|
||||
var timestamp = element.getAttribute('data-timestamp');
|
||||
var date = dayjs.unix(timestamp);
|
||||
var formattedDate = date.format('MMMM D, YYYY [at] h:mm A');
|
||||
element.title = formattedDate;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -39,6 +49,7 @@
|
|||
<script src="/js/nav.min.js"></script>
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<script src="/js/typeahead.bundle.js"></script>
|
||||
<script src="/js/dayjs.min.js"></script>
|
||||
|
||||
<script>
|
||||
$("a#like").tooltip({html: true})
|
||||
|
|
|
@ -62,14 +62,10 @@
|
|||
<h3>Website Stats</h3>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<span>Last updated</span>
|
||||
<strong>
|
||||
<% if site.updated_at.nil? %>
|
||||
<%= site.created_at.ago.downcase %>
|
||||
<% else %>
|
||||
<%= site.updated_at.ago.downcase %>
|
||||
<% end %>
|
||||
</strong>
|
||||
<% unless site.updated_at.nil? %>
|
||||
<span>Last updated</span>
|
||||
<strong class="local-date-title" data-timestamp="<%= site.site_updated_at.to_i %>"><%= site.site_updated_at.ago.downcase %></strong>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%b %-d, %Y') %></strong></div>
|
||||
<a href="/site/<%= site.username %>/stats">Site Traffic Stats</a>
|
||||
|
|
|
@ -268,7 +268,7 @@
|
|||
<div class="stats">
|
||||
<div class="col col-50">
|
||||
<% if site.updated_at %>
|
||||
Last updated<br><strong><%= site.updated_at.ago %></strong>
|
||||
Last updated<br><strong class="local-date-title" data-timestamp="<%= site.site_updated_at.to_i %>"><%= site.site_updated_at.ago %></strong>
|
||||
<% else %>
|
||||
Your new website!<br><strong><a href="/dashboard"><i class="fa fa-edit" title="Edit"></i> Start Building</a></strong>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Reference in a new issue