Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:client_coding:javascript_api [2020/10/17 21:08] – [Batch Editing] dstillman | dev:client_coding:javascript_api [2022/07/02 18:22] (current) – [Executing the search] dstillman | ||
---|---|---|---|
Line 36: | Line 36: | ||
Non-window scope applies to lower-level code that doesn' | Non-window scope applies to lower-level code that doesn' | ||
- | Overlays and windows | + | Windows |
- | To access Zotero functionality from your own extension, you will need access to the core '' | + | To access Zotero functionality from your own extension, you will need access to the core '' |
<code html> | <code html> | ||
Line 87: | Line 87: | ||
] | ] | ||
); | ); | ||
- | var itemID = await item.save(); | + | var itemID = await item.saveTx(); |
return itemID; | return itemID; | ||
</ | </ | ||
Line 216: | Line 216: | ||
s.addCondition(' | s.addCondition(' | ||
s.addCondition(' | s.addCondition(' | ||
+ | </ | ||
+ | |||
+ | === Search by creator === | ||
+ | |||
+ | <code javascript> | ||
+ | var name = ' | ||
+ | s.addCondition(' | ||
</ | </ | ||
Line 236: | Line 243: | ||
results: | results: | ||
- | <code javascript> | + | <code javascript> |
This returns the item ids in the search as an array. The next thing to do is to get the Zotero items for the array of IDs: | This returns the item ids in the search as an array. The next thing to do is to get the Zotero items for the array of IDs: | ||
- | <code javascript> | + | <code javascript> |
==== Managing citations and bibliographies ==== | ==== Managing citations and bibliographies ==== | ||
Line 340: | Line 347: | ||
return fulltext; | return fulltext; | ||
</ | </ | ||
+ | |||
+ | ==== File I/O ==== | ||
+ | |||
+ | === Getting the contents of a file === | ||
+ | |||
+ | <code javascript> | ||
+ | var path = '/ | ||
+ | var data = await Zotero.File.getContentsAsync(path); | ||
+ | </ | ||
+ | |||
+ | === Saving data to a file === | ||
+ | |||
+ | <code javascript> | ||
+ | var path = '/ | ||
+ | var data = "This is some text."; | ||
+ | await Zotero.File.putContentsAsync(path, | ||
+ | </ | ||
+ | |||
==== To Do === | ==== To Do === |