]> gitweb @ CieloNegro.org - Rakka.git/blob - js/redirection.js
1a0c99b0bf4aceac2dabd0e286bceb81166d4c0a
[Rakka.git] / js / redirection.js
1 $(document).ready(function () {
2     var fragment;
3     
4     if ($.browser.mozilla) {
5         fragment = window.location.hash; // 何故か勝手に URI デコードされる
6     }
7     else {
8         fragment = decodeURIComponent(window.location.hash);
9     }
10
11     var m = fragment.match(/^#Redirect:(.*)$/);
12     if (m) {
13         var from = m[1];
14
15         var editButton
16             = $.INPUT({className: "editButton",
17                        type:      "button",
18                        value:     "Edit the page"});
19         $(editButton).click(function () {
20             Rakka.editPage(from);
21         });
22
23         var box
24             = $.P({className: "redirection"},
25                   "This page has been redirected from “" + from + "”.", editButton);
26
27         $("div.title").after(box);
28     }
29 });