summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-13 01:56:58 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-13 01:56:58 +0200
commit0ed3ffe0e3bf5f41bd6c4f0f8755988771e87312 (patch)
treecb82f3fe7056742ce6b6333fcaa36fd492bbffa7
parent70aaf6be9e30c484992faa3f267edd3140c5984a (diff)
downloaddamlengine-0ed3ffe0e3bf5f41bd6c4f0f8755988771e87312.tar.gz
damlengine-0ed3ffe0e3bf5f41bd6c4f0f8755988771e87312.tar.bz2
damlengine-0ed3ffe0e3bf5f41bd6c4f0f8755988771e87312.zip
JavaScript magic on weblog/ page to redirect to permalink of fragment not found.
This repairs things for people who might have used URLs like <URL: http://www.madore.org/~david/weblog/#d.2011-09-12.1935 > as if they were permalinks.
-rw-r--r--org/madore/damlengine/weblog-recent-template.daml13
1 files changed, 13 insertions, 0 deletions
diff --git a/org/madore/damlengine/weblog-recent-template.daml b/org/madore/damlengine/weblog-recent-template.daml
index 423f410..2938edc 100644
--- a/org/madore/damlengine/weblog-recent-template.daml
+++ b/org/madore/damlengine/weblog-recent-template.daml
@@ -22,6 +22,19 @@
<link rel="alternate" type="application/rss+xml" title="RSS" href="weblog.rss" />
+<d:extra-script>
+// <![CDATA[Addition for this page: redirect to permalink if fragment not found
+function checkFragment(e) {
+ var frag = location.hash;
+ var match = /^\#(d\.(\d{4}\-\d{2})\-\d{2}\.\d{4}(?:$|\..*))$/.exec(frag);
+ if ( match && ! document.getElementById(match[1]) ) {
+ location.href = match[2] + ".html" + frag;
+ }
+}
+window.addEventListener("load", checkFragment, false);
+// ]]>
+</d:extra-script>
+
<d:body>
<p>This WebLog is bilingual, some entries are in English and others