X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=59135afdbecdf109b4f7f879e95b059d8d197e69;hb=56d8cf539156f5949ce33aebf784438c737f84b3;hp=a4ad957acf2e18b86ed0aa333112079a66426fdb;hpb=8cf44910fb8d20d99b15c575e73b0521205a3e76;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index a4ad957..59135af 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -601,6 +601,25 @@ function getStatus() { }) } +/** + * Returns the content of the page-id attribute. + * + * @returns The page ID + */ +function getPageId() { + return $("#sone .page-id").text(); +} + +/** + * Returns whether the current page is the index page. + * + * @returns {Boolean} true if the current page is the index page, + * false otherwise + */ +function isIndexPage() { + return getPageId() == "index"; +} + var loadedPosts = {}; var loadedReplies = {}; @@ -618,6 +637,7 @@ function loadNewPost(postId) { return false; } }); + newPost = $(data.post.html).addClass("hidden"); if (firstOlderPost != null) { newPost.insertBefore(firstOlderPost); } else { @@ -646,6 +666,7 @@ function loadNewReply(replyId) { return false; } }); + newReply = $(data.reply.html).addClass("hidden"); if (firstNewerReply != null) { newReply.insertBefore(firstNewerReply); } else {