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:
- Ensure the first sample page is open in your browser and has focus.
- Open Scaffold 2.0 from the Firefox main menu with Tools>Scaffold. This should popup dialog=“Zotero Scaffold”.
- If you are not already in tab=Metadata, select that. Enter some text in the Label and Creator fields.
- 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/
- 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.
- 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);
- Click on icon=“Run doWeb” (a stylized thunderbolt) to obtain an evaluation like
12:00:00 ===>4<===(number)
- 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.