Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding support for env files and cleaning up function names

  • Loading branch information...
commit 6e11c921c130756a84134599554e9cd20044c519 1 parent b4e6e9c
@sh1mmer authored
Showing with 13 additions and 6 deletions.
  1. +13 −6 js-yql-display/yql_js_widget.js
View
19 js-yql-display/yql_js_widget.js
@@ -36,6 +36,13 @@ yqlWidget = function() {
var getYQLData = function(query){
//prepare the URL for YQL query:
var sURL = yqlPublicQueryURL + "q=" + query + "&format=json&callback=yqlWidget.getYQLDataCallback";
+
+ //add any environment files specified in the config
+ if (setupConfig['communitytables']) {
+ sURL += "&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
+ } else if (setupConfig['env']) {
+ sURL += "&env=" + escape(setupConfig['env']);
+ }
//make GET request to YQL with provided query
var transactionObj = YAHOO.util.Get.script(sURL, {
@@ -69,11 +76,11 @@ yqlWidget = function() {
if (firstChild.length !== undefined){
//multiple results - array
for(var i = 0; i < firstChild.length; i++){
- html += parseConfig(firstChild[i]);
+ html += parseFormat(firstChild[i]);
}
} else {
//single result - object
- html += parseConfig(firstChild);
+ html += parseFormat(firstChild);
}
document.getElementById(queryInsert).innerHTML = html;
@@ -81,11 +88,11 @@ yqlWidget = function() {
}
/************************************************************
- * Method: Parse Config
- * Description: Loop through configuration array for provided
+ * Method: Parse Format
+ * Description: Loop through format array for provided
* data set node
************************************************************/
- var parseConfig = function(node){
+ var parseFormat = function(node){
currString = node;
//replace YQL result placeholders with return content
@@ -133,4 +140,4 @@ yqlWidget = function() {
parseYQLResults(o.query.results);
}
}
-}();
+}();
Please sign in to comment.
Something went wrong with that request. Please try again.