User:BrandonXLF/Citoid

Citoid.js is a utility that returns a valid MediaWiki reference using Citoid. After loading the script, the function  takes a URL, DOI, ISBN, PMID, PMCID, or QID and returns a reference in the format   through a jQuery Promise/Deferred object. The script can be loaded from. The source code can be found at User:BrandonXLF/Citoid.js. The output should be used within  tags.

Documentation
This utility has one function scoped to the window,.

accepts a URL, DOI, ISBN, PMID, PMCID, or QID to get the reference of and returns a jQuery Promise object.

The Promise resolve calls a function and provides two parameters, the reference and the source of the reference.

The Promise reject calls a function and provides one parameter, the text status for why the function failed.

The Promise notify calls a function and provides one parameter, the text status of the function.

Example
The example about will output (to the console): This is the reference for the book with the ISBN 13 9781857800913.

Loading
The module should be loaded using  or   with a then statement that can use the function   to generate a reference (see the example above). If you need to load severl different scripts or gadgets, you can use.