Nagoya University translator

I've posted the code for a translator I've written for the Nagoya University OPAC to zotero-dev. The translator works fine for a single entry, but subsequent captures against the same list of hits show only an empty box in the lower right-hand side of the screen, and nothing is captured. The site uses frames, I'm not sure whether that's the source of the problem, or whether I've missed something essential in writing the code. But the scraper seems to work fine in Scaffold.

Here's the search form URL for our library:

http://opac.nul.nagoya-u.ac.jp/imain_en_utf-8.html

Many thanks,
Frank Bennett

PS: initially posted the code as an attachment to zotero-dev, then realized I could just upload it to the list. I've done that now, it's the file "nagoya-translator-hang.txt".
  • edited January 9, 2009
    One additional thing on this. The JS error console shows this:
    Error: uncaught exception: cannot translate: no translator specified
    I guess something gets set when FF navigates down to the page that is being lost when the top frame remains unaltered but the frame content changes (if I navigate away and back again, it will work one time again on any search hit; it will also work repeatedly if the content frame remains unchanged). Odd.
  • It's a bug in Zotero's frame handling. We should have a patch in a day or two.

    Here's a stopgap solution:

    --- chrome/content/zotero/browser.js (revision 3941)
    +++ chrome/content/zotero/browser.js (working copy)
    @@ -364,9 +364,13 @@
    * called to unregister Zotero icon, etc.
    */
    function contentHide(event) {
    - if(event.originalTarget instanceof HTMLDocument && !event.originalTarget.defaultView.frameElement) {
    + if(event.originalTarget instanceof HTMLDocument) {
    var doc = event.originalTarget;

    + while(doc.defaultView.frameElement) {
    + doc = doc.defaultView.frameElement.ownerDocument;
    + }
    +
    // Figure out what browser this contentDocument is associated with
    var browser;
    for(var i=0; i<this.tabbrowser.browsers.length; i++) {


    This isn't the best approach, but it'll let you keep working on the translator in the meantime if you're already running a modified build.
  • edited January 10, 2009
    Many thanks -- it must be getting on toward 1 AM where you are. I feel a tad guilty (but also very grateful).

    PS: Tried it out, and the patch does its job. Great stuff.
  • The frame issue is now fixed on the 1.0 branch and trunk.

    I've added the translator to the 1.0 branch, so users of the dev XPI (and 1.0.10, when it comes out) will get it, but I'm not pushing it to existing clients due to the frame problem.
Sign In or Register to comment.