From: David ‘Bombe’ Roden Date: Fri, 26 Nov 2010 22:56:07 +0000 (+0100) Subject: Add possibility to detect the index page. X-Git-Tag: 0.3.1~5 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=56d8cf539156f5949ce33aebf784438c737f84b3;p=Sone.git Add possibility to detect the index page. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index ba78d2c..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 = {}; diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 5c2fca0..39d53f1 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,5 +1,7 @@ <%include include/head.html> + +

<%= Page.Index.PostList.Title|l10n|html>