📄 microsoftajax.debug.js
字号:
{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 e = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
e.popStackFrame();
return e;
}
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 e = Error.create(displayMessage, {name: 'Sys.FormatException'});
e.popStackFrame();
return e;
}
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 e = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
e.popStackFrame();
return e;
}
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 e = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
e.popStackFrame();
return e;
}
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 e = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
e.popStackFrame();
return e;
}
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.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);
}
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}
]);
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;
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";
}
if (format.length === 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.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);
}
}
return format;
}
Date._expandYear = function Date$_expandYear(dtf, year) {
if (year < 100) {
var curr = new Date().getFullYear();
year += curr - (curr % 100);
if (year > dtf.Calendar.TwoDigitYearMax) {
return year - 100;
}
}
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]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -