/[suikacvs]/webroot/www/url/urlresolution.ja.html
Suika

Contents of /webroot/www/url/urlresolution.ja.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Sat Jul 5 14:13:35 2008 UTC (15 years, 10 months ago) by wakaba
Branch: MAIN
File MIME type: text/html
Fancy Japanese version :-)

1 wakaba 1.1 <!DOCTYPE HTML>
2     <html lang=ja>
3     <head>
4     <title>$B@8$-$?(B URL $B2r7h1\Mw4o(B</title>
5     <link rel=author href="http://suika.fam.cx/~wakaba/who?" title=Wakaba lang=ja>
6     <style>
7     h1 {
8     font-size: 100%;
9     }
10     textarea {
11     width: 90%;
12     height: 3em;
13     }
14     iframe {
15     visibility: hidden;
16     width: 0;
17     height: 0;
18     }
19     var {
20     color: orange;
21     }
22     </style>
23     <script>
24     document.createElement ('output');
25    
26     var updateTimer = 0;
27     function update () {
28     if (updateTimer) {
29     clearTimeout (updateTimer);
30     }
31     updateTimer = setTimeout (realUpdate, 100);
32     } // update
33    
34     function htescape (s) {
35     return s.replace (/&/g, '&amp;')
36     .replace (/</g, '&lt;')
37     .replace (/>/g, '&gt;')
38     .replace (/"/g, '&quot;');
39     } // htescape
40    
41     function htescape2 (s) {
42     return s.replace (/&/g, '&amp;')
43     .replace (/</g, '&lt;')
44     .replace (/>/g, '&gt;')
45     .replace (/"/g, '&quot;')
46     .replace (/[\u0000-\u0020\u007F-\u00A0]/g, function (t) {
47     return '<var>&amp;#x' + t.charCodeAt (0).toString (16).toUpperCase () + ';</var>';
48     });
49     } // htescape2
50    
51     function realUpdate () {
52     var baseURL = document.getElementById ('base-url').value;
53     var resolvedURL = document.getElementById ('resolved-url').value;
54    
55     var pl = document.getElementById ('permalink');
56     pl.href = location.pathname + '?' + encodeURIComponent (baseURL) + ';' +
57     encodeURIComponent (resolvedURL);
58    
59     var iframe = document.getElementsByTagName ('iframe')[0];
60     var doc = iframe.contentWindow.document;
61     doc.open ();
62     doc.write ('<!DOCTYPE HTML>');
63     doc.write ('<base href="' + htescape (baseURL) + '">');
64     doc.write ('<a href="' + htescape (resolvedURL) + '">xx</a>');
65     doc.close ();
66    
67     var resultURL = doc.getElementsByTagName ('a')[0].href;
68     var output = document.getElementsByTagName ('output')[0];
69     output.innerHTML = '';
70     if (typeof (resultURL) == 'undefined') {
71     output.innerHTML = '(<code>undefined</code>)';
72     } else if (resultURL === null) {
73     output.innerHTML = '(<code>null</code>)';
74     } else if (resultURL === '') {
75     output.innerHTML = '($B6uJ8;zNs(B $B!=(B URL $B2r7h<:GT(B?)';
76     } else {
77     output.innerHTML = '<code>' + htescape2 ('' + resultURL) +
78     '</code> of type <code>' + htescape (typeof (resultURL)) + '</code>';
79     }
80     } // realUpdate
81    
82     window.onload = function () {
83     if (location.search) {
84     var q = location.search.substring (1).split (/;/);
85     if (q[0] != null) {
86     document.getElementById ('base-url').value = decodeURIComponent (q[0]);
87     }
88     if (q[1] != null) {
89     document.getElementById ('resolved-url').value = decodeURIComponent (q[1]);
90     }
91     }
92    
93     update ();
94     }; // window.onload
95     </script>
96     </head>
97     <body>
98     <h1>$B@8$-$?(B URL $B2r7h1\Mw4o(B
99     (<a rel=bookmark id=permalink href>$B915W%j%s%/(B</a>)</h1>
100    
101     <dl>
102     <dt><label for=resolved-url>$B2r7h$9$k(B URL</label>:
103     <dd><textarea id=resolved-url oninput="update()" onchange="update()" onkeypress="update()"></textarea>
104     <dt><label for=base-url>$B4pDl(B URL</label>:
105     <dd><textarea id=base-url oninput="update()" onchange="update()" onkeypress="update()"></textarea>
106     </dl>
107     <hr>
108     <dl>
109     <dt>$B7k2L(B (<code>base href</code> $B$H(B <code>HTMLAnchorElement.href</code>
110     $B$r;HMQ(B):
111     <dd><output></output>
112     </dl>
113    
114     <iframe></iframe>
115    
116     </body>
117     </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24