From fe6775b05fddb4b8f69016ade23b726651df3b36 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 17 Sep 2017 21:40:56 -0400 Subject: [PATCH] Add instrument to the mix Might as well grab the first instrument as well. Signed-off-by: Dan Scott --- Open-ILS/web/js/ui/default/opac/wikidata_music_card.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }); -- 2.11.0