Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
dev:client_coding:javascript_api [2019/08/05 05:54] – [Running Ad Hoc JavaScript in Zotero] dstillman | dev:client_coding:javascript_api [2019/10/20 06:32] – [Managing citations and bibliographies] zuphilip | ||
---|---|---|---|
Line 13: | Line 13: | ||
- In the window that opens, enter JavaScript in the Code textbox and click Run or press Cmd-R/ | - In the window that opens, enter JavaScript in the Code textbox and click Run or press Cmd-R/ | ||
- | When running asynchronous code containing '' | + | When running |
- | In synchronous mode, the value of the final line will appear in the right-hand pane. | + | <code javascript> |
+ | var items = Zotero.getActiveZoteroPane().getSelectedItems(); | ||
+ | return items; | ||
+ | </ | ||
+ | |||
+ | In **synchronous** mode, the value of the final line will appear in the right-hand pane. The same result as above could be achieved in synchonous mode with | ||
+ | |||
+ | <code javascript> | ||
+ | var items = Zotero.getActiveZoteroPane().getSelectedItems(); | ||
+ | items; | ||
+ | </ | ||
===== Zotero Code Architecture ===== | ===== Zotero Code Architecture ===== | ||
Line 232: | Line 242: | ||
<code javascript> | <code javascript> | ||
- | ===== Managing citations and bibliographies | + | ==== Managing citations and bibliographies ==== |
TODO: this is pretty sparse. | TODO: this is pretty sparse. | ||
- | ==== Getting a bibliography for an array of items: | + | === Getting a bibliography for an array of items: === |
Here we use Zotero' | Here we use Zotero' | ||
Line 244: | Line 254: | ||
<code javascript> | <code javascript> | ||
- | var biblio | + | var format |
- | var biblio_html_format = cite.html; | + | if (format.split(" |
- | var biblio_txt | + | |
+ | } | ||
+ | var biblio = qc.getContentFromItems([item], | ||
+ | var biblio_html_format = biblio.html; | ||
+ | var biblio_txt = biblio.text; | ||
</ | </ | ||
- | ==== Get a list of available styles | + | === Get a list of available styles === |
<code javascript> | <code javascript> |