From e508676493627c055b09e1eef26ba551aefa6e67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 27 Nov 2010 00:02:22 +0100 Subject: [PATCH] =?utf8?q?Add=20functions=20to=20detect=20a=20=E2=80=9Cvie?= =?utf8?q?w=20Sone=E2=80=9D=20page=20and=20the=20ID=20of=20the=20shown=20S?= =?utf8?q?one.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/javascript/sone.js | 20 ++++++++++++++++++++ src/main/resources/templates/viewSone.html | 3 +++ 2 files changed, 23 insertions(+) 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>

-- 2.7.4