Debian Codegraph @

dojox/string/tests/BidiEngine/test_BidiEngine.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Test Bidi Engine</title>
6 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true, isDebug: true"></script>
7 <script language="javascript" type="text/javascript">
8 var doTransform, showMap, changeInp;
9 require(["dojox/string/BidiEngine"], function(BidiEngine) {
10 var bdEngine = new BidiEngine();
11 doTransform = function() {
12 var txt = document.getElementById("inp").value;
13 document.getElementById("div0").innerHTML = txt;
14 document.getElementById("div1").innerHTML = txt;
15 var sp = document.getElementById("sform").value +
16 document.getElementById("sdir").value +
17 document.getElementById("sswap").value +
18 document.getElementById("sshap").value + "N";
19 var tp = document.getElementById("tform").value +
20 document.getElementById("tdir").value +
21 document.getElementById("tswap").value +
22 document.getElementById("tshap").value + "N";
23 document.getElementById("div11").innerHTML = sp + " - " + tp;
24 var rCls = sp.substring(0,2).toLowerCase();
25 var tCls = tp.substring(0,2).toLowerCase();
26 document.getElementById("div0").className = rCls;
27 document.getElementById("div2").className = tCls;
28 var res = bdEngine.bidiTransform(txt, sp, tp);
29 document.getElementById("div2").innerHTML = res;
30 document.getElementById("div3").innerHTML = res;
31 var arrays = [bdEngine.sourceToTarget, bdEngine.targetToSource, bdEngine.levels];
32 var divNames = ["div5", "div6", "div7"];
33 for (var i=0; i<3; i++) {
34 showMap(arrays[i], divNames[i]);
35 }
36 };
37 showMap = function (arr, divName) {
38 var map = "", sps;
39 for (var i=0; i<arr.length; i++) {
40 sps = "";
41 if (arr[i].toString().length < 2)
42 sps = "&#160;";
43 map = map + sps + arr[i].toString() + "&#160;";
44 }
45 document.getElementById(divName).innerHTML = map;
46 };
47 changeInp = function(b) {
48 if (b.innerHTML == "Visual") {
49 document.getElementById("inp").className = "v";
50 b.innerHTML = "Logical";
51 } else {
52 document.getElementById("inp").className = "i";
53 b.innerHTML = "Visual";
54 }
55 }
56 });
57 </script>
58 <style>
59 .il {
60 direction: ltr;
61 unicode-bidi: embed;
62 }
63 .vl {
64 direction: ltr;
65 unicode-bidi: bidi-override;
66 }
67 .ir {
68 direction: rtl;
69 unicode-bidi: embed;
70 text-align: left;
71 }
72 .vr {
73 direction: rtl;
74 text-align: left;
75 unicode-bidi: bidi-override;
76 }
77 input.v {
78 unicode-bidi: bidi-override;
79 }
80 input.i {
81 unicode-bidi: normal;
82 }
83 </style>
84 </head>
85 <body>
86 <h1 align="center">Test Bidi Engine</h1>
87 </br></br>
88 <table>
89 <tr>
90 <td>Type text: </td>
91 <td><input id="inp" type="text" size=200 /></td>
92 <td><button id="b2" onClick="changeInp(this);">Visual</button></td>
93 </tr>
94 <tr>
95 <td>Source looks: </td>
96 <td><div id="div0"></div></td>
97 </tr>
98 <tr>
99 <td> Buffer: </td>
100 <td><div id="div1" style="unicode-bidi: bidi-override;"></div></td>
101 </tr>
102 <tr>
103 <td> Params: </td>
104 <td><div id="div11"></div></td>
105 </tr>
106 <tr><td></br></br></td></tr>
107 <tr>
108 <td>Result looks: </td>
109 <td><div id="div2"></div></td>
110 </tr>
111 <tr>
112 <td> Buffer: </td>
113 <td><div id="div3" style="unicode-bidi: bidi-override;"></div></td>
114 </tr>
115 <tr>
116 <td>Maps </td>
117 <td><div id="div4"></div></td>
118 </tr>
119 <tr>
120 <td>Source to Target: </td>
121 <td><div id="div5" style="font-family: 'Courier New';"></div></td>
122 </tr>
123 <tr>
124 <td>Target to Source: </td>
125 <td><div id="div6" style="font-family: 'Courier New';"></div></td>
126 </tr>
127 <tr>
128 <td>Levels: </td>
129 <td><div id="div7" style="font-family: 'Courier New';"></div></td>
130 </tr>
131 </table>
132 </br></br>
133 <table>
134 <tr>
135 <table><tr>
136 <td>Source format:</td>
137 <td><select id="sform">
138 <option value="I">Implicit</option>
139 <option value="V">Visual</option>
140 </select></td>
141 <td><select id="sdir">
142 <option value="L">LTR</option>
143 <option value="R">RTL</option>
144 <option value="C">Contextual LTR</option>
145 <option value="D">Contextual RTL</option>
146 </select></td>
147 <td><select id="sswap">
148 <option value="Y">Y</option>
149 <option value="N">N</option>
150 </select></td>
151 <td><select id="sshap">
152 <option value="N">N</option>
153 <option value="S">S</option>
154 </select></td>
155 </tr>
156 <tr>
157 <td>Target format:</td>
158 <td><select id="tform">
159 <option value="V">Visual</option>
160 <option value="I">Implicit</option>
161 </select></td>
162 <td><select id="tdir">
163 <option value="L">LTR</option>
164 <option value="R">RTL</option>
165 <option value="C">Contextual LTR</option>
166 <option value="D">Contextual RTL</option>
167 </select></td>
168 <td><select id="tswap">
169 <option value="N">N</option>
170 <option value="Y">Y</option>
171 </select></td>
172 <td><select id="tshap">
173 <option value="N">N</option>
174 <option value="S">S</option>
175 </select></td>
176 </tr></table>
177 </tr>
178 </table>
179 </br>
180 <button id="b1" height="50px" onClick="doTransform();">Go</button>
181 </body>
182 </html>