samcctan schrieb: > Hi Holger, > > THanks for your help. > As you said, the approach you suggested is only work in firefox 1.5 > (deerpark alpha2). Anyway, I tried to install it to my firefox, which > is firefox 1.0.6 and obviously it shows that this extension only can > be used in Firefox 1.0+ to 1.1. (1.0+?? Then I suppose my firefox > 1.0.6 shoud be alright :-))
no, 1.0+ means somthing like the alpha version of the next version. when i wrote the extension i did not know that there will be no firefox 1.1 but the next one will be 1.5 this new firefox will have native svg support ( no nedd for a plug in ). > > Anyway, I thought the version I am having now is the latest and I > don't really dare to install firefox 1.5. right, firefox 1.5 isnt even in beta phase, you can download an alpha version ( wich runs in parallel to your existing firefox installation ) here: http://www.mozilla.org/developer/#builds these builds are only intended for extension developers, but since you are developing an extension... you should make sure your extension works in the next version of firefox ;-) > > I was looking through your codes in the .js file and trying to > understand what is going on, as I am quite new in programming and web > development. Talking about adding an eventlistener to the tabbrowser > element and use hth contentDocument to access to the loaded file, > could you give me some ideas on which are those codes involved in > this case? > ok look at the js file, it starts with some vars, and then there is the line window.addEventListener("load", mtOnWindowLoad, false); this gets executed when the browser is started, and adds an eventListener to the onload event of the window, that means that the mtOnWindowLoad function will be called as soon as the browser is loaded completely. function mtOnWindowLoad() { appContent = window.document.getElementById("content"); if (appContent) appContent.addEventListener("focus", mtOnDocumentFocus, true); appContent.addEventListener("blur", mtOnDocumentblur, true); } the element with the id "content" is the tabedbrowser, this is the area in firefox where the documents are shown. i add two eventlisteners to this tabedbrowser, "focus" and "blur", you could register only one handler here, the "load" handler. so in your case it will look like this: function mtOnWindowLoad() { appContent = window.document.getElementById("content"); if (appContent) appContent.addEventListener("load", documentLoaded, true); } so in your case you only need one other function; documentLoaded() in this function you can access the currently loaded file with svgDoc=appContent.contentDocument sure you have to test if the current document is really an svg document, but then you can get all elements and attributes with getElementsByTagNameNS() and getAttributeNS(). here is a simple firefox extension tutorial. http://www.borngeek.com/firefox/tutorial/part_06.html hth Holger > Thanks, > S. > > --- In [email protected], Holger Will <[EMAIL PROTECTED]> > wrote: > > samcctan schrieb: > > > > > Hi Holger, > > > > > > What do you mean "there is no way to communicate between ASV and > > > firefox"? > > > > > > I am doing a project to improve the accessibility of the graphics > to > > > the blind and visually impaired people by using some assistive > devices, > > > such as audio and haptic. I am now concentrating on SVG graphics, > > > especially for graphs. So, I am planning to have a plugin for the > > > browsers. At the moment, we are concentrating on creating a > firefox > > > extension, but eventually we would like to have a plugin for IE > as well. > > > > > > Anyway, I wrote a JavaScipt to extract the desired and important > data > > > and information from a SVG file, by using getAttribute, > > > getElementsByTagName and so on. It is working at the moment but > only if > > > I read the SVG file which saved in the same directory in my local > > > machine. > > > > > > This is snippet of my Code: > > > > > > function init(){ > > > readXML(SVGBarGrap.svg"); > > > } > > > function readXML(url){ > > > if (window.XMLHttpRequest) { > > > req = new XMLHttpRequest(); > > > req.overrideMimeType ("text/xml"); > > > req.onreadystatechange = processReqChange; > > > req.open("GET", url, true); > > > req.send(null); > > > } else if (window.ActiveXObject) { > > > req = new ActiveXObject("Microsoft.XMLHTTP"); > > > if (req) { > > > req.onreadystatechange = processReqChange; > > > req.open("GET", url, true); > > > req.send(); > > > } > > > } > > > } > > > function processReqChange() { > > > if (req.readyState == 4 && req.responseXML) { > > > var resp = req.responseXML; > > > parseSVGFile(resp); > > > } > > > } > > > > > > But now, I would like to create this plugin which can extract the > data > > > and information from any of the SVG graph from any of the > webpage. But > > > I am not too sure how could I do that now. My idea is: When the > user > > > browse through a webpage, and found a SVG Graph on one of the > webpage, > > > then he will clock on a link to "view SVG". Then I suppose a new > window > > > with SVG graph will pop up. I would then like to have my plugin > to work > > > at this point, by directing my audio and haptic to represent the > > > content of the graph. > > > > > > But I don't have any idea to read a file from a remote server. Or > I > > > should save the file on to the user's machine, but I am wondering > can > > > JavaScript does that.... > > > > > > Is all these make any sense? > > > > > > Many Thanks, > > > > > > Sam > > > > > > > > > > yes i think i get it now. you are writing an extension , so i think > > there is no reason you should load any document, > > since the documents you want to handle, are allready loaded by the > browser ! > > so you could do the following: > > you can add an eventlistener to the <tabbrowser> element. > > you can then use the contentDocument property of said tabbrowser > > element to gain access to the currently loaded file. > > or you can iterate through all embed and object elements and get a > > reference to the included documents. > > > > this is the basic framework i used to implement my zoom and pan > extension. > > > > http://www.treebuilder.de/zoomandpan/index.htm > > > > you can look at the code to find out how its done by downloading > the > > .xpi , renaming it to .zip unzip it > > change to the unziped folder, open the chrome folder, rename > > svgdevtools.jar to svgdevtools.zip , unzip it, > > change to chrome/content and look at the svgdevtools.js . > > > > but note that all this will only work in firefox 1.5 (deerpark > alpha2). > > > > hth > > Holger > > > > > > > > > > > > > > > > > > ----- > > > To unsubscribe send a message to: > > > [EMAIL PROTECTED] > > > -or- > > > visit http://groups.yahoo.com/group/svg-developers and > click "edit my > > > membership" > > > ---- > > > > > > > > > ------------------------------------------------------------------ > ------ > > > YAHOO! GROUPS LINKS > > > > > > * Visit your group "svg-developers > > > <http://groups.yahoo.com/group/svg-developers>" on the web. > > > > > > * To unsubscribe from this group, send an email to: > > > [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED] > subject=Unsubscribe> > > > > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > > Service <http://docs.yahoo.com/info/terms/>. > > > > > > > > > ------------------------------------------------------------------ > ------ > > > > > > > > > ----- > To unsubscribe send a message to: > [EMAIL PROTECTED] > -or- > visit http://groups.yahoo.com/group/svg-developers and click "edit my > membership" > ---- > > > ------------------------------------------------------------------------ > YAHOO! GROUPS LINKS > > * Visit your group "svg-developers > <http://groups.yahoo.com/group/svg-developers>" on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/>. > > > ------------------------------------------------------------------------ > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hf8b05i/M=362329.6886308.7839368.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1124216199/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

