]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - js/redirection.js
redirection
[Rakka.git] / js / redirection.js
diff --git a/js/redirection.js b/js/redirection.js
new file mode 100644 (file)
index 0000000..b379437
--- /dev/null
@@ -0,0 +1,30 @@
+$(document).ready(function () {
+    var fragment;
+    
+    if ($.browser.mozilla) {
+        fragment = window.location.hash; // 何故か勝手に URI デコードされる
+    }
+    else {
+        fragment = decodeURIComponent(window.location.hash);
+    }
+
+    var m = fragment.match(/^#Redirect:(.*)$/);
+    if (m) {
+        var from = m[1];
+
+        var editButton
+            = $.INPUT({className: "editButton",
+                       type:      "button",
+                       value:     from,
+                       title:     "Edit the page"});
+        $(editButton).click(function () {
+            alert("not implemented");
+        });
+
+        var box
+            = $.P({className: "redirection"},
+                  "This page is redirected from ", editButton, ".");
+
+        $("div.title").after(box);
+    }
+});
\ No newline at end of file