/SampleWebSites/AjaxClientWebSite/Scripts/MicrosoftAjax/MicrosoftAjaxWebForms.debug.js
JavaScript | 1441 lines | 1207 code | 169 blank | 65 comment | 270 complexity | 6be3c7cd97ab2d5e33499da80196084c MD5 | raw file
Possible License(s): BSD-3-Clause
Large files files are truncated, but you can click here to view the full file
- // (c) 2010 CodePlex Foundation
- (function() {
-
- function execute() {
-
- Type._registerScript("MicrosoftAjaxWebForms.js", [
- "MicrosoftAjaxCore.js",
- "MicrosoftAjaxSerialization.js",
- "MicrosoftAjaxNetwork.js",
- "MicrosoftAjaxComponentModel.js"]);
- var $type, $prototype;
- Type.registerNamespace('Sys.WebForms');
-
- $type = Sys.WebForms.BeginRequestEventArgs = function BeginRequestEventArgs(request, postBackElement, updatePanelsToUpdate) {
- /// <summary locid="M:J#Sys.WebForms.BeginRequestEventArgs.#ctor">The arguments for the PageRequestManager's beginRequest event. The beginRequest event is raised when a request is about to be made.</summary>
- /// <param name="request" type="Sys.Net.WebRequest">The web request for the EventArgs.</param>
- /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param>
- /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param>
- var e = Function._validateParams(arguments, [
- {name: "request", type: Sys.Net.WebRequest},
- {name: "postBackElement", mayBeNull: true, domElement: true},
- {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String}
- ]);
- if (e) throw e;
- Sys.WebForms.BeginRequestEventArgs.initializeBase(this);
- this._request = request;
- this._postBackElement = postBackElement;
- this._updatePanelsToUpdate = updatePanelsToUpdate;
- }
-
- $type.prototype = {
- get_postBackElement: function BeginRequestEventArgs$get_postBackElement() {
- /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.BeginRequestEventArgs.postBackElement"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._postBackElement;
- },
- get_request: function BeginRequestEventArgs$get_request() {
- /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.BeginRequestEventArgs.request"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._request;
- },
- get_updatePanelsToUpdate: function BeginRequestEventArgs$get_updatePanelsToUpdate() {
- /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.BeginRequestEventArgs.updatePanelsToUpdate"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : [];
- }
- }
-
- $type.registerClass('Sys.WebForms.BeginRequestEventArgs', Sys.EventArgs);
- $type = Sys.WebForms.EndRequestEventArgs = function EndRequestEventArgs(error, dataItems, response) {
- /// <summary locid="M:J#Sys.WebForms.EndRequestEventArgs.#ctor">The arguments for the PageRequestManager's endRequest event. The endRequest event is raised when a response has finished processing.</summary>
- /// <param name="error" type="Error" mayBeNull="true"></param>
- /// <param name="dataItems" type="Object" mayBeNull="true"></param>
- /// <param name="response" type="Sys.Net.WebRequestExecutor"></param>
- var e = Function._validateParams(arguments, [
- {name: "error", type: Error, mayBeNull: true},
- {name: "dataItems", type: Object, mayBeNull: true},
- {name: "response", type: Sys.Net.WebRequestExecutor}
- ]);
- if (e) throw e;
-
- Sys.WebForms.EndRequestEventArgs.initializeBase(this);
- this._errorHandled = false;
- this._error = error;
- this._dataItems = dataItems || new Object();
- this._response = response;
- }
-
- $type.prototype = {
- get_dataItems: function EndRequestEventArgs$get_dataItems() {
- /// <value type="Object" locid="P:J#Sys.WebForms.EndRequestEventArgs.dataItems"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._dataItems;
- },
-
- get_error: function EndRequestEventArgs$get_error() {
- /// <value type="Error" locid="P:J#Sys.WebForms.EndRequestEventArgs.error"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._error;
- },
-
- get_errorHandled: function EndRequestEventArgs$get_errorHandled() {
- /// <value type="Boolean" locid="P:J#Sys.WebForms.EndRequestEventArgs.errorHandled"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._errorHandled;
- },
- set_errorHandled: function EndRequestEventArgs$set_errorHandled(value) {
- var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
- if (e) throw e;
- this._errorHandled = value;
- },
-
- get_response: function EndRequestEventArgs$get_response() {
- /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.WebForms.EndRequestEventArgs.response"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._response;
- }
- }
-
- $type.registerClass('Sys.WebForms.EndRequestEventArgs', Sys.EventArgs);
- $type = Sys.WebForms.InitializeRequestEventArgs = function InitializeRequestEventArgs(request, postBackElement, updatePanelsToUpdate) {
- /// <summary locid="M:J#Sys.WebForms.InitializeRequestEventArgs.#ctor">The arguments for the PageRequestManager's initializeRequest event. The initializeRequest event is raised when a request is being prepared and can be cancelled.</summary>
- /// <param name="request" type="Sys.Net.WebRequest">The web request to be packaged in this EventArgs.</param>
- /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param>
- /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param>
- var e = Function._validateParams(arguments, [
- {name: "request", type: Sys.Net.WebRequest},
- {name: "postBackElement", mayBeNull: true, domElement: true},
- {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String}
- ]);
- if (e) throw e;
- Sys.WebForms.InitializeRequestEventArgs.initializeBase(this);
- this._request = request;
- this._postBackElement = postBackElement;
- this._updatePanelsToUpdate = updatePanelsToUpdate;
- }
-
- $type.prototype = {
- get_postBackElement: function InitializeRequestEventArgs$get_postBackElement() {
- /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.postBackElement"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._postBackElement;
- },
- get_request: function InitializeRequestEventArgs$get_request() {
- /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.request"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._request;
- },
- get_updatePanelsToUpdate: function InitializeRequestEventArgs$get_updatePanelsToUpdate() {
- /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.updatePanelsToUpdate"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : [];
- },
- set_updatePanelsToUpdate: function InitializeRequestEventArgs$set_updatePanelsToUpdate(value) {
- var e = Function._validateParams(arguments, [{name: "value", type: Array, elementType: String}]);
- if (e) throw e;
- this._updated = true;
- this._updatePanelsToUpdate = value;
- }
- }
-
- $type.registerClass('Sys.WebForms.InitializeRequestEventArgs', Sys.CancelEventArgs);
- $type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) {
- /// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
- /// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
- /// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
- /// <param name="dataItems" type="Object" mayBeNull="true"></param>
- var e = Function._validateParams(arguments, [
- {name: "panelsUpdated", type: Array},
- {name: "panelsCreated", type: Array},
- {name: "dataItems", type: Object, mayBeNull: true}
- ]);
- if (e) throw e;
- Sys.WebForms.PageLoadedEventArgs.initializeBase(this);
-
- this._panelsUpdated = panelsUpdated;
- this._panelsCreated = panelsCreated;
- this._dataItems = dataItems || new Object();
- }
-
- $type.prototype = {
- get_dataItems: function PageLoadedEventArgs$get_dataItems() {
- /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadedEventArgs.dataItems"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._dataItems;
- },
-
- get_panelsCreated: function PageLoadedEventArgs$get_panelsCreated() {
- /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsCreated"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._panelsCreated;
- },
-
- get_panelsUpdated: function PageLoadedEventArgs$get_panelsUpdated() {
- /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsUpdated"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._panelsUpdated;
- }
- }
-
- $type.registerClass('Sys.WebForms.PageLoadedEventArgs', Sys.EventArgs);
- $type = Sys.WebForms.PageLoadingEventArgs = function PageLoadingEventArgs(panelsUpdating, panelsDeleting, dataItems) {
- /// <summary locid="M:J#Sys.WebForms.PageLoadingEventArgs.#ctor">The arguments for the PageRequestManager's pageLoading event. The pageLoading event is raised before the DOM has been updated.</summary>
- /// <param name="panelsUpdating" type="Array">An array of UpdatePanels that are going to be updated.</param>
- /// <param name="panelsDeleting" type="Array">An array of UpdatePanels that are going to be deleted.</param>
- /// <param name="dataItems" type="Object" mayBeNull="true"></param>
- var e = Function._validateParams(arguments, [
- {name: "panelsUpdating", type: Array},
- {name: "panelsDeleting", type: Array},
- {name: "dataItems", type: Object, mayBeNull: true}
- ]);
- if (e) throw e;
- Sys.WebForms.PageLoadingEventArgs.initializeBase(this);
-
- this._panelsUpdating = panelsUpdating;
- this._panelsDeleting = panelsDeleting;
- this._dataItems = dataItems || new Object();
- }
-
- $type.prototype = {
- get_dataItems: function PageLoadingEventArgs$get_dataItems() {
- /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadingEventArgs.dataItems"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._dataItems;
- },
-
- get_panelsDeleting: function PageLoadingEventArgs$get_panelsDeleting() {
- /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsDeleting"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._panelsDeleting;
- },
-
- get_panelsUpdating: function PageLoadingEventArgs$get_panelsUpdating() {
- /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsUpdating"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._panelsUpdating;
- }
- }
-
- $type.registerClass('Sys.WebForms.PageLoadingEventArgs', Sys.EventArgs);
-
- $type = Sys._ScriptLoaderTask = function _ScriptLoaderTask(scriptElement, completedCallback) {
- /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor"></summary>
- /// <param name="scriptElement" domElement="true">The script element to add to the DOM.</param>
- /// <param name="completedCallback" type="Function">Callback to call when the script has loaded or failed to load.</param>
- var e = Function._validateParams(arguments, [
- {name: "scriptElement", domElement: true},
- {name: "completedCallback", type: Function}
- ]);
- if (e) throw e;
- this._scriptElement = scriptElement;
- this._completedCallback = completedCallback;
- }
- $type.prototype = {
- get_scriptElement: function _ScriptLoaderTask$get_scriptElement() {
- /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement">The script element.</value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._scriptElement;
- },
-
- dispose: function _ScriptLoaderTask$dispose() {
- if(this._disposed) {
- return;
- }
- this._disposed = true;
- this._removeScriptElementHandlers();
- Sys._ScriptLoaderTask._clearScript(this._scriptElement);
- this._scriptElement = null;
- },
-
- execute: function _ScriptLoaderTask$execute() {
- /// <summary locid="M:J#Sys._ScriptLoaderTask.execute">Begins loading the given script element.</summary>
- 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);
- }
- },
-
- _addScriptElementHandlers: function _ScriptLoaderTask$_addScriptElementHandlers() {
- this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
-
- if (document.addEventListener) {
- 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);
- }
- },
-
- _removeScriptElementHandlers: function _ScriptLoaderTask$_removeScriptElementHandlers() {
- if(this._scriptLoadDelegate) {
- var scriptElement = this.get_scriptElement();
- if (document.addEventListener) {
- $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;
- }
- },
-
- _scriptErrorHandler: function _ScriptLoaderTask$_scriptErrorHandler() {
- if(this._disposed) {
- return;
- }
-
- this._completedCallback(this.get_scriptElement(), false);
- },
-
- _scriptLoadHandler: function _ScriptLoaderTask$_scriptLoadHandler() {
- if(this._disposed) {
- return;
- }
-
- var scriptElement = this.get_scriptElement();
- if ((scriptElement.readyState !== 'loaded') &&
- (scriptElement.readyState !== 'complete')) {
- return;
- }
-
- this._completedCallback(scriptElement, true);
- }
- }
- $type.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
-
- $type._clearScript = function _ScriptLoaderTask$_clearScript(scriptElement) {
- if (!Sys.Debug.isDebug) {
- scriptElement.parentNode.removeChild(scriptElement);
- }
- }
-
- $type = Sys._ScriptLoader = function _ScriptLoader() {
- this._scriptsToLoad = null;
- this._sessions = [];
- this._scriptLoadedDelegate = Function.createDelegate(this, this._scriptLoadedHandler);
- }
- $type.prototype = {
- dispose: function _ScriptLoader$dispose() {
- this._stopSession();
- this._loading = false;
- if(this._events) {
- delete this._events;
- }
- this._sessions = null;
- this._currentSession = null;
- this._scriptLoadedDelegate = null;
- },
-
- loadScripts: function _ScriptLoader$loadScripts(scriptTimeout, allScriptsLoadedCallback, scriptLoadFailedCallback, scriptLoadTimeoutCallback) {
- /// <summary locid="M:J#Sys._ScriptLoader.loadScripts">Begins loading scripts that have been queued.</summary>
- /// <param name="scriptTimeout" type="Number" integer="true">Timeout in seconds for loading all scripts.</param>
- /// <param name="allScriptsLoadedCallback" type="Function" mayBeNull="true">Callback for notification when all scripts have successfully loaded.</param>
- /// <param name="scriptLoadFailedCallback" type="Function" mayBeNull="true">Callback for notification when a script fails to load.</param>
- /// <param name="scriptLoadTimeoutCallback" type="Function" mayBeNull="true">Callback for notification when scripts have not finished loading within the given timeout.</param>
- var e = Function._validateParams(arguments, [
- {name: "scriptTimeout", type: Number, integer: true},
- {name: "allScriptsLoadedCallback", type: Function, mayBeNull: true},
- {name: "scriptLoadFailedCallback", type: Function, mayBeNull: true},
- {name: "scriptLoadTimeoutCallback", type: Function, mayBeNull: true}
- ]);
- if (e) throw e;
- var session = {
- allScriptsLoadedCallback: allScriptsLoadedCallback,
- scriptLoadFailedCallback: scriptLoadFailedCallback,
- scriptLoadTimeoutCallback: scriptLoadTimeoutCallback,
- scriptsToLoad: this._scriptsToLoad,
- scriptTimeout: scriptTimeout };
- this._scriptsToLoad = null;
- this._sessions.push(session);
-
- if (!this._loading) {
- this._nextSession();
- }
- },
-
- queueCustomScriptTag: function _ScriptLoader$queueCustomScriptTag(scriptAttributes) {
- /// <summary locid="M:J#Sys._ScriptLoader.queueCustomScriptTag">Queues a script reference with the given set of custom script element attributes.</summary>
- /// <param name="scriptAttributes" mayBeNull="false">A JSON object that describtes the attributes to apply to the script element.</param>
- var e = Function._validateParams(arguments, [
- {name: "scriptAttributes"}
- ]);
- if (e) throw e;
- if(!this._scriptsToLoad) {
- this._scriptsToLoad = [];
- }
- Array.add(this._scriptsToLoad, scriptAttributes);
- },
-
- queueScriptBlock: function _ScriptLoader$queueScriptBlock(scriptContent) {
- /// <summary locid="M:J#Sys._ScriptLoader.queueScriptBlock">Queues a script reference with literal script.</summary>
- /// <param name="scriptContent" type="String" mayBeNull="false">Literal script to execute.</param>
- var e = Function._validateParams(arguments, [
- {name: "scriptContent", type: String}
- ]);
- if (e) throw e;
- if(!this._scriptsToLoad) {
- this._scriptsToLoad = [];
- }
- Array.add(this._scriptsToLoad, {text: scriptContent});
- },
-
- queueScriptReference: function _ScriptLoader$queueScriptReference(scriptUrl) {
- /// <summary locid="M:J#Sys._ScriptLoader.queueScriptReference">Queues a script reference to the given script URL.</summary>
- /// <param name="scriptUrl" type="String" mayBeNull="false">URL to the script to reference.</param>
- var e = Function._validateParams(arguments, [
- {name: "scriptUrl", type: String}
- ]);
- if (e) throw e;
- if(!this._scriptsToLoad) {
- this._scriptsToLoad = [];
- }
- Array.add(this._scriptsToLoad, {src: scriptUrl});
- },
-
- _createScriptElement: function _ScriptLoader$_createScriptElement(queuedScript) {
- var scriptElement = document.createElement('script');
-
- scriptElement.type = 'text/javascript';
-
- for (var attr in queuedScript) {
- scriptElement[attr] = queuedScript[attr];
- }
-
- return scriptElement;
- },
-
- _loadScriptsInternal: function _ScriptLoader$_loadScriptsInternal() {
- var session = this._currentSession;
- if (session.scriptsToLoad && session.scriptsToLoad.length > 0) {
- var nextScript = Array.dequeue(session.scriptsToLoad);
- var scriptElement = this._createScriptElement(nextScript);
-
- if (scriptElement.text && Sys.Browser.agent === Sys.Browser.Safari) {
- scriptElement.innerHTML = scriptElement.text;
- delete scriptElement.text;
- }
-
- if (typeof(nextScript.src) === "string") {
- this._currentTask = new Sys._ScriptLoaderTask(scriptElement, this._scriptLoadedDelegate);
- this._currentTask.execute();
- }
- else {
- var headElements = document.getElementsByTagName('head');
- if (headElements.length === 0) {
- throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
- }
- else {
- headElements[0].appendChild(scriptElement);
- }
-
-
- Sys._ScriptLoaderTask._clearScript(scriptElement);
- this._loadScriptsInternal();
- }
- }
- else {
- this._stopSession();
- var callback = session.allScriptsLoadedCallback;
- if(callback) {
- callback(this);
- }
- this._nextSession();
- }
- },
-
- _nextSession: function _ScriptLoader$_nextSession() {
- if (this._sessions.length === 0) {
- this._loading = false;
- this._currentSession = null;
- return;
- }
- this._loading = true;
-
- var session = Array.dequeue(this._sessions);
- this._currentSession = session;
- this._loadScriptsInternal();
- },
-
- _raiseError: function _ScriptLoader$_raiseError() {
- var callback = this._currentSession.scriptLoadFailedCallback;
- var scriptElement = this._currentTask.get_scriptElement();
- this._stopSession();
-
- if(callback) {
- callback(this, scriptElement);
- this._nextSession();
- }
- else {
- this._loading = false;
- throw Sys._ScriptLoader._errorScriptLoadFailed(scriptElement.src);
- }
- },
-
- _scriptLoadedHandler: function _ScriptLoader$_scriptLoadedHandler(scriptElement, loaded) {
- if (loaded) {
- Array.add(Sys._ScriptLoader._getLoadedScripts(), scriptElement.src);
- this._currentTask.dispose();
- this._currentTask = null;
- this._loadScriptsInternal();
- }
- else {
- this._raiseError();
- }
- },
- _stopSession: function _ScriptLoader$_stopSession() {
- if(this._currentTask) {
- this._currentTask.dispose();
- this._currentTask = null;
- }
- }
- }
- $type.registerClass('Sys._ScriptLoader', null, Sys.IDisposable);
-
- $type.getInstance = function _ScriptLoader$getInstance() {
- var sl = Sys._ScriptLoader._activeInstance;
- if(!sl) {
- sl = Sys._ScriptLoader._activeInstance = new Sys._ScriptLoader();
- }
- return sl;
- }
-
- $type.isScriptLoaded = function _ScriptLoader$isScriptLoaded(scriptSrc) {
- var dummyScript = document.createElement('script');
- dummyScript.src = scriptSrc;
- return Array.contains(Sys._ScriptLoader._getLoadedScripts(), dummyScript.src);
- }
-
- $type.readLoadedScripts = function _ScriptLoader$readLoadedScripts() {
- if(!Sys._ScriptLoader._referencedScripts) {
- var referencedScripts = Sys._ScriptLoader._referencedScripts = [];
-
- var existingScripts = document.getElementsByTagName('script');
- for (var i = existingScripts.length - 1; i >= 0; i--) {
- var scriptNode = existingScripts[i];
- var scriptSrc = scriptNode.src;
- if (scriptSrc.length) {
- if (!Array.contains(referencedScripts, scriptSrc)) {
- Array.add(referencedScripts, scriptSrc);
- }
- }
- }
- }
- }
-
- $type._errorScriptLoadFailed = function _ScriptLoader$_errorScriptLoadFailed(scriptUrl) {
- var errorMessage;
- errorMessage = Sys.Res.scriptLoadFailedDebug;
-
- var displayMessage = "Sys.ScriptLoadFailedException: " + String.format(errorMessage, scriptUrl);
- var e = Error.create(displayMessage, {name: 'Sys.ScriptLoadFailedException', 'scriptUrl': scriptUrl });
- e.popStackFrame();
- return e;
- }
-
- $type._getLoadedScripts = function _ScriptLoader$_getLoadedScripts() {
- if(!Sys._ScriptLoader._referencedScripts) {
- Sys._ScriptLoader._referencedScripts = [];
- Sys._ScriptLoader.readLoadedScripts();
- }
- return Sys._ScriptLoader._referencedScripts;
- }
- $type = Sys.WebForms.PageRequestManager = function PageRequestManager() {
- this._form = null;
- this._activeDefaultButton = null;
- this._activeDefaultButtonClicked = false;
- this._updatePanelIDs = null;
- this._updatePanelClientIDs = null;
- this._updatePanelHasChildrenAsTriggers = null;
- this._asyncPostBackControlIDs = null;
- this._asyncPostBackControlClientIDs = null;
- this._postBackControlIDs = null;
- this._postBackControlClientIDs = null;
- this._scriptManagerID = null;
- this._pageLoadedHandler = null;
-
- this._additionalInput = null;
- this._onsubmit = null;
- this._onSubmitStatements = [];
- this._originalDoPostBack = null;
- this._originalDoPostBackWithOptions = null;
- this._originalFireDefaultButton = null;
- this._originalDoCallback = null;
- this._isCrossPost = false;
- this._postBackSettings = null;
- this._request = null;
- this._onFormSubmitHandler = null;
- this._onFormElementClickHandler = null;
- this._onWindowUnloadHandler = null;
- this._asyncPostBackTimeout = null;
-
- this._controlIDToFocus = null;
- this._scrollPosition = null;
- this._processingRequest = false;
- this._scriptDisposes = {};
-
- this._transientFields = ["__VIEWSTATEENCRYPTED", "__VIEWSTATEFIELDCOUNT"];
- }
-
- $type.prototype = {
- get_isInAsyncPostBack: function PageRequestManager$get_isInAsyncPostBack() {
- /// <value type="Boolean" locid="P:J#Sys.WebForms.PageRequestManager.isInAsyncPostBack"></value>
- if (arguments.length !== 0) throw Error.parameterCount();
- return this._request !== null;
- },
-
- add_beginRequest: function PageRequestManager$add_beginRequest(handler) {
- /// <summary locid="E:J#Sys.WebForms.PageRequestManager.beginRequest">Adds a beginRequest event handler.</summary>
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.addEventHandler(this, "beginRequest", handler);
- },
- remove_beginRequest: function PageRequestManager$remove_beginRequest(handler) {
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.removeEventHandler(this, "beginRequest", handler);
- },
-
- add_endRequest: function PageRequestManager$add_endRequest(handler) {
- /// <summary locid="E:J#Sys.WebForms.PageRequestManager.endRequest">Adds a endRequest event handler.</summary>
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.addEventHandler(this, "endRequest", handler);
- },
- remove_endRequest: function PageRequestManager$remove_endRequest(handler) {
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.removeEventHandler(this, "endRequest", handler);
- },
-
- add_initializeRequest: function PageRequestManager$add_initializeRequest(handler) {
- /// <summary locid="E:J#Sys.WebForms.PageRequestManager.initializeRequest">Adds a initializeRequest event handler.</summary>
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.addEventHandler(this, "initializeRequest", handler);
- },
- remove_initializeRequest: function PageRequestManager$remove_initializeRequest(handler) {
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.removeEventHandler(this, "initializeRequest", handler);
- },
-
- add_pageLoaded: function PageRequestManager$add_pageLoaded(handler) {
- /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoaded">Adds a pageLoaded event handler.</summary>
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.addEventHandler(this, "pageLoaded", handler);
- },
- remove_pageLoaded: function PageRequestManager$remove_pageLoaded(handler) {
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.removeEventHandler(this, "pageLoaded", handler);
- },
-
- add_pageLoading: function PageRequestManager$add_pageLoading(handler) {
- /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoading">Adds a pageLoading event handler.</summary>
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.addEventHandler(this, "pageLoading", handler);
- },
- remove_pageLoading: function PageRequestManager$remove_pageLoading(handler) {
- var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
- if (e) throw e;
- Sys.Observer.removeEventHandler(this, "pageLoading", handler);
- },
-
- abortPostBack: function PageRequestManager$abortPostBack() {
- if (!this._processingRequest && this._request) {
- this._request.get_executor().abort();
- this._request = null;
- }
- },
-
- beginAsyncPostBack: function PageRequestManager$beginAsyncPostBack(updatePanelsToUpdate, eventTarget, eventArgument, causesValidation, validationGroup) {
- /// <summary locid="M:J#Sys.WebForms.PageRequestManager.beginAsyncPostBack">Begins an asynchronous postback.</summary>
- /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs or ClientIDs of UpdatePanel controls that should have their rendering updated.</param>
- /// <param name="eventTarget" type="String" mayBeNull="true" optional="true"></param>
- /// <param name="eventArgument" type="String" mayBeNull="true" optional="true"></param>
- /// <param name="causesValidation" type="Boolean" mayBeNull="true" optional="true"></param>
- /// <param name="validationGroup" type="String" mayBeNull="true" optional="true"></param>
- var e = Function._validateParams(arguments, [
- {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String},
- {name: "eventTarget", type: String, mayBeNull: true, optional: true},
- {name: "eventArgument", type: String, mayBeNull: true, optional: true},
- {name: "causesValidation", type: Boolean, mayBeNull: true, optional: true},
- {name: "validationGroup", type: String, mayBeNull: true, optional: true}
- ]);
- if (e) throw e;
- if (causesValidation && (typeof(Page_ClientValidate) === 'function') && !Page_ClientValidate(validationGroup || null)) {
- return;
- }
- this._postBackSettings = this._createPostBackSettings(true, updatePanelsToUpdate, eventTarget);
- var form = this._form;
- form.__EVENTTARGET.value = (eventTarget || "");
- form.__EVENTARGUMENT.value = (eventArgument || "");
- this._isCrossPost = false;
- this._additionalInput = null;
- this._onFormSubmit();
- },
-
- _cancelPendingCallbacks: function PageRequestManager$_cancelPendingCallbacks() {
- for (var i = 0, l = window.__pendingCallbacks.length; i < l; i++) {
- var callback = window.__pendingCallbacks[i];
- if (callback) {
- if (!callback.async) {
- window.__synchronousCallBackIndex = -1;
- }
- window.__pendingCallbacks[i] = null;
- var callbackFrameID = "__CALLBACKFRAME" + i;
- var xmlRequestFrame = document.getElementById(callbackFrameID);
- if (xmlRequestFrame) {
- xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
- }
- }
- }
- },
-
- _commitControls: function PageRequestManager$_commitControls(updatePanelData, asyncPostBackTimeout) {
- if (updatePanelData) {
- this._updatePanelIDs = updatePanelData.updatePanelIDs;
- this._updatePanelClientIDs = updatePanelData.updatePanelClientIDs;
- this._updatePanelHasChildrenAsTriggers = updatePanelData.updatePanelHasChildrenAsTriggers;
- this._asyncPostBackControlIDs = updatePanelData.asyncPostBackControlIDs;
- this._asyncPostBackControlClientIDs = updatePanelData.asyncPostBackControlClientIDs;
- this._postBackControlIDs = updatePanelData.postBackControlIDs;
- this._postBackControlClientIDs = updatePanelData.postBackControlClientIDs;
- }
- if (typeof(asyncPostBackTimeout) !== 'undefined' && asyncPostBackTimeout !== null) {
- this._asyncPostBackTimeout = asyncPostBackTimeout * 1000;
- }
- },
-
- _createHiddenField: function PageRequestManager$_createHiddenField(id, value) {
- var container, field = document.getElementById(id);
-
- if (field) {
- if (!field._isContained) {
- field.parentNode.removeChild(field);
- }
- else {
- container = field.parentNode;
- }
- }
- if (!container) {
- container = document.createElement('span');
- container.style.cssText = "display:none !important";
- this._form.appendChild(container);
- }
- container.innerHTML = "<input type='hidden' />";
- field = container.childNodes[0];
- field._isContained = true;
- field.id = field.name = id;
- field.value = value;
- },
-
- _createPageRequestManagerTimeoutError: function PageRequestManager$_createPageRequestManagerTimeoutError() {
- var displayMessage = "Sys.WebForms.PageRequestManagerTimeoutException: " + Sys.WebForms.Res.PRM_TimeoutError;
- var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerTimeoutException'});
- e.popStackFrame();
- return e;
- },
-
- _createPageRequestManagerServerError: function PageRequestManager$_createPageRequestManagerServerError(httpStatusCode, message) {
- var displayMessage = "Sys.WebForms.PageRequestManagerServerErrorException: " +
- (message || String.format(Sys.WebForms.Res.PRM_ServerError, httpStatusCode));
- var e = Error.create(displayMessage, {
- name: 'Sys.WebForms.PageRequestManagerServerErrorException',
- httpStatusCode: httpStatusCode
- });
- e.popStackFrame();
- return e;
- },
-
- _createPageRequestManagerParserError: function PageRequestManager$_createPageRequestManagerParserError(parserErrorMessage) {
- var displayMessage = "Sys.WebForms.PageRequestManagerParserErrorException: " + String.format(Sys.WebForms.Res.PRM_ParserError, parserErrorMessage);
- var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerParserErrorException'});
- e.popStackFrame();
- return e;
- },
-
- _createPanelID: function PageRequestManager$_createPanelID(panelsToUpdate, postBackSettings) {
- var asyncTarget = postBackSettings.asyncTarget,
- toUpdate = this._ensureUniqueIds(panelsToUpdate || postBackSettings.panelsToUpdate),
- panelArg = (toUpdate instanceof Array)
- ? toUpdate.join(',')
- : (toUpdate || this._scriptManagerID);
- if (asyncTarget) {
- panelArg += "|" + asyncTarget;
- }
- return encodeURIComponent(this._scriptManagerID) + '=' + encodeURIComponent(panelArg) + '&';
- },
-
- _createPostBackSettings: function PageRequestManager$_createPostBackSettings(async, panelsToUpdate, asyncTarget, sourceElement) {
- return { async:async, asyncTarget: asyncTarget, panelsToUpdate: panelsToUpdate, sourceElement: sourceElement };
- },
-
- _convertToClientIDs: function PageRequestManager$_convertToClientIDs(source, destinationIDs, destinationClientIDs, version4) {
- if (source) {
- for (var i = 0, l = source.length; i < l; i += (version4 ? 2 : 1)) {
- var uniqueID = source[i],
- clientID = (version4 ? source[i+1] : "") || this._uniqueIDToClientID(uniqueID);
- Array.add(destinationIDs, uniqueID);
- Array.add(destinationClientIDs, clientID);
- }
- }
- },
-
- dispose: function PageRequestManager$dispose() {
- Sys.Observer.clearEventHandlers(this);
- if (this._form) {
- Sys.UI.DomEvent.removeHandler(this._form, 'submit', this._onFormSubmitHandler);
- Sys.UI.DomEvent.removeHandler(this._form, 'click', this._onFormElementClickHandler);
- Sys.UI.DomEvent.removeHandler(window, 'unload', this._onWindowUnloadHandler);
- Sys.UI.DomEvent.removeHandler(window, 'load', this._pageLoadedHandler);
- }
-
- if (this._originalDoPostBack) {
- window.__doPostBack = this._originalDoPostBack;
- this._originalDoPostBack = null;
- }
- if (this._originalDoPostBackWithOptions) {
- window.WebForm_DoPostBackWithOptions = this._originalDoPostBackWithOptions;
- this._originalDoPostBackWithOptions = null;
- }
- if (this._originalFireDefaultButton) {
- window.WebForm_FireDefaultButton = this._originalFireDefaultButton;
- this._originalFireDefaultButton = null;
- }
- if (this._originalDoCallback) {
- window.WebForm_DoCallback = this._originalDoCallback;
- this._originalDoCallback = null;
- }
-
- this._form = null;
- this._updatePanelIDs = null;
- this._updatePanelClientIDs = null;
- this._asyncPostBackControlIDs = null;
- this._asyncPostBackControlClientIDs = null;
- this._postBackControlIDs = null;
- this._postBackControlClientIDs = null;
- this._asyncPostBackTimeout = null;
- this._scrollPosition = null;
- },
-
- _doCallback: function PageRequestManager$_doCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
- if (!this.get_isInAsyncPostBack()) {
- this._originalDoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
- }
- },
-
- _doPostBack: function PageRequestManager$_doPostBack(eventTarget, eventArgument) {
- this._additionalInput = null;
-
- var form = this._form;
- if ((eventTarget === null) || (typeof(eventTarget) === "undefined") || (this._isCrossPost)) {
- this._postBackSettings = this._createPostBackSettings(false);
- this._isCrossPost = false;
- }
- else {
- var mpUniqueID = this._masterPageUniqueID;
- var clientID = this._uniqueIDToClientID(eventTarget);
- var postBackElement = document.getElementById(clientID);
- if (!postBackElement && mpUniqueID) {
- if (clientID.indexOf(mpUniqueID + "$") === 0) {
- postBackElement = document.getElementById(clientID.substr(mpUniqueID.length + 1));
- }
- }
- if (!postBackElement) {
- if (Array.contains(this._asyncPostBackControlIDs, eventTarget)) {
- this._postBackSettings = this._createPostBackSettings(true, null, eventTarget);
- }
- else {
- if (Array.contains(this._postBackControlIDs, eventTarget)) {
- this._postBackSettings = this._createPostBackSettings(false);
- }
- else {
- var nearestUniqueIDMatch = this._findNearestElement(eventTarget);
- if (nearestUniqueIDMatch) {
- this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget);
- }
- else {
- if (mpUniqueID) {
- mpUniqueID += "$";
- if (eventTarget.indexOf(mpUniqueID) === 0) {
- nearestUniqueIDMatch = this._findNearestElement(eventTarget.substr(mpUniqueID.length));
- }
- }
- if (nearestUniqueIDMatch) {
- this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget);
- }
- else {
- this._postBackSettings = this._createPostBackSettings(false);
- }
- }
- }
- }
- }
- else {
- this._postBackSettings = this._getPostBackSettings(postBackElement, eventTarget);
- }
- }
-
- if (!this._postBackSettings.async) {
- form.onsubmit = this._onsubmit;
- this._originalDoPostBack(eventTarget, eventArgument);
- form.onsubmit = null;
- return;
- }
-
- form.__EVENTTARGET.value = eventTarget;
- form.__EVENTARGUMENT.value = eventArgument;
- this._onFormSubmit();
- },
-
- _doPostBackWithOptions: function PageRequestManager$_doPostBackWithOptions(options) {
- this._isCrossPost = options && options.actionUrl;
- this._originalDoPostBackWithOptions(options);
- },
-
- _elementContains: function PageRequestManager$_elementContains(container, element) {
- while (element) {
- if (element === container) {
- return true;
- }
- element = element.parentNode;
- }
- return false;
- },
-
- _endPostBack: function PageRequestManager$_endPostBack(error, executor, data) {
- if (this._request === executor.get_webRequest()) {
- this._processingRequest = false;
- this._additionalInput = null;
- this._request = null;
- }
-
- var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
- Sys.Observer.raiseEvent(this, "endRequest", eventArgs);
- if (error && !eventArgs.get_errorHandled()) {
- throw error;
- }
- },
-
- _ensureUniqueIds: function PageRequestManager$_ensureUniqueIds(ids) {
- if (!ids) return ids;
- ids = ids instanceof Array ? ids : [ids];
- var uniqueIds = [];
- for (var i = 0, l = ids.length; i < l; i++) {
- var id = ids[i], index = Array.indexOf(this._updatePanelClientIDs, id);
- uniqueIds.push(index > -1 ? this._updatePanelIDs[index] : id);
- }
- return uniqueIds;
- },
-
- _findNearestElement: function PageRequestManager$_findNearestElement(uniqueID) {
- while (uniqueID.length > 0) {
- var clientID = this._uniqueIDToClientID(uniqueID);
- var element = document.getElementById(clientID);
- if (element) {
- return element;
- }
- var indexOfLastDollar = uniqueID.lastIndexOf('$');
- if (indexOfLastDollar === -1) {
- return null;
- }
- uniqueID = uniqueID.substring(0, indexOfLastDollar);
- }
- return null;
- },
-
- _findText: function PageRequestManager$_findText(text, location) {
- var startIndex = Math.max(0, location - 20);
- var endIndex = Math.min(text.length, location + 20);
- return text.substring(startIndex, endIndex);
- },
-
- _fireDefaultButton: function PageRequestManager$_fireDefaultButton(event, target) {
- if (event.keyCode === 13) {
- var src = event.srcElement || event.target;
- if (!src || (src.tagName.toLowerCase() !== "textarea")) {
- var defaultButton = document.getElementById(target);
-
- if (defaultButton && (typeof(defaultButton.click) !== "undefined")) {
-
-
- this._activeDefaultButton = defaultButton;
- this._activeDefaultButtonClicked = false;
- try {
- defaultButton.click();
- }
- finally {
- this._activeDefaultButton = null;
- }
-
-
- event.cancelBubble = true;
- if (typeof(event.stopPropagation) === "function") {
- event.stopPropagation();
- }
- return false;
- }
- }
- }
- return true;
- },
-
- _getPageLoadedEventArgs: function PageRequestManager$_getPageLoadedEventArgs(initialLoad, data) {
-
- var updated = [];
- var created = [];
- var version4 = data ? data.version4 : false;
- var upData = data ? data.updatePanelData : null;
-
- var newIDs, newClientIDs, childIDs, refreshedIDs;
-
- if (!upData) {
- newIDs = this._updatePanelIDs;
- newClientIDs = this._updatePanelClientIDs;
- childIDs = null;
- refreshedIDs = null;
- }
- else {
- newIDs = upData.updatePanelIDs;
- newClientIDs = upData.updatePanelClientIDs;
- childIDs = upData.childUpdatePanelIDs;
- refreshedIDs = upData.panelsToRefreshIDs;
- }
-
- var i, l, uniqueID, clientID;
- if (refreshedIDs) {
- for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) {
- uniqueID = refreshedIDs[i];
- clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID);
- Array.add(updated, document.getElementById(clientID));
- }
- }
-
- for (i = 0, l = newIDs.length; i < l; i++) {
- if (initialLoad || Array.indexOf(childIDs, newIDs[i]) !== -1) {
- Array.add(created, document.getElementById(newClientIDs[i]));
- }
- }
-
- return new Sys.WebForms.PageLoadedEventArgs(updated, created, data ? data.dataItems : {});
- },
-
- _getPageLoadingEventArgs: function PageRequestManager$_getPageLoadingEventArgs(data) {
-
- var updated = [],
- deleted = [],
- upData = data.updatePanelData,
- oldIDs = upData.oldUpdatePanelIDs,
- oldClientIDs = upData.oldUpdatePanelClientIDs,
- newIDs = upData.updatePanelIDs,
- childIDs = upData.childUpdatePanelIDs,
- refreshedIDs = upData.panelsToRefreshIDs,
- i, l, uniqueID, clientID,
- version4 = data.version4;
- for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) {
- uniqueID = refreshedIDs[i];
- clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID);
- Array.add(updated, document.getElementById(clientID));
- }
-
- for (i = 0, l = oldIDs.length; i < l; i++) {
- uniqueID = oldIDs[i];
- if (Array.indexOf(refreshedIDs, uniqueID) === -1 &&
- (Array.indexOf(newIDs, uniqueID) === -1 || Array.indexOf(childIDs, uniqueID) > -1)) {
- Array.add(deleted, document.getElementById(oldClientIDs[i]));
- }
- }
-
- return new Sys.WebForms.PageLoadingEventArgs(updated, deleted, data.dataItems);
- },
-
- _getPostBackSettings: function PageRequestManager$_getPostBackSettings(element, elementUniqueI…
Large files files are truncated, but you can click here to view the full file