/[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.2 - (show annotations) (download) (as text)
Sat Jul 5 14:36:58 2008 UTC (16 years, 4 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +20 -3 lines
File MIME type: text/html
Error occurred while calculating annotation data.
Show effective base URL

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 aEl = doc.getElementsByTagName ('a')[0];
68 var resultURL = aEl.href;
69 var output = document.getElementById ('output-url');
70 output.innerHTML = '';
71 if (typeof (resultURL) == 'undefined') {
72 output.innerHTML = '(<code>undefined</code>)';
73 } else if (resultURL === null) {
74 output.innerHTML = '(<code>null</code>)';
75 } else if (resultURL === '') {
76 output.innerHTML = '($B6uJ8;zNs(B $B!=(B URL $B2r7h<:GT(B?)';
77 } else {
78 output.innerHTML = '<code>' + htescape2 ('' + resultURL) +
79 '</code> of type <code>' + htescape (typeof (resultURL)) + '</code>';
80 }
81
82 var resultBaseURL = aEl.baseURI;
83 var output = document.getElementById ('output-base-url');
84 output.innerHTML = '';
85 if (typeof (resultBaseURL) == 'undefined') {
86 output.innerHTML = '(<code>undefined</code>)';
87 } else if (resultBaseURL === null) {
88 output.innerHTML = '(<code>null</code>)';
89 } else if (resultBaseURL === '') {
90 output.innerHTML = '($B6uJ8;zNs(B)';
91 } else {
92 output.innerHTML = '<code>' + htescape2 ('' + resultBaseURL) +
93 '</code> of type <code>' + htescape (typeof (resultBaseURL)) + '</code>';
94 }
95 } // realUpdate
96
97 window.onload = function () {
98 if (location.search) {
99 var q = location.search.substring (1).split (/;/);
100 if (q[0] != null) {
101 document.getElementById ('base-url').value = decodeURIComponent (q[0]);
102 }
103 if (q[1] != null) {
104 document.getElementById ('resolved-url').value = decodeURIComponent (q[1]);
105 }
106 }
107
108 update ();
109 }; // window.onload
110 </script>
111 </head>
112 <body>
113 <h1>$B@8$-$?(B URL $B2r7h1\Mw4o(B
114 (<a rel=bookmark id=permalink href>$B915W%j%s%/(B</a>)</h1>
115
116 <dl>
117 <dt><label for=resolved-url>$B2r7h$9$k(B URL</label>:
118 <dd><textarea id=resolved-url oninput="update()" onchange="update()" onkeypress="update()"></textarea>
119 <dt><label for=base-url>$B4pDl(B URL</label>:
120 <dd><textarea id=base-url oninput="update()" onchange="update()" onkeypress="update()"></textarea>
121 </dl>
122 <hr>
123 <dl>
124 <dt>$B7k2L(B (<code>base href</code> $B$H(B <code>HTMLAnchorElement.href</code>
125 $B$r;HMQ(B):
126 <dd><output id=output-url></output>
127 <dt>$B<B8z4pDl(B URL (<code>Node.baseURI</code> $B$K$h$k(B)
128 <dd><output id=output-base-url></output>
129 </dl>
130
131 <iframe></iframe>
132
133 </body>
134 </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24