Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Seth Mason
authored and
Seth Mason
committed
May 8, 2009
0 parents
commit 94a9b79
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
About | ||
===== | ||
This is an dojo interface to Yahoo's [YQL][yql]. It's heavily based on Dav Glass's | ||
[yui-yql][yui-yql]. | ||
|
||
To use it: | ||
|
||
dojo.yql.execute("SELECT * from friendfeed.feeds WHERE nickname = 'slackorama'", | ||
{ load: function( data ) { | ||
console.dir( data ); | ||
}, | ||
error: function( e ) { | ||
console.error( e ); | ||
} | ||
}); | ||
|
||
|
||
TODO: | ||
===== | ||
|
||
* Tests! | ||
* Documentation! | ||
* Profit! | ||
|
||
[yql]: http://developer.yahoo.com/yql/ | ||
[yui-yql]: http://github.com/davglass/yui-yql/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dojo.provide("dojox.yql"); | ||
dojo.require("dojox.yql._base"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
dojo.provide("dojox.yql._base"); | ||
|
||
dojo.require("dojo.io.script"); | ||
|
||
(function() { | ||
var _d = dojo; | ||
var _dxy = dojox.yql; | ||
var URL = 'http:/' + '/query.yahooapis.com/v1/public/yql'; | ||
_dxy.execute = function( qry, ioArgs ) { | ||
|
||
if (!ioArgs) { | ||
ioArgs = { }; | ||
} | ||
var myArgs = dojo.mixin({},ioArgs ); | ||
if (!myArgs.content) { | ||
myArgs.content = { }; | ||
} | ||
myArgs.url = URL; | ||
myArgs.callbackParamName = "callback"; | ||
myArgs.content.q = qry; | ||
myArgs.content.format = 'json'; | ||
|
||
if (myArgs.env) { | ||
myArgs.content.env = myArgs.env; | ||
} else { | ||
if (!myArgs.content.env) { | ||
myArgs.content.env = 'http:/' + '/datatables.org/alltables.env'; | ||
} | ||
} | ||
|
||
// to look into the data to see if there's an error | ||
myArgs.load = function( data ) { | ||
if (data.error) { | ||
if (ioArgs.error) { | ||
ioArgs.error( new Error( data.error.description ) ); | ||
return; | ||
} | ||
} | ||
if (data.query) { | ||
if (ioArgs.load) { | ||
ioArgs.load( data.query ); | ||
return; | ||
} | ||
} | ||
}; | ||
return dojo.io.script.get( myArgs ); | ||
}; | ||
})(); |