User:Christian Ferrer/common.js

From Wikispecies
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
////////// link named "Article list in Wikidata" in the Toolbox section, to a query giving the articles list (item, item label, year, Wikispecies, Wikimedia Commons) for which the person is noted as the author in Wikidata //////////

function tl(){
  if( mw.config.get( 'wgNamespaceNumber' ) == 0) 
  {
		mw.util.addPortletLink('p-tb', 'https://query.wikidata.org/embed.html#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20(YEAR(%3Fdate_de_publication)%20as%20%3Fyear)%20%3Fwikispecies%20%3FwikimediaCommons%20WHERE%20{%0A%20%20SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22[AUTO_LANGUAGE]%2Cen%22.%20}%0A%20%20{%0A%20%20%20%20SELECT%20DISTINCT%20%3Fitem%20WHERE%20{%0A%20%20%20%20%20%20%3Fitem%20p%3AP50%20%3Fstatement0.%0A%20%20%20%20%20%20%3Fstatement0%20(ps%3AP50%2F(wdt%3AP279*))%20wd%3A' + mw.config.get('wgWikibaseItemId') + '.%0A%20%20%20%20%20%20%20%20%20%20}%0A%20%20%20%20LIMIT%20100%0A%20%20}%0A%20%20OPTIONAL%20{%20%3Fwikispecies%20schema%3Aabout%20%3Fitem%20%3B%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fspecies.wikimedia.org%2F%3E%20}%0A%20%20OPTIONAL%20{%20%3FwikimediaCommons%20schema%3Aabout%20%3Fitem%20%3B%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fcommons.wikimedia.org%2F%3E%20}%0A%20%20OPTIONAL%20{%20%3Fitem%20wdt%3AP577%20%3Fdate_de_publication.%20}%0A}', 'Article list in Wikidata', null);
  }
}
$.when($.ready,mw.loader.using('mediawiki.util')).then(tl);