Initial commit
[yaffs-website] / node_modules / js-base64 / base64.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <!-- $Id: base64.html,v 1.1 2009/03/01 22:00:28 dankogai Exp dankogai $ -->
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6 <title>Test for base64.js</title>
7 </head>
8 <body>
9 <h1>Test for base64.js</h1>
10 <p>$Id: base64.html,v 1.1 2009/03/01 22:00:28 dankogai Exp dankogai $</p>
11 <table width="640"><tbody>
12 <tr><th width="50%">Text</th><th>Base64
13 (URL Safe <input id="encodeURI" type="checkbox" onclick="doit()">)</th></tr>
14 <tr>
15 <th><textarea id="srctxt" cols="32" rows="4" onkeyup="doit()">
16 </textarea></th>
17 <th><textarea id="base64" cols=32" rows="4" onkeyup="
18     $('srctxt').value = Base64.decode(this.value);
19     doit();
20     if (1 /*@cc_on -1 @*/) $('data').src = 'data:text/plain;base64,' + this.value;
21 "></textarea></th>
22 </tr>
23 <tr><th width="50%">Roundtrip</th><th>iframe w/ data: (no IE)</th></tr>
24 <tr>
25 <th><textarea id="roundtrip" cols=32" rows="4" disabled></textarea></th>
26 <th><iframe id="data" width="80%" height="64"></iframe></th>
27 </tr>
28 </tbody></table>
29
30
31 <script src="./base64.js"></script>
32 <script>
33 $ = function(id){ return document.getElementById(id) };
34 function doit(){
35     var encoded = Base64[ 
36         'encode' + ($('encodeURI').checked ? 'URI' : '')
37      ]($('srctxt').value);
38     $('base64').value = encoded;
39     if (1 /*@cc_on -1 @*/) {
40         $('data').src = 'data:text/plain;base64,' 
41             + Base64.encode(Base64.decode(encoded));
42     }
43     $('roundtrip').value = Base64.decode(encoded);
44 }
45 </script>
46 </body>
47 </html>