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

Commit

Permalink
Starting spice collecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Getty committed Jul 4, 2011
0 parents commit 1470c95
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
DuckDuckGo ZeroClickInfo Spice
==============================

About
-----



Contributing
------------

We organize this repository in projects. Some of those projects are in use on the live system, some are still in development.

For the spice we only use JavaScript which is called on the browser. Every project needs a file:

* project/parse.js
33 changes: 33 additions & 0 deletions example/parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function nra(items) {
document.getElementById('a').innerHTML = items[0]['a'];
}

// This is the function you mess with.
// To see this live check out http://duckduckgo.com/?q=is+it+raining+in+philadelphia
function nrir(ir) {
var snippet = '';

// For debugging.
// console.log(ir);

// Validity check.
if (ir['answer']) {

// Snippet that gets shown in the 0-click box.
snippet = '<b>' + ir['answer'] + '</b>';
if (ir['forecast']) snippet += '; ' + ir['forecast'];
if (ir['location']) snippet += ' (' + ir['location'] + ')';

items = new Array();
items[0] = new Array();
items[0]['a'] = snippet;

items[0]['h'] = '';

// Source name and url for the More at X link.
items[0]['s'] = 'GoingToRain';
items[0]['u'] = 'http://goingtorain.com/';

nra(items);
}
}

0 comments on commit 1470c95

Please sign in to comment.