Patch Freebase Suggest 4.2 to deal with Freebase Search changes.

This commit is contained in:
Tom Morris 2013-07-26 10:50:22 -04:00
parent 1e5f89e84c
commit d16e8404b4

View File

@ -1815,7 +1815,7 @@
id = data['mid']; id = data['mid'];
image = flyout_image_url.replace(/\$\{id\}/g, id); image = flyout_image_url.replace(/\$\{id\}/g, id);
} }
var description_src = 'freebase'; var description_src = '';
var description = get_value( var description = get_value(
data, ['output', 'description', 'wikipedia'], true); data, ['output', 'description', 'wikipedia'], true);
if (description && description.length) { if (description && description.length) {
@ -1824,6 +1824,12 @@
else { else {
description = get_value( description = get_value(
data, ['output', 'description', 'freebase'], true); 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) { if (description && description.length) {
description = description[0]; description = description[0];
@ -1867,11 +1873,13 @@
.append(document.createTextNode(prop[1]))); .append(document.createTextNode(prop[1])));
}); });
if (description) { if (description) {
content.append( var text_node = document.createTextNode(description);
$('<p class="fbs-topic-article">') if (description_src) {
.append($('<em class="fbs-citation">') text_node.prepend($('<em class="fbs-citation">')
.text('[' + description_src + '] ')) .text('[' + description_src + '] '));
.append(document.createTextNode(description))); }
content.append($('<p class="fbs-topic-article">')
.append(text_node));
} }
if (image) { if (image) {
content.children().addClass('fbs-flyout-image-true'); content.children().addClass('fbs-flyout-image-true');