Wikidata:Tools/User scripts

From Wikidata
Jump to: navigation, search

User scripts
User scripts are also scripts created by users but they do not appear in the preferences. Instead you have to add a line of code into your common.js file to use the script. User scripts can be created by anyone and might not always be stable.
Other languages:
dansk • ‎Deutsch • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Lëtzebuergesch • ‎latviešu • ‎Nederlands • ‎polski • ‎پښتو • ‎русский • ‎српски / srpski • ‎中文


User Interface[edit]

AltLabels

by Joern

If you're viewing an item for which there's no label in your current language this will insert the 3 most common labels across other languages below the input box. A simple click on one of them will approve & submit it for the current user language

Limitations and other info
  • works with the user's default language, but localization of popups and messages currently missing
How to use

Add the following to your common.js

importScript( 'User:Joern/altLabels.js' );


Ancestry viewer

by Ch1902

This tool adds a sidebar link to show an ancestry/pedigree chart of the person you are currently viewing and to be able to navigate around their relations. A pedigree chart is different from a family tree, it only shows the father and mother of each person up through the generations, but if you click on the person in the chart it will load spouses and other children to allow you to jump to that person and view their ancestry instead.

Limitations and other info
  • Viewing spouses and children requires links in both directions (that is, Person A has a child Person B then Person B should have father/mother Person A), some relations added by bot don't link in both ways. In that case you can see the relations better using GeneaWiki or add the connections yourself.
  • People without parents are shown as a grey box with "Unknown", not every person will have a wiki article
  • There is no history, so you can't easily go back to previous people you have viewed
  • If you want to go to the person's wikidata entry hold the Shift or Ctrl or Alt key when clicking or use the middle click on your mouse to open the link
  • If an item doesn't have a label in your language it just shows the Q##### number
  • It uses templates from enwiki, so you need a browser that supports CORS, most modern browsers do
How to use

Add the following to your common.js

mw.loader.load('//www.wikidata.org/w/index.php?title=User:Ch1902/ancestry.js&action=raw&ctype=text/javascript');

To customise the options use this instead

ancestry_opts = {
   lang: 'en',  // display language falls back to en
   levels: 4,  // number of generations to show, minimum 2, maximum 6
   boxsize: 165,  // width of person cells
   truncate: 22  // truncate names longer than this
};
mw.loader.load('//www.wikidata.org/w/index.php?title=User:Ch1902/ancestry.js&action=raw&ctype=text/javascript');


DMY dates

by Ricordisamoa

Makes all dates in claims appear as "dd month-name-in-your-language yyyy". Requires the "date" option to be set to "dmy".

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/DMYdates.js' );

Internationalization

This script uses MediaWiki's built-in messages to provide a professional translation system.


GeneaWiki.js

by Ricordisamoa

For people with kinship relations, adds a link to GeneaWiki for viewing a family tree.

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/GeneaWiki.js' );

Internationalization

This script is translated with ScriptTranslator: you can view its messages here.


Label Collector

by YMS
Label Collector

A script to semi-automatically import labels, descriptions and aliases for multiple languages based on the articles in Wikipedia and other Wikimedia projects. Suggests descriptions by extracting definitions from article introductions, aliases based on what's bolded in the article introduction, and labels from the article title, and provides a mask to compare existing values with the suggestions made and the article introductions, and to review and edit them all at once. When finished, optionally the next item with no label or description can be loaded automatically, allowing fast processing of many items.


See User:YMS/LC for a more detailed documentation.

How to use

Please write the following line into your common.js: importScript( 'User:YMS/labelcollect.js' ); // [[User:YMS/labelcollect.js]]


logoLinks - Compact toc

by FRacco
Wikidata logoLinks full page screenshot.jpg

Replaces link text to Wikimedia projects in the table of contents at the beginning of the page with the logo of the projects.

How to use

Please write the following line into your common.js: importScript( 'User:FRacco/logoLinks.js' ); // [[User:FRacco/logoLinks.js]]

Bugs

If it does not work, or it is too slow to load, you can try to import the code directly. Please write the following line into your common.js

{{subst:User:FRacco/logoLinks.js}}
Internationalization

This script doesn't need to be localized.


Sitenames in user-language

by Ricordisamoa
SitenamesInUserLanguage on Wikidata.png

Makes language names in sitelinks appear in your language.

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/SitenamesInUserLanguage.js' );

Internationalization

This script doesn't need to be localized.


StatementSort

by Soulkeeper

Sort the order of statements inside an item.

How to use

Please write the following line into your common.js: importScript( 'User:Soulkeeper/statementSort.js' ); // [[User:Soulkeeper/statementSort.js]]


Taxobox

by FelixReimann

Shows the taxobox for each item which has taxon name (P225).

How to use

Please write the following line into your common.js: importScript( 'User:FelixReimann/taxobox.js' ); // [[User:FelixReimann/taxobox.js]]


WikidataTrust

by Ricordisamoa

Inspired by the original WikiTrust, it's a fairly simple algorithm which loops into all revisions of the current entity and attributes changes of claims, sitelinks, labels and descriptions to the users who made them.


It is still in beta, but should work fine.

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/WikidataTrust.js' );

Internationalization

This script doesn't use any localization system at the moment.


Wikispecies.js

by Ricordisamoa

It provides a link to Wikispecies for elements with taxon name (P225), and an image for IUCN conservation status (P141).

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/Wikispecies.js' );

Internationalization

This script doesn't use any localization system at the moment.


Statements[edit]

authority_control.js

by Magnus Manske

Searches VIAF and en/de/fr Wikipedia articles for an item to find Authority Control data. Shows which are already used, which disagree, and which are new. Single-click adding for individual values or sets.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus_Manske/authority_control.js' );


Consistency check

by Magnus Manske

A tool to check consistencies of statements, that is, if B is "child" of A, then A should be "father" or "mother" of B.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus Manske/consistency_check.js' ); // [[User:Magnus Manske/consistency_check.js]]


The (original) script is broken as of 2013-11-17, see User talk:Magnus Manske/consistency check.js.

Forks:


Import statements

by Magnus Manske
Link for Import statements. No further interface.

Scans templates on the corresponding en.wikipedia article, and adds applicable statements (e.g. from Taxobox). Fully automated. Click, wait 10 sec, see how many were added, reload.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus Manske/import statements.js' ); // [[User:Magnus Manske/import statements.js]]


Sourcerer

by Magnus Manske
Sourcerer screenshot.png

Click on new "Sourcerer" link in toolbox to get a list of all external links from all language editions of Wikipedia for an item. The list also shows the number of languages that link to a URL, and lists the top ones first. Useful for using URLs to source statements.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus Manske/sourcerer.js' ); // [[User:Magnus Manske/sourcerer.js]]


The Brown Tool

by Goldzahn

Adds a box to the right side of the page. There are some predefined property-items (man, woman, some occupations from User:ValterVB/Sandbox and the main types) stored in three selects, which gets activated by clicking on them. But the main feature is that the user can input property-item pairs for repeated use.

First, there is a flexible storage system, which uses cookies. After the start there is only one row for a property (p) and one for a value (q). By clicking p+ and q+ you can add as much rows as you need. If you write in a property, an item, or a short text (label) this will be saved in the cookies. That means, after checking an property-item pair, which transfers the inputs to the Wikidata datasource, you can go to the next item and what you typed into the storage system is still there and can be used again.

The second option is a file in the Wikidata userspace. Each user has a separate wikipage where he or she could write in some property-item pairs, which uses the tool to fill an additional select. The address is User:your username/data. Take as example User:Goldzahn/data. In this way data is stored until it is deleted, while the data stored in cookies last only as long as the browser is not closed.

How to use

Please write the following line into your common.js: importScript( 'User:Goldzahn/wikidata useful.js' );


Wikidata useful

by Magnus Manske
Wikidata useful.png

Adds a box of quick "add statement" links to the right side of the page. Entity and phylogeny types, countries (location and citizenship). More to come. Also, tries to load and display a blurb from en or de wikipedia.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus Manske/wikidata_useful.js' ); // [[User:Magnus Manske/wikidata_useful.js]]


Interwikilinks[edit]

InterwikiList

by Ricordisamoa

Generates a list of "old" interwiki links from an item, to be quickly copied e.g. on Wikimedia Commons.

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/InterwikiList.js' );

Internationalization

This script is translated with ScriptTranslator: you can view its messages here.


iwconflict.js

by Bene*

Tool to report an interwiki conflict at Wikidata:Interwiki conflicts.

How to use

Please write the following line into your common.js: importScript( 'User:Bene*/iwconflict.js' );

Internationalization

This script uses a built-in localization system: you can request for any translation to be added on the talk page of the script, or on the author's talk page.


Userscripts for Wikipedia[edit]

Check site links

by Yair rand

When editing a Wikipedia article, the script adds an action link (near search box) to remove the sitelinks which are already available on Wikidata.

How to use

Please write the following line into your common.js on Wikipedia (change en in the URL for non-en.wikipedia):

// [[d:User:Yair rand/checksitelinks.js]]
mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair_rand/checksitelinks.js&action=raw&ctype=text/javascript");


Display Wikidata Info on sister projects (Wikipedia, Wikivoyage, Commons, ...)

by Yair rand

(I'm not sure this really counts as a "Wikidata tool" as it's run while browsing Wikipedia, but it seems like it belongs here...) This script adds a small box under a Wikipedia article's title displaying a label (which links to Wikidata's entry), description, and aliases, or a small "Wikidata item not found." linking to CreateItem if Wikidata does have a item for it yet.

How to use

Please write the following line into your common.js on Wikipedia:

// [[d:User:Yair rand/WikidataInfo.js]]
mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript");


Missing properties

by Magnus Manske

For certain item types (e.g. "book"), list all the potential but missing properties. Click on one to add it.

How to use

Please write the following line into your common.js: importScript( 'User:Magnus Manske/missing props.js' );


Other[edit]

Fake Rollback

by Ricordisamoa

Provides the [rollback] link to non-rollbackers (still experimental in Q and P namespaces).

How to use

Please write the following line into your common.js: importScript( 'User:Ricordisamoa/Rollback.js' );

Internationalization

This script uses MediaWiki's built-in messages to provide a professional translation system.


Switch to Wikidata

From any Wikipedia article of any languages, switch to the corresponding item at Wikidata by add this link to the bookmark of your browser.

How to use
javascript:location='//www.wikidata.org/wiki/Special:ItemByTitle/'+wgDBname+'/'+wgPageName


userwarn.js

by Bene*

Tool to add warn templates to user's talk pages

How to use

Please write the following line into your common.js: importScript( 'User:Bene*/userwarn.js' );