This is an old revision of the document!


Chapter 6: JS Variables

HWZT chapter 6 (JS Variables):

A few things have changed since How To Write a Zotero Translator was written. To use its first Scaffold example as an example:

  1. Ensure the first sample page is open in your browser and has focus.
  2. Open Scaffold 2.0 from the Firefox main menu with Tools>Scaffold. This should popup dialog=“Zotero Scaffold”.
  3. If you are not already in tab=Metadata, select that. Enter some text in the Label and Creator fields.
  4. The URI of the sample page has changed since HWZT, so you will need to enter Target=
    http://niche-canada.org/member-projects/zotero-guide/
  5. Hit button=“Test Regex”. You should get a result, in the “Test Frame” on the right of the tab, similar to that described in HWZT.
  6. Instead of
    Click on the "Detect Code" tab

    , click on tab=Code. As directed, in that tab enter the expressions

    var myVariable=4;
    Zotero.debug(myVariable);
  7. Click on icon=“Run doWeb” (a stylized thunderbolt) to obtain an evaluation like
    12:00:00 ===>4<===(number)
  8. To also obtain an evaluation like
    12:00:00 detectWeb returned type "undefined"

    , you will need to also click on icon=“Run detectWeb” (the eye next to the thunderbolt).

The subsequent examples behave similarly.

Next: * Chapter 7: JavaScript Methods & Math

dev/how_to_write_a_zotero_translator_2nd_edition/chapter_6.1301860193.txt.gz · Last modified: 2011/04/03 15:49 by debweb