From d16e8404b49672565dfff4f179cd3f3cc6a8fee9 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Fri, 26 Jul 2013 10:50:22 -0400 Subject: [PATCH] Patch Freebase Suggest 4.2 to deal with Freebase Search changes. --- .../core/externals/suggest/suggest-4_2.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/main/webapp/modules/core/externals/suggest/suggest-4_2.js b/main/webapp/modules/core/externals/suggest/suggest-4_2.js index 8a706e241..2ef8ec395 100644 --- a/main/webapp/modules/core/externals/suggest/suggest-4_2.js +++ b/main/webapp/modules/core/externals/suggest/suggest-4_2.js @@ -1815,7 +1815,7 @@ id = data['mid']; image = flyout_image_url.replace(/\$\{id\}/g, id); } - var description_src = 'freebase'; + var description_src = ''; var description = get_value( data, ['output', 'description', 'wikipedia'], true); if (description && description.length) { @@ -1824,6 +1824,12 @@ else { description = get_value( data, ['output', 'description', 'freebase'], true); + if (description && description.length) { + description_src = 'freebase'; + } else { + description = get_value( + data, ['output', 'description', '/common/topic/description'], true); + } } if (description && description.length) { description = description[0]; @@ -1867,11 +1873,13 @@ .append(document.createTextNode(prop[1]))); }); if (description) { - content.append( - $('

') - .append($('') - .text('[' + description_src + '] ')) - .append(document.createTextNode(description))); + var text_node = document.createTextNode(description); + if (description_src) { + text_node.prepend($('') + .text('[' + description_src + '] ')); + } + content.append($('

') + .append(text_node)); } if (image) { content.children().addClass('fbs-flyout-image-true');