Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated the minified version with the latest source code.

  • Loading branch information...
commit bfe2288ac8ffef10d33b62264f7c7ccca3e47b2f 1 parent 4e35737
@3rd-Eden authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  SpryDataYQLDataSet-min.js
View
2  SpryDataYQLDataSet-min.js
@@ -1 +1 @@
-/* Copyright Arnout Kazemier, license: github.com/3rd-Eden/Spry-YQL-DataSet */(function(){if(!Spry||!Spry.Data)return alert("Spry.Data.YQLDataSet depends on SpryData.js to loaded in advance.");Spry.Data.YQLDataSet=function(a,b,c){this.YQLServer="http://query.yahooapis.com/v1/public/yql?";this.env="http://datatables.org/alltables.env";this.format="json";this.timeout=1E4;this.query=a;this.prefix="yql_";this.path=b||false;this.preparseFunc=this.doc=null;this.diagnostics=false;Spry.Data.DataSet.call(this,c)};Spry.Data.YQLDataSet.prototype=new Spry.Data.DataSet;Spry.Data.YQLDataSet.prototype.constructor=Spry.Data.YQLDataSet;Spry.Data.YQLDataSet.id=0;Spry.Data.YQLDataSet.receiver={};Spry.Data.YQLDataSet.prototype.yql=function(a){var b=++Spry.Data.YQLDataSet.id,c={q:this.query,format:this.format,env:this.env,diagnostics:this.diagnostics,callback:"Spry.Data.YQLDataSet.receiver."+this.prefix+""+b},d=this,f,e,g,i;a=a||this.loadDataIntoDataSet;e=Spry.Data.YQLDataSet.receiver[this.prefix+""+b]=function(h){clearTimeout(i);h.error&&d.notifyObservers("onLoadError",h.error);if(h.results||h.query)a.call(d,h.results||h.query);try{var j=Spry.Data.YQLDataSet.receiver[d.prefix+""+b];j.script.parentNode.removeChild(j.script);delete Spry.Data.YQLDataSet.receiver[d.prefix+""+b]}catch(k){}};f=[];for(g in c)f.push(g+"="+encodeURIComponent(c[g]));f=this.YQLServer+f.join("&");e.script=document.createElement("script");e.script.type="text/javascript";e.script.src=f;e.script.setAttribute("async",true);this.notifyObservers("onPreLoad");document.getElementsByTagName("script")[0].appendChild(e.script);i=setTimeout(function(){d.timedOut(e,b)},this.timeout)};Spry.Data.YQLDataSet.prototype.loadData=function(){this.dataWasLoaded=false;if(!this.pendingRequest){this.yql();this.pendingRequest=true}};Spry.Data.YQLDataSet.prototype.loadDataIntoDataSet=function(a){this.doc=a;var b=[],c={};a=a.results?a.results:a;var d=0,f,e;if(this.preparseFunc)a=this.preparseFunc(a);if(this.path)a=Spry.Utils.getObjectByName(this.path,a);if(!a||Object.prototype.toString.call(a)!=="[object Array]")if(typeof a!=="object")b.push(c[0]={column0:a,ds_rowID:0});else{e=Spry.Data.YQLDataSet.flattenObject(a);e.ds_RowID=d;b.push(c[d]=e)}else for(f=a.length;d<f;d++){e=Spry.Data.YQLDataSet.flattenObject(a[d]);e.ds_RowID=d;b.push(c[d]=e)}this.data=b;this.dataHash=c;this.dataWasLoaded=true;this.pendingRequest=null;this.syncColumnTypesToData();this.applyColumnTypes();this.disableNotifications();this.filterAndSortData();this.enableNotifications();this.notifyObservers("onPostLoad");this.notifyObservers("onDataChanged")};Spry.Data.YQLDataSet.prototype.syncColumnTypesToData=function(){var a=this.data[0],b,c;for(b in a)if(!this.columnTypes[b])(c=typeof a[b]=="number")&&this.setColumnType(b,c)};Spry.Data.YQLDataSet.prototype.timedOut=function(a,b){var c=this;this.notifyObservers("onTimeOut");a.script.parentNode.removeChild(a.script);Spry.Data.YQLDataSet.receiver[c.prefix+""+b]=function(){delete Spry.Data.YQLDataSet.receiver[c.prefix+""+b]}};Spry.Data.YQLDataSet.prototype.getQuery=function(){return this.query};Spry.Data.YQLDataSet.prototype.setQuery=function(a){this.query=a;this.dataWasLoaded=false};Spry.Data.YQLDataSet.prototype.getPath=function(){return this.path};Spry.Data.YQLDataSet.prototype.setPath=function(a){if(this.path!=a){this.path=a;if(this.dataWasLoaded&&this.doc){this.notifyObservers("onPreLoad");this.loadDataIntoDataSet(this.doc)}}};Spry.Data.YQLDataSet.flattenObject=function(a,b){var c={};if(typeof a=="object")Spry.Data.YQLDataSet.copyProps(c,a);else c[b||"column0"]=a;c.ds_JSONObject=a;return c};Spry.Data.YQLDataSet.copyProps=function(a,b,c){if(a&&b)for(var d in b)c&&typeof b[d]=="object"||(a[d]=b[d]);return a};Spry.Utils.getObjectByName=function(a,b){var c=null,d=b||window,f,e,g;if(a){f=a.split(".");e=0;for(g=f.length;d&&e<g;e++)d=c=d[f[e]]}return c};Spry.Data.Region.prototype.onTimeOut=function(){this.currentState!="timeout"&&this.setState("timeout");Spry.Data.Region.notifyObservers("onTimeOut",this)}})();
+/* Copyright Arnout Kazemier, license: github.com/3rd-Eden/Spry-YQL-DataSet */(function(){if(!Spry||!Spry.Data)return alert("Spry.Data.YQLDataSet depends on SpryData.js to loaded in advance.");Spry.Data.YQLDataSet=function(a,b,c){this.YQLServer="http://query.yahooapis.com/v1/public/yql?";this.env="http://datatables.org/alltables.env";this.format="json";this.timeout=1E4;this.query=a;this.prefix="yql_";this.path=b||false;this.preparseFunc=this.doc=null;this.diagnostics=false;Spry.Data.DataSet.call(this,c)};Spry.Data.YQLDataSet.prototype=new Spry.Data.DataSet;Spry.Data.YQLDataSet.prototype.constructor=Spry.Data.YQLDataSet;Spry.Data.YQLDataSet.id=0;Spry.Data.YQLDataSet.receiver={};Spry.Data.YQLDataSet.prototype.yql=function(a){var b=++Spry.Data.YQLDataSet.id,c={q:this.query,format:this.format,env:this.env,diagnostics:this.diagnostics,callback:"Spry.Data.YQLDataSet.receiver."+this.prefix+""+b},d=this,g=document,e,f,h,j;a=a||this.loadDataIntoDataSet;f=Spry.Data.YQLDataSet.receiver[this.prefix+""+b]=function(i){f.done=true;j&&clearTimeout(j);i.error&&d.notifyObservers("onLoadError",i.error);if(i.results||i.query)a.call(d,i.results||i.query);try{f.script.parentNode.removeChild(f.script);f=null;delete Spry.Data.YQLDataSet.receiver[d.prefix+""+b]}catch(k){}};e=[];for(h in c)e.push(h+"="+encodeURIComponent(c[h]));e=this.YQLServer+e.join("&");f.script=g.createElement("script");f.script.type="text/javascript";f.script.src=e;f.script.setAttribute("async",true);this.notifyObservers("onPreLoad");h=g.getElementsByTagName("script")[0];h.parentNode.insertBefore(f.script,h);j=setTimeout(function(){d.timedOut(f,b)},this.timeout)};Spry.Data.YQLDataSet.prototype.loadData=function(){this.dataWasLoaded=false;if(!this.pendingRequest){this.yql();this.pendingRequest=true}};Spry.Data.YQLDataSet.prototype.loadDataIntoDataSet=function(a){this.doc=a;var b=[],c={};a=a.results?a.results:a;var d=0,g,e;if(this.preparseFunc)a=this.preparseFunc(a);if(this.path)a=Spry.Utils.getObjectByName(this.path,a);if(!a||Object.prototype.toString.call(a)!=="[object Array]")if(typeof a!=="object")b.push(c[0]={column0:a,ds_rowID:0});else{e=Spry.Data.YQLDataSet.flattenObject(a);e.ds_RowID=d;b.push(c[d]=e)}else for(g=a.length;d<g;d++){e=Spry.Data.YQLDataSet.flattenObject(a[d]);e.ds_RowID=d;b.push(c[d]=e)}this.data=b;this.dataHash=c;this.dataWasLoaded=true;this.pendingRequest=null;this.syncColumnTypesToData();this.applyColumnTypes();this.disableNotifications();this.filterAndSortData();this.enableNotifications();this.notifyObservers("onPostLoad");this.notifyObservers("onDataChanged")};Spry.Data.YQLDataSet.prototype.syncColumnTypesToData=function(){var a=this.data[0],b,c;for(b in a)if(!this.columnTypes[b])(c=typeof a[b]=="number")&&this.setColumnType(b,c)};Spry.Data.YQLDataSet.prototype.timedOut=function(a,b){if(a){var c=this,d=a.script,g;if(!a.done){this.notifyObservers("onTimeOut");if(d&&(g=d.parent))g.removeChild(a.script);Spry.Data.YQLDataSet.receiver[c.prefix+""+b]=function(){delete Spry.Data.YQLDataSet.receiver[c.prefix+""+b]}}}};Spry.Data.YQLDataSet.prototype.getQuery=function(){return this.query};Spry.Data.YQLDataSet.prototype.setQuery=function(a){this.query=a;this.dataWasLoaded=false};Spry.Data.YQLDataSet.prototype.getPath=function(){return this.path};Spry.Data.YQLDataSet.prototype.setPath=function(a){if(this.path!=a){this.path=a;if(this.dataWasLoaded&&this.doc){this.notifyObservers("onPreLoad");this.loadDataIntoDataSet(this.doc)}}};Spry.Data.YQLDataSet.flattenObject=function(a,b){var c={};if(typeof a=="object")Spry.Data.YQLDataSet.copyProps(c,a);else c[b||"column0"]=a;c.ds_JSONObject=a;return c};Spry.Data.YQLDataSet.copyProps=function(a,b,c){if(a&&b)for(var d in b)c&&typeof b[d]=="object"||(a[d]=b[d]);return a};Spry.Utils.getObjectByName=function(a,b){var c=null,d=b||window,g,e,f;if(a){g=a.split(".");e=0;for(f=g.length;d&&e<f;e++)d=c=d[g[e]]}return c};Spry.Data.Region.prototype.onTimeOut=function(){this.currentState!="timeout"&&this.setState("timeout");Spry.Data.Region.notifyObservers("onTimeOut",this)}})();
Please sign in to comment.
Something went wrong with that request. Please try again.