From: Dan Scott Date: Mon, 18 Sep 2017 01:40:56 +0000 (-0400) Subject: Add instrument to the mix X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe6775b05fddb4b8f69016ade23b726651df3b36;p=contrib%2FConifer.git Add instrument to the mix Might as well grab the first instrument as well. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js b/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js index a87e60d9b0..aba84eaa06 100644 --- a/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js +++ b/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js @@ -82,7 +82,7 @@ function findPerformer(icon_node, entity_name) { var url = 'https://query.wikidata.org/sparql'; - var query = 'SELECT DISTINCT ?item ?itemLabel ?itemDescription ?image ?birthPlace ?birthPlaceLabel ' + + var query = 'SELECT DISTINCT ?item ?itemLabel ?itemDescription ?image ?instrumentLabel ?birthPlace ?birthPlaceLabel ' + '?website ?musicbrainz ?songKick ?twitter ?facebook ' + 'WHERE { ' + '?item rdfs:label|skos:altLabel|wdt:P1449 "' + entity_name + '"@en . ' + @@ -93,6 +93,7 @@ '{ ?item wdt:P106/wdt:P279* wd:Q639669 . } ' + 'OPTIONAL { ?item wdt:P3478 ?songKick } . ' + 'OPTIONAL { ?item wdt:P19 ?birthPlace } . ' + + 'OPTIONAL { ?item wdt:P1303 ?instrument } . ' + 'OPTIONAL { ?item wdt:P856 ?website } . ' + 'OPTIONAL { ?item wdt:P434 ?musicbrainz } . ' + 'OPTIONAL { ?item wdt:P2002 ?twitter } . ' + @@ -189,11 +190,16 @@ } valueLink.innerText = labelText; valueDiv.appendChild(valueLink); + } else if (label !== null) { + var valueText = document.createElement('span'); + valueText.innerText = labelText; + valueDiv.appendChild(valueText); } musician.appendChild(valueDiv); } } + addWDValue('instrumentLabel', 'Instrument: ', 'instrumentLabel', false); addWDValue('birthPlace', 'Birth place: ', 'birthPlaceLabel', true); addWDValue('website', 'Web site: ', null, true); addWDValue('musicbrainz', null, 'Discography (Musicbrainz)', true, function(value) { return 'https://musicbrainz.org/artist/' + value });