X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=59135afdbecdf109b4f7f879e95b059d8d197e69;hb=56d8cf539156f5949ce33aebf784438c737f84b3;hp=c02e240d8f2a637d9addd7c79a3b44623dae40ed;hpb=eb8d6cb360fd57eeccc692f631f6b9b7d8f41729;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index c02e240..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,9 +637,7 @@ function loadNewPost(postId) { return false; } }); - newPost = $(data.post.html).addClass("hidden").click(function() { - markPostAsKnown(this); - }); + newPost = $(data.post.html).addClass("hidden"); if (firstOlderPost != null) { newPost.insertBefore(firstOlderPost); } else { @@ -649,9 +666,7 @@ function loadNewReply(replyId) { return false; } }); - newReply = $(data.reply.html).addClass("hidden").click(function() { - markPostAsKnown(getPostElement(this)); - }); + newReply = $(data.reply.html).addClass("hidden"); if (firstNewerReply != null) { newReply.insertBefore(firstNewerReply); } else {