Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #844 from duckduckgo/jd/record
Browse files Browse the repository at this point in the history
Update record template IAs
  • Loading branch information
bsstoner committed Jun 2, 2014
2 parents 69345a8 + 1d8777d commit 9db6700
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
23 changes: 10 additions & 13 deletions share/spice/code_search/code_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
10 changes: 4 additions & 6 deletions share/spice/meta_cpan/meta_cpan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,11 +29,6 @@
content: 'record',
moreAt: true
}
},
normalize: function(item){
return{
record_keys: ['abstract','author','version','description']
};
}
});
}
Expand Down
8 changes: 5 additions & 3 deletions share/spice/urban_dictionary/urban_dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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, '')
};
}
});
Expand Down

0 comments on commit 9db6700

Please sign in to comment.