Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dev:client_coding:javascript_api [2019/10/20 06:32]
zuphilip [Managing citations and bibliographies]
dev:client_coding:javascript_api [2019/10/20 06:46] (current)
zuphilip [API Methods]
Line 249: Line 249:
  
 Here we use Zotero'​s Quick Copy functions to get a bibliography in the style Here we use Zotero'​s Quick Copy functions to get a bibliography in the style
-specified in Zotero'​s preferences.+specified in Zotero'​s preferences. We will in the following example create this 
 +bibliography from all currently selected items.
  
-First we start with a list of as in the previous entry. +<code javascript>​var items = Zotero.getActiveZoteroPane().getSelectedItems();​ 
- +var qc = Zotero.QuickCopy;​
-<code javascript>​var qc = Zotero.QuickCopy;​+
 var format = Zotero.Prefs.get("​export.quickCopy.setting"​);​ var format = Zotero.Prefs.get("​export.quickCopy.setting"​);​
 if (format.split("​="​)[0] !== "​bibliography"​) { if (format.split("​="​)[0] !== "​bibliography"​) {
-   return ​"No bibliography style is choosen in the settings for QuickCopy.";​+   alert("No bibliography style is choosen in the settings for QuickCopy."​);
 } }
-var biblio = qc.getContentFromItems([item], format);+var biblio = qc.getContentFromItems(items, format);
 var biblio_html_format = biblio.html;​ var biblio_html_format = biblio.html;​
 var biblio_txt = biblio.text;​ var biblio_txt = biblio.text;​
 </​code>​ </​code>​
 +
 +If you instead want to have the citation string then simply replace the 7th
 +line with ''​var biblio = qc.getContentFromItems(items,​ format, null, true);''​.
 +
  
 === Get a list of available styles === === Get a list of available styles ===
Line 275: Line 279:
 </​code>​ </​code>​
  
-TODO:  get citations. ​ ​change the style. ​ get stuff in other formats,+TODO:  change the style. ​ get stuff in other formats,
 especially RTF especially RTF
  
dev/client_coding/javascript_api.txt · Last modified: 2019/10/20 06:46 by zuphilip