MediaWiki:Gadget-AuthorityControl.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
adding per talk page |
Ricordisamoa (talk | contribs) fix UI class per Special:PermanentLink/67573656#What happened to the 'Move' gadget? |
||
Line 138: | Line 138: | ||
if( parent.size() < 1 ) parent = $( e ).parents( '.wb-referenceview' ).first(); |
if( parent.size() < 1 ) parent = $( e ).parents( '.wb-referenceview' ).first(); |
||
parent |
parent |
||
.find( '.wb-editsection . |
.find( '.wb-editsection .wikibase-toolbarbutton' ) |
||
.on( 'click', function() { // show the textarea and hide the link when the user clicks 'edit' |
.on( 'click', function() { // show the textarea and hide the link when the user clicks 'edit' |
||
$( e ).show().next().hide(); |
$( e ).show().next().hide(); |
Revision as of 08:14, 30 August 2013
/* <nowiki>
*
* AuthorityControl.js by [[User:Ricordisamoa]]
* Provides a link to various Authority Control tools (VIAF, GND, etc.)
* for Wikidata elements that have related properties
*/
$( document ).ready( function() {
if( mw.config.get( 'wgNamespaceNumber' ) === 0 && mw.config.exists( 'wbEntityType' ) && mw.config.get( 'wbEntityType' ) === 'item' ) { // only on items, not properties or other namespaces
var baseLanguage = mw.config.get( 'wgUserLanguage' ).replace( /^([a-z]*).*$/g, '$1' );
var properties = {
212: mw.util.wikiGetlink('Special:BookSources') + '/$1', // ISBN-13
213: 'http://isni-url.oclc.nl/isni/$1', // ISNI
214: 'http://viaf.org/viaf/$1/', // VIAF
220: 'http://www-01.sil.org/iso639-3/documentation.asp?id=$1', // ISO 639-3
225: '//species.wikimedia.org/wiki/$1', // taxon name
227: 'http://d-nb.info/gnd/$1', // GND
236: 'http://www.worldcat.org/search?fq=x0:jrnl&q=n2:$1', // ISSN
243: 'http://worldcat.org/oclc/$1&lang=' + baseLanguage, // OCLC
244: 'http://lccn.loc.gov/$1', // LCCN
245: 'http://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=$1', // ULAN
247: 'http://nssdc.gsfc.nasa.gov/nmc/spacecraftDisplay.do?id=$1', // NSSDC ID
268: 'http://catalogue.bnf.fr/ark:/12148/cb$1/PUBLIC', // BNF
269: 'http://www.idref.fr/$1', // SUDOC
270: 'http://opac.calis.edu.cn/aopac/ajsp/detail.jsp?actionfrom=1&actl=CAL++$1%23', // CALIS
271: 'http://ci.nii.ac.jp/author/$1', // CiNii
345: 'http://www.imdb.com/Name?$1', // IMDb
347: 'http://www.culture.gouv.fr/public/mistral/joconde_fr?ACTION=CHERCHER&FIELD_1=REF&VALUE_1=$1', // Joconde
349: 'http://id.ndl.go.jp/auth/ndlna/$1', // NDL
350: 'http://www.rkd.nl/rkddb/dispatcher.aspx?action=search&database=ChoiceImages&search=priref=$1', // RKDimages
351: 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=retrieve&dopt=default&list_uids=$1', // Entrez Gene
352: 'http://www.uniprot.org/uniprot/$1', // Uniprot
354: 'http://www.genenames.org/data/hgnc_data.php?hgnc_id=$1', // HGNC
356: 'http://dx.doi.org/$1', // DOI
359: 'http://monumentenregister.cultureelerfgoed.nl/php/main.php?cAction=search&cOffset=1&cLimit=25&oOrder=ASC&cSubmit=1&sCompMonNr=$1', // Rijksmonument
373: '//commons.wikimedia.org/wiki/Category:$1', // Commons category
374: 'http://www.insee.fr/fr/bases-de-donnees/esl/comparateur.asp?codgeo=com-$1', // INSEE commune code
377: 'http://www.n2yo.com/satellite/?s=$1', // SCN
380: 'http://www.culture.gouv.fr/public/mistral/merimee_fr?ACTION=CHERCHER&FIELD_1=REF&VALUE_1=$1', // Mérimée
381: '//toolserver.org/~erfgoed/api/api.php?action=search&format=html&srcountry=ch&srid=$1', // KGS identifier
396: 'http://id.sbn.it/af/$1', // SBN
402: 'http://www.openstreetmap.org/?relation=$1', // OpenStreetmap
409: 'http://nla.gov.au/anbd.aut-an$1', // NLA
428: 'http://www.ipni.org/ipni/advPlantNameSearch.do?find_includePublicationAuthors=on&find_includePublicationAuthors=off&find_includeBasionymAuthors=on&find_includeBasionymAuthors=off&find_rankToReturn=all&output_format=normal&find_authorAbbrev=$1', // botanist author abbreviation
434: 'http://musicbrainz.org/artist/$1', // MusicBrainz Artist ID
435: 'http://musicbrainz.org/work/$1', // MusicBrainz Work ID
436: 'http://musicbrainz.org/release-group/$1', // MusicBrainz Release Group ID
454: 'http://' + ( $.inArray( baseLanguage, ['de', 'en', 'fr'] ) !== -1 ? baseLanguage : 'en' ) + '.structurae.de/structures/data/index.cfm?ID=$1', // Structurae ID
455: 'http://www.emporis.com/' + ( $.inArray( baseLanguage, ['de', 'en', 'fr'] ) !== -1 ? baseLanguage : 'en' ) + '/wm/bu/?id=$1', // Emporis ID
464: 'http://www.legifrance.gouv.fr/UnTexteDeJorf.do?numjo=$1', // NOR (French law)
476: 'http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:$1:' + ( $.inArray( baseLanguage, ['bg', 'es', 'cs', 'da', 'de', 'et', 'el', 'en', 'fr', 'ga', 'it', 'lv', 'lt', 'hu', 'mt', 'nl', 'pl', 'pt', 'ro', 'ro', 'sk', 'sl', 'fi', 'sv'] ) !== -1 ? baseLanguage : 'en' ) + ':NOT', // CELEX (European law)
477: 'http://www.historicplaces.ca/' + ( $.inArray( baseLanguage, ['en', 'fr'] ) !== -1 ? baseLanguage : 'en' ) + '/rep-reg/place-lieu.aspx?id=$1', // Historic Places (Canada)
480: 'http://www.filmaffinity.com/' + ( $.inArray( baseLanguage, ['en', 'es'] ) !== -1 ? baseLanguage : 'en' ) + '/film$1.html', // Filmaffinity
481: 'http://www.culture.gouv.fr/public/mistral/palissy_fr?ACTION=CHERCHER&FIELD_1=REF&VALUE_1=$1', // Palissy
486: 'http://www.nlm.nih.gov/cgi/mesh/2013/MB_cgi?field=uid&term=$1', // Mesh
492: 'http://omim.org/entry/$1', // OMIM
493: 'http://www.icd9data.com/getICD9Code.ashx?icd9=$1', // ICD 9
494: 'http://apps.who.int/classifications/icd10/browse/2010/en#/$1', // ICD 10
496: 'http://orcid.org/$1', // ORCID
497: 'http://db1.ihp.sinica.edu.tw/cbdbc/cbdbkm' + ( $.inArray( baseLanguage.substring(0,2), ['zh'] ) !== -1 ? '' : 'eng' ) + '?~~AAA$1', // China Biographical Database
508: 'http://thes.bncf.firenze.sbn.it/termine.php?id=$1', //BNFC
535: 'http://www.findagrave.com/cgi-bin/fg.cgi?page=gr&GRid=$1', // Find a Grave
536: 'http://www.atpworldtour.com/Tennis/Players/$1.aspx', // ATP id
539: 'http://www.culture.gouv.fr/public/mistral/museo_fr?ACTION=CHERCHER&FIELD_98=REF&VALUE_98=$1', // Museofile
549: 'http://genealogy.math.ndsu.nodak.edu/id.php?id=$1', // MGP
557: 'http://www.diseasesdatabase.com/ddb$1.htm', // DiseasesDB
563: 'http://www.progenetix.org/cgi-bin/subsets.cgi?project=progenetix&subsetType=ICDM&ICDMcodes_m=$1', // ICD-O
586: 'http://www.ipni.org/ipni/idAuthorSearch.do?id=$1', // IPNI author
587: 'http://www.marinetraffic.com/ais/fr/shipdetails.aspx?MMSI=$1', // MMSI author
590: 'http://geonames.usgs.gov/pls/gnispublic/f?p=gnispq:3:::NO::P3_FID:$1', // GNIS
594: 'http://www.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g=$1', // Ensembl ID
597: 'http://www.wtatennis.com/players/player/$1', // WTA id
599: 'http://www.itftennis.com/procircuit/players/player/profile.aspx?playerid=$1', // ITF id
600: 'http://appdb.winehq.org/appview.php?iAppId=$1', // Wine AppDB-ID
604: 'http://www.nlm.nih.gov/medlineplus/ency/article/$1.htm', // MedlinePlus
627: 'http://www.iucnredlist.org/details/$1/0', // IUCN
630: 'http://www.v2asp.paris.fr/commun/v2asp/v2/nomenclature_voies/Voieactu/$1.nom.htm', // Paris streets
633: 'http://www.patrimoine-culturel.gouv.qc.ca/rpcq/detail.do?methode=consulter&id=$1&type=bien', // Quebec protected places
638: 'http://www.rcsb.org/pdb/explore/explore.do?structureId=$1', // PDB ID
640: 'http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1=$1', // Léonore
646: 'http://www.freebase.com$1', // Freebase ID (note that property values are supposed to start with slashes)
650: 'http://www.rkd.nl/rkddb/dispatcher.aspx?action=search&database=ChoiceArtists&search=priref=$1', // RKDartists
651: 'http://www.biografischportaal.nl/persoon/$1', // BPN
652: 'http://fdasis.nlm.nih.gov/srs/srsdirect.jsp?regno=$1', // UNII
653: 'http://www.ncbi.nlm.nih.gov/pubmedhealth/PMH$1', // PubMed Health
661: 'http://www.chemspider.com/Chemical-Structure.$1', // Chemspider
662: 'http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=$1', // PubChem ID
665: 'http://www.kegg.jp/entry/$1', // KEGG ID
668: 'http://www.ncbi.nlm.nih.gov/books/$1', // GeneReviews ID
671: 'http://www.informatics.jax.org/marker/MGI:$1', // Mouse Gene Informatics ID
673: 'http://emedicine.medscape.com/article/$1', // eMedicine
675: 'http://books.google.com/books?id=$1', // Google Books identifier
677: 'http://drusop.nature.cz/ost/chrobjekty/chrob_find/index.php?frame=1&h_kod=$1', // ÚSOP Code
683: 'https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:$1', // ChEBI
685: 'http://www.ncbi.nlm.nih.gov/taxonomy/$1', // NCBI Taxonomy ID
686: 'http://amigo.geneontology.org/cgi-bin/amigo/term_details?term=GO:$1', // Gene Ontology ID
687: 'http://biodiversitylibrary.org/page/$1', // BHL Page ID
691: 'http://aut.nkp.cz/$1', // NK ČR
699: 'http://disease-ontology.org/term/DOID%3A$1', // diseases ontology ID
709: 'http://hsewsf.sedsh.gov.uk/hslive/hsstart?P_HBNUM=$1', // Historic Scotland ID
715: 'http://www.drugbank.ca/drugs/DB$1', // Drugbank ID
716: 'http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=$1', // JPL Small-Body Database
718: 'http://canmore.rcahms.gov.uk/en/site/$1/details/', // Canmore ID
721: 'http://www.mosclassific.ru/mClass/okato_view.php?text=$1', // OKATO
723: 'http://www.dbnl.org/auteurs/auteur.php?id=$1', // DBNL ID
724: 'https://archive.org/details/$1', // Internet Archive ID
727: 'http://www.europeana.eu/portal/record/$1.html', // Europeana ID
731: 'http://www.bgr.de/app/litholex/gesamt_ausgabe_neu.php?id=$1', // Litholex ID
732: 'http://www.bgs.ac.uk/Lexicon/lexicon.cfm?pub=$1', // BGX Lexicon ID
733: 'http://www.dinoloket.nl/$1', // Dinoloket ID
757: 'http://whc.unesco.org/' + ( $.inArray( baseLanguage, ['en', 'fr'] ) !== -1 ? baseLanguage : 'en' ) + '/list/$1', // UNESCO World Heritage
758: 'http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=$1', // Kulturminne
759: 'https://hermis.alberta.ca/ARHP/Details.aspx?DeptID=1&ObjectID=$1', // Alberta Historic Places ID
763: 'http://www.gov.pe.ca/hpo/app.php?nav=details&p=$1&lang=' + ( $.inArray( baseLanguage.substring(0,2), ['fr'] ) !== -1 ? 'F' : 'E' ), // Prince Edward Island Historic Places ID
764: 'http://classif.spb.ru/classificators/view/tmo.php?st=A&kr=1&kod=$1', // OKTMO
804: 'http://geonames.usgs.gov/pls/gnispublic/f?p=gnispq:5:::NO::P5_ANTAR_ID:$1', // GNIS Antarctica ID
808: 'http://toolserver.org/~platonides/wlm/ids.php?bic=$1', // code Bien de Interés Cultural (BIC)
809: 'http://protectedplanet.net/sites/$1', // WDPA ID
815: 'http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=$1', // ITIS TSN
818: 'http://arxiv.org/abs/$1', // arXiv
819: 'http://adsabs.harvard.edu/abs/$1', // ADS bibcode
821: 'http://www4.rncan.gc.ca/search-place-names/unique.php?id=$1', // CGNDB ID
824: 'http://www.lpi.usra.edu/meteor/metbull.php?code=$1', // ADS bibcode
827: 'http://www.bbc.co.uk/programmes/$1' // BBC Identifier
};
$.each( properties, function( k, v ) {
var input = $( '.wb-snak-property a' ).filter( function() {
return new RegExp( 'Property:P' + k + '$' ).test( this.href );
} )
.parent()
.parent()
.parent()
.find( '.wb-snak-value .valueview-value textarea.valueview-input' );
if( input && input.size() > 0 ) {
input.each( function( i, e ) {
var id = $( e ).val();
if( k == 213 ) id = id.replace( / /g, '' );
var parent = $( e ).parents( '.wb-statement-claim' ).first();
if( parent.size() < 1 ) parent = $( e ).parents( '.wb-referenceview' ).first();
parent
.find( '.wb-editsection .wikibase-toolbarbutton' )
.on( 'click', function() { // show the textarea and hide the link when the user clicks 'edit'
$( e ).show().next().hide();
} );
$( e )
.hide() // 'replace' the textarea with the link
.after(
$( '<a>' )
.text( $( e ).val() )
.attr( 'href', v.replace( '$1', id ) )
.addClass( 'external' ) // show the 'external link' icon
);
} );
}
} );
}
} );
// </nowiki>