PageRenderTime 54ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/MvcMusicStore/Scripts/MicrosoftAjax.debug.js

#
JavaScript | 1591 lines | 1352 code | 17 blank | 222 comment | 346 complexity | ac857904e524358569946a8d92bbf63e MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. // Name: MicrosoftAjax.debug.js
  2. // Assembly: System.Web.Extensions
  3. // Version: 4.0.0.0
  4. // FileVersion: 4.0.20526.0
  5. //-----------------------------------------------------------------------
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------
  8. // MicrosoftAjax.js
  9. // Microsoft AJAX Framework.
  10. Function.__typeName = 'Function';
  11. Function.__class = true;
  12. Function.createCallback = function Function$createCallback(method, context) {
  13. /// <summary locid="M:J#Function.createCallback" />
  14. /// <param name="method" type="Function"></param>
  15. /// <param name="context" mayBeNull="true"></param>
  16. /// <returns type="Function"></returns>
  17. var e = Function._validateParams(arguments, [
  18. {name: "method", type: Function},
  19. {name: "context", mayBeNull: true}
  20. ]);
  21. if (e) throw e;
  22. return function() {
  23. var l = arguments.length;
  24. if (l > 0) {
  25. var args = [];
  26. for (var i = 0; i < l; i++) {
  27. args[i] = arguments[i];
  28. }
  29. args[l] = context;
  30. return method.apply(this, args);
  31. }
  32. return method.call(this, context);
  33. }
  34. }
  35. Function.createDelegate = function Function$createDelegate(instance, method) {
  36. /// <summary locid="M:J#Function.createDelegate" />
  37. /// <param name="instance" mayBeNull="true"></param>
  38. /// <param name="method" type="Function"></param>
  39. /// <returns type="Function"></returns>
  40. var e = Function._validateParams(arguments, [
  41. {name: "instance", mayBeNull: true},
  42. {name: "method", type: Function}
  43. ]);
  44. if (e) throw e;
  45. return function() {
  46. return method.apply(instance, arguments);
  47. }
  48. }
  49. Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
  50. /// <summary locid="M:J#Function.emptyMethod" />
  51. }
  52. Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) {
  53. /// <summary locid="M:J#Function.validateParameters" />
  54. /// <param name="parameters"></param>
  55. /// <param name="expectedParameters"></param>
  56. /// <param name="validateParameterCount" type="Boolean" optional="true"></param>
  57. /// <returns type="Error" mayBeNull="true"></returns>
  58. var e = Function._validateParams(arguments, [
  59. {name: "parameters"},
  60. {name: "expectedParameters"},
  61. {name: "validateParameterCount", type: Boolean, optional: true}
  62. ]);
  63. if (e) throw e;
  64. return Function._validateParams(parameters, expectedParameters, validateParameterCount);
  65. }
  66. Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) {
  67. var e, expectedLength = expectedParams.length;
  68. validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined");
  69. e = Function._validateParameterCount(params, expectedParams, validateParameterCount);
  70. if (e) {
  71. e.popStackFrame();
  72. return e;
  73. }
  74. for (var i = 0, l = params.length; i < l; i++) {
  75. var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
  76. paramName = expectedParam.name;
  77. if (expectedParam.parameterArray) {
  78. paramName += "[" + (i - expectedLength + 1) + "]";
  79. }
  80. else if (!validateParameterCount && (i >= expectedLength)) {
  81. break;
  82. }
  83. e = Function._validateParameter(params[i], expectedParam, paramName);
  84. if (e) {
  85. e.popStackFrame();
  86. return e;
  87. }
  88. }
  89. return null;
  90. }
  91. Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) {
  92. var i, error,
  93. expectedLen = expectedParams.length,
  94. actualLen = params.length;
  95. if (actualLen < expectedLen) {
  96. var minParams = expectedLen;
  97. for (i = 0; i < expectedLen; i++) {
  98. var param = expectedParams[i];
  99. if (param.optional || param.parameterArray) {
  100. minParams--;
  101. }
  102. }
  103. if (actualLen < minParams) {
  104. error = true;
  105. }
  106. }
  107. else if (validateParameterCount && (actualLen > expectedLen)) {
  108. error = true;
  109. for (i = 0; i < expectedLen; i++) {
  110. if (expectedParams[i].parameterArray) {
  111. error = false;
  112. break;
  113. }
  114. }
  115. }
  116. if (error) {
  117. var e = Error.parameterCount();
  118. e.popStackFrame();
  119. return e;
  120. }
  121. return null;
  122. }
  123. Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
  124. var e,
  125. expectedType = expectedParam.type,
  126. expectedInteger = !!expectedParam.integer,
  127. expectedDomElement = !!expectedParam.domElement,
  128. mayBeNull = !!expectedParam.mayBeNull;
  129. e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  130. if (e) {
  131. e.popStackFrame();
  132. return e;
  133. }
  134. var expectedElementType = expectedParam.elementType,
  135. elementMayBeNull = !!expectedParam.elementMayBeNull;
  136. if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
  137. (expectedElementType || !elementMayBeNull)) {
  138. var expectedElementInteger = !!expectedParam.elementInteger,
  139. expectedElementDomElement = !!expectedParam.elementDomElement;
  140. for (var i=0; i < param.length; i++) {
  141. var elem = param[i];
  142. e = Function._validateParameterType(elem, expectedElementType,
  143. expectedElementInteger, expectedElementDomElement, elementMayBeNull,
  144. paramName + "[" + i + "]");
  145. if (e) {
  146. e.popStackFrame();
  147. return e;
  148. }
  149. }
  150. }
  151. return null;
  152. }
  153. Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  154. var e, i;
  155. if (typeof(param) === "undefined") {
  156. if (mayBeNull) {
  157. return null;
  158. }
  159. else {
  160. e = Error.argumentUndefined(paramName);
  161. e.popStackFrame();
  162. return e;
  163. }
  164. }
  165. if (param === null) {
  166. if (mayBeNull) {
  167. return null;
  168. }
  169. else {
  170. e = Error.argumentNull(paramName);
  171. e.popStackFrame();
  172. return e;
  173. }
  174. }
  175. if (expectedType && expectedType.__enum) {
  176. if (typeof(param) !== 'number') {
  177. e = Error.argumentType(paramName, Object.getType(param), expectedType);
  178. e.popStackFrame();
  179. return e;
  180. }
  181. if ((param % 1) === 0) {
  182. var values = expectedType.prototype;
  183. if (!expectedType.__flags || (param === 0)) {
  184. for (i in values) {
  185. if (values[i] === param) return null;
  186. }
  187. }
  188. else {
  189. var v = param;
  190. for (i in values) {
  191. var vali = values[i];
  192. if (vali === 0) continue;
  193. if ((vali & param) === vali) {
  194. v -= vali;
  195. }
  196. if (v === 0) return null;
  197. }
  198. }
  199. }
  200. e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
  201. e.popStackFrame();
  202. return e;
  203. }
  204. if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) {
  205. e = Error.argument(paramName, Sys.Res.argumentDomElement);
  206. e.popStackFrame();
  207. return e;
  208. }
  209. if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {
  210. e = Error.argumentType(paramName, Object.getType(param), expectedType);
  211. e.popStackFrame();
  212. return e;
  213. }
  214. if (expectedType === Number && expectedInteger) {
  215. if ((param % 1) !== 0) {
  216. e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
  217. e.popStackFrame();
  218. return e;
  219. }
  220. }
  221. return null;
  222. }
  223. Error.__typeName = 'Error';
  224. Error.__class = true;
  225. Error.create = function Error$create(message, errorInfo) {
  226. /// <summary locid="M:J#Error.create" />
  227. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  228. /// <param name="errorInfo" optional="true" mayBeNull="true"></param>
  229. /// <returns type="Error"></returns>
  230. var e = Function._validateParams(arguments, [
  231. {name: "message", type: String, mayBeNull: true, optional: true},
  232. {name: "errorInfo", mayBeNull: true, optional: true}
  233. ]);
  234. if (e) throw e;
  235. var err = new Error(message);
  236. err.message = message;
  237. if (errorInfo) {
  238. for (var v in errorInfo) {
  239. err[v] = errorInfo[v];
  240. }
  241. }
  242. err.popStackFrame();
  243. return err;
  244. }
  245. Error.argument = function Error$argument(paramName, message) {
  246. /// <summary locid="M:J#Error.argument" />
  247. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  248. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  249. /// <returns></returns>
  250. var e = Function._validateParams(arguments, [
  251. {name: "paramName", type: String, mayBeNull: true, optional: true},
  252. {name: "message", type: String, mayBeNull: true, optional: true}
  253. ]);
  254. if (e) throw e;
  255. var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument);
  256. if (paramName) {
  257. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  258. }
  259. var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  260. err.popStackFrame();
  261. return err;
  262. }
  263. Error.argumentNull = function Error$argumentNull(paramName, message) {
  264. /// <summary locid="M:J#Error.argumentNull" />
  265. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  266. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  267. /// <returns></returns>
  268. var e = Function._validateParams(arguments, [
  269. {name: "paramName", type: String, mayBeNull: true, optional: true},
  270. {name: "message", type: String, mayBeNull: true, optional: true}
  271. ]);
  272. if (e) throw e;
  273. var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull);
  274. if (paramName) {
  275. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  276. }
  277. var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  278. err.popStackFrame();
  279. return err;
  280. }
  281. Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
  282. /// <summary locid="M:J#Error.argumentOutOfRange" />
  283. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  284. /// <param name="actualValue" optional="true" mayBeNull="true"></param>
  285. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  286. /// <returns></returns>
  287. var e = Function._validateParams(arguments, [
  288. {name: "paramName", type: String, mayBeNull: true, optional: true},
  289. {name: "actualValue", mayBeNull: true, optional: true},
  290. {name: "message", type: String, mayBeNull: true, optional: true}
  291. ]);
  292. if (e) throw e;
  293. var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange);
  294. if (paramName) {
  295. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  296. }
  297. if (typeof(actualValue) !== "undefined" && actualValue !== null) {
  298. displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
  299. }
  300. var err = Error.create(displayMessage, {
  301. name: "Sys.ArgumentOutOfRangeException",
  302. paramName: paramName,
  303. actualValue: actualValue
  304. });
  305. err.popStackFrame();
  306. return err;
  307. }
  308. Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
  309. /// <summary locid="M:J#Error.argumentType" />
  310. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  311. /// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
  312. /// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
  313. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  314. /// <returns></returns>
  315. var e = Function._validateParams(arguments, [
  316. {name: "paramName", type: String, mayBeNull: true, optional: true},
  317. {name: "actualType", type: Type, mayBeNull: true, optional: true},
  318. {name: "expectedType", type: Type, mayBeNull: true, optional: true},
  319. {name: "message", type: String, mayBeNull: true, optional: true}
  320. ]);
  321. if (e) throw e;
  322. var displayMessage = "Sys.ArgumentTypeException: ";
  323. if (message) {
  324. displayMessage += message;
  325. }
  326. else if (actualType && expectedType) {
  327. displayMessage +=
  328. String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
  329. }
  330. else {
  331. displayMessage += Sys.Res.argumentType;
  332. }
  333. if (paramName) {
  334. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  335. }
  336. var err = Error.create(displayMessage, {
  337. name: "Sys.ArgumentTypeException",
  338. paramName: paramName,
  339. actualType: actualType,
  340. expectedType: expectedType
  341. });
  342. err.popStackFrame();
  343. return err;
  344. }
  345. Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
  346. /// <summary locid="M:J#Error.argumentUndefined" />
  347. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  348. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  349. /// <returns></returns>
  350. var e = Function._validateParams(arguments, [
  351. {name: "paramName", type: String, mayBeNull: true, optional: true},
  352. {name: "message", type: String, mayBeNull: true, optional: true}
  353. ]);
  354. if (e) throw e;
  355. var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined);
  356. if (paramName) {
  357. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  358. }
  359. var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  360. err.popStackFrame();
  361. return err;
  362. }
  363. Error.format = function Error$format(message) {
  364. /// <summary locid="M:J#Error.format" />
  365. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  366. /// <returns></returns>
  367. var e = Function._validateParams(arguments, [
  368. {name: "message", type: String, mayBeNull: true, optional: true}
  369. ]);
  370. if (e) throw e;
  371. var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format);
  372. var err = Error.create(displayMessage, {name: 'Sys.FormatException'});
  373. err.popStackFrame();
  374. return err;
  375. }
  376. Error.invalidOperation = function Error$invalidOperation(message) {
  377. /// <summary locid="M:J#Error.invalidOperation" />
  378. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  379. /// <returns></returns>
  380. var e = Function._validateParams(arguments, [
  381. {name: "message", type: String, mayBeNull: true, optional: true}
  382. ]);
  383. if (e) throw e;
  384. var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation);
  385. var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
  386. err.popStackFrame();
  387. return err;
  388. }
  389. Error.notImplemented = function Error$notImplemented(message) {
  390. /// <summary locid="M:J#Error.notImplemented" />
  391. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  392. /// <returns></returns>
  393. var e = Function._validateParams(arguments, [
  394. {name: "message", type: String, mayBeNull: true, optional: true}
  395. ]);
  396. if (e) throw e;
  397. var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented);
  398. var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
  399. err.popStackFrame();
  400. return err;
  401. }
  402. Error.parameterCount = function Error$parameterCount(message) {
  403. /// <summary locid="M:J#Error.parameterCount" />
  404. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  405. /// <returns></returns>
  406. var e = Function._validateParams(arguments, [
  407. {name: "message", type: String, mayBeNull: true, optional: true}
  408. ]);
  409. if (e) throw e;
  410. var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount);
  411. var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
  412. err.popStackFrame();
  413. return err;
  414. }
  415. Error.prototype.popStackFrame = function Error$popStackFrame() {
  416. /// <summary locid="M:J#checkParam" />
  417. if (arguments.length !== 0) throw Error.parameterCount();
  418. if (typeof(this.stack) === "undefined" || this.stack === null ||
  419. typeof(this.fileName) === "undefined" || this.fileName === null ||
  420. typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
  421. return;
  422. }
  423. var stackFrames = this.stack.split("\n");
  424. var currentFrame = stackFrames[0];
  425. var pattern = this.fileName + ":" + this.lineNumber;
  426. while(typeof(currentFrame) !== "undefined" &&
  427. currentFrame !== null &&
  428. currentFrame.indexOf(pattern) === -1) {
  429. stackFrames.shift();
  430. currentFrame = stackFrames[0];
  431. }
  432. var nextFrame = stackFrames[1];
  433. if (typeof(nextFrame) === "undefined" || nextFrame === null) {
  434. return;
  435. }
  436. var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
  437. if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
  438. return;
  439. }
  440. this.fileName = nextFrameParts[1];
  441. this.lineNumber = parseInt(nextFrameParts[2]);
  442. stackFrames.shift();
  443. this.stack = stackFrames.join("\n");
  444. }
  445. Object.__typeName = 'Object';
  446. Object.__class = true;
  447. Object.getType = function Object$getType(instance) {
  448. /// <summary locid="M:J#Object.getType" />
  449. /// <param name="instance"></param>
  450. /// <returns type="Type"></returns>
  451. var e = Function._validateParams(arguments, [
  452. {name: "instance"}
  453. ]);
  454. if (e) throw e;
  455. var ctor = instance.constructor;
  456. if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) {
  457. return Object;
  458. }
  459. return ctor;
  460. }
  461. Object.getTypeName = function Object$getTypeName(instance) {
  462. /// <summary locid="M:J#Object.getTypeName" />
  463. /// <param name="instance"></param>
  464. /// <returns type="String"></returns>
  465. var e = Function._validateParams(arguments, [
  466. {name: "instance"}
  467. ]);
  468. if (e) throw e;
  469. return Object.getType(instance).getName();
  470. }
  471. String.__typeName = 'String';
  472. String.__class = true;
  473. String.prototype.endsWith = function String$endsWith(suffix) {
  474. /// <summary locid="M:J#String.endsWith" />
  475. /// <param name="suffix" type="String"></param>
  476. /// <returns type="Boolean"></returns>
  477. var e = Function._validateParams(arguments, [
  478. {name: "suffix", type: String}
  479. ]);
  480. if (e) throw e;
  481. return (this.substr(this.length - suffix.length) === suffix);
  482. }
  483. String.prototype.startsWith = function String$startsWith(prefix) {
  484. /// <summary locid="M:J#String.startsWith" />
  485. /// <param name="prefix" type="String"></param>
  486. /// <returns type="Boolean"></returns>
  487. var e = Function._validateParams(arguments, [
  488. {name: "prefix", type: String}
  489. ]);
  490. if (e) throw e;
  491. return (this.substr(0, prefix.length) === prefix);
  492. }
  493. String.prototype.trim = function String$trim() {
  494. /// <summary locid="M:J#String.trim" />
  495. /// <returns type="String"></returns>
  496. if (arguments.length !== 0) throw Error.parameterCount();
  497. return this.replace(/^\s+|\s+$/g, '');
  498. }
  499. String.prototype.trimEnd = function String$trimEnd() {
  500. /// <summary locid="M:J#String.trimEnd" />
  501. /// <returns type="String"></returns>
  502. if (arguments.length !== 0) throw Error.parameterCount();
  503. return this.replace(/\s+$/, '');
  504. }
  505. String.prototype.trimStart = function String$trimStart() {
  506. /// <summary locid="M:J#String.trimStart" />
  507. /// <returns type="String"></returns>
  508. if (arguments.length !== 0) throw Error.parameterCount();
  509. return this.replace(/^\s+/, '');
  510. }
  511. String.format = function String$format(format, args) {
  512. /// <summary locid="M:J#String.format" />
  513. /// <param name="format" type="String"></param>
  514. /// <param name="args" parameterArray="true" mayBeNull="true"></param>
  515. /// <returns type="String"></returns>
  516. var e = Function._validateParams(arguments, [
  517. {name: "format", type: String},
  518. {name: "args", mayBeNull: true, parameterArray: true}
  519. ]);
  520. if (e) throw e;
  521. return String._toFormattedString(false, arguments);
  522. }
  523. String._toFormattedString = function String$_toFormattedString(useLocale, args) {
  524. var result = '';
  525. var format = args[0];
  526. for (var i=0;;) {
  527. var open = format.indexOf('{', i);
  528. var close = format.indexOf('}', i);
  529. if ((open < 0) && (close < 0)) {
  530. result += format.slice(i);
  531. break;
  532. }
  533. if ((close > 0) && ((close < open) || (open < 0))) {
  534. if (format.charAt(close + 1) !== '}') {
  535. throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
  536. }
  537. result += format.slice(i, close + 1);
  538. i = close + 2;
  539. continue;
  540. }
  541. result += format.slice(i, open);
  542. i = open + 1;
  543. if (format.charAt(i) === '{') {
  544. result += '{';
  545. i++;
  546. continue;
  547. }
  548. if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
  549. var brace = format.substring(i, close);
  550. var colonIndex = brace.indexOf(':');
  551. var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1;
  552. if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid);
  553. var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);
  554. var arg = args[argNumber];
  555. if (typeof(arg) === "undefined" || arg === null) {
  556. arg = '';
  557. }
  558. if (arg.toFormattedString) {
  559. result += arg.toFormattedString(argFormat);
  560. }
  561. else if (useLocale && arg.localeFormat) {
  562. result += arg.localeFormat(argFormat);
  563. }
  564. else if (arg.format) {
  565. result += arg.format(argFormat);
  566. }
  567. else
  568. result += arg.toString();
  569. i = close + 1;
  570. }
  571. return result;
  572. }
  573. Boolean.__typeName = 'Boolean';
  574. Boolean.__class = true;
  575. Boolean.parse = function Boolean$parse(value) {
  576. /// <summary locid="M:J#Boolean.parse" />
  577. /// <param name="value" type="String"></param>
  578. /// <returns type="Boolean"></returns>
  579. var e = Function._validateParams(arguments, [
  580. {name: "value", type: String}
  581. ], false);
  582. if (e) throw e;
  583. var v = value.trim().toLowerCase();
  584. if (v === 'false') return false;
  585. if (v === 'true') return true;
  586. throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
  587. }
  588. Date.__typeName = 'Date';
  589. Date.__class = true;
  590. Number.__typeName = 'Number';
  591. Number.__class = true;
  592. RegExp.__typeName = 'RegExp';
  593. RegExp.__class = true;
  594. if (!window) this.window = this;
  595. window.Type = Function;
  596. Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
  597. Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");
  598. Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
  599. /// <summary locid="M:J#Type.callBaseMethod" />
  600. /// <param name="instance"></param>
  601. /// <param name="name" type="String"></param>
  602. /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
  603. /// <returns></returns>
  604. var e = Function._validateParams(arguments, [
  605. {name: "instance"},
  606. {name: "name", type: String},
  607. {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
  608. ]);
  609. if (e) throw e;
  610. var baseMethod = Sys._getBaseMethod(this, instance, name);
  611. if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
  612. if (!baseArguments) {
  613. return baseMethod.apply(instance);
  614. }
  615. else {
  616. return baseMethod.apply(instance, baseArguments);
  617. }
  618. }
  619. Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
  620. /// <summary locid="M:J#Type.getBaseMethod" />
  621. /// <param name="instance"></param>
  622. /// <param name="name" type="String"></param>
  623. /// <returns type="Function" mayBeNull="true"></returns>
  624. var e = Function._validateParams(arguments, [
  625. {name: "instance"},
  626. {name: "name", type: String}
  627. ]);
  628. if (e) throw e;
  629. return Sys._getBaseMethod(this, instance, name);
  630. }
  631. Type.prototype.getBaseType = function Type$getBaseType() {
  632. /// <summary locid="M:J#Type.getBaseType" />
  633. /// <returns type="Type" mayBeNull="true"></returns>
  634. if (arguments.length !== 0) throw Error.parameterCount();
  635. return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
  636. }
  637. Type.prototype.getInterfaces = function Type$getInterfaces() {
  638. /// <summary locid="M:J#Type.getInterfaces" />
  639. /// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></returns>
  640. if (arguments.length !== 0) throw Error.parameterCount();
  641. var result = [];
  642. var type = this;
  643. while(type) {
  644. var interfaces = type.__interfaces;
  645. if (interfaces) {
  646. for (var i = 0, l = interfaces.length; i < l; i++) {
  647. var interfaceType = interfaces[i];
  648. if (!Array.contains(result, interfaceType)) {
  649. result[result.length] = interfaceType;
  650. }
  651. }
  652. }
  653. type = type.__baseType;
  654. }
  655. return result;
  656. }
  657. Type.prototype.getName = function Type$getName() {
  658. /// <summary locid="M:J#Type.getName" />
  659. /// <returns type="String"></returns>
  660. if (arguments.length !== 0) throw Error.parameterCount();
  661. return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
  662. }
  663. Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
  664. /// <summary locid="M:J#Type.implementsInterface" />
  665. /// <param name="interfaceType" type="Type"></param>
  666. /// <returns type="Boolean"></returns>
  667. var e = Function._validateParams(arguments, [
  668. {name: "interfaceType", type: Type}
  669. ]);
  670. if (e) throw e;
  671. this.resolveInheritance();
  672. var interfaceName = interfaceType.getName();
  673. var cache = this.__interfaceCache;
  674. if (cache) {
  675. var cacheEntry = cache[interfaceName];
  676. if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
  677. }
  678. else {
  679. cache = this.__interfaceCache = {};
  680. }
  681. var baseType = this;
  682. while (baseType) {
  683. var interfaces = baseType.__interfaces;
  684. if (interfaces) {
  685. if (Array.indexOf(interfaces, interfaceType) !== -1) {
  686. return cache[interfaceName] = true;
  687. }
  688. }
  689. baseType = baseType.__baseType;
  690. }
  691. return cache[interfaceName] = false;
  692. }
  693. Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
  694. /// <summary locid="M:J#Type.inheritsFrom" />
  695. /// <param name="parentType" type="Type"></param>
  696. /// <returns type="Boolean"></returns>
  697. var e = Function._validateParams(arguments, [
  698. {name: "parentType", type: Type}
  699. ]);
  700. if (e) throw e;
  701. this.resolveInheritance();
  702. var baseType = this.__baseType;
  703. while (baseType) {
  704. if (baseType === parentType) {
  705. return true;
  706. }
  707. baseType = baseType.__baseType;
  708. }
  709. return false;
  710. }
  711. Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
  712. /// <summary locid="M:J#Type.initializeBase" />
  713. /// <param name="instance"></param>
  714. /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
  715. /// <returns></returns>
  716. var e = Function._validateParams(arguments, [
  717. {name: "instance"},
  718. {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
  719. ]);
  720. if (e) throw e;
  721. if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this);
  722. this.resolveInheritance();
  723. if (this.__baseType) {
  724. if (!baseArguments) {
  725. this.__baseType.apply(instance);
  726. }
  727. else {
  728. this.__baseType.apply(instance, baseArguments);
  729. }
  730. }
  731. return instance;
  732. }
  733. Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
  734. /// <summary locid="M:J#Type.isImplementedBy" />
  735. /// <param name="instance" mayBeNull="true"></param>
  736. /// <returns type="Boolean"></returns>
  737. var e = Function._validateParams(arguments, [
  738. {name: "instance", mayBeNull: true}
  739. ]);
  740. if (e) throw e;
  741. if (typeof(instance) === "undefined" || instance === null) return false;
  742. var instanceType = Object.getType(instance);
  743. return !!(instanceType.implementsInterface && instanceType.implementsInterface(this));
  744. }
  745. Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
  746. /// <summary locid="M:J#Type.isInstanceOfType" />
  747. /// <param name="instance" mayBeNull="true"></param>
  748. /// <returns type="Boolean"></returns>
  749. var e = Function._validateParams(arguments, [
  750. {name: "instance", mayBeNull: true}
  751. ]);
  752. if (e) throw e;
  753. return Sys._isInstanceOfType(this, instance);
  754. }
  755. Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
  756. /// <summary locid="M:J#Type.registerClass" />
  757. /// <param name="typeName" type="String"></param>
  758. /// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
  759. /// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
  760. /// <returns type="Type"></returns>
  761. var e = Function._validateParams(arguments, [
  762. {name: "typeName", type: String},
  763. {name: "baseType", type: Type, mayBeNull: true, optional: true},
  764. {name: "interfaceTypes", type: Type, parameterArray: true}
  765. ]);
  766. if (e) throw e;
  767. if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
  768. var parsedName;
  769. try {
  770. parsedName = eval(typeName);
  771. }
  772. catch(e) {
  773. throw Error.argument('typeName', Sys.Res.argumentTypeName);
  774. }
  775. if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
  776. if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
  777. if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
  778. if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass);
  779. this.prototype.constructor = this;
  780. this.__typeName = typeName;
  781. this.__class = true;
  782. if (baseType) {
  783. this.__baseType = baseType;
  784. this.__basePrototypePending = true;
  785. }
  786. Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
  787. if (interfaceTypes) {
  788. this.__interfaces = [];
  789. this.resolveInheritance();
  790. for (var i = 2, l = arguments.length; i < l; i++) {
  791. var interfaceType = arguments[i];
  792. if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface);
  793. for (var methodName in interfaceType.prototype) {
  794. var method = interfaceType.prototype[methodName];
  795. if (!this.prototype[methodName]) {
  796. this.prototype[methodName] = method;
  797. }
  798. }
  799. this.__interfaces.push(interfaceType);
  800. }
  801. }
  802. Sys.__registeredTypes[typeName] = true;
  803. return this;
  804. }
  805. Type.prototype.registerInterface = function Type$registerInterface(typeName) {
  806. /// <summary locid="M:J#Type.registerInterface" />
  807. /// <param name="typeName" type="String"></param>
  808. /// <returns type="Type"></returns>
  809. var e = Function._validateParams(arguments, [
  810. {name: "typeName", type: String}
  811. ]);
  812. if (e) throw e;
  813. if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
  814. var parsedName;
  815. try {
  816. parsedName = eval(typeName);
  817. }
  818. catch(e) {
  819. throw Error.argument('typeName', Sys.Res.argumentTypeName);
  820. }
  821. if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
  822. if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
  823. Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
  824. this.prototype.constructor = this;
  825. this.__typeName = typeName;
  826. this.__interface = true;
  827. Sys.__registeredTypes[typeName] = true;
  828. return this;
  829. }
  830. Type.prototype.resolveInheritance = function Type$resolveInheritance() {
  831. /// <summary locid="M:J#Type.resolveInheritance" />
  832. if (arguments.length !== 0) throw Error.parameterCount();
  833. if (this.__basePrototypePending) {
  834. var baseType = this.__baseType;
  835. baseType.resolveInheritance();
  836. for (var memberName in baseType.prototype) {
  837. var memberValue = baseType.prototype[memberName];
  838. if (!this.prototype[memberName]) {
  839. this.prototype[memberName] = memberValue;
  840. }
  841. }
  842. delete this.__basePrototypePending;
  843. }
  844. }
  845. Type.getRootNamespaces = function Type$getRootNamespaces() {
  846. /// <summary locid="M:J#Type.getRootNamespaces" />
  847. /// <returns type="Array"></returns>
  848. if (arguments.length !== 0) throw Error.parameterCount();
  849. return Array.clone(Sys.__rootNamespaces);
  850. }
  851. Type.isClass = function Type$isClass(type) {
  852. /// <summary locid="M:J#Type.isClass" />
  853. /// <param name="type" mayBeNull="true"></param>
  854. /// <returns type="Boolean"></returns>
  855. var e = Function._validateParams(arguments, [
  856. {name: "type", mayBeNull: true}
  857. ]);
  858. if (e) throw e;
  859. if ((typeof(type) === 'undefined') || (type === null)) return false;
  860. return !!type.__class;
  861. }
  862. Type.isInterface = function Type$isInterface(type) {
  863. /// <summary locid="M:J#Type.isInterface" />
  864. /// <param name="type" mayBeNull="true"></param>
  865. /// <returns type="Boolean"></returns>
  866. var e = Function._validateParams(arguments, [
  867. {name: "type", mayBeNull: true}
  868. ]);
  869. if (e) throw e;
  870. if ((typeof(type) === 'undefined') || (type === null)) return false;
  871. return !!type.__interface;
  872. }
  873. Type.isNamespace = function Type$isNamespace(object) {
  874. /// <summary locid="M:J#Type.isNamespace" />
  875. /// <param name="object" mayBeNull="true"></param>
  876. /// <returns type="Boolean"></returns>
  877. var e = Function._validateParams(arguments, [
  878. {name: "object", mayBeNull: true}
  879. ]);
  880. if (e) throw e;
  881. if ((typeof(object) === 'undefined') || (object === null)) return false;
  882. return !!object.__namespace;
  883. }
  884. Type.parse = function Type$parse(typeName, ns) {
  885. /// <summary locid="M:J#Type.parse" />
  886. /// <param name="typeName" type="String" mayBeNull="true"></param>
  887. /// <param name="ns" optional="true" mayBeNull="true"></param>
  888. /// <returns type="Type" mayBeNull="true"></returns>
  889. var e = Function._validateParams(arguments, [
  890. {name: "typeName", type: String, mayBeNull: true},
  891. {name: "ns", mayBeNull: true, optional: true}
  892. ]);
  893. if (e) throw e;
  894. var fn;
  895. if (ns) {
  896. fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
  897. return fn || null;
  898. }
  899. if (!typeName) return null;
  900. if (!Type.__htClasses) {
  901. Type.__htClasses = {};
  902. }
  903. fn = Type.__htClasses[typeName];
  904. if (!fn) {
  905. fn = eval(typeName);
  906. if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName);
  907. Type.__htClasses[typeName] = fn;
  908. }
  909. return fn;
  910. }
  911. Type.registerNamespace = function Type$registerNamespace(namespacePath) {
  912. /// <summary locid="M:J#Type.registerNamespace" />
  913. /// <param name="namespacePath" type="String"></param>
  914. var e = Function._validateParams(arguments, [
  915. {name: "namespacePath", type: String}
  916. ]);
  917. if (e) throw e;
  918. Type._registerNamespace(namespacePath);
  919. }
  920. Type._registerNamespace = function Type$_registerNamespace(namespacePath) {
  921. if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
  922. var rootObject = window;
  923. var namespaceParts = namespacePath.split('.');
  924. for (var i = 0; i < namespaceParts.length; i++) {
  925. var currentPart = namespaceParts[i];
  926. var ns = rootObject[currentPart];
  927. var nsType = typeof(ns);
  928. if ((nsType !== "undefined") && (ns !== null)) {
  929. if (nsType === "function") {
  930. throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.')));
  931. }
  932. if ((typeof(ns) !== "object") || (ns instanceof Array)) {
  933. throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.')));
  934. }
  935. }
  936. if (!ns) {
  937. ns = rootObject[currentPart] = {};
  938. }
  939. if (!ns.__namespace) {
  940. if ((i === 0) && (namespacePath !== "Sys")) {
  941. Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns;
  942. }
  943. ns.__namespace = true;
  944. ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
  945. var parsedName;
  946. try {
  947. parsedName = eval(ns.__typeName);
  948. }
  949. catch(e) {
  950. parsedName = null;
  951. }
  952. if (parsedName !== ns) {
  953. delete rootObject[currentPart];
  954. throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
  955. }
  956. ns.getName = function ns$getName() {return this.__typeName;}
  957. }
  958. rootObject = ns;
  959. }
  960. }
  961. Type._checkDependency = function Type$_checkDependency(dependency, featureName) {
  962. var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false);
  963. if ((typeof(featureName) !== 'undefined') && !isDependent) {
  964. throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
  965. featureName, dependency));
  966. }
  967. return isDependent;
  968. }
  969. Type._registerScript = function Type$_registerScript(scriptName, dependencies) {
  970. var scripts = Type._registerScript._scripts;
  971. if (!scripts) {
  972. Type._registerScript._scripts = scripts = {};
  973. }
  974. if (scripts[scriptName]) {
  975. throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName));
  976. }
  977. scripts[scriptName] = true;
  978. if (dependencies) {
  979. for (var i = 0, l = dependencies.length; i < l; i++) {
  980. var dependency = dependencies[i];
  981. if (!Type._checkDependency(dependency)) {
  982. throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency));
  983. }
  984. }
  985. }
  986. }
  987. Type._registerNamespace("Sys");
  988. Sys.__upperCaseTypes = {};
  989. Sys.__rootNamespaces = [Sys];
  990. Sys.__registeredTypes = {};
  991. Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) {
  992. if (typeof(instance) === "undefined" || instance === null) return false;
  993. if (instance instanceof type) return true;
  994. var instanceType = Object.getType(instance);
  995. return !!(instanceType === type) ||
  996. (instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
  997. (instanceType.implementsInterface && instanceType.implementsInterface(type));
  998. }
  999. Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
  1000. if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
  1001. var baseType = type.getBaseType();
  1002. if (baseType) {
  1003. var baseMethod = baseType.prototype[name];
  1004. return (baseMethod instanceof Function) ? baseMethod : null;
  1005. }
  1006. return null;
  1007. }
  1008. Sys._isDomElement = function Sys$_isDomElement(obj) {
  1009. var val = false;
  1010. if (typeof (obj.nodeType) !== 'number') {
  1011. var doc = obj.ownerDocument || obj.document || obj;
  1012. if (doc != obj) {
  1013. var w = doc.defaultView || doc.parentWindow;
  1014. val = (w != obj);
  1015. }
  1016. else {
  1017. val = (typeof (doc.body) === 'undefined');
  1018. }
  1019. }
  1020. return !val;
  1021. }
  1022. Array.__typeName = 'Array';
  1023. Array.__class = true;
  1024. Array.add = Array.enqueue = function Array$enqueue(array, item) {
  1025. /// <summary locid="M:J#Array.enqueue" />
  1026. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1027. /// <param name="item" mayBeNull="true"></param>
  1028. var e = Function._validateParams(arguments, [
  1029. {name: "array", type: Array, elementMayBeNull: true},
  1030. {name: "item", mayBeNull: true}
  1031. ]);
  1032. if (e) throw e;
  1033. array[array.length] = item;
  1034. }
  1035. Array.addRange = function Array$addRange(array, items) {
  1036. /// <summary locid="M:J#Array.addRange" />
  1037. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1038. /// <param name="items" type="Array" elementMayBeNull="true"></param>
  1039. var e = Function._validateParams(arguments, [
  1040. {name: "array", type: Array, elementMayBeNull: true},
  1041. {name: "items", type: Array, elementMayBeNull: true}
  1042. ]);
  1043. if (e) throw e;
  1044. array.push.apply(array, items);
  1045. }
  1046. Array.clear = function Array$clear(array) {
  1047. /// <summary locid="M:J#Array.clear" />
  1048. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1049. var e = Function._validateParams(arguments, [
  1050. {name: "array", type: Array, elementMayBeNull: true}
  1051. ]);
  1052. if (e) throw e;
  1053. array.length = 0;
  1054. }
  1055. Array.clone = function Array$clone(array) {
  1056. /// <summary locid="M:J#Array.clone" />
  1057. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1058. /// <returns type="Array" elementMayBeNull="true"></returns>
  1059. var e = Function._validateParams(arguments, [
  1060. {name: "array", type: Array, elementMayBeNull: true}
  1061. ]);
  1062. if (e) throw e;
  1063. if (array.length === 1) {
  1064. return [array[0]];
  1065. }
  1066. else {
  1067. return Array.apply(null, array);
  1068. }
  1069. }
  1070. Array.contains = function Array$contains(array, item) {
  1071. /// <summary locid="M:J#Array.contains" />
  1072. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1073. /// <param name="item" mayBeNull="true"></param>
  1074. /// <returns type="Boolean"></returns>
  1075. var e = Function._validateParams(arguments, [
  1076. {name: "array", type: Array, elementMayBeNull: true},
  1077. {name: "item", mayBeNull: true}
  1078. ]);
  1079. if (e) throw e;
  1080. return (Sys._indexOf(array, item) >= 0);
  1081. }
  1082. Array.dequeue = function Array$dequeue(array) {
  1083. /// <summary locid="M:J#Array.dequeue" />
  1084. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1085. /// <returns mayBeNull="true"></returns>
  1086. var e = Function._validateParams(arguments, [
  1087. {name: "array", type: Array, elementMayBeNull: true}
  1088. ]);
  1089. if (e) throw e;
  1090. return array.shift();
  1091. }
  1092. Array.forEach = function Array$forEach(array, method, instance) {
  1093. /// <summary locid="M:J#Array.forEach" />
  1094. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1095. /// <param name="method" type="Function"></param>
  1096. /// <param name="instance" optional="true" mayBeNull="true"></param>
  1097. var e = Function._validateParams(arguments, [
  1098. {name: "array", type: Array, elementMayBeNull: true},
  1099. {name: "method", type: Function},
  1100. {name: "instance", mayBeNull: true, optional: true}
  1101. ]);
  1102. if (e) throw e;
  1103. for (var i = 0, l = array.length; i < l; i++) {
  1104. var elt = array[i];
  1105. if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
  1106. }
  1107. }
  1108. Array.indexOf = function Array$indexOf(array, item, start) {
  1109. /// <summary locid="M:J#Array.indexOf" />
  1110. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1111. /// <param name="item" optional="true" mayBeNull="true"></param>
  1112. /// <param name="start" optional="true" mayBeNull="true"></param>
  1113. /// <returns type="Number"></returns>
  1114. var e = Function._validateParams(arguments, [
  1115. {name: "array", type: Array, elementMayBeNull: true},
  1116. {name: "item", mayBeNull: true, optional: true},
  1117. {name: "start", mayBeNull: true, optional: true}
  1118. ]);
  1119. if (e) throw e;
  1120. return Sys._indexOf(array, item, start);
  1121. }
  1122. Array.insert = function Array$insert(array, index, item) {
  1123. /// <summary locid="M:J#Array.insert" />
  1124. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1125. /// <param name="index" mayBeNull="true"></param>
  1126. /// <param name="item" mayBeNull="true"></param>
  1127. var e = Function._validateParams(arguments, [
  1128. {name: "array", type: Array, elementMayBeNull: true},
  1129. {name: "index", mayBeNull: true},
  1130. {name: "item", mayBeNull: true}
  1131. ]);
  1132. if (e) throw e;
  1133. array.splice(index, 0, item);
  1134. }
  1135. Array.parse = function Array$parse(value) {
  1136. /// <summary locid="M:J#Array.parse" />
  1137. /// <param name="value" type="String" mayBeNull="true"></param>
  1138. /// <returns type="Array" elementMayBeNull="true"></returns>
  1139. var e = Function._validateParams(arguments, [
  1140. {name: "value", type: String, mayBeNull: true}
  1141. ]);
  1142. if (e) throw e;
  1143. if (!value) return [];
  1144. var v = eval(value);
  1145. if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat);
  1146. return v;
  1147. }
  1148. Array.remove = function Array$remove(array, item) {
  1149. /// <summary locid="M:J#Array.remove" />
  1150. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1151. /// <param name="item" mayBeNull="true"></param>
  1152. /// <returns type="Boolean"></returns>
  1153. var e = Function._validateParams(arguments, [
  1154. {name: "array", type: Array, elementMayBeNull: true},
  1155. {name: "item", mayBeNull: true}
  1156. ]);
  1157. if (e) throw e;
  1158. var index = Sys._indexOf(array, item);
  1159. if (index >= 0) {
  1160. array.splice(index, 1);
  1161. }
  1162. return (index >= 0);
  1163. }
  1164. Array.removeAt = function Array$removeAt(array, index) {
  1165. /// <summary locid="M:J#Array.removeAt" />
  1166. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1167. /// <param name="index" mayBeNull="true"></param>
  1168. var e = Function._validateParams(arguments, [
  1169. {name: "array", type: Array, elementMayBeNull: true},
  1170. {name: "index", mayBeNull: true}
  1171. ]);
  1172. if (e) throw e;
  1173. array.splice(index, 1);
  1174. }
  1175. Sys._indexOf = function Sys$_indexOf(array, item, start) {
  1176. if (typeof(item) === "undefined") return -1;
  1177. var length = array.length;
  1178. if (length !== 0) {
  1179. start = start - 0;
  1180. if (isNaN(start)) {
  1181. start = 0;
  1182. }
  1183. else {
  1184. if (isFinite(start)) {
  1185. start = start - (start % 1);
  1186. }
  1187. if (start < 0) {
  1188. start = Math.max(0, length + start);
  1189. }
  1190. }
  1191. for (var i = start; i < length; i++) {
  1192. if ((typeof(array[i]) !== "undefined") && (array[i] === item)) {
  1193. return i;
  1194. }
  1195. }
  1196. }
  1197. return -1;
  1198. }
  1199. Type._registerScript._scripts = {
  1200. "MicrosoftAjaxCore.js": true,
  1201. "MicrosoftAjaxGlobalization.js": true,
  1202. "MicrosoftAjaxSerialization.js": true,
  1203. "MicrosoftAjaxComponentModel.js": true,
  1204. "MicrosoftAjaxHistory.js": true,
  1205. "MicrosoftAjaxNetwork.js" : true,
  1206. "MicrosoftAjaxWebServices.js": true };
  1207. Sys.IDisposable = function Sys$IDi

Large files files are truncated, but you can click here to view the full file