update timestamps every minute or so

This commit is contained in:
Kyle Mahan 2015-05-12 08:59:43 -07:00
parent a0748e3261
commit 569b186cc6
5 changed files with 30 additions and 3 deletions

View file

@ -1,5 +1,13 @@
$(function(){
function updateTimestamps() {
$(".permalink time").each(function() {
var absolute = $(this).attr('datetime');
var formatted = moment(absolute).fromNow();
$(this).text(formatted);
})
}
function clickOlderLink(evt) {
evt.preventDefault();
$.get(this.href, function(result) {
@ -106,4 +114,7 @@ $(function(){
if (WS_TOPIC) {
webSocketSubscribe(WS_TOPIC);
}
updateTimestamps();
window.setInterval(updateTimestamps, 60 * 1000);
});

7
woodwind/static/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,11 @@
</div>
{% endif %}
<footer>
<a href="{{ context.permalink }}">{{ context.published | relative_time }}</a>
<a class="permalink" href="{{ context.permalink }}">
<time datetime="{{ context.published | isoformat }}">
{{ context.published | relative_time }}
</time>
</a>
</footer>
</article>
{% endfor %}
@ -49,7 +53,11 @@
<footer>
<a href="{{ entry.permalink }}">{{ entry.published | relative_time }}</a>
<a class="permalink" href="{{ entry.permalink }}">
<time datetime="{{ entry.published | isoformat }}">
{{ entry.published | relative_time }}
</time>
</a>
<a href="{{ url_for('.index', entry=entry.permalink) }}" target="_blank">
<i class="fa fa-external-link"></i>
</a>

View file

@ -11,6 +11,7 @@
<link rel="stylesheet" href="{{ url_for('static', filename='style.css', version='2015-05-12') }}"/>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="{{ url_for('static', filename='moment.min.js') }}"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
{% block head %}{% endblock %}

View file

@ -4,7 +4,7 @@
{% if ws_topic %}
<script>var WS_TOPIC = "{{ ws_topic }}";</script>
{% endif %}
<script src="{{url_for('static', filename='feed.js', version='2015-05-12')}}"></script>
<script src="{{url_for('static', filename='feed.js', version='2015-05-12_1')}}"></script>
{% if current_user and current_user.settings
and current_user.settings.get('reply-method') == 'indie-config' %}