/[suikacvs]/www/test/charset/charset-names/test-all.html
Suika

Contents of /www/test/charset/charset-names/test-all.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Thu Jun 5 15:52:10 2008 UTC (17 years, 1 month ago) by wakaba
Branch: MAIN
File MIME type: text/html
New

1 wakaba 1.1 <!DOCTYPE HTML>
2     <html>
3     <head>
4     <title></title>
5     <script src="../../support/result.js"></script>
6     <style>
7     .result-match {
8     background-color: green;
9     color: white;
10     }
11     .result-notmatch {
12     background-color: white;
13     color: blue;
14     }
15     .result-na {
16     background-color: gray;
17     color: black;
18     }
19     .result-na .result-notmatch {
20     background-color: transparent;
21     color: #C0C0C0;
22     }
23     </style>
24     </head>
25     <body>
26    
27     <noscript>FAIL (noscript)</noscript>
28    
29     <table>
30     <thead>
31     <tr><th>HTTP <code>charset=""</code> parameter
32     <th><code>charset</code><th><code>characterSet</code>
33     <th><code>inputEncoding</code>
34     <tbody id=result-tbody></table>
35    
36     <iframe style="width: 0; height: 0"></iframe>
37    
38     <script>
39     var iframe = document.getElementsByTagName ('iframe')[0];
40     var resultTBody = document.getElementById ('result-tbody');
41    
42     var xhr = new XMLHttpRequest ();
43     xhr.open ('GET', 'list.txt', false);
44     xhr.send (null);
45     var names = xhr.responseText.toLowerCase ().split (/\n/).sort ();
46    
47     var lastData;
48     doNext ();
49    
50     function doNext () {
51     if (names.length > 0) {
52     if (document.all && !window.opera) {
53     iframe.onreadystatechange = function () {
54     if (this.readyState == 'complete') {
55     addData ();
56     }
57     };
58     } else {
59     iframe.onload = addData;
60     }
61     var n = encodeURIComponent (names[0]).replace (/%2[Ff]/g, '/');
62     iframe.src = 'charset.cgi/' + n + '?' + (lastData ? 'c1' : 'c2');
63     } else {
64     iframe.onload = null;
65     }
66     } // doNext
67    
68     function addData () {
69     var doc = iframe.contentWindow.document;
70     if (!lastData) {
71     lastData = [doc.charset, doc.characterSet, doc.inputEncoding];
72     doNext ();
73     return;
74     }
75    
76     var tr = document.createElement ('tr');
77     if (lastData[0] != doc.charset ||
78     lastData[1] != doc.characterSet ||
79     lastData[2] != doc.inputEncoding) {
80     tr.className = 'result-na';
81     }
82     lastData = null;
83    
84     var name = names.shift ();
85     tr.appendChild (document.createElement ('th'))
86     .appendChild (document.createElement ('code'))
87     .appendChild (document.createTextNode (name));
88    
89     var v = doc.charset;
90     if (v != null) {
91     var td = tr.appendChild (document.createElement ('td'));
92     td.appendChild (document.createElement ('code'))
93     .appendChild (document.createTextNode (v));
94     td.className = v.toLowerCase () == name ? 'result-match' : 'result-notmatch';
95     } else {
96     tr.appendChild (document.createElement ('td'))
97     .className = 'result-na';
98     }
99    
100     v = doc.characterSet;
101     if (v != null) {
102     var td = tr.appendChild (document.createElement ('td'));
103     td.appendChild (document.createElement ('code'))
104     .appendChild (document.createTextNode (v));
105     td.className = v.toLowerCase () == name ? 'result-match' : 'result-notmatch';
106     } else {
107     tr.appendChild (document.createElement ('td'))
108     .className = 'result-na';
109     }
110    
111     v = doc.inputEncoding;
112     if (v != null) {
113     var td = tr.appendChild (document.createElement ('td'));
114     td.appendChild (document.createElement ('code'))
115     .appendChild (document.createTextNode (v));
116     td.className = v.toLowerCase () == name ? 'result-match' : 'result-notmatch';
117     } else {
118     tr.appendChild (document.createElement ('td'))
119     .className = 'result-na';
120     }
121    
122     resultTBody.appendChild (tr);
123    
124     doNext ();
125     } // addData
126     </script>
127    
128     </body>
129     </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24