Commit cca408ea authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Merge branch '594-opensearch-relevance-extension-in-quicktips-einfugen' into...

Merge branch '594-opensearch-relevance-extension-in-quicktips-einfugen' into 589-umsetzung-erstes-neudesign-fur-ergebnisseite
parents b525d07c a96b8481
...@@ -566,6 +566,7 @@ function loadQuicktips (search, locale, sprueche) { ...@@ -566,6 +566,7 @@ function loadQuicktips (search, locale, sprueche) {
} }
const QUICKTIP_SERVER = 'https://quicktips.metager3.de'; const QUICKTIP_SERVER = 'https://quicktips.metager3.de';
//const QUICKTIP_SERVER = 'http://localhost:63825';
/** /**
* Requests quicktips from the quicktip server and passes them to the loadedHandler * Requests quicktips from the quicktip server and passes them to the loadedHandler
...@@ -582,15 +583,16 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { ...@@ -582,15 +583,16 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
}); });
$.get(getString, function (data, status) { $.get(getString, function (data, status) {
if (status === 'success') { if (status === 'success') {
var quicktips = $(data).find('entry').map(function () { var quicktips = $(data).children('feed').children('entry').map(function () {
console.log(this);
return quicktip = { return quicktip = {
type: $(this).children('type').text(), type: $(this).children('mg\\:type').text(),
title: $(this).children('title').text(), title: $(this).children('title').text(),
summary: $(this).children('summary').text(), summary: $(this).children('content').text(),
url: $(this).children('url').text(), url: $(this).children('link').text(),
gefVon: $(this).children('gefVon').text(), gefVon: $(this).children('gefVon').text(),
priority: $(this).children('priority').text(), score: $(this).children('relevance\\:score').text(),
details: $(this).children('details').map(function () { details: $(this).children('mg\\:details').children('entry').map(function () {
return { return {
title: $(this).children('title').text(), title: $(this).children('title').text(),
text: $(this).children('text').text(), text: $(this).children('text').text(),
...@@ -599,6 +601,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { ...@@ -599,6 +601,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
}).toArray() }).toArray()
}; };
}).toArray(); }).toArray();
console.log(quicktips);
loadedHandler(quicktips); loadedHandler(quicktips);
} else { } else {
console.error('Loading quicktips failed with status ' + status); console.error('Loading quicktips failed with status ' + status);
...@@ -632,7 +635,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { ...@@ -632,7 +635,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
function createQuicktips (quicktips, sprueche) { function createQuicktips (quicktips, sprueche) {
var quicktipsDiv = $('#quicktips'); var quicktipsDiv = $('#quicktips');
quicktips.sort(function (a, b) { quicktips.sort(function (a, b) {
return b.priority - a.priority; return b.score - a.score;
}).forEach(function (quicktip) { }).forEach(function (quicktip) {
var mainElem; var mainElem;
if (quicktip.details.length > 0) { if (quicktip.details.length > 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment