Commit 7e3fb173bc60a771351a0d12954dff0b7240d5e8

  • avatar
  • pradeep c <pradeep @admini…ator.(none)>
  • Mon Aug 29 16:23:47 IST 2011
Changed overlay.js
ffext/alipi.xpi
(219 / 249)
Binary files differ
  
5656 }
5757 };
5858 xhr.open("POST","http://x.a11y.in/alipi/menu",true);
59 // xhr.open("POST","http://192.168.1.5/menu",true);
6059 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
6160 xhr.send(String(content.window.location.href));
6261 }
7777 for (j=0; j<v.length; j++) {
7878 c = v[0].appendChild(a);
7979 c.setAttribute("src","http://x.a11y.in/alipi/wsgi/page_edit.js");
80 // c.setAttribute("src","http://192.168.1.5/page_edit.js");
8180 c.setAttribute("type","text/javascript");
8281 }
8382 },
168168 {
169169 if(xhr.readyState == 4)
170170 {
171 if(xhr.responseText == "None")
171 if(xhr.responseText == "empty")
172172 {
173173 a11ypi.clearMenu();
174174 }
228228 ///content.window.location = "http://localhost/replace?url="+url+"&lang="+e.getAttribute("value");
229229 //content.window.reload();
230230 },
231 evaluate: function(path,newContent){
231232
232 // getNarration: function() {
233 // var doc = content.document;
234 // //we get the selections
235 // var selection = content.window.getSelection();
236 // var str = '';
237 // var currentNode = selection.getRangeAt(0).commonAncestorContainer;
238 // var xpath = a11ypi.getxPath(currentNode);
239
240 // var xhr = new XMLHttpRequest();
241 // var url = content.window.location;
242 // var data="url="+encodeURIComponent(url)+"&xpath="+encodeURIComponent(xpath);
233 //evaluate the path
243234
244 // xhr.onreadystatechange = function()
245 // {
246 // if(xhr.readyState == 4)
247 // {
248 // if(xhr.responseText =='empty')
249 // {
250 // alert("There is no re-narration available for this element!");
251 // }
252 // else
253 // {
254 // //alert(xhr.responseText);
255 // d ={}
256 // var response=xhr.responseText.substring(3).split('###');
257 // for (var j= 0; j< response.length ; j++){
258 // chunk = response[j].substring(1).split('&');
259
260 // for (var i= 0; i< chunk.length ; i++){
261 // pair =chunk[i].split("::");
262 // key = pair[0];
263 // value = pair[1];
264 // d[key] = value;
265 // }
266 // path = d['xpath'];
267 // data = d['data'];
268 // alert(path+'\n'+data);
269 // }
270 // }
271 // }
272 // }
273
274 // xhr.open("POST","http://localhost/narration",true);
275 // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
276 // xhr.send(data);//
277
278 // ///content.window.location = "http://localhost/replace?url="+url+"&lang="+e.getAttribute("value");
279 // //content.window.reload();
280 // },
235 var nodes = content.document.evaluate(path, content.document, null, XPathResult.ANY_TYPE,null);
281236
282
283 /* getURL: function(e) {
284 var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] //The service branch which handles the "Window".
285 .getService(Components.interfaces.nsIWindowMediator);
286 var recentWindow = wm.getMostRecentWindow("navigator:browser");
287 recentWindow ? recentWindow.content.document.location : null;
288 var url = content.window.location;
289 content.window.location = "http://192.168.100.100/replace?url="+url+"&lang="+e.getAttribute("value");
290 content.window.reload();
291 },*/
237 try{
238
239 var result = nodes.iterateNext();
240
241 while (result)
242
243 {
244
245 if (result.nameTag == "img" || result.nameTag =='IMG'){
246
247 result.setAttribute('src',newContent);
248
249 }
250
251 else{
252
253 result.textContent = newContent;
254
255 }
256
257 result=nodes.iterateNext();
258
259 }
260
261 }
262
263 catch (e)
264
265 {
266
267 dump( 'error: Document tree modified during iteration ' + e );
268
269 }
270
271 },
292272};
293273window.addEventListener("load", function () { a11ypi.onLoad(); }, false);gBrowser.addEventListener("DOMContentLoaded", a11ypi.test, false);