Fix false detection of posts added by updater on Tinyboard as own posts.

This commit is contained in:
ccd0 2019-01-22 20:26:39 -08:00
parent b7cd785559
commit 5e0e4c0337

View File

@ -6,8 +6,10 @@ Tinyboard =
$.global ->
{boardID, threadID} = document.currentScript.dataset
threadID = +threadID
window.$(document).on 'new_post', (e, post) ->
postID = +post.id.match(/\d*$/)[0]
form = document.querySelector 'form[name="post"]'
window.$(document).ajaxComplete (event, request, settings) ->
return unless settings.url is form.action
return unless (postID = +request.responseJSON?.id)
detail = {boardID, threadID, postID}
event = new CustomEvent 'QRPostSuccessful', {bubbles: true, detail: detail}
document.dispatchEvent event