This is an old revision of the document!


We’re in the process of updating the documentation for Zotero 5.0. Some documentation may be outdated in the meantime. Thanks for your understanding.

Chapter 14: DetectWeb Tab

HWZT chapter 14 (DetectWeb Tab): the tutorial example works in Scaffold 2.0 and Firefox 3.5, with 2 minor exceptions

  1. HWZT says “Save your entry and click Execute”: instead click icon=“Run detectWeb” (the eye)
  2. HWZT says “If you would like to see the Icon in the address bar [of the first sample page], you will likely have to relaunch Firefox”: in fact, if you have in fact saved your entry, you need only reload the page or tab.

As HWZT has gotten increasingly casual, here are some step-by-step instructions for this chapter's tutorial section:

  1. Close any running Scaffold 2.0 instances.
  2. Ensure the first sample page is open in your browser and has focus.
  3. Open Scaffold 2.0 from the Firefox main menu with Tools>Scaffold. This should popup dialog=“Zotero Scaffold”.
  4. Hit icon=Load (the non-OS UI item closest to the upper left of the dialog). This should popup dialog=“Load Translator” displaying a single table mapping “Label” to “Creator”.
  5. Scroll through the “Load Translator” table until you see Label=
    How to Write a Zotero Translator

    , then hit button=OK.

  6. You will return to the main dialog=“Zotero Scaffold”. Check to see that tab=Metadata is properly populated.
  7. Switch to tab=Code and enter the following:
    function detectWeb(doc, url) {
      if (doc.title.match("Single Item")) {
        return "book";
      } else if (doc.title.match("Search Results")) {
        return "multiple";
      }
    }
  8. Click icon=“Run detectWeb” (the eye): in the Test Frame you should get results like
    12:00:00 detectWeb returned type "book"
  9. Click icon=Save (second from left): your translator should save silently.
  10. Return focus to the page or tab containing the first sample page and refresh it: you should see the Zotero book icon in the location field of your Firefox.

Next: Chapter 15: Scraping the Search Results Page: doWeb Function

dev/how_to_write_a_zotero_translator_2nd_edition/chapter_14.1510534411.txt.gz · Last modified: 2017/11/22 11:18 (external edit)