diff --git a/share/spice/code_search/code_search.js b/share/spice/code_search/code_search.js index ddd43587cb..eec80c8df5 100644 --- a/share/spice/code_search/code_search.js +++ b/share/spice/code_search/code_search.js @@ -9,26 +9,23 @@ var query = encodeURIComponent(api_result.query); + var keys = []; + + $.each(api_result.results[0].lines, function(k, v){ + keys.push(k) + }); + Spice.add({ id: 'code_search', name: "Software", - data: api_result.results[0].lines, + data: { + record_data: api_result.results[0].lines, + record_keys: keys + }, meta: { sourceUrl: 'http://searchco.de/?q=' + query + '&cs=true', sourceName: 'searchcode' }, - normalize: function(item){ - - var keys = []; - - $.each(item, function(k, v){ - keys.push(k) - }); - - return{ - record_keys: keys - }; - }, templates: { group: 'base', options: { diff --git a/share/spice/meta_cpan/meta_cpan.js b/share/spice/meta_cpan/meta_cpan.js index d46cf1fffa..5d5beb5aac 100644 --- a/share/spice/meta_cpan/meta_cpan.js +++ b/share/spice/meta_cpan/meta_cpan.js @@ -15,7 +15,10 @@ Spice.add({ id: "meta_cpan", name: "Software", - data: api_result, + data: { + record_data: api_result, + record_keys: ['abstract','author','version','description'] + }, meta: { sourceName: "MetaCPAN", sourceUrl: 'https://metacpan.org/' + link @@ -26,11 +29,6 @@ content: 'record', moreAt: true } - }, - normalize: function(item){ - return{ - record_keys: ['abstract','author','version','description'] - }; } }); } diff --git a/share/spice/urban_dictionary/urban_dictionary.js b/share/spice/urban_dictionary/urban_dictionary.js index 1953ae8020..f695d98f7d 100644 --- a/share/spice/urban_dictionary/urban_dictionary.js +++ b/share/spice/urban_dictionary/urban_dictionary.js @@ -16,7 +16,10 @@ Spice.add({ id: "urban_dictionary", name: "Dictionary", - data: response.list[0], + data: { + record_data: response.list[0], + record_keys: ['word', 'definition', 'example'] + }, meta: { sourceUrl: 'http://www.urbandictionary.com/define.php?term=' + word, sourceName: 'Urban Dictionary' @@ -30,8 +33,7 @@ }, normalize : function(item){ return{ - definition: item.definition.replace(/(\r?\n)+/gi, ''), - record_keys: ['word', 'definition', 'example'], + definition: item.record_data.definition.replace(/(\r?\n)+/gi, '') }; } });