mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-30 19:56:54 +00:00
86eb70bcbb
Moved Plugin scripts to Scripts (Compatibility with Nuget). jquery.validate.unobtrusive.min.js no longer uses CDN (Now a Nuget package).
7117 lines
302 KiB
JavaScript
7117 lines
302 KiB
JavaScript
// Name: MicrosoftAjax.debug.js
|
|
// Assembly: System.Web.Extensions
|
|
// Version: 4.0.0.0
|
|
// FileVersion: 4.0.20526.0
|
|
//-----------------------------------------------------------------------
|
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------
|
|
// MicrosoftAjax.js
|
|
// Microsoft AJAX Framework.
|
|
|
|
Function.__typeName = 'Function';
|
|
Function.__class = true;
|
|
Function.createCallback = function Function$createCallback(method, context) {
|
|
/// <summary locid="M:J#Function.createCallback" />
|
|
/// <param name="method" type="Function"></param>
|
|
/// <param name="context" mayBeNull="true"></param>
|
|
/// <returns type="Function"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "method", type: Function},
|
|
{name: "context", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
return function() {
|
|
var l = arguments.length;
|
|
if (l > 0) {
|
|
var args = [];
|
|
for (var i = 0; i < l; i++) {
|
|
args[i] = arguments[i];
|
|
}
|
|
args[l] = context;
|
|
return method.apply(this, args);
|
|
}
|
|
return method.call(this, context);
|
|
}
|
|
}
|
|
Function.createDelegate = function Function$createDelegate(instance, method) {
|
|
/// <summary locid="M:J#Function.createDelegate" />
|
|
/// <param name="instance" mayBeNull="true"></param>
|
|
/// <param name="method" type="Function"></param>
|
|
/// <returns type="Function"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance", mayBeNull: true},
|
|
{name: "method", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
return function() {
|
|
return method.apply(instance, arguments);
|
|
}
|
|
}
|
|
Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
|
|
/// <summary locid="M:J#Function.emptyMethod" />
|
|
}
|
|
Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) {
|
|
/// <summary locid="M:J#Function.validateParameters" />
|
|
/// <param name="parameters"></param>
|
|
/// <param name="expectedParameters"></param>
|
|
/// <param name="validateParameterCount" type="Boolean" optional="true"></param>
|
|
/// <returns type="Error" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "parameters"},
|
|
{name: "expectedParameters"},
|
|
{name: "validateParameterCount", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
return Function._validateParams(parameters, expectedParameters, validateParameterCount);
|
|
}
|
|
Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) {
|
|
var e, expectedLength = expectedParams.length;
|
|
validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined");
|
|
e = Function._validateParameterCount(params, expectedParams, validateParameterCount);
|
|
if (e) {
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
for (var i = 0, l = params.length; i < l; i++) {
|
|
var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
|
|
paramName = expectedParam.name;
|
|
if (expectedParam.parameterArray) {
|
|
paramName += "[" + (i - expectedLength + 1) + "]";
|
|
}
|
|
else if (!validateParameterCount && (i >= expectedLength)) {
|
|
break;
|
|
}
|
|
e = Function._validateParameter(params[i], expectedParam, paramName);
|
|
if (e) {
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) {
|
|
var i, error,
|
|
expectedLen = expectedParams.length,
|
|
actualLen = params.length;
|
|
if (actualLen < expectedLen) {
|
|
var minParams = expectedLen;
|
|
for (i = 0; i < expectedLen; i++) {
|
|
var param = expectedParams[i];
|
|
if (param.optional || param.parameterArray) {
|
|
minParams--;
|
|
}
|
|
}
|
|
if (actualLen < minParams) {
|
|
error = true;
|
|
}
|
|
}
|
|
else if (validateParameterCount && (actualLen > expectedLen)) {
|
|
error = true;
|
|
for (i = 0; i < expectedLen; i++) {
|
|
if (expectedParams[i].parameterArray) {
|
|
error = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (error) {
|
|
var e = Error.parameterCount();
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
return null;
|
|
}
|
|
Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
|
|
var e,
|
|
expectedType = expectedParam.type,
|
|
expectedInteger = !!expectedParam.integer,
|
|
expectedDomElement = !!expectedParam.domElement,
|
|
mayBeNull = !!expectedParam.mayBeNull;
|
|
e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
|
|
if (e) {
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
var expectedElementType = expectedParam.elementType,
|
|
elementMayBeNull = !!expectedParam.elementMayBeNull;
|
|
if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
|
|
(expectedElementType || !elementMayBeNull)) {
|
|
var expectedElementInteger = !!expectedParam.elementInteger,
|
|
expectedElementDomElement = !!expectedParam.elementDomElement;
|
|
for (var i=0; i < param.length; i++) {
|
|
var elem = param[i];
|
|
e = Function._validateParameterType(elem, expectedElementType,
|
|
expectedElementInteger, expectedElementDomElement, elementMayBeNull,
|
|
paramName + "[" + i + "]");
|
|
if (e) {
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
|
|
var e, i;
|
|
if (typeof(param) === "undefined") {
|
|
if (mayBeNull) {
|
|
return null;
|
|
}
|
|
else {
|
|
e = Error.argumentUndefined(paramName);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
}
|
|
if (param === null) {
|
|
if (mayBeNull) {
|
|
return null;
|
|
}
|
|
else {
|
|
e = Error.argumentNull(paramName);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
}
|
|
if (expectedType && expectedType.__enum) {
|
|
if (typeof(param) !== 'number') {
|
|
e = Error.argumentType(paramName, Object.getType(param), expectedType);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
if ((param % 1) === 0) {
|
|
var values = expectedType.prototype;
|
|
if (!expectedType.__flags || (param === 0)) {
|
|
for (i in values) {
|
|
if (values[i] === param) return null;
|
|
}
|
|
}
|
|
else {
|
|
var v = param;
|
|
for (i in values) {
|
|
var vali = values[i];
|
|
if (vali === 0) continue;
|
|
if ((vali & param) === vali) {
|
|
v -= vali;
|
|
}
|
|
if (v === 0) return null;
|
|
}
|
|
}
|
|
}
|
|
e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) {
|
|
e = Error.argument(paramName, Sys.Res.argumentDomElement);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {
|
|
e = Error.argumentType(paramName, Object.getType(param), expectedType);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
if (expectedType === Number && expectedInteger) {
|
|
if ((param % 1) !== 0) {
|
|
e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
Error.__typeName = 'Error';
|
|
Error.__class = true;
|
|
Error.create = function Error$create(message, errorInfo) {
|
|
/// <summary locid="M:J#Error.create" />
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="errorInfo" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Error"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true, optional: true},
|
|
{name: "errorInfo", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var err = new Error(message);
|
|
err.message = message;
|
|
if (errorInfo) {
|
|
for (var v in errorInfo) {
|
|
err[v] = errorInfo[v];
|
|
}
|
|
}
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.argument = function Error$argument(paramName, message) {
|
|
/// <summary locid="M:J#Error.argument" />
|
|
/// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "paramName", type: String, mayBeNull: true, optional: true},
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument);
|
|
if (paramName) {
|
|
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
|
|
}
|
|
var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.argumentNull = function Error$argumentNull(paramName, message) {
|
|
/// <summary locid="M:J#Error.argumentNull" />
|
|
/// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "paramName", type: String, mayBeNull: true, optional: true},
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull);
|
|
if (paramName) {
|
|
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
|
|
}
|
|
var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
|
|
/// <summary locid="M:J#Error.argumentOutOfRange" />
|
|
/// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="actualValue" optional="true" mayBeNull="true"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "paramName", type: String, mayBeNull: true, optional: true},
|
|
{name: "actualValue", mayBeNull: true, optional: true},
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange);
|
|
if (paramName) {
|
|
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
|
|
}
|
|
if (typeof(actualValue) !== "undefined" && actualValue !== null) {
|
|
displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
|
|
}
|
|
var err = Error.create(displayMessage, {
|
|
name: "Sys.ArgumentOutOfRangeException",
|
|
paramName: paramName,
|
|
actualValue: actualValue
|
|
});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
|
|
/// <summary locid="M:J#Error.argumentType" />
|
|
/// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
|
|
/// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "paramName", type: String, mayBeNull: true, optional: true},
|
|
{name: "actualType", type: Type, mayBeNull: true, optional: true},
|
|
{name: "expectedType", type: Type, mayBeNull: true, optional: true},
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ArgumentTypeException: ";
|
|
if (message) {
|
|
displayMessage += message;
|
|
}
|
|
else if (actualType && expectedType) {
|
|
displayMessage +=
|
|
String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
|
|
}
|
|
else {
|
|
displayMessage += Sys.Res.argumentType;
|
|
}
|
|
if (paramName) {
|
|
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
|
|
}
|
|
var err = Error.create(displayMessage, {
|
|
name: "Sys.ArgumentTypeException",
|
|
paramName: paramName,
|
|
actualType: actualType,
|
|
expectedType: expectedType
|
|
});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
|
|
/// <summary locid="M:J#Error.argumentUndefined" />
|
|
/// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "paramName", type: String, mayBeNull: true, optional: true},
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined);
|
|
if (paramName) {
|
|
displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
|
|
}
|
|
var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.format = function Error$format(message) {
|
|
/// <summary locid="M:J#Error.format" />
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format);
|
|
var err = Error.create(displayMessage, {name: 'Sys.FormatException'});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.invalidOperation = function Error$invalidOperation(message) {
|
|
/// <summary locid="M:J#Error.invalidOperation" />
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation);
|
|
var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.notImplemented = function Error$notImplemented(message) {
|
|
/// <summary locid="M:J#Error.notImplemented" />
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented);
|
|
var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.parameterCount = function Error$parameterCount(message) {
|
|
/// <summary locid="M:J#Error.parameterCount" />
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount);
|
|
var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
|
|
err.popStackFrame();
|
|
return err;
|
|
}
|
|
Error.prototype.popStackFrame = function Error$popStackFrame() {
|
|
/// <summary locid="M:J#checkParam" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (typeof(this.stack) === "undefined" || this.stack === null ||
|
|
typeof(this.fileName) === "undefined" || this.fileName === null ||
|
|
typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
|
|
return;
|
|
}
|
|
var stackFrames = this.stack.split("\n");
|
|
var currentFrame = stackFrames[0];
|
|
var pattern = this.fileName + ":" + this.lineNumber;
|
|
while(typeof(currentFrame) !== "undefined" &&
|
|
currentFrame !== null &&
|
|
currentFrame.indexOf(pattern) === -1) {
|
|
stackFrames.shift();
|
|
currentFrame = stackFrames[0];
|
|
}
|
|
var nextFrame = stackFrames[1];
|
|
if (typeof(nextFrame) === "undefined" || nextFrame === null) {
|
|
return;
|
|
}
|
|
var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
|
|
if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
|
|
return;
|
|
}
|
|
this.fileName = nextFrameParts[1];
|
|
this.lineNumber = parseInt(nextFrameParts[2]);
|
|
stackFrames.shift();
|
|
this.stack = stackFrames.join("\n");
|
|
}
|
|
|
|
Object.__typeName = 'Object';
|
|
Object.__class = true;
|
|
Object.getType = function Object$getType(instance) {
|
|
/// <summary locid="M:J#Object.getType" />
|
|
/// <param name="instance"></param>
|
|
/// <returns type="Type"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance"}
|
|
]);
|
|
if (e) throw e;
|
|
var ctor = instance.constructor;
|
|
if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) {
|
|
return Object;
|
|
}
|
|
return ctor;
|
|
}
|
|
Object.getTypeName = function Object$getTypeName(instance) {
|
|
/// <summary locid="M:J#Object.getTypeName" />
|
|
/// <param name="instance"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance"}
|
|
]);
|
|
if (e) throw e;
|
|
return Object.getType(instance).getName();
|
|
}
|
|
|
|
String.__typeName = 'String';
|
|
String.__class = true;
|
|
String.prototype.endsWith = function String$endsWith(suffix) {
|
|
/// <summary locid="M:J#String.endsWith" />
|
|
/// <param name="suffix" type="String"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "suffix", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return (this.substr(this.length - suffix.length) === suffix);
|
|
}
|
|
String.prototype.startsWith = function String$startsWith(prefix) {
|
|
/// <summary locid="M:J#String.startsWith" />
|
|
/// <param name="prefix" type="String"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "prefix", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return (this.substr(0, prefix.length) === prefix);
|
|
}
|
|
String.prototype.trim = function String$trim() {
|
|
/// <summary locid="M:J#String.trim" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this.replace(/^\s+|\s+$/g, '');
|
|
}
|
|
String.prototype.trimEnd = function String$trimEnd() {
|
|
/// <summary locid="M:J#String.trimEnd" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this.replace(/\s+$/, '');
|
|
}
|
|
String.prototype.trimStart = function String$trimStart() {
|
|
/// <summary locid="M:J#String.trimStart" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this.replace(/^\s+/, '');
|
|
}
|
|
String.format = function String$format(format, args) {
|
|
/// <summary locid="M:J#String.format" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <param name="args" parameterArray="true" mayBeNull="true"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String},
|
|
{name: "args", mayBeNull: true, parameterArray: true}
|
|
]);
|
|
if (e) throw e;
|
|
return String._toFormattedString(false, arguments);
|
|
}
|
|
String._toFormattedString = function String$_toFormattedString(useLocale, args) {
|
|
var result = '';
|
|
var format = args[0];
|
|
for (var i=0;;) {
|
|
var open = format.indexOf('{', i);
|
|
var close = format.indexOf('}', i);
|
|
if ((open < 0) && (close < 0)) {
|
|
result += format.slice(i);
|
|
break;
|
|
}
|
|
if ((close > 0) && ((close < open) || (open < 0))) {
|
|
if (format.charAt(close + 1) !== '}') {
|
|
throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
|
|
}
|
|
result += format.slice(i, close + 1);
|
|
i = close + 2;
|
|
continue;
|
|
}
|
|
result += format.slice(i, open);
|
|
i = open + 1;
|
|
if (format.charAt(i) === '{') {
|
|
result += '{';
|
|
i++;
|
|
continue;
|
|
}
|
|
if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
|
|
var brace = format.substring(i, close);
|
|
var colonIndex = brace.indexOf(':');
|
|
var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1;
|
|
if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid);
|
|
var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);
|
|
var arg = args[argNumber];
|
|
if (typeof(arg) === "undefined" || arg === null) {
|
|
arg = '';
|
|
}
|
|
if (arg.toFormattedString) {
|
|
result += arg.toFormattedString(argFormat);
|
|
}
|
|
else if (useLocale && arg.localeFormat) {
|
|
result += arg.localeFormat(argFormat);
|
|
}
|
|
else if (arg.format) {
|
|
result += arg.format(argFormat);
|
|
}
|
|
else
|
|
result += arg.toString();
|
|
i = close + 1;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
Boolean.__typeName = 'Boolean';
|
|
Boolean.__class = true;
|
|
Boolean.parse = function Boolean$parse(value) {
|
|
/// <summary locid="M:J#Boolean.parse" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String}
|
|
], false);
|
|
if (e) throw e;
|
|
var v = value.trim().toLowerCase();
|
|
if (v === 'false') return false;
|
|
if (v === 'true') return true;
|
|
throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
|
|
}
|
|
|
|
Date.__typeName = 'Date';
|
|
Date.__class = true;
|
|
|
|
Number.__typeName = 'Number';
|
|
Number.__class = true;
|
|
|
|
RegExp.__typeName = 'RegExp';
|
|
RegExp.__class = true;
|
|
|
|
if (!window) this.window = this;
|
|
window.Type = Function;
|
|
Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
|
|
Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");
|
|
Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
|
|
/// <summary locid="M:J#Type.callBaseMethod" />
|
|
/// <param name="instance"></param>
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance"},
|
|
{name: "name", type: String},
|
|
{name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var baseMethod = Sys._getBaseMethod(this, instance, name);
|
|
if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
|
|
if (!baseArguments) {
|
|
return baseMethod.apply(instance);
|
|
}
|
|
else {
|
|
return baseMethod.apply(instance, baseArguments);
|
|
}
|
|
}
|
|
Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
|
|
/// <summary locid="M:J#Type.getBaseMethod" />
|
|
/// <param name="instance"></param>
|
|
/// <param name="name" type="String"></param>
|
|
/// <returns type="Function" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance"},
|
|
{name: "name", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return Sys._getBaseMethod(this, instance, name);
|
|
}
|
|
Type.prototype.getBaseType = function Type$getBaseType() {
|
|
/// <summary locid="M:J#Type.getBaseType" />
|
|
/// <returns type="Type" mayBeNull="true"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
|
|
}
|
|
Type.prototype.getInterfaces = function Type$getInterfaces() {
|
|
/// <summary locid="M:J#Type.getInterfaces" />
|
|
/// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var result = [];
|
|
var type = this;
|
|
while(type) {
|
|
var interfaces = type.__interfaces;
|
|
if (interfaces) {
|
|
for (var i = 0, l = interfaces.length; i < l; i++) {
|
|
var interfaceType = interfaces[i];
|
|
if (!Array.contains(result, interfaceType)) {
|
|
result[result.length] = interfaceType;
|
|
}
|
|
}
|
|
}
|
|
type = type.__baseType;
|
|
}
|
|
return result;
|
|
}
|
|
Type.prototype.getName = function Type$getName() {
|
|
/// <summary locid="M:J#Type.getName" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
|
|
}
|
|
Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
|
|
/// <summary locid="M:J#Type.implementsInterface" />
|
|
/// <param name="interfaceType" type="Type"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "interfaceType", type: Type}
|
|
]);
|
|
if (e) throw e;
|
|
this.resolveInheritance();
|
|
var interfaceName = interfaceType.getName();
|
|
var cache = this.__interfaceCache;
|
|
if (cache) {
|
|
var cacheEntry = cache[interfaceName];
|
|
if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
|
|
}
|
|
else {
|
|
cache = this.__interfaceCache = {};
|
|
}
|
|
var baseType = this;
|
|
while (baseType) {
|
|
var interfaces = baseType.__interfaces;
|
|
if (interfaces) {
|
|
if (Array.indexOf(interfaces, interfaceType) !== -1) {
|
|
return cache[interfaceName] = true;
|
|
}
|
|
}
|
|
baseType = baseType.__baseType;
|
|
}
|
|
return cache[interfaceName] = false;
|
|
}
|
|
Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
|
|
/// <summary locid="M:J#Type.inheritsFrom" />
|
|
/// <param name="parentType" type="Type"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "parentType", type: Type}
|
|
]);
|
|
if (e) throw e;
|
|
this.resolveInheritance();
|
|
var baseType = this.__baseType;
|
|
while (baseType) {
|
|
if (baseType === parentType) {
|
|
return true;
|
|
}
|
|
baseType = baseType.__baseType;
|
|
}
|
|
return false;
|
|
}
|
|
Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
|
|
/// <summary locid="M:J#Type.initializeBase" />
|
|
/// <param name="instance"></param>
|
|
/// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance"},
|
|
{name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this);
|
|
this.resolveInheritance();
|
|
if (this.__baseType) {
|
|
if (!baseArguments) {
|
|
this.__baseType.apply(instance);
|
|
}
|
|
else {
|
|
this.__baseType.apply(instance, baseArguments);
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
|
|
/// <summary locid="M:J#Type.isImplementedBy" />
|
|
/// <param name="instance" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (typeof(instance) === "undefined" || instance === null) return false;
|
|
var instanceType = Object.getType(instance);
|
|
return !!(instanceType.implementsInterface && instanceType.implementsInterface(this));
|
|
}
|
|
Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
|
|
/// <summary locid="M:J#Type.isInstanceOfType" />
|
|
/// <param name="instance" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "instance", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
return Sys._isInstanceOfType(this, instance);
|
|
}
|
|
Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
|
|
/// <summary locid="M:J#Type.registerClass" />
|
|
/// <param name="typeName" type="String"></param>
|
|
/// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
|
|
/// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
|
|
/// <returns type="Type"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "typeName", type: String},
|
|
{name: "baseType", type: Type, mayBeNull: true, optional: true},
|
|
{name: "interfaceTypes", type: Type, parameterArray: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
|
|
var parsedName;
|
|
try {
|
|
parsedName = eval(typeName);
|
|
}
|
|
catch(e) {
|
|
throw Error.argument('typeName', Sys.Res.argumentTypeName);
|
|
}
|
|
if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
|
|
if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
|
|
if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
|
|
if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass);
|
|
this.prototype.constructor = this;
|
|
this.__typeName = typeName;
|
|
this.__class = true;
|
|
if (baseType) {
|
|
this.__baseType = baseType;
|
|
this.__basePrototypePending = true;
|
|
}
|
|
Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
|
|
if (interfaceTypes) {
|
|
this.__interfaces = [];
|
|
this.resolveInheritance();
|
|
for (var i = 2, l = arguments.length; i < l; i++) {
|
|
var interfaceType = arguments[i];
|
|
if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface);
|
|
for (var methodName in interfaceType.prototype) {
|
|
var method = interfaceType.prototype[methodName];
|
|
if (!this.prototype[methodName]) {
|
|
this.prototype[methodName] = method;
|
|
}
|
|
}
|
|
this.__interfaces.push(interfaceType);
|
|
}
|
|
}
|
|
Sys.__registeredTypes[typeName] = true;
|
|
return this;
|
|
}
|
|
Type.prototype.registerInterface = function Type$registerInterface(typeName) {
|
|
/// <summary locid="M:J#Type.registerInterface" />
|
|
/// <param name="typeName" type="String"></param>
|
|
/// <returns type="Type"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "typeName", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
|
|
var parsedName;
|
|
try {
|
|
parsedName = eval(typeName);
|
|
}
|
|
catch(e) {
|
|
throw Error.argument('typeName', Sys.Res.argumentTypeName);
|
|
}
|
|
if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
|
|
if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
|
|
Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
|
|
this.prototype.constructor = this;
|
|
this.__typeName = typeName;
|
|
this.__interface = true;
|
|
Sys.__registeredTypes[typeName] = true;
|
|
return this;
|
|
}
|
|
Type.prototype.resolveInheritance = function Type$resolveInheritance() {
|
|
/// <summary locid="M:J#Type.resolveInheritance" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this.__basePrototypePending) {
|
|
var baseType = this.__baseType;
|
|
baseType.resolveInheritance();
|
|
for (var memberName in baseType.prototype) {
|
|
var memberValue = baseType.prototype[memberName];
|
|
if (!this.prototype[memberName]) {
|
|
this.prototype[memberName] = memberValue;
|
|
}
|
|
}
|
|
delete this.__basePrototypePending;
|
|
}
|
|
}
|
|
Type.getRootNamespaces = function Type$getRootNamespaces() {
|
|
/// <summary locid="M:J#Type.getRootNamespaces" />
|
|
/// <returns type="Array"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return Array.clone(Sys.__rootNamespaces);
|
|
}
|
|
Type.isClass = function Type$isClass(type) {
|
|
/// <summary locid="M:J#Type.isClass" />
|
|
/// <param name="type" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "type", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(type) === 'undefined') || (type === null)) return false;
|
|
return !!type.__class;
|
|
}
|
|
Type.isInterface = function Type$isInterface(type) {
|
|
/// <summary locid="M:J#Type.isInterface" />
|
|
/// <param name="type" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "type", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(type) === 'undefined') || (type === null)) return false;
|
|
return !!type.__interface;
|
|
}
|
|
Type.isNamespace = function Type$isNamespace(object) {
|
|
/// <summary locid="M:J#Type.isNamespace" />
|
|
/// <param name="object" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "object", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(object) === 'undefined') || (object === null)) return false;
|
|
return !!object.__namespace;
|
|
}
|
|
Type.parse = function Type$parse(typeName, ns) {
|
|
/// <summary locid="M:J#Type.parse" />
|
|
/// <param name="typeName" type="String" mayBeNull="true"></param>
|
|
/// <param name="ns" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Type" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "typeName", type: String, mayBeNull: true},
|
|
{name: "ns", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var fn;
|
|
if (ns) {
|
|
fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
|
|
return fn || null;
|
|
}
|
|
if (!typeName) return null;
|
|
if (!Type.__htClasses) {
|
|
Type.__htClasses = {};
|
|
}
|
|
fn = Type.__htClasses[typeName];
|
|
if (!fn) {
|
|
fn = eval(typeName);
|
|
if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName);
|
|
Type.__htClasses[typeName] = fn;
|
|
}
|
|
return fn;
|
|
}
|
|
Type.registerNamespace = function Type$registerNamespace(namespacePath) {
|
|
/// <summary locid="M:J#Type.registerNamespace" />
|
|
/// <param name="namespacePath" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "namespacePath", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
Type._registerNamespace(namespacePath);
|
|
}
|
|
Type._registerNamespace = function Type$_registerNamespace(namespacePath) {
|
|
if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
|
|
var rootObject = window;
|
|
var namespaceParts = namespacePath.split('.');
|
|
for (var i = 0; i < namespaceParts.length; i++) {
|
|
var currentPart = namespaceParts[i];
|
|
var ns = rootObject[currentPart];
|
|
var nsType = typeof(ns);
|
|
if ((nsType !== "undefined") && (ns !== null)) {
|
|
if (nsType === "function") {
|
|
throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.')));
|
|
}
|
|
if ((typeof(ns) !== "object") || (ns instanceof Array)) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.')));
|
|
}
|
|
}
|
|
if (!ns) {
|
|
ns = rootObject[currentPart] = {};
|
|
}
|
|
if (!ns.__namespace) {
|
|
if ((i === 0) && (namespacePath !== "Sys")) {
|
|
Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns;
|
|
}
|
|
ns.__namespace = true;
|
|
ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
|
|
var parsedName;
|
|
try {
|
|
parsedName = eval(ns.__typeName);
|
|
}
|
|
catch(e) {
|
|
parsedName = null;
|
|
}
|
|
if (parsedName !== ns) {
|
|
delete rootObject[currentPart];
|
|
throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
|
|
}
|
|
ns.getName = function ns$getName() {return this.__typeName;}
|
|
}
|
|
rootObject = ns;
|
|
}
|
|
}
|
|
Type._checkDependency = function Type$_checkDependency(dependency, featureName) {
|
|
var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false);
|
|
if ((typeof(featureName) !== 'undefined') && !isDependent) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
|
|
featureName, dependency));
|
|
}
|
|
return isDependent;
|
|
}
|
|
Type._registerScript = function Type$_registerScript(scriptName, dependencies) {
|
|
var scripts = Type._registerScript._scripts;
|
|
if (!scripts) {
|
|
Type._registerScript._scripts = scripts = {};
|
|
}
|
|
if (scripts[scriptName]) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName));
|
|
}
|
|
scripts[scriptName] = true;
|
|
if (dependencies) {
|
|
for (var i = 0, l = dependencies.length; i < l; i++) {
|
|
var dependency = dependencies[i];
|
|
if (!Type._checkDependency(dependency)) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Type._registerNamespace("Sys");
|
|
Sys.__upperCaseTypes = {};
|
|
Sys.__rootNamespaces = [Sys];
|
|
Sys.__registeredTypes = {};
|
|
Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) {
|
|
if (typeof(instance) === "undefined" || instance === null) return false;
|
|
if (instance instanceof type) return true;
|
|
var instanceType = Object.getType(instance);
|
|
return !!(instanceType === type) ||
|
|
(instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
|
|
(instanceType.implementsInterface && instanceType.implementsInterface(type));
|
|
}
|
|
Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
|
|
if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
|
|
var baseType = type.getBaseType();
|
|
if (baseType) {
|
|
var baseMethod = baseType.prototype[name];
|
|
return (baseMethod instanceof Function) ? baseMethod : null;
|
|
}
|
|
return null;
|
|
}
|
|
Sys._isDomElement = function Sys$_isDomElement(obj) {
|
|
var val = false;
|
|
if (typeof (obj.nodeType) !== 'number') {
|
|
var doc = obj.ownerDocument || obj.document || obj;
|
|
if (doc != obj) {
|
|
var w = doc.defaultView || doc.parentWindow;
|
|
val = (w != obj);
|
|
}
|
|
else {
|
|
val = (typeof (doc.body) === 'undefined');
|
|
}
|
|
}
|
|
return !val;
|
|
}
|
|
|
|
Array.__typeName = 'Array';
|
|
Array.__class = true;
|
|
Array.add = Array.enqueue = function Array$enqueue(array, item) {
|
|
/// <summary locid="M:J#Array.enqueue" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
array[array.length] = item;
|
|
}
|
|
Array.addRange = function Array$addRange(array, items) {
|
|
/// <summary locid="M:J#Array.addRange" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="items" type="Array" elementMayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "items", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
array.push.apply(array, items);
|
|
}
|
|
Array.clear = function Array$clear(array) {
|
|
/// <summary locid="M:J#Array.clear" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
array.length = 0;
|
|
}
|
|
Array.clone = function Array$clone(array) {
|
|
/// <summary locid="M:J#Array.clone" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <returns type="Array" elementMayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (array.length === 1) {
|
|
return [array[0]];
|
|
}
|
|
else {
|
|
return Array.apply(null, array);
|
|
}
|
|
}
|
|
Array.contains = function Array$contains(array, item) {
|
|
/// <summary locid="M:J#Array.contains" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
return (Sys._indexOf(array, item) >= 0);
|
|
}
|
|
Array.dequeue = function Array$dequeue(array) {
|
|
/// <summary locid="M:J#Array.dequeue" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <returns mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
return array.shift();
|
|
}
|
|
Array.forEach = function Array$forEach(array, method, instance) {
|
|
/// <summary locid="M:J#Array.forEach" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="method" type="Function"></param>
|
|
/// <param name="instance" optional="true" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "method", type: Function},
|
|
{name: "instance", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
for (var i = 0, l = array.length; i < l; i++) {
|
|
var elt = array[i];
|
|
if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
|
|
}
|
|
}
|
|
Array.indexOf = function Array$indexOf(array, item, start) {
|
|
/// <summary locid="M:J#Array.indexOf" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" optional="true" mayBeNull="true"></param>
|
|
/// <param name="start" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Number"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true, optional: true},
|
|
{name: "start", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
return Sys._indexOf(array, item, start);
|
|
}
|
|
Array.insert = function Array$insert(array, index, item) {
|
|
/// <summary locid="M:J#Array.insert" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="index" mayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "index", mayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
array.splice(index, 0, item);
|
|
}
|
|
Array.parse = function Array$parse(value) {
|
|
/// <summary locid="M:J#Array.parse" />
|
|
/// <param name="value" type="String" mayBeNull="true"></param>
|
|
/// <returns type="Array" elementMayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String, mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!value) return [];
|
|
var v = eval(value);
|
|
if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat);
|
|
return v;
|
|
}
|
|
Array.remove = function Array$remove(array, item) {
|
|
/// <summary locid="M:J#Array.remove" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var index = Sys._indexOf(array, item);
|
|
if (index >= 0) {
|
|
array.splice(index, 1);
|
|
}
|
|
return (index >= 0);
|
|
}
|
|
Array.removeAt = function Array$removeAt(array, index) {
|
|
/// <summary locid="M:J#Array.removeAt" />
|
|
/// <param name="array" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="index" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "array", type: Array, elementMayBeNull: true},
|
|
{name: "index", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
array.splice(index, 1);
|
|
}
|
|
Sys._indexOf = function Sys$_indexOf(array, item, start) {
|
|
if (typeof(item) === "undefined") return -1;
|
|
var length = array.length;
|
|
if (length !== 0) {
|
|
start = start - 0;
|
|
if (isNaN(start)) {
|
|
start = 0;
|
|
}
|
|
else {
|
|
if (isFinite(start)) {
|
|
start = start - (start % 1);
|
|
}
|
|
if (start < 0) {
|
|
start = Math.max(0, length + start);
|
|
}
|
|
}
|
|
for (var i = start; i < length; i++) {
|
|
if ((typeof(array[i]) !== "undefined") && (array[i] === item)) {
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
Type._registerScript._scripts = {
|
|
"MicrosoftAjaxCore.js": true,
|
|
"MicrosoftAjaxGlobalization.js": true,
|
|
"MicrosoftAjaxSerialization.js": true,
|
|
"MicrosoftAjaxComponentModel.js": true,
|
|
"MicrosoftAjaxHistory.js": true,
|
|
"MicrosoftAjaxNetwork.js" : true,
|
|
"MicrosoftAjaxWebServices.js": true };
|
|
|
|
Sys.IDisposable = function Sys$IDisposable() {
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$IDisposable$dispose() {
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.IDisposable.prototype = {
|
|
dispose: Sys$IDisposable$dispose
|
|
}
|
|
Sys.IDisposable.registerInterface('Sys.IDisposable');
|
|
|
|
Sys.StringBuilder = function Sys$StringBuilder(initialText) {
|
|
/// <summary locid="M:J#Sys.StringBuilder.#ctor" />
|
|
/// <param name="initialText" optional="true" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "initialText", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ?
|
|
[initialText.toString()] : [];
|
|
this._value = {};
|
|
this._len = 0;
|
|
}
|
|
function Sys$StringBuilder$append(text) {
|
|
/// <summary locid="M:J#Sys.StringBuilder.append" />
|
|
/// <param name="text" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "text", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
this._parts[this._parts.length] = text;
|
|
}
|
|
function Sys$StringBuilder$appendLine(text) {
|
|
/// <summary locid="M:J#Sys.StringBuilder.appendLine" />
|
|
/// <param name="text" optional="true" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "text", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
this._parts[this._parts.length] =
|
|
((typeof(text) === 'undefined') || (text === null) || (text === '')) ?
|
|
'\r\n' : text + '\r\n';
|
|
}
|
|
function Sys$StringBuilder$clear() {
|
|
/// <summary locid="M:J#Sys.StringBuilder.clear" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._parts = [];
|
|
this._value = {};
|
|
this._len = 0;
|
|
}
|
|
function Sys$StringBuilder$isEmpty() {
|
|
/// <summary locid="M:J#Sys.StringBuilder.isEmpty" />
|
|
/// <returns type="Boolean"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._parts.length === 0) return true;
|
|
return this.toString() === '';
|
|
}
|
|
function Sys$StringBuilder$toString(separator) {
|
|
/// <summary locid="M:J#Sys.StringBuilder.toString" />
|
|
/// <param name="separator" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "separator", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
separator = separator || '';
|
|
var parts = this._parts;
|
|
if (this._len !== parts.length) {
|
|
this._value = {};
|
|
this._len = parts.length;
|
|
}
|
|
var val = this._value;
|
|
if (typeof(val[separator]) === 'undefined') {
|
|
if (separator !== '') {
|
|
for (var i = 0; i < parts.length;) {
|
|
if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) {
|
|
parts.splice(i, 1);
|
|
}
|
|
else {
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
val[separator] = this._parts.join(separator);
|
|
}
|
|
return val[separator];
|
|
}
|
|
Sys.StringBuilder.prototype = {
|
|
append: Sys$StringBuilder$append,
|
|
appendLine: Sys$StringBuilder$appendLine,
|
|
clear: Sys$StringBuilder$clear,
|
|
isEmpty: Sys$StringBuilder$isEmpty,
|
|
toString: Sys$StringBuilder$toString
|
|
}
|
|
Sys.StringBuilder.registerClass('Sys.StringBuilder');
|
|
|
|
Sys.Browser = {};
|
|
Sys.Browser.InternetExplorer = {};
|
|
Sys.Browser.Firefox = {};
|
|
Sys.Browser.Safari = {};
|
|
Sys.Browser.Opera = {};
|
|
Sys.Browser.agent = null;
|
|
Sys.Browser.hasDebuggerStatement = false;
|
|
Sys.Browser.name = navigator.appName;
|
|
Sys.Browser.version = parseFloat(navigator.appVersion);
|
|
Sys.Browser.documentMode = 0;
|
|
if (navigator.userAgent.indexOf(' MSIE ') > -1) {
|
|
Sys.Browser.agent = Sys.Browser.InternetExplorer;
|
|
Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
|
|
if (Sys.Browser.version >= 8) {
|
|
if (document.documentMode >= 7) {
|
|
Sys.Browser.documentMode = document.documentMode;
|
|
}
|
|
}
|
|
Sys.Browser.hasDebuggerStatement = true;
|
|
}
|
|
else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
|
|
Sys.Browser.agent = Sys.Browser.Firefox;
|
|
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
|
|
Sys.Browser.name = 'Firefox';
|
|
Sys.Browser.hasDebuggerStatement = true;
|
|
}
|
|
else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) {
|
|
Sys.Browser.agent = Sys.Browser.Safari;
|
|
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]);
|
|
Sys.Browser.name = 'Safari';
|
|
}
|
|
else if (navigator.userAgent.indexOf('Opera/') > -1) {
|
|
Sys.Browser.agent = Sys.Browser.Opera;
|
|
}
|
|
|
|
Sys.EventArgs = function Sys$EventArgs() {
|
|
/// <summary locid="M:J#Sys.EventArgs.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
}
|
|
Sys.EventArgs.registerClass('Sys.EventArgs');
|
|
Sys.EventArgs.Empty = new Sys.EventArgs();
|
|
|
|
Sys.CancelEventArgs = function Sys$CancelEventArgs() {
|
|
/// <summary locid="M:J#Sys.CancelEventArgs.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
Sys.CancelEventArgs.initializeBase(this);
|
|
this._cancel = false;
|
|
}
|
|
function Sys$CancelEventArgs$get_cancel() {
|
|
/// <value type="Boolean" locid="P:J#Sys.CancelEventArgs.cancel"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._cancel;
|
|
}
|
|
function Sys$CancelEventArgs$set_cancel(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
|
|
if (e) throw e;
|
|
this._cancel = value;
|
|
}
|
|
Sys.CancelEventArgs.prototype = {
|
|
get_cancel: Sys$CancelEventArgs$get_cancel,
|
|
set_cancel: Sys$CancelEventArgs$set_cancel
|
|
}
|
|
Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs);
|
|
Type.registerNamespace('Sys.UI');
|
|
|
|
Sys._Debug = function Sys$_Debug() {
|
|
/// <summary locid="M:J#Sys.Debug.#ctor" />
|
|
/// <field name="isDebug" type="Boolean" locid="F:J#Sys.Debug.isDebug"></field>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
}
|
|
function Sys$_Debug$_appendConsole(text) {
|
|
if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
|
|
Debug.writeln(text);
|
|
}
|
|
if (window.console && window.console.log) {
|
|
window.console.log(text);
|
|
}
|
|
if (window.opera) {
|
|
window.opera.postError(text);
|
|
}
|
|
if (window.debugService) {
|
|
window.debugService.trace(text);
|
|
}
|
|
}
|
|
function Sys$_Debug$_appendTrace(text) {
|
|
var traceElement = document.getElementById('TraceConsole');
|
|
if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
|
|
traceElement.value += text + '\n';
|
|
}
|
|
}
|
|
function Sys$_Debug$assert(condition, message, displayCaller) {
|
|
/// <summary locid="M:J#Sys.Debug.assert" />
|
|
/// <param name="condition" type="Boolean"></param>
|
|
/// <param name="message" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <param name="displayCaller" type="Boolean" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "condition", type: Boolean},
|
|
{name: "message", type: String, mayBeNull: true, optional: true},
|
|
{name: "displayCaller", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!condition) {
|
|
message = (displayCaller && this.assert.caller) ?
|
|
String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) :
|
|
String.format(Sys.Res.assertFailed, message);
|
|
if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) {
|
|
this.fail(message);
|
|
}
|
|
}
|
|
}
|
|
function Sys$_Debug$clearTrace() {
|
|
/// <summary locid="M:J#Sys.Debug.clearTrace" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var traceElement = document.getElementById('TraceConsole');
|
|
if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
|
|
traceElement.value = '';
|
|
}
|
|
}
|
|
function Sys$_Debug$fail(message) {
|
|
/// <summary locid="M:J#Sys.Debug.fail" />
|
|
/// <param name="message" type="String" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "message", type: String, mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
this._appendConsole(message);
|
|
if (Sys.Browser.hasDebuggerStatement) {
|
|
eval('debugger');
|
|
}
|
|
}
|
|
function Sys$_Debug$trace(text) {
|
|
/// <summary locid="M:J#Sys.Debug.trace" />
|
|
/// <param name="text"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "text"}
|
|
]);
|
|
if (e) throw e;
|
|
this._appendConsole(text);
|
|
this._appendTrace(text);
|
|
}
|
|
function Sys$_Debug$traceDump(object, name) {
|
|
/// <summary locid="M:J#Sys.Debug.traceDump" />
|
|
/// <param name="object" mayBeNull="true"></param>
|
|
/// <param name="name" type="String" mayBeNull="true" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "object", mayBeNull: true},
|
|
{name: "name", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var text = this._traceDump(object, name, true);
|
|
}
|
|
function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) {
|
|
name = name? name : 'traceDump';
|
|
indentationPadding = indentationPadding? indentationPadding : '';
|
|
if (object === null) {
|
|
this.trace(indentationPadding + name + ': null');
|
|
return;
|
|
}
|
|
switch(typeof(object)) {
|
|
case 'undefined':
|
|
this.trace(indentationPadding + name + ': Undefined');
|
|
break;
|
|
case 'number': case 'string': case 'boolean':
|
|
this.trace(indentationPadding + name + ': ' + object);
|
|
break;
|
|
default:
|
|
if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) {
|
|
this.trace(indentationPadding + name + ': ' + object.toString());
|
|
break;
|
|
}
|
|
if (!loopArray) {
|
|
loopArray = [];
|
|
}
|
|
else if (Array.contains(loopArray, object)) {
|
|
this.trace(indentationPadding + name + ': ...');
|
|
return;
|
|
}
|
|
Array.add(loopArray, object);
|
|
if ((object == window) || (object === document) ||
|
|
(window.HTMLElement && (object instanceof HTMLElement)) ||
|
|
(typeof(object.nodeName) === 'string')) {
|
|
var tag = object.tagName? object.tagName : 'DomElement';
|
|
if (object.id) {
|
|
tag += ' - ' + object.id;
|
|
}
|
|
this.trace(indentationPadding + name + ' {' + tag + '}');
|
|
}
|
|
else {
|
|
var typeName = Object.getTypeName(object);
|
|
this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : ''));
|
|
if ((indentationPadding === '') || recursive) {
|
|
indentationPadding += " ";
|
|
var i, length, properties, p, v;
|
|
if (Array.isInstanceOfType(object)) {
|
|
length = object.length;
|
|
for (i = 0; i < length; i++) {
|
|
this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray);
|
|
}
|
|
}
|
|
else {
|
|
for (p in object) {
|
|
v = object[p];
|
|
if (!Function.isInstanceOfType(v)) {
|
|
this._traceDump(v, p, recursive, indentationPadding, loopArray);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Array.remove(loopArray, object);
|
|
}
|
|
}
|
|
Sys._Debug.prototype = {
|
|
_appendConsole: Sys$_Debug$_appendConsole,
|
|
_appendTrace: Sys$_Debug$_appendTrace,
|
|
assert: Sys$_Debug$assert,
|
|
clearTrace: Sys$_Debug$clearTrace,
|
|
fail: Sys$_Debug$fail,
|
|
trace: Sys$_Debug$trace,
|
|
traceDump: Sys$_Debug$traceDump,
|
|
_traceDump: Sys$_Debug$_traceDump
|
|
}
|
|
Sys._Debug.registerClass('Sys._Debug');
|
|
Sys.Debug = new Sys._Debug();
|
|
Sys.Debug.isDebug = true;
|
|
|
|
function Sys$Enum$parse(value, ignoreCase) {
|
|
/// <summary locid="M:J#Sys.Enum.parse" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <param name="ignoreCase" type="Boolean" optional="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String},
|
|
{name: "ignoreCase", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var values, parsed, val;
|
|
if (ignoreCase) {
|
|
values = this.__lowerCaseValues;
|
|
if (!values) {
|
|
this.__lowerCaseValues = values = {};
|
|
var prototype = this.prototype;
|
|
for (var name in prototype) {
|
|
values[name.toLowerCase()] = prototype[name];
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
values = this.prototype;
|
|
}
|
|
if (!this.__flags) {
|
|
val = (ignoreCase ? value.toLowerCase() : value);
|
|
parsed = values[val.trim()];
|
|
if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
|
|
return parsed;
|
|
}
|
|
else {
|
|
var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
|
|
var v = 0;
|
|
for (var i = parts.length - 1; i >= 0; i--) {
|
|
var part = parts[i].trim();
|
|
parsed = values[part];
|
|
if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName));
|
|
v |= parsed;
|
|
}
|
|
return v;
|
|
}
|
|
}
|
|
function Sys$Enum$toString(value) {
|
|
/// <summary locid="M:J#Sys.Enum.toString" />
|
|
/// <param name="value" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
|
|
if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this);
|
|
var values = this.prototype;
|
|
var i;
|
|
if (!this.__flags || (value === 0)) {
|
|
for (i in values) {
|
|
if (values[i] === value) {
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
var sorted = this.__sortedValues;
|
|
if (!sorted) {
|
|
sorted = [];
|
|
for (i in values) {
|
|
sorted[sorted.length] = {key: i, value: values[i]};
|
|
}
|
|
sorted.sort(function(a, b) {
|
|
return a.value - b.value;
|
|
});
|
|
this.__sortedValues = sorted;
|
|
}
|
|
var parts = [];
|
|
var v = value;
|
|
for (i = sorted.length - 1; i >= 0; i--) {
|
|
var kvp = sorted[i];
|
|
var vali = kvp.value;
|
|
if (vali === 0) continue;
|
|
if ((vali & value) === vali) {
|
|
parts[parts.length] = kvp.key;
|
|
v -= vali;
|
|
if (v === 0) break;
|
|
}
|
|
}
|
|
if (parts.length && v === 0) return parts.reverse().join(', ');
|
|
}
|
|
throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
|
|
}
|
|
Type.prototype.registerEnum = function Type$registerEnum(name, flags) {
|
|
/// <summary locid="M:J#Sys.UI.LineType.#ctor" />
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="flags" type="Boolean" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "name", type: String},
|
|
{name: "flags", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName);
|
|
var parsedName;
|
|
try {
|
|
parsedName = eval(name);
|
|
}
|
|
catch(e) {
|
|
throw Error.argument('name', Sys.Res.argumentTypeName);
|
|
}
|
|
if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName);
|
|
if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name));
|
|
for (var j in this.prototype) {
|
|
var val = this.prototype[j];
|
|
if (!Type.__identifierRegExp.test(j)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j));
|
|
if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger);
|
|
if (typeof(this[j]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, j));
|
|
}
|
|
Sys.__upperCaseTypes[name.toUpperCase()] = this;
|
|
for (var i in this.prototype) {
|
|
this[i] = this.prototype[i];
|
|
}
|
|
this.__typeName = name;
|
|
this.parse = Sys$Enum$parse;
|
|
this.__string = this.toString();
|
|
this.toString = Sys$Enum$toString;
|
|
this.__flags = flags;
|
|
this.__enum = true;
|
|
Sys.__registeredTypes[name] = true;
|
|
}
|
|
Type.isEnum = function Type$isEnum(type) {
|
|
/// <summary locid="M:J#Type.isEnum" />
|
|
/// <param name="type" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "type", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(type) === 'undefined') || (type === null)) return false;
|
|
return !!type.__enum;
|
|
}
|
|
Type.isFlags = function Type$isFlags(type) {
|
|
/// <summary locid="M:J#Type.isFlags" />
|
|
/// <param name="type" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "type", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((typeof(type) === 'undefined') || (type === null)) return false;
|
|
return !!type.__flags;
|
|
}
|
|
Sys.CollectionChange = function Sys$CollectionChange(action, newItems, newStartingIndex, oldItems, oldStartingIndex) {
|
|
/// <summary locid="M:J#Sys.CollectionChange.#ctor" />
|
|
/// <param name="action" type="Sys.NotifyCollectionChangedAction"></param>
|
|
/// <param name="newItems" optional="true" mayBeNull="true"></param>
|
|
/// <param name="newStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
|
|
/// <param name="oldItems" optional="true" mayBeNull="true"></param>
|
|
/// <param name="oldStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
|
|
/// <field name="action" type="Sys.NotifyCollectionChangedAction" locid="F:J#Sys.CollectionChange.action"></field>
|
|
/// <field name="newItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.newItems"></field>
|
|
/// <field name="newStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.newStartingIndex"></field>
|
|
/// <field name="oldItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.oldItems"></field>
|
|
/// <field name="oldStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.oldStartingIndex"></field>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "action", type: Sys.NotifyCollectionChangedAction},
|
|
{name: "newItems", mayBeNull: true, optional: true},
|
|
{name: "newStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true},
|
|
{name: "oldItems", mayBeNull: true, optional: true},
|
|
{name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
this.action = action;
|
|
if (newItems) {
|
|
if (!(newItems instanceof Array)) {
|
|
newItems = [newItems];
|
|
}
|
|
}
|
|
this.newItems = newItems || null;
|
|
if (typeof newStartingIndex !== "number") {
|
|
newStartingIndex = -1;
|
|
}
|
|
this.newStartingIndex = newStartingIndex;
|
|
if (oldItems) {
|
|
if (!(oldItems instanceof Array)) {
|
|
oldItems = [oldItems];
|
|
}
|
|
}
|
|
this.oldItems = oldItems || null;
|
|
if (typeof oldStartingIndex !== "number") {
|
|
oldStartingIndex = -1;
|
|
}
|
|
this.oldStartingIndex = oldStartingIndex;
|
|
}
|
|
Sys.CollectionChange.registerClass("Sys.CollectionChange");
|
|
Sys.NotifyCollectionChangedAction = function Sys$NotifyCollectionChangedAction() {
|
|
/// <summary locid="M:J#Sys.NotifyCollectionChangedAction.#ctor" />
|
|
/// <field name="add" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.add"></field>
|
|
/// <field name="remove" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.remove"></field>
|
|
/// <field name="reset" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.reset"></field>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.NotifyCollectionChangedAction.prototype = {
|
|
add: 0,
|
|
remove: 1,
|
|
reset: 2
|
|
}
|
|
Sys.NotifyCollectionChangedAction.registerEnum('Sys.NotifyCollectionChangedAction');
|
|
Sys.NotifyCollectionChangedEventArgs = function Sys$NotifyCollectionChangedEventArgs(changes) {
|
|
/// <summary locid="M:J#Sys.NotifyCollectionChangedEventArgs.#ctor" />
|
|
/// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "changes", type: Array, elementType: Sys.CollectionChange}
|
|
]);
|
|
if (e) throw e;
|
|
this._changes = changes;
|
|
Sys.NotifyCollectionChangedEventArgs.initializeBase(this);
|
|
}
|
|
function Sys$NotifyCollectionChangedEventArgs$get_changes() {
|
|
/// <value type="Array" elementType="Sys.CollectionChange" locid="P:J#Sys.NotifyCollectionChangedEventArgs.changes"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._changes || [];
|
|
}
|
|
Sys.NotifyCollectionChangedEventArgs.prototype = {
|
|
get_changes: Sys$NotifyCollectionChangedEventArgs$get_changes
|
|
}
|
|
Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs);
|
|
Sys.Observer = function Sys$Observer() {
|
|
throw Error.invalidOperation();
|
|
}
|
|
Sys.Observer.registerClass("Sys.Observer");
|
|
Sys.Observer.makeObservable = function Sys$Observer$makeObservable(target) {
|
|
/// <summary locid="M:J#Sys.Observer.makeObservable" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"}
|
|
]);
|
|
if (e) throw e;
|
|
var isArray = target instanceof Array,
|
|
o = Sys.Observer;
|
|
Sys.Observer._ensureObservable(target);
|
|
if (target.setValue === o._observeMethods.setValue) return target;
|
|
o._addMethods(target, o._observeMethods);
|
|
if (isArray) {
|
|
o._addMethods(target, o._arrayMethods);
|
|
}
|
|
return target;
|
|
}
|
|
Sys.Observer._ensureObservable = function Sys$Observer$_ensureObservable(target) {
|
|
var type = typeof target;
|
|
if ((type === "string") || (type === "number") || (type === "boolean") || (type === "date")) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.notObservable, type));
|
|
}
|
|
}
|
|
Sys.Observer._addMethods = function Sys$Observer$_addMethods(target, methods) {
|
|
for (var m in methods) {
|
|
if (target[m] && (target[m] !== methods[m])) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.observableConflict, m));
|
|
}
|
|
target[m] = methods[m];
|
|
}
|
|
}
|
|
Sys.Observer._addEventHandler = function Sys$Observer$_addEventHandler(target, eventName, handler) {
|
|
Sys.Observer._getContext(target, true).events._addHandler(eventName, handler);
|
|
}
|
|
Sys.Observer.addEventHandler = function Sys$Observer$addEventHandler(target, eventName, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.addEventHandler" />
|
|
/// <param name="target"></param>
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._addEventHandler(target, eventName, handler);
|
|
}
|
|
Sys.Observer._removeEventHandler = function Sys$Observer$_removeEventHandler(target, eventName, handler) {
|
|
Sys.Observer._getContext(target, true).events._removeHandler(eventName, handler);
|
|
}
|
|
Sys.Observer.removeEventHandler = function Sys$Observer$removeEventHandler(target, eventName, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.removeEventHandler" />
|
|
/// <param name="target"></param>
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._removeEventHandler(target, eventName, handler);
|
|
}
|
|
Sys.Observer.raiseEvent = function Sys$Observer$raiseEvent(target, eventName, eventArgs) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseEvent" />
|
|
/// <param name="target"></param>
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="eventArgs" type="Sys.EventArgs"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "eventName", type: String},
|
|
{name: "eventArgs", type: Sys.EventArgs}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
var ctx = Sys.Observer._getContext(target);
|
|
if (!ctx) return;
|
|
var handler = ctx.events.getHandler(eventName);
|
|
if (handler) {
|
|
handler(target, eventArgs);
|
|
}
|
|
}
|
|
Sys.Observer.addPropertyChanged = function Sys$Observer$addPropertyChanged(target, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.addPropertyChanged" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._addEventHandler(target, "propertyChanged", handler);
|
|
}
|
|
Sys.Observer.removePropertyChanged = function Sys$Observer$removePropertyChanged(target, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.removePropertyChanged" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._removeEventHandler(target, "propertyChanged", handler);
|
|
}
|
|
Sys.Observer.beginUpdate = function Sys$Observer$beginUpdate(target) {
|
|
/// <summary locid="M:J#Sys.Observer.beginUpdate" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._getContext(target, true).updating = true;
|
|
}
|
|
Sys.Observer.endUpdate = function Sys$Observer$endUpdate(target) {
|
|
/// <summary locid="M:J#Sys.Observer.endUpdate" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
var ctx = Sys.Observer._getContext(target);
|
|
if (!ctx || !ctx.updating) return;
|
|
ctx.updating = false;
|
|
var dirty = ctx.dirty;
|
|
ctx.dirty = false;
|
|
if (dirty) {
|
|
if (target instanceof Array) {
|
|
var changes = ctx.changes;
|
|
ctx.changes = null;
|
|
Sys.Observer.raiseCollectionChanged(target, changes);
|
|
}
|
|
Sys.Observer.raisePropertyChanged(target, "");
|
|
}
|
|
}
|
|
Sys.Observer.isUpdating = function Sys$Observer$isUpdating(target) {
|
|
/// <summary locid="M:J#Sys.Observer.isUpdating" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
var ctx = Sys.Observer._getContext(target);
|
|
return ctx ? ctx.updating : false;
|
|
}
|
|
Sys.Observer._setValue = function Sys$Observer$_setValue(target, propertyName, value) {
|
|
var getter, setter, mainTarget = target, path = propertyName.split('.');
|
|
for (var i = 0, l = (path.length - 1); i < l ; i++) {
|
|
var name = path[i];
|
|
getter = target["get_" + name];
|
|
if (typeof (getter) === "function") {
|
|
target = getter.call(target);
|
|
}
|
|
else {
|
|
target = target[name];
|
|
}
|
|
var type = typeof (target);
|
|
if ((target === null) || (type === "undefined")) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, propertyName));
|
|
}
|
|
}
|
|
var currentValue, lastPath = path[l];
|
|
getter = target["get_" + lastPath];
|
|
setter = target["set_" + lastPath];
|
|
if (typeof(getter) === 'function') {
|
|
currentValue = getter.call(target);
|
|
}
|
|
else {
|
|
currentValue = target[lastPath];
|
|
}
|
|
if (typeof(setter) === 'function') {
|
|
setter.call(target, value);
|
|
}
|
|
else {
|
|
target[lastPath] = value;
|
|
}
|
|
if (currentValue !== value) {
|
|
var ctx = Sys.Observer._getContext(mainTarget);
|
|
if (ctx && ctx.updating) {
|
|
ctx.dirty = true;
|
|
return;
|
|
};
|
|
Sys.Observer.raisePropertyChanged(mainTarget, path[0]);
|
|
}
|
|
}
|
|
Sys.Observer.setValue = function Sys$Observer$setValue(target, propertyName, value) {
|
|
/// <summary locid="M:J#Sys.Observer.setValue" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <param name="propertyName" type="String"></param>
|
|
/// <param name="value" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "propertyName", type: String},
|
|
{name: "value", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._ensureObservable(target);
|
|
Sys.Observer._setValue(target, propertyName, value);
|
|
}
|
|
Sys.Observer.raisePropertyChanged = function Sys$Observer$raisePropertyChanged(target, propertyName) {
|
|
/// <summary locid="M:J#Sys.Observer.raisePropertyChanged" />
|
|
/// <param name="target" mayBeNull="false"></param>
|
|
/// <param name="propertyName" type="String"></param>
|
|
Sys.Observer.raiseEvent(target, "propertyChanged", new Sys.PropertyChangedEventArgs(propertyName));
|
|
}
|
|
Sys.Observer.addCollectionChanged = function Sys$Observer$addCollectionChanged(target, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.addCollectionChanged" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._addEventHandler(target, "collectionChanged", handler);
|
|
}
|
|
Sys.Observer.removeCollectionChanged = function Sys$Observer$removeCollectionChanged(target, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.removeCollectionChanged" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._removeEventHandler(target, "collectionChanged", handler);
|
|
}
|
|
Sys.Observer._collectionChange = function Sys$Observer$_collectionChange(target, change) {
|
|
var ctx = Sys.Observer._getContext(target);
|
|
if (ctx && ctx.updating) {
|
|
ctx.dirty = true;
|
|
var changes = ctx.changes;
|
|
if (!changes) {
|
|
ctx.changes = changes = [change];
|
|
}
|
|
else {
|
|
changes.push(change);
|
|
}
|
|
}
|
|
else {
|
|
Sys.Observer.raiseCollectionChanged(target, [change]);
|
|
Sys.Observer.raisePropertyChanged(target, 'length');
|
|
}
|
|
}
|
|
Sys.Observer.add = function Sys$Observer$add(target, item) {
|
|
/// <summary locid="M:J#Sys.Observer.add" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], target.length);
|
|
Array.add(target, item);
|
|
Sys.Observer._collectionChange(target, change);
|
|
}
|
|
Sys.Observer.addRange = function Sys$Observer$addRange(target, items) {
|
|
/// <summary locid="M:J#Sys.Observer.addRange" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="items" type="Array" elementMayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "items", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, items, target.length);
|
|
Array.addRange(target, items);
|
|
Sys.Observer._collectionChange(target, change);
|
|
}
|
|
Sys.Observer.clear = function Sys$Observer$clear(target) {
|
|
/// <summary locid="M:J#Sys.Observer.clear" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var oldItems = Array.clone(target);
|
|
Array.clear(target);
|
|
Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems, 0));
|
|
}
|
|
Sys.Observer.insert = function Sys$Observer$insert(target, index, item) {
|
|
/// <summary locid="M:J#Sys.Observer.insert" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="index" type="Number" integer="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "index", type: Number, integer: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
Array.insert(target, index, item);
|
|
Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index));
|
|
}
|
|
Sys.Observer.remove = function Sys$Observer$remove(target, item) {
|
|
/// <summary locid="M:J#Sys.Observer.remove" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "item", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var index = Array.indexOf(target, item);
|
|
if (index !== -1) {
|
|
Array.remove(target, item);
|
|
Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
Sys.Observer.removeAt = function Sys$Observer$removeAt(target, index) {
|
|
/// <summary locid="M:J#Sys.Observer.removeAt" />
|
|
/// <param name="target" type="Array" elementMayBeNull="true"></param>
|
|
/// <param name="index" type="Number" integer="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target", type: Array, elementMayBeNull: true},
|
|
{name: "index", type: Number, integer: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((index > -1) && (index < target.length)) {
|
|
var item = target[index];
|
|
Array.removeAt(target, index);
|
|
Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
|
|
}
|
|
}
|
|
Sys.Observer.raiseCollectionChanged = function Sys$Observer$raiseCollectionChanged(target, changes) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="target"></param>
|
|
/// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
|
|
Sys.Observer.raiseEvent(target, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
|
|
}
|
|
Sys.Observer._observeMethods = {
|
|
add_propertyChanged: function(handler) {
|
|
Sys.Observer._addEventHandler(this, "propertyChanged", handler);
|
|
},
|
|
remove_propertyChanged: function(handler) {
|
|
Sys.Observer._removeEventHandler(this, "propertyChanged", handler);
|
|
},
|
|
addEventHandler: function(eventName, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._addEventHandler(this, eventName, handler);
|
|
},
|
|
removeEventHandler: function(eventName, handler) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._removeEventHandler(this, eventName, handler);
|
|
},
|
|
get_isUpdating: function() {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <returns type="Boolean"></returns>
|
|
return Sys.Observer.isUpdating(this);
|
|
},
|
|
beginUpdate: function() {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
Sys.Observer.beginUpdate(this);
|
|
},
|
|
endUpdate: function() {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
Sys.Observer.endUpdate(this);
|
|
},
|
|
setValue: function(name, value) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="value" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "name", type: String},
|
|
{name: "value", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Observer._setValue(this, name, value);
|
|
},
|
|
raiseEvent: function(eventName, eventArgs) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="eventArgs" type="Sys.EventArgs"></param>
|
|
Sys.Observer.raiseEvent(this, eventName, eventArgs);
|
|
},
|
|
raisePropertyChanged: function(name) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="name" type="String"></param>
|
|
Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(name));
|
|
}
|
|
}
|
|
Sys.Observer._arrayMethods = {
|
|
add_collectionChanged: function(handler) {
|
|
Sys.Observer._addEventHandler(this, "collectionChanged", handler);
|
|
},
|
|
remove_collectionChanged: function(handler) {
|
|
Sys.Observer._removeEventHandler(this, "collectionChanged", handler);
|
|
},
|
|
add: function(item) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
Sys.Observer.add(this, item);
|
|
},
|
|
addRange: function(items) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="items" type="Array" elementMayBeNull="true"></param>
|
|
Sys.Observer.addRange(this, items);
|
|
},
|
|
clear: function() {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
Sys.Observer.clear(this);
|
|
},
|
|
insert: function(index, item) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="index" type="Number" integer="true"></param>
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
Sys.Observer.insert(this, index, item);
|
|
},
|
|
remove: function(item) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="item" mayBeNull="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
return Sys.Observer.remove(this, item);
|
|
},
|
|
removeAt: function(index) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="index" type="Number" integer="true"></param>
|
|
Sys.Observer.removeAt(this, index);
|
|
},
|
|
raiseCollectionChanged: function(changes) {
|
|
/// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
|
|
/// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
|
|
Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
|
|
}
|
|
}
|
|
Sys.Observer._getContext = function Sys$Observer$_getContext(obj, create) {
|
|
var ctx = obj._observerContext;
|
|
if (ctx) return ctx();
|
|
if (create) {
|
|
return (obj._observerContext = Sys.Observer._createContext())();
|
|
}
|
|
return null;
|
|
}
|
|
Sys.Observer._createContext = function Sys$Observer$_createContext() {
|
|
var ctx = {
|
|
events: new Sys.EventHandlerList()
|
|
};
|
|
return function() {
|
|
return ctx;
|
|
}
|
|
}
|
|
Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) {
|
|
var quoteCount = 0;
|
|
var escaped = false;
|
|
for (var i = 0, il = preMatch.length; i < il; i++) {
|
|
var c = preMatch.charAt(i);
|
|
switch (c) {
|
|
case '\'':
|
|
if (escaped) strBuilder.append("'");
|
|
else quoteCount++;
|
|
escaped = false;
|
|
break;
|
|
case '\\':
|
|
if (escaped) strBuilder.append("\\");
|
|
escaped = !escaped;
|
|
break;
|
|
default:
|
|
strBuilder.append(c);
|
|
escaped = false;
|
|
break;
|
|
}
|
|
}
|
|
return quoteCount;
|
|
}
|
|
Date._expandFormat = function Date$_expandFormat(dtf, format) {
|
|
if (!format) {
|
|
format = "F";
|
|
}
|
|
var len = format.length;
|
|
if (len === 1) {
|
|
switch (format) {
|
|
case "d":
|
|
return dtf.ShortDatePattern;
|
|
case "D":
|
|
return dtf.LongDatePattern;
|
|
case "t":
|
|
return dtf.ShortTimePattern;
|
|
case "T":
|
|
return dtf.LongTimePattern;
|
|
case "f":
|
|
return dtf.LongDatePattern + " " + dtf.ShortTimePattern;
|
|
case "F":
|
|
return dtf.FullDateTimePattern;
|
|
case "M": case "m":
|
|
return dtf.MonthDayPattern;
|
|
case "s":
|
|
return dtf.SortableDateTimePattern;
|
|
case "Y": case "y":
|
|
return dtf.YearMonthPattern;
|
|
default:
|
|
throw Error.format(Sys.Res.formatInvalidString);
|
|
}
|
|
}
|
|
else if ((len === 2) && (format.charAt(0) === "%")) {
|
|
format = format.charAt(1);
|
|
}
|
|
return format;
|
|
}
|
|
Date._expandYear = function Date$_expandYear(dtf, year) {
|
|
var now = new Date(),
|
|
era = Date._getEra(now);
|
|
if (year < 100) {
|
|
var curr = Date._getEraYear(now, dtf, era);
|
|
year += curr - (curr % 100);
|
|
if (year > dtf.Calendar.TwoDigitYearMax) {
|
|
year -= 100;
|
|
}
|
|
}
|
|
return year;
|
|
}
|
|
Date._getEra = function Date$_getEra(date, eras) {
|
|
if (!eras) return 0;
|
|
var start, ticks = date.getTime();
|
|
for (var i = 0, l = eras.length; i < l; i += 4) {
|
|
start = eras[i+2];
|
|
if ((start === null) || (ticks >= start)) {
|
|
return i;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
Date._getEraYear = function Date$_getEraYear(date, dtf, era, sortable) {
|
|
var year = date.getFullYear();
|
|
if (!sortable && dtf.eras) {
|
|
year -= dtf.eras[era + 3];
|
|
}
|
|
return year;
|
|
}
|
|
Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) {
|
|
if (!dtf._parseRegExp) {
|
|
dtf._parseRegExp = {};
|
|
}
|
|
else if (dtf._parseRegExp[format]) {
|
|
return dtf._parseRegExp[format];
|
|
}
|
|
var expFormat = Date._expandFormat(dtf, format);
|
|
expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");
|
|
var regexp = new Sys.StringBuilder("^");
|
|
var groups = [];
|
|
var index = 0;
|
|
var quoteCount = 0;
|
|
var tokenRegExp = Date._getTokenRegExp();
|
|
var match;
|
|
while ((match = tokenRegExp.exec(expFormat)) !== null) {
|
|
var preMatch = expFormat.slice(index, match.index);
|
|
index = tokenRegExp.lastIndex;
|
|
quoteCount += Date._appendPreOrPostMatch(preMatch, regexp);
|
|
if ((quoteCount%2) === 1) {
|
|
regexp.append(match[0]);
|
|
continue;
|
|
}
|
|
switch (match[0]) {
|
|
case 'dddd': case 'ddd':
|
|
case 'MMMM': case 'MMM':
|
|
case 'gg': case 'g':
|
|
regexp.append("(\\D+)");
|
|
break;
|
|
case 'tt': case 't':
|
|
regexp.append("(\\D*)");
|
|
break;
|
|
case 'yyyy':
|
|
regexp.append("(\\d{4})");
|
|
break;
|
|
case 'fff':
|
|
regexp.append("(\\d{3})");
|
|
break;
|
|
case 'ff':
|
|
regexp.append("(\\d{2})");
|
|
break;
|
|
case 'f':
|
|
regexp.append("(\\d)");
|
|
break;
|
|
case 'dd': case 'd':
|
|
case 'MM': case 'M':
|
|
case 'yy': case 'y':
|
|
case 'HH': case 'H':
|
|
case 'hh': case 'h':
|
|
case 'mm': case 'm':
|
|
case 'ss': case 's':
|
|
regexp.append("(\\d\\d?)");
|
|
break;
|
|
case 'zzz':
|
|
regexp.append("([+-]?\\d\\d?:\\d{2})");
|
|
break;
|
|
case 'zz': case 'z':
|
|
regexp.append("([+-]?\\d\\d?)");
|
|
break;
|
|
case '/':
|
|
regexp.append("(\\" + dtf.DateSeparator + ")");
|
|
break;
|
|
default:
|
|
Sys.Debug.fail("Invalid date format pattern");
|
|
}
|
|
Array.add(groups, match[0]);
|
|
}
|
|
Date._appendPreOrPostMatch(expFormat.slice(index), regexp);
|
|
regexp.append("$");
|
|
var regexpStr = regexp.toString().replace(/\s+/g, "\\s+");
|
|
var parseRegExp = {'regExp': regexpStr, 'groups': groups};
|
|
dtf._parseRegExp[format] = parseRegExp;
|
|
return parseRegExp;
|
|
}
|
|
Date._getTokenRegExp = function Date$_getTokenRegExp() {
|
|
return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g;
|
|
}
|
|
Date.parseLocale = function Date$parseLocale(value, formats) {
|
|
/// <summary locid="M:J#Date.parseLocale" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Date"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String},
|
|
{name: "formats", mayBeNull: true, optional: true, parameterArray: true}
|
|
]);
|
|
if (e) throw e;
|
|
return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments);
|
|
}
|
|
Date.parseInvariant = function Date$parseInvariant(value, formats) {
|
|
/// <summary locid="M:J#Date.parseInvariant" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Date"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String},
|
|
{name: "formats", mayBeNull: true, optional: true, parameterArray: true}
|
|
]);
|
|
if (e) throw e;
|
|
return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments);
|
|
}
|
|
Date._parse = function Date$_parse(value, cultureInfo, args) {
|
|
var i, l, date, format, formats, custom = false;
|
|
for (i = 1, l = args.length; i < l; i++) {
|
|
format = args[i];
|
|
if (format) {
|
|
custom = true;
|
|
date = Date._parseExact(value, format, cultureInfo);
|
|
if (date) return date;
|
|
}
|
|
}
|
|
if (! custom) {
|
|
formats = cultureInfo._getDateTimeFormats();
|
|
for (i = 0, l = formats.length; i < l; i++) {
|
|
date = Date._parseExact(value, formats[i], cultureInfo);
|
|
if (date) return date;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
Date._parseExact = function Date$_parseExact(value, format, cultureInfo) {
|
|
value = value.trim();
|
|
var dtf = cultureInfo.dateTimeFormat,
|
|
parseInfo = Date._getParseRegExp(dtf, format),
|
|
match = new RegExp(parseInfo.regExp).exec(value);
|
|
if (match === null) return null;
|
|
|
|
var groups = parseInfo.groups,
|
|
era = null, year = null, month = null, date = null, weekDay = null,
|
|
hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
|
|
pmHour = false;
|
|
for (var j = 0, jl = groups.length; j < jl; j++) {
|
|
var matchGroup = match[j+1];
|
|
if (matchGroup) {
|
|
switch (groups[j]) {
|
|
case 'dd': case 'd':
|
|
date = parseInt(matchGroup, 10);
|
|
if ((date < 1) || (date > 31)) return null;
|
|
break;
|
|
case 'MMMM':
|
|
month = cultureInfo._getMonthIndex(matchGroup);
|
|
if ((month < 0) || (month > 11)) return null;
|
|
break;
|
|
case 'MMM':
|
|
month = cultureInfo._getAbbrMonthIndex(matchGroup);
|
|
if ((month < 0) || (month > 11)) return null;
|
|
break;
|
|
case 'M': case 'MM':
|
|
month = parseInt(matchGroup, 10) - 1;
|
|
if ((month < 0) || (month > 11)) return null;
|
|
break;
|
|
case 'y': case 'yy':
|
|
year = Date._expandYear(dtf,parseInt(matchGroup, 10));
|
|
if ((year < 0) || (year > 9999)) return null;
|
|
break;
|
|
case 'yyyy':
|
|
year = parseInt(matchGroup, 10);
|
|
if ((year < 0) || (year > 9999)) return null;
|
|
break;
|
|
case 'h': case 'hh':
|
|
hour = parseInt(matchGroup, 10);
|
|
if (hour === 12) hour = 0;
|
|
if ((hour < 0) || (hour > 11)) return null;
|
|
break;
|
|
case 'H': case 'HH':
|
|
hour = parseInt(matchGroup, 10);
|
|
if ((hour < 0) || (hour > 23)) return null;
|
|
break;
|
|
case 'm': case 'mm':
|
|
min = parseInt(matchGroup, 10);
|
|
if ((min < 0) || (min > 59)) return null;
|
|
break;
|
|
case 's': case 'ss':
|
|
sec = parseInt(matchGroup, 10);
|
|
if ((sec < 0) || (sec > 59)) return null;
|
|
break;
|
|
case 'tt': case 't':
|
|
var upperToken = matchGroup.toUpperCase();
|
|
pmHour = (upperToken === dtf.PMDesignator.toUpperCase());
|
|
if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null;
|
|
break;
|
|
case 'f':
|
|
msec = parseInt(matchGroup, 10) * 100;
|
|
if ((msec < 0) || (msec > 999)) return null;
|
|
break;
|
|
case 'ff':
|
|
msec = parseInt(matchGroup, 10) * 10;
|
|
if ((msec < 0) || (msec > 999)) return null;
|
|
break;
|
|
case 'fff':
|
|
msec = parseInt(matchGroup, 10);
|
|
if ((msec < 0) || (msec > 999)) return null;
|
|
break;
|
|
case 'dddd':
|
|
weekDay = cultureInfo._getDayIndex(matchGroup);
|
|
if ((weekDay < 0) || (weekDay > 6)) return null;
|
|
break;
|
|
case 'ddd':
|
|
weekDay = cultureInfo._getAbbrDayIndex(matchGroup);
|
|
if ((weekDay < 0) || (weekDay > 6)) return null;
|
|
break;
|
|
case 'zzz':
|
|
var offsets = matchGroup.split(/:/);
|
|
if (offsets.length !== 2) return null;
|
|
hourOffset = parseInt(offsets[0], 10);
|
|
if ((hourOffset < -12) || (hourOffset > 13)) return null;
|
|
var minOffset = parseInt(offsets[1], 10);
|
|
if ((minOffset < 0) || (minOffset > 59)) return null;
|
|
tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset);
|
|
break;
|
|
case 'z': case 'zz':
|
|
hourOffset = parseInt(matchGroup, 10);
|
|
if ((hourOffset < -12) || (hourOffset > 13)) return null;
|
|
tzMinOffset = hourOffset * 60;
|
|
break;
|
|
case 'g': case 'gg':
|
|
var eraName = matchGroup;
|
|
if (!eraName || !dtf.eras) return null;
|
|
eraName = eraName.toLowerCase().trim();
|
|
for (var i = 0, l = dtf.eras.length; i < l; i += 4) {
|
|
if (eraName === dtf.eras[i + 1].toLowerCase()) {
|
|
era = i;
|
|
break;
|
|
}
|
|
}
|
|
if (era === null) return null;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
var result = new Date(), defaults, convert = dtf.Calendar.convert;
|
|
if (convert) {
|
|
defaults = convert.fromGregorian(result);
|
|
}
|
|
if (!convert) {
|
|
defaults = [result.getFullYear(), result.getMonth(), result.getDate()];
|
|
}
|
|
if (year === null) {
|
|
year = defaults[0];
|
|
}
|
|
else if (dtf.eras) {
|
|
year += dtf.eras[(era || 0) + 3];
|
|
}
|
|
if (month === null) {
|
|
month = defaults[1];
|
|
}
|
|
if (date === null) {
|
|
date = defaults[2];
|
|
}
|
|
if (convert) {
|
|
result = convert.toGregorian(year, month, date);
|
|
if (result === null) return null;
|
|
}
|
|
else {
|
|
result.setFullYear(year, month, date);
|
|
if (result.getDate() !== date) return null;
|
|
if ((weekDay !== null) && (result.getDay() !== weekDay)) {
|
|
return null;
|
|
}
|
|
}
|
|
if (pmHour && (hour < 12)) {
|
|
hour += 12;
|
|
}
|
|
result.setHours(hour, min, sec, msec);
|
|
if (tzMinOffset !== null) {
|
|
var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset());
|
|
result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60);
|
|
}
|
|
return result;
|
|
}
|
|
Date.prototype.format = function Date$format(format) {
|
|
/// <summary locid="M:J#Date.format" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
|
|
}
|
|
Date.prototype.localeFormat = function Date$localeFormat(format) {
|
|
/// <summary locid="M:J#Date.localeFormat" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
|
|
}
|
|
Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) {
|
|
var dtf = cultureInfo.dateTimeFormat,
|
|
convert = dtf.Calendar.convert;
|
|
if (!format || !format.length || (format === 'i')) {
|
|
if (cultureInfo && cultureInfo.name.length) {
|
|
if (convert) {
|
|
return this._toFormattedString(dtf.FullDateTimePattern, cultureInfo);
|
|
}
|
|
else {
|
|
var eraDate = new Date(this.getTime());
|
|
var era = Date._getEra(this, dtf.eras);
|
|
eraDate.setFullYear(Date._getEraYear(this, dtf, era));
|
|
return eraDate.toLocaleString();
|
|
}
|
|
}
|
|
else {
|
|
return this.toString();
|
|
}
|
|
}
|
|
var eras = dtf.eras,
|
|
sortable = (format === "s");
|
|
format = Date._expandFormat(dtf, format);
|
|
var ret = new Sys.StringBuilder();
|
|
var hour;
|
|
function addLeadingZero(num) {
|
|
if (num < 10) {
|
|
return '0' + num;
|
|
}
|
|
return num.toString();
|
|
}
|
|
function addLeadingZeros(num) {
|
|
if (num < 10) {
|
|
return '00' + num;
|
|
}
|
|
if (num < 100) {
|
|
return '0' + num;
|
|
}
|
|
return num.toString();
|
|
}
|
|
function padYear(year) {
|
|
if (year < 10) {
|
|
return '000' + year;
|
|
}
|
|
else if (year < 100) {
|
|
return '00' + year;
|
|
}
|
|
else if (year < 1000) {
|
|
return '0' + year;
|
|
}
|
|
return year.toString();
|
|
}
|
|
|
|
var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g;
|
|
function hasDay() {
|
|
if (foundDay || checkedDay) {
|
|
return foundDay;
|
|
}
|
|
foundDay = dayPartRegExp.test(format);
|
|
checkedDay = true;
|
|
return foundDay;
|
|
}
|
|
|
|
var quoteCount = 0,
|
|
tokenRegExp = Date._getTokenRegExp(),
|
|
converted;
|
|
if (!sortable && convert) {
|
|
converted = convert.fromGregorian(this);
|
|
}
|
|
for (;;) {
|
|
var index = tokenRegExp.lastIndex;
|
|
var ar = tokenRegExp.exec(format);
|
|
var preMatch = format.slice(index, ar ? ar.index : format.length);
|
|
quoteCount += Date._appendPreOrPostMatch(preMatch, ret);
|
|
if (!ar) break;
|
|
if ((quoteCount%2) === 1) {
|
|
ret.append(ar[0]);
|
|
continue;
|
|
}
|
|
|
|
function getPart(date, part) {
|
|
if (converted) {
|
|
return converted[part];
|
|
}
|
|
switch (part) {
|
|
case 0: return date.getFullYear();
|
|
case 1: return date.getMonth();
|
|
case 2: return date.getDate();
|
|
}
|
|
}
|
|
switch (ar[0]) {
|
|
case "dddd":
|
|
ret.append(dtf.DayNames[this.getDay()]);
|
|
break;
|
|
case "ddd":
|
|
ret.append(dtf.AbbreviatedDayNames[this.getDay()]);
|
|
break;
|
|
case "dd":
|
|
foundDay = true;
|
|
ret.append(addLeadingZero(getPart(this, 2)));
|
|
break;
|
|
case "d":
|
|
foundDay = true;
|
|
ret.append(getPart(this, 2));
|
|
break;
|
|
case "MMMM":
|
|
ret.append((dtf.MonthGenitiveNames && hasDay())
|
|
? dtf.MonthGenitiveNames[getPart(this, 1)]
|
|
: dtf.MonthNames[getPart(this, 1)]);
|
|
break;
|
|
case "MMM":
|
|
ret.append((dtf.AbbreviatedMonthGenitiveNames && hasDay())
|
|
? dtf.AbbreviatedMonthGenitiveNames[getPart(this, 1)]
|
|
: dtf.AbbreviatedMonthNames[getPart(this, 1)]);
|
|
break;
|
|
case "MM":
|
|
ret.append(addLeadingZero(getPart(this, 1) + 1));
|
|
break;
|
|
case "M":
|
|
ret.append(getPart(this, 1) + 1);
|
|
break;
|
|
case "yyyy":
|
|
ret.append(padYear(converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)));
|
|
break;
|
|
case "yy":
|
|
ret.append(addLeadingZero((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100));
|
|
break;
|
|
case "y":
|
|
ret.append((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100);
|
|
break;
|
|
case "hh":
|
|
hour = this.getHours() % 12;
|
|
if (hour === 0) hour = 12;
|
|
ret.append(addLeadingZero(hour));
|
|
break;
|
|
case "h":
|
|
hour = this.getHours() % 12;
|
|
if (hour === 0) hour = 12;
|
|
ret.append(hour);
|
|
break;
|
|
case "HH":
|
|
ret.append(addLeadingZero(this.getHours()));
|
|
break;
|
|
case "H":
|
|
ret.append(this.getHours());
|
|
break;
|
|
case "mm":
|
|
ret.append(addLeadingZero(this.getMinutes()));
|
|
break;
|
|
case "m":
|
|
ret.append(this.getMinutes());
|
|
break;
|
|
case "ss":
|
|
ret.append(addLeadingZero(this.getSeconds()));
|
|
break;
|
|
case "s":
|
|
ret.append(this.getSeconds());
|
|
break;
|
|
case "tt":
|
|
ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator);
|
|
break;
|
|
case "t":
|
|
ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0));
|
|
break;
|
|
case "f":
|
|
ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0));
|
|
break;
|
|
case "ff":
|
|
ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2));
|
|
break;
|
|
case "fff":
|
|
ret.append(addLeadingZeros(this.getMilliseconds()));
|
|
break;
|
|
case "z":
|
|
hour = this.getTimezoneOffset() / 60;
|
|
ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour)));
|
|
break;
|
|
case "zz":
|
|
hour = this.getTimezoneOffset() / 60;
|
|
ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))));
|
|
break;
|
|
case "zzz":
|
|
hour = this.getTimezoneOffset() / 60;
|
|
ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) +
|
|
":" + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60)));
|
|
break;
|
|
case "g":
|
|
case "gg":
|
|
if (dtf.eras) {
|
|
ret.append(dtf.eras[Date._getEra(this, eras) + 1]);
|
|
}
|
|
break;
|
|
case "/":
|
|
ret.append(dtf.DateSeparator);
|
|
break;
|
|
default:
|
|
Sys.Debug.fail("Invalid date format pattern");
|
|
}
|
|
}
|
|
return ret.toString();
|
|
}
|
|
String.localeFormat = function String$localeFormat(format, args) {
|
|
/// <summary locid="M:J#String.localeFormat" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <param name="args" parameterArray="true" mayBeNull="true"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String},
|
|
{name: "args", mayBeNull: true, parameterArray: true}
|
|
]);
|
|
if (e) throw e;
|
|
return String._toFormattedString(true, arguments);
|
|
}
|
|
Number.parseLocale = function Number$parseLocale(value) {
|
|
/// <summary locid="M:J#Number.parseLocale" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <returns type="Number"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String}
|
|
], false);
|
|
if (e) throw e;
|
|
return Number._parse(value, Sys.CultureInfo.CurrentCulture);
|
|
}
|
|
Number.parseInvariant = function Number$parseInvariant(value) {
|
|
/// <summary locid="M:J#Number.parseInvariant" />
|
|
/// <param name="value" type="String"></param>
|
|
/// <returns type="Number"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String}
|
|
], false);
|
|
if (e) throw e;
|
|
return Number._parse(value, Sys.CultureInfo.InvariantCulture);
|
|
}
|
|
Number._parse = function Number$_parse(value, cultureInfo) {
|
|
value = value.trim();
|
|
|
|
if (value.match(/^[+-]?infinity$/i)) {
|
|
return parseFloat(value);
|
|
}
|
|
if (value.match(/^0x[a-f0-9]+$/i)) {
|
|
return parseInt(value);
|
|
}
|
|
var numFormat = cultureInfo.numberFormat;
|
|
var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern);
|
|
var sign = signInfo[0];
|
|
var num = signInfo[1];
|
|
|
|
if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) {
|
|
signInfo = Number._parseNumberNegativePattern(value, numFormat, 1);
|
|
sign = signInfo[0];
|
|
num = signInfo[1];
|
|
}
|
|
if (sign === '') sign = '+';
|
|
|
|
var exponent;
|
|
var intAndFraction;
|
|
var exponentPos = num.indexOf('e');
|
|
if (exponentPos < 0) exponentPos = num.indexOf('E');
|
|
if (exponentPos < 0) {
|
|
intAndFraction = num;
|
|
exponent = null;
|
|
}
|
|
else {
|
|
intAndFraction = num.substr(0, exponentPos);
|
|
exponent = num.substr(exponentPos + 1);
|
|
}
|
|
|
|
var integer;
|
|
var fraction;
|
|
var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator);
|
|
if (decimalPos < 0) {
|
|
integer = intAndFraction;
|
|
fraction = null;
|
|
}
|
|
else {
|
|
integer = intAndFraction.substr(0, decimalPos);
|
|
fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length);
|
|
}
|
|
|
|
integer = integer.split(numFormat.NumberGroupSeparator).join('');
|
|
var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " ");
|
|
if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) {
|
|
integer = integer.split(altNumGroupSeparator).join('');
|
|
}
|
|
|
|
var p = sign + integer;
|
|
if (fraction !== null) {
|
|
p += '.' + fraction;
|
|
}
|
|
if (exponent !== null) {
|
|
var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1);
|
|
if (expSignInfo[0] === '') {
|
|
expSignInfo[0] = '+';
|
|
}
|
|
p += 'e' + expSignInfo[0] + expSignInfo[1];
|
|
}
|
|
if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) {
|
|
return parseFloat(p);
|
|
}
|
|
return Number.NaN;
|
|
}
|
|
Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) {
|
|
var neg = numFormat.NegativeSign;
|
|
var pos = numFormat.PositiveSign;
|
|
switch (numberNegativePattern) {
|
|
case 4:
|
|
neg = ' ' + neg;
|
|
pos = ' ' + pos;
|
|
case 3:
|
|
if (value.endsWith(neg)) {
|
|
return ['-', value.substr(0, value.length - neg.length)];
|
|
}
|
|
else if (value.endsWith(pos)) {
|
|
return ['+', value.substr(0, value.length - pos.length)];
|
|
}
|
|
break;
|
|
case 2:
|
|
neg += ' ';
|
|
pos += ' ';
|
|
case 1:
|
|
if (value.startsWith(neg)) {
|
|
return ['-', value.substr(neg.length)];
|
|
}
|
|
else if (value.startsWith(pos)) {
|
|
return ['+', value.substr(pos.length)];
|
|
}
|
|
break;
|
|
case 0:
|
|
if (value.startsWith('(') && value.endsWith(')')) {
|
|
return ['-', value.substr(1, value.length - 2)];
|
|
}
|
|
break;
|
|
default:
|
|
Sys.Debug.fail("");
|
|
}
|
|
return ['', value];
|
|
}
|
|
Number.prototype.format = function Number$format(format) {
|
|
/// <summary locid="M:J#Number.format" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
|
|
}
|
|
Number.prototype.localeFormat = function Number$localeFormat(format) {
|
|
/// <summary locid="M:J#Number.localeFormat" />
|
|
/// <param name="format" type="String"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "format", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
|
|
}
|
|
Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) {
|
|
if (!format || (format.length === 0) || (format === 'i')) {
|
|
if (cultureInfo && (cultureInfo.name.length > 0)) {
|
|
return this.toLocaleString();
|
|
}
|
|
else {
|
|
return this.toString();
|
|
}
|
|
}
|
|
|
|
var _percentPositivePattern = ["n %", "n%", "%n" ];
|
|
var _percentNegativePattern = ["-n %", "-n%", "-%n"];
|
|
var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
|
|
var _currencyPositivePattern = ["$n","n$","$ n","n $"];
|
|
var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
|
|
function zeroPad(str, count, left) {
|
|
for (var l=str.length; l < count; l++) {
|
|
str = (left ? ('0' + str) : (str + '0'));
|
|
}
|
|
return str;
|
|
}
|
|
|
|
function expandNumber(number, precision, groupSizes, sep, decimalChar) {
|
|
Sys.Debug.assert(groupSizes.length > 0, "groupSizes must be an array of at least 1");
|
|
var curSize = groupSizes[0];
|
|
var curGroupIndex = 1;
|
|
var factor = Math.pow(10, precision);
|
|
var rounded = (Math.round(number * factor) / factor);
|
|
if (!isFinite(rounded)) {
|
|
rounded = number;
|
|
}
|
|
number = rounded;
|
|
|
|
var numberString = number.toString();
|
|
var right = "";
|
|
var exponent;
|
|
|
|
|
|
var split = numberString.split(/e/i);
|
|
numberString = split[0];
|
|
exponent = (split.length > 1 ? parseInt(split[1]) : 0);
|
|
split = numberString.split('.');
|
|
numberString = split[0];
|
|
right = split.length > 1 ? split[1] : "";
|
|
|
|
var l;
|
|
if (exponent > 0) {
|
|
right = zeroPad(right, exponent, false);
|
|
numberString += right.slice(0, exponent);
|
|
right = right.substr(exponent);
|
|
}
|
|
else if (exponent < 0) {
|
|
exponent = -exponent;
|
|
numberString = zeroPad(numberString, exponent+1, true);
|
|
right = numberString.slice(-exponent, numberString.length) + right;
|
|
numberString = numberString.slice(0, -exponent);
|
|
}
|
|
if (precision > 0) {
|
|
if (right.length > precision) {
|
|
right = right.slice(0, precision);
|
|
}
|
|
else {
|
|
right = zeroPad(right, precision, false);
|
|
}
|
|
right = decimalChar + right;
|
|
}
|
|
else {
|
|
right = "";
|
|
}
|
|
var stringIndex = numberString.length-1;
|
|
var ret = "";
|
|
while (stringIndex >= 0) {
|
|
if (curSize === 0 || curSize > stringIndex) {
|
|
if (ret.length > 0)
|
|
return numberString.slice(0, stringIndex + 1) + sep + ret + right;
|
|
else
|
|
return numberString.slice(0, stringIndex + 1) + right;
|
|
}
|
|
if (ret.length > 0)
|
|
ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret;
|
|
else
|
|
ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1);
|
|
stringIndex -= curSize;
|
|
if (curGroupIndex < groupSizes.length) {
|
|
curSize = groupSizes[curGroupIndex];
|
|
curGroupIndex++;
|
|
}
|
|
}
|
|
return numberString.slice(0, stringIndex + 1) + sep + ret + right;
|
|
}
|
|
var nf = cultureInfo.numberFormat;
|
|
var number = Math.abs(this);
|
|
if (!format)
|
|
format = "D";
|
|
var precision = -1;
|
|
if (format.length > 1) precision = parseInt(format.slice(1), 10);
|
|
var pattern;
|
|
switch (format.charAt(0)) {
|
|
case "d":
|
|
case "D":
|
|
pattern = 'n';
|
|
if (precision !== -1) {
|
|
number = zeroPad(""+number, precision, true);
|
|
}
|
|
if (this < 0) number = -number;
|
|
break;
|
|
case "c":
|
|
case "C":
|
|
if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern];
|
|
else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern];
|
|
if (precision === -1) precision = nf.CurrencyDecimalDigits;
|
|
number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator);
|
|
break;
|
|
case "n":
|
|
case "N":
|
|
if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern];
|
|
else pattern = 'n';
|
|
if (precision === -1) precision = nf.NumberDecimalDigits;
|
|
number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator);
|
|
break;
|
|
case "p":
|
|
case "P":
|
|
if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern];
|
|
else pattern = _percentPositivePattern[nf.PercentPositivePattern];
|
|
if (precision === -1) precision = nf.PercentDecimalDigits;
|
|
number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator);
|
|
break;
|
|
default:
|
|
throw Error.format(Sys.Res.formatBadFormatSpecifier);
|
|
}
|
|
var regex = /n|\$|-|%/g;
|
|
var ret = "";
|
|
for (;;) {
|
|
var index = regex.lastIndex;
|
|
var ar = regex.exec(pattern);
|
|
ret += pattern.slice(index, ar ? ar.index : pattern.length);
|
|
if (!ar)
|
|
break;
|
|
switch (ar[0]) {
|
|
case "n":
|
|
ret += number;
|
|
break;
|
|
case "$":
|
|
ret += nf.CurrencySymbol;
|
|
break;
|
|
case "-":
|
|
if (/[1-9]/.test(number)) {
|
|
ret += nf.NegativeSign;
|
|
}
|
|
break;
|
|
case "%":
|
|
ret += nf.PercentSymbol;
|
|
break;
|
|
default:
|
|
Sys.Debug.fail("Invalid number format pattern");
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) {
|
|
/// <summary locid="M:J#Sys.CultureInfo.#ctor" />
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="numberFormat" type="Object"></param>
|
|
/// <param name="dateTimeFormat" type="Object"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "name", type: String},
|
|
{name: "numberFormat", type: Object},
|
|
{name: "dateTimeFormat", type: Object}
|
|
]);
|
|
if (e) throw e;
|
|
this.name = name;
|
|
this.numberFormat = numberFormat;
|
|
this.dateTimeFormat = dateTimeFormat;
|
|
}
|
|
function Sys$CultureInfo$_getDateTimeFormats() {
|
|
if (! this._dateTimeFormats) {
|
|
var dtf = this.dateTimeFormat;
|
|
this._dateTimeFormats =
|
|
[ dtf.MonthDayPattern,
|
|
dtf.YearMonthPattern,
|
|
dtf.ShortDatePattern,
|
|
dtf.ShortTimePattern,
|
|
dtf.LongDatePattern,
|
|
dtf.LongTimePattern,
|
|
dtf.FullDateTimePattern,
|
|
dtf.RFC1123Pattern,
|
|
dtf.SortableDateTimePattern,
|
|
dtf.UniversalSortableDateTimePattern ];
|
|
}
|
|
return this._dateTimeFormats;
|
|
}
|
|
function Sys$CultureInfo$_getIndex(value, a1, a2) {
|
|
var upper = this._toUpper(value),
|
|
i = Array.indexOf(a1, upper);
|
|
if (i === -1) {
|
|
i = Array.indexOf(a2, upper);
|
|
}
|
|
return i;
|
|
}
|
|
function Sys$CultureInfo$_getMonthIndex(value) {
|
|
if (!this._upperMonths) {
|
|
this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames);
|
|
this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames);
|
|
}
|
|
return this._getIndex(value, this._upperMonths, this._upperMonthsGenitive);
|
|
}
|
|
function Sys$CultureInfo$_getAbbrMonthIndex(value) {
|
|
if (!this._upperAbbrMonths) {
|
|
this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
|
|
this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames);
|
|
}
|
|
return this._getIndex(value, this._upperAbbrMonths, this._upperAbbrMonthsGenitive);
|
|
}
|
|
function Sys$CultureInfo$_getDayIndex(value) {
|
|
if (!this._upperDays) {
|
|
this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames);
|
|
}
|
|
return Array.indexOf(this._upperDays, this._toUpper(value));
|
|
}
|
|
function Sys$CultureInfo$_getAbbrDayIndex(value) {
|
|
if (!this._upperAbbrDays) {
|
|
this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);
|
|
}
|
|
return Array.indexOf(this._upperAbbrDays, this._toUpper(value));
|
|
}
|
|
function Sys$CultureInfo$_toUpperArray(arr) {
|
|
var result = [];
|
|
for (var i = 0, il = arr.length; i < il; i++) {
|
|
result[i] = this._toUpper(arr[i]);
|
|
}
|
|
return result;
|
|
}
|
|
function Sys$CultureInfo$_toUpper(value) {
|
|
return value.split("\u00A0").join(' ').toUpperCase();
|
|
}
|
|
Sys.CultureInfo.prototype = {
|
|
_getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats,
|
|
_getIndex: Sys$CultureInfo$_getIndex,
|
|
_getMonthIndex: Sys$CultureInfo$_getMonthIndex,
|
|
_getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex,
|
|
_getDayIndex: Sys$CultureInfo$_getDayIndex,
|
|
_getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex,
|
|
_toUpperArray: Sys$CultureInfo$_toUpperArray,
|
|
_toUpper: Sys$CultureInfo$_toUpper
|
|
}
|
|
Sys.CultureInfo.registerClass('Sys.CultureInfo');
|
|
Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) {
|
|
var dtf = value.dateTimeFormat;
|
|
if (dtf && !dtf.eras) {
|
|
dtf.eras = value.eras;
|
|
}
|
|
return new Sys.CultureInfo(value.name, value.numberFormat, dtf);
|
|
}
|
|
Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
|
|
if (typeof(__cultureInfo) === "object") {
|
|
Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo);
|
|
delete __cultureInfo;
|
|
}
|
|
else {
|
|
Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
|
|
}
|
|
Type.registerNamespace('Sys.Serialization');
|
|
Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() {
|
|
/// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer');
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = [];
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscape = [];
|
|
Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._escapeChars = {};
|
|
Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i');
|
|
Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type';
|
|
Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() {
|
|
var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007',
|
|
'\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011',
|
|
'\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019',
|
|
'\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f'];
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\';
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\';
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"';
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g');
|
|
Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"';
|
|
for (var i = 0; i < 32; i++) {
|
|
var c = String.fromCharCode(i);
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c;
|
|
Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g');
|
|
Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i];
|
|
}
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) {
|
|
stringBuilder.append(object.toString());
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) {
|
|
if (isFinite(object)) {
|
|
stringBuilder.append(String(object));
|
|
}
|
|
else {
|
|
throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
|
|
}
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) {
|
|
stringBuilder.append('"');
|
|
if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) {
|
|
if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) {
|
|
Sys.Serialization.JavaScriptSerializer._init();
|
|
}
|
|
if (string.length < 128) {
|
|
string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,
|
|
function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; });
|
|
}
|
|
else {
|
|
for (var i = 0; i < 34; i++) {
|
|
var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i];
|
|
if (string.indexOf(c) !== -1) {
|
|
if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) {
|
|
string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
|
|
}
|
|
else {
|
|
string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c],
|
|
Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stringBuilder.append(string);
|
|
stringBuilder.append('"');
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) {
|
|
var i;
|
|
switch (typeof object) {
|
|
case 'object':
|
|
if (object) {
|
|
if (prevObjects){
|
|
for( var j = 0; j < prevObjects.length; j++) {
|
|
if (prevObjects[j] === object) {
|
|
throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
prevObjects = new Array();
|
|
}
|
|
try {
|
|
Array.add(prevObjects, object);
|
|
|
|
if (Number.isInstanceOfType(object)){
|
|
Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
|
|
}
|
|
else if (Boolean.isInstanceOfType(object)){
|
|
Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
|
|
}
|
|
else if (String.isInstanceOfType(object)){
|
|
Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
|
|
}
|
|
|
|
else if (Array.isInstanceOfType(object)) {
|
|
stringBuilder.append('[');
|
|
|
|
for (i = 0; i < object.length; ++i) {
|
|
if (i > 0) {
|
|
stringBuilder.append(',');
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects);
|
|
}
|
|
stringBuilder.append(']');
|
|
}
|
|
else {
|
|
if (Date.isInstanceOfType(object)) {
|
|
stringBuilder.append('"\\/Date(');
|
|
stringBuilder.append(object.getTime());
|
|
stringBuilder.append(')\\/"');
|
|
break;
|
|
}
|
|
var properties = [];
|
|
var propertyCount = 0;
|
|
for (var name in object) {
|
|
if (name.startsWith('$')) {
|
|
continue;
|
|
}
|
|
if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){
|
|
properties[propertyCount++] = properties[0];
|
|
properties[0] = name;
|
|
}
|
|
else{
|
|
properties[propertyCount++] = name;
|
|
}
|
|
}
|
|
if (sort) properties.sort();
|
|
stringBuilder.append('{');
|
|
var needComma = false;
|
|
|
|
for (i=0; i<propertyCount; i++) {
|
|
var value = object[properties[i]];
|
|
if (typeof value !== 'undefined' && typeof value !== 'function') {
|
|
if (needComma) {
|
|
stringBuilder.append(',');
|
|
}
|
|
else {
|
|
needComma = true;
|
|
}
|
|
|
|
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(properties[i], stringBuilder, sort, prevObjects);
|
|
stringBuilder.append(':');
|
|
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(value, stringBuilder, sort, prevObjects);
|
|
|
|
}
|
|
}
|
|
stringBuilder.append('}');
|
|
}
|
|
}
|
|
finally {
|
|
Array.removeAt(prevObjects, prevObjects.length - 1);
|
|
}
|
|
}
|
|
else {
|
|
stringBuilder.append('null');
|
|
}
|
|
break;
|
|
case 'number':
|
|
Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
|
|
break;
|
|
case 'string':
|
|
Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
|
|
break;
|
|
case 'boolean':
|
|
Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
|
|
break;
|
|
default:
|
|
stringBuilder.append('null');
|
|
break;
|
|
}
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer.serialize = function Sys$Serialization$JavaScriptSerializer$serialize(object) {
|
|
/// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.serialize" />
|
|
/// <param name="object" mayBeNull="true"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "object", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
var stringBuilder = new Sys.StringBuilder();
|
|
Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false);
|
|
return stringBuilder.toString();
|
|
}
|
|
Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) {
|
|
/// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.deserialize" />
|
|
/// <param name="data" type="String"></param>
|
|
/// <param name="secure" type="Boolean" optional="true"></param>
|
|
/// <returns></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "data", type: String},
|
|
{name: "secure", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
|
|
if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString);
|
|
try {
|
|
var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)");
|
|
|
|
if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(
|
|
exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null;
|
|
return eval('(' + exp + ')');
|
|
}
|
|
catch (e) {
|
|
throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
|
|
}
|
|
}
|
|
Type.registerNamespace('Sys.UI');
|
|
|
|
Sys.EventHandlerList = function Sys$EventHandlerList() {
|
|
/// <summary locid="M:J#Sys.EventHandlerList.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._list = {};
|
|
}
|
|
function Sys$EventHandlerList$_addHandler(id, handler) {
|
|
Array.add(this._getEvent(id, true), handler);
|
|
}
|
|
function Sys$EventHandlerList$addHandler(id, handler) {
|
|
/// <summary locid="M:J#Sys.EventHandlerList.addHandler" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
this._addHandler(id, handler);
|
|
}
|
|
function Sys$EventHandlerList$_removeHandler(id, handler) {
|
|
var evt = this._getEvent(id);
|
|
if (!evt) return;
|
|
Array.remove(evt, handler);
|
|
}
|
|
function Sys$EventHandlerList$removeHandler(id, handler) {
|
|
/// <summary locid="M:J#Sys.EventHandlerList.removeHandler" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
this._removeHandler(id, handler);
|
|
}
|
|
function Sys$EventHandlerList$getHandler(id) {
|
|
/// <summary locid="M:J#Sys.EventHandlerList.getHandler" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <returns type="Function"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
var evt = this._getEvent(id);
|
|
if (!evt || (evt.length === 0)) return null;
|
|
evt = Array.clone(evt);
|
|
return function(source, args) {
|
|
for (var i = 0, l = evt.length; i < l; i++) {
|
|
evt[i](source, args);
|
|
}
|
|
};
|
|
}
|
|
function Sys$EventHandlerList$_getEvent(id, create) {
|
|
if (!this._list[id]) {
|
|
if (!create) return null;
|
|
this._list[id] = [];
|
|
}
|
|
return this._list[id];
|
|
}
|
|
Sys.EventHandlerList.prototype = {
|
|
_addHandler: Sys$EventHandlerList$_addHandler,
|
|
addHandler: Sys$EventHandlerList$addHandler,
|
|
_removeHandler: Sys$EventHandlerList$_removeHandler,
|
|
removeHandler: Sys$EventHandlerList$removeHandler,
|
|
getHandler: Sys$EventHandlerList$getHandler,
|
|
_getEvent: Sys$EventHandlerList$_getEvent
|
|
}
|
|
Sys.EventHandlerList.registerClass('Sys.EventHandlerList');
|
|
Sys.CommandEventArgs = function Sys$CommandEventArgs(commandName, commandArgument, commandSource) {
|
|
/// <summary locid="M:J#Sys.CommandEventArgs.#ctor" />
|
|
/// <param name="commandName" type="String"></param>
|
|
/// <param name="commandArgument" mayBeNull="true"></param>
|
|
/// <param name="commandSource" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "commandName", type: String},
|
|
{name: "commandArgument", mayBeNull: true},
|
|
{name: "commandSource", mayBeNull: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.CommandEventArgs.initializeBase(this);
|
|
this._commandName = commandName;
|
|
this._commandArgument = commandArgument;
|
|
this._commandSource = commandSource;
|
|
}
|
|
function Sys$CommandEventArgs$get_commandName() {
|
|
/// <value type="String" locid="P:J#Sys.CommandEventArgs.commandName"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._commandName;
|
|
}
|
|
function Sys$CommandEventArgs$get_commandArgument() {
|
|
/// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandArgument"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._commandArgument;
|
|
}
|
|
function Sys$CommandEventArgs$get_commandSource() {
|
|
/// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandSource"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._commandSource;
|
|
}
|
|
Sys.CommandEventArgs.prototype = {
|
|
_commandName: null,
|
|
_commandArgument: null,
|
|
_commandSource: null,
|
|
get_commandName: Sys$CommandEventArgs$get_commandName,
|
|
get_commandArgument: Sys$CommandEventArgs$get_commandArgument,
|
|
get_commandSource: Sys$CommandEventArgs$get_commandSource
|
|
}
|
|
Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs);
|
|
|
|
Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() {
|
|
/// <summary locid="M:J#Sys.INotifyPropertyChange.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$INotifyPropertyChange$add_propertyChanged(handler) {
|
|
/// <summary locid="E:J#Sys.INotifyPropertyChange.propertyChanged" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$INotifyPropertyChange$remove_propertyChanged(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.INotifyPropertyChange.prototype = {
|
|
add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged,
|
|
remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged
|
|
}
|
|
Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange');
|
|
|
|
Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) {
|
|
/// <summary locid="M:J#Sys.PropertyChangedEventArgs.#ctor" />
|
|
/// <param name="propertyName" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "propertyName", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.PropertyChangedEventArgs.initializeBase(this);
|
|
this._propertyName = propertyName;
|
|
}
|
|
|
|
function Sys$PropertyChangedEventArgs$get_propertyName() {
|
|
/// <value type="String" locid="P:J#Sys.PropertyChangedEventArgs.propertyName"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._propertyName;
|
|
}
|
|
Sys.PropertyChangedEventArgs.prototype = {
|
|
get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName
|
|
}
|
|
Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
|
|
|
|
Sys.INotifyDisposing = function Sys$INotifyDisposing() {
|
|
/// <summary locid="M:J#Sys.INotifyDisposing.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$INotifyDisposing$add_disposing(handler) {
|
|
/// <summary locid="E:J#Sys.INotifyDisposing.disposing" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$INotifyDisposing$remove_disposing(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.INotifyDisposing.prototype = {
|
|
add_disposing: Sys$INotifyDisposing$add_disposing,
|
|
remove_disposing: Sys$INotifyDisposing$remove_disposing
|
|
}
|
|
Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");
|
|
|
|
Sys.Component = function Sys$Component() {
|
|
/// <summary locid="M:J#Sys.Component.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (Sys.Application) Sys.Application.registerDisposableObject(this);
|
|
}
|
|
function Sys$Component$get_events() {
|
|
/// <value type="Sys.EventHandlerList" locid="P:J#Sys.Component.events"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._events) {
|
|
this._events = new Sys.EventHandlerList();
|
|
}
|
|
return this._events;
|
|
}
|
|
function Sys$Component$get_id() {
|
|
/// <value type="String" locid="P:J#Sys.Component.id"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._id;
|
|
}
|
|
function Sys$Component$set_id(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice);
|
|
this._idSet = true;
|
|
var oldId = this.get_id();
|
|
if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp);
|
|
this._id = value;
|
|
}
|
|
function Sys$Component$get_isInitialized() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Component.isInitialized"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._initialized;
|
|
}
|
|
function Sys$Component$get_isUpdating() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Component.isUpdating"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._updating;
|
|
}
|
|
function Sys$Component$add_disposing(handler) {
|
|
/// <summary locid="E:J#Sys.Component.disposing" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().addHandler("disposing", handler);
|
|
}
|
|
function Sys$Component$remove_disposing(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("disposing", handler);
|
|
}
|
|
function Sys$Component$add_propertyChanged(handler) {
|
|
/// <summary locid="E:J#Sys.Component.propertyChanged" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().addHandler("propertyChanged", handler);
|
|
}
|
|
function Sys$Component$remove_propertyChanged(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("propertyChanged", handler);
|
|
}
|
|
function Sys$Component$beginUpdate() {
|
|
this._updating = true;
|
|
}
|
|
function Sys$Component$dispose() {
|
|
if (this._events) {
|
|
var handler = this._events.getHandler("disposing");
|
|
if (handler) {
|
|
handler(this, Sys.EventArgs.Empty);
|
|
}
|
|
}
|
|
delete this._events;
|
|
Sys.Application.unregisterDisposableObject(this);
|
|
Sys.Application.removeComponent(this);
|
|
}
|
|
function Sys$Component$endUpdate() {
|
|
this._updating = false;
|
|
if (!this._initialized) this.initialize();
|
|
this.updated();
|
|
}
|
|
function Sys$Component$initialize() {
|
|
this._initialized = true;
|
|
}
|
|
function Sys$Component$raisePropertyChanged(propertyName) {
|
|
/// <summary locid="M:J#Sys.Component.raisePropertyChanged" />
|
|
/// <param name="propertyName" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "propertyName", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._events) return;
|
|
var handler = this._events.getHandler("propertyChanged");
|
|
if (handler) {
|
|
handler(this, new Sys.PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
function Sys$Component$updated() {
|
|
}
|
|
Sys.Component.prototype = {
|
|
_id: null,
|
|
_idSet: false,
|
|
_initialized: false,
|
|
_updating: false,
|
|
get_events: Sys$Component$get_events,
|
|
get_id: Sys$Component$get_id,
|
|
set_id: Sys$Component$set_id,
|
|
get_isInitialized: Sys$Component$get_isInitialized,
|
|
get_isUpdating: Sys$Component$get_isUpdating,
|
|
add_disposing: Sys$Component$add_disposing,
|
|
remove_disposing: Sys$Component$remove_disposing,
|
|
add_propertyChanged: Sys$Component$add_propertyChanged,
|
|
remove_propertyChanged: Sys$Component$remove_propertyChanged,
|
|
beginUpdate: Sys$Component$beginUpdate,
|
|
dispose: Sys$Component$dispose,
|
|
endUpdate: Sys$Component$endUpdate,
|
|
initialize: Sys$Component$initialize,
|
|
raisePropertyChanged: Sys$Component$raisePropertyChanged,
|
|
updated: Sys$Component$updated
|
|
}
|
|
Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing);
|
|
function Sys$Component$_setProperties(target, properties) {
|
|
/// <summary locid="M:J#Sys.Component._setProperties" />
|
|
/// <param name="target"></param>
|
|
/// <param name="properties"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "target"},
|
|
{name: "properties"}
|
|
]);
|
|
if (e) throw e;
|
|
var current;
|
|
var targetType = Object.getType(target);
|
|
var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
|
|
var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating();
|
|
if (isComponent) target.beginUpdate();
|
|
for (var name in properties) {
|
|
var val = properties[name];
|
|
var getter = isObject ? null : target["get_" + name];
|
|
if (isObject || typeof(getter) !== 'function') {
|
|
var targetVal = target[name];
|
|
if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
|
|
if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
|
|
target[name] = val;
|
|
}
|
|
else {
|
|
Sys$Component$_setProperties(targetVal, val);
|
|
}
|
|
}
|
|
else {
|
|
var setter = target["set_" + name];
|
|
if (typeof(setter) === 'function') {
|
|
setter.apply(target, [val]);
|
|
}
|
|
else if (val instanceof Array) {
|
|
current = getter.apply(target);
|
|
if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
|
|
for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) {
|
|
current[j] = val[i];
|
|
}
|
|
}
|
|
else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) {
|
|
current = getter.apply(target);
|
|
if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
|
|
Sys$Component$_setProperties(current, val);
|
|
}
|
|
else {
|
|
throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
|
|
}
|
|
}
|
|
}
|
|
if (isComponent) target.endUpdate();
|
|
}
|
|
function Sys$Component$_setReferences(component, references) {
|
|
for (var name in references) {
|
|
var setter = component["set_" + name];
|
|
var reference = $find(references[name]);
|
|
if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
|
|
if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name]));
|
|
setter.apply(component, [reference]);
|
|
}
|
|
}
|
|
var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
|
|
/// <summary locid="M:J#Sys.Component.create" />
|
|
/// <param name="type" type="Type"></param>
|
|
/// <param name="properties" optional="true" mayBeNull="true"></param>
|
|
/// <param name="events" optional="true" mayBeNull="true"></param>
|
|
/// <param name="references" optional="true" mayBeNull="true"></param>
|
|
/// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Sys.UI.Component"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "type", type: Type},
|
|
{name: "properties", mayBeNull: true, optional: true},
|
|
{name: "events", mayBeNull: true, optional: true},
|
|
{name: "references", mayBeNull: true, optional: true},
|
|
{name: "element", mayBeNull: true, domElement: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!type.inheritsFrom(Sys.Component)) {
|
|
throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
|
|
}
|
|
if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
|
|
if (!element) throw Error.argument('element', Sys.Res.createNoDom);
|
|
}
|
|
else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom);
|
|
var component = (element ? new type(element): new type());
|
|
var app = Sys.Application;
|
|
var creatingComponents = app.get_isCreatingComponents();
|
|
component.beginUpdate();
|
|
if (properties) {
|
|
Sys$Component$_setProperties(component, properties);
|
|
}
|
|
if (events) {
|
|
for (var name in events) {
|
|
if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
|
|
if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
|
|
component["add_" + name](events[name]);
|
|
}
|
|
}
|
|
if (component.get_id()) {
|
|
app.addComponent(component);
|
|
}
|
|
if (creatingComponents) {
|
|
app._createdComponents[app._createdComponents.length] = component;
|
|
if (references) {
|
|
app._addComponentToSecondPass(component, references);
|
|
}
|
|
else {
|
|
component.endUpdate();
|
|
}
|
|
}
|
|
else {
|
|
if (references) {
|
|
Sys$Component$_setReferences(component, references);
|
|
}
|
|
component.endUpdate();
|
|
}
|
|
return component;
|
|
}
|
|
|
|
Sys.UI.MouseButton = function Sys$UI$MouseButton() {
|
|
/// <summary locid="M:J#Sys.UI.MouseButton.#ctor" />
|
|
/// <field name="leftButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.leftButton"></field>
|
|
/// <field name="middleButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.middleButton"></field>
|
|
/// <field name="rightButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.rightButton"></field>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.UI.MouseButton.prototype = {
|
|
leftButton: 0,
|
|
middleButton: 1,
|
|
rightButton: 2
|
|
}
|
|
Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");
|
|
|
|
Sys.UI.Key = function Sys$UI$Key() {
|
|
/// <summary locid="M:J#Sys.UI.Key.#ctor" />
|
|
/// <field name="backspace" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.backspace"></field>
|
|
/// <field name="tab" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.tab"></field>
|
|
/// <field name="enter" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.enter"></field>
|
|
/// <field name="esc" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.esc"></field>
|
|
/// <field name="space" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.space"></field>
|
|
/// <field name="pageUp" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageUp"></field>
|
|
/// <field name="pageDown" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageDown"></field>
|
|
/// <field name="end" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.end"></field>
|
|
/// <field name="home" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.home"></field>
|
|
/// <field name="left" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.left"></field>
|
|
/// <field name="up" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.up"></field>
|
|
/// <field name="right" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.right"></field>
|
|
/// <field name="down" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.down"></field>
|
|
/// <field name="del" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.del"></field>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.UI.Key.prototype = {
|
|
backspace: 8,
|
|
tab: 9,
|
|
enter: 13,
|
|
esc: 27,
|
|
space: 32,
|
|
pageUp: 33,
|
|
pageDown: 34,
|
|
end: 35,
|
|
home: 36,
|
|
left: 37,
|
|
up: 38,
|
|
right: 39,
|
|
down: 40,
|
|
del: 127
|
|
}
|
|
Sys.UI.Key.registerEnum("Sys.UI.Key");
|
|
|
|
Sys.UI.Point = function Sys$UI$Point(x, y) {
|
|
/// <summary locid="M:J#Sys.UI.Point.#ctor" />
|
|
/// <param name="x" type="Number" integer="true"></param>
|
|
/// <param name="y" type="Number" integer="true"></param>
|
|
/// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
|
|
/// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "x", type: Number, integer: true},
|
|
{name: "y", type: Number, integer: true}
|
|
]);
|
|
if (e) throw e;
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
Sys.UI.Point.registerClass('Sys.UI.Point');
|
|
|
|
Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) {
|
|
/// <summary locid="M:J#Sys.UI.Bounds.#ctor" />
|
|
/// <param name="x" type="Number" integer="true"></param>
|
|
/// <param name="y" type="Number" integer="true"></param>
|
|
/// <param name="width" type="Number" integer="true"></param>
|
|
/// <param name="height" type="Number" integer="true"></param>
|
|
/// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.x"></field>
|
|
/// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.y"></field>
|
|
/// <field name="width" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.width"></field>
|
|
/// <field name="height" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.height"></field>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "x", type: Number, integer: true},
|
|
{name: "y", type: Number, integer: true},
|
|
{name: "width", type: Number, integer: true},
|
|
{name: "height", type: Number, integer: true}
|
|
]);
|
|
if (e) throw e;
|
|
this.x = x;
|
|
this.y = y;
|
|
this.height = height;
|
|
this.width = width;
|
|
}
|
|
Sys.UI.Bounds.registerClass('Sys.UI.Bounds');
|
|
|
|
Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.#ctor" />
|
|
/// <param name="eventObject"></param>
|
|
/// <field name="altKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.altKey"></field>
|
|
/// <field name="button" type="Sys.UI.MouseButton" locid="F:J#Sys.UI.DomEvent.button"></field>
|
|
/// <field name="charCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.charCode"></field>
|
|
/// <field name="clientX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientX"></field>
|
|
/// <field name="clientY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientY"></field>
|
|
/// <field name="ctrlKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.ctrlKey"></field>
|
|
/// <field name="keyCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.keyCode"></field>
|
|
/// <field name="offsetX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetX"></field>
|
|
/// <field name="offsetY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetY"></field>
|
|
/// <field name="screenX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenX"></field>
|
|
/// <field name="screenY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenY"></field>
|
|
/// <field name="shiftKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.shiftKey"></field>
|
|
/// <field name="target" locid="F:J#Sys.UI.DomEvent.target"></field>
|
|
/// <field name="type" type="String" locid="F:J#Sys.UI.DomEvent.type"></field>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "eventObject"}
|
|
]);
|
|
if (e) throw e;
|
|
var ev = eventObject;
|
|
var etype = this.type = ev.type.toLowerCase();
|
|
this.rawEvent = ev;
|
|
this.altKey = ev.altKey;
|
|
if (typeof(ev.button) !== 'undefined') {
|
|
this.button = (typeof(ev.which) !== 'undefined') ? ev.button :
|
|
(ev.button === 4) ? Sys.UI.MouseButton.middleButton :
|
|
(ev.button === 2) ? Sys.UI.MouseButton.rightButton :
|
|
Sys.UI.MouseButton.leftButton;
|
|
}
|
|
if (etype === 'keypress') {
|
|
this.charCode = ev.charCode || ev.keyCode;
|
|
}
|
|
else if (ev.keyCode && (ev.keyCode === 46)) {
|
|
this.keyCode = 127;
|
|
}
|
|
else {
|
|
this.keyCode = ev.keyCode;
|
|
}
|
|
this.clientX = ev.clientX;
|
|
this.clientY = ev.clientY;
|
|
this.ctrlKey = ev.ctrlKey;
|
|
this.target = ev.target ? ev.target : ev.srcElement;
|
|
if (!etype.startsWith('key')) {
|
|
if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !== 'undefined')) {
|
|
this.offsetX = ev.offsetX;
|
|
this.offsetY = ev.offsetY;
|
|
}
|
|
else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX) === 'number')) {
|
|
var loc = Sys.UI.DomElement.getLocation(this.target);
|
|
var w = Sys.UI.DomElement._getWindow(this.target);
|
|
this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x;
|
|
this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y;
|
|
}
|
|
}
|
|
this.screenX = ev.screenX;
|
|
this.screenY = ev.screenY;
|
|
this.shiftKey = ev.shiftKey;
|
|
}
|
|
function Sys$UI$DomEvent$preventDefault() {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.preventDefault" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this.rawEvent.preventDefault) {
|
|
this.rawEvent.preventDefault();
|
|
}
|
|
else if (window.event) {
|
|
this.rawEvent.returnValue = false;
|
|
}
|
|
}
|
|
function Sys$UI$DomEvent$stopPropagation() {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.stopPropagation" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this.rawEvent.stopPropagation) {
|
|
this.rawEvent.stopPropagation();
|
|
}
|
|
else if (window.event) {
|
|
this.rawEvent.cancelBubble = true;
|
|
}
|
|
}
|
|
Sys.UI.DomEvent.prototype = {
|
|
preventDefault: Sys$UI$DomEvent$preventDefault,
|
|
stopPropagation: Sys$UI$DomEvent$stopPropagation
|
|
}
|
|
Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent');
|
|
var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler, autoRemove) {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.addHandler" />
|
|
/// <param name="element"></param>
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
/// <param name="autoRemove" type="Boolean" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element"},
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function},
|
|
{name: "autoRemove", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.DomEvent._ensureDomNode(element);
|
|
if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError);
|
|
if (!element._events) {
|
|
element._events = {};
|
|
}
|
|
var eventCache = element._events[eventName];
|
|
if (!eventCache) {
|
|
element._events[eventName] = eventCache = [];
|
|
}
|
|
var browserHandler;
|
|
if (element.addEventListener) {
|
|
browserHandler = function(e) {
|
|
return handler.call(element, new Sys.UI.DomEvent(e));
|
|
}
|
|
element.addEventListener(eventName, browserHandler, false);
|
|
}
|
|
else if (element.attachEvent) {
|
|
browserHandler = function() {
|
|
var e = {};
|
|
try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {}
|
|
return handler.call(element, new Sys.UI.DomEvent(e));
|
|
}
|
|
element.attachEvent('on' + eventName, browserHandler);
|
|
}
|
|
eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler, autoRemove: autoRemove };
|
|
if (autoRemove) {
|
|
var d = element.dispose;
|
|
if (d !== Sys.UI.DomEvent._disposeHandlers) {
|
|
element.dispose = Sys.UI.DomEvent._disposeHandlers;
|
|
if (typeof(d) !== "undefined") {
|
|
element._chainDispose = d;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner, autoRemove) {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.addHandlers" />
|
|
/// <param name="element"></param>
|
|
/// <param name="events" type="Object"></param>
|
|
/// <param name="handlerOwner" optional="true"></param>
|
|
/// <param name="autoRemove" type="Boolean" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element"},
|
|
{name: "events", type: Object},
|
|
{name: "handlerOwner", optional: true},
|
|
{name: "autoRemove", type: Boolean, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.DomEvent._ensureDomNode(element);
|
|
for (var name in events) {
|
|
var handler = events[name];
|
|
if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);
|
|
if (handlerOwner) {
|
|
handler = Function.createDelegate(handlerOwner, handler);
|
|
}
|
|
$addHandler(element, name, handler, autoRemove || false);
|
|
}
|
|
}
|
|
var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.clearHandlers" />
|
|
/// <param name="element"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element"}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.DomEvent._ensureDomNode(element);
|
|
Sys.UI.DomEvent._clearHandlers(element, false);
|
|
}
|
|
Sys.UI.DomEvent._clearHandlers = function Sys$UI$DomEvent$_clearHandlers(element, autoRemoving) {
|
|
if (element._events) {
|
|
var cache = element._events;
|
|
for (var name in cache) {
|
|
var handlers = cache[name];
|
|
for (var i = handlers.length - 1; i >= 0; i--) {
|
|
var entry = handlers[i];
|
|
if (!autoRemoving || entry.autoRemove) {
|
|
$removeHandler(element, name, entry.handler);
|
|
}
|
|
}
|
|
}
|
|
element._events = null;
|
|
}
|
|
}
|
|
Sys.UI.DomEvent._disposeHandlers = function Sys$UI$DomEvent$_disposeHandlers() {
|
|
Sys.UI.DomEvent._clearHandlers(this, true);
|
|
var d = this._chainDispose, type = typeof(d);
|
|
if (type !== "undefined") {
|
|
this.dispose = d;
|
|
this._chainDispose = null;
|
|
if (type === "function") {
|
|
this.dispose();
|
|
}
|
|
}
|
|
}
|
|
var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {
|
|
/// <summary locid="M:J#Sys.UI.DomEvent.removeHandler" />
|
|
/// <param name="element"></param>
|
|
/// <param name="eventName" type="String"></param>
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element"},
|
|
{name: "eventName", type: String},
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.DomEvent._removeHandler(element, eventName, handler);
|
|
}
|
|
Sys.UI.DomEvent._removeHandler = function Sys$UI$DomEvent$_removeHandler(element, eventName, handler) {
|
|
Sys.UI.DomEvent._ensureDomNode(element);
|
|
var browserHandler = null;
|
|
if ((typeof(element._events) !== 'object') || !element._events) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
|
|
var cache = element._events[eventName];
|
|
if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
|
|
for (var i = 0, l = cache.length; i < l; i++) {
|
|
if (cache[i].handler === handler) {
|
|
browserHandler = cache[i].browserHandler;
|
|
break;
|
|
}
|
|
}
|
|
if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
|
|
if (element.removeEventListener) {
|
|
element.removeEventListener(eventName, browserHandler, false);
|
|
}
|
|
else if (element.detachEvent) {
|
|
element.detachEvent('on' + eventName, browserHandler);
|
|
}
|
|
cache.splice(i, 1);
|
|
}
|
|
Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) {
|
|
if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;
|
|
|
|
var doc = element.ownerDocument || element.document || element;
|
|
if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) {
|
|
throw Error.argument("element", Sys.Res.argumentDomNode);
|
|
}
|
|
}
|
|
|
|
Sys.UI.DomElement = function Sys$UI$DomElement() {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.UI.DomElement.registerClass('Sys.UI.DomElement');
|
|
Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.addCssClass" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!Sys.UI.DomElement.containsCssClass(element, className)) {
|
|
if (element.className === '') {
|
|
element.className = className;
|
|
}
|
|
else {
|
|
element.className += ' ' + className;
|
|
}
|
|
}
|
|
}
|
|
Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.containsCssClass" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="className" type="String"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
return Array.contains(element.className.split(' '), className);
|
|
}
|
|
Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getBounds" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Sys.UI.Bounds"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
var offset = Sys.UI.DomElement.getLocation(element);
|
|
return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);
|
|
}
|
|
var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getElementById" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
|
|
/// <returns domElement="true" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String},
|
|
{name: "element", mayBeNull: true, domElement: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!element) return document.getElementById(id);
|
|
if (element.getElementById) return element.getElementById(id);
|
|
var nodeQueue = [];
|
|
var childNodes = element.childNodes;
|
|
for (var i = 0; i < childNodes.length; i++) {
|
|
var node = childNodes[i];
|
|
if (node.nodeType == 1) {
|
|
nodeQueue[nodeQueue.length] = node;
|
|
}
|
|
}
|
|
while (nodeQueue.length) {
|
|
node = nodeQueue.shift();
|
|
if (node.id == id) {
|
|
return node;
|
|
}
|
|
childNodes = node.childNodes;
|
|
for (i = 0; i < childNodes.length; i++) {
|
|
node = childNodes[i];
|
|
if (node.nodeType == 1) {
|
|
nodeQueue[nodeQueue.length] = node;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
if (document.documentElement.getBoundingClientRect) {
|
|
Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Sys.UI.Point"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
|
|
var clientRect = element.getBoundingClientRect();
|
|
if (!clientRect) {
|
|
return new Sys.UI.Point(0,0);
|
|
}
|
|
var documentElement = element.ownerDocument.documentElement,
|
|
offsetX = Math.floor(clientRect.left + 0.5) + documentElement.scrollLeft,
|
|
offsetY = Math.floor(clientRect.top + 0.5) + documentElement.scrollTop;
|
|
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
|
|
try {
|
|
var f = element.ownerDocument.parentWindow.frameElement || null;
|
|
if (f) {
|
|
var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0;
|
|
offsetX += offset;
|
|
offsetY += offset;
|
|
}
|
|
}
|
|
catch(ex) {
|
|
}
|
|
if (Sys.Browser.version <= 7) {
|
|
|
|
var multiplier, before, rect, d = document.createElement("div");
|
|
d.style.cssText = "position:absolute !important;left:0px !important;right:0px !important;height:0px !important;width:1px !important;display:hidden !important";
|
|
try {
|
|
before = document.body.childNodes[0];
|
|
document.body.insertBefore(d, before);
|
|
rect = d.getBoundingClientRect();
|
|
document.body.removeChild(d);
|
|
multiplier = (rect.right - rect.left);
|
|
}
|
|
catch (e) {
|
|
}
|
|
if (multiplier && (multiplier !== 1)) {
|
|
offsetX = Math.floor(offsetX / multiplier);
|
|
offsetY = Math.floor(offsetY / multiplier);
|
|
}
|
|
}
|
|
if ((document.documentMode || 0) < 8) {
|
|
offsetX -= 2;
|
|
offsetY -= 2;
|
|
}
|
|
}
|
|
return new Sys.UI.Point(offsetX, offsetY);
|
|
}
|
|
}
|
|
else if (Sys.Browser.agent === Sys.Browser.Safari) {
|
|
Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Sys.UI.Point"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
|
|
var offsetX = 0, offsetY = 0,
|
|
parent,
|
|
previous = null,
|
|
previousStyle = null,
|
|
currentStyle;
|
|
for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
|
|
var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
|
|
if ((parent.offsetLeft || parent.offsetTop) &&
|
|
((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) {
|
|
offsetX += parent.offsetLeft;
|
|
offsetY += parent.offsetTop;
|
|
}
|
|
if (previous && Sys.Browser.version >= 3) {
|
|
offsetX += parseInt(currentStyle.borderLeftWidth);
|
|
offsetY += parseInt(currentStyle.borderTopWidth);
|
|
}
|
|
}
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
|
|
var elementPosition = currentStyle ? currentStyle.position : null;
|
|
if (!elementPosition || (elementPosition !== "absolute")) {
|
|
for (parent = element.parentNode; parent; parent = parent.parentNode) {
|
|
tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
|
|
if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
|
|
offsetX -= (parent.scrollLeft || 0);
|
|
offsetY -= (parent.scrollTop || 0);
|
|
}
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
|
|
var parentPosition = currentStyle ? currentStyle.position : null;
|
|
if (parentPosition && (parentPosition === "absolute")) break;
|
|
}
|
|
}
|
|
return new Sys.UI.Point(offsetX, offsetY);
|
|
}
|
|
}
|
|
else {
|
|
Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Sys.UI.Point"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
|
|
var offsetX = 0, offsetY = 0,
|
|
parent,
|
|
previous = null,
|
|
previousStyle = null,
|
|
currentStyle = null;
|
|
for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
|
|
var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
|
|
if ((parent.offsetLeft || parent.offsetTop) &&
|
|
!((tagName === "BODY") &&
|
|
(!previousStyle || previousStyle.position !== "absolute"))) {
|
|
offsetX += parent.offsetLeft;
|
|
offsetY += parent.offsetTop;
|
|
}
|
|
if (previous !== null && currentStyle) {
|
|
if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) {
|
|
offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
|
|
offsetY += parseInt(currentStyle.borderTopWidth) || 0;
|
|
}
|
|
if (tagName === "TABLE" &&
|
|
(currentStyle.position === "relative" || currentStyle.position === "absolute")) {
|
|
offsetX += parseInt(currentStyle.marginLeft) || 0;
|
|
offsetY += parseInt(currentStyle.marginTop) || 0;
|
|
}
|
|
}
|
|
}
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
|
|
var elementPosition = currentStyle ? currentStyle.position : null;
|
|
if (!elementPosition || (elementPosition !== "absolute")) {
|
|
for (parent = element.parentNode; parent; parent = parent.parentNode) {
|
|
tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
|
|
if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
|
|
offsetX -= (parent.scrollLeft || 0);
|
|
offsetY -= (parent.scrollTop || 0);
|
|
currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
|
|
if (currentStyle) {
|
|
offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
|
|
offsetY += parseInt(currentStyle.borderTopWidth) || 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return new Sys.UI.Point(offsetX, offsetY);
|
|
}
|
|
}
|
|
Sys.UI.DomElement.isDomElement = function Sys$UI$DomElement$isDomElement(obj) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.isDomElement" />
|
|
/// <param name="obj"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "obj"}
|
|
]);
|
|
if (e) throw e;
|
|
return Sys._isDomElement(obj);
|
|
}
|
|
Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.removeCssClass" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
var currentClassName = ' ' + element.className + ' ';
|
|
var index = currentClassName.indexOf(' ' + className + ' ');
|
|
if (index >= 0) {
|
|
element.className = (currentClassName.substr(0, index) + ' ' +
|
|
currentClassName.substring(index + className.length + 1, currentClassName.length)).trim();
|
|
}
|
|
}
|
|
Sys.UI.DomElement.resolveElement = function Sys$UI$DomElement$resolveElement(elementOrElementId, containerElement) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.resolveElement" />
|
|
/// <param name="elementOrElementId" mayBeNull="true"></param>
|
|
/// <param name="containerElement" domElement="true" optional="true" mayBeNull="true"></param>
|
|
/// <returns domElement="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "elementOrElementId", mayBeNull: true},
|
|
{name: "containerElement", mayBeNull: true, domElement: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var el = elementOrElementId;
|
|
if (!el) return null;
|
|
if (typeof(el) === "string") {
|
|
el = Sys.UI.DomElement.getElementById(el, containerElement);
|
|
if (!el) {
|
|
throw Error.argument("elementOrElementId", String.format(Sys.Res.elementNotFound, elementOrElementId));
|
|
}
|
|
}
|
|
else if(!Sys.UI.DomElement.isDomElement(el)) {
|
|
throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId);
|
|
}
|
|
return el;
|
|
}
|
|
Sys.UI.DomElement.raiseBubbleEvent = function Sys$UI$DomElement$raiseBubbleEvent(source, args) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.raiseBubbleEvent" />
|
|
/// <param name="source" domElement="true"></param>
|
|
/// <param name="args" type="Sys.EventArgs"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "source", domElement: true},
|
|
{name: "args", type: Sys.EventArgs}
|
|
]);
|
|
if (e) throw e;
|
|
var target = source;
|
|
while (target) {
|
|
var control = target.control;
|
|
if (control && control.onBubbleEvent && control.raiseBubbleEvent) {
|
|
Sys.UI.DomElement._raiseBubbleEventFromControl(control, source, args);
|
|
return;
|
|
}
|
|
target = target.parentNode;
|
|
}
|
|
}
|
|
Sys.UI.DomElement._raiseBubbleEventFromControl = function Sys$UI$DomElement$_raiseBubbleEventFromControl(control, source, args) {
|
|
if (!control.onBubbleEvent(source, args)) {
|
|
control._raiseBubbleEvent(source, args);
|
|
}
|
|
}
|
|
Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.setLocation" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="x" type="Number" integer="true"></param>
|
|
/// <param name="y" type="Number" integer="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "x", type: Number, integer: true},
|
|
{name: "y", type: Number, integer: true}
|
|
]);
|
|
if (e) throw e;
|
|
var style = element.style;
|
|
style.position = 'absolute';
|
|
style.left = x + "px";
|
|
style.top = y + "px";
|
|
}
|
|
Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.toggleCssClass" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (Sys.UI.DomElement.containsCssClass(element, className)) {
|
|
Sys.UI.DomElement.removeCssClass(element, className);
|
|
}
|
|
else {
|
|
Sys.UI.DomElement.addCssClass(element, className);
|
|
}
|
|
}
|
|
Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getVisibilityMode" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Sys.UI.VisibilityMode"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ?
|
|
Sys.UI.VisibilityMode.hide :
|
|
Sys.UI.VisibilityMode.collapse;
|
|
}
|
|
Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.setVisibilityMode" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="value" type="Sys.UI.VisibilityMode"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "value", type: Sys.UI.VisibilityMode}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.DomElement._ensureOldDisplayMode(element);
|
|
if (element._visibilityMode !== value) {
|
|
element._visibilityMode = value;
|
|
if (Sys.UI.DomElement.getVisible(element) === false) {
|
|
if (element._visibilityMode === Sys.UI.VisibilityMode.hide) {
|
|
element.style.display = element._oldDisplayMode;
|
|
}
|
|
else {
|
|
element.style.display = 'none';
|
|
}
|
|
}
|
|
element._visibilityMode = value;
|
|
}
|
|
}
|
|
Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.getVisible" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
|
|
if (!style) return true;
|
|
return (style.visibility !== 'hidden') && (style.display !== 'none');
|
|
}
|
|
Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) {
|
|
/// <summary locid="M:J#Sys.UI.DomElement.setVisible" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="value" type="Boolean"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "value", type: Boolean}
|
|
]);
|
|
if (e) throw e;
|
|
if (value !== Sys.UI.DomElement.getVisible(element)) {
|
|
Sys.UI.DomElement._ensureOldDisplayMode(element);
|
|
element.style.visibility = value ? 'visible' : 'hidden';
|
|
if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) {
|
|
element.style.display = element._oldDisplayMode;
|
|
}
|
|
else {
|
|
element.style.display = 'none';
|
|
}
|
|
}
|
|
}
|
|
Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) {
|
|
if (!element._oldDisplayMode) {
|
|
var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
|
|
element._oldDisplayMode = style ? style.display : null;
|
|
if (!element._oldDisplayMode || element._oldDisplayMode === 'none') {
|
|
switch(element.tagName.toUpperCase()) {
|
|
case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL':
|
|
case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM':
|
|
case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR':
|
|
case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD':
|
|
case 'TH': case 'TR': case 'UL':
|
|
element._oldDisplayMode = 'block';
|
|
break;
|
|
case 'LI':
|
|
element._oldDisplayMode = 'list-item';
|
|
break;
|
|
default:
|
|
element._oldDisplayMode = 'inline';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) {
|
|
var doc = element.ownerDocument || element.document || element;
|
|
return doc.defaultView || doc.parentWindow;
|
|
}
|
|
Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) {
|
|
if (element.nodeType === 3) return null;
|
|
var w = Sys.UI.DomElement._getWindow(element);
|
|
if (element.documentElement) element = element.documentElement;
|
|
var computedStyle = (w && (element !== w) && w.getComputedStyle) ?
|
|
w.getComputedStyle(element, null) :
|
|
element.currentStyle || element.style;
|
|
if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) {
|
|
var oldDisplay = element.style.display;
|
|
var oldPosition = element.style.position;
|
|
element.style.position = 'absolute';
|
|
element.style.display = 'block';
|
|
var style = w.getComputedStyle(element, null);
|
|
element.style.display = oldDisplay;
|
|
element.style.position = oldPosition;
|
|
computedStyle = {};
|
|
for (var n in style) {
|
|
computedStyle[n] = style[n];
|
|
}
|
|
computedStyle.display = 'none';
|
|
}
|
|
return computedStyle;
|
|
}
|
|
|
|
Sys.IContainer = function Sys$IContainer() {
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$IContainer$addComponent(component) {
|
|
/// <summary locid="M:J#Sys.IContainer.addComponent" />
|
|
/// <param name="component" type="Sys.Component"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "component", type: Sys.Component}
|
|
]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$IContainer$removeComponent(component) {
|
|
/// <summary locid="M:J#Sys.IContainer.removeComponent" />
|
|
/// <param name="component" type="Sys.Component"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "component", type: Sys.Component}
|
|
]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$IContainer$findComponent(id) {
|
|
/// <summary locid="M:J#Sys.IContainer.findComponent" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <returns type="Sys.Component"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$IContainer$getComponents() {
|
|
/// <summary locid="M:J#Sys.IContainer.getComponents" />
|
|
/// <returns type="Array" elementType="Sys.Component"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.IContainer.prototype = {
|
|
addComponent: Sys$IContainer$addComponent,
|
|
removeComponent: Sys$IContainer$removeComponent,
|
|
findComponent: Sys$IContainer$findComponent,
|
|
getComponents: Sys$IContainer$getComponents
|
|
}
|
|
Sys.IContainer.registerInterface("Sys.IContainer");
|
|
|
|
Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) {
|
|
/// <summary locid="M:J#Sys.ApplicationLoadEventArgs.#ctor" />
|
|
/// <param name="components" type="Array" elementType="Sys.Component"></param>
|
|
/// <param name="isPartialLoad" type="Boolean"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "components", type: Array, elementType: Sys.Component},
|
|
{name: "isPartialLoad", type: Boolean}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.ApplicationLoadEventArgs.initializeBase(this);
|
|
this._components = components;
|
|
this._isPartialLoad = isPartialLoad;
|
|
}
|
|
|
|
function Sys$ApplicationLoadEventArgs$get_components() {
|
|
/// <value type="Array" elementType="Sys.Component" locid="P:J#Sys.ApplicationLoadEventArgs.components"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._components;
|
|
}
|
|
function Sys$ApplicationLoadEventArgs$get_isPartialLoad() {
|
|
/// <value type="Boolean" locid="P:J#Sys.ApplicationLoadEventArgs.isPartialLoad"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._isPartialLoad;
|
|
}
|
|
Sys.ApplicationLoadEventArgs.prototype = {
|
|
get_components: Sys$ApplicationLoadEventArgs$get_components,
|
|
get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad
|
|
}
|
|
Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
|
|
|
|
Sys._Application = function Sys$_Application() {
|
|
/// <summary locid="M:J#Sys.Application.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
Sys._Application.initializeBase(this);
|
|
this._disposableObjects = [];
|
|
this._components = {};
|
|
this._createdComponents = [];
|
|
this._secondPassComponents = [];
|
|
this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler);
|
|
Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
|
|
this._domReady();
|
|
}
|
|
function Sys$_Application$get_isCreatingComponents() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Application.isCreatingComponents"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._creatingComponents;
|
|
}
|
|
function Sys$_Application$get_isDisposing() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Application.isDisposing"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._disposing;
|
|
}
|
|
function Sys$_Application$add_init(handler) {
|
|
/// <summary locid="E:J#Sys.Application.init" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
if (this._initialized) {
|
|
handler(this, Sys.EventArgs.Empty);
|
|
}
|
|
else {
|
|
this.get_events().addHandler("init", handler);
|
|
}
|
|
}
|
|
function Sys$_Application$remove_init(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("init", handler);
|
|
}
|
|
function Sys$_Application$add_load(handler) {
|
|
/// <summary locid="E:J#Sys.Application.load" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().addHandler("load", handler);
|
|
}
|
|
function Sys$_Application$remove_load(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("load", handler);
|
|
}
|
|
function Sys$_Application$add_unload(handler) {
|
|
/// <summary locid="E:J#Sys.Application.unload" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().addHandler("unload", handler);
|
|
}
|
|
function Sys$_Application$remove_unload(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("unload", handler);
|
|
}
|
|
function Sys$_Application$addComponent(component) {
|
|
/// <summary locid="M:J#Sys.Application.addComponent" />
|
|
/// <param name="component" type="Sys.Component"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "component", type: Sys.Component}
|
|
]);
|
|
if (e) throw e;
|
|
var id = component.get_id();
|
|
if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId);
|
|
if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id));
|
|
this._components[id] = component;
|
|
}
|
|
function Sys$_Application$beginCreateComponents() {
|
|
/// <summary locid="M:J#Sys.Application.beginCreateComponents" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._creatingComponents = true;
|
|
}
|
|
function Sys$_Application$dispose() {
|
|
/// <summary locid="M:J#Sys.Application.dispose" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._disposing) {
|
|
this._disposing = true;
|
|
if (this._timerCookie) {
|
|
window.clearTimeout(this._timerCookie);
|
|
delete this._timerCookie;
|
|
}
|
|
if (this._endRequestHandler) {
|
|
Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
|
|
delete this._endRequestHandler;
|
|
}
|
|
if (this._beginRequestHandler) {
|
|
Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);
|
|
delete this._beginRequestHandler;
|
|
}
|
|
if (window.pageUnload) {
|
|
window.pageUnload(this, Sys.EventArgs.Empty);
|
|
}
|
|
var unloadHandler = this.get_events().getHandler("unload");
|
|
if (unloadHandler) {
|
|
unloadHandler(this, Sys.EventArgs.Empty);
|
|
}
|
|
var disposableObjects = Array.clone(this._disposableObjects);
|
|
for (var i = 0, l = disposableObjects.length; i < l; i++) {
|
|
var object = disposableObjects[i];
|
|
if (typeof(object) !== "undefined") {
|
|
object.dispose();
|
|
}
|
|
}
|
|
Array.clear(this._disposableObjects);
|
|
Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate);
|
|
if (Sys._ScriptLoader) {
|
|
var sl = Sys._ScriptLoader.getInstance();
|
|
if(sl) {
|
|
sl.dispose();
|
|
}
|
|
}
|
|
Sys._Application.callBaseMethod(this, 'dispose');
|
|
}
|
|
}
|
|
function Sys$_Application$disposeElement(element, childNodesOnly) {
|
|
/// <summary locid="M:J#Sys._Application.disposeElement" />
|
|
/// <param name="element"></param>
|
|
/// <param name="childNodesOnly" type="Boolean"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element"},
|
|
{name: "childNodesOnly", type: Boolean}
|
|
]);
|
|
if (e) throw e;
|
|
if (element.nodeType === 1) {
|
|
var children = element.getElementsByTagName("*");
|
|
for (var i = children.length - 1; i >= 0; i--) {
|
|
this._disposeElementInternal(children[i]);
|
|
}
|
|
if (!childNodesOnly) {
|
|
this._disposeElementInternal(element);
|
|
}
|
|
}
|
|
}
|
|
function Sys$_Application$endCreateComponents() {
|
|
/// <summary locid="M:J#Sys.Application.endCreateComponents" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var components = this._secondPassComponents;
|
|
for (var i = 0, l = components.length; i < l; i++) {
|
|
var component = components[i].component;
|
|
Sys$Component$_setReferences(component, components[i].references);
|
|
component.endUpdate();
|
|
}
|
|
this._secondPassComponents = [];
|
|
this._creatingComponents = false;
|
|
}
|
|
function Sys$_Application$findComponent(id, parent) {
|
|
/// <summary locid="M:J#Sys.Application.findComponent" />
|
|
/// <param name="id" type="String"></param>
|
|
/// <param name="parent" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Sys.Component" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "id", type: String},
|
|
{name: "parent", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
return (parent ?
|
|
((Sys.IContainer.isInstanceOfType(parent)) ?
|
|
parent.findComponent(id) :
|
|
parent[id] || null) :
|
|
Sys.Application._components[id] || null);
|
|
}
|
|
function Sys$_Application$getComponents() {
|
|
/// <summary locid="M:J#Sys.Application.getComponents" />
|
|
/// <returns type="Array" elementType="Sys.Component"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var res = [];
|
|
var components = this._components;
|
|
for (var name in components) {
|
|
res[res.length] = components[name];
|
|
}
|
|
return res;
|
|
}
|
|
function Sys$_Application$initialize() {
|
|
/// <summary locid="M:J#Sys.Application.initialize" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if(!this.get_isInitialized() && !this._disposing) {
|
|
Sys._Application.callBaseMethod(this, 'initialize');
|
|
this._raiseInit();
|
|
if (this.get_stateString) {
|
|
if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
|
|
this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest);
|
|
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);
|
|
this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest);
|
|
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
|
|
}
|
|
var loadedEntry = this.get_stateString();
|
|
if (loadedEntry !== this._currentEntry) {
|
|
this._navigate(loadedEntry);
|
|
}
|
|
else {
|
|
this._ensureHistory();
|
|
}
|
|
}
|
|
this.raiseLoad();
|
|
}
|
|
}
|
|
function Sys$_Application$notifyScriptLoaded() {
|
|
/// <summary locid="M:J#Sys.Application.notifyScriptLoaded" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
}
|
|
function Sys$_Application$registerDisposableObject(object) {
|
|
/// <summary locid="M:J#Sys.Application.registerDisposableObject" />
|
|
/// <param name="object" type="Sys.IDisposable"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "object", type: Sys.IDisposable}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._disposing) {
|
|
var objects = this._disposableObjects,
|
|
i = objects.length;
|
|
objects[i] = object;
|
|
object.__msdisposeindex = i;
|
|
}
|
|
}
|
|
function Sys$_Application$raiseLoad() {
|
|
/// <summary locid="M:J#Sys.Application.raiseLoad" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var h = this.get_events().getHandler("load");
|
|
var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded);
|
|
this._loaded = true;
|
|
if (h) {
|
|
h(this, args);
|
|
}
|
|
if (window.pageLoad) {
|
|
window.pageLoad(this, args);
|
|
}
|
|
this._createdComponents = [];
|
|
}
|
|
function Sys$_Application$removeComponent(component) {
|
|
/// <summary locid="M:J#Sys.Application.removeComponent" />
|
|
/// <param name="component" type="Sys.Component"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "component", type: Sys.Component}
|
|
]);
|
|
if (e) throw e;
|
|
var id = component.get_id();
|
|
if (id) delete this._components[id];
|
|
}
|
|
function Sys$_Application$unregisterDisposableObject(object) {
|
|
/// <summary locid="M:J#Sys.Application.unregisterDisposableObject" />
|
|
/// <param name="object" type="Sys.IDisposable"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "object", type: Sys.IDisposable}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._disposing) {
|
|
var i = object.__msdisposeindex;
|
|
if (typeof(i) === "number") {
|
|
var disposableObjects = this._disposableObjects;
|
|
delete disposableObjects[i];
|
|
delete object.__msdisposeindex;
|
|
if (++this._deleteCount > 1000) {
|
|
var newArray = [];
|
|
for (var j = 0, l = disposableObjects.length; j < l; j++) {
|
|
object = disposableObjects[j];
|
|
if (typeof(object) !== "undefined") {
|
|
object.__msdisposeindex = newArray.length;
|
|
newArray.push(object);
|
|
}
|
|
}
|
|
this._disposableObjects = newArray;
|
|
this._deleteCount = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function Sys$_Application$_addComponentToSecondPass(component, references) {
|
|
this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references};
|
|
}
|
|
function Sys$_Application$_disposeComponents(list) {
|
|
if (list) {
|
|
for (var i = list.length - 1; i >= 0; i--) {
|
|
var item = list[i];
|
|
if (typeof(item.dispose) === "function") {
|
|
item.dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function Sys$_Application$_disposeElementInternal(element) {
|
|
var d = element.dispose;
|
|
if (d && typeof(d) === "function") {
|
|
element.dispose();
|
|
}
|
|
else {
|
|
var c = element.control;
|
|
if (c && typeof(c.dispose) === "function") {
|
|
c.dispose();
|
|
}
|
|
}
|
|
var list = element._behaviors;
|
|
if (list) {
|
|
this._disposeComponents(list);
|
|
}
|
|
list = element._components;
|
|
if (list) {
|
|
this._disposeComponents(list);
|
|
element._components = null;
|
|
}
|
|
}
|
|
function Sys$_Application$_domReady() {
|
|
var check, er, app = this;
|
|
function init() { app.initialize(); }
|
|
var onload = function() {
|
|
Sys.UI.DomEvent.removeHandler(window, "load", onload);
|
|
init();
|
|
}
|
|
Sys.UI.DomEvent.addHandler(window, "load", onload);
|
|
|
|
if (document.addEventListener) {
|
|
try {
|
|
document.addEventListener("DOMContentLoaded", check = function() {
|
|
document.removeEventListener("DOMContentLoaded", check, false);
|
|
init();
|
|
}, false);
|
|
}
|
|
catch (er) { }
|
|
}
|
|
else if (document.attachEvent) {
|
|
if ((window == window.top) && document.documentElement.doScroll) {
|
|
var timeout, el = document.createElement("div");
|
|
check = function() {
|
|
try {
|
|
el.doScroll("left");
|
|
}
|
|
catch (er) {
|
|
timeout = window.setTimeout(check, 0);
|
|
return;
|
|
}
|
|
el = null;
|
|
init();
|
|
}
|
|
check();
|
|
}
|
|
else {
|
|
document.attachEvent("onreadystatechange", check = function() {
|
|
if (document.readyState === "complete") {
|
|
document.detachEvent("onreadystatechange", check);
|
|
init();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function Sys$_Application$_raiseInit() {
|
|
var handler = this.get_events().getHandler("init");
|
|
if (handler) {
|
|
this.beginCreateComponents();
|
|
handler(this, Sys.EventArgs.Empty);
|
|
this.endCreateComponents();
|
|
}
|
|
}
|
|
function Sys$_Application$_unloadHandler(event) {
|
|
this.dispose();
|
|
}
|
|
Sys._Application.prototype = {
|
|
_creatingComponents: false,
|
|
_disposing: false,
|
|
_deleteCount: 0,
|
|
get_isCreatingComponents: Sys$_Application$get_isCreatingComponents,
|
|
get_isDisposing: Sys$_Application$get_isDisposing,
|
|
add_init: Sys$_Application$add_init,
|
|
remove_init: Sys$_Application$remove_init,
|
|
add_load: Sys$_Application$add_load,
|
|
remove_load: Sys$_Application$remove_load,
|
|
add_unload: Sys$_Application$add_unload,
|
|
remove_unload: Sys$_Application$remove_unload,
|
|
addComponent: Sys$_Application$addComponent,
|
|
beginCreateComponents: Sys$_Application$beginCreateComponents,
|
|
dispose: Sys$_Application$dispose,
|
|
disposeElement: Sys$_Application$disposeElement,
|
|
endCreateComponents: Sys$_Application$endCreateComponents,
|
|
findComponent: Sys$_Application$findComponent,
|
|
getComponents: Sys$_Application$getComponents,
|
|
initialize: Sys$_Application$initialize,
|
|
notifyScriptLoaded: Sys$_Application$notifyScriptLoaded,
|
|
registerDisposableObject: Sys$_Application$registerDisposableObject,
|
|
raiseLoad: Sys$_Application$raiseLoad,
|
|
removeComponent: Sys$_Application$removeComponent,
|
|
unregisterDisposableObject: Sys$_Application$unregisterDisposableObject,
|
|
_addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass,
|
|
_disposeComponents: Sys$_Application$_disposeComponents,
|
|
_disposeElementInternal: Sys$_Application$_disposeElementInternal,
|
|
_domReady: Sys$_Application$_domReady,
|
|
_raiseInit: Sys$_Application$_raiseInit,
|
|
_unloadHandler: Sys$_Application$_unloadHandler
|
|
}
|
|
Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer);
|
|
Sys.Application = new Sys._Application();
|
|
var $find = Sys.Application.findComponent;
|
|
|
|
Sys.UI.Behavior = function Sys$UI$Behavior(element) {
|
|
/// <summary locid="M:J#Sys.UI.Behavior.#ctor" />
|
|
/// <param name="element" domElement="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.UI.Behavior.initializeBase(this);
|
|
this._element = element;
|
|
var behaviors = element._behaviors;
|
|
if (!behaviors) {
|
|
element._behaviors = [this];
|
|
}
|
|
else {
|
|
behaviors[behaviors.length] = this;
|
|
}
|
|
}
|
|
function Sys$UI$Behavior$get_element() {
|
|
/// <value domElement="true" locid="P:J#Sys.UI.Behavior.element"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._element;
|
|
}
|
|
function Sys$UI$Behavior$get_id() {
|
|
/// <value type="String" locid="P:J#Sys.UI.Behavior.id"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
|
|
if (baseId) return baseId;
|
|
if (!this._element || !this._element.id) return '';
|
|
return this._element.id + '$' + this.get_name();
|
|
}
|
|
function Sys$UI$Behavior$get_name() {
|
|
/// <value type="String" locid="P:J#Sys.UI.Behavior.name"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._name) return this._name;
|
|
var name = Object.getTypeName(this);
|
|
var i = name.lastIndexOf('.');
|
|
if (i !== -1) name = name.substr(i + 1);
|
|
if (!this.get_isInitialized()) this._name = name;
|
|
return name;
|
|
}
|
|
function Sys$UI$Behavior$set_name(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' '))
|
|
throw Error.argument('value', Sys.Res.invalidId);
|
|
if (typeof(this._element[value]) !== 'undefined')
|
|
throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value));
|
|
if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit);
|
|
this._name = value;
|
|
}
|
|
function Sys$UI$Behavior$initialize() {
|
|
Sys.UI.Behavior.callBaseMethod(this, 'initialize');
|
|
var name = this.get_name();
|
|
if (name) this._element[name] = this;
|
|
}
|
|
function Sys$UI$Behavior$dispose() {
|
|
Sys.UI.Behavior.callBaseMethod(this, 'dispose');
|
|
var e = this._element;
|
|
if (e) {
|
|
var name = this.get_name();
|
|
if (name) {
|
|
e[name] = null;
|
|
}
|
|
var behaviors = e._behaviors;
|
|
Array.remove(behaviors, this);
|
|
if (behaviors.length === 0) {
|
|
e._behaviors = null;
|
|
}
|
|
delete this._element;
|
|
}
|
|
}
|
|
Sys.UI.Behavior.prototype = {
|
|
_name: null,
|
|
get_element: Sys$UI$Behavior$get_element,
|
|
get_id: Sys$UI$Behavior$get_id,
|
|
get_name: Sys$UI$Behavior$get_name,
|
|
set_name: Sys$UI$Behavior$set_name,
|
|
initialize: Sys$UI$Behavior$initialize,
|
|
dispose: Sys$UI$Behavior$dispose
|
|
}
|
|
Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component);
|
|
Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) {
|
|
/// <summary locid="M:J#Sys.UI.Behavior.getBehaviorByName" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="name" type="String"></param>
|
|
/// <returns type="Sys.UI.Behavior" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "name", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
var b = element[name];
|
|
return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
|
|
}
|
|
Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) {
|
|
/// <summary locid="M:J#Sys.UI.Behavior.getBehaviors" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!element._behaviors) return [];
|
|
return Array.clone(element._behaviors);
|
|
}
|
|
Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) {
|
|
/// <summary locid="M:J#Sys.UI.Behavior.getBehaviorsByType" />
|
|
/// <param name="element" domElement="true"></param>
|
|
/// <param name="type" type="Type"></param>
|
|
/// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true},
|
|
{name: "type", type: Type}
|
|
]);
|
|
if (e) throw e;
|
|
var behaviors = element._behaviors;
|
|
var results = [];
|
|
if (behaviors) {
|
|
for (var i = 0, l = behaviors.length; i < l; i++) {
|
|
if (type.isInstanceOfType(behaviors[i])) {
|
|
results[results.length] = behaviors[i];
|
|
}
|
|
}
|
|
}
|
|
return results;
|
|
}
|
|
|
|
Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() {
|
|
/// <summary locid="M:J#Sys.UI.VisibilityMode.#ctor" />
|
|
/// <field name="hide" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.hide"></field>
|
|
/// <field name="collapse" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.collapse"></field>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.UI.VisibilityMode.prototype = {
|
|
hide: 0,
|
|
collapse: 1
|
|
}
|
|
Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");
|
|
|
|
Sys.UI.Control = function Sys$UI$Control(element) {
|
|
/// <summary locid="M:J#Sys.UI.Control.#ctor" />
|
|
/// <param name="element" domElement="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "element", domElement: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (typeof(element.control) !== 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
|
|
Sys.UI.Control.initializeBase(this);
|
|
this._element = element;
|
|
element.control = this;
|
|
var role = this.get_role();
|
|
if (role) {
|
|
element.setAttribute("role", role);
|
|
}
|
|
}
|
|
function Sys$UI$Control$get_element() {
|
|
/// <value domElement="true" locid="P:J#Sys.UI.Control.element"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._element;
|
|
}
|
|
function Sys$UI$Control$get_id() {
|
|
/// <value type="String" locid="P:J#Sys.UI.Control.id"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._element) return '';
|
|
return this._element.id;
|
|
}
|
|
function Sys$UI$Control$set_id(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
throw Error.invalidOperation(Sys.Res.cantSetId);
|
|
}
|
|
function Sys$UI$Control$get_parent() {
|
|
/// <value type="Sys.UI.Control" locid="P:J#Sys.UI.Control.parent"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._parent) return this._parent;
|
|
if (!this._element) return null;
|
|
|
|
var parentElement = this._element.parentNode;
|
|
while (parentElement) {
|
|
if (parentElement.control) {
|
|
return parentElement.control;
|
|
}
|
|
parentElement = parentElement.parentNode;
|
|
}
|
|
return null;
|
|
}
|
|
function Sys$UI$Control$set_parent(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
var parents = [this];
|
|
var current = value;
|
|
while (current) {
|
|
if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain);
|
|
parents[parents.length] = current;
|
|
current = current.get_parent();
|
|
}
|
|
this._parent = value;
|
|
}
|
|
function Sys$UI$Control$get_role() {
|
|
/// <value type="String" locid="P:J#Sys.UI.Control.role"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return null;
|
|
}
|
|
function Sys$UI$Control$get_visibilityMode() {
|
|
/// <value type="Sys.UI.VisibilityMode" locid="P:J#Sys.UI.Control.visibilityMode"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
return Sys.UI.DomElement.getVisibilityMode(this._element);
|
|
}
|
|
function Sys$UI$Control$set_visibilityMode(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
Sys.UI.DomElement.setVisibilityMode(this._element, value);
|
|
}
|
|
function Sys$UI$Control$get_visible() {
|
|
/// <value type="Boolean" locid="P:J#Sys.UI.Control.visible"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
return Sys.UI.DomElement.getVisible(this._element);
|
|
}
|
|
function Sys$UI$Control$set_visible(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
Sys.UI.DomElement.setVisible(this._element, value)
|
|
}
|
|
function Sys$UI$Control$addCssClass(className) {
|
|
/// <summary locid="M:J#Sys.UI.Control.addCssClass" />
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
Sys.UI.DomElement.addCssClass(this._element, className);
|
|
}
|
|
function Sys$UI$Control$dispose() {
|
|
Sys.UI.Control.callBaseMethod(this, 'dispose');
|
|
if (this._element) {
|
|
this._element.control = null;
|
|
delete this._element;
|
|
}
|
|
if (this._parent) delete this._parent;
|
|
}
|
|
function Sys$UI$Control$onBubbleEvent(source, args) {
|
|
/// <summary locid="M:J#Sys.UI.Control.onBubbleEvent" />
|
|
/// <param name="source"></param>
|
|
/// <param name="args" type="Sys.EventArgs"></param>
|
|
/// <returns type="Boolean"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "source"},
|
|
{name: "args", type: Sys.EventArgs}
|
|
]);
|
|
if (e) throw e;
|
|
return false;
|
|
}
|
|
function Sys$UI$Control$raiseBubbleEvent(source, args) {
|
|
/// <summary locid="M:J#Sys.UI.Control.raiseBubbleEvent" />
|
|
/// <param name="source"></param>
|
|
/// <param name="args" type="Sys.EventArgs"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "source"},
|
|
{name: "args", type: Sys.EventArgs}
|
|
]);
|
|
if (e) throw e;
|
|
this._raiseBubbleEvent(source, args);
|
|
}
|
|
function Sys$UI$Control$_raiseBubbleEvent(source, args) {
|
|
var currentTarget = this.get_parent();
|
|
while (currentTarget) {
|
|
if (currentTarget.onBubbleEvent(source, args)) {
|
|
return;
|
|
}
|
|
currentTarget = currentTarget.get_parent();
|
|
}
|
|
}
|
|
function Sys$UI$Control$removeCssClass(className) {
|
|
/// <summary locid="M:J#Sys.UI.Control.removeCssClass" />
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
Sys.UI.DomElement.removeCssClass(this._element, className);
|
|
}
|
|
function Sys$UI$Control$toggleCssClass(className) {
|
|
/// <summary locid="M:J#Sys.UI.Control.toggleCssClass" />
|
|
/// <param name="className" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "className", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
|
|
Sys.UI.DomElement.toggleCssClass(this._element, className);
|
|
}
|
|
Sys.UI.Control.prototype = {
|
|
_parent: null,
|
|
_visibilityMode: Sys.UI.VisibilityMode.hide,
|
|
get_element: Sys$UI$Control$get_element,
|
|
get_id: Sys$UI$Control$get_id,
|
|
set_id: Sys$UI$Control$set_id,
|
|
get_parent: Sys$UI$Control$get_parent,
|
|
set_parent: Sys$UI$Control$set_parent,
|
|
get_role: Sys$UI$Control$get_role,
|
|
get_visibilityMode: Sys$UI$Control$get_visibilityMode,
|
|
set_visibilityMode: Sys$UI$Control$set_visibilityMode,
|
|
get_visible: Sys$UI$Control$get_visible,
|
|
set_visible: Sys$UI$Control$set_visible,
|
|
addCssClass: Sys$UI$Control$addCssClass,
|
|
dispose: Sys$UI$Control$dispose,
|
|
onBubbleEvent: Sys$UI$Control$onBubbleEvent,
|
|
raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent,
|
|
_raiseBubbleEvent: Sys$UI$Control$_raiseBubbleEvent,
|
|
removeCssClass: Sys$UI$Control$removeCssClass,
|
|
toggleCssClass: Sys$UI$Control$toggleCssClass
|
|
}
|
|
Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component);
|
|
Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) {
|
|
/// <summary locid="M:J#Sys.HistoryEventArgs.#ctor" />
|
|
/// <param name="state" type="Object"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "state", type: Object}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.HistoryEventArgs.initializeBase(this);
|
|
this._state = state;
|
|
}
|
|
function Sys$HistoryEventArgs$get_state() {
|
|
/// <value type="Object" locid="P:J#Sys.HistoryEventArgs.state"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._state;
|
|
}
|
|
Sys.HistoryEventArgs.prototype = {
|
|
get_state: Sys$HistoryEventArgs$get_state
|
|
}
|
|
Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs);
|
|
Sys.Application._appLoadHandler = null;
|
|
Sys.Application._beginRequestHandler = null;
|
|
Sys.Application._clientId = null;
|
|
Sys.Application._currentEntry = '';
|
|
Sys.Application._endRequestHandler = null;
|
|
Sys.Application._history = null;
|
|
Sys.Application._enableHistory = false;
|
|
Sys.Application._historyEnabledInScriptManager = false;
|
|
Sys.Application._historyFrame = null;
|
|
Sys.Application._historyInitialized = false;
|
|
Sys.Application._historyPointIsNew = false;
|
|
Sys.Application._ignoreTimer = false;
|
|
Sys.Application._initialState = null;
|
|
Sys.Application._state = {};
|
|
Sys.Application._timerCookie = 0;
|
|
Sys.Application._timerHandler = null;
|
|
Sys.Application._uniqueId = null;
|
|
Sys._Application.prototype.get_stateString = function Sys$_Application$get_stateString() {
|
|
/// <summary locid="M:J#Sys._Application.get_stateString" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
var hash = null;
|
|
|
|
if (Sys.Browser.agent === Sys.Browser.Firefox) {
|
|
var href = window.location.href;
|
|
var hashIndex = href.indexOf('#');
|
|
if (hashIndex !== -1) {
|
|
hash = href.substring(hashIndex + 1);
|
|
}
|
|
else {
|
|
hash = "";
|
|
}
|
|
return hash;
|
|
}
|
|
else {
|
|
hash = window.location.hash;
|
|
}
|
|
|
|
if ((hash.length > 0) && (hash.charAt(0) === '#')) {
|
|
hash = hash.substring(1);
|
|
}
|
|
return hash;
|
|
};
|
|
Sys._Application.prototype.get_enableHistory = function Sys$_Application$get_enableHistory() {
|
|
/// <summary locid="M:J#Sys._Application.get_enableHistory" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._enableHistory;
|
|
};
|
|
Sys._Application.prototype.set_enableHistory = function Sys$_Application$set_enableHistory(value) {
|
|
if (this._initialized && !this._initializing) {
|
|
throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory);
|
|
}
|
|
else if (this._historyEnabledInScriptManager && !value) {
|
|
throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination);
|
|
}
|
|
this._enableHistory = value;
|
|
};
|
|
Sys._Application.prototype.add_navigate = function Sys$_Application$add_navigate(handler) {
|
|
/// <summary locid="E:J#Sys.Application.navigate" />
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
this.get_events().addHandler("navigate", handler);
|
|
};
|
|
Sys._Application.prototype.remove_navigate = function Sys$_Application$remove_navigate(handler) {
|
|
/// <summary locid="M:J#Sys._Application.remove_navigate" />
|
|
/// <param name="handler" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "handler", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
this.get_events().removeHandler("navigate", handler);
|
|
};
|
|
Sys._Application.prototype.addHistoryPoint = function Sys$_Application$addHistoryPoint(state, title) {
|
|
/// <summary locid="M:J#Sys.Application.addHistoryPoint" />
|
|
/// <param name="state" type="Object"></param>
|
|
/// <param name="title" type="String" optional="true" mayBeNull="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "state", type: Object},
|
|
{name: "title", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled);
|
|
for (var n in state) {
|
|
var v = state[n];
|
|
var t = typeof(v);
|
|
if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) {
|
|
throw Error.argument('state', Sys.Res.stateMustBeStringDictionary);
|
|
}
|
|
}
|
|
this._ensureHistory();
|
|
var initialState = this._state;
|
|
for (var key in state) {
|
|
var value = state[key];
|
|
if (value === null) {
|
|
if (typeof(initialState[key]) !== 'undefined') {
|
|
delete initialState[key];
|
|
}
|
|
}
|
|
else {
|
|
initialState[key] = value;
|
|
}
|
|
}
|
|
var entry = this._serializeState(initialState);
|
|
this._historyPointIsNew = true;
|
|
this._setState(entry, title);
|
|
this._raiseNavigate();
|
|
};
|
|
Sys._Application.prototype.setServerId = function Sys$_Application$setServerId(clientId, uniqueId) {
|
|
/// <summary locid="M:J#Sys.Application.setServerId" />
|
|
/// <param name="clientId" type="String"></param>
|
|
/// <param name="uniqueId" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "clientId", type: String},
|
|
{name: "uniqueId", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
this._clientId = clientId;
|
|
this._uniqueId = uniqueId;
|
|
};
|
|
Sys._Application.prototype.setServerState = function Sys$_Application$setServerState(value) {
|
|
/// <summary locid="M:J#Sys.Application.setServerState" />
|
|
/// <param name="value" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "value", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
this._ensureHistory();
|
|
this._state.__s = value;
|
|
this._updateHiddenField(value);
|
|
};
|
|
Sys._Application.prototype._deserializeState = function Sys$_Application$_deserializeState(entry) {
|
|
var result = {};
|
|
entry = entry || '';
|
|
var serverSeparator = entry.indexOf('&&');
|
|
if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) {
|
|
result.__s = entry.substr(serverSeparator + 2);
|
|
entry = entry.substr(0, serverSeparator);
|
|
}
|
|
var tokens = entry.split('&');
|
|
for (var i = 0, l = tokens.length; i < l; i++) {
|
|
var token = tokens[i];
|
|
var equal = token.indexOf('=');
|
|
if ((equal !== -1) && (equal + 1 < token.length)) {
|
|
var name = token.substr(0, equal);
|
|
var value = token.substr(equal + 1);
|
|
result[name] = decodeURIComponent(value);
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
Sys._Application.prototype._enableHistoryInScriptManager = function Sys$_Application$_enableHistoryInScriptManager() {
|
|
this._enableHistory = true;
|
|
this._historyEnabledInScriptManager = true;
|
|
};
|
|
Sys._Application.prototype._ensureHistory = function Sys$_Application$_ensureHistory() {
|
|
if (!this._historyInitialized && this._enableHistory) {
|
|
if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) {
|
|
this._historyFrame = document.getElementById('__historyFrame');
|
|
if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame);
|
|
this._ignoreIFrame = true;
|
|
}
|
|
this._timerHandler = Function.createDelegate(this, this._onIdle);
|
|
this._timerCookie = window.setTimeout(this._timerHandler, 100);
|
|
|
|
try {
|
|
this._initialState = this._deserializeState(this.get_stateString());
|
|
} catch(e) {}
|
|
|
|
this._historyInitialized = true;
|
|
}
|
|
};
|
|
Sys._Application.prototype._navigate = function Sys$_Application$_navigate(entry) {
|
|
this._ensureHistory();
|
|
var state = this._deserializeState(entry);
|
|
|
|
if (this._uniqueId) {
|
|
var oldServerEntry = this._state.__s || '';
|
|
var newServerEntry = state.__s || '';
|
|
if (newServerEntry !== oldServerEntry) {
|
|
this._updateHiddenField(newServerEntry);
|
|
__doPostBack(this._uniqueId, newServerEntry);
|
|
this._state = state;
|
|
return;
|
|
}
|
|
}
|
|
this._setState(entry);
|
|
this._state = state;
|
|
this._raiseNavigate();
|
|
};
|
|
Sys._Application.prototype._onIdle = function Sys$_Application$_onIdle() {
|
|
delete this._timerCookie;
|
|
|
|
var entry = this.get_stateString();
|
|
if (entry !== this._currentEntry) {
|
|
if (!this._ignoreTimer) {
|
|
this._historyPointIsNew = false;
|
|
this._navigate(entry);
|
|
}
|
|
}
|
|
else {
|
|
this._ignoreTimer = false;
|
|
}
|
|
this._timerCookie = window.setTimeout(this._timerHandler, 100);
|
|
};
|
|
Sys._Application.prototype._onIFrameLoad = function Sys$_Application$_onIFrameLoad(entry) {
|
|
this._ensureHistory();
|
|
if (!this._ignoreIFrame) {
|
|
this._historyPointIsNew = false;
|
|
this._navigate(entry);
|
|
}
|
|
this._ignoreIFrame = false;
|
|
};
|
|
Sys._Application.prototype._onPageRequestManagerBeginRequest = function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) {
|
|
this._ignoreTimer = true;
|
|
};
|
|
Sys._Application.prototype._onPageRequestManagerEndRequest = function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) {
|
|
var dataItem = args.get_dataItems()[this._clientId];
|
|
var eventTarget = document.getElementById("__EVENTTARGET");
|
|
if (eventTarget && eventTarget.value === this._uniqueId) {
|
|
eventTarget.value = '';
|
|
}
|
|
if (typeof(dataItem) !== 'undefined') {
|
|
this.setServerState(dataItem);
|
|
this._historyPointIsNew = true;
|
|
}
|
|
else {
|
|
this._ignoreTimer = false;
|
|
}
|
|
var entry = this._serializeState(this._state);
|
|
if (entry !== this._currentEntry) {
|
|
this._ignoreTimer = true;
|
|
this._setState(entry);
|
|
this._raiseNavigate();
|
|
}
|
|
};
|
|
Sys._Application.prototype._raiseNavigate = function Sys$_Application$_raiseNavigate() {
|
|
var h = this.get_events().getHandler("navigate");
|
|
var stateClone = {};
|
|
for (var key in this._state) {
|
|
if (key !== '__s') {
|
|
stateClone[key] = this._state[key];
|
|
}
|
|
}
|
|
var args = new Sys.HistoryEventArgs(stateClone);
|
|
if (h) {
|
|
h(this, args);
|
|
}
|
|
var err;
|
|
try {
|
|
if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash &&
|
|
(!window.frameElement || window.top.location.hash)) {
|
|
window.history.go(0);
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
};
|
|
Sys._Application.prototype._serializeState = function Sys$_Application$_serializeState(state) {
|
|
var serialized = [];
|
|
for (var key in state) {
|
|
var value = state[key];
|
|
if (key === '__s') {
|
|
var serverState = value;
|
|
}
|
|
else {
|
|
if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid);
|
|
serialized[serialized.length] = key + '=' + encodeURIComponent(value);
|
|
}
|
|
}
|
|
return serialized.join('&') + (serverState ? '&&' + serverState : '');
|
|
};
|
|
Sys._Application.prototype._setState = function Sys$_Application$_setState(entry, title) {
|
|
if (this._enableHistory) {
|
|
entry = entry || '';
|
|
if (entry !== this._currentEntry) {
|
|
if (window.theForm) {
|
|
var action = window.theForm.action;
|
|
var hashIndex = action.indexOf('#');
|
|
window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry;
|
|
}
|
|
|
|
if (this._historyFrame && this._historyPointIsNew) {
|
|
this._ignoreIFrame = true;
|
|
var frameDoc = this._historyFrame.contentWindow.document;
|
|
frameDoc.open("javascript:'<html></html>'");
|
|
frameDoc.write("<html><head><title>" + (title || document.title) +
|
|
"</title><scri" + "pt type=\"text/javascript\">parent.Sys.Application._onIFrameLoad(" +
|
|
Sys.Serialization.JavaScriptSerializer.serialize(entry) +
|
|
");</scri" + "pt></head><body></body></html>");
|
|
frameDoc.close();
|
|
}
|
|
this._ignoreTimer = false;
|
|
this._currentEntry = entry;
|
|
if (this._historyFrame || this._historyPointIsNew) {
|
|
var currentHash = this.get_stateString();
|
|
if (entry !== currentHash) {
|
|
var loc = document.location;
|
|
if (loc.href.length - loc.hash.length + entry.length > 1024) {
|
|
throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars);
|
|
}
|
|
window.location.hash = entry;
|
|
this._currentEntry = this.get_stateString();
|
|
if ((typeof(title) !== 'undefined') && (title !== null)) {
|
|
document.title = title;
|
|
}
|
|
}
|
|
}
|
|
this._historyPointIsNew = false;
|
|
}
|
|
}
|
|
};
|
|
Sys._Application.prototype._updateHiddenField = function Sys$_Application$_updateHiddenField(value) {
|
|
if (this._clientId) {
|
|
var serverStateField = document.getElementById(this._clientId);
|
|
if (serverStateField) {
|
|
serverStateField.value = value;
|
|
}
|
|
}
|
|
};
|
|
|
|
if (!window.XMLHttpRequest) {
|
|
window.XMLHttpRequest = function window$XMLHttpRequest() {
|
|
var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
|
|
for (var i = 0, l = progIDs.length; i < l; i++) {
|
|
try {
|
|
return new ActiveXObject(progIDs[i]);
|
|
}
|
|
catch (ex) {
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
Type.registerNamespace('Sys.Net');
|
|
|
|
Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._webRequest = null;
|
|
this._resultObject = null;
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_webRequest() {
|
|
/// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.WebRequestExecutor.webRequest"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._webRequest;
|
|
}
|
|
function Sys$Net$WebRequestExecutor$_set_webRequest(value) {
|
|
if (this.get_started()) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
|
|
}
|
|
this._webRequest = value;
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_started() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.started"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_responseAvailable() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.responseAvailable"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_timedOut() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.timedOut"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_aborted() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.aborted"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_responseData() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.responseData"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_statusCode() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.WebRequestExecutor.statusCode"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_statusText() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.statusText"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_xml() {
|
|
/// <value locid="P:J#Sys.Net.WebRequestExecutor.xml"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$get_object() {
|
|
/// <value locid="P:J#Sys.Net.WebRequestExecutor.object"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._resultObject) {
|
|
this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
|
|
}
|
|
return this._resultObject;
|
|
}
|
|
function Sys$Net$WebRequestExecutor$executeRequest() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.executeRequest" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$abort() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.abort" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$getResponseHeader(header) {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.getResponseHeader" />
|
|
/// <param name="header" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "header", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
throw Error.notImplemented();
|
|
}
|
|
function Sys$Net$WebRequestExecutor$getAllResponseHeaders() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestExecutor.getAllResponseHeaders" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
throw Error.notImplemented();
|
|
}
|
|
Sys.Net.WebRequestExecutor.prototype = {
|
|
get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest,
|
|
_set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest,
|
|
get_started: Sys$Net$WebRequestExecutor$get_started,
|
|
get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable,
|
|
get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut,
|
|
get_aborted: Sys$Net$WebRequestExecutor$get_aborted,
|
|
get_responseData: Sys$Net$WebRequestExecutor$get_responseData,
|
|
get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode,
|
|
get_statusText: Sys$Net$WebRequestExecutor$get_statusText,
|
|
get_xml: Sys$Net$WebRequestExecutor$get_xml,
|
|
get_object: Sys$Net$WebRequestExecutor$get_object,
|
|
executeRequest: Sys$Net$WebRequestExecutor$executeRequest,
|
|
abort: Sys$Net$WebRequestExecutor$abort,
|
|
getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader,
|
|
getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders
|
|
}
|
|
Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor');
|
|
|
|
Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) {
|
|
/// <summary locid="M:J#Sys.Net.XMLDOM.#ctor" />
|
|
/// <param name="markup" type="String"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "markup", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!window.DOMParser) {
|
|
var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
|
|
for (var i = 0, l = progIDs.length; i < l; i++) {
|
|
try {
|
|
var xmlDOM = new ActiveXObject(progIDs[i]);
|
|
xmlDOM.async = false;
|
|
xmlDOM.loadXML(markup);
|
|
xmlDOM.setProperty('SelectionLanguage', 'XPath');
|
|
return xmlDOM;
|
|
}
|
|
catch (ex) {
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
try {
|
|
var domParser = new window.DOMParser();
|
|
return domParser.parseFromString(markup, 'text/xml');
|
|
}
|
|
catch (ex) {
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
|
|
/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
Sys.Net.XMLHttpExecutor.initializeBase(this);
|
|
var _this = this;
|
|
this._xmlHttpRequest = null;
|
|
this._webRequest = null;
|
|
this._responseAvailable = false;
|
|
this._timedOut = false;
|
|
this._timer = null;
|
|
this._aborted = false;
|
|
this._started = false;
|
|
this._onReadyStateChange = (function () {
|
|
|
|
if (_this._xmlHttpRequest.readyState === 4 ) {
|
|
try {
|
|
if (typeof(_this._xmlHttpRequest.status) === "undefined") {
|
|
return;
|
|
}
|
|
}
|
|
catch(ex) {
|
|
return;
|
|
}
|
|
|
|
_this._clearTimer();
|
|
_this._responseAvailable = true;
|
|
_this._webRequest.completed(Sys.EventArgs.Empty);
|
|
if (_this._xmlHttpRequest != null) {
|
|
_this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
|
|
_this._xmlHttpRequest = null;
|
|
}
|
|
}
|
|
});
|
|
this._clearTimer = (function() {
|
|
if (_this._timer != null) {
|
|
window.clearTimeout(_this._timer);
|
|
_this._timer = null;
|
|
}
|
|
});
|
|
this._onTimeout = (function() {
|
|
if (!_this._responseAvailable) {
|
|
_this._clearTimer();
|
|
_this._timedOut = true;
|
|
_this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
|
|
_this._xmlHttpRequest.abort();
|
|
_this._webRequest.completed(Sys.EventArgs.Empty);
|
|
_this._xmlHttpRequest = null;
|
|
}
|
|
});
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_timedOut() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.timedOut"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._timedOut;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_started() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.started"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._started;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_responseAvailable() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.responseAvailable"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._responseAvailable;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_aborted() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.aborted"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._aborted;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$executeRequest() {
|
|
/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.executeRequest" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._webRequest = this.get_webRequest();
|
|
if (this._started) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
|
|
}
|
|
if (this._webRequest === null) {
|
|
throw Error.invalidOperation(Sys.Res.nullWebRequest);
|
|
}
|
|
var body = this._webRequest.get_body();
|
|
var headers = this._webRequest.get_headers();
|
|
this._xmlHttpRequest = new XMLHttpRequest();
|
|
this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange;
|
|
var verb = this._webRequest.get_httpVerb();
|
|
this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true );
|
|
this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
if (headers) {
|
|
for (var header in headers) {
|
|
var val = headers[header];
|
|
if (typeof(val) !== "function")
|
|
this._xmlHttpRequest.setRequestHeader(header, val);
|
|
}
|
|
}
|
|
if (verb.toLowerCase() === "post") {
|
|
if ((headers === null) || !headers['Content-Type']) {
|
|
this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
|
|
}
|
|
if (!body) {
|
|
body = "";
|
|
}
|
|
}
|
|
var timeout = this._webRequest.get_timeout();
|
|
if (timeout > 0) {
|
|
this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
|
|
}
|
|
this._xmlHttpRequest.send(body);
|
|
this._started = true;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$getResponseHeader(header) {
|
|
/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getResponseHeader" />
|
|
/// <param name="header" type="String"></param>
|
|
/// <returns type="String"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "header", type: String}
|
|
]);
|
|
if (e) throw e;
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader'));
|
|
}
|
|
var result;
|
|
try {
|
|
result = this._xmlHttpRequest.getResponseHeader(header);
|
|
} catch (e) {
|
|
}
|
|
if (!result) result = "";
|
|
return result;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() {
|
|
/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getAllResponseHeaders" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders'));
|
|
}
|
|
return this._xmlHttpRequest.getAllResponseHeaders();
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_responseData() {
|
|
/// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.responseData"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
|
|
}
|
|
return this._xmlHttpRequest.responseText;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_statusCode() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.XMLHttpExecutor.statusCode"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode'));
|
|
}
|
|
var result = 0;
|
|
try {
|
|
result = this._xmlHttpRequest.status;
|
|
}
|
|
catch(ex) {
|
|
}
|
|
return result;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_statusText() {
|
|
/// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.statusText"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText'));
|
|
}
|
|
return this._xmlHttpRequest.statusText;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$get_xml() {
|
|
/// <value locid="P:J#Sys.Net.XMLHttpExecutor.xml"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._responseAvailable) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
|
|
}
|
|
if (!this._xmlHttpRequest) {
|
|
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
|
|
}
|
|
var xml = this._xmlHttpRequest.responseXML;
|
|
if (!xml || !xml.documentElement) {
|
|
xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);
|
|
if (!xml || !xml.documentElement)
|
|
return null;
|
|
}
|
|
else if (navigator.userAgent.indexOf('MSIE') !== -1) {
|
|
xml.setProperty('SelectionLanguage', 'XPath');
|
|
}
|
|
if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
|
|
xml.documentElement.tagName === "parsererror") {
|
|
return null;
|
|
}
|
|
|
|
if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") {
|
|
return null;
|
|
}
|
|
|
|
return xml;
|
|
}
|
|
function Sys$Net$XMLHttpExecutor$abort() {
|
|
/// <summary locid="M:J#Sys.Net.XMLHttpExecutor.abort" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (!this._started) {
|
|
throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
|
|
}
|
|
if (this._aborted || this._responseAvailable || this._timedOut)
|
|
return;
|
|
this._aborted = true;
|
|
this._clearTimer();
|
|
if (this._xmlHttpRequest && !this._responseAvailable) {
|
|
this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
|
|
this._xmlHttpRequest.abort();
|
|
|
|
this._xmlHttpRequest = null;
|
|
this._webRequest.completed(Sys.EventArgs.Empty);
|
|
}
|
|
}
|
|
Sys.Net.XMLHttpExecutor.prototype = {
|
|
get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut,
|
|
get_started: Sys$Net$XMLHttpExecutor$get_started,
|
|
get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable,
|
|
get_aborted: Sys$Net$XMLHttpExecutor$get_aborted,
|
|
executeRequest: Sys$Net$XMLHttpExecutor$executeRequest,
|
|
getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader,
|
|
getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders,
|
|
get_responseData: Sys$Net$XMLHttpExecutor$get_responseData,
|
|
get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode,
|
|
get_statusText: Sys$Net$XMLHttpExecutor$get_statusText,
|
|
get_xml: Sys$Net$XMLHttpExecutor$get_xml,
|
|
abort: Sys$Net$XMLHttpExecutor$abort
|
|
}
|
|
Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
|
|
|
|
Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() {
|
|
/// <summary locid="P:J#Sys.Net.WebRequestManager.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._defaultTimeout = 0;
|
|
this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
|
|
}
|
|
function Sys$Net$_WebRequestManager$add_invokingRequest(handler) {
|
|
/// <summary locid="E:J#Sys.Net.WebRequestManager.invokingRequest" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().addHandler("invokingRequest", handler);
|
|
}
|
|
function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().removeHandler("invokingRequest", handler);
|
|
}
|
|
function Sys$Net$_WebRequestManager$add_completedRequest(handler) {
|
|
/// <summary locid="E:J#Sys.Net.WebRequestManager.completedRequest" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().addHandler("completedRequest", handler);
|
|
}
|
|
function Sys$Net$_WebRequestManager$remove_completedRequest(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().removeHandler("completedRequest", handler);
|
|
}
|
|
function Sys$Net$_WebRequestManager$_get_eventHandlerList() {
|
|
if (!this._events) {
|
|
this._events = new Sys.EventHandlerList();
|
|
}
|
|
return this._events;
|
|
}
|
|
function Sys$Net$_WebRequestManager$get_defaultTimeout() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.WebRequestManager.defaultTimeout"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._defaultTimeout;
|
|
}
|
|
function Sys$Net$_WebRequestManager$set_defaultTimeout(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
|
|
if (e) throw e;
|
|
if (value < 0) {
|
|
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
|
|
}
|
|
this._defaultTimeout = value;
|
|
}
|
|
function Sys$Net$_WebRequestManager$get_defaultExecutorType() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebRequestManager.defaultExecutorType"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._defaultExecutorType;
|
|
}
|
|
function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
this._defaultExecutorType = value;
|
|
}
|
|
function Sys$Net$_WebRequestManager$executeRequest(webRequest) {
|
|
/// <summary locid="M:J#Sys.Net.WebRequestManager.executeRequest" />
|
|
/// <param name="webRequest" type="Sys.Net.WebRequest"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "webRequest", type: Sys.Net.WebRequest}
|
|
]);
|
|
if (e) throw e;
|
|
var executor = webRequest.get_executor();
|
|
if (!executor) {
|
|
var failed = false;
|
|
try {
|
|
var executorType = eval(this._defaultExecutorType);
|
|
executor = new executorType();
|
|
} catch (e) {
|
|
failed = true;
|
|
}
|
|
if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) {
|
|
throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
|
|
}
|
|
webRequest.set_executor(executor);
|
|
}
|
|
if (executor.get_aborted()) {
|
|
return;
|
|
}
|
|
var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
|
|
var handler = this._get_eventHandlerList().getHandler("invokingRequest");
|
|
if (handler) {
|
|
handler(this, evArgs);
|
|
}
|
|
if (!evArgs.get_cancel()) {
|
|
executor.executeRequest();
|
|
}
|
|
}
|
|
Sys.Net._WebRequestManager.prototype = {
|
|
add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest,
|
|
remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest,
|
|
add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest,
|
|
remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest,
|
|
_get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList,
|
|
get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout,
|
|
set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout,
|
|
get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType,
|
|
set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType,
|
|
executeRequest: Sys$Net$_WebRequestManager$executeRequest
|
|
}
|
|
Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager');
|
|
Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
|
|
|
|
Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) {
|
|
/// <summary locid="M:J#Sys.Net.NetworkRequestEventArgs.#ctor" />
|
|
/// <param name="webRequest" type="Sys.Net.WebRequest"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "webRequest", type: Sys.Net.WebRequest}
|
|
]);
|
|
if (e) throw e;
|
|
Sys.Net.NetworkRequestEventArgs.initializeBase(this);
|
|
this._webRequest = webRequest;
|
|
}
|
|
function Sys$Net$NetworkRequestEventArgs$get_webRequest() {
|
|
/// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.NetworkRequestEventArgs.webRequest"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._webRequest;
|
|
}
|
|
Sys.Net.NetworkRequestEventArgs.prototype = {
|
|
get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest
|
|
}
|
|
Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
|
|
|
|
Sys.Net.WebRequest = function Sys$Net$WebRequest() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequest.#ctor" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._url = "";
|
|
this._headers = { };
|
|
this._body = null;
|
|
this._userContext = null;
|
|
this._httpVerb = null;
|
|
this._executor = null;
|
|
this._invokeCalled = false;
|
|
this._timeout = 0;
|
|
}
|
|
function Sys$Net$WebRequest$add_completed(handler) {
|
|
/// <summary locid="E:J#Sys.Net.WebRequest.completed" />
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().addHandler("completed", handler);
|
|
}
|
|
function Sys$Net$WebRequest$remove_completed(handler) {
|
|
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
|
|
if (e) throw e;
|
|
this._get_eventHandlerList().removeHandler("completed", handler);
|
|
}
|
|
function Sys$Net$WebRequest$completed(eventArgs) {
|
|
/// <summary locid="M:J#Sys.Net.WebRequest.completed" />
|
|
/// <param name="eventArgs" type="Sys.EventArgs"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "eventArgs", type: Sys.EventArgs}
|
|
]);
|
|
if (e) throw e;
|
|
var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");
|
|
if (handler) {
|
|
handler(this._executor, eventArgs);
|
|
}
|
|
handler = this._get_eventHandlerList().getHandler("completed");
|
|
if (handler) {
|
|
handler(this._executor, eventArgs);
|
|
}
|
|
}
|
|
function Sys$Net$WebRequest$_get_eventHandlerList() {
|
|
if (!this._events) {
|
|
this._events = new Sys.EventHandlerList();
|
|
}
|
|
return this._events;
|
|
}
|
|
function Sys$Net$WebRequest$get_url() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebRequest.url"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._url;
|
|
}
|
|
function Sys$Net$WebRequest$set_url(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
this._url = value;
|
|
}
|
|
function Sys$Net$WebRequest$get_headers() {
|
|
/// <value locid="P:J#Sys.Net.WebRequest.headers"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._headers;
|
|
}
|
|
function Sys$Net$WebRequest$get_httpVerb() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebRequest.httpVerb"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._httpVerb === null) {
|
|
if (this._body === null) {
|
|
return "GET";
|
|
}
|
|
return "POST";
|
|
}
|
|
return this._httpVerb;
|
|
}
|
|
function Sys$Net$WebRequest$set_httpVerb(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
if (value.length === 0) {
|
|
throw Error.argument('value', Sys.Res.invalidHttpVerb);
|
|
}
|
|
this._httpVerb = value;
|
|
}
|
|
function Sys$Net$WebRequest$get_body() {
|
|
/// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.body"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._body;
|
|
}
|
|
function Sys$Net$WebRequest$set_body(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
|
|
if (e) throw e;
|
|
this._body = value;
|
|
}
|
|
function Sys$Net$WebRequest$get_userContext() {
|
|
/// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.userContext"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._userContext;
|
|
}
|
|
function Sys$Net$WebRequest$set_userContext(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
|
|
if (e) throw e;
|
|
this._userContext = value;
|
|
}
|
|
function Sys$Net$WebRequest$get_executor() {
|
|
/// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.Net.WebRequest.executor"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._executor;
|
|
}
|
|
function Sys$Net$WebRequest$set_executor(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
|
|
if (e) throw e;
|
|
if (this._executor !== null && this._executor.get_started()) {
|
|
throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
|
|
}
|
|
this._executor = value;
|
|
this._executor._set_webRequest(this);
|
|
}
|
|
function Sys$Net$WebRequest$get_timeout() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.WebRequest.timeout"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._timeout === 0) {
|
|
return Sys.Net.WebRequestManager.get_defaultTimeout();
|
|
}
|
|
return this._timeout;
|
|
}
|
|
function Sys$Net$WebRequest$set_timeout(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
|
|
if (e) throw e;
|
|
if (value < 0) {
|
|
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
|
|
}
|
|
this._timeout = value;
|
|
}
|
|
function Sys$Net$WebRequest$getResolvedUrl() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequest.getResolvedUrl" />
|
|
/// <returns type="String"></returns>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return Sys.Net.WebRequest._resolveUrl(this._url);
|
|
}
|
|
function Sys$Net$WebRequest$invoke() {
|
|
/// <summary locid="M:J#Sys.Net.WebRequest.invoke" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
if (this._invokeCalled) {
|
|
throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
|
|
}
|
|
Sys.Net.WebRequestManager.executeRequest(this);
|
|
this._invokeCalled = true;
|
|
}
|
|
Sys.Net.WebRequest.prototype = {
|
|
add_completed: Sys$Net$WebRequest$add_completed,
|
|
remove_completed: Sys$Net$WebRequest$remove_completed,
|
|
completed: Sys$Net$WebRequest$completed,
|
|
_get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList,
|
|
get_url: Sys$Net$WebRequest$get_url,
|
|
set_url: Sys$Net$WebRequest$set_url,
|
|
get_headers: Sys$Net$WebRequest$get_headers,
|
|
get_httpVerb: Sys$Net$WebRequest$get_httpVerb,
|
|
set_httpVerb: Sys$Net$WebRequest$set_httpVerb,
|
|
get_body: Sys$Net$WebRequest$get_body,
|
|
set_body: Sys$Net$WebRequest$set_body,
|
|
get_userContext: Sys$Net$WebRequest$get_userContext,
|
|
set_userContext: Sys$Net$WebRequest$set_userContext,
|
|
get_executor: Sys$Net$WebRequest$get_executor,
|
|
set_executor: Sys$Net$WebRequest$set_executor,
|
|
get_timeout: Sys$Net$WebRequest$get_timeout,
|
|
set_timeout: Sys$Net$WebRequest$set_timeout,
|
|
getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl,
|
|
invoke: Sys$Net$WebRequest$invoke
|
|
}
|
|
Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) {
|
|
if (url && url.indexOf('://') !== -1) {
|
|
return url;
|
|
}
|
|
if (!baseUrl || baseUrl.length === 0) {
|
|
var baseElement = document.getElementsByTagName('base')[0];
|
|
if (baseElement && baseElement.href && baseElement.href.length > 0) {
|
|
baseUrl = baseElement.href;
|
|
}
|
|
else {
|
|
baseUrl = document.URL;
|
|
}
|
|
}
|
|
var qsStart = baseUrl.indexOf('?');
|
|
if (qsStart !== -1) {
|
|
baseUrl = baseUrl.substr(0, qsStart);
|
|
}
|
|
qsStart = baseUrl.indexOf('#');
|
|
if (qsStart !== -1) {
|
|
baseUrl = baseUrl.substr(0, qsStart);
|
|
}
|
|
baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);
|
|
if (!url || url.length === 0) {
|
|
return baseUrl;
|
|
}
|
|
if (url.charAt(0) === '/') {
|
|
var slashslash = baseUrl.indexOf('://');
|
|
if (slashslash === -1) {
|
|
throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
|
|
}
|
|
var nextSlash = baseUrl.indexOf('/', slashslash + 3);
|
|
if (nextSlash === -1) {
|
|
throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
|
|
}
|
|
return baseUrl.substr(0, nextSlash) + url;
|
|
}
|
|
else {
|
|
var lastSlash = baseUrl.lastIndexOf('/');
|
|
if (lastSlash === -1) {
|
|
throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
|
|
}
|
|
return baseUrl.substr(0, lastSlash+1) + url;
|
|
}
|
|
}
|
|
Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod, addParams) {
|
|
encodeMethod = encodeMethod || encodeURIComponent;
|
|
var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
|
|
if (queryString) {
|
|
for (arg in queryString) {
|
|
obj = queryString[arg];
|
|
if (typeof(obj) === "function") continue;
|
|
val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
|
|
if (i++) {
|
|
sb.append('&');
|
|
}
|
|
sb.append(arg);
|
|
sb.append('=');
|
|
sb.append(encodeMethod(val));
|
|
}
|
|
}
|
|
if (addParams) {
|
|
if (i) {
|
|
sb.append('&');
|
|
}
|
|
sb.append(addParams);
|
|
}
|
|
return sb.toString();
|
|
}
|
|
Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString, addParams) {
|
|
if (!queryString && !addParams) {
|
|
return url;
|
|
}
|
|
var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
|
|
return qs.length
|
|
? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
|
|
: url;
|
|
}
|
|
Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest');
|
|
|
|
Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) {
|
|
/// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor" />
|
|
/// <param name="scriptElement" domElement="true"></param>
|
|
/// <param name="completedCallback" type="Function"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "scriptElement", domElement: true},
|
|
{name: "completedCallback", type: Function}
|
|
]);
|
|
if (e) throw e;
|
|
this._scriptElement = scriptElement;
|
|
this._completedCallback = completedCallback;
|
|
}
|
|
function Sys$_ScriptLoaderTask$get_scriptElement() {
|
|
/// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._scriptElement;
|
|
}
|
|
function Sys$_ScriptLoaderTask$dispose() {
|
|
if(this._disposed) {
|
|
return;
|
|
}
|
|
this._disposed = true;
|
|
this._removeScriptElementHandlers();
|
|
Sys._ScriptLoaderTask._clearScript(this._scriptElement);
|
|
this._scriptElement = null;
|
|
}
|
|
function Sys$_ScriptLoaderTask$execute() {
|
|
/// <summary locid="M:J#Sys._ScriptLoaderTask.execute" />
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
this._addScriptElementHandlers();
|
|
var headElements = document.getElementsByTagName('head');
|
|
if (headElements.length === 0) {
|
|
throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
|
|
}
|
|
else {
|
|
headElements[0].appendChild(this._scriptElement);
|
|
}
|
|
}
|
|
function Sys$_ScriptLoaderTask$_addScriptElementHandlers() {
|
|
this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
|
|
|
|
if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
|
|
this._scriptElement.readyState = 'loaded';
|
|
$addHandler(this._scriptElement, 'load', this._scriptLoadDelegate);
|
|
}
|
|
else {
|
|
$addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate);
|
|
}
|
|
if (this._scriptElement.addEventListener) {
|
|
this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler);
|
|
this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false);
|
|
}
|
|
}
|
|
function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() {
|
|
if(this._scriptLoadDelegate) {
|
|
var scriptElement = this.get_scriptElement();
|
|
if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
|
|
$removeHandler(scriptElement, 'load', this._scriptLoadDelegate);
|
|
}
|
|
else {
|
|
$removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate);
|
|
}
|
|
if (this._scriptErrorDelegate) {
|
|
this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false);
|
|
this._scriptErrorDelegate = null;
|
|
}
|
|
this._scriptLoadDelegate = null;
|
|
}
|
|
}
|
|
function Sys$_ScriptLoaderTask$_scriptErrorHandler() {
|
|
if(this._disposed) {
|
|
return;
|
|
}
|
|
|
|
this._completedCallback(this.get_scriptElement(), false);
|
|
}
|
|
function Sys$_ScriptLoaderTask$_scriptLoadHandler() {
|
|
if(this._disposed) {
|
|
return;
|
|
}
|
|
var scriptElement = this.get_scriptElement();
|
|
if ((scriptElement.readyState !== 'loaded') &&
|
|
(scriptElement.readyState !== 'complete')) {
|
|
return;
|
|
}
|
|
|
|
this._completedCallback(scriptElement, true);
|
|
}
|
|
Sys._ScriptLoaderTask.prototype = {
|
|
get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement,
|
|
dispose: Sys$_ScriptLoaderTask$dispose,
|
|
execute: Sys$_ScriptLoaderTask$execute,
|
|
_addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers,
|
|
_removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers,
|
|
_scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler,
|
|
_scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler
|
|
}
|
|
Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
|
|
Sys._ScriptLoaderTask._clearScript = function Sys$_ScriptLoaderTask$_clearScript(scriptElement) {
|
|
if (!Sys.Debug.isDebug) {
|
|
scriptElement.parentNode.removeChild(scriptElement);
|
|
}
|
|
}
|
|
Type.registerNamespace('Sys.Net');
|
|
|
|
Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() {
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_timeout() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.WebServiceProxy.timeout"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._timeout || 0;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_timeout(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
|
|
if (e) throw e;
|
|
if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
|
|
this._timeout = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_defaultUserContext() {
|
|
/// <value mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultUserContext"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return (typeof(this._userContext) === "undefined") ? null : this._userContext;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_defaultUserContext(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
|
|
if (e) throw e;
|
|
this._userContext = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() {
|
|
/// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultSucceededCallback"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._succeeded || null;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
|
|
if (e) throw e;
|
|
this._succeeded = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_defaultFailedCallback() {
|
|
/// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultFailedCallback"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._failed || null;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
|
|
if (e) throw e;
|
|
this._failed = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_enableJsonp() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebServiceProxy.enableJsonp"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return !!this._jsonp;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_enableJsonp(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
|
|
if (e) throw e;
|
|
this._jsonp = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_path() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.path"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._path || null;
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_path(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
this._path = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$get_jsonpCallbackParameter() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.jsonpCallbackParameter"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._callbackParameter || "callback";
|
|
}
|
|
function Sys$Net$WebServiceProxy$set_jsonpCallbackParameter(value) {
|
|
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
|
|
if (e) throw e;
|
|
this._callbackParameter = value;
|
|
}
|
|
function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) {
|
|
/// <summary locid="M:J#Sys.Net.WebServiceProxy._invoke" />
|
|
/// <param name="servicePath" type="String"></param>
|
|
/// <param name="methodName" type="String"></param>
|
|
/// <param name="useGet" type="Boolean"></param>
|
|
/// <param name="params"></param>
|
|
/// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
|
|
/// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
|
|
/// <param name="userContext" mayBeNull="true" optional="true"></param>
|
|
/// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "servicePath", type: String},
|
|
{name: "methodName", type: String},
|
|
{name: "useGet", type: Boolean},
|
|
{name: "params"},
|
|
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
|
|
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
|
|
{name: "userContext", mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
onSuccess = onSuccess || this.get_defaultSucceededCallback();
|
|
onFailure = onFailure || this.get_defaultFailedCallback();
|
|
if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext();
|
|
return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter());
|
|
}
|
|
Sys.Net.WebServiceProxy.prototype = {
|
|
get_timeout: Sys$Net$WebServiceProxy$get_timeout,
|
|
set_timeout: Sys$Net$WebServiceProxy$set_timeout,
|
|
get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext,
|
|
set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext,
|
|
get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback,
|
|
set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback,
|
|
get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback,
|
|
set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback,
|
|
get_enableJsonp: Sys$Net$WebServiceProxy$get_enableJsonp,
|
|
set_enableJsonp: Sys$Net$WebServiceProxy$set_enableJsonp,
|
|
get_path: Sys$Net$WebServiceProxy$get_path,
|
|
set_path: Sys$Net$WebServiceProxy$set_path,
|
|
get_jsonpCallbackParameter: Sys$Net$WebServiceProxy$get_jsonpCallbackParameter,
|
|
set_jsonpCallbackParameter: Sys$Net$WebServiceProxy$set_jsonpCallbackParameter,
|
|
_invoke: Sys$Net$WebServiceProxy$_invoke
|
|
}
|
|
Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy');
|
|
Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) {
|
|
/// <summary locid="M:J#Sys.Net.WebServiceProxy.invoke" />
|
|
/// <param name="servicePath" type="String"></param>
|
|
/// <param name="methodName" type="String" mayBeNull="true" optional="true"></param>
|
|
/// <param name="useGet" type="Boolean" optional="true"></param>
|
|
/// <param name="params" mayBeNull="true" optional="true"></param>
|
|
/// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
|
|
/// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
|
|
/// <param name="userContext" mayBeNull="true" optional="true"></param>
|
|
/// <param name="timeout" type="Number" optional="true"></param>
|
|
/// <param name="enableJsonp" type="Boolean" optional="true" mayBeNull="true"></param>
|
|
/// <param name="jsonpCallbackParameter" type="String" optional="true" mayBeNull="true"></param>
|
|
/// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "servicePath", type: String},
|
|
{name: "methodName", type: String, mayBeNull: true, optional: true},
|
|
{name: "useGet", type: Boolean, optional: true},
|
|
{name: "params", mayBeNull: true, optional: true},
|
|
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
|
|
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
|
|
{name: "userContext", mayBeNull: true, optional: true},
|
|
{name: "timeout", type: Number, optional: true},
|
|
{name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
|
|
{name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
|
|
tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
|
|
((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host));
|
|
useGet = jsonp || useGet;
|
|
if (jsonp) {
|
|
jsonpCallbackParameter = jsonpCallbackParameter || "callback";
|
|
tempCallback = "_jsonp" + Sys._jsonp++;
|
|
}
|
|
if (!params) params = {};
|
|
var urlParams = params;
|
|
if (!useGet || !urlParams) urlParams = {};
|
|
var script, error, timeoutcookie = null, loader, body = null,
|
|
url = Sys.Net.WebRequest._createUrl(methodName
|
|
? (servicePath+"/"+encodeURIComponent(methodName))
|
|
: servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null);
|
|
if (jsonp) {
|
|
script = document.createElement("script");
|
|
script.src = url;
|
|
loader = new Sys._ScriptLoaderTask(script, function(script, loaded) {
|
|
if (!loaded || tempCallback) {
|
|
jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
|
|
}
|
|
});
|
|
function jsonpComplete(data, statusCode) {
|
|
if (timeoutcookie !== null) {
|
|
window.clearTimeout(timeoutcookie);
|
|
timeoutcookie = null;
|
|
}
|
|
loader.dispose();
|
|
delete Sys[tempCallback];
|
|
tempCallback = null;
|
|
if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
|
|
if (onFailure) {
|
|
error = new Sys.Net.WebServiceError(false,
|
|
data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName),
|
|
data.StackTrace || null,
|
|
data.ExceptionType || null,
|
|
data);
|
|
error._statusCode = statusCode;
|
|
onFailure(error, userContext, methodName);
|
|
}
|
|
else {
|
|
if (data.StackTrace && data.Message) {
|
|
error = data.StackTrace + "-- " + data.Message;
|
|
}
|
|
else {
|
|
error = data.StackTrace || data.Message;
|
|
}
|
|
error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error);
|
|
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
|
|
}
|
|
}
|
|
else if (onSuccess) {
|
|
onSuccess(data, userContext, methodName);
|
|
}
|
|
}
|
|
Sys[tempCallback] = jsonpComplete;
|
|
loader.execute();
|
|
return null;
|
|
}
|
|
var request = new Sys.Net.WebRequest();
|
|
request.set_url(url);
|
|
request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
|
|
if (!useGet) {
|
|
body = Sys.Serialization.JavaScriptSerializer.serialize(params);
|
|
if (body === "{}") body = "";
|
|
}
|
|
request.set_body(body);
|
|
request.add_completed(onComplete);
|
|
if (timeout && timeout > 0) request.set_timeout(timeout);
|
|
request.invoke();
|
|
|
|
function onComplete(response, eventArgs) {
|
|
if (response.get_responseAvailable()) {
|
|
var statusCode = response.get_statusCode();
|
|
var result = null;
|
|
|
|
try {
|
|
var contentType = response.getResponseHeader("Content-Type");
|
|
if (contentType.startsWith("application/json")) {
|
|
result = response.get_object();
|
|
}
|
|
else if (contentType.startsWith("text/xml")) {
|
|
result = response.get_xml();
|
|
}
|
|
else {
|
|
result = response.get_responseData();
|
|
}
|
|
} catch (ex) {
|
|
}
|
|
var error = response.getResponseHeader("jsonerror");
|
|
var errorObj = (error === "true");
|
|
if (errorObj) {
|
|
if (result) {
|
|
result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result);
|
|
}
|
|
}
|
|
else if (contentType.startsWith("application/json")) {
|
|
result = (!result || (typeof(result.d) === "undefined")) ? result : result.d;
|
|
}
|
|
if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
|
|
if (onFailure) {
|
|
if (!result || !errorObj) {
|
|
result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName));
|
|
}
|
|
result._statusCode = statusCode;
|
|
onFailure(result, userContext, methodName);
|
|
}
|
|
else {
|
|
if (result && errorObj) {
|
|
error = result.get_exceptionType() + "-- " + result.get_message();
|
|
}
|
|
else {
|
|
error = response.get_responseData();
|
|
}
|
|
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
|
|
}
|
|
}
|
|
else if (onSuccess) {
|
|
onSuccess(result, userContext, methodName);
|
|
}
|
|
}
|
|
else {
|
|
var msg;
|
|
if (response.get_timedOut()) {
|
|
msg = String.format(Sys.Res.webServiceTimedOut, methodName);
|
|
}
|
|
else {
|
|
msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName)
|
|
}
|
|
if (onFailure) {
|
|
onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName);
|
|
}
|
|
else {
|
|
throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
|
|
}
|
|
}
|
|
}
|
|
return request;
|
|
}
|
|
Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) {
|
|
var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
|
|
var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName });
|
|
e.popStackFrame();
|
|
return e;
|
|
}
|
|
Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) {
|
|
var error = err.get_exceptionType() + "-- " + err.get_message();
|
|
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
|
|
}
|
|
Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) {
|
|
return function(properties) {
|
|
if (properties) {
|
|
for (var name in properties) {
|
|
this[name] = properties[name];
|
|
}
|
|
}
|
|
this.__type = type;
|
|
}
|
|
}
|
|
Sys._jsonp = 0;
|
|
Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;
|
|
|
|
Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) {
|
|
/// <summary locid="M:J#Sys.Net.WebServiceError.#ctor" />
|
|
/// <param name="timedOut" type="Boolean"></param>
|
|
/// <param name="message" type="String" mayBeNull="true"></param>
|
|
/// <param name="stackTrace" type="String" mayBeNull="true" optional="true"></param>
|
|
/// <param name="exceptionType" type="String" mayBeNull="true" optional="true"></param>
|
|
/// <param name="errorObject" type="Object" mayBeNull="true" optional="true"></param>
|
|
var e = Function._validateParams(arguments, [
|
|
{name: "timedOut", type: Boolean},
|
|
{name: "message", type: String, mayBeNull: true},
|
|
{name: "stackTrace", type: String, mayBeNull: true, optional: true},
|
|
{name: "exceptionType", type: String, mayBeNull: true, optional: true},
|
|
{name: "errorObject", type: Object, mayBeNull: true, optional: true}
|
|
]);
|
|
if (e) throw e;
|
|
this._timedOut = timedOut;
|
|
this._message = message;
|
|
this._stackTrace = stackTrace;
|
|
this._exceptionType = exceptionType;
|
|
this._errorObject = errorObject;
|
|
this._statusCode = -1;
|
|
}
|
|
function Sys$Net$WebServiceError$get_timedOut() {
|
|
/// <value type="Boolean" locid="P:J#Sys.Net.WebServiceError.timedOut"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._timedOut;
|
|
}
|
|
function Sys$Net$WebServiceError$get_statusCode() {
|
|
/// <value type="Number" locid="P:J#Sys.Net.WebServiceError.statusCode"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._statusCode;
|
|
}
|
|
function Sys$Net$WebServiceError$get_message() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebServiceError.message"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._message;
|
|
}
|
|
function Sys$Net$WebServiceError$get_stackTrace() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebServiceError.stackTrace"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._stackTrace || "";
|
|
}
|
|
function Sys$Net$WebServiceError$get_exceptionType() {
|
|
/// <value type="String" locid="P:J#Sys.Net.WebServiceError.exceptionType"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._exceptionType || "";
|
|
}
|
|
function Sys$Net$WebServiceError$get_errorObject() {
|
|
/// <value type="Object" locid="P:J#Sys.Net.WebServiceError.errorObject"></value>
|
|
if (arguments.length !== 0) throw Error.parameterCount();
|
|
return this._errorObject || null;
|
|
}
|
|
Sys.Net.WebServiceError.prototype = {
|
|
get_timedOut: Sys$Net$WebServiceError$get_timedOut,
|
|
get_statusCode: Sys$Net$WebServiceError$get_statusCode,
|
|
get_message: Sys$Net$WebServiceError$get_message,
|
|
get_stackTrace: Sys$Net$WebServiceError$get_stackTrace,
|
|
get_exceptionType: Sys$Net$WebServiceError$get_exceptionType,
|
|
get_errorObject: Sys$Net$WebServiceError$get_errorObject
|
|
}
|
|
Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError');
|
|
|
|
|
|
Type.registerNamespace('Sys');
|
|
|
|
Sys.Res={
|
|
'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.',
|
|
'argumentTypeName':'Value is not the name of an existing type.',
|
|
'cantBeCalledAfterDispose':'Can\'t be called after dispose.',
|
|
'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.',
|
|
'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.',
|
|
'notATypeName':'Value is not a valid type name.',
|
|
'elementNotFound':'An element with id \'{0}\' could not be found.',
|
|
'stateMustBeStringDictionary':'The state object can only have null and string fields.',
|
|
'boolTrueOrFalse':'Value must be \'true\' or \'false\'.',
|
|
'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a <head> element.',
|
|
'stringFormatInvalid':'The format string is invalid.',
|
|
'referenceNotFound':'Component \'{0}\' was not found.',
|
|
'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.',
|
|
'circularParentChain':'The chain of control parents can\'t have circular references.',
|
|
'namespaceContainsNonObject':'Object {0} already exists and is not an object.',
|
|
'undefinedEvent':'\'{0}\' is not an event.',
|
|
'propertyUndefined':'\'{0}\' is not a property or an existing field.',
|
|
'observableConflict':'Object already contains a member with the name \'{0}\'.',
|
|
'historyCannotEnableHistory':'Cannot set enableHistory after initialization.',
|
|
'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
|
|
'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.',
|
|
'propertyNotWritable':'\'{0}\' is not a writable property.',
|
|
'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.',
|
|
'controlAlreadyDefined':'A control is already associated with the element.',
|
|
'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.',
|
|
'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.',
|
|
'invalidNameSpace':'Value is not a valid namespace identifier.',
|
|
'notAnInterface':'Value is not a valid interface.',
|
|
'eventHandlerNotFunction':'Handler must be a function.',
|
|
'propertyNotAnArray':'\'{0}\' is not an Array property.',
|
|
'namespaceContainsClass':'Object {0} already exists as a class, enum, or interface.',
|
|
'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.',
|
|
'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.',
|
|
'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.',
|
|
'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.',
|
|
'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.',
|
|
'baseNotAClass':'Value is not a class.',
|
|
'expectedElementOrId':'Value must be a DOM element or DOM element Id.',
|
|
'methodNotFound':'No method found with name \'{0}\'.',
|
|
'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.',
|
|
'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.',
|
|
'cantSetId':'The id property can\'t be set on this object.',
|
|
'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.',
|
|
'enumValueNotInteger':'An enumeration definition can only contain integer values.',
|
|
'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.',
|
|
'argumentDomNode':'Value must be a DOM element or a text node.',
|
|
'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.',
|
|
'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.',
|
|
'createNotComponent':'{0} does not derive from Sys.Component.',
|
|
'createNoDom':'Value must not be null for Controls and Behaviors.',
|
|
'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.',
|
|
'notObservable':'Instances of type \'{0}\' cannot be observed.',
|
|
'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.',
|
|
'argumentInteger':'Value must be an integer.',
|
|
'invokeCalledTwice':'Cannot call invoke more than once.',
|
|
'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}',
|
|
'argumentType':'Object cannot be converted to the required type.',
|
|
'argumentNull':'Value cannot be null.',
|
|
'scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.',
|
|
'scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.',
|
|
'formatBadFormatSpecifier':'Format specifier was invalid.',
|
|
'requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.',
|
|
'webServiceFailedNoMsg':'The server method \'{0}\' failed.',
|
|
'argumentDomElement':'Value must be a DOM element.',
|
|
'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.',
|
|
'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.',
|
|
'actualValue':'Actual value was {0}.',
|
|
'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.',
|
|
'scriptLoadFailed':'The script \'{0}\' could not be loaded.',
|
|
'parameterCount':'Parameter count mismatch.',
|
|
'cannotDeserializeEmptyString':'Cannot deserialize empty string.',
|
|
'formatInvalidString':'Input string was not in a correct format.',
|
|
'invalidTimeout':'Value must be greater than or equal to zero.',
|
|
'cannotAbortBeforeStart':'Cannot abort when executor has not started.',
|
|
'argument':'Value does not fall within the expected range.',
|
|
'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.',
|
|
'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.',
|
|
'nullWebRequest':'Cannot call executeRequest with a null webRequest.',
|
|
'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
|
|
'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.',
|
|
'argumentUndefined':'Value cannot be undefined.',
|
|
'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}',
|
|
'servicePathNotSet':'The path to the web service has not been set.',
|
|
'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.',
|
|
'cannotCallOnceStarted':'Cannot call {0} once started.',
|
|
'badBaseUrl1':'Base URL does not contain ://.',
|
|
'badBaseUrl2':'Base URL does not contain another /.',
|
|
'badBaseUrl3':'Cannot find last / in base URL.',
|
|
'setExecutorAfterActive':'Cannot set executor after it has become active.',
|
|
'paramName':'Parameter name: {0}',
|
|
'nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.',
|
|
'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.',
|
|
'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.',
|
|
'format':'One of the identified items was in an invalid format.',
|
|
'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}',
|
|
'argumentOutOfRange':'Specified argument was out of the range of valid values.',
|
|
'webServiceTimedOut':'The server method \'{0}\' timed out.',
|
|
'notImplemented':'The method or operation is not implemented.',
|
|
'assertFailed':'Assertion Failed: {0}',
|
|
'invalidOperation':'Operation is not valid due to the current state of the object.',
|
|
'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'
|
|
};
|