PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/ajax/libs/yui/3.8.1/yql/yql-coverage.js

https://gitlab.com/alidz1982/cdnjs
JavaScript | 265 lines | 159 code | 20 blank | 86 comment | 19 complexity | 697b8f0cf42cc17e2b1c1781e5ff7415 MD5 | raw file
  1. if (typeof _yuitest_coverage == "undefined"){
  2. _yuitest_coverage = {};
  3. _yuitest_coverline = function(src, line){
  4. var coverage = _yuitest_coverage[src];
  5. if (!coverage.lines[line]){
  6. coverage.calledLines++;
  7. }
  8. coverage.lines[line]++;
  9. };
  10. _yuitest_coverfunc = function(src, name, line){
  11. var coverage = _yuitest_coverage[src],
  12. funcId = name + ":" + line;
  13. if (!coverage.functions[funcId]){
  14. coverage.calledFunctions++;
  15. }
  16. coverage.functions[funcId]++;
  17. };
  18. }
  19. _yuitest_coverage["build/yql/yql.js"] = {
  20. lines: {},
  21. functions: {},
  22. coveredLines: 0,
  23. calledLines: 0,
  24. coveredFunctions: 0,
  25. calledFunctions: 0,
  26. path: "build/yql/yql.js",
  27. code: []
  28. };
  29. _yuitest_coverage["build/yql/yql.js"].code=["YUI.add('yql', function (Y, NAME) {","","/**"," * This class adds a sugar class to allow access to YQL (http://developer.yahoo.com/yql/)."," * @module yql"," */","/**"," * Utility Class used under the hood my the YQL class"," * @class YQLRequest"," * @constructor"," * @param {String} sql The SQL statement to execute"," * @param {Function/Object} callback The callback to execute after the query (Falls through to JSONP)."," * @param {Object} params An object literal of extra parameters to pass along (optional)."," * @param {Object} opts An object literal of configuration options (optional): proto (http|https), base (url)"," */","var YQLRequest = function (sql, callback, params, opts) {",""," if (!params) {"," params = {};"," }"," params.q = sql;"," //Allow format override.. JSON-P-X"," if (!params.format) {"," params.format = Y.YQLRequest.FORMAT;"," }"," if (!params.env) {"," params.env = Y.YQLRequest.ENV;"," }",""," this._context = this;",""," if (opts && opts.context) {"," this._context = opts.context;"," delete opts.context;"," }",""," if (params && params.context) {"," this._context = params.context;"," delete params.context;"," }",""," this._params = params;"," this._opts = opts;"," this._callback = callback;","","};","","YQLRequest.prototype = {"," /**"," * @private"," * @property _jsonp"," * @description Reference to the JSONP instance used to make the queries"," */"," _jsonp: null,"," /**"," * @private"," * @property _opts"," * @description Holder for the opts argument"," */"," _opts: null,"," /**"," * @private"," * @property _callback"," * @description Holder for the callback argument"," */"," _callback: null,"," /**"," * @private"," * @property _params"," * @description Holder for the params argument"," */"," _params: null,"," /**"," * @private"," * @property _context"," * @description The context to execute the callback in"," */"," _context: null,"," /**"," * @private"," * @method _internal"," * @description Internal Callback Handler"," */"," _internal: function () {"," this._callback.apply(this._context, arguments);"," },"," /**"," * @method send"," * @description The method that executes the YQL Request."," * @chainable"," * @return {YQLRequest}"," */"," send: function () {"," var qs = [], url = ((this._opts && this._opts.proto) ? this._opts.proto : Y.YQLRequest.PROTO), o;",""," Y.each(this._params, function (v, k) {"," qs.push(k + '=' + encodeURIComponent(v));"," });",""," qs = qs.join('&');",""," url += ((this._opts && this._opts.base) ? this._opts.base : Y.YQLRequest.BASE_URL) + qs;",""," o = (!Y.Lang.isFunction(this._callback)) ? this._callback : { on: { success: this._callback } };",""," o.on = o.on || {};"," this._callback = o.on.success;",""," o.on.success = Y.bind(this._internal, this);",""," this._send(url, o);"," return this;"," },"," /**"," * Private method to send the request, overwritten in plugins"," * @method _send"," * @private"," * @param {String} url The URL to request"," * @param {Object} o The config object"," */"," _send: function(url, o) {"," if (o.allowCache !== false) {"," o.allowCache = true;"," }"," if (!this._jsonp) {"," this._jsonp = Y.jsonp(url, o);"," } else {"," this._jsonp.url = url;"," if (o.on && o.on.success) {"," this._jsonp._config.on.success = o.on.success;"," }"," this._jsonp.send();"," }"," }","};","","/**","* @static","* @property FORMAT","* @description Default format to use: json","*/","YQLRequest.FORMAT = 'json';","/**","* @static","* @property PROTO","* @description Default protocol to use: http","*/","YQLRequest.PROTO = 'http';","/**","* @static","* @property BASE_URL","* @description The base URL to query: query.yahooapis.com/v1/public/yql?","*/","YQLRequest.BASE_URL = ':/' + '/query.yahooapis.com/v1/public/yql?';","/**","* @static","* @property ENV","* @description The environment file to load: http://datatables.org/alltables.env","*/","YQLRequest.ENV = 'http:/' + '/datatables.org/alltables.env';","","Y.YQLRequest = YQLRequest;","","/**"," * This class adds a sugar class to allow access to YQL (http://developer.yahoo.com/yql/)."," * @class YQL"," * @constructor"," * @param {String} sql The SQL statement to execute"," * @param {Function} callback The callback to execute after the query (optional)."," * @param {Object} params An object literal of extra parameters to pass along (optional)."," * @param {Object} opts An object literal of configuration options (optional): proto (http|https), base (url)"," */","Y.YQL = function (sql, callback, params, opts) {"," return new Y.YQLRequest(sql, callback, params, opts).send();","};","","","}, '@VERSION@', {\"requires\": [\"jsonp\", \"jsonp-url\"]});"];
  30. _yuitest_coverage["build/yql/yql.js"].lines = {"1":0,"16":0,"18":0,"19":0,"21":0,"23":0,"24":0,"26":0,"27":0,"30":0,"32":0,"33":0,"34":0,"37":0,"38":0,"39":0,"42":0,"43":0,"44":0,"48":0,"85":0,"94":0,"96":0,"97":0,"100":0,"102":0,"104":0,"106":0,"107":0,"109":0,"111":0,"112":0,"122":0,"123":0,"125":0,"126":0,"128":0,"129":0,"130":0,"132":0,"142":0,"148":0,"154":0,"160":0,"162":0,"173":0,"174":0};
  31. _yuitest_coverage["build/yql/yql.js"].functions = {"YQLRequest:16":0,"_internal:84":0,"(anonymous 2):96":0,"send:93":0,"_send:121":0,"YQL:173":0,"(anonymous 1):1":0};
  32. _yuitest_coverage["build/yql/yql.js"].coveredLines = 47;
  33. _yuitest_coverage["build/yql/yql.js"].coveredFunctions = 7;
  34. _yuitest_coverline("build/yql/yql.js", 1);
  35. YUI.add('yql', function (Y, NAME) {
  36. /**
  37. * This class adds a sugar class to allow access to YQL (http://developer.yahoo.com/yql/).
  38. * @module yql
  39. */
  40. /**
  41. * Utility Class used under the hood my the YQL class
  42. * @class YQLRequest
  43. * @constructor
  44. * @param {String} sql The SQL statement to execute
  45. * @param {Function/Object} callback The callback to execute after the query (Falls through to JSONP).
  46. * @param {Object} params An object literal of extra parameters to pass along (optional).
  47. * @param {Object} opts An object literal of configuration options (optional): proto (http|https), base (url)
  48. */
  49. _yuitest_coverfunc("build/yql/yql.js", "(anonymous 1)", 1);
  50. _yuitest_coverline("build/yql/yql.js", 16);
  51. var YQLRequest = function (sql, callback, params, opts) {
  52. _yuitest_coverfunc("build/yql/yql.js", "YQLRequest", 16);
  53. _yuitest_coverline("build/yql/yql.js", 18);
  54. if (!params) {
  55. _yuitest_coverline("build/yql/yql.js", 19);
  56. params = {};
  57. }
  58. _yuitest_coverline("build/yql/yql.js", 21);
  59. params.q = sql;
  60. //Allow format override.. JSON-P-X
  61. _yuitest_coverline("build/yql/yql.js", 23);
  62. if (!params.format) {
  63. _yuitest_coverline("build/yql/yql.js", 24);
  64. params.format = Y.YQLRequest.FORMAT;
  65. }
  66. _yuitest_coverline("build/yql/yql.js", 26);
  67. if (!params.env) {
  68. _yuitest_coverline("build/yql/yql.js", 27);
  69. params.env = Y.YQLRequest.ENV;
  70. }
  71. _yuitest_coverline("build/yql/yql.js", 30);
  72. this._context = this;
  73. _yuitest_coverline("build/yql/yql.js", 32);
  74. if (opts && opts.context) {
  75. _yuitest_coverline("build/yql/yql.js", 33);
  76. this._context = opts.context;
  77. _yuitest_coverline("build/yql/yql.js", 34);
  78. delete opts.context;
  79. }
  80. _yuitest_coverline("build/yql/yql.js", 37);
  81. if (params && params.context) {
  82. _yuitest_coverline("build/yql/yql.js", 38);
  83. this._context = params.context;
  84. _yuitest_coverline("build/yql/yql.js", 39);
  85. delete params.context;
  86. }
  87. _yuitest_coverline("build/yql/yql.js", 42);
  88. this._params = params;
  89. _yuitest_coverline("build/yql/yql.js", 43);
  90. this._opts = opts;
  91. _yuitest_coverline("build/yql/yql.js", 44);
  92. this._callback = callback;
  93. };
  94. _yuitest_coverline("build/yql/yql.js", 48);
  95. YQLRequest.prototype = {
  96. /**
  97. * @private
  98. * @property _jsonp
  99. * @description Reference to the JSONP instance used to make the queries
  100. */
  101. _jsonp: null,
  102. /**
  103. * @private
  104. * @property _opts
  105. * @description Holder for the opts argument
  106. */
  107. _opts: null,
  108. /**
  109. * @private
  110. * @property _callback
  111. * @description Holder for the callback argument
  112. */
  113. _callback: null,
  114. /**
  115. * @private
  116. * @property _params
  117. * @description Holder for the params argument
  118. */
  119. _params: null,
  120. /**
  121. * @private
  122. * @property _context
  123. * @description The context to execute the callback in
  124. */
  125. _context: null,
  126. /**
  127. * @private
  128. * @method _internal
  129. * @description Internal Callback Handler
  130. */
  131. _internal: function () {
  132. _yuitest_coverfunc("build/yql/yql.js", "_internal", 84);
  133. _yuitest_coverline("build/yql/yql.js", 85);
  134. this._callback.apply(this._context, arguments);
  135. },
  136. /**
  137. * @method send
  138. * @description The method that executes the YQL Request.
  139. * @chainable
  140. * @return {YQLRequest}
  141. */
  142. send: function () {
  143. _yuitest_coverfunc("build/yql/yql.js", "send", 93);
  144. _yuitest_coverline("build/yql/yql.js", 94);
  145. var qs = [], url = ((this._opts && this._opts.proto) ? this._opts.proto : Y.YQLRequest.PROTO), o;
  146. _yuitest_coverline("build/yql/yql.js", 96);
  147. Y.each(this._params, function (v, k) {
  148. _yuitest_coverfunc("build/yql/yql.js", "(anonymous 2)", 96);
  149. _yuitest_coverline("build/yql/yql.js", 97);
  150. qs.push(k + '=' + encodeURIComponent(v));
  151. });
  152. _yuitest_coverline("build/yql/yql.js", 100);
  153. qs = qs.join('&');
  154. _yuitest_coverline("build/yql/yql.js", 102);
  155. url += ((this._opts && this._opts.base) ? this._opts.base : Y.YQLRequest.BASE_URL) + qs;
  156. _yuitest_coverline("build/yql/yql.js", 104);
  157. o = (!Y.Lang.isFunction(this._callback)) ? this._callback : { on: { success: this._callback } };
  158. _yuitest_coverline("build/yql/yql.js", 106);
  159. o.on = o.on || {};
  160. _yuitest_coverline("build/yql/yql.js", 107);
  161. this._callback = o.on.success;
  162. _yuitest_coverline("build/yql/yql.js", 109);
  163. o.on.success = Y.bind(this._internal, this);
  164. _yuitest_coverline("build/yql/yql.js", 111);
  165. this._send(url, o);
  166. _yuitest_coverline("build/yql/yql.js", 112);
  167. return this;
  168. },
  169. /**
  170. * Private method to send the request, overwritten in plugins
  171. * @method _send
  172. * @private
  173. * @param {String} url The URL to request
  174. * @param {Object} o The config object
  175. */
  176. _send: function(url, o) {
  177. _yuitest_coverfunc("build/yql/yql.js", "_send", 121);
  178. _yuitest_coverline("build/yql/yql.js", 122);
  179. if (o.allowCache !== false) {
  180. _yuitest_coverline("build/yql/yql.js", 123);
  181. o.allowCache = true;
  182. }
  183. _yuitest_coverline("build/yql/yql.js", 125);
  184. if (!this._jsonp) {
  185. _yuitest_coverline("build/yql/yql.js", 126);
  186. this._jsonp = Y.jsonp(url, o);
  187. } else {
  188. _yuitest_coverline("build/yql/yql.js", 128);
  189. this._jsonp.url = url;
  190. _yuitest_coverline("build/yql/yql.js", 129);
  191. if (o.on && o.on.success) {
  192. _yuitest_coverline("build/yql/yql.js", 130);
  193. this._jsonp._config.on.success = o.on.success;
  194. }
  195. _yuitest_coverline("build/yql/yql.js", 132);
  196. this._jsonp.send();
  197. }
  198. }
  199. };
  200. /**
  201. * @static
  202. * @property FORMAT
  203. * @description Default format to use: json
  204. */
  205. _yuitest_coverline("build/yql/yql.js", 142);
  206. YQLRequest.FORMAT = 'json';
  207. /**
  208. * @static
  209. * @property PROTO
  210. * @description Default protocol to use: http
  211. */
  212. _yuitest_coverline("build/yql/yql.js", 148);
  213. YQLRequest.PROTO = 'http';
  214. /**
  215. * @static
  216. * @property BASE_URL
  217. * @description The base URL to query: query.yahooapis.com/v1/public/yql?
  218. */
  219. _yuitest_coverline("build/yql/yql.js", 154);
  220. YQLRequest.BASE_URL = ':/' + '/query.yahooapis.com/v1/public/yql?';
  221. /**
  222. * @static
  223. * @property ENV
  224. * @description The environment file to load: http://datatables.org/alltables.env
  225. */
  226. _yuitest_coverline("build/yql/yql.js", 160);
  227. YQLRequest.ENV = 'http:/' + '/datatables.org/alltables.env';
  228. _yuitest_coverline("build/yql/yql.js", 162);
  229. Y.YQLRequest = YQLRequest;
  230. /**
  231. * This class adds a sugar class to allow access to YQL (http://developer.yahoo.com/yql/).
  232. * @class YQL
  233. * @constructor
  234. * @param {String} sql The SQL statement to execute
  235. * @param {Function} callback The callback to execute after the query (optional).
  236. * @param {Object} params An object literal of extra parameters to pass along (optional).
  237. * @param {Object} opts An object literal of configuration options (optional): proto (http|https), base (url)
  238. */
  239. _yuitest_coverline("build/yql/yql.js", 173);
  240. Y.YQL = function (sql, callback, params, opts) {
  241. _yuitest_coverfunc("build/yql/yql.js", "YQL", 173);
  242. _yuitest_coverline("build/yql/yql.js", 174);
  243. return new Y.YQLRequest(sql, callback, params, opts).send();
  244. };
  245. }, '@VERSION@', {"requires": ["jsonp", "jsonp-url"]});