mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
fix blog comments
This commit is contained in:
parent
6bb558688e
commit
ed37be689a
7 changed files with 10 additions and 11 deletions
|
|
@ -41,6 +41,7 @@
|
||||||
function showComments(cb) {
|
function showComments(cb) {
|
||||||
$('#sd-container').remove()
|
$('#sd-container').remove()
|
||||||
getComments(function(err) {
|
getComments(function(err) {
|
||||||
|
$('#comments-spinner').hide()
|
||||||
if (err) {
|
if (err) {
|
||||||
$('#comments').text('derp')
|
$('#comments').text('derp')
|
||||||
if (typeof cb === 'function') cb(err)
|
if (typeof cb === 'function') cb(err)
|
||||||
|
|
@ -102,7 +103,7 @@
|
||||||
document.getElementById('thoughts').focus()
|
document.getElementById('thoughts').focus()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
comment.timestamp = +comment.timestamp + tzOffset
|
comment.timestamp = +new Date() + tzOffset
|
||||||
|
|
||||||
var options = { method: 'POST'
|
var options = { method: 'POST'
|
||||||
, uri: postCommentURL()
|
, uri: postCommentURL()
|
||||||
|
|
@ -115,8 +116,6 @@
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME check for error, how do we get the returned status code?
|
|
||||||
|
|
||||||
$('#comment-form').get(0).reset()
|
$('#comment-form').get(0).reset()
|
||||||
|
|
||||||
comment.timestamp = +new Date()
|
comment.timestamp = +new Date()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/// http://github.com/samsonjs/gitter
|
/// http://github.com/samsonjs/gitter
|
||||||
/// @_sjs
|
/// @_sjs
|
||||||
///
|
///
|
||||||
/// Copyright 2010 Sami Samhuri <sami.samhuri@gmail.com>
|
/// Copyright 2010 Sami Samhuri <sami@samhuri.net>
|
||||||
/// MIT License
|
/// MIT License
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
xhr.setRequestHeader(k, headers[k])
|
xhr.setRequestHeader(k, headers[k])
|
||||||
}
|
}
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200 || xhr.status === 204) {
|
||||||
cb(null, xhr, xhr.responseText)
|
cb(null, xhr, xhr.responseText)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/// http://github.com/samsonjs/strftime
|
/// http://github.com/samsonjs/strftime
|
||||||
/// @_sjs
|
/// @_sjs
|
||||||
///
|
///
|
||||||
/// Copyright 2010 Sami Samhuri <sami.samhuri@gmail.com>
|
/// Copyright 2010 Sami Samhuri <sami@samhuri.net>
|
||||||
/// MIT License
|
/// MIT License
|
||||||
|
|
||||||
var strftime = (function() {
|
var strftime = (function() {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= name %>
|
<%= name %>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ <%= strftime('%F %r', new Date(timestamp)) %>
|
@ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
|
||||||
</p>
|
</p>
|
||||||
<blockquote><%= html %></blockquote>
|
<blockquote><%= html %></blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@
|
||||||
</div>
|
</div>
|
||||||
<script type="text/html" id="comment_tmpl">
|
<script type="text/html" id="comment_tmpl">
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<a name="comment-<%= id %>" id="comment-<%= id %>">
|
<a name="comment-<%= id %>" id="comment-<%= id %>"></a>
|
||||||
<p>
|
<p>
|
||||||
<% if (url) { %>
|
<% if (url) { %>
|
||||||
<a href="<%= url %>"><%= name %></a>
|
<a href="<%= url %>"><%= name %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= name %>
|
<%= name %>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ <%= strftime('%F %r', new Date(timestamp)) %>
|
@ <a href="#comment-<%= id %>"><%= strftime('%F %I:%M %p', new Date(timestamp)) %></a>
|
||||||
</p>
|
</p>
|
||||||
<blockquote><%= html %></blockquote>
|
<blockquote><%= html %></blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,14 @@
|
||||||
</div>
|
</div>
|
||||||
<script type="text/html" id="comment_tmpl">
|
<script type="text/html" id="comment_tmpl">
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<a name="comment-<%= id %>" id="comment-<%= id %>">
|
<a name="comment-<%= id %>" id="comment-<%= id %>"></a>
|
||||||
<p>
|
<p>
|
||||||
<% if (url) { %>
|
<% if (url) { %>
|
||||||
<a href="<%= url %>"><%= name %></a>
|
<a href="<%= url %>"><%= name %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= name %>
|
<%= name %>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
|
@ <a href="#comment-<%= id %>"><%= strftime('%F %I:%M %p', new Date(timestamp)) %></a>
|
||||||
</p>
|
</p>
|
||||||
<blockquote><%= html %></blockquote>
|
<blockquote><%= html %></blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue