X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=29c5420607c08ae48567723b37b4e64c9e564379;hb=74af78bee7dda61c9244b71e170c753bc15f80e4;hp=943895b90fa650dbca222c8105c667126f9a8797;hpb=67e70ae26d1b8dc644013cddb85e90c7944bafe0;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 943895b..29c5420 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")); @@ -849,6 +858,7 @@ function ajaxifyPost(postElement) { /* show Sone menu when hovering over the avatar. */ $(postElement).find(".post-avatar").mouseover(function() { + $(".sone-menu:visible").fadeOut(); $(".sone-post-menu", postElement).mouseleave(function() { $(this).fadeOut(); }).fadeIn(); @@ -909,6 +919,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. */ @@ -968,6 +988,7 @@ function ajaxifyReply(replyElement) { /* show Sone menu when hovering over the avatar. */ $(replyElement).find(".reply-avatar").mouseover(function() { + $(".sone-menu:visible").fadeOut(); $(".sone-reply-menu", replyElement).mouseleave(function() { $(this).fadeOut(); }).fadeIn(); @@ -1921,11 +1942,6 @@ $(document).ready(function() { ajaxifyNotification($(this)); }); - /* disable all permalinks. */ - $(".permalink").click(function() { - return false; - }); - /* activate status polling. */ setTimeout(getStatus, 5000);