X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=cb16e6420d0455ad3d5adc2dea4b8310ae58daa7;hp=59135afdbecdf109b4f7f879e95b059d8d197e69;hb=e508676493627c055b09e1eef26ba551aefa6e67;hpb=2e3b2fb869041cd573ea2acd0623d2f499d4ab1b 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 = {};