X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=b5a7a2a67a6b8c8b91b72c8577d2ebd302420a13;hp=943895b90fa650dbca222c8105c667126f9a8797;hb=0a9c148df4c376753b93a54b694d693120da7a24;hpb=9986ec9e8083af0851144e38bec38bdac10df6eb diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 943895b..b5a7a2a 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -809,6 +809,15 @@ function ajaxifyPost(postElement) { }) }); + /* ajaxify author/post links */ + $(".post-status-line .permalink a", postElement).click(function() { + if (!$(".create-reply", postElement).hasClass("hidden")) { + textArea = $("input.reply-input", postElement).focus().data("textarea"); + $(textArea).replaceSelection($(this).attr("href")); + } + return false; + }); + /* add “comment” link. */ addCommentLink(getPostId(postElement), getPostAuthor(postElement), postElement, $(postElement).find(".post-status-line .permalink-author")); @@ -909,6 +918,16 @@ function ajaxifyReply(replyElement) { }); }); })(replyElement); + + /* ajaxify author links */ + $(".reply-status-line .permalink a", replyElement).click(function() { + if (!$(".create-reply", getPostElement(replyElement)).hasClass("hidden")) { + textArea = $("input.reply-input", getPostElement(replyElement)).focus().data("textarea"); + $(textArea).replaceSelection($(this).attr("href")); + } + return false; + }); + addCommentLink(getPostId(replyElement), getReplyAuthor(replyElement), replyElement, $(replyElement).find(".reply-status-line .permalink-author")); /* convert “show source” link into javascript function. */ @@ -1921,11 +1940,6 @@ $(document).ready(function() { ajaxifyNotification($(this)); }); - /* disable all permalinks. */ - $(".permalink").click(function() { - return false; - }); - /* activate status polling. */ setTimeout(getStatus, 5000);