Tool for making it easier to add references on Wikidata, with help of the Citoid service. This master branch is configured for test.wikidata. For the source usable on wikidata, switch to the openrefine branch.
The tool works currently as a user script on-wiki. To enable the script, add something like the following to your user's common.js page (e.g. "User:ExampleUser/common.js") on the wiki:
mw.loader.using(['wikibase'], function() {
$.getScript( 'https://www.wikidata.org/w/index.php?title=User:Mvolz_(WMF)/CiteTool.js&action=raw&ctype=text/javascript', function() {
var citeTool = new wb.CiteTool( 'https://www.wikidata.org/w/index.php?title=User:Mvolz_(WMF)/CiteProperties.json&action=raw&ctype=application/json' );
citeTool.init();
});
});
Alternatively you can generate the code yourself following the directions below and modify for your own use.
The complete CiteTool.js file is generated by running gulp. You must have node and npm installed already or install it if not. After cloning this repository using git, navigate inside the folder and run:
npm install
npm install -g gulp-cli
gulp
Your output should look something like this:
[12:19:46] Using gulpfile ~/code/wikidata-citoid-gadget/gulpfile.js
[12:19:46] Starting 'jshint'...
[12:19:46] Finished 'jshint' after 8.99 ms
[12:19:46] Starting 'concat'...
[12:19:46] Finished 'concat' after 900 μs
[12:19:46] Starting 'default'...
[12:19:46] Finished 'default' after 12 μs
[12:19:46] gulp-notify: [JSHint] JSHint passed
[12:19:46] gulp-notify: [JSHint] JSHint passed
[12:19:46] gulp-notify: [JSHint] JSHint passed
[12:19:46] gulp-notify: [JSHint] JSHint passed
[12:19:46] gulp-notify: [JSHint] JSHint passed
[12:19:46] gulp-notify: [JSHint] JSHint passed
If you already have gulp installed and you get an error, you may need to uninstall gulp and install gulp-cli instead, as this may mean you have an older version.
npm rm -g gulp
npm install -g gulp-cli
You can now find the concatenated CiteTool.js file in the /dist/ directory.
Code includes Sparql.js from wikidata query gui, which is under Apache license:
https://github.com/wikimedia/wikidata-query-gui/blob/master/LICENSE
Code copyright Katie Filbert under the MIT license.
Forked by Mvolz and released under the same license.