X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=fa2b1cf84372b01b57f7627447e7bf23a45c093d;hb=693da3f2d937022bca8377d95e57df8ea8ee10f9;hp=f3ea9e83e4483a67828d365c68455f84b625e53a;hpb=945df2c5ed34ba5be654b2a084ade589a3125067;p=Sone.git
diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js
index f3ea9e8..fa2b1cf 100644
--- a/src/main/resources/static/javascript/sone.js
+++ b/src/main/resources/static/javascript/sone.js
@@ -640,6 +640,26 @@ function getSoneId() {
return $("#sone .sone-id").text();
}
+/**
+ * Returns whether the current page is a âview postâ page.
+ *
+ * @returns {Boolean} true
if the current page is a âview postâ
+ * page, false
otherwise
+ */
+function isViewPostPage() {
+ return getPageId() == "view-post";
+}
+
+/**
+ * Returns the ID of the currently shown post. This will only return a sensible
+ * value if isViewPostPage() returns true
.
+ *
+ * @returns The ID of the currently shown post
+ */
+function getPostId() {
+ return $("#sone .post-id").text();
+}
+
var loadedPosts = {};
var loadedReplies = {};
@@ -664,7 +684,7 @@ function loadNewPost(postId) {
if (firstOlderPost != null) {
newPost.insertBefore(firstOlderPost);
} else {
- $("#sone #posts").append(newPost);
+ $("#sone .post:last").append(newPost);
}
ajaxifyPost(newPost);
newPost.slideDown();