From 1371a5b8bd854d930aec684c696f2e4096e19e64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 28 Jan 2011 06:39:07 +0100 Subject: [PATCH] Convert links to posts on the current page to relative links. --- src/main/resources/static/javascript/sone.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 254c0c3..656e22c 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -742,6 +742,15 @@ function ajaxifyNotification(notification) { notification.find("form.mark-as-read button").click(function() { $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()}); }); + notification.find("a[class^='link-']").each(function() { + linkElement = $(this); + if (linkElement.is("[href^='viewPost']")) { + id = linkElement.attr("class").substr(5); + if (hasPost(id)) { + linkElement.attr("href", "#post-" + id); + } + } + }); notification.find("form.dismiss button").click(function() { $.getJSON("dismissNotification.ajax", { "formPassword" : getFormPassword(), "notification" : notification.attr("id") }, function(data, textStatus) { /* dismiss in case of error, too. */ -- 2.7.4