X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Ftemplates%2Findex.html;h=c3fe06478964a4b542dd4e0258505262bd0b8ff7;hb=577105026674a86598fe83c9e2dae682525209e9;hp=2b21e91a2abcf90a7cb634041f2d833d05c50ddd;hpb=d4d356a040c0787b2062c686ee8f02f7b63f0660;p=Sone.git diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2b21e91..c3fe064 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -4,13 +4,31 @@ /* register input field/textarea swap. */ $(document).ready(function() { registerInputTextareaSwap("#sone input.createpost", "What are you doing?"); - registerInputTextareaSwap("#sone input.create-reply", "Write a Reply…"); + registerInputTextareaSwap("#sone input.reply-input", "Write a Reply…"); /* hide all the “create reply” forms until a link is clicked. */ - commentElement = $("
Comment
").addClass("show-reply-form").click(function() { + $("#sone .post").each(function() { + postId = $(this).attr("id"); + (function(postId) { + commentElement = $("
Comment
").addClass("show-reply-form").click(function() { + replyElement = $("#sone .post#" + postId + " .create-reply"); + replyElement.removeClass("hidden"); + replyElement.removeClass("light"); + (function(replyElement) { + replyElement.find("input.reply-input").blur(function() { + if ($(this).hasClass("default")) { + replyElement.addClass("light"); + } + }).focus(function() { + replyElement.removeClass("light"); + }); + })(replyElement); + replyElement.find("input.create-reply").focus(); + }); + })(postId); + $(this).find(".create-reply").addClass("hidden"); + $(this).find(".status-line .time").after(commentElement); }); - $("#sone .post > .status-line .time").after(commentElement); - $("#sone .post .create-reply").addClass("hidden"); });