From: David ‘Bombe’ Roden Date: Fri, 26 Nov 2010 23:02:22 +0000 (+0100) Subject: Add functions to detect a “view Sone” page and the ID of the shown Sone. X-Git-Tag: 0.3.1~3 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=e508676493627c055b09e1eef26ba551aefa6e67 Add functions to detect a “view Sone” page and the ID of the shown Sone. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 59135af..cb16e64 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -620,6 +620,26 @@ function isIndexPage() { return getPageId() == "index"; } +/** + * Returns whether the current page is a “view Sone” page. + * + * @returns {Boolean} true if the current page is a “view Sone” + * page, false otherwise + */ +function isViewSonePage() { + return getPageId() == "view-sone"; +} + +/** + * Returns the ID of the currently shown Sone. This will only return a sensible + * value if isViewSonePage() returns true. + * + * @returns The ID of the currently shown Sone + */ +function getSoneId() { + return $("#sone .sone-id").text(); +} + var loadedPosts = {}; var loadedReplies = {}; diff --git a/src/main/resources/templates/viewSone.html b/src/main/resources/templates/viewSone.html index 534c5ff..b736f8d 100644 --- a/src/main/resources/templates/viewSone.html +++ b/src/main/resources/templates/viewSone.html @@ -1,5 +1,8 @@ <%include include/head.html> + + + <%ifnull sone>

<%= Page.ViewSone.Page.TitleWithoutSone|l10n|html>