mirror of
https://github.com/neocities/neocities.git
synced 2025-07-24 19:38:25 +02:00
streamline CSS, remove google font/cdn dep
This commit is contained in:
parent
ab6abc637e
commit
47344e8bdc
186 changed files with 31689 additions and 1655 deletions
38
public/js/news/comment.js
Normal file
38
public/js/news/comment.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
var Comment = {
|
||||
create: function(eventId, csrfToken, form) {
|
||||
var form = $(form)
|
||||
var comment = form.find('[name="comment"]').val()
|
||||
form.remove()
|
||||
|
||||
$.post('/event/'+eventId+'/comment', {csrf_token: csrfToken, message: comment}, function(res) {
|
||||
console.log(res)
|
||||
location.reload()
|
||||
})
|
||||
},
|
||||
|
||||
delete: function(commentId, csrfToken) {
|
||||
$.post('/comment/'+commentId+'/delete', {csrf_token: csrfToken}, function(res) {
|
||||
console.log(res)
|
||||
location.reload()
|
||||
})
|
||||
},
|
||||
|
||||
toggleLike: function(commentId, csrfToken) {
|
||||
var link = $('#comment_'+commentId+'_like')
|
||||
|
||||
$.post('/comment/'+commentId+'/toggle_like', {csrf_token: csrfToken}, function(res) {
|
||||
if(res.result == 'liked')
|
||||
link.text('Unlike ('+res.comment_like_count+')')
|
||||
|
||||
if(res.result == 'unliked') {
|
||||
var linkText = 'Like'
|
||||
|
||||
if(res.comment_like_count > 0)
|
||||
linkText += ' ('+res.comment_like_count+')'
|
||||
|
||||
link.text(linkText)
|
||||
}
|
||||
link.attr('data-original-title', res.liking_site_names.join('<br>'))
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue