Both sides previous revisionPrevious revision | |
dev:how_to_write_a_zotero_translator_2nd_edition:chapter_6 [2017/11/12 19:53] – external edit 127.0.0.1 | dev:how_to_write_a_zotero_translator_2nd_edition:chapter_6 [2017/11/22 11:17] (current) – removed bwiernik |
---|
<html><p id="zotero-5-update-warning" style="color: red; font-weight: bold">We’re | |
in the process of updating the documentation for | |
<a href="https://www.zotero.org/blog/zotero-5-0">Zotero 5.0</a>. Some documentation | |
may be outdated in the meantime. Thanks for your understanding.</p></html> | |
| |
| |
===== Chapter 6: JS Variables ===== | |
| |
[[http://niche-canada.org/member-projects/zotero-guide/chapter6.html|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 [[http://niche-canada.org/member-projects/zotero-guide/sample1.html|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=<code>http://niche-canada.org/member-projects/zotero-guide/</code> | |
- 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 <code>Click on the "Detect Code" tab</code>, click on tab=Code. As directed, in that tab enter the expressions <code>var myVariable=4; | |
Zotero.debug(myVariable); | |
</code> | |
- Click on icon="Run doWeb" (a stylized thunderbolt) to obtain an evaluation like <code>12:00:00 ===>4<===(number)</code> | |
- To also obtain an evaluation like <code>12:00:00 detectWeb returned type "undefined"</code>, you will need to also click on icon="Run detectWeb" (the eye next to the thunderbolt). | |
| |
The subsequent examples behave similarly. | |
| |
**Next**: * [[dev/How to Write a Zotero Translator, 2nd Edition/Chapter 7|Chapter 7: JavaScript Methods & Math]] | |