From 407dee982a3dfa0fa1fb6ae8974b563d5af86fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Fri, 13 Oct 2017 21:10:53 +0300 Subject: [PATCH 01/16] grunt-browser-sync added --- gruntfile.js | 12 ++++++++++++ package.json | 1 + 2 files changed, 13 insertions(+) diff --git a/gruntfile.js b/gruntfile.js index 7144f41..0c8a52c 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -20,6 +20,17 @@ module.exports = function (grunt) { dest: globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js" }; + configuration.browserSync = { + bsFiles: { + src : 'example/js/*.js' + }, + options: { + server: { + baseDir: "./example" + } + } + } + configuration.copy.threejs = { src: "node_modules/three/three.min.js", dest: globalConfig.exampleDir + "/three.min.js" @@ -85,6 +96,7 @@ module.exports = function (grunt) { ]); grunt.registerTask("default", [ + "browserSync", "debug", "example" ]); diff --git a/package.json b/package.json index 793328b..c9d427e 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "devDependencies": { "browserify": "^8.0.2", "grunt": "^1.0.1", + "grunt-browser-sync": "^2.2.0", "grunt-contrib-clean": "^1.0.0", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", From 3ba4c87089e6aeabbeaa91fca5d50a51296e00c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Fri, 13 Oct 2017 21:17:21 +0300 Subject: [PATCH 02/16] format fixed --- gruntfile.js | 31 +++++++++++++++++-------------- package.json | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index 0c8a52c..4243ad5 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -20,21 +20,21 @@ module.exports = function (grunt) { dest: globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js" }; - configuration.browserSync = { - bsFiles: { - src : 'example/js/*.js' - }, - options: { - server: { - baseDir: "./example" - } - } - } + configuration.browserSync = { + bsFiles: { + src : 'example/js/*.js' + }, + options: { + server: { + baseDir: "./example" + } + } + }; configuration.copy.threejs = { src: "node_modules/three/three.min.js", dest: globalConfig.exampleDir + "/three.min.js" - } + }; configuration.typescript = { options: { @@ -44,6 +44,7 @@ module.exports = function (grunt) { removeComments: false } }; + configuration.typescript[globalConfig.moduleName] = { src: globalConfig.sources, dest: globalConfig.outDir + "/" + globalConfig.moduleName + ".js" @@ -56,7 +57,8 @@ module.exports = function (grunt) { mode: "file", readme: "none" } - } + }; + configuration.typedoc[globalConfig.moduleName] = { options: { out: globalConfig.docDir + "/" + globalConfig.moduleName, @@ -71,10 +73,11 @@ module.exports = function (grunt) { beautify: false, sourceMap: true } - } + }; configuration.uglify[globalConfig.moduleName] = { files: {} - } + }; + configuration.uglify[globalConfig.moduleName].files["dist/" + globalConfig.moduleName + ".min.js"] = globalConfig.outDir + "/" + globalConfig.moduleName +".js"; grunt.initConfig(configuration); diff --git a/package.json b/package.json index c9d427e..6df782b 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-uglify": "^1.0.1", + "grunt-contrib-watch": "^1.0.0", "grunt-string-replace": "^1.2.1", "grunt-subgrunt": "^1.2.0", "grunt-typedoc": "^0.2.4", From 7fbd052c45cced97e884c42d5ba3429c137cdf23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Fri, 13 Oct 2017 22:23:04 +0300 Subject: [PATCH 03/16] concurrent added --- gruntfile.js | 52 ++++++++++++++++++++++++++++++++++++++++------------ package.json | 1 + 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index 4243ad5..550f35c 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -11,7 +11,11 @@ module.exports = function (grunt) { }; var configuration = { - clean: [globalConfig.outDir, globalConfig.docDir] + clean: [ + globalConfig.outDir, + globalConfig.docDir, + globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js", + globalConfig.exampleDir + "/three.min.js"] }; configuration.copy = {}; @@ -20,13 +24,27 @@ module.exports = function (grunt) { dest: globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js" }; + configuration.watch = { + scripts: { + files: ['src/**/*.ts'], + tasks: ['compile', 'example'], + options: { + //interrupt: true, + spawn: false, + } + } + }; + configuration.browserSync = { - bsFiles: { - src : 'example/js/*.js' - }, - options: { - server: { - baseDir: "./example" + dev: { + bsFiles: { + src: 'example/js/*.js' + }, + options: { + server: { + watchTask: true, + baseDir: "./example" + } } } }; @@ -50,6 +68,10 @@ module.exports = function (grunt) { dest: globalConfig.outDir + "/" + globalConfig.moduleName + ".js" }; + configuration.concurrent = { + target1: ["browserSync", "watch"] + }; + configuration.typedoc = { options: { name: globalConfig.moduleName, @@ -82,7 +104,7 @@ module.exports = function (grunt) { grunt.initConfig(configuration); - grunt.registerTask("debug", [ + grunt.registerTask("compile", [ "typescript:" + globalConfig.moduleName ]); @@ -93,14 +115,20 @@ module.exports = function (grunt) { grunt.registerTask("release", [ "clean", - "debug", + "compile", "uglify:" + globalConfig.moduleName, "typedoc:" + globalConfig.moduleName ]); grunt.registerTask("default", [ - "browserSync", - "debug", - "example" + "clean", + "compile", + "example", + "concurrent:target1" ]); + + grunt.event.on('watch', function(action, filepath, target) { + //grunt.config(configuration.typescript[globalConfig.moduleName].src, filepath); + grunt.log.writeln(target + ': ' + filepath + ' has ' + action); + }); }; diff --git a/package.json b/package.json index 6df782b..0ddbf3d 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "browserify": "^8.0.2", "grunt": "^1.0.1", "grunt-browser-sync": "^2.2.0", + "grunt-concurrent": "^2.3.1", "grunt-contrib-clean": "^1.0.0", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", From 0e85dcbeb48e7ef5f29f6a45d33c477d14fe6b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Fri, 13 Oct 2017 23:14:30 +0300 Subject: [PATCH 04/16] minor fix --- gruntfile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/gruntfile.js b/gruntfile.js index 550f35c..ad9d44e 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -29,7 +29,6 @@ module.exports = function (grunt) { files: ['src/**/*.ts'], tasks: ['compile', 'example'], options: { - //interrupt: true, spawn: false, } } From a9c14f71ca3bc43e85abf9f547b7eea73395d41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Sat, 14 Oct 2017 16:03:58 +0300 Subject: [PATCH 05/16] grunt-typescript replaced with grunt-ts --- gruntfile.js | 6 +++--- package.json | 2 +- src/core/configuration.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index ad9d44e..66905bd 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -53,7 +53,7 @@ module.exports = function (grunt) { dest: globalConfig.exampleDir + "/three.min.js" }; - configuration.typescript = { + configuration.ts = { options: { target: "es5", declaration: true, @@ -62,7 +62,7 @@ module.exports = function (grunt) { } }; - configuration.typescript[globalConfig.moduleName] = { + configuration.ts[globalConfig.moduleName] = { src: globalConfig.sources, dest: globalConfig.outDir + "/" + globalConfig.moduleName + ".js" }; @@ -104,7 +104,7 @@ module.exports = function (grunt) { grunt.initConfig(configuration); grunt.registerTask("compile", [ - "typescript:" + globalConfig.moduleName + "ts:" + globalConfig.moduleName ]); grunt.registerTask("example", [ diff --git a/package.json b/package.json index 0ddbf3d..2d085bb 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "grunt-contrib-watch": "^1.0.0", "grunt-string-replace": "^1.2.1", "grunt-subgrunt": "^1.2.0", + "grunt-ts": "^6.0.0-beta.16", "grunt-typedoc": "^0.2.4", - "grunt-typescript": "^0.8.0", "matchdep": "^1.0.1" }, "repository": { diff --git a/src/core/configuration.ts b/src/core/configuration.ts index a390efa..70fd1a0 100644 --- a/src/core/configuration.ts +++ b/src/core/configuration.ts @@ -21,7 +21,7 @@ module BP3D.Core { dimUnit: dimInch, wallHeight: 250, - wallThickness: 10 + wallThickness: 6 }; /** Set a configuration parameter. */ From c4544b744edd7999e00dce231290f89d52c068bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Sat, 14 Oct 2017 17:19:57 +0300 Subject: [PATCH 06/16] @types used --- gruntfile.js | 2 +- lib/jquery.d.ts | 3170 ------------- lib/three.d.ts | 6082 ------------------------- package.json | 6 +- src/floorplanner/floorplanner.ts | 2 +- src/floorplanner/floorplanner_view.ts | 2 +- src/items/floor_item.ts | 2 +- src/items/in_wall_floor_item.ts | 2 +- src/items/in_wall_item.ts | 2 +- src/items/item.ts | 2 +- src/items/on_floor_item.ts | 2 +- src/items/wall_floor_item.ts | 2 +- src/items/wall_item.ts | 2 +- src/model/corner.ts | 2 +- src/model/floorplan.ts | 4 +- src/model/half_edge.ts | 4 +- src/model/model.ts | 4 +- src/model/room.ts | 4 +- src/model/scene.ts | 4 +- src/model/wall.ts | 4 +- src/three/controller.ts | 4 +- src/three/controls.ts | 4 +- src/three/edge.ts | 4 +- src/three/floor.ts | 2 +- src/three/floorplan.ts | 2 +- src/three/hud.ts | 2 +- src/three/lights.ts | 2 +- src/three/main.ts | 4 +- src/three/skybox.ts | 2 +- 29 files changed, 41 insertions(+), 9289 deletions(-) delete mode 100644 lib/jquery.d.ts delete mode 100644 lib/three.d.ts diff --git a/gruntfile.js b/gruntfile.js index 66905bd..91a381d 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -56,7 +56,7 @@ module.exports = function (grunt) { configuration.ts = { options: { target: "es5", - declaration: true, + declaration: false, sourceMap: true, removeComments: false } diff --git a/lib/jquery.d.ts b/lib/jquery.d.ts deleted file mode 100644 index 4653239..0000000 --- a/lib/jquery.d.ts +++ /dev/null @@ -1,3170 +0,0 @@ -// Type definitions for jQuery 1.10.x / 2.0.x -// Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly , Dick van den Brink -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - - -/** - * Interface for the AJAX setting that will configure the AJAX request - */ -interface JQueryAjaxSettings { - /** - * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. - */ - accepts?: any; - /** - * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). - */ - async?: boolean; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. - */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; - /** - * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. - */ - cache?: boolean; - /** - * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; - /** - * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) - */ - contents?: { [key: string]: any; }; - //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" - // https://github.com/borisyankov/DefinitelyTyped/issues/742 - /** - * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. - */ - contentType?: any; - /** - * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). - */ - context?: any; - /** - * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5) - */ - converters?: { [key: string]: any; }; - /** - * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5) - */ - crossDomain?: boolean; - /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). - */ - data?: any; - /** - * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. - */ - dataFilter? (data: any, ty: any): any; - /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). - */ - dataType?: string; - /** - * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. - */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; - /** - * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. - */ - global?: boolean; - /** - * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5) - */ - headers?: { [key: string]: any; }; - /** - * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - */ - ifModified?: boolean; - /** - * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1) - */ - isLocal?: boolean; - /** - * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } - */ - jsonp?: any; - /** - * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. - */ - jsonpCallback?: any; - /** - * A mime type to override the XHR mime type. (version added: 1.5.1) - */ - mimeType?: string; - /** - * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - password?: string; - /** - * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. - */ - processData?: boolean; - /** - * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. - */ - scriptCharset?: string; - /** - * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5) - */ - statusCode?: { [key: string]: any; }; - /** - * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; - /** - * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. - */ - timeout?: number; - /** - * Set this to true if you wish to use the traditional style of param serialization. - */ - traditional?: boolean; - /** - * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. - */ - type?: string; - /** - * A string containing the URL to which the request is sent. - */ - url?: string; - /** - * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - username?: string; - /** - * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. - */ - xhr?: any; - /** - * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1) - */ - xhrFields?: { [key: string]: any; }; -} - -/** - * Interface for the jqXHR object - */ -interface JQueryXHR extends XMLHttpRequest, JQueryPromise { - /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). - */ - overrideMimeType(mimeType: string): any; - /** - * Cancel the request. - * - * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" - */ - abort(statusText?: string): void; - /** - * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. - */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => void, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; - /** - * Property containing the parsed response if the response Content-Type is json - */ - responseJSON?: any; -} - -/** - * Interface for the JQuery callback - */ -interface JQueryCallback { - /** - * Add a callback or a collection of callbacks to a callback list. - * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - */ - add(callbacks: Function): JQueryCallback; - /** - * Add a callback or a collection of callbacks to a callback list. - * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - */ - add(callbacks: Function[]): JQueryCallback; - - /** - * Disable a callback list from doing anything more. - */ - disable(): JQueryCallback; - - /** - * Determine if the callbacks list has been disabled. - */ - disabled(): boolean; - - /** - * Remove all of the callbacks from a list. - */ - empty(): JQueryCallback; - - /** - * Call all of the callbacks with the given arguments - * - * @param arguments The argument or list of arguments to pass back to the callback list. - */ - fire(...arguments: any[]): JQueryCallback; - - /** - * Determine if the callbacks have already been called at least once. - */ - fired(): boolean; - - /** - * Call all callbacks in a list with the given context and arguments. - * - * @param context A reference to the context in which the callbacks in the list should be fired. - * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. - */ - fireWith(context?: any, ...args: any[]): JQueryCallback; - - /** - * Determine whether a supplied callback is in a list - * - * @param callback The callback to search for. - */ - has(callback: Function): boolean; - - /** - * Lock a callback list in its current state. - */ - lock(): JQueryCallback; - - /** - * Determine if the callbacks list has been locked. - */ - locked(): boolean; - - /** - * Remove a callback or a collection of callbacks from a callback list. - * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - */ - remove(callbacks: Function): JQueryCallback; - /** - * Remove a callback or a collection of callbacks from a callback list. - * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - */ - remove(callbacks: Function[]): JQueryCallback; -} - -/** - * Allows jQuery Promises to interop with non-jQuery promises - */ -interface JQueryGenericPromise { - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; -} - -/** - * Interface for the JQuery promise/deferred callbacks - */ -interface JQueryPromiseCallback { - (value?: T, ...args: any[]): void; -} - -interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; -} - -/** - * Interface for the JQuery promise, part of callbacks - */ -interface JQueryPromise extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface for the JQuery deferred, part of callbacks - */ -interface JQueryDeferred extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given args. - * - * @param args Optional arguments that are passed to the progressCallbacks. - */ - notify(value?: any, ...args: any[]): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given context and args. - * - * @param context Context passed to the progressCallbacks as the this object. - * @param args Optional arguments that are passed to the progressCallbacks. - */ - notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred; - - /** - * Reject a Deferred object and call any failCallbacks with the given args. - * - * @param args Optional arguments that are passed to the failCallbacks. - */ - reject(value?: any, ...args: any[]): JQueryDeferred; - /** - * Reject a Deferred object and call any failCallbacks with the given context and args. - * - * @param context Context passed to the failCallbacks as the this object. - * @param args An optional array of arguments that are passed to the failCallbacks. - */ - rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given args. - * - * @param value First argument passed to doneCallbacks. - * @param args Optional subsequent arguments that are passed to the doneCallbacks. - */ - resolve(value?: T, ...args: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * - * @param context Context passed to the doneCallbacks as the this object. - * @param args An optional array of arguments that are passed to the doneCallbacks. - */ - resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred; - - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - */ - promise(target?: any): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface of the JQuery extension of the W3C event object - */ -interface BaseJQueryEventObject extends Event { - data: any; - delegateTarget: Element; - isDefaultPrevented(): boolean; - isImmediatePropagationStopped(): boolean; - isPropagationStopped(): boolean; - namespace: string; - originalEvent: Event; - preventDefault(): any; - relatedTarget: Element; - result: any; - stopImmediatePropagation(): void; - stopPropagation(): void; - target: Element; - pageX: number; - pageY: number; - which: number; - metaKey: boolean; -} - -interface JQueryInputEventObject extends BaseJQueryEventObject { - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; -} - -interface JQueryMouseEventObject extends JQueryInputEventObject { - button: number; - clientX: number; - clientY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; -} - -interface JQueryKeyEventObject extends JQueryInputEventObject { - char: any; - charCode: number; - key: any; - keyCode: number; -} - -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ -} - -/* - Collection of properties of the current browser -*/ - -interface JQuerySupport { - ajax?: boolean; - boxModel?: boolean; - changeBubbles?: boolean; - checkClone?: boolean; - checkOn?: boolean; - cors?: boolean; - cssFloat?: boolean; - hrefNormalized?: boolean; - htmlSerialize?: boolean; - leadingWhitespace?: boolean; - noCloneChecked?: boolean; - noCloneEvent?: boolean; - opacity?: boolean; - optDisabled?: boolean; - optSelected?: boolean; - scriptEval? (): boolean; - style?: boolean; - submitBubbles?: boolean; - tbody?: boolean; -} - -interface JQueryParam { - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - */ - (obj: any): string; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - */ - (obj: any, traditional: boolean): string; -} - -/** - * The interface used to construct jQuery events (with $.Event). It is - * defined separately instead of inline in JQueryStatic to allow - * overriding the construction function with specific strings - * returning specific event objects. - */ -interface JQueryEventConstructor { - (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; -} - -/** - * The interface used to specify coordinates. - */ -interface JQueryCoordinates { - left: number; - top: number; -} - -/** - * Elements in the array returned by serializeArray() - */ -interface JQuerySerializeArrayElement { - name: string; - value: string; -} - -interface JQueryAnimationOptions { - /** - * A string or number determining how long the animation will run. - */ - duration?: any; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to call once the animation is complete. - */ - complete?: Function; - /** - * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. - */ - step?: (now: number, tween: any) => any; - /** - * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) - */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; - /** - * A function to call when the animation begins. (version added: 1.8) - */ - start?: (animation: JQueryPromise) => any; - /** - * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) - */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) - */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) - */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. - */ - queue?: any; - /** - * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) - */ - specialEasing?: Object; -} - -/** - * Static members of jQuery (those on $ and jQuery themselves) - */ -interface JQueryStatic { - - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - */ - ajax(settings: JQueryAjaxSettings): JQueryXHR; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param url A string containing the URL to which the request is sent. - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - */ - ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; - - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param dataTypes An optional string containing one or more space-separated dataTypes - * @param handler A handler to set default values for future Ajax requests. - */ - ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param handler A handler to set default values for future Ajax requests. - */ - ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - ajaxSettings: JQueryAjaxSettings; - - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - */ - ajaxSetup(options: JQueryAjaxSettings): void; - - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - */ - get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - */ - getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load a JavaScript file from the server using a GET HTTP request, then execute it. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - */ - getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - */ - param: JQueryParam; - - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - */ - post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - - /** - * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. - * - * @param flags An optional list of space-separated flags that change how the callback list behaves. - */ - Callbacks(flags?: string): JQueryCallback; - - /** - * Holds or releases the execution of jQuery's ready event. - * - * @param hold Indicates whether the ready hold is being requested or released - */ - holdReady(hold: boolean): void; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param selector A string containing a selector expression - * @param context A DOM Element, Document, or jQuery to use as context - */ - (selector: string, context?: Element|JQuery): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param element A DOM element to wrap in a jQuery object. - */ - (element: Element): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. - */ - (elementArray: Element[]): JQuery; - - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback A function to execute after the DOM is ready. - */ - (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object A plain object to wrap in a jQuery object. - */ - (object: {}): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object An existing jQuery object to clone. - */ - (object: JQuery): JQuery; - - /** - * Specify a function to execute when the DOM is fully loaded. - */ - (): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. - * @param ownerDocument A document in which the new elements will be created. - */ - (html: string, ownerDocument?: Document): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string defining a single, standalone, HTML element (e.g.
or
). - * @param attributes An object of attributes, events, and methods to call on the newly-created element. - */ - (html: string, attributes: Object): JQuery; - - /** - * Relinquish jQuery's control of the $ variable. - * - * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - */ - noConflict(removeAll?: boolean): Object; - - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; - - /** - * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. - */ - cssHooks: { [key: string]: any; }; - cssNumber: any; - - /** - * Store arbitrary data associated with the specified element. Returns the value that was set. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @param value The new data value. - */ - data(element: Element, key: string, value: T): T; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - */ - data(element: Element, key: string): any; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - */ - data(element: Element): any; - - /** - * Execute the next function on the queue for the matched element. - * - * @param element A DOM element from which to remove and execute a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - dequeue(element: Element, queueName?: string): void; - - /** - * Determine whether an element has any jQuery data associated with it. - * - * @param element A DOM element to be checked for data. - */ - hasData(element: Element): boolean; - - /** - * Show the queue of functions to be executed on the matched element. - * - * @param element A DOM element to inspect for an attached queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - queue(element: Element, queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element where the array of queued functions is attached. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(element: Element, queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element on which to add a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue. - */ - queue(element: Element, queueName: string, callback: Function): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param element A DOM element from which to remove data. - * @param name A string naming the piece of data to remove. - */ - removeData(element: Element, name?: string): JQuery; - - /** - * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. - * - * @param beforeStart A function that is called just before the constructor returns. - */ - Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; - - /** - * Effects - */ - fx: { - tick: () => void; - /** - * The rate (in milliseconds) at which animations fire. - */ - interval: number; - stop: () => void; - speeds: { slow: number; fast: number; }; - /** - * Globally disable all animations. - */ - off: boolean; - step: any; - }; - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fnction The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - */ - proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param context The object to which the context (this) of the function should be set. - * @param name The name of the function whose context will be changed (should be a property of the context object). - * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. - */ - proxy(context: Object, name: string, ...additionalArguments: any[]): any; - - Event: JQueryEventConstructor; - - /** - * Takes a string and throws an exception containing it. - * - * @param message The message to send out. - */ - error(message: any): JQuery; - - expr: any; - fn: any; //TODO: Decide how we want to type this - - isReady: boolean; - - // Properties - support: JQuerySupport; - - /** - * Check to see if a DOM element is a descendant of another DOM element. - * - * @param container The DOM element that may contain the other element. - * @param contained The DOM element that may be contained by (a descendant of) the other element. - */ - contains(container: Element, contained: Element): boolean; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. - */ - each( - collection: T[], - callback: (indexInArray: number, valueOfElement: T) => any - ): any; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. - */ - each( - collection: any, - callback: (indexInArray: any, valueOfElement: any) => any - ): any; - - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - */ - extend(target: any, object1?: any, ...objectN: any[]): any; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). - * @param target The object to extend. It will receive the new properties. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - */ - extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; - - /** - * Execute some JavaScript code globally. - * - * @param code The JavaScript code to execute. - */ - globalEval(code: string): any; - - /** - * Finds the elements of an array which satisfy a filter function. The original array is not affected. - * - * @param array The array to search through. - * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. - * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. - */ - grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; - - /** - * Search for a specified value within an array and return its index (or -1 if not found). - * - * @param value The value to search for. - * @param array An array through which to search. - * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. - */ - inArray(value: T, array: T[], fromIndex?: number): number; - - /** - * Determine whether the argument is an array. - * - * @param obj Object to test whether or not it is an array. - */ - isArray(obj: any): boolean; - /** - * Check to see if an object is empty (contains no enumerable properties). - * - * @param obj The object that will be checked to see if it's empty. - */ - isEmptyObject(obj: any): boolean; - /** - * Determine if the argument passed is a Javascript function object. - * - * @param obj Object to test whether or not it is a function. - */ - isFunction(obj: any): boolean; - /** - * Determines whether its argument is a number. - * - * @param obj The value to be tested. - */ - isNumeric(value: any): boolean; - /** - * Check to see if an object is a plain object (created using "{}" or "new Object"). - * - * @param obj The object that will be checked to see if it's a plain object. - */ - isPlainObject(obj: any): boolean; - /** - * Determine whether the argument is a window. - * - * @param obj Object to test whether or not it is a window. - */ - isWindow(obj: any): boolean; - /** - * Check to see if a DOM node is within an XML document (or is an XML document). - * - * @param node he DOM node that will be checked to see if it's in an XML document. - */ - isXMLDoc(node: Node): boolean; - - /** - * Convert an array-like object into a true JavaScript array. - * - * @param obj Any object to turn into a native Array. - */ - makeArray(obj: any): any[]; - - /** - * Translate all items in an array or object to new array of items. - * - * @param array The Array to translate. - * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. - */ - map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param arrayOrObject The Array or Object to translate. - * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. - */ - map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; - - /** - * Merge the contents of two arrays together into the first array. - * - * @param first The first array to merge, the elements of second added. - * @param second The second array to merge into the first, unaltered. - */ - merge(first: T[], second: T[]): T[]; - - /** - * An empty function. - */ - noop(): any; - - /** - * Return a number representing the current time. - */ - now(): number; - - /** - * Takes a well-formed JSON string and returns the resulting JavaScript object. - * - * @param json The JSON string to parse. - */ - parseJSON(json: string): any; - - /** - * Parses a string into an XML document. - * - * @param data a well-formed XML string to be parsed - */ - parseXML(data: string): XMLDocument; - - /** - * Remove the whitespace from the beginning and end of a string. - * - * @param str Remove the whitespace from the beginning and end of a string. - */ - trim(str: string): string; - - /** - * Determine the internal JavaScript [[Class]] of an object. - * - * @param obj Object to get the internal JavaScript [[Class]] of. - */ - type(obj: any): string; - - /** - * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - */ - unique(array: Element[]): Element[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - */ - parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - */ - parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; -} - -/** - * The jQuery instance members - */ -interface JQuery { - /** - * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. - * - * @param handler The function to be invoked. - */ - ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; - /** - * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; - /** - * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - /** - * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxStart(handler: () => any): JQuery; - /** - * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxStop(handler: () => any): JQuery; - /** - * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param complete A callback function that is executed when the request completes. - */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; - - /** - * Encode a set of form elements as a string for submission. - */ - serialize(): string; - /** - * Encode a set of form elements as an array of names and values. - */ - serializeArray(): JQuerySerializeArrayElement[]; - - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - */ - addClass(className: string): JQuery; - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. - */ - addClass(func: (index: number, className: string) => string): JQuery; - - /** - * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. - */ - addBack(selector?: string): JQuery; - - /** - * Get the value of an attribute for the first element in the set of matched elements. - * - * @param attributeName The name of the attribute to get. - */ - attr(attributeName: string): string; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. - */ - attr(attributeName: string, value: string|number): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. - */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributes An object of attribute-value pairs to set. - */ - attr(attributes: Object): JQuery; - - /** - * Determine whether any of the matched elements are assigned the given class. - * - * @param className The class name to search for. - */ - hasClass(className: string): boolean; - - /** - * Get the HTML contents of the first element in the set of matched elements. - */ - html(): string; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - */ - html(htmlString: string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - */ - html(func: (index: number, oldhtml: string) => string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - */ - - /** - * Get the value of a property for the first element in the set of matched elements. - * - * @param propertyName The name of the property to get. - */ - prop(propertyName: string): any; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - */ - prop(propertyName: string, value: string|number|boolean): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - */ - prop(properties: Object): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. - */ - prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; - - /** - * Remove an attribute from each element in the set of matched elements. - * - * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - */ - removeAttr(attributeName: string): JQuery; - - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - */ - removeClass(className?: string): JQuery; - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. - */ - removeClass(func: (index: number, className: string) => string): JQuery; - - /** - * Remove a property for the set of matched elements. - * - * @param propertyName The name of the property to remove. - */ - removeProp(propertyName: string): JQuery; - - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - */ - toggleClass(className: string, swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param swtch A boolean value to determine whether the class should be added or removed. - */ - toggleClass(swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. - * @param swtch A boolean value to determine whether the class should be added or removed. - */ - toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; - - /** - * Get the current value of the first element in the set of matched elements. - */ - val(): any; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. - */ - val(value: string|string[]): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: string) => string): JQuery; - - - /** - * Get the value of style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - */ - css(propertyName: string): string; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - */ - css(propertyName: string, value: string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - */ - css(properties: Object): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements. - */ - height(): number; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - */ - height(value: number|string): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - */ - height(func: (index: number, height: number) => number|string): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding but not border. - */ - innerHeight(): number; - - /** - * Sets the inner height on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerHeight(height: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding but not border. - */ - innerWidth(): number; - - /** - * Sets the inner width on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerWidth(width: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the document. - */ - offset(): JQueryCoordinates; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - */ - offset(coordinates: JQueryCoordinates): JQuery; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. - */ - offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - */ - outerHeight(includeMargin?: boolean): number; - - /** - * Sets the outer height on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerHeight(height: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding and border. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - */ - outerWidth(includeMargin?: boolean): number; - - /** - * Sets the outer width on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerWidth(width: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. - */ - position(): JQueryCoordinates; - - /** - * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. - */ - scrollLeft(): number; - /** - * Set the current horizontal position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - */ - scrollLeft(value: number): JQuery; - - /** - * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. - */ - scrollTop(): number; - /** - * Set the current vertical position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - */ - scrollTop(value: number): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements. - */ - width(): number; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - width(value: number|string): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - */ - width(func: (index: number, width: number) => number|string): JQuery; - - /** - * Remove from the queue all items that have not yet been run. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - clearQueue(queueName?: string): JQuery; - - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any Javascript type including Array or Object. - */ - data(key: string, value: any): JQuery; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - */ - data(obj: { [key: string]: any; }): JQuery; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - */ - data(key: string): any; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - */ - data(): any; - - /** - * Execute the next function on the queue for the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - dequeue(queueName?: string): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. - */ - removeData(name: string): JQuery; - /** - * Remove a previously-stored piece of data. - * - * @param list An array of strings naming the pieces of data to delete. - */ - removeData(list: string[]): JQuery; - - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. - * - * @param type The type of queue that needs to be observed. (default: fx) - * @param target Object onto which the promise methods have to be attached - */ - promise(type?: string, target?: Object): JQueryPromise; - - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. (default: swing) - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param options A map of additional options to pass to the method. - */ - animate(properties: Object, options: JQueryAnimationOptions): JQuery; - - /** - * Set a timer to delay execution of subsequent items in the queue. - * - * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - delay(duration: number, queueName?: string): JQuery; - - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param options A map of additional options to pass to the method. - */ - fadeIn(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param options A map of additional options to pass to the method. - */ - fadeOut(options: JQueryAnimationOptions): JQuery; - - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; - - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param options A map of additional options to pass to the method. - */ - fadeToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. - * - * @param queue The name of the queue in which to stop animations. - */ - finish(queue?: string): JQuery; - - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - hide(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - show(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - show(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideDown(options: JQueryAnimationOptions): JQuery; - - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideUp(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation on the matched elements. - * - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - */ - stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - /** - * Stop the currently-running animation on the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - */ - stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - toggle(options: JQueryAnimationOptions): JQuery; - /** - * Display or hide the matched elements. - * - * @param showOrHide A Boolean indicating whether to show or hide the elements. - */ - toggle(showOrHide: boolean): JQuery; - - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - */ - bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - */ - bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - */ - bind(eventType: string, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param events An object containing one or more DOM event types and functions to execute for them. - */ - bind(events: any): JQuery; - - /** - * Trigger the "blur" event on an element - */ - blur(): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - blur(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "change" event on an element. - */ - change(): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - change(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "click" event on an element. - */ - click(): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - */ - click(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "dblclick" event on an element. - */ - dblclick(): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focus" event on an element. - */ - focus(): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focus(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - * - * @param handlerIn A function to execute when the mouse pointer enters the element. - * @param handlerOut A function to execute when the mouse pointer leaves the element. - */ - hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. - * - * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. - */ - hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "keydown" event on an element. - */ - keydown(): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keypress" event on an element. - */ - keypress(): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keyup" event on an element. - */ - keyup(): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - load(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "mousedown" event on an element. - */ - mousedown(): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseenter" event on an element. - */ - mouseenter(): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param handler A function to execute when the event is triggered. - */ - mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseleave" event on an element. - */ - mouseleave(): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param handler A function to execute when the event is triggered. - */ - mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mousemove" event on an element. - */ - mousemove(): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseout" event on an element. - */ - mouseout(): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseover" event on an element. - */ - mouseover(): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseup" event on an element. - */ - mouseup(): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Remove an event handler. - */ - off(): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @param handler A handler function previously attached for the event(s), or the special value false. - */ - off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. - */ - off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - */ - off(events: { [key: string]: any; }, selector?: string): JQuery; - - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). - */ - on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - on(events: { [key: string]: any; }, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute at the time the event is triggered. - */ - one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param data An object containing data that will be passed to the event handler. - * @param handler A function to execute at the time the event is triggered. - */ - one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - one(events: { [key: string]: any; }, data?: any): JQuery; - - - /** - * Specify a function to execute when the DOM is fully loaded. - * - * @param handler A function to execute after the DOM is ready. - */ - ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Trigger the "resize" event on an element. - */ - resize(): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - resize(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "scroll" event on an element. - */ - scroll(): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "select" event on an element. - */ - select(): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - select(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "submit" event on an element. - */ - submit(): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - submit(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param event A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; - - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters An array of additional parameters to pass along to the event handler. - */ - triggerHandler(eventType: string, ...extraParameters: any[]): Object; - - /** - * Execute all handlers attached to an element for an event. - * - * @param event A jQuery.Event object. - * @param extraParameters An array of additional parameters to pass along to the event handler. - */ - triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; - - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param handler The function that is to be no longer executed. - */ - unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - */ - unbind(eventType: string, fls: boolean): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param evt A JavaScript event object as passed to an event handler. - */ - unbind(evt: any): JQuery; - - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - */ - undelegate(): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" - * @param handler A function to execute at the time the event is triggered. - */ - undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param events An object of one or more event types and previously bound functions to unbind from them. - */ - undelegate(selector: string, events: Object): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param namespace A string containing a namespace to unbind all events from. - */ - undelegate(namespace: string): JQuery; - - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - */ - unload(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) - */ - context: Element; - - jquery: string; - - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - */ - error(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - */ - pushStack(elements: any[]): JQuery; - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @param name The name of a jQuery method that generated the array of elements. - * @param arguments The arguments that were passed in to the jQuery method (for serialization). - */ - pushStack(elements: any[], name: string, arguments: any[]): JQuery; - - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - */ - appendTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Create a deep copy of the set of matched elements. - * - * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * param selector A selector expression that filters the set of matched elements to be removed. - */ - detach(selector?: string): JQuery; - - /** - * Remove all child nodes of the set of matched elements from the DOM. - */ - empty(): JQuery; - - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - */ - prependTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - */ - remove(selector?: string): JQuery; - - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; - - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param func A function that returns content with which to replace the set of matched elements. - */ - replaceWith(func: () => Element|JQuery): JQuery; - - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - */ - text(): string; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. - */ - text(text: string|number|boolean): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. - */ - text(func: (index: number, text: string) => string): JQuery; - - /** - * Retrieve all the elements contained in the jQuery set, as an array. - */ - toArray(): any[]; - - /** - * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - */ - unwrap(): JQuery; - - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrap(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - wrap(func: (index: number) => string|JQuery): JQuery; - - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; - wrapAll(func: (index: number) => string): JQuery; - - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - wrapInner(func: (index: number) => string): JQuery; - - /** - * Iterate over a jQuery object, executing a function for each matched element. - * - * @param func A function to execute for each matched element. - */ - each(func: (index: number, elem: Element) => any): JQuery; - - /** - * Retrieve one of the elements matched by the jQuery object. - * - * @param index A zero-based integer indicating which element to retrieve. - */ - get(index: number): HTMLElement; - /** - * Retrieve the elements matched by the jQuery object. - */ - get(): any[]; - - /** - * Search for a given element from among the matched elements. - */ - index(): number; - /** - * Search for a given element from among the matched elements. - * - * @param selector A selector representing a jQuery collection in which to look for an element. - */ - index(selector: string|JQuery|Element): number; - - /** - * The number of elements in the jQuery object. - */ - length: number; - /** - * A selector representing selector passed to jQuery(), if any, when creating the original set. - * version deprecated: 1.7, removed: 1.9 - */ - selector: string; - [index: string]: any; - [index: number]: HTMLElement; - - /** - * Add elements to the set of matched elements. - * - * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. - * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. - */ - add(selector: string, context?: Element): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param elements One or more elements to add to the set of matched elements. - */ - add(...elements: Element[]): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param html An HTML fragment to add to the set of matched elements. - */ - add(html: string): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param obj An existing jQuery object to add to the set of matched elements. - */ - add(obj: JQuery): JQuery; - - /** - * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - children(selector?: string): JQuery; - - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - */ - closest(selector: string): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - */ - closest(selector: string, context?: Element): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param obj A jQuery object to match elements against. - */ - closest(obj: JQuery): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param element An element to match elements against. - */ - closest(element: Element): JQuery; - - /** - * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * - * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - */ - closest(selectors: any, context?: Element): any[]; - - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - */ - contents(): JQuery; - - /** - * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. - */ - end(): JQuery; - - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * - */ - eq(index: number): JQuery; - - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param selector A string containing a selector expression to match the current set of elements against. - */ - filter(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - */ - filter(func: (index: number, element: Element) => any): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param element An element to match the current set of elements against. - */ - filter(element: Element): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - filter(obj: JQuery): JQuery; - - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - */ - find(selector: string): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param element An element to match elements against. - */ - find(element: Element): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param obj A jQuery object to match elements against. - */ - find(obj: JQuery): JQuery; - - /** - * Reduce the set of matched elements to the first in the set. - */ - first(): JQuery; - - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param selector A string containing a selector expression to match elements against. - */ - has(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param contained A DOM element to match elements against. - */ - has(contained: Element): JQuery; - - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param selector A string containing a selector expression to match elements against. - */ - is(selector: string): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. - */ - is(func: (index: number, element: Element) => boolean): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - is(obj: JQuery): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param elements One or more elements to match the current set of elements against. - */ - is(elements: any): boolean; - - /** - * Reduce the set of matched elements to the final one in the set. - */ - last(): JQuery; - - /** - * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - * - * @param callback A function object that will be invoked for each element in the current set. - */ - map(callback: (index: number, domElement: Element) => any): JQuery; - - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - next(selector?: string): JQuery; - - /** - * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - nextAll(selector?: string): JQuery; - - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(selector?: string, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(element?: Element, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Remove elements from the set of matched elements. - * - * @param selector A string containing a selector expression to match elements against. - */ - not(selector: string): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - */ - not(func: (index: number, element: Element) => boolean): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param elements One or more DOM elements to remove from the matched set. - */ - not(...elements: Element[]): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - not(obj: JQuery): JQuery; - - /** - * Get the closest ancestor element that is positioned. - */ - offsetParent(): JQuery; - - /** - * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - parent(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - parents(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(selector?: string, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(element?: Element, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - prev(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - prevAll(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(selector?: string, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(element?: Element, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - siblings(selector?: string): JQuery; - - /** - * Reduce the set of matched elements to a subset specified by a range of indices. - * - * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. - * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - */ - slice(start: number, end?: number): JQuery; - - /** - * Show the queue of functions to be executed on the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - queue(queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - */ - queue(callback: Function): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - */ - queue(queueName: string, callback: Function): JQuery; -} -declare module "jquery" { - export = $; -} -declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; diff --git a/lib/three.d.ts b/lib/three.d.ts deleted file mode 100644 index d4bbd8d..0000000 --- a/lib/three.d.ts +++ /dev/null @@ -1,6082 +0,0 @@ -// Type definitions for three.js r73 -// Project: http://mrdoob.github.com/three.js/ -// Definitions by: Kon , Satoru Kimura -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module THREE { - export var REVISION: string; - - // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button - export enum MOUSE { LEFT, MIDDLE, RIGHT } - - // GL STATE CONSTANTS - export enum CullFace { } - export var CullFaceNone: CullFace; - export var CullFaceBack: CullFace; - export var CullFaceFront: CullFace; - export var CullFaceFrontBack: CullFace; - - export enum FrontFaceDirection { } - export var FrontFaceDirectionCW: FrontFaceDirection; - export var FrontFaceDirectionCCW: FrontFaceDirection; - - // Shadowing Type - export enum ShadowMapType { } - export var BasicShadowMap: ShadowMapType; - export var PCFShadowMap: ShadowMapType; - export var PCFSoftShadowMap: ShadowMapType; - - // MATERIAL CONSTANTS - - // side - export enum Side { } - export var FrontSide: Side; - export var BackSide: Side; - export var DoubleSide: Side; - - // shading - export enum Shading { } - export var NoShading: Shading; - export var FlatShading: Shading; - export var SmoothShading: Shading; - - // colors - export enum Colors { } - export var NoColors: Colors; - export var FaceColors: Colors; - export var VertexColors: Colors; - - // blending modes - export enum Blending { } - export var NoBlending: Blending; - export var NormalBlending: Blending; - export var AdditiveBlending: Blending; - export var SubtractiveBlending: Blending; - export var MultiplyBlending: Blending; - export var CustomBlending: Blending; - - // custom blending equations - // (numbers start from 100 not to clash with other - // mappings to OpenGL constants defined in Texture.js) - export enum BlendingEquation { } - export var AddEquation: BlendingEquation; - export var SubtractEquation: BlendingEquation; - export var ReverseSubtractEquation: BlendingEquation; - export var MinEquation: BlendingEquation; - export var MaxEquation: BlendingEquation; - - // custom blending destination factors - export enum BlendingDstFactor { } - export var ZeroFactor: BlendingDstFactor; - export var OneFactor: BlendingDstFactor; - export var SrcColorFactor: BlendingDstFactor; - export var OneMinusSrcColorFactor: BlendingDstFactor; - export var SrcAlphaFactor: BlendingDstFactor; - export var OneMinusSrcAlphaFactor: BlendingDstFactor; - export var DstAlphaFactor: BlendingDstFactor; - export var OneMinusDstAlphaFactor: BlendingDstFactor; - - // custom blending src factors - export enum BlendingSrcFactor { } - export var DstColorFactor: BlendingSrcFactor; - export var OneMinusDstColorFactor: BlendingSrcFactor; - export var SrcAlphaSaturateFactor: BlendingSrcFactor; - - // depth modes - export enum DepthModes { } - export var NeverDepth: DepthModes; - export var AlwaysDepth: DepthModes; - export var LessDepth: DepthModes; - export var LessEqualDepth: DepthModes; - export var EqualDepth: DepthModes; - export var GreaterEqualDepth: DepthModes; - export var GreaterDepth: DepthModes; - export var NotEqualDepth: DepthModes; - - // TEXTURE CONSTANTS - // Operations - export enum Combine { } - export var MultiplyOperation: Combine; - export var MixOperation: Combine; - export var AddOperation: Combine; - - // Mapping modes - export enum Mapping { } - export var UVMapping: Mapping; - export var CubeReflectionMapping: Mapping; - export var CubeRefractionMapping: Mapping; - export var EquirectangularReflectionMapping: Mapping; - export var EquirectangularRefractionMapping: Mapping; - export var SphericalReflectionMapping: Mapping; - - // Wrapping modes - export enum Wrapping { } - export var RepeatWrapping: Wrapping; - export var ClampToEdgeWrapping: Wrapping; - export var MirroredRepeatWrapping: Wrapping; - - // Filters - export enum TextureFilter { } - export var NearestFilter: TextureFilter; - export var NearestMipMapNearestFilter: TextureFilter; - export var NearestMipMapLinearFilter: TextureFilter; - export var LinearFilter: TextureFilter; - export var LinearMipMapNearestFilter: TextureFilter; - export var LinearMipMapLinearFilter: TextureFilter; - - // Data types - export enum TextureDataType { } - export var UnsignedByteType: TextureDataType; - export var ByteType: TextureDataType; - export var ShortType: TextureDataType; - export var UnsignedShortType: TextureDataType; - export var IntType: TextureDataType; - export var UnsignedIntType: TextureDataType; - export var FloatType: TextureDataType; - export var HalfFloatType: TextureDataType; - - // Pixel types - export enum PixelType { } - export var UnsignedShort4444Type: PixelType; - export var UnsignedShort5551Type: PixelType; - export var UnsignedShort565Type: PixelType; - - // Pixel formats - export enum PixelFormat { } - export var AlphaFormat: PixelFormat; - export var RGBFormat: PixelFormat; - export var RGBAFormat: PixelFormat; - export var LuminanceFormat: PixelFormat; - export var LuminanceAlphaFormat: PixelFormat; - export var RGBEFormat: PixelFormat; - - // Compressed texture formats - // DDS / ST3C Compressed texture formats - export enum CompressedPixelFormat { } - export var RGB_S3TC_DXT1_Format: CompressedPixelFormat; - export var RGBA_S3TC_DXT1_Format: CompressedPixelFormat; - export var RGBA_S3TC_DXT3_Format: CompressedPixelFormat; - export var RGBA_S3TC_DXT5_Format: CompressedPixelFormat; - - // PVRTC compressed texture formats - export var RGB_PVRTC_4BPPV1_Format: CompressedPixelFormat; - export var RGB_PVRTC_2BPPV1_Format: CompressedPixelFormat; - export var RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat; - export var RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat; - - // Loop styles for AnimationAction - export enum AnimationActionLoopStyles { } - export var LoopOnce: AnimationActionLoopStyles; - export var LoopRepeat: AnimationActionLoopStyles; - export var LoopPingPong: AnimationActionLoopStyles; - - // log handlers - export function warn(message?: any, ...optionalParams: any[]): void; - export function error(message?: any, ...optionalParams: any[]): void; - export function log(message?: any, ...optionalParams: any[]): void; - - // Animation //////////////////////////////////////////////////////////////////////////////////////// - export class AnimationAction { - constructor(clip: AnimationClip, startTime?: number, timeScale?: number, weight?: number, loop?: boolean); - - clip: AnimationClip - localRoot: Mesh; - startTime: number; - timeScale: number; - weight: number; - loop: AnimationActionLoopStyles; - loopCount: number; - enabled: boolean; - actionTime: number; - clipTime: number; - propertyBindings: PropertyBinding[]; - - setLocalRoot( localRoot: Mesh ): AnimationAction; - updateTime( clipDeltaTime: number ): number; - syncWith( action: AnimationAction ): AnimationAction; - warpToDuration( duration: number ): AnimationAction; - init( time: number ): AnimationAction; - update( clipDeltaTime: number ): any[]; - getTimeScaleAt( time: number ): number; - getWeightAt( time: number ): number; - } - - export class AnimationClip { - constructor( name: string, duration?: number, tracks?: KeyframeTrack[] ); - - name: string; - tracks: KeyframeTrack[]; - duration: number; - results: any[]; - - getAt(clipTime: number): any[]; - trim(): AnimationClip; - optimize(): AnimationClip; - - static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number ): AnimationClip; - findByName( clipArray: AnimationClip, name: string ): AnimationClip; - static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number ): AnimationClip[]; - parse( json: any ): AnimationClip; - parseAnimation( animation: any, bones: Bone[], nodeName: string ): AnimationClip; - } - - export class AnimationMixer { - constructor( root: any ); - - root: any; - time: number; - timeScale: number; - actions: AnimationAction; - propertyBindingMap: any; - - addAction( action: AnimationAction ): void; - removeAllActions(): AnimationMixer; - removeAction( action: AnimationAction ): AnimationMixer; - findActionByName( name: string ): AnimationAction; - play( action: AnimationAction, optionalFadeInDuration?: number ): AnimationMixer; - fadeOut( action: AnimationAction, duration: number ): AnimationMixer; - fadeIn( action: AnimationAction, duration: number ): AnimationMixer; - warp( action: AnimationAction, startTimeScale: NumberKeyframeTrack, endTimeScale: NumberKeyframeTrack, duration: number ): AnimationMixer; - crossFade( fadeOutAction: AnimationAction, fadeInAction: AnimationAction, duration: number, warp: boolean ): AnimationMixer; - update( deltaTime: number ): AnimationMixer; - } - - export var AnimationUtils: { - getEqualsFunc( exemplarValue: any ): boolean; - clone(exemplarValue: T): T; - lerp( a: any, b: any, alpha: number, interTrack: boolean ): any; - lerp_object( a: any, b: any, alpha: number ): any; - slerp_object( a: any, b: any, alpha: number ): any; - lerp_number( a: any, b: any, alpha: number ): any; - lerp_boolean( a: any, b: any, alpha: number ): any; - lerp_boolean_immediate( a: any, b: any, alpha: number ): any; - lerp_string( a: any, b: any, alpha: number ): any; - lerp_string_immediate( a: any, b: any, alpha: number ): any; - getLerpFunc( exemplarValue: any, interTrack: boolean ): Function; - }; - - export class KeyframeTrack { - constructor(name: string, keys: any[]); - - name: string; - keys: any[]; - lastIndex: number; - - getAt( time: number ): any; - shift( timeOffset: number ): KeyframeTrack; - scale( timeScale: number ): KeyframeTrack; - trim( startTime: number, endTime: number ): KeyframeTrack; - validate(): KeyframeTrack; - optimize(): KeyframeTrack; - - keyComparator(key0: KeyframeTrack, key1: KeyframeTrack): number; - parse( json: any ): KeyframeTrack; - GetTrackTypeForTypeName( typeName: string ): any; - } - - export class PropertyBinding { - constructor( rootNode: any, trackName: string ); - - rootNode: any; - trackName: string; - referenceCount: number; - originalValue: any; - directoryName: string; - nodeName: string; - objectName: string; - objectIndex: number; - propertyName: string; - propertyIndex: number; - node: any; - cumulativeValue: number; - cumulativeWeight: number; - - reset(): void; - accumulate( value: any, weight: number ): void; - unbind(): void; - bind(): void; - apply(): void; - parseTrackName( trackName: string ): any; - findNode( root: any, nodeName: string ): any; - } - - export class BooleanKeyframeTrack extends KeyframeTrack { - constructor(name: string, keys: any[]); - - result: any; - - setResult( value: any ): void; - lerpValues( value0: any, value1: any, alpha: number ): any; - compareValues( value0: any, value1: any ): boolean; - clone(): BooleanKeyframeTrack; - parse( json: any ): BooleanKeyframeTrack; - } - - export class NumberKeyframeTrack { - constructor(); - - result: any; - - setResult( value: any ): void; - lerpValues( value0: any, value1: any, alpha: number ): any; - compareValues( value0: any, value1: any ): boolean; - clone(): NumberKeyframeTrack; - parse( json: any ): NumberKeyframeTrack; - } - - export class QuaternionKeyframeTrack { - constructor(); - - result: any; - - setResult( value: any ): void; - lerpValues( value0: any, value1: any, alpha: number ): any; - compareValues( value0: any, value1: any ): boolean; - clone(): QuaternionKeyframeTrack; - parse( json: any ): QuaternionKeyframeTrack; - } - - export class StringKeyframeTrack { - constructor(); - - result: any; - - setResult( value: any ): void; - lerpValues( value0: any, value1: any, alpha: number ): any; - compareValues( value0: any, value1: any ): boolean; - clone(): StringKeyframeTrack; - parse( json: any ): StringKeyframeTrack; - } - - export class VectorKeyframeTrack { - constructor(); - - result: any; - - setResult( value: any ): void; - lerpValues( value0: any, value1: any, alpha: number ): any; - compareValues( value0: any, value1: any ): boolean; - clone(): VectorKeyframeTrack; - parse( json: any ): VectorKeyframeTrack; - } - - // Cameras //////////////////////////////////////////////////////////////////////////////////////// - - /** - * Abstract base class for cameras. This class should always be inherited when you build a new camera. - */ - export class Camera extends Object3D { - /** - * This constructor sets following properties to the correct type: matrixWorldInverse, projectionMatrix and projectionMatrixInverse. - */ - constructor(); - - /** - * This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera. - */ - matrixWorldInverse: Matrix4; - - /** - * This is the matrix which contains the projection. - */ - projectionMatrix: Matrix4; - - getWorldDirection(optionalTarget?: Vector3): Vector3; - - /** - * This make the camera look at the vector position in local space. - * @param vector point to look at - */ - lookAt(vector: Vector3): void; - - clone(): Camera; - copy(camera?: Camera): Camera; - } - - export class CubeCamera extends Object3D { - constructor( near?: number, far?: number, cubeResolution?: number); - - renderTarget: WebGLRenderTargetCube; - - updateCubeMap( renderer: Renderer, scene: Scene ): void; - - } - - /** - * Camera with orthographic projection - * - * @example - * var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); - * scene.add( camera ); - * - * @see src/cameras/OrthographicCamera.js - */ - export class OrthographicCamera extends Camera { - /** - * @param left Camera frustum left plane. - * @param right Camera frustum right plane. - * @param top Camera frustum top plane. - * @param bottom Camera frustum bottom plane. - * @param near Camera frustum near plane. - * @param far Camera frustum far plane. - */ - constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number); - - zoom: number; - - /** - * Camera frustum left plane. - */ - left: number; - - /** - * Camera frustum right plane. - */ - right: number; - - /** - * Camera frustum top plane. - */ - top: number; - - /** - * Camera frustum bottom plane. - */ - bottom: number; - - /** - * Camera frustum near plane. - */ - near: number; - - /** - * Camera frustum far plane. - */ - far: number; - - /** - * Updates the camera projection matrix. Must be called after change of parameters. - */ - updateProjectionMatrix(): void; - clone(): OrthographicCamera; - copy( source: OrthographicCamera ): OrthographicCamera; - toJSON( meta?: any ): any; - } - - /** - * Camera with perspective projection. - * - * # example - * var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); - * scene.add( camera ); - * - * @source https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js - */ - export class PerspectiveCamera extends Camera { - /** - * @param fov Camera frustum vertical field of view. Default value is 50. - * @param aspect Camera frustum aspect ratio. Default value is 1. - * @param near Camera frustum near plane. Default value is 0.1. - * @param far Camera frustum far plane. Default value is 2000. - */ - constructor(fov?: number, aspect?: number, near?: number, far?: number); - - zoom: number; - - /** - * Camera frustum vertical field of view, from bottom to top of view, in degrees. - */ - fov: number; - - /** - * Camera frustum aspect ratio, window width divided by window height. - */ - aspect: number; - - /** - * Camera frustum near plane. - */ - near: number; - - /** - * Camera frustum far plane. - */ - far: number; - - /** - * Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified. - * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - * @param focalLength focal length - * @param frameHeight frame size. Default value is 24. - */ - setLens(focalLength: number, frameHeight?: number): void; - - /** - * Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this: - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this: - * - * var w = 1920; - * var h = 1080; - * var fullWidth = w * 3; - * var fullHeight = h * 2; - * - * // A - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * // B - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * // C - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * // D - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * // E - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * // F - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); Note there is no reason monitors have to be the same size or in a grid. - * - * @param fullWidth full width of multiview setup - * @param fullHeight full height of multiview setup - * @param x horizontal offset of subcamera - * @param y vertical offset of subcamera - * @param width width of subcamera - * @param height height of subcamera - */ - setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; - - /** - * Updates the camera projection matrix. Must be called after change of parameters. - */ - updateProjectionMatrix(): void; - clone(): PerspectiveCamera; - copy( source: PerspectiveCamera ): PerspectiveCamera; - toJSON( meta?: any ): any; - } - - // Core /////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * @see src/core/BufferAttribute.js - */ - export class BufferAttribute { - constructor(array: Array, itemSize: number); // array parameter should be TypedArray. - - uuid: string; - array: Array; - itemSize: number; - dynamic: boolean; - updateRange: {offset:number, count:number}; - version: number; - - needsUpdate: boolean; - /** Deprecated, use count instead */ - length: number; - count: number; - - setDynamic(dynamic: boolean): BufferAttribute; - clone(): BufferAttribute; - copy(source: BufferAttribute): BufferAttribute; - copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute; - copyArray(array: Array): BufferAttribute; - copyColorsArray(colors: {r:number, g:number, b:number}[]): BufferAttribute; - copyIndicesArray(indices: {a:number, b:number, c:number}[]): BufferAttribute; - copyVector2sArray(vectors: {x:number, y:number}[]): BufferAttribute; - copyVector3sArray(vectors: {x:number, y:number, z:number}[]): BufferAttribute; - copyVector4sArray(vectors: {x:number, y:number, z:number, w:number}[]): BufferAttribute; - set(value: Array, offset?: number): BufferAttribute; - getX(index: number): number; - setX(index: number, x: number): BufferAttribute; - getY(index: number): number; - setY(index: number, y: number): BufferAttribute; - getZ(index: number): number; - setZ(index: number, z: number): BufferAttribute; - getW(index: number): number; - setW(index: number, z: number): BufferAttribute; - setXY(index: number, x: number, y: number): BufferAttribute; - setXYZ(index: number, x: number, y: number, z: number): BufferAttribute; - setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute; - clone(): BufferAttribute; - } - - // deprecated (are these actually deprecated?) - export class Int8Attribute extends BufferAttribute{ - constructor(array: any, itemSize: number); - } - - // deprecated - export class Uint8Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Uint8ClampedAttribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Int16Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Uint16Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Int32Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Uint32Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Float32Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - // deprecated - export class Float64Attribute extends BufferAttribute { - constructor(array: any, itemSize: number); - } - - /** - * This is a superefficent class for geometries because it saves all data in buffers. - * It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the nessecary buffer calculations. - * It is mainly interesting when working with static objects. - * - * @see src/core/BufferGeometry.js - */ - export class BufferGeometry { - /** - * This creates a new BufferGeometry. It also sets several properties to an default value. - */ - constructor(); - - static MaxIndex: number; - - /** - * Unique number of this buffergeometry instance - */ - id: number; - uuid: string; - name: string; - type: string; - index: BufferAttribute; - attributes: BufferAttribute|InterleavedBufferAttribute[]; - morphAttributes: any; - groups: {start: number, count: number, materialIndex?: number}[]; - boundingBox: Box3; - boundingSphere: BoundingSphere; - drawRange: { start: number, count: number }; - - /** Deprecated. */ - addIndex( index: BufferAttribute ): void; - - getIndex(): BufferAttribute; - setIndex( index: BufferAttribute ): void; - - /** Deprecated. This overloaded method is deprecated. */ - addAttribute(name: string, array: any, itemSize: number): any; - addAttribute(name: string, attribute: BufferAttribute|InterleavedBufferAttribute): void; - getAttribute(name: string): BufferAttribute|InterleavedBufferAttribute; - removeAttribute(name: string): void; - - /** Deprecated. */ - drawcalls(): any; - /** Deprecated. */ - offsets(): any; - - /** Deprecated. Use addGroup */ - addDrawCall(start: number, count: number, index?: number): void; - /** Deprecated. */ - clearDrawCalls(): void; - addGroup(start: number, count: number, materialIndex?: number): void; - clearGroups(): void; - - setDrawRange(start: number, count: number): void; - - /** - * Bakes matrix transform directly into vertex coordinates. - */ - applyMatrix(matrix: Matrix4): void; - - rotateX(angle: number): BufferGeometry; - rotateY(angle: number): BufferGeometry; - rotateZ(angle: number): BufferGeometry; - translate(x: number, y: number, z: number): BufferGeometry; - scale(x: number, y: number, z: number): BufferGeometry; - lookAt(v: Vector3): void; - - center(): Vector3; - - setFromObject(object: Object3D) : void; - updateFromObject(object: Object3D) : void; - - fromGeometry(geometry: Geometry, settings?: any): BufferGeometry; - - fromDirectGeometry( geometry: DirectGeometry ): BufferGeometry; - - /** - * Computes bounding box of the geometry, updating Geometry.boundingBox attribute. - * Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null. - */ - computeBoundingBox(): void; - - /** - * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute. - * Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null. - */ - computeBoundingSphere(): void; - - // deprecated - computeFaceNormals(): void; - - /** - * Computes vertex normals by averaging face normals. - */ - computeVertexNormals(): void; - - computeOffsets(size: number): void; - merge(geometry: BufferGeometry, offset: number): BufferGeometry; - normalizeNormals(): void; - toJSON(): any; - clone(): BufferGeometry; - copy(source: BufferGeometry): BufferGeometry; - - /** - * Disposes the object from memory. - * You need to call this when you want the bufferGeometry removed while the application is running. - */ - dispose(): void; - - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - export class Channels { - constructor(); - - mask: number; - - set( channel: number ): void; - enable( channel: number ): void; - toggle( channel: number ): void; - disable( channel: number ): void; - } - - /** - * Object for keeping track of time. - * - * @see src/core/Clock.js - */ - export class Clock { - /** - * @param autoStart Automatically start the clock. - */ - constructor(autoStart?: boolean); - - /** - * If set, starts the clock automatically when the first update is called. - */ - autoStart: boolean; - - /** - * When the clock is running, It holds the starttime of the clock. - * This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. - */ - startTime: number; - - /** - * When the clock is running, It holds the previous time from a update. - * This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. - */ - oldTime: number; - - /** - * When the clock is running, It holds the time elapsed between the start of the clock to the previous update. - * This parameter is in seconds of three decimal places. - */ - elapsedTime: number; - - /** - * This property keeps track whether the clock is running or not. - */ - running: boolean; - - /** - * Starts clock. - */ - start(): void; - - /** - * Stops clock. - */ - stop(): void; - - /** - * Get the seconds passed since the clock started. - */ - getElapsedTime(): number; - - /** - * Get the seconds passed since the last call to this method. - */ - getDelta(): number; - } - - /** - * @see src/core/DirectGeometry.js - */ - export class DirectGeometry { - constructor(); - - id: number; - uuid: string; - name: string; - type: string; - indices: number[]; - vertices: Vector3[]; - normals: Vector3[]; - colors: Color[]; - uvs: Vector2[]; - uvs2: Vector2[]; - groups: {start: number, materialIndex: number}[]; - morphTargets: MorphTarget[]; - skinWeights: number[]; - skinIndices: number[]; - boundingBox: Box3; - boundingSphere: BoundingSphere; - verticesNeedUpdate: boolean; - normalsNeedUpdate: boolean; - colorsNeedUpdate: boolean; - uvsNeedUpdate: boolean; - groupsNeedUpdate: boolean; - - computeBoundingBox(): void; - computeBoundingSphere(): void; - computeGroups(geometry: Geometry): void; - fromGeometry(geometry: Geometry): DirectGeometry; - dispose(): void; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - /** - * JavaScript events for custom objects - * - * # Example - * var Car = function () { - * - * EventDispatcher.call( this ); - * this.start = function () { - * - * this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); - * - * }; - * - * }; - * - * var car = new Car(); - * car.addEventListener( 'start', function ( event ) { - * - * alert( event.message ); - * - * } ); - * car.start(); - * - * @source src/core/EventDispatcher.js - */ - export class EventDispatcher { - /** - * Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object. - */ - constructor(); - - /** - * Adds a listener to an event type. - * @param type The type of the listener that gets removed. - * @param listener The listener function that gets removed. - */ - addEventListener(type: string, listener: (event: any) => void ): void; - - /** - * Adds a listener to an event type. - * @param type The type of the listener that gets removed. - * @param listener The listener function that gets removed. - */ - hasEventListener(type: string, listener: (event: any) => void): void; - - /** - * Removes a listener from an event type. - * @param type The type of the listener that gets removed. - * @param listener The listener function that gets removed. - */ - removeEventListener(type: string, listener: (event: any) => void): void; - - /** - * Fire an event type. - * @param type The type of event that gets fired. - */ - dispatchEvent(event: { type: string; target: any; }): void; - } - - /** - * Triangle face. - * - * # Example - * var normal = new THREE.Vector3( 0, 1, 0 ); - * var color = new THREE.Color( 0xffaa00 ); - * var face = new THREE.Face3( 0, 1, 2, normal, color, 0 ); - * - * @source https://github.com/mrdoob/three.js/blob/master/src/core/Face3.js - */ - export class Face3 { - /** - * @param a Vertex A index. - * @param b Vertex B index. - * @param c Vertex C index. - * @param normal Face normal or array of vertex normals. - * @param color Face color or array of vertex colors. - * @param materialIndex Material index. - */ - constructor(a: number, b: number, c: number, normal?: Vector3, color?: Color, materialIndex?: number); - constructor(a: number, b: number, c: number, normal?: Vector3, vertexColors?: Color[], materialIndex?: number); - constructor(a: number, b: number, c: number, vertexNormals?: Vector3[], color?: Color, materialIndex?: number); - constructor(a: number, b: number, c: number, vertexNormals?: Vector3[], vertexColors?: Color[], materialIndex?: number); - - /** - * Vertex A index. - */ - a: number; - - /** - * Vertex B index. - */ - b: number; - - /** - * Vertex C index. - */ - c: number; - - /** - * Face normal. - */ - normal: Vector3; - - /** - * Array of 4 vertex normals. - */ - vertexNormals: Vector3[]; - - /** - * Face color. - */ - color: Color; - - /** - * Array of 4 vertex normals. - */ - vertexColors: Color[]; - - /** - * Array of 4 vertex tangets. - */ - vertexTangents: number[]; - - /** - * Material index (points to {@link Geometry.materials}). - */ - materialIndex: number; - - clone(): Face3; - } - - export interface MorphTarget { - name: string; - vertices: Vector3[]; - } - - export interface MorphColor { - name: string; - colors: Color[]; - } - - export interface MorphNormals { - name: string; - normals: Vector3[]; - } - - export interface BoundingSphere { - radius: number; - } - - /** - * Base class for geometries - * - * # Example - * var geometry = new THREE.Geometry(); - * geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) ); - * geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) ); - * geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) ); - * geometry.faces.push( new THREE.Face3( 0, 1, 2 ) ); - * geometry.computeBoundingSphere(); - * - * @see https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js - */ - export class Geometry { - constructor(); - - /** - * Unique number of this geometry instance - */ - id: number; - - uuid: string; - - /** - * Name for this geometry. Default is an empty string. - */ - name: string; - - type: string; - - /** - * The array of vertices hold every position of points of the model. - * To signal an update in this array, Geometry.verticesNeedUpdate needs to be set to true. - */ - vertices: Vector3[]; - - /** - * Array of vertex colors, matching number and order of vertices. - * Used in ParticleSystem, Line and Ribbon. - * Meshes use per-face-use-of-vertex colors embedded directly in faces. - * To signal an update in this array, Geometry.colorsNeedUpdate needs to be set to true. - */ - colors: Color[]; - - /** - * Array of triangles or/and quads. - * The array of faces describe how each vertex in the model is connected with each other. - * To signal an update in this array, Geometry.elementsNeedUpdate needs to be set to true. - */ - faces: Face3[]; - - /** - * Array of face UV layers. - * Each UV layer is an array of UV matching order and number of vertices in faces. - * To signal an update in this array, Geometry.uvsNeedUpdate needs to be set to true. - */ - faceVertexUvs: Vector2[][][]; - - /** - * Array of morph targets. Each morph target is a Javascript object: - * - * { name: "targetName", vertices: [ new THREE.Vector3(), ... ] } - * - * Morph vertices match number and order of primary vertices. - */ - morphTargets: MorphTarget[]; - - /** - * Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object: - * - * morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] } - */ - morphNormals: MorphNormals[]; - - /** - * Array of skinning weights, matching number and order of vertices. - */ - skinWeights: number[]; - - /** - * Array of skinning indices, matching number and order of vertices. - */ - skinIndices: number[]; - - /** - * - */ - lineDistances: number[]; - - /** - * Bounding box. - */ - boundingBox: Box3; - - /** - * Bounding sphere. - */ - boundingSphere: BoundingSphere; - - /** - * Set to true if the vertices array has been updated. - */ - verticesNeedUpdate: boolean; - - /** - * Set to true if the faces array has been updated. - */ - elementsNeedUpdate: boolean; - - /** - * Set to true if the uvs array has been updated. - */ - uvsNeedUpdate: boolean; - - /** - * Set to true if the normals array has been updated. - */ - normalsNeedUpdate: boolean; - - /** - * Set to true if the colors array has been updated. - */ - colorsNeedUpdate: boolean; - - /** - * Set to true if the linedistances array has been updated. - */ - lineDistancesNeedUpdate: boolean; - - /** - * - */ - groupsNeedUpdate: boolean; - - /** - * Bakes matrix transform directly into vertex coordinates. - */ - applyMatrix(matrix: Matrix4): void; - - rotateX(angle: number): Geometry; - rotateY(angle: number): Geometry; - rotateZ(angle: number): Geometry; - - translate(x: number, y: number, z: number): Geometry; - scale(x: number, y: number, z: number): Geometry; - lookAt( vector: Vector3 ): void; - - - fromBufferGeometry(geometry: BufferGeometry): Geometry; - - /** - * - */ - center(): Vector3; - - normalize(): Geometry; - - /** - * Computes face normals. - */ - computeFaceNormals(): void; - - /** - * Computes vertex normals by averaging face normals. - * Face normals must be existing / computed beforehand. - */ - computeVertexNormals(areaWeighted?: boolean): void; - - /** - * Computes morph normals. - */ - computeMorphNormals(): void; - - computeLineDistances(): void; - - /** - * Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute. - */ - computeBoundingBox(): void; - - /** - * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute. - * Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are null. - */ - computeBoundingSphere(): void; - - merge( geometry: Geometry, matrix: Matrix, materialIndexOffset?: number): void; - - mergeMesh( mesh: Mesh ): void; - - /** - * Checks for duplicate vertices using hashmap. - * Duplicated vertices are removed and faces' vertices are updated. - */ - mergeVertices(): number; - - sortFacesByMaterialIndex(): void; - - toJSON(): any; - - /** - * Creates a new clone of the Geometry. - */ - clone(): Geometry; - - copy(source: Geometry): Geometry; - - /** - * Removes The object from memory. - * Don't forget to call this method when you remove an geometry because it can cuase meomory leaks. - */ - dispose(): void; - - - //These properties do not exist in a normal Geometry class, but if you use the instance that was passed by JSONLoader, it will be added. - bones: Bone[]; - animation: AnimationClip; - animations: AnimationClip[]; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - /** - * @see src/core/InstancedBufferAttribute.js - */ - export class InstancedBufferAttribute extends BufferAttribute { - constructor(data: Array, itemSize: number, meshPerAttribute?: number); - meshPerAttribute: number; - - clone(): InstancedBufferAttribute; - copy(source: InstancedBufferAttribute): InstancedBufferAttribute; - } - - /** - * @see src/core/InstancedBufferGeometry.js - */ - export class InstancedBufferGeometry extends BufferGeometry { - constructor(); - groups: {start:number, count:number, instances:number}[]; - addGroup(start: number, count: number, instances: number): void; - - clone(): InstancedBufferGeometry; - copy(source: InstancedBufferGeometry): InstancedBufferGeometry; - } - - /** - * @see src/core/InstancedInterleavedBuffer.js - */ - export class InstancedInterleavedBuffer extends InterleavedBuffer { - constructor(array: Array, stride: number, meshPerAttribute?: number); - meshPerAttribute: number; - - clone(): InstancedInterleavedBuffer; - copy(source: InstancedInterleavedBuffer): InstancedInterleavedBuffer; - } - - /** - * @see src/core/InterleavedBuffer.js - */ - export class InterleavedBuffer { - constructor(array: Array, stride: number); - array: Array; - stride: number; - dynamic: boolean; - updateRange: {offset:number, count:number}; - version: number; - length: number; - count: number; - needsUpdate: boolean; - - setDynamic(dynamic: boolean): InterleavedBuffer; - clone(): InterleavedBuffer; - copy(source: InterleavedBuffer): InterleavedBuffer; - copyAt(index1: number, attribute: InterleavedBufferAttribute, index2: number): InterleavedBuffer; - set(value: Array, index: number): InterleavedBuffer; - clone(): InterleavedBuffer; - } - - /** - * @see src/core/InterleavedBufferAttribute.js - */ - export class InterleavedBufferAttribute { - constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number); - - uuid: string; - data: InterleavedBuffer; - itemSize: number; - offset: number; - /** Deprecated, use count instead */ - length: number; - count: number; - - getX(index: number): number; - setX(index: number, x: number): InterleavedBufferAttribute; - getY(index: number): number; - setY(index: number, y: number): InterleavedBufferAttribute; - getZ(index: number): number; - setZ(index: number, z: number): InterleavedBufferAttribute; - getW(index: number): number; - setW(index: number, z: number): InterleavedBufferAttribute; - setXY(index: number, x: number, y: number): InterleavedBufferAttribute; - setXYZ(index: number, x: number, y: number, z: number): InterleavedBufferAttribute; - setXYZW(index: number, x: number, y: number, z: number, w: number): InterleavedBufferAttribute; - } - - /** - * Base class for scene graph objects - */ - export class Object3D { - constructor(); - - /** - * Unique number of this object instance. - */ - id: number; - - /** - * - */ - uuid: string; - - /** - * Optional name of the object (doesn't need to be unique). - */ - name: string; - - type: string; - - /** - * Object's parent in the scene graph. - */ - parent: Object3D; - - channels: Channels; - - /** - * Array with object's children. - */ - children: Object3D[]; - - /** - * Up direction. - */ - up: Vector3; - - /** - * Object's local position. - */ - position: Vector3; - - /** - * Object's local rotation (Euler angles), in radians. - */ - rotation: Euler; - - /** - * Global rotation. - */ - quaternion: Quaternion; - - /** - * Object's local scale. - */ - scale: Vector3; - - modelViewMatrix: Matrix4; - - normalMatrix: Matrix3; - - /** - * When this is set, then the rotationMatrix gets calculated every frame. - */ - rotationAutoUpdate: boolean; - - /** - * Local transform. - */ - matrix: Matrix4; - - /** - * The global transform of the object. If the Object3d has no parent, then it's identical to the local transform. - */ - matrixWorld: Matrix4; - - /** - * When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property. - */ - matrixAutoUpdate: boolean; - - /** - * When this is set, it calculates the matrixWorld in that frame and resets this property to false. - */ - matrixWorldNeedsUpdate: boolean; - - /** - * Object gets rendered if true. - */ - visible: boolean; - - /** - * Gets rendered into shadow map. - */ - castShadow: boolean; - - /** - * Material gets baked in shadow receiving. - */ - receiveShadow: boolean; - - /** - * When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible. - */ - frustumCulled: boolean; - - renderOrder: number; - - /** - * An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned. - */ - userData: any; - - /** - * - */ - static DefaultUp: Vector3; - static DefaultMatrixAutoUpdate: Vector3; - - /** - * This updates the position, rotation and scale with the matrix. - */ - applyMatrix(matrix: Matrix4): void; - - /** - * - */ - setRotationFromAxisAngle(axis: Vector3, angle: number): void; - - /** - * - */ - setRotationFromEuler(euler: Euler ): void; - - /** - * - */ - setRotationFromMatrix(m: Matrix4): void; - - /** - * - */ - setRotationFromQuaternion( q: Quaternion ): void; - - /** - * Rotate an object along an axis in object space. The axis is assumed to be normalized. - * @param axis A normalized vector in object space. - * @param angle The angle in radians. - */ - rotateOnAxis(axis: Vector3, angle: number): Object3D; - - /** - * - * @param angle - */ - rotateX(angle: number): Object3D; - - /** - * - * @param angle - */ - rotateY(angle: number): Object3D; - - /** - * - * @param angle - */ - rotateZ(angle: number): Object3D; - - /** - * @param axis A normalized vector in object space. - * @param distance The distance to translate. - */ - translateOnAxis(axis: Vector3, distance: number): Object3D; - - /** - * - * @param distance - * @param axis - */ - translate( distance: number, axis: Vector3 ): Object3D; - - /** - * Translates object along x axis by distance. - * @param distance Distance. - */ - translateX(distance: number): Object3D; - - /** - * Translates object along y axis by distance. - * @param distance Distance. - */ - translateY(distance: number): Object3D; - - /** - * Translates object along z axis by distance. - * @param distance Distance. - */ - translateZ(distance: number): Object3D; - - /** - * Updates the vector from local space to world space. - * @param vector A local vector. - */ - localToWorld(vector: Vector3): Vector3; - - /** - * Updates the vector from world space to local space. - * @param vector A world vector. - */ - worldToLocal(vector: Vector3): Vector3; - - /** - * Rotates object to face point in space. - * @param vector A world vector to look at. - */ - lookAt(vector: Vector3): void; - - /** - * Adds object as child of this object. - */ - add(object: Object3D): void; - - /** - * Removes object as child of this object. - */ - remove(object: Object3D): void; - - /* deprecated */ - getChildByName( name: string ): Object3D; - - /** - * Searches through the object's children and returns the first with a matching id, optionally recursive. - * @param id Unique number of the object instance - */ - getObjectById(id: number): Object3D; - - /** - * Searches through the object's children and returns the first with a matching name, optionally recursive. - * @param name String to match to the children's Object3d.name property. - */ - getObjectByName(name: string): Object3D; - - getObjectByProperty( name: string, value: string ): Object3D; - - getWorldPosition(optionalTarget?: Vector3): Vector3; - getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; - getWorldRotation(optionalTarget?: Euler): Euler; - getWorldScale(optionalTarget?: Vector3): Vector3; - getWorldDirection(optionalTarget?: Vector3): Vector3; - - raycast(raycaster: Raycaster, intersects: any): void; - - traverse(callback: (object: Object3D) => void): void; - - traverseVisible(callback: (object: Object3D) => void): void; - - traverseAncestors(callback: (object: Object3D) => void): void; - - /** - * Updates local transform. - */ - updateMatrix(): void; - - /** - * Updates global transform of the object and its children. - */ - updateMatrixWorld(force: boolean): void; - - toJSON(meta?: any): any; - - clone(recursive?: boolean): Object3D; - - /** - * - * @param object - * @param recursive - */ - copy(source: Object3D, recursive?: boolean): Object3D; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - - } - - export interface Intersection { - distance: number; - point: Vector3; - face: Face3; - object: Object3D; - } - - export interface RaycasterParameters { - Mesh?: any; - Line?: any; - LOD?: any; - Points?: any; - Sprite?: any; - } - - export class Raycaster { - constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number); - - ray: Ray; - near: number; - far: number; - params: RaycasterParameters; - precision: number; - linePrecision: number; - set(origin: Vector3, direction: Vector3): void; - setFromCamera(coords: { x: number; y: number;}, camera: Camera ): void; - intersectObject(object: Object3D, recursive?: boolean): Intersection[]; - intersectObjects(objects: Object3D[], recursive?: boolean): Intersection[]; - } - - // Lights ////////////////////////////////////////////////////////////////////////////////// - - /** - * Abstract base class for lights. - */ - export class Light extends Object3D { - constructor(hex?: number|string); - - color: Color; - receiveShadow: boolean; - - shadowCameraFov: number; - shadowCameraLeft: number; - shadowCameraRight: number; - shadowCameraTop: number; - shadowCameraBottom: number; - shadowCameraNear: number; - shadowCameraFar: number; - shadowBias: number; - shadowDarkness: number; - shadowMapWidth: number; - shadowMapHeight: number; - - clone(recursive?: boolean): Light; - copy( source: Light ): Light; - toJSON( meta: any ): any; - } - - export class LightShadow { - constructor(camera: Camera); - - camera: Camera; - bias: number; - darkness: number; - mapSize: Vector2; - map: RenderTarget; - matrix: Matrix4; - - copy(source: LightShadow): void; - clone(): LightShadow; - } - - /** - * This light's color gets applied to all the objects in the scene globally. - * - * # example - * var light = new THREE.AmbientLight( 0x404040 ); // soft white light - * scene.add( light ); - * - * @source https://github.com/mrdoob/three.js/blob/master/src/lights/AmbientLight.js - */ - export class AmbientLight extends Light { - /** - * This creates a Ambientlight with a color. - * @param hex Numeric value of the RGB component of the color. - */ - constructor(hex?: number|string); - - clone(recursive?: boolean): AmbientLight; - copy(source: AmbientLight): AmbientLight; - } - - /** - * Affects objects using MeshLambertMaterial or MeshPhongMaterial. - * - * @example - * // White directional light at half intensity shining from the top. - * var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); - * directionalLight.position.set( 0, 1, 0 ); - * scene.add( directionalLight ); - * - * @see src/lights/DirectionalLight.js - */ - export class DirectionalLight extends Light { - - constructor(hex?: number|string, intensity?: number); - - /** - * Target used for shadow camera orientation. - */ - target: Object3D; - - /** - * Light's intensity. - * Default — 1.0. - */ - intensity: number; - - shadow: LightShadow; - - clone(recursive?: boolean): DirectionalLight; - copy(source: DirectionalLight): DirectionalLight; - } - - export class HemisphereLight extends Light { - constructor(skyColorHex?: number|string, groundColorHex?: number|string, intensity?: number); - - groundColor: Color; - intensity: number; - - clone(recursive?: boolean): HemisphereLight; - copy(source: HemisphereLight): HemisphereLight; - } - - /** - * Affects objects using {@link MeshLambertMaterial} or {@link MeshPhongMaterial}. - * - * @example - * var light = new THREE.PointLight( 0xff0000, 1, 100 ); - * light.position.set( 50, 50, 50 ); - * scene.add( light ); - */ - export class PointLight extends Light { - constructor(hex?: number|string, intensity?: number, distance?: number, decay?: number); - - /* - * Light's intensity. - * Default - 1.0. - */ - intensity: number; - - /** - * If non-zero, light will attenuate linearly from maximum intensity at light position down to zero at distance. - * Default — 0.0. - */ - distance: number; - - decay: number; - - shadow: LightShadow; - - clone(recursive?: boolean): PointLight; - copy(source: PointLight): PointLight; - } - - /** - * A point light that can cast shadow in one direction. - */ - export class SpotLight extends Light { - constructor(hex?: number|string, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); - - /** - * Spotlight focus points at target.position. - * Default position — (0,0,0). - */ - target: Object3D; - - /** - * Light's intensity. - * Default — 1.0. - */ - intensity: number; - - /** - * If non-zero, light will attenuate linearly from maximum intensity at light position down to zero at distance. - * Default — 0.0. - */ - distance: number; - - /* - * Maximum extent of the spotlight, in radians, from its direction. - * Default — Math.PI/2. - */ - angle: number; - - /** - * Rapidity of the falloff of light from its target direction. - * Default — 10.0. - */ - exponent: number; - - decay: number; - - shadow: LightShadow; - - clone(recursive?: boolean): SpotLight; - copy(source: PointLight): SpotLight; - } - - // Loaders ////////////////////////////////////////////////////////////////////////////////// - - export interface Progress { - total: number; - loaded: number; - } - - /** - * Base class for implementing loaders. - * - * Events: - * load - * Dispatched when the image has completed loading - * content — loaded image - * - * error - * - * Dispatched when the image can't be loaded - * message — error message - */ - export class Loader { - constructor(); - - /** - * Will be called when load starts. - * The default is a function with empty body. - */ - onLoadStart: () => void; - - /** - * Will be called while load progresses. - * The default is a function with empty body. - */ - onLoadProgress: () => void; - - /** - * Will be called when load completes. - * The default is a function with empty body. - */ - onLoadComplete: () => void; - - /** - * default — null. - * If set, assigns the crossOrigin attribute of the image to the value of crossOrigin, prior to starting the load. - */ - crossOrigin: string; - - extractUrlBase(url: string): string; - initMaterials(materials: Material[], texturePath: string): Material[]; - createMaterial(m: Material, texturePath: string, crossOrigin?: string): boolean; - - static Handlers: LoaderHandler; - } - - export interface LoaderHandler{ - handlers:any[]; - add(regex:string, loader:Loader):void; - get(file: string):Loader; - } - - export class BinaryTextureLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - load(url: string, onLoad: (dataTexture: DataTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - } - - export class BufferGeometryLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - load(url: string, onLoad: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - parse(json: any): BufferGeometry; - } - - export interface Cache { - enabled: boolean; - files: any[]; - - add(key: string, file: any): void; - get(key: string): any; - remove(key: string): void; - clear(): void; - } - export var Cache: Cache; - - export class CompressedTextureLoader{ - constructor(manager?: LoadingManager); - - manager: LoadingManager; - load(url: string, onLoad: (texture: CompressedTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - } - - export class CubeTextureLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - - } - - /** - * A loader for loading an image. - * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. - */ - export class ImageLoader { - constructor(manager?: LoadingManager); - - cache: Cache; - manager: LoadingManager; - crossOrigin: string; - - /** - * Begin loading from url - * @param url - */ - load(url: string, onLoad?: (image: HTMLImageElement) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): HTMLImageElement; - - setCrossOrigin(crossOrigin: string): void; - } - - /** - * A loader for loading objects in JSON format. - */ - export class JSONLoader extends Loader { - constructor(manager?: LoadingManager); - manager: LoadingManager; - withCredentials: boolean; - - load(url: string, onLoad?: (geometry: Geometry, materials: Material[]) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - - setCrossOrigin(crossOrigin: string): void; - setTexturePath( value: string ): void; - parse(json: any, texturePath?: string): { geometry: Geometry; materials?: Material[] }; - } - - /** - * Handles and keeps track of loaded and pending data. - */ - export class LoadingManager { - constructor(onLoad?: () => void, onProgress?: (url: string, loaded: number, total: number) => void, onError?: () => void); - - onStart: () => void; - - /** - * Will be called when load starts. - * The default is a function with empty body. - */ - onLoad: () => void; - - /** - * Will be called while load progresses. - * The default is a function with empty body. - */ - onProgress: (item: any, loaded: number, total: number) => void; - - /** - * Will be called when each element in the scene completes loading. - * The default is a function with empty body. - */ - onError: () => void; - - itemStart(url: string): void; - itemEnd(url: string): void; - itemError(url: string): void; - } - - export var DefaultLoadingManager: LoadingManager; - - export class MaterialLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - textures: { [key:string]:Texture }; - - load(url: string, onLoad: (material: Material) => void): void; - setCrossOrigin(crossOrigin: string): void; - setTextures(textures: { [key:string]:Texture }): void; - getTexture( name: string ):Texture; - parse(json: any): Material; - } - - export class ObjectLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - texturePass: string; - - load(url: string, onLoad?: (object: Object3D) => void): void; - setTexturePath( value: string ): void; - setCrossOrigin(crossOrigin: string): void; - parse(json: any, onLoad?: (object: Object3D) => void): T; - parseGeometries(json: any): any[]; // Array of BufferGeometry or Geometry or Geometry2. - parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial. - parseImages( json: any, onLoad: () => void ): any[]; - parseTextures( json: any, images: any ): Texture[]; - parseObject(data: any, geometries: any[], materials: Material[]): T; - - } - - /** - * Class for loading a texture. - * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. - */ - export class TextureLoader { - constructor(manager?: LoadingManager); - - manager: LoadingManager; - crossOrigin: string; - - /** - * Begin loading from url - * - * @param url - */ - load(url: string, onLoad?: (texture: Texture) => void): Texture; - setCrossOrigin(crossOrigin: string): void; - } - - export class XHRLoader { - constructor(manager?: LoadingManager); - - cache: Cache; - manager: LoadingManager; - responseType: string; - crossOrigin: string; - - load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): any; - setResponseType(responseType: string): void; - setCrossOrigin(crossOrigin: string): void; - setWithCredentials( withCredentials: string ): void; - } - - // Materials ////////////////////////////////////////////////////////////////////////////////// - export interface MaterialParameters { - name?: string; - side?: Side; - opacity?: number; - transparent?: boolean; - blending?: Blending; - blendSrc?: BlendingDstFactor; - blendDst?: BlendingSrcFactor; - blendEquation?: BlendingEquation; - depthTest?: boolean; - depthWrite?: boolean; - polygonOffset?: boolean; - polygonOffsetFactor?: number; - polygonOffsetUnits?: number; - alphaTest?: number; - overdraw?: number; - visible?: boolean; - needsUpdate?: boolean; - } - - /** - * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer. - */ - export class Material { - constructor(); - - /** - * Unique number of this material instance. - */ - id: number; - - uuid: string; - - /** - * Material name. Default is an empty string. - */ - name: string; - - type: string; - - /** - * Defines which of the face sides will be rendered - front, back or both. - * Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide. - */ - side: Side; - - /** - * Opacity. Default is 1. - */ - opacity: number; - - /** - * Defines whether this material is transparent. This has an effect on rendering, as transparent objects need an special treatment, and are rendered after the opaque (i.e. non transparent) objects. For a working example of this behaviour, check the {@link WebGLRenderer} code. - * Default is false. - */ - transparent: boolean; - - /** - * Which blending to use when displaying objects with this material. Default is {@link NormalBlending}. - */ - blending: Blending; - - /** - * Blending source. It's one of the blending mode constants defined in Three.js. Default is {@link SrcAlphaFactor}. - */ - blendSrc: BlendingDstFactor; - - /** - * Blending destination. It's one of the blending mode constants defined in Three.js. Default is {@link OneMinusSrcAlphaFactor}. - */ - blendDst: BlendingSrcFactor; - - /** - * Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation. - */ - blendEquation: BlendingEquation; - - blendSrcAlpha: number; - blendDstAlpha: number; - blendEquationAlpha: number; - - depthFunc: DepthModes; - - /** - * Whether to have depth test enabled when rendering this material. Default is true. - */ - depthTest: boolean; - - /** - * Whether rendering this material has any effect on the depth buffer. Default is true. - * When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts. - */ - depthWrite: boolean; - - colorWrite: boolean; - - precision: any; - - /** - * Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature. - */ - polygonOffset: boolean; - - /** - * Sets the polygon offset factor. Default is 0. - */ - polygonOffsetFactor: number; - - /** - * Sets the polygon offset units. Default is 0. - */ - polygonOffsetUnits: number; - - /** - * Sets the alpha value to be used when running an alpha test. Default is 0. - */ - alphaTest: number; - - /** - * Enables/disables overdraw. If greater than zero, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the CanvasRenderer. Default is 0. - */ - overdraw: number; - - /** - * Defines whether this material is visible. Default is true. - */ - visible: boolean; - - /** - * Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. - * This property is automatically set to true when instancing a new material. - */ - needsUpdate: boolean; - - setValues(values: Object): void; - toJSON(meta?: any): any; - clone(): Material; - clone(source?:Material): Material; - update(): void; - dispose(): void; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - export interface LineBasicMaterialParameters extends MaterialParameters { - color?: number|string; - linewidth?: number; - linecap?: string; - linejoin?: string; - vertexColors?: Colors; - fog?: boolean; - } - - export class LineBasicMaterial extends Material { - constructor(parameters?: LineBasicMaterialParameters); - - color: Color; - linewidth: number; - linecap: string; - linejoin: string; - vertexColors: Colors; - fog: boolean; - - clone(): LineBasicMaterial; - copy(source: LineBasicMaterial): LineBasicMaterial; - } - - export interface LineDashedMaterialParameters extends MaterialParameters { - color?: number|string; - linewidth?: number; - scale?: number; - dashSize?: number; - gapSize?: number; - vertexColors?: Colors; - fog?: boolean; - } - - export class LineDashedMaterial extends Material { - constructor(parameters?: LineDashedMaterialParameters); - - color: Color; - linewidth: number; - scale: number; - dashSize: number; - gapSize: number; - vertexColors: Colors; - fog: boolean; - - clone(): LineDashedMaterial; - copy(source: LineDashedMaterial): LineDashedMaterial; - } - - /** - * parameters is an object with one or more properties defining the material's appearance. - */ - export interface MeshBasicMaterialParameters extends MaterialParameters{ - color?: number|string; - opacity?: number; - map?: Texture; - aoMap?: Texture; - aoMapIntensity?: number; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; - combine?: Combine; - reflectivity?: number; - refractionRatio?: number; - shading?: Shading; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - wireframe?: boolean; - wireframeLinewidth?: number; - vertexColors?: Colors; - skinning?: boolean; - morphTargets?: boolean; - fog?: boolean; - } - - export class MeshBasicMaterial extends Material { - constructor(parameters?: MeshBasicMaterialParameters); - - color: Color; - map: Texture; - aoMap: Texture; - aoMapIntensity: number; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; - combine: Combine; - reflectivity: number; - refractionRatio: number; - fog: boolean; - shading: Shading; - wireframe: boolean; - wireframeLinewidth: number; - wireframeLinecap: string; - wireframeLinejoin: string; - vertexColors: Colors; - skinning: boolean; - morphTargets: boolean; - - clone(): MeshBasicMaterial; - copy(source: MeshBasicMaterial): MeshBasicMaterial; - } - - export interface MeshDepthMaterialParameters extends MaterialParameters{ - wireframe?: boolean; - wireframeLinewidth?: number; - } - - export class MeshDepthMaterial extends Material { - constructor(parameters?: MeshDepthMaterialParameters); - - wireframe: boolean; - wireframeLinewidth: number; - - clone(): MeshDepthMaterial; - copy(source: MeshDepthMaterial): MeshDepthMaterial; - } - - export interface MeshLambertMaterialParameters extends MaterialParameters{ - color?: number|string; - emissive?: number; - opacity?: number; - map?: Texture; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; - combine?: Combine; - reflectivity?: number; - refractionRatio?: number; - fog?: boolean; - wireframe?: boolean; - wireframeLinewidth?: number; - vertexColors?: Colors; - skinning?: boolean; - morphTargets?: boolean; - morphNormals?: boolean; - } - - export class MeshLambertMaterial extends Material { - constructor(parameters?: MeshLambertMaterialParameters); - - color: Color; - emissive: Color; - map: Texture; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; - combine: Combine; - reflectivity: number; - refractionRatio: number; - fog: boolean; - wireframe: boolean; - wireframeLinewidth: number; - wireframeLinecap: string; - wireframeLinejoin: string; - vertexColors: Colors; - skinning: boolean; - morphTargets: boolean; - morphNormals: boolean; - - clone(): MeshLambertMaterial; - copy(source: MeshLambertMaterial): MeshLambertMaterial; - } - - export interface MeshNormalMaterialParameters extends MaterialParameters{ - opacity?: number; - shading?: Shading; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - - /** Render geometry as wireframe. Default is false (i.e. render as smooth shaded). */ - wireframe?: boolean; - /** Controls wireframe thickness. Default is 1. */ - wireframeLinewidth?: number; - - } - - export class MeshNormalMaterial extends Material { - constructor(parameters?: MeshNormalMaterialParameters); - - wireframe: boolean; - wireframeLinewidth: number; - morphTargets: boolean; - - clone(): MeshNormalMaterial; - copy(source: MeshNormalMaterial): MeshNormalMaterial; - } - - export interface MeshPhongMaterialParameters extends MaterialParameters { - /** geometry color in hexadecimal. Default is 0xffffff. */ - color?: number | string; - emissive?: number; - specular?: number; - shininess?: number; - opacity?: number; - map?: Texture; - lightMap?: Texture; - lightMapIntensity?: number; - aoMap?: Texture; - aoMapIntensity?: number; - emissiveMap?: Texture; - bumpMap?: Texture; - bumpScale?: number; - normalMap?: Texture; - normalScale?: Vector2; - displacementMap?: Texture; - displacementScale?: number; - displacementBias?: number; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; - combine?: Combine; - reflectivity?: number; - refractionRatio?: number; - shading?: Shading; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - wireframe?: boolean; - wireframeLinewidth?: number; - vertexColors?: Colors; - skinning?: boolean; - morphTargets?: boolean; - morphNormals?: boolean; - fog?: boolean; - } - - export class MeshPhongMaterial extends Material { - constructor(parameters?: MeshPhongMaterialParameters); - - color: Color; // diffuse - emissive: Color; - specular: Color; - shininess: number; - metal: boolean; - map: Texture; - lightMap: Texture; - lightMapIntensity: number; - aoMap: Texture; - aoMapIntensity: number; - emissiveMap: Texture; - bumpMap: Texture; - bumpScale: number; - normalMap: Texture; - normalScale: Vector2; - displacementMap: Texture; - displacementScale: number; - displacementBias: number; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; - combine: Combine; - reflectivity: number; - refractionRatio: number; - fog: boolean; - shading: Shading; - wireframe: boolean; - wireframeLinewidth: number; - wireframeLinecap: string; - wireframeLinejoin: string; - vertexColors: Colors; - skinning: boolean; - morphTargets: boolean; - morphNormals: boolean; - - clone(): MeshPhongMaterial; - copy(source: MeshPhongMaterial): MeshPhongMaterial; - } - - // MultiMaterial does not inherit the Material class in the original code. However, it should treat as Material class. - // See tests/canvas/canvas_materials.ts. - export class MultiMaterial extends Material { - constructor(materials?: Material[]); - materials: Material[]; - - toJSON(): any; - clone(): MultiMaterial; - } - - // deprecated - export class MeshFaceMaterial extends MultiMaterial { - - } - - export interface PointsMaterialParameters extends MaterialParameters{ - color?: number|string; - opacity?: number; - map?: Texture; - size?: number; - sizeAttenuation?: boolean; - blending?: Blending, - depthTest?: boolean; - depthWrite?: boolean; - vertexColors?: Colors; - fog?: boolean; - } - - export class PointsMaterial extends Material { - constructor(parameters?: PointsMaterialParameters); - - color: Color; - map: Texture; - size: number; - sizeAttenuation: boolean; - vertexColors: boolean; - fog: boolean; - - clone(): PointsMaterial; - copy(source: PointsMaterial): PointsMaterial; - } - - export class RawShaderMaterial extends ShaderMaterial { - constructor(parameters?: ShaderMaterialParameters); - } - - export interface ShaderMaterialParameters extends MaterialParameters { - defines?: any; - uniforms?: any; - fragmentShader?: string; - vertexShader?: string; - shading?: Shading; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - wireframe?: boolean; - wireframeLinewidth?: number; - lights?: boolean; - vertexColors?: Colors; - skinning?: boolean; - morphTargets?: boolean; - morphNormals?: boolean; - fog?: boolean; - } - - export class ShaderMaterial extends Material { - constructor(parameters?: ShaderMaterialParameters); - - defines: any; - uniforms: any; - vertexShader: string; - fragmentShader: string; - shading: Shading; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - vertexColors: Colors; - skinning: boolean; - morphTargets: boolean; - morphNormals: boolean; - derivatives: boolean; - defaultAttributeValues: any; - index0AttributeName: string; - - clone(): ShaderMaterial; - copy(source: ShaderMaterial): ShaderMaterial; - toJSON(meta: any): any; - } - - export interface SpriteMaterialParameters extends MaterialParameters { - color?: number|string; - opacity?: number; - map?: Texture; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - uvOffset?: Vector2; - uvScale?: Vector2; - fog?: boolean; - } - - export class SpriteMaterial extends Material { - constructor(parameters?: SpriteMaterialParameters); - - color: Color; - map: Texture; - rotation: number; - fog: boolean; - - clone(): SpriteMaterial; - copy(source: SpriteMaterial): SpriteMaterial; - } - - // Math ////////////////////////////////////////////////////////////////////////////////// - - export class Box2 { - constructor(min?: Vector2, max?: Vector2); - - max: Vector2; - min: Vector2; - - set(min: Vector2, max: Vector2): Box2; - setFromPoints(points: Vector2[]): Box2; - setFromCenterAndSize(center: Vector2, size: Vector2): Box2; - clone(): Box2; - copy(box: Box2): Box2; - makeEmpty(): Box2; - empty(): boolean; - center(optionalTarget?: Vector2): Vector2; - size(optionalTarget?: Vector2): Vector2; - expandByPoint(point: Vector2): Box2; - expandByVector(vector: Vector2): Box2; - expandByScalar(scalar: number): Box2; - containsPoint(point: Vector2): boolean; - containsBox(box: Box2): boolean; - getParameter(point: Vector2): Vector2; - isIntersectionBox(box: Box2): boolean; - clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2; - distanceToPoint(point: Vector2): number; - intersect(box: Box2): Box2; - union(box: Box2): Box2; - translate(offset: Vector2): Box2; - equals(box: Box2): boolean; - } - - export class Box3 { - constructor(min?: Vector3, max?: Vector3); - - max: Vector3; - min: Vector3; - - set(min: Vector3, max: Vector3): Box3; - setFromPoints(points: Vector3[]): Box3; - setFromCenterAndSize(center: Vector3, size: Vector3): Box3; - setFromObject(object: Object3D): Box3; - clone(): Box3; - copy(box: Box3): Box3; - makeEmpty(): Box3; - empty(): boolean; - center(optionalTarget?: Vector3): Vector3; - size(optionalTarget?: Vector3): Vector3; - expandByPoint(point: Vector3): Box3; - expandByVector(vector: Vector3): Box3; - expandByScalar(scalar: number): Box3; - containsPoint(point: Vector3): boolean; - containsBox(box: Box3): boolean; - getParameter(point: Vector3): Vector3; - isIntersectionBox(box: Box3): boolean; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - distanceToPoint(point: Vector3): number; - getBoundingSphere(optionalTarget?: Sphere): Sphere; - intersect(box: Box3): Box3; - union(box: Box3): Box3; - applyMatrix4(matrix: Matrix4): Box3; - translate(offset: Vector3): Box3; - equals(box: Box3): boolean; - } - - export interface HSL { - h: number; - s: number; - l: number; - } - - /** - * Represents a color. See also {@link ColorUtils}. - * - * @example - * var color = new THREE.Color( 0xff0000 ); - * - * @see src/math/Color.js - */ - export class Color { - constructor(color?: Color); - constructor(color?: string); - constructor(color?: number); - constructor(r: number, g: number, b: number); - - /** - * Red channel value between 0 and 1. Default is 1. - */ - r: number; - - /** - * Green channel value between 0 and 1. Default is 1. - */ - g: number; - - /** - * Blue channel value between 0 and 1. Default is 1. - */ - b: number; - - set(color: Color): Color; - set(color: number): Color; - set(color: string): Color; - setHex(hex: number): Color; - - /** - * Sets this color from RGB values. - * @param r Red channel value between 0 and 1. - * @param g Green channel value between 0 and 1. - * @param b Blue channel value between 0 and 1. - */ - setRGB(r: number, g: number, b: number): Color; - - /** - * Sets this color from HSL values. - * Based on MochiKit implementation by Bob Ippolito. - * - * @param h Hue channel value between 0 and 1. - * @param s Saturation value channel between 0 and 1. - * @param l Value channel value between 0 and 1. - */ - setHSL(h: number, s: number, l: number): Color; - - /** - * Sets this color from a CSS context style string. - * @param contextStyle Color in CSS context style format. - */ - setStyle(style: string): Color; - - /** - * Clones this color. - */ - clone(): Color; - - /** - * Copies given color. - * @param color Color to copy. - */ - copy(color: Color): Color; - - /** - * Copies given color making conversion from gamma to linear space. - * @param color Color to copy. - */ - copyGammaToLinear(color: Color, gammaFactor?: number): Color; - - /** - * Copies given color making conversion from linear to gamma space. - * @param color Color to copy. - */ - copyLinearToGamma(color: Color, gammaFactor?: number): Color; - - /** - * Converts this color from gamma to linear space. - */ - convertGammaToLinear(): Color; - - /** - * Converts this color from linear to gamma space. - */ - convertLinearToGamma(): Color; - - /** - * Returns the hexadecimal value of this color. - */ - getHex(): number; - - /** - * Returns the string formated hexadecimal value of this color. - */ - getHexString(): string; - - getHSL(): HSL; - - /** - * Returns the value of this color in CSS context style. - * Example: rgb(r, g, b) - */ - getStyle(): string; - - offsetHSL(h: number, s: number, l: number): Color; - - add(color: Color): Color; - addColors(color1: Color, color2: Color): Color; - addScalar(s: number): Color; - multiply(color: Color): Color; - multiplyScalar(s: number): Color; - lerp(color: Color, alpha: number): Color; - equals(color: Color): boolean; - fromArray(rgb: number[], offset?: number): Color; - toArray(array?: number[], offset?: number): number[]; - } - - export class ColorKeywords { - static aliceblue: number; - static antiquewhite: number; - static aqua: number; - static aquamarine: number; - static azure: number; - static beige: number; - static bisque: number; - static black: number; - static blanchedalmond: number; - static blue: number; - static blueviolet: number; - static brown: number; - static burlywood: number; - static cadetblue: number; - static chartreuse: number; - static chocolate: number; - static coral: number; - static cornflowerblue: number; - static cornsilk: number; - static crimson: number; - static cyan: number; - static darkblue: number; - static darkcyan: number; - static darkgoldenrod: number; - static darkgray: number; - static darkgreen: number; - static darkgrey: number; - static darkkhaki: number; - static darkmagenta: number; - static darkolivegreen: number; - static darkorange: number; - static darkorchid: number; - static darkred: number; - static darksalmon: number; - static darkseagreen: number; - static darkslateblue: number; - static darkslategray: number; - static darkslategrey: number; - static darkturquoise: number; - static darkviolet: number; - static deeppink: number; - static deepskyblue: number; - static dimgray: number; - static dimgrey: number; - static dodgerblue: number; - static firebrick: number; - static floralwhite: number; - static forestgreen: number; - static fuchsia: number; - static gainsboro: number; - static ghostwhite: number; - static gold: number; - static goldenrod: number; - static gray: number; - static green: number; - static greenyellow: number; - static grey: number; - static honeydew: number; - static hotpink: number; - static indianred: number; - static indigo: number; - static ivory: number; - static khaki: number; - static lavender: number; - static lavenderblush: number; - static lawngreen: number; - static lemonchiffon: number; - static lightblue: number; - static lightcoral: number; - static lightcyan: number; - static lightgoldenrodyellow: number; - static lightgray: number; - static lightgreen: number; - static lightgrey: number; - static lightpink: number; - static lightsalmon: number; - static lightseagreen: number; - static lightskyblue: number; - static lightslategray: number; - static lightslategrey: number; - static lightsteelblue: number; - static lightyellow: number; - static lime: number; - static limegreen: number; - static linen: number; - static magenta: number; - static maroon: number; - static mediumaquamarine: number; - static mediumblue: number; - static mediumorchid: number; - static mediumpurple: number; - static mediumseagreen: number; - static mediumslateblue: number; - static mediumspringgreen: number; - static mediumturquoise: number; - static mediumvioletred: number; - static midnightblue: number; - static mintcream: number; - static mistyrose: number; - static moccasin: number; - static navajowhite: number; - static navy: number; - static oldlace: number; - static olive: number; - static olivedrab: number; - static orange: number; - static orangered: number; - static orchid: number; - static palegoldenrod: number; - static palegreen: number; - static paleturquoise: number; - static palevioletred: number; - static papayawhip: number; - static peachpuff: number; - static peru: number; - static pink: number; - static plum: number; - static powderblue: number; - static purple: number; - static red: number; - static rosybrown: number; - static royalblue: number; - static saddlebrown: number; - static salmon: number; - static sandybrown: number; - static seagreen: number; - static seashell: number; - static sienna: number; - static silver: number; - static skyblue: number; - static slateblue: number; - static slategray: number; - static slategrey: number; - static snow: number; - static springgreen: number; - static steelblue: number; - static tan: number; - static teal: number; - static thistle: number; - static tomato: number; - static turquoise: number; - static violet: number; - static wheat: number; - static white: number; - static whitesmoke: number; - static yellow: number; - static yellowgreen: number; - } - - export class Euler { - static DefaultOrder: string; - - constructor(x?: number, y?: number, z?: number, order?: string); - - x: number; - y: number; - z: number; - order: string; - - set(x: number, y: number, z: number, order?: string): Euler; - clone(): Euler; - copy(euler: Euler): Euler; - setFromRotationMatrix(m: Matrix4, order?: string, update?: boolean): Euler; - setFromQuaternion(q:Quaternion, order?: string, update?: boolean): Euler; - setFromVector3( v: Vector3, order?: string ): Euler; - reorder(newOrder: string): Euler; - equals(euler: Euler): boolean; - fromArray(xyzo: any[]): Euler; - toArray(array?: number[], offset?: number): number[]; - toVector3(optionalResult?: Vector3): Vector3; - onChange: () => void; - } - - /** - * Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process. - */ - export class Frustum { - constructor(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane); - - /** - * Array of 6 vectors. - */ - planes: Plane[]; - - set(p0?: number, p1?: number, p2?: number, p3?: number, p4?: number, p5?: number): Frustum; - clone(): Frustum; - copy(frustum: Frustum): Frustum; - setFromMatrix(m: Matrix4): Frustum; - intersectsObject(object: Object3D): boolean; - intersectsSphere(sphere: Sphere): boolean; - intersectsBox(box: Box3): boolean; - containsPoint(point: Vector3): boolean; - } - - export class Line3 { - constructor(start?: Vector3, end?: Vector3); - start: Vector3; - end: Vector3; - - set(start?: Vector3, end?: Vector3): Line3; - clone(): Line3; - copy(line: Line3): Line3; - center(optionalTarget?: Vector3): Vector3; - delta(optionalTarget?: Vector3): Vector3; - distanceSq(): number; - distance(): number; - at(t: number, optionalTarget?: Vector3): Vector3; - closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number; - closestPointToPoint(point: Vector3, clampToLine?: boolean, optionalTarget?: Vector3): Vector3; - applyMatrix4(matrix: Matrix4): Line3; - equals(line: Line3): boolean; - } - - interface Math { - generateUUID(): string; - - /** - * Clamps the x to be between a and b. - * - * @param value Value to be clamped. - * @param min Minimum value - * @param max Maximum value. - */ - clamp(value: number, min: number, max: number): number; - euclideanModulo( n: number, m: number ): number; - - /** - * Linear mapping of x from range [a1, a2] to range [b1, b2]. - * - * @param x Value to be mapped. - * @param a1 Minimum value for range A. - * @param a2 Maximum value for range A. - * @param b1 Minimum value for range B. - * @param b2 Maximum value for range B. - */ - mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number; - - smoothstep(x: number, min: number, max: number): number; - - smootherstep(x: number, min: number, max: number): number; - - /** - * Random float from 0 to 1 with 16 bits of randomness. - * Standard Math.random() creates repetitive patterns when applied over larger space. - */ - random16(): number; - - /** - * Random integer from low to high interval. - */ - randInt(low: number, high: number): number; - - /** - * Random float from low to high interval. - */ - randFloat(low: number, high: number): number; - - /** - * Random float from - range / 2 to range / 2 interval. - */ - randFloatSpread(range: number): number; - - degToRad(degrees: number): number; - - radToDeg(radians: number): number; - - isPowerOfTwo(value: number): boolean; - - nearestPowerOfTwo(value: number): number; - - nextPowerOfTwo(value: number): number; - } - - /** - * - * @see src/math/Math.js - */ - export var Math: Math; - - /** - * ( interface Matrix<T> ) - */ - export interface Matrix { - /** - * Float32Array with matrix values. - */ - elements: Float32Array; - - /** - * identity():T; - */ - identity(): Matrix; - - /** - * copy(m:T):T; - */ - copy(m: Matrix): Matrix; - - /** - * multiplyScalar(s:number):T; - */ - multiplyScalar(s: number): Matrix; - - determinant(): number; - - /** - * getInverse(matrix:T, throwOnInvertible?:boolean):T; - */ - getInverse(matrix: Matrix, throwOnInvertible?: boolean): Matrix; - - /** - * transpose():T; - */ - transpose(): Matrix; - - /** - * clone():T; - */ - clone(): Matrix; - } - - /** - * ( class Matrix3 implements Matrix<Matrix3> ) - */ - export class Matrix3 implements Matrix { - /** - * Creates an identity matrix. - */ - constructor(); - - /** - * Initialises the matrix with the supplied n11..n33 values. - */ - constructor(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number); - - /** - * Float32Array with matrix values. - */ - elements: Float32Array; - - set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): Matrix3; - identity(): Matrix3; - clone(): Matrix3; - copy(m: Matrix3): Matrix3; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; - applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; - multiplyScalar(s: number): Matrix3; - determinant(): number; - getInverse(matrix: Matrix3, throwOnInvertible?: boolean): Matrix3; - getInverse(matrix: Matrix4, throwOnInvertible?: boolean): Matrix3; - - /** - * Transposes this matrix in place. - */ - transpose(): Matrix3; - flattenToArrayOffset(array: number[], offset: number): number[]; - getNormalMatrix(m: Matrix4): Matrix3; - - /** - * Transposes this matrix into the supplied array r, and returns itself. - */ - transposeIntoArray(r: number[]): number[]; - fromArray(array: number[]): Matrix3; - toArray(): number[]; - - } - - /** - * A 4x4 Matrix. - * - * @example - * // Simple rig for rotating around 3 axes - * var m = new THREE.Matrix4(); - * var m1 = new THREE.Matrix4(); - * var m2 = new THREE.Matrix4(); - * var m3 = new THREE.Matrix4(); - * var alpha = 0; - * var beta = Math.PI; - * var gamma = Math.PI/2; - * m1.makeRotationX( alpha ); - * m2.makeRotationY( beta ); - * m3.makeRotationZ( gamma ); - * m.multiplyMatrices( m1, m2 ); - * m.multiply( m3 ); - */ - export class Matrix4 implements Matrix { - /** - * Initialises the matrix with the supplied n11..n44 values. - */ - constructor(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number); - - /** - * Float32Array with matrix values. - */ - elements: Float32Array; - - /** - * Sets all fields of this matrix. - */ - set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): Matrix4; - - /** - * Resets this matrix to identity. - */ - identity(): Matrix4; - clone(): Matrix4; - copy(m: Matrix4): Matrix4; - copyPosition(m: Matrix4): Matrix4; - extractBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; - makeBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; - - /** - * Copies the rotation component of the supplied matrix m into this matrix rotation component. - */ - extractRotation(m: Matrix4): Matrix4; - makeRotationFromEuler(euler: Euler): Matrix4; - makeRotationFromQuaternion(q: Quaternion): Matrix4; - /** - * Constructs a rotation matrix, looking from eye towards center with defined up vector. - */ - lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4; - - /** - * Multiplies this matrix by m. - */ - multiply(m: Matrix4): Matrix4; - - /** - * Sets this matrix to a x b. - */ - multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4; - - /** - * Sets this matrix to a x b and stores the result into the flat array r. - * r can be either a regular Array or a TypedArray. - */ - multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4; - - /** - * Multiplies this matrix by s. - */ - multiplyScalar(s: number): Matrix4; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; - applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; - /** - * Computes determinant of this matrix. - * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - */ - determinant(): number; - - /** - * Transposes this matrix. - */ - transpose(): Matrix4; - - /** - * Flattens this matrix into supplied flat array starting from offset position in the array. - */ - flattenToArrayOffset(array: number[], offset: number): number[]; - - /** - * Sets the position component for this matrix from vector v. - */ - setPosition(v: Vector3): Vector3; - - /** - * Sets this matrix to the inverse of matrix m. - * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm. - */ - getInverse(m: Matrix4, throwOnInvertible?: boolean): Matrix4; - - /** - * Multiplies the columns of this matrix by vector v. - */ - scale(v: Vector3): Matrix4; - - getMaxScaleOnAxis(): number; - /** - * Sets this matrix as translation transform. - */ - makeTranslation(x: number, y: number, z: number): Matrix4; - - /** - * Sets this matrix as rotation transform around x axis by theta radians. - * - * @param theta Rotation angle in radians. - */ - makeRotationX(theta: number): Matrix4; - - /** - * Sets this matrix as rotation transform around y axis by theta radians. - * - * @param theta Rotation angle in radians. - */ - makeRotationY(theta: number): Matrix4; - - /** - * Sets this matrix as rotation transform around z axis by theta radians. - * - * @param theta Rotation angle in radians. - */ - makeRotationZ(theta: number): Matrix4; - - /** - * Sets this matrix as rotation transform around axis by angle radians. - * Based on http://www.gamedev.net/reference/articles/article1199.asp. - * - * @param axis Rotation axis. - * @param theta Rotation angle in radians. - */ - makeRotationAxis(axis: Vector3, angle: number): Matrix4; - - /** - * Sets this matrix as scale transform. - */ - makeScale(x: number, y: number, z: number): Matrix4; - - /** - * Sets this matrix to the transformation composed of translation, rotation and scale. - */ - compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4; - - /** - * Decomposes this matrix into the translation, rotation and scale components. - * If parameters are not passed, new instances will be created. - */ - decompose(translation?: Vector3, rotation?: Quaternion, scale?: Vector3): Object[]; // [Vector3, Quaternion, Vector3] - - /** - * Creates a frustum matrix. - */ - makeFrustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4; - - /** - * Creates a perspective projection matrix. - */ - makePerspective(fov: number, aspect: number, near: number, far: number): Matrix4; - - /** - * Creates an orthographic projection matrix. - */ - makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4; - equals( matrix: Matrix4 ): boolean; - fromArray(array: number[]): Matrix4; - toArray(): number[]; - } - - export class Plane { - constructor(normal?: Vector3, constant?: number); - - normal: Vector3; - constant: number; - - set(normal: Vector3, constant: number): Plane; - setComponents(x: number, y: number, z: number, w: number): Plane; - setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): Plane; - setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane; - clone(): Plane; - copy(plane: Plane): Plane; - normalize(): Plane; - negate(): Plane; - distanceToPoint(point: Vector3): number; - distanceToSphere(sphere: Sphere): number; - projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - orthoPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - isIntersectionLine(line: Line3): boolean; - intersectLine(line: Line3, optionalTarget?: Vector3): Vector3; - coplanarPoint(optionalTarget?: boolean): Vector3; - applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane; - translate(offset: Vector3): Plane; - equals(plane: Plane): boolean; - } - - /** - * Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages. - * - * @example - * var quaternion = new THREE.Quaternion(); - * quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); - * var vector = new THREE.Vector3( 1, 0, 0 ); - * vector.applyQuaternion( quaternion ); - */ - export class Quaternion { - /** - * @param x x coordinate - * @param y y coordinate - * @param z z coordinate - * @param w w coordinate - */ - constructor(x?: number, y?: number, z?: number, w?: number); - - x: number; - y: number; - z: number; - w: number; - - /** - * Sets values of this quaternion. - */ - set(x: number, y: number, z: number, w: number): Quaternion; - - /** - * Clones this quaternion. - */ - clone(): Quaternion; - - /** - * Copies values of q to this quaternion. - */ - copy(q: Quaternion): Quaternion; - - /** - * Sets this quaternion from rotation specified by Euler angles. - */ - setFromEuler(euler: Euler, update?: boolean): Quaternion; - - /** - * Sets this quaternion from rotation specified by axis and angle. - * Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm. - * Axis have to be normalized, angle is in radians. - */ - setFromAxisAngle(axis: Vector3, angle: number): Quaternion; - - /** - * Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm. - */ - setFromRotationMatrix(m: Matrix4): Quaternion; - setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion; - /** - * Inverts this quaternion. - */ - inverse(): Quaternion; - - conjugate(): Quaternion; - dot(v: Vector3): number; - lengthSq(): number; - - /** - * Computes length of this quaternion. - */ - length(): number; - - /** - * Normalizes this quaternion. - */ - normalize(): Quaternion; - - /** - * Multiplies this quaternion by b. - */ - multiply(q: Quaternion): Quaternion; - - /** - * Sets this quaternion to a x b - * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm. - */ - multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion; - - /** - * Deprecated. Use Vector3.applyQuaternion instead - */ - multiplyVector3(vector: Vector3): Vector3; - slerp(qb: Quaternion, t: number): Quaternion; - equals(v: Quaternion): boolean; - fromArray(n: number[]): Quaternion; - toArray(): number[]; - - fromArray(xyzw: number[], offset?: number): Quaternion; - toArray(xyzw?: number[], offset?: number): number[]; - - onChange: () => void; - - /** - * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/. - */ - static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion; - } - - export class Ray { - constructor(origin?: Vector3, direction?: Vector3); - - origin: Vector3; - direction: Vector3; - - set(origin: Vector3, direction: Vector3): Ray; - clone(): Ray; - copy(ray: Ray): Ray; - at(t: number, optionalTarget?: Vector3): Vector3; - recast(t: number): Ray; - closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - distanceToPoint(point: Vector3): number; - distanceSqToPoint(point: Vector3): number; - distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; - isIntersectionSphere(sphere: Sphere): boolean; - intersectSphere(sphere: Sphere, optionalTarget?: Vector3): Vector3; - isIntersectionPlane(plane: Plane): boolean; - distanceToPlane(plane: Plane): number; - intersectPlane(plane: Plane, optionalTarget?: Vector3): Vector3; - isIntersectionBox(box: Box3): boolean; - intersectBox(box: Box3, optionalTarget?: Vector3): Vector3; - intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; - applyMatrix4(matrix4: Matrix4): Ray; - equals(ray: Ray): boolean; - } - - export class Sphere { - constructor(center?: Vector3, radius?: number); - - center: Vector3; - radius: number; - - set(center: Vector3, radius: number): Sphere; - setFromPoints(points: Vector3[], optionalCenter?: Vector3): Sphere; - clone(): Sphere; - copy(sphere: Sphere): Sphere; - empty(): boolean; - containsPoint(point: Vector3): boolean; - distanceToPoint(point: Vector3): number; - intersectsSphere(sphere: Sphere): boolean; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - getBoundingBox(optionalTarget?: Box3): Box3; - applyMatrix4(matrix: Matrix4): Sphere; - translate(offset: Vector3): Sphere; - equals(sphere: Sphere): boolean; - } - - export interface SplineControlPoint { - x: number; - y: number; - z: number; - } - - /** - * Represents a spline. - * - * @see src/math/Spline.js - */ - export class Spline { - /** - * Initialises the spline with points, which are the places through which the spline will go. - */ - constructor(points: SplineControlPoint[]); - - points: SplineControlPoint[]; - - /** - * Initialises using the data in the array as a series of points. Each value in a must be another array with three values, where a[n] is v, the value for the nth point, and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively. - * - * @param a array of triplets containing x, y, z coordinates - */ - initFromArray(a: number[][]): void; - - /** - * Return the interpolated point at k. - * - * @param k point index - */ - getPoint(k: number): SplineControlPoint; - - /** - * Returns an array with triplets of x, y, z coordinates that correspond to the current control points. - */ - getControlPointsArray(): number[][]; - - /** - * Returns the length of the spline when using nSubDivisions. - * @param nSubDivisions number of subdivisions between control points. Default is 100. - */ - getLength(nSubDivisions?: number): { chunks: number[]; total: number; }; - - /** - * Modifies the spline so that it looks similar to the original but has its points distributed in such way that moving along the spline it's done at a more or less constant speed. The points should also appear more uniformly spread along the curve. - * This is done by resampling the original spline, with the density of sampling controlled by samplingCoef. Here it's interesting to note that denser sampling is not necessarily better: if sampling is too high, you may get weird kinks in curvature. - * - * @param samplingCoef how many intermediate values to use between spline points - */ - reparametrizeByArcLength(samplingCoef: number): void; - } - - class Triangle { - constructor(a?: Vector3, b?: Vector3, c?: Vector3); - - a: Vector3; - b: Vector3; - c: Vector3; - - set(a: Vector3, b: Vector3, c: Vector3): Triangle; - setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): Triangle; - clone(): Triangle; - copy(triangle: Triangle): Triangle; - area(): number; - midpoint(optionalTarget?: Vector3): Vector3; - normal(optionalTarget?: Vector3): Vector3; - plane(optionalTarget?: Vector3): Plane; - barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - containsPoint(point: Vector3): boolean; - equals(triangle: Triangle): boolean; - - static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3; - static barycoordFromPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3, optionalTarget: Vector3): Vector3; - static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean; - } - - - /** - * ( interface Vector<T> ) - * - * Abstract interface of Vector2, Vector3 and Vector4. - * Currently the members of Vector is NOT type safe because it accepts different typed vectors. - * Those definitions will be changed when TypeScript innovates Generics to be type safe. - * - * @example - * var v:THREE.Vector = new THREE.Vector3(); - * v.addVectors(new THREE.Vector2(0, 1), new THREE.Vector2(2, 3)); // invalid but compiled successfully - */ - export interface Vector { - setComponent(index: number, value: number): void; - - getComponent(index: number): number; - - /** - * copy(v:T):T; - */ - copy(v: Vector): Vector; - - /** - * add(v:T):T; - */ - add(v: Vector): Vector; - - /** - * addVectors(a:T, b:T):T; - */ - addVectors(a: Vector, b: Vector): Vector; - - /** - * sub(v:T):T; - */ - sub(v: Vector): Vector; - - /** - * subVectors(a:T, b:T):T; - */ - subVectors(a: Vector, b: Vector): Vector; - - /** - * multiplyScalar(s:number):T; - */ - multiplyScalar(s: number): Vector; - - /** - * divideScalar(s:number):T; - */ - divideScalar(s: number): Vector; - - /** - * negate():T; - */ - negate(): Vector; - - /** - * dot(v:T):T; - */ - dot(v: Vector): number; - - /** - * lengthSq():number; - */ - lengthSq(): number; - - /** - * length():number; - */ - length(): number; - - /** - * normalize():T; - */ - normalize(): Vector; - - /** - * NOTE: Vector4 doesn't have the property. - * - * distanceTo(v:T):number; - */ - distanceTo?(v: Vector): number; - - /** - * NOTE: Vector4 doesn't have the property. - * - * distanceToSquared(v:T):number; - */ - distanceToSquared?(v: Vector): number; - - /** - * setLength(l:number):T; - */ - setLength(l: number): Vector; - - /** - * lerp(v:T, alpha:number):T; - */ - lerp(v: Vector, alpha: number): Vector; - - /** - * equals(v:T):boolean; - */ - equals(v: Vector): boolean; - - /** - * clone():T; - */ - clone(): Vector; - } - - /** - * 2D vector. - * - * ( class Vector2 implements Vector ) - */ - export class Vector2 implements Vector { - constructor(x?: number, y?: number); - - x: number; - y: number; - - width: number; - height: number; - - /** - * Sets value of this vector. - */ - set(x: number, y: number): Vector2; - - /** - * Sets X component of this vector. - */ - setX(x: number): Vector2; - - /** - * Sets Y component of this vector. - */ - setY(y: number): Vector2; - - /** - * Sets a component of this vector. - */ - setComponent(index: number, value: number): void; - - /** - * Gets a component of this vector. - */ - getComponent(index: number): number; - /** - * Clones this vector. - */ - clone(): Vector2; - /** - * Copies value of v to this vector. - */ - copy(v: Vector2): Vector2; - - /** - * Adds v to this vector. - */ - add(v: Vector2): Vector2; - - /** - * Sets this vector to a + b. - */ - addScalar(s: number): Vector2; - addVectors(a: Vector2, b: Vector2): Vector2; - addScaledVector( v: Vector2, s: number ): Vector2; - /** - * Subtracts v from this vector. - */ - sub(v: Vector2): Vector2; - - /** - * Sets this vector to a - b. - */ - subVectors(a: Vector2, b: Vector2): Vector2; - - multiply(v: Vector2): Vector2; - /** - * Multiplies this vector by scalar s. - */ - multiplyScalar(scalar: number): Vector2; - - divide(v: Vector2): Vector2; - /** - * Divides this vector by scalar s. - * Set vector to ( 0, 0 ) if s == 0. - */ - divideScalar(s: number): Vector2; - - min(v: Vector2): Vector2; - - max(v: Vector2): Vector2; - clamp(min: Vector2, max: Vector2): Vector2; - clampScalar(min: number, max: number): Vector2; - clampLength(min: number, max: number): Vector2; - floor(): Vector2; - ceil(): Vector2; - round(): Vector2; - roundToZero(): Vector2; - - /** - * Inverts this vector. - */ - negate(): Vector2; - - /** - * Computes dot product of this vector and v. - */ - dot(v: Vector2): number; - - /** - * Computes squared length of this vector. - */ - lengthSq(): number; - - /** - * Computes length of this vector. - */ - length(): number; - lengthManhattan(): number; - - /** - * Normalizes this vector. - */ - normalize(): Vector2; - - /** - * Computes distance of this vector to v. - */ - distanceTo(v: Vector2): number; - - /** - * Computes squared distance of this vector to v. - */ - distanceToSquared(v: Vector2): number; - - /** - * Normalizes this vector and multiplies it by l. - */ - setLength(length: number): Vector2; - - lerp(v: Vector2, alpha: number): Vector2; - - lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; - - /** - * Checks for strict equality of this vector and v. - */ - equals(v: Vector2): boolean; - - fromArray(xy: number[], offset?: number): Vector2; - - toArray(xy?: number[], offset?: number): number[]; - - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; - - rotateAround( center: Vector2, angle: number ): Vector2; - } - - /** - * 3D vector. - * - * @example - * var a = new THREE.Vector3( 1, 0, 0 ); - * var b = new THREE.Vector3( 0, 1, 0 ); - * var c = new THREE.Vector3(); - * c.crossVectors( a, b ); - * - * @see src/math/Vector3.js - * - * ( class Vector3 implements Vector ) - */ - export class Vector3 implements Vector { - - constructor(x?: number, y?: number, z?: number); - - x: number; - y: number; - z: number; - - /** - * Sets value of this vector. - */ - set(x: number, y: number, z: number): Vector3; - - /** - * Sets x value of this vector. - */ - setX(x: number): Vector3; - - /** - * Sets y value of this vector. - */ - setY(y: number): Vector3; - - /** - * Sets z value of this vector. - */ - setZ(z: number): Vector3; - - setComponent(index: number, value: number): void; - getComponent(index: number): number; - /** - * Clones this vector. - */ - clone(): Vector3; - /** - * Copies value of v to this vector. - */ - copy(v: Vector3): Vector3; - - /** - * Adds v to this vector. - */ - add(a: Vector3): Vector3; - addScalar(s: number): Vector3; - addScaledVector(v: Vector3, s: number): Vector3; - - /** - * Sets this vector to a + b. - */ - addVectors(a: Vector3, b: Vector3): Vector3; - addScaledVector( v: Vector3, s: number ): Vector3; - - /** - * Subtracts v from this vector. - */ - sub(a: Vector3): Vector3; - - subScalar( s: number ): Vector3; - - /** - * Sets this vector to a - b. - */ - subVectors(a: Vector3, b: Vector3): Vector3; - - multiply(v: Vector3): Vector3; - /** - * Multiplies this vector by scalar s. - */ - multiplyScalar(s: number): Vector3; - multiplyVectors(a: Vector3, b: Vector3): Vector3; - applyEuler(euler: Euler): Vector3; - applyAxisAngle(axis: Vector3, angle: number): Vector3; - applyMatrix3(m: Matrix3): Vector3; - applyMatrix4(m: Matrix4): Vector3; - applyProjection(m: Matrix4): Vector3; - applyQuaternion(q: Quaternion): Vector3; - project(camrea: Camera): Vector3; - unproject(camera: Camera): Vector3; - transformDirection(m: Matrix4): Vector3; - divide(v: Vector3): Vector3; - - /** - * Divides this vector by scalar s. - * Set vector to ( 0, 0, 0 ) if s == 0. - */ - divideScalar(s: number): Vector3; - min(v: Vector3): Vector3; - max(v: Vector3): Vector3; - clamp(min: Vector3, max: Vector3): Vector3; - clampScalar(min: number, max: number): Vector3; - clampLength(min: number, max: number): Vector3; - floor(): Vector3; - ceil(): Vector3; - round(): Vector3; - roundToZero(): Vector3; - - /** - * Inverts this vector. - */ - negate(): Vector3; - - /** - * Computes dot product of this vector and v. - */ - dot(v: Vector3): number; - - /** - * Computes squared length of this vector. - */ - lengthSq(): number; - - /** - * Computes length of this vector. - */ - length(): number; - - /** - * Computes Manhattan length of this vector. - * http://en.wikipedia.org/wiki/Taxicab_geometry - */ - lengthManhattan(): number; - - /** - * Normalizes this vector. - */ - normalize(): Vector3; - - /** - * Normalizes this vector and multiplies it by l. - */ - setLength(l: number): Vector3; - lerp(v: Vector3, alpha: number): Vector3; - - lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; - - /** - * Sets this vector to cross product of itself and v. - */ - cross(a: Vector3): Vector3; - - /** - * Sets this vector to cross product of a and b. - */ - crossVectors(a: Vector3, b: Vector3): Vector3; - projectOnVector(v: Vector3): Vector3; - projectOnPlane(planeNormal: Vector3): Vector3; - reflect(vector: Vector3): Vector3; - angleTo(v: Vector3): number; - - /** - * Computes distance of this vector to v. - */ - distanceTo(v: Vector3): number; - - /** - * Computes squared distance of this vector to v. - */ - distanceToSquared(v: Vector3): number; - - setFromMatrixPosition(m: Matrix4): Vector3; - setFromMatrixScale(m: Matrix4): Vector3; - setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; - - /** - * Checks for strict equality of this vector and v. - */ - equals(v: Vector3): boolean; - - fromArray(xyz: number[], offset?: number): Vector3; - - toArray(xyz?: number[], offset?: number): number[]; - - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; - } - - /** - * 4D vector. - * - * ( class Vector4 implements Vector ) - */ - export class Vector4 implements Vector { - constructor(x?: number, y?: number, z?: number, w?: number); - x: number; - y: number; - z: number; - w: number; - - /** - * Sets value of this vector. - */ - set(x: number, y: number, z: number, w: number): Vector4; - - /** - * Sets X component of this vector. - */ - setX(x: number): Vector4; - - /** - * Sets Y component of this vector. - */ - setY(y: number): Vector4; - - /** - * Sets Z component of this vector. - */ - setZ(z: number): Vector4; - - /** - * Sets w component of this vector. - */ - setW(w: number): Vector4; - - setComponent(index: number, value: number): void; - getComponent(index: number): number; - /** - * Clones this vector. - */ - clone(): Vector4; - /** - * Copies value of v to this vector. - */ - copy(v: Vector4): Vector4; - - /** - * Adds v to this vector. - */ - add(v: Vector4): Vector4; - addScalar(s: number): Vector4; - - /** - * Sets this vector to a + b. - */ - addVectors(a: Vector4, b: Vector4): Vector4; - addScaledVector( v: Vector4, s: number ): Vector4; - /** - * Subtracts v from this vector. - */ - sub(v: Vector4): Vector4; - - subScalar(s: number): Vector4; - - /** - * Sets this vector to a - b. - */ - subVectors(a: Vector4, b: Vector4): Vector4; - - /** - * Multiplies this vector by scalar s. - */ - multiplyScalar(s: number): Vector4; - applyMatrix4(m: Matrix4): Vector4; - - /** - * Divides this vector by scalar s. - * Set vector to ( 0, 0, 0 ) if s == 0. - */ - divideScalar(s: number): Vector4; - - /** - * http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - * @param q is assumed to be normalized - */ - setAxisAngleFromQuaternion(q: Quaternion): Vector4; - - /** - * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - */ - setAxisAngleFromRotationMatrix(m: Matrix4): Vector4; - - min(v: Vector4): Vector4; - max(v: Vector4): Vector4; - clamp(min: Vector4, max: Vector4): Vector4; - clampScalar(min: number, max: number): Vector4; - floor(): Vector4; - ceil(): Vector4; - round(): Vector4; - roundToZero(): Vector4; - - /** - * Inverts this vector. - */ - negate(): Vector4; - - /** - * Computes dot product of this vector and v. - */ - dot(v: Vector4): number; - - /** - * Computes squared length of this vector. - */ - lengthSq(): number; - - /** - * Computes length of this vector. - */ - length(): number; - lengthManhattan(): number; - - /** - * Normalizes this vector. - */ - normalize(): Vector4; - /** - * Normalizes this vector and multiplies it by l. - */ - setLength(length: number): Vector4; - - /** - * Linearly interpolate between this vector and v with alpha factor. - */ - lerp(v: Vector4, alpha: number): Vector4; - - lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; - - /** - * Checks for strict equality of this vector and v. - */ - equals(v: Vector4): boolean; - - fromArray(xyzw: number[], offset?: number): Vector4; - - toArray(xyzw?: number[], offset?: number): number[]; - - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector4; - } - - // Objects ////////////////////////////////////////////////////////////////////////////////// - - export class Bone extends Object3D { - constructor(skin: SkinnedMesh); - - skin: SkinnedMesh; - - clone(): Bone; - copy(source: Bone): Bone; - } - - export class Group extends Object3D { - constructor(); - } - - export class LOD extends Object3D { - constructor(); - - levels: any[]; - - addLevel(object: Object3D, distance?: number): void; - getObjectForDistance(distance: number): Object3D; - raycast(raycaster: Raycaster, intersects: any): void; - update(camera: Camera): void; - - clone(): LOD; - copy(source: LOD): LOD; - toJSON(meta: any): any; - } - - export interface LensFlareProperty { - texture: Texture; // Texture - size: number; // size in pixels (-1 = use texture.width) - distance: number; // distance (0-1) from light source (0=at light source) - x: number; - y: number; - z: number; // screen position (-1 => 1) z = 0 is ontop z = 1 is back - scale: number; // scale - rotation: number; // rotation - opacity: number; // opacity - color: Color; // color - blending: Blending; - } - - export class LensFlare extends Object3D { - constructor(texture?: Texture, size?: number, distance?: number, blending?: Blending, color?: Color); - - lensFlares: LensFlareProperty[]; - positionScreen: Vector3; - customUpdateCallback: (object: LensFlare) => void; - - add(texture: Texture, size?: number, distance?: number, blending?: Blending, color?: Color): void; - add(obj: Object3D): void; - - updateLensFlares(): void; - - clone(): LensFlare; - copy(source: LensFlare): LensFlare; - } - - export class Line extends Object3D { - constructor( - geometry?: Geometry | BufferGeometry, - material?: LineDashedMaterial | LineBasicMaterial | ShaderMaterial, - mode?: number - ); - - geometry: Geometry|BufferGeometry; - material: Material; // LineDashedMaterial or LineBasicMaterial or ShaderMaterial - - raycast(raycaster: Raycaster, intersects: any): void; - clone(): Line; - copy(source: Line): Line; - } - - export class LineSegments extends Line { - constructor( - geometry?: Geometry | BufferGeometry, - material?: LineDashedMaterial | LineBasicMaterial | ShaderMaterial, - mode?: number - ); - - clone(): LineSegments; - copy(source: LineSegments): LineSegments; - } - - enum LineMode{} - var LineStrip: LineMode; - var LinePieces: LineMode; - - export class Mesh extends Object3D { - constructor(geometry?: Geometry, material?: Material); - constructor(geometry?: BufferGeometry, material?: Material); - - geometry: Geometry|BufferGeometry; - material: Material; - - updateMorphTargets(): void; - getMorphTargetIndexByName(name: string): number; - raycast(raycaster: Raycaster, intersects: any): void; - clone(): Mesh; - copy(source: Mesh): Mesh; - } - - /** - * A class for displaying particles in the form of variable size points. For example, if using the WebGLRenderer, the particles are displayed using GL_POINTS. - * - * @see src/objects/ParticleSystem.js - */ - export class Points extends Object3D { - - /** - * @param geometry An instance of Geometry. - * @param material An instance of Material (optional). - */ - constructor( - geometry: Geometry | BufferGeometry, - material?: PointsMaterial | ShaderMaterial - ); - - /** - * An instance of Geometry, where each vertex designates the position of a particle in the system. - */ - geometry: Geometry; - - /** - * An instance of Material, defining the object's appearance. Default is a ParticleBasicMaterial with randomised colour. - */ - material: Material; - - raycast(raycaster: Raycaster, intersects: any): void; - clone(): Points; - copy(source: Points): Points; - } - - export class Skeleton { - constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); - - useVertexTexture: boolean; - identityMatrix: Matrix4; - bones: Bone[]; - boneTextureWidth: number; - boneTextureHeight: number; - boneMatrices: Float32Array; - boneTexture: DataTexture; - boneInverses: Matrix4[]; - - calculateInverses(bone: Bone): void; - pose(): void; - update(): void; - clone(): Skeleton; - - } - - export class SkinnedMesh extends Mesh { - constructor(geometry?: Geometry|BufferGeometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry|BufferGeometry, material?: ShaderMaterial, useVertexTexture?: boolean); - - bindMode: string; - bindMatrix: Matrix4; - bindMatrixInverse: Matrix4; - - bind( skeleton: Skeleton, bindMatrix?: Matrix4 ): void; - pose(): void; - normalizeSkinWeights(): void; - updateMatrixWorld(force?: boolean): void; - clone(): SkinnedMesh; - copy(source?: SkinnedMesh): SkinnedMesh; - - skeleton: Skeleton; - } - - export class Sprite extends Object3D { - constructor(material?: Material); - - geometry: BufferGeometry; - material: SpriteMaterial; - - raycast(raycaster: Raycaster, intersects: any): void; - clone(): Sprite; - copy(source?: Sprite): Sprite; - } - - - // Renderers ////////////////////////////////////////////////////////////////////////////////// - - export interface Renderer { - render(scene: Scene, camera: Camera): void; - setSize(width:number, height:number, updateStyle?:boolean): void; - domElement: HTMLCanvasElement; - } - - export interface WebGLRendererParameters { - /** - * A Canvas where the renderer draws its output. - */ - canvas?: HTMLCanvasElement; - - /** - * shader precision. Can be "highp", "mediump" or "lowp". - */ - precision?: string; - - /** - * default is true. - */ - alpha?: boolean; - - /** - * default is true. - */ - premultipliedAlpha?: boolean; - - /** - * default is false. - */ - antialias?: boolean; - - /** - * default is true. - */ - stencil?: boolean; - - /** - * default is false. - */ - preserveDrawingBuffer?: boolean; - - /** - * default is 0x000000. - */ - clearColor?: number; - - /** - * default is 0. - */ - clearAlpha?: number; - - devicePixelRatio?: number; - - /** - * default is false. - */ - logarithmicDepthBuffer?: boolean; - } - - - /** - * The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it. - * This renderer has way better performance than CanvasRenderer. - * - * @see src/renderers/WebGLRenderer.js - */ - export class WebGLRenderer implements Renderer { - /** - * parameters is an optional object with properties defining the renderer's behaviour. The constructor also accepts no parameters at all. In all cases, it will assume sane defaults when parameters are missing. - */ - constructor(parameters?: WebGLRendererParameters); - - /** - * A Canvas where the renderer draws its output. - * This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page. - */ - domElement: HTMLCanvasElement; - - /** - * The HTML5 Canvas's 'webgl' context obtained from the canvas where the renderer will draw. - */ - context: WebGLRenderingContext; - - /** - * Defines whether the renderer should automatically clear its output before rendering. - */ - autoClear: boolean; - - /** - * If autoClear is true, defines whether the renderer should clear the color buffer. Default is true. - */ - autoClearColor: boolean; - - /** - * If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true. - */ - autoClearDepth: boolean; - - /** - * If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true. - */ - autoClearStencil: boolean; - - /** - * Defines whether the renderer should sort objects. Default is true. - */ - sortObjects: boolean; - - extensions: WebGLExtensions; - - gammaFactor: number; - - /** - * Default is false. - */ - gammaInput: boolean; - - /** - * Default is false. - */ - gammaOutput: boolean; - - /** - * Default is false. - */ - shadowMapEnabled: boolean; - - /** - * Defines shadow map type (unfiltered, percentage close filtering, percentage close filtering with bilinear filtering in shader) - * Options are THREE.BasicShadowMap, THREE.PCFShadowMap, THREE.PCFSoftShadowMap. Default is THREE.PCFShadowMap. - */ - shadowMapType: ShadowMapType; - - /** - * Default is true - */ - shadowMapCullFace: CullFace; - - /** - * Default is false. - */ - shadowMapDebug: boolean; - - /** - * Default is 8. - */ - maxMorphTargets: number; - - /** - * Default is 4. - */ - maxMorphNormals: number; - - /** - * Default is true. - */ - autoScaleCubemaps: boolean; - - /** - * An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields: - */ - info: { - memory: { - programs: number; - geometries: number; - textures: number; - }; - render: { - calls: number; - vertices: number; - faces: number; - points: number; - }; - }; - - shadowMap: WebGLShadowMapInstance; - - /** - * Return the WebGL context. - */ - getContext(): WebGLRenderingContext; - - forceContextLoss(): void; - - capabilities: WebGLCapabilities; - - /** Deprecated, use capabilities instead */ - supportsVertexTextures(): boolean; - supportsFloatTextures(): boolean; - supportsStandardDerivatives(): boolean; - supportsCompressedTextureS3TC(): boolean; - supportsCompressedTexturePVRTC(): boolean; - supportsBlendMinMax(): boolean; - getPrecision(): string; - - getMaxAnisotropy(): number; - getPixelRatio(): number; - setPixelRatio(value: number): void; - - getSize(): { width: number; height: number; }; - - /** - * Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0). - */ - setSize(width: number, height: number, updateStyle?: boolean): void; - - /** - * Sets the viewport to render from (x, y) to (x + width, y + height). - */ - setViewport(x?: number, y?: number, width?: number, height?: number): void; - - /** - * Sets the scissor area from (x, y) to (x + width, y + height). - */ - setScissor(x: number, y: number, width: number, height: number): void; - - /** - * Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions. - */ - enableScissorTest(enable: boolean): void; - - /** - * Sets the clear color, using color for the color and alpha for the opacity. - */ - setClearColor(color: Color, alpha?: number): void; - setClearColor(color: string, alpha?: number): void; - setClearColor(color: number, alpha?: number): void; - - setClearAlpha(alpha: number): void; - - /** - * Sets the clear color, using hex for the color and alpha for the opacity. - * - * @example - * // Creates a renderer with black background - * var renderer = new THREE.WebGLRenderer(); - * renderer.setSize(200, 100); - * renderer.setClearColorHex(0x000000, 1); - */ - setClearColorHex(hex: number, alpha: number): void; - - /** - * Returns a THREE.Color instance with the current clear color. - */ - getClearColor(): Color; - - /** - * Returns a float with the current clear alpha. Ranges from 0 to 1. - */ - getClearAlpha(): number; - - /** - * Tells the renderer to clear its color, depth or stencil drawing buffer(s). - * Arguments default to true - */ - clear(color?: boolean, depth?: boolean, stencil?: boolean): void; - - clearColor(): void; - clearDepth(): void; - clearStencil(): void; - clearTarget(renderTarget:WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; - resetGLState(): void; - dispose(): void; - - /** - * Tells the shadow map plugin to update using the passed scene and camera parameters. - * - * @param scene an instance of Scene - * @param camera — an instance of Camera - */ - updateShadowMap(scene: Scene, camera: Camera): void; - - renderBufferImmediate(object: Object3D, program: Object, material: Material): void; - - renderBufferDirect(camera: Camera, lights: Light[], fog: Fog, material: Material, geometryGroup: any, object: Object3D): void; - - renderBuffer(camera: Camera, lights: Light[], fog: Fog, material: Material, geometryGroup: any, object: Object3D): void; - - /** - * Render a scene using a camera. - * The render is done to the renderTarget (if specified) or to the canvas as usual. - * If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false. - */ - render(scene: Scene, camera: Camera, renderTarget?: RenderTarget, forceClear?: boolean): void; - renderImmediateObject(camera: Camera, lights: Light[], fog: Fog, material: Material, object: Object3D): void; - - /** - * Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering. - * If cullFace is false, culling will be disabled. - * @param cullFace "back", "front", "front_and_back", or false. - * @param frontFace "ccw" or "cw - */ - setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; - setMaterialFaces(material: Material): void; - setDepthTest(depthTest: boolean): void; - setDepthWrite(depthWrite: boolean): void; - setBlending(blending: Blending, blendEquation: BlendingEquation, blendSrc: BlendingSrcFactor, blendDst: BlendingDstFactor): void; - uploadTexture(texture: Texture): void; - setTexture(texture: Texture, slot: number): void; - setRenderTarget(renderTarget: RenderTarget): void; - readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; - } - - export interface RenderTarget { - } - - export interface WebGLRenderTargetOptions { - wrapS?: Wrapping; - wrapT?: Wrapping; - magFilter?: TextureFilter; - minFilter?: TextureFilter; - anisotropy?: number; // 1; - format?: number; // RGBAFormat; - type?: TextureDataType; // UnsignedByteType; - depthBuffer?: boolean; // true; - stencilBuffer?: boolean; // true; - } - - export class WebGLRenderTarget implements RenderTarget { - constructor(width: number, height: number, options?: WebGLRenderTargetOptions); - - uuid: string; - width: number; - height: number; - wrapS: Wrapping; - wrapT: Wrapping; - magFilter: TextureFilter; - minFilter: TextureFilter; - anisotropy: number; - offset: Vector2; - repeat: Vector2; - format: number; - type: number; - depthBuffer: boolean; - stencilBuffer: boolean; - generateMipmaps: boolean; - shareDepthFrom: any; - - setSize(width: number, height: number): void; - clone(): WebGLRenderTarget; - copy(source: WebGLRenderTarget): WebGLRenderTarget; - dispose(): void; - - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - export class WebGLRenderTargetCube extends WebGLRenderTarget { - constructor(width: number, height: number, options?: WebGLRenderTargetOptions); - - activeCubeFace: number; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 - } - - // Renderers / Shaders ///////////////////////////////////////////////////////////////////// - export interface ShaderChunk { - [name: string]: string; - - common: string; - - alphamap_fragment: string; - alphamap_pars_fragment: string; - alphatest_fragment: string; - aomap_fragment: string; - aomap_pars_fragment: string; - begin_vertex: string; - beginnormal_vertex: string; - bumpmap_pars_fragment: string; - color_fragment: string; - color_pars_fragment: string; - color_pars_vertex: string; - color_vertex: string; - defaultnormal_vertex: string; - displacementmap_pars_vertex: string; - displacementmap_vertex: string; - emissivemap_fragment: string; - emissivemap_pars_fragment: string; - envmap_fragment: string; - envmap_pars_fragment: string; - envmap_pars_vertex: string; - envmap_vertex: string; - fog_fragment: string; - fog_pars_fragment: string; - hemilight_fragment: string; - lightmap_fragment: string; - lightmap_pars_fragment: string; - lights_lambert_pars_vertex: string; - lights_lambert_vertex: string; - lights_phong_fragment: string; - lights_phong_pars_fragment: string; - lights_phong_pars_vertex: string; - lights_phong_vertex: string; - linear_to_gamma_fragment: string; - logdepthbuf_fragment: string; - logdepthbuf_pars_fragment: string; - logdepthbuf_pars_vertex: string; - logdepthbuf_vertex: string; - map_fragment: string; - map_pars_fragment: string; - map_particle_fragment: string; - map_particle_pars_fragment: string; - morphnormal_vertex: string; - morphtarget_pars_vertex: string; - morphtarget_vertex: string; - normal_phong_fragment: string; - normalmap_pars_fragment: string; - project_vertex: string; - shadowmap_fragment: string; - shadowmap_pars_fragment: string; - shadowmap_pars_vertex: string; - shadowmap_vertex: string; - skinbase_vertex: string; - skinning_pars_vertex: string; - skinning_vertex: string; - skinnormal_vertex: string; - specularmap_fragment: string; - specularmap_pars_fragment: string; - uv2_pars_fragment: string; - uv2_pars_vertex: string; - uv2_vertex: string; - uv_pars_fragment: string; - uv_pars_vertex: string; - uv_vertex: string; - worldpos_vertex: string; - } - - export var ShaderChunk: ShaderChunk; - - export interface Shader { - uniforms: any; - vertexShader: string; - fragmentShader: string; - } - - export var ShaderLib: { - [name: string]: Shader; - basic: Shader; - lambert: Shader; - phong: Shader; - particle_basic: Shader; - dashed: Shader; - depth: Shader; - normal: Shader; - normalmap: Shader; - cube: Shader; - equirect: Shader; - depthRGBA: Shader; - }; - - export var UniformsLib: { - common: any; - aomap: any; - lightmap: any; - emissivemap: any; - bumpmap: any; - normalmap: any; - displacementmap: any; - fog: any; - lights: any; - points: any; - shadowmap: any; - }; - - export var UniformsUtils: { - merge(uniforms: any[]): any; - clone(uniforms_src: any): any; - }; - - // Renderers / WebGL ///////////////////////////////////////////////////////////////////// - export class WebGLBufferRenderer{ - constructor(_gl: any, extensions: any, _infoRender: any); // WebGLRenderingContext - - setMode( value: any ): void; - render( start: any, count: any ): void; - renderInstances( geometry: any ): void; - } - - export class WebGLCapabilities{ - constructor(gl: any, extensions: any, parameters: any); // WebGLRenderingContext - - getMaxPrecision: any; - precision: any; - maxTextures: any; - maxVertexTextures: any; - maxTextureSize: any; - maxCubemapSize: any; - maxAttributes: any; - maxVertexUniforms: any; - maxVaryings: any; - maxFragmentUniforms: any; - vertexTextures: any; - floatFragmentTextures: any; - floatVertexTextures: any; - } - - export class WebGLExtensions{ - constructor(gl: any); // WebGLRenderingContext - - get(name: string): any; - } - - interface WebGLGeometriesInstance { - get( object: any ): any; - } - interface WebGLGeometriesStatic{ - new (gl: any, properties: any, info: any): WebGLGeometriesInstance; - } - export var WebGLGeometries: WebGLGeometriesStatic; - - - interface WebGLIndexedBufferRendererInstance { - setMode( value: any ): void; - setIndex( index: any ): void; - render( start: any, count: any ): void; - renderInstances( geometry: any ): void; - } - interface WebGLIndexedBufferRendererStatic{ - new (gl: any, properties: any, info: any): WebGLIndexedBufferRendererInstance; - } - export var WebGLIndexedBufferRenderer: WebGLIndexedBufferRendererStatic; - - - interface WebGLObjectsInstance { - getAttributeBuffer( attribute: any ): any; - getWireframeAttribute(geometry: any): any; - update(object: any): void; - } - interface WebGLObjectsStatic{ - new (gl: any, properties: any, info: any): WebGLObjectsInstance; - } - export var WebGLObjects: WebGLObjectsStatic; - - export class WebGLProgram{ - constructor(renderer: WebGLRenderer, code: string, material: ShaderMaterial, parameters: WebGLRendererParameters); - - getUniforms(): any; - getAttributes(): any; - - /** Deprecated, use getUniforms */ - uniforms: any; - /** Deprecated, use getAttributes */ - attributes: any; - - id: number; - code: string; - usedTimes: number; - program: any; - vertexShader: WebGLShader; - fragmentShader: WebGLShader; - } - - interface WebGLProgramsInstance { - getParameters( material: any, lights: any, fog: any, object: any ): any[]; - getProgramCode( material: any, parameters: any ): any; - acquireProgram( material: any, parameters: any, code: any ): any; - releaseProgram( program: any ): void; - } - interface WebGLProgramsStatic{ - new (renderer: WebGLRenderer, capabilities: any): WebGLProgramsInstance; - } - export var WebGLPrograms: WebGLProgramsStatic; - - interface WebGLPropertiesInstance { - get(object: any): any; - delete(object: any): void; - clear(): void; - } - interface WebGLPropertiesStatic{ - new (): WebGLPropertiesInstance; - } - export var WebGLProperties: WebGLPropertiesStatic; - - export class WebGLShader{ - constructor(gl: any, type: string, string: string); - } - - interface WebGLShadowMapInstance{ - enabled: boolean; - autoUpdate: boolean; - needsUpdate: boolean; - type: ShadowMapType; - cullFace: CullFace; - - render( scene: Scene ): void; - } - interface WebGLShadowMapStatic{ - new ( _renderer: Renderer, _lights: any[], _objects: any[] ): WebGLStateInstance; - } - export var WebGLShadowMap: WebGLShadowMapStatic; - - interface WebGLStateInstance{ - init(): void; - initAttributes(): void; - enableAttribute(attribute: string): void; - enableAttributeAndDivisor( attribute: string, meshPerAttribute: any, extension: any ): void; - disableUnusedAttributes(): void; - enable( id: string ): void; - disable( id: string ): void; - getCompressedTextureFormats(): any; - setBlending( blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number ): void; - setDepthFunc( func: Function): void; - setDepthTest( depthTest: number ): void; - setDepthWrite( depthWrite: number ): void; - setColorWrite( colorWrite: number ): void; - setFlipSided( flipSided: number ): void; - setLineWidth( width: number ): void; - setPolygonOffset(polygonoffset: number, factor: number, units: number): void; - setScissorTest( scissorTest: boolean ): void; - activeTexture( webglSlot: any ): void; - bindTexture( webglType: any, webglTexture: any ): void; - compressedTexImage2D(): void; - texImage2D(): void; - reset(): void; - } - interface WebGLStateStatic{ - new ( gl: any, extensions: any, paramThreeToGL: Function ): WebGLStateInstance; - } - export var WebGLState: WebGLStateStatic; - - - // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// - export interface RendererPlugin { - init(renderer: WebGLRenderer): void; - render(scene: Scene, camera: Camera, currentWidth: number, currentHeight: number): void; - } - - export class LensFlarePlugin implements RendererPlugin { - constructor(); - - init(renderer: Renderer): void; - render(scene: Scene, camera: Camera, viewportWidth: number, viewportHeight: number): void; - } - - export class SpritePlugin implements RendererPlugin { - constructor(); - - init(renderer: Renderer): void; - render(scene: Scene, camera: Camera, viewportWidth: number, viewportHeight: number): void; - } - - // Scenes ///////////////////////////////////////////////////////////////////// - - export interface IFog { - name:string; - color: Color; - clone():IFog; - } - - - /** - * This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance. - */ - export class Fog implements IFog { - constructor(hex: number, near?: number, far?: number); - - name:string; - - /** - * Fog color. - */ - color: Color; - - /** - * The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog. - */ - near: number; - - /** - * The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog. - * Default is 1000. - */ - far: number; - - clone(): Fog; - } - - /** - * This class contains the parameters that define linear fog, i.e., that grows exponentially denser with the distance. - */ - export class FogExp2 implements IFog { - constructor(hex: number|string, density?: number); - - name: string; - color: Color; - - /** - * Defines how fast the fog will grow dense. - * Default is 0.00025. - */ - density: number; - - clone(): FogExp2; - } - - /** - * Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras. - */ - export class Scene extends Object3D { - constructor(); - - /** - * A fog instance defining the type of fog that affects everything rendered in the scene. Default is null. - */ - fog: IFog; - - /** - * If not null, it will force everything in the scene to be rendered with that material. Default is null. - */ - overrideMaterial: Material; - autoUpdate: boolean; - - copy(source: Scene): Scene; - } - - // Textures ///////////////////////////////////////////////////////////////////// - export class CanvasTexture extends Texture { - constructor( - canvas: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - - needsUpdate: boolean; - } - - export class CompressedTexture extends Texture { - constructor( - mipmaps: ImageData[], - width: number, - height: number, - format?: PixelFormat, - type?: TextureDataType, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - anisotropy?: number - ); - - image: { width: number; height: number; }; - mipmaps: ImageData[]; - flipY: boolean; - generateMipmaps: boolean; - } - - export class CubeTexture extends Texture { - constructor( - images: any[], // HTMLImageElement or HTMLCanvasElement - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - - images: any[]; - - copy(source: CubeTexture): CubeTexture; - } - - export class DataTexture extends Texture { - constructor( - data: ImageData, - width: number, - height: number, - format: PixelFormat, - type: TextureDataType, - mapping: Mapping, - wrapS: Wrapping, - wrapT: Wrapping, - magFilter: TextureFilter, - minFilter: TextureFilter, - anisotropy?: number - ); - - image: { data: ImageData; width: number; height: number; }; - magFilter: TextureFilter; - minFilter: TextureFilter; - flipY: boolean; - generateMipmaps: boolean; - } - - export class Texture { - constructor( - image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - - id: number; - uuid: string; - name: string; - sourceFile: string; - image: any; // HTMLImageElement or ImageData ; - mipmaps: ImageData[]; - mapping: Mapping; - wrapS: Wrapping; - wrapT: Wrapping; - magFilter: TextureFilter; - minFilter: TextureFilter; - anisotropy: number; - format: PixelFormat; - type: TextureDataType; - offset: Vector2; - repeat: Vector2; - generateMipmaps: boolean; - premultiplyAlpha: boolean; - flipY: boolean; - unpackAlignment: number; - version: number; - needsUpdate: boolean; - onUpdate: () => void; - static DEFAULT_IMAGE: any; - static DEFAULT_MAPPING: any; - - clone(): Texture; - copy(source: Texture): Texture; - toJSON(meta: any): any; - dispose(): void; - transformUv( uv: Vector ): void; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; - hasEventListener(type: string, listener: (event: any) => void): void; - removeEventListener(type: string, listener: (event: any) => void): void; - dispatchEvent(event: { type: string; target: any; }): void; - } - - class VideoTexture extends Texture { - constructor( - video: HTMLVideoElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - - generateMipmaps: boolean; - } - - // Extras ///////////////////////////////////////////////////////////////////// - export var CurveUtils: { - tangentQuadraticBezier(t: number, p0: number, p1: number, p2: number): number; - tangentCubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; - tangentSpline(t: number, p0: number, p1: number, p2: number, p3: number): number; - interpolate(p0: number, p1: number, p2: number, p3: number, t: number): number; - } - - // deprecated. - export var ImageUtils: { - crossOrigin: string; - - // deprecated. - loadTexture(url: string, mapping?: Mapping, onLoad?: (texture: Texture) => void, onError?: (message: string) => void): Texture; - - // deprecated. - loadTextureCube(array: string[], mapping?: Mapping, onLoad?: (texture: Texture) => void , onError?: (message: string) => void ): Texture; - - // deprecated. - getNormalMap(image: HTMLImageElement, depth?: number): HTMLCanvasElement; - - // deprecated. - generateDataTexture(width: number, height: number, color: Color): DataTexture; - }; - - export var SceneUtils: { - createMultiMaterialObject(geometry: Geometry, materials: Material[]): Object3D; - detach(child: Object3D, parent: Object3D, scene: Scene): void; - attach(child: Object3D, scene: Scene, parent: Object3D): void; - }; - - export var ShapeUtils: { - area( contour: number[] ): number; - triangulate( contour: number[], indices: boolean ): number[]; - triangulateShape( contour: number[], holes: any[] ): number[]; - isClockWise( pts: number[] ): boolean; - b2( t: number, p0: number, p1: number, p2: number ): number; - b3( t: number, p0: number, p1: number, p2: number, p3: number ): number; - }; - - // Extras / Audio ///////////////////////////////////////////////////////////////////// - - export class Audio extends Object3D { - constructor(listener: AudioListener); - type: string; - context: AudioContext; - source: AudioBufferSourceNode; - gain: GainNode; - panner: PannerNode; - autoplay: boolean; - startTime: number; - playbackRate: number; - isPlaying: boolean; - - load(file: string): Audio; - play(): void; - pause(): void; - stop(): void; - connect(): void; - disconnect(): void; - setFilter(value: any): void; - getFilter(): any; - setPlaybackRate(value: number): void; - getPlaybackRate(): number; - - setLoop(value: boolean): void; - getLoop(): boolean; - setRefDistance(value: number): void; - getRefDistance(): number; - setRolloffFactor(value: number): void; - getRolloffFactor(): number; - setVolume(value: number): void; - getVolume(): number; - updateMatrixWorld(force?: boolean): void; - } - - export class AudioListener extends Object3D { - constructor(); - - type: string; - context: AudioContext; - - updateMatrixWorld(force?: boolean): void; - } - - // Extras / Core ///////////////////////////////////////////////////////////////////// - - /** - * An extensible curve object which contains methods for interpolation - * class Curve<T extends Vector> - */ - export class Curve { - /** - * Returns a vector for point t of the curve where t is between 0 and 1 - * getPoint(t: number): T; - */ - getPoint(t: number): T; - - /** - * Returns a vector for point at relative position in curve according to arc length - * getPointAt(u: number): T; - */ - getPointAt(u: number):T; - - /** - * Get sequence of points using getPoint( t ) - * getPoints(divisions?: number): T[]; - */ - getPoints(divisions?: number): T[]; - - /** - * Get sequence of equi-spaced points using getPointAt( u ) - * getSpacedPoints(divisions?: number): T[]; - */ - getSpacedPoints(divisions?: number): T[]; - - /** - * Get total curve arc length - */ - getLength(): number; - - /** - * Get list of cumulative segment lengths - */ - getLengths(divisions?: number): number[]; - - /** - * Update the cumlative segment distance cache - */ - updateArcLengths(): void; - - /** - * Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance - */ - getUtoTmapping(u: number, distance: number): number; - - /** - * Returns a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation - * getTangent(t: number): T; - */ - getTangent(t: number): T; - - /** - * Returns tangent at equidistance point u on the curve - * getTangentAt(u: number): T; - */ - getTangentAt(u: number): T; - - static create(constructorFunc: Function, getPointFunc: Function): Function; - } - - export var CurveUtils: { - tangentQuadraticBezier(t: number, p0: number, p1: number, p2: number): number; - tangentCubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; - tangentSpline(t: number, p0: number, p1: number, p2: number, p3: number): number; - interpolate(p0: number, p1: number, p2: number, p3: number, t: number): number; - }; - - export interface BoundingBox { - minX: number; - minY: number; - minZ?: number; - maxX: number; - maxY: number; - maxZ?: number; - } - - export class CurvePath extends Curve { - constructor(); - - curves: Curve[]; - autoClose: boolean; - - add(curve: Curve): void; - checkConnection(): boolean; - closePath(): void; - getPoint(t: number): T; - getLength(): number; - getCurveLengths(): number[]; - createPointsGeometry(divisions: number): Geometry; - createSpacedPointsGeometry(divisions: number): Geometry; - createGeometry(points: T[]): Geometry; - } - - export enum PathActions { - MOVE_TO, - LINE_TO, - QUADRATIC_CURVE_TO, // Bezier quadratic curve - BEZIER_CURVE_TO, // Bezier cubic curve - CSPLINE_THRU, // Catmull-rom spline - ARC, // Circle - ELLIPSE, - } - - export interface PathAction { - action: PathActions; - args: any; - } - - /** - * a 2d path representation, comprising of points, lines, and cubes, similar to the html5 2d canvas api. It extends CurvePath. - */ - export class Path extends CurvePath { - constructor(points?: Vector2[]); - - actions: PathAction[]; - - fromPoints(vectors: Vector2[]): void; - moveTo(x: number, y: number): void; - lineTo(x: number, y: number): void; - quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): void; - bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): void; - splineThru(pts: Vector2[]): void; - arc(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; - absarc(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; - ellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; - absellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; - getSpacedPoints(divisions?: number, closedPath?: boolean): Vector2[]; - getPoints(divisions?: number, closedPath?: boolean): Vector2[]; - toShapes(): Shape[]; - } - - /** - * Defines a 2d shape plane using paths. - */ - export class Shape extends Path { - constructor(points?: Vector2[]); - - holes: Path[]; - - extrude(options?: any): ExtrudeGeometry; - makeGeometry(options?: any): ShapeGeometry; - getPointsHoles(divisions: number): Vector2[][]; - extractAllPoints(divisions: number): { - shape: Vector2[]; - holes: Vector2[][]; - }; - extractPoints(divisions: number): Vector2[]; - - } - - // Extras / Curves ///////////////////////////////////////////////////////////////////// - export class ArcCurve extends EllipseCurve { - constructor(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean ); - } - - export class CatmullRomCurve3 extends Curve { - constructor(); - } - - export class ClosedSplineCurve3 extends Curve { - constructor(points?: Vector3[]); - - points: Vector3[]; - } - - export class CubicBezierCurve extends Curve { - constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2); - - v0: Vector2; - v1: Vector2; - v2: Vector2; - v3: Vector2; - } - export class CubicBezierCurve3 extends Curve { - constructor(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3); - - v0: Vector3; - v1: Vector3; - v2: Vector3; - v3: Vector3; - } - export class EllipseCurve extends Curve { - constructor(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number); - - aX: number; - aY: number; - xRadius: number; - yRadius: number; - aStartAngle: number; - aEndAngle: number; - aClockwise: boolean; - aRotation: number; - } - export class LineCurve extends Curve { - constructor( v1: Vector2, v2: Vector2 ); - - v1: Vector2; - v2: Vector2; - - } - export class LineCurve3 extends Curve { - constructor( v1: Vector3, v2: Vector3 ); - - v1: Vector3; - v2: Vector3; - } - export class QuadraticBezierCurve extends Curve { - constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); - - v0: Vector2; - v1: Vector2; - v2: Vector2; - } - export class QuadraticBezierCurve3 extends Curve { - constructor( v0: Vector3, v1: Vector3, v2: Vector3 ); - - v0: Vector3; - v1: Vector3; - v2: Vector3; - } - export class SplineCurve extends Curve { - constructor( points?: Vector2[] ); - - points:Vector2[]; - } - export class SplineCurve3 extends Curve { - constructor( points?: Vector3[] ); - - points:Vector3[]; - } - - // Extras / Geomerties ///////////////////////////////////////////////////////////////////// - /** - * BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided within the (optional) 'width', 'height', & 'depth' constructor arguments. - */ - export class BoxGeometry extends Geometry { - /** - * @param width — Width of the sides on the X axis. - * @param height — Height of the sides on the Y axis. - * @param depth — Depth of the sides on the Z axis. - * @param widthSegments — Number of segmented faces along the width of the sides. - * @param heightSegments — Number of segmented faces along the height of the sides. - * @param depthSegments — Number of segmented faces along the depth of the sides. - */ - constructor(width: number, height: number, depth: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); - - parameters: { - width: number; - height: number; - depth: number; - widthSegments: number; - heightSegments: number; - depthSegments: number; - }; - - clone(): BoxGeometry; - } - - export class CircleBufferGeometry extends Geometry { - constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); - - parameters: { - radius: number; - segments: number; - thetaStart: number; - thetaLength: number; - }; - - clone(): CircleBufferGeometry; - } - - export class CircleGeometry extends Geometry { - constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); - - parameters: { - radius: number; - segments: number; - thetaStart: number; - thetaLength: number; - }; - - clone(): CircleGeometry; - } - - // deprecated - export class CubeGeometry extends BoxGeometry { - } - - export class CylinderGeometry extends Geometry { - /** - * @param radiusTop — Radius of the cylinder at the top. - * @param radiusBottom — Radius of the cylinder at the bottom. - * @param height — Height of the cylinder. - * @param radiusSegments — Number of segmented faces around the circumference of the cylinder. - * @param heightSegments — Number of rows of faces along the height of the cylinder. - * @param openEnded - A Boolean indicating whether or not to cap the ends of the cylinder. - */ - constructor(radiusTop?: number, radiusBottom?: number, height?: number, radiusSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); - - parameters: { - radiusTop: number; - radiusBottom: number; - height: number; - radialSegments: number; - heightSegments: number; - openEnded: boolean; - thetaStart: number; - thetaLength: number; - }; - - clone(): CylinderGeometry; - } - - export class DodecahedronGeometry extends Geometry { - constructor(radius: number, detail: number); - - parameters: { - radius: number; - detail: number; - }; - - clone(): DodecahedronGeometry; - } - - export class EdgesGeometry extends BufferGeometry { - constructor(geometry: BufferGeometry, thresholdAngle: number); - - clone(): EdgesGeometry; - } - - export class ExtrudeGeometry extends Geometry { - constructor(shape?: Shape, options?: any); - constructor(shapes?: Shape[], options?: any); - - static WorldUVGenerator: { - generateTopUV(geometry: Geometry, indexA: number, indexB: number, indexC: number): Vector2[]; - generateSideWallUV(geometry: Geometry, indexA: number, indexB: number, indexC: number, indexD: number): Vector2[]; - }; - - addShapeList(shapes: Shape[], options?: any): void; - addShape(shape: Shape, options?: any): void; - } - - export class IcosahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); - - clone(): IcosahedronGeometry; - } - - export class LatheGeometry extends Geometry { - constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); - - parameters: { - points: Vector3[]; - segments: number; - phiStart: number; - phiLength: number; - }; - } - - export class OctahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); - - clone(): OctahedronGeometry; - } - - export class ParametricGeometry extends Geometry { - constructor(func: (u: number, v: number) => Vector3, slices: number, stacks: number); - - parameters: { - func: (u: number, v: number) => Vector3; - slices: number; - stacks: number; - }; - } - - export class PlaneBufferGeometry extends BufferGeometry { - constructor(width: number, height: number, widthSegments?: number, heightSegments?: number); - - parameters: { - width: number; - height: number; - widthSegments: number; - heightSegments: number; - }; - - clone(): PlaneBufferGeometry; - } - - export class PlaneGeometry extends Geometry { - constructor(width: number, height: number, widthSegments?: number, heightSegments?: number); - - parameters: { - width: number; - height: number; - widthSegments: number; - heightSegments: number; - }; - - clone(): PlaneGeometry; - } - - export class PolyhedronGeometry extends Geometry { - constructor(vertices: Vector3[], faces: Face3[], radius?: number, detail?: number); - - parameters: { - vertices: Vector3[]; - faces: Face3[]; - radius: number; - detail: number; - }; - - clone(): PolyhedronGeometry; - } - - export class RingGeometry extends Geometry { - constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); - - parameters: { - innerRadius: number; - outerRadius: number; - thetaSegments: number; - phiSegments: number; - thetaStart: number; - thetaLength: number; - }; - - clone(): RingGeometry; - } - - export class ShapeGeometry extends Geometry { - constructor(shape: Shape, options?: any); - constructor(shapes: Shape[], options?: any); - - - addShapeList(shapes: Shape[], options: any): ShapeGeometry; - addShape(shape: Shape, options?: any): void; - } - - - export class SphereBufferGeometry extends BufferGeometry { - constructor(radius: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); - - parameters: { - radius: number; - widthSegments: number; - heightSegments: number; - phiStart: number; - phiLength: number; - thetaStart: number; - thetaLength: number; - }; - - clone(): SphereBufferGeometry; - } - - /** - * A class for generating sphere geometries - */ - export class SphereGeometry extends Geometry { - /** - * The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices. - * - * @param radius — sphere radius. Default is 50. - * @param widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8. - * @param heightSegments — number of vertical segments. Minimum value is 2, and the default is 6. - * @param phiStart — specify horizontal starting angle. Default is 0. - * @param phiLength — specify horizontal sweep angle size. Default is Math.PI * 2. - * @param thetaStart — specify vertical starting angle. Default is 0. - * @param thetaLength — specify vertical sweep angle size. Default is Math.PI. - */ - constructor(radius: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); - - parameters: { - radius: number; - widthSegments: number; - heightSegments: number; - phiStart: number; - phiLength: number; - thetaStart: number; - thetaLength: number; - }; - } - - export class TetrahedronGeometry extends PolyhedronGeometry { - constructor(radius?: number, detail?: number); - - clone(): TetrahedronGeometry; - } - - export class TorusGeometry extends Geometry { - constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number); - - parameters: { - radius: number; - tube: number; - radialSegments: number; - tubularSegments: number; - arc: number; - }; - - clone(): TorusGeometry; - } - - export class TorusKnotGeometry extends Geometry { - constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, heightScale?: number); - - parameters: { - radius: number; - tube: number; - radialSegments: number; - tubularSegments: number; - p: number; - q: number; - heightScale: number; - }; - - clone(): TorusKnotGeometry; - } - - - export class TubeGeometry extends Geometry { - constructor(path: Path, segments?: number, radius?: number, radiusSegments?: number, closed?: boolean, taper?: (u: number) => number); - - parameters: { - path: Path; - segments: number; - radius: number; - radialSegments: number; - closed: boolean; - taper: (u: number) => number; // NoTaper or SinusoidalTaper; - }; - tangents: Vector3[]; - normals: Vector3[]; - binormals: Vector3[]; - - static NoTaper(u?: number): number; - static SinusoidalTaper(u: number): number; - static FrenetFrames(path: Path, segments: number, closed: boolean): void; - - clone(): TubeGeometry; - } - - export class WireframeGeometry extends BufferGeometry{ - constructor(geometry: Geometry | BufferGeometry); - } - - // Extras / Helpers ///////////////////////////////////////////////////////////////////// - - export class ArrowHelper extends Object3D { - constructor(dir: Vector3, origin?: Vector3, length?: number, hex?: number, headLength?: number, headWidth?: number); - - line: Line; - cone: Mesh; - - setDirection(dir: Vector3): void; - setLength(length: number, headLength?: number, headWidth?: number): void; - setColor(hex: number): void; - } - - export class AxisHelper extends LineSegments { - constructor(size?: number); - } - - export class BoundingBoxHelper extends Mesh { - constructor(object?: Object3D, hex?: number); - - object: Object3D; - box: Box3; - - update(): void; - } - - export class BoxHelper extends LineSegments { - constructor(object?: Object3D); - - update(object?: Object3D): void; - } - - export class CameraHelper extends LineSegments { - constructor(camera: Camera); - - camera: Camera; - pointMap: { [id: string]: number[]; }; - - update(): void; - } - - export class DirectionalLightHelper extends Object3D { - constructor(light: Light, size?: number); - - light: Light; - lightPlane: Line; - targetLine: Line; - - dispose(): void; - update(): void; - } - - export class EdgesHelper extends LineSegments { - constructor(object: Object3D, hex?: number, thresholdAngle?: number); - - } - - export class FaceNormalsHelper extends LineSegments { - constructor(object: Object3D, size?: number, hex?: number, linewidth?: number); - - object: Object3D; - size: number; - - update(object?: Object3D): void; - } - - export class GridHelper extends LineSegments { - constructor(size: number, step: number); - - color1: Color; - color2: Color; - - setColors(colorCenterLine: number, colorGrid: number): void; - } - export class HemisphereLightHelper extends Object3D { - constructor(light: Light, sphereSize: number); - - light: Light; - colors: Color[]; - lightSphere: Mesh; - - dispose(): void; - update(): void; - } - - export class PointLightHelper extends Object3D { - constructor(light: Light, sphereSize: number); - - light: Light; - - dispose(): void; - update(): void; - } - - export class SkeletonHelper extends LineSegments { - constructor(bone: Object3D); - - bones: Bone[]; - root: Object3D; - - getBoneList(object: Object3D): Bone[]; - update(): void; - } - - export class SpotLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number); - - light: Light; - cone: Mesh; - - dispose(): void; - update(): void; - } - - export class VertexNormalsHelper extends LineSegments { - constructor(object: Object3D, size?: number, hex?: number, linewidth?: number); - - object: Object3D; - size: number; - - update(object?: Object3D): void; - } - - export class WireframeHelper extends LineSegments { - constructor(object: Object3D, hex?: number); - - } - - // Extras / Objects ///////////////////////////////////////////////////////////////////// - - export class ImmediateRenderObject extends Object3D { - constructor(material: Material); - - material: Material; - render(renderCallback:Function): void; - } - - export interface MorphBlendMeshAnimation { - start: number; - end: number; - length: number; - fps: number; - duration: number; - lastFrame: number; - currentFrame: number; - active: boolean; - time: number; - direction: number; - weight: number; - directionBackwards: boolean; - mirroredLoop: boolean; - } - - export class MorphBlendMesh extends Mesh { - constructor(geometry: Geometry, material: Material); - - animationsMap: { [name: string]: MorphBlendMeshAnimation; }; - animationsList: MorphBlendMeshAnimation[]; - - createAnimation(name: string, start: number, end: number, fps: number): void; - autoCreateAnimations(fps: number): void; - setAnimationDirectionForward(name: string): void; - setAnimationDirectionBackward(name: string): void; - setAnimationFPS(name: string, fps: number): void; - setAnimationDuration(name: string, duration: number): void; - setAnimationWeight(name: string, weight: number): void; - setAnimationTime(name: string, time: number): void; - getAnimationTime(name: string): number; - getAnimationDuration(name: string): number; - playAnimation(name: string): void; - stopAnimation(name: string): void; - update(delta: number): void; - } -} - -declare module 'three' { - export = THREE; -} diff --git a/package.json b/package.json index 2d085bb..938123d 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "license": "(MIT OR Apache-2.0)", "main": "main.js", "dependencies": { + "@types/jquery": "^3.2.13", + "@types/three": "^0.84.27", "bootstrap": "^3.3.1", "bootstrap-tour": "^0.10.1", "inherits": "^2.0.1", @@ -16,6 +18,7 @@ "vec2": "^1.6.0" }, "devDependencies": { + "@types/node": "^8.0.34", "browserify": "^8.0.2", "grunt": "^1.0.1", "grunt-browser-sync": "^2.2.0", @@ -29,7 +32,8 @@ "grunt-subgrunt": "^1.2.0", "grunt-ts": "^6.0.0-beta.16", "grunt-typedoc": "^0.2.4", - "matchdep": "^1.0.1" + "matchdep": "^1.0.1", + "typescript": "2.5.3" }, "repository": { "type": "git", diff --git a/src/floorplanner/floorplanner.ts b/src/floorplanner/floorplanner.ts index 98401ef..f2b5f8c 100644 --- a/src/floorplanner/floorplanner.ts +++ b/src/floorplanner/floorplanner.ts @@ -1,4 +1,4 @@ -/// +/// /// /// diff --git a/src/floorplanner/floorplanner_view.ts b/src/floorplanner/floorplanner_view.ts index e660ba4..0b1ecf5 100644 --- a/src/floorplanner/floorplanner_view.ts +++ b/src/floorplanner/floorplanner_view.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/floor_item.ts b/src/items/floor_item.ts index 2095ca3..9923461 100644 --- a/src/items/floor_item.ts +++ b/src/items/floor_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/in_wall_floor_item.ts b/src/items/in_wall_floor_item.ts index 0073dc2..7f97274 100644 --- a/src/items/in_wall_floor_item.ts +++ b/src/items/in_wall_floor_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/in_wall_item.ts b/src/items/in_wall_item.ts index 2d89fe3..f9d885d 100644 --- a/src/items/in_wall_item.ts +++ b/src/items/in_wall_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/item.ts b/src/items/item.ts index 7954f81..11cdcb4 100644 --- a/src/items/item.ts +++ b/src/items/item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/on_floor_item.ts b/src/items/on_floor_item.ts index 0093086..ea72cb1 100644 --- a/src/items/on_floor_item.ts +++ b/src/items/on_floor_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/wall_floor_item.ts b/src/items/wall_floor_item.ts index 9895f5a..dfa3b74 100644 --- a/src/items/wall_floor_item.ts +++ b/src/items/wall_floor_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/items/wall_item.ts b/src/items/wall_item.ts index 0919fac..05c0397 100644 --- a/src/items/wall_item.ts +++ b/src/items/wall_item.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/model/corner.ts b/src/model/corner.ts index 91f147d..39d892d 100644 --- a/src/model/corner.ts +++ b/src/model/corner.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/model/floorplan.ts b/src/model/floorplan.ts index 12304cb..2d7cf17 100644 --- a/src/model/floorplan.ts +++ b/src/model/floorplan.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// /// diff --git a/src/model/half_edge.ts b/src/model/half_edge.ts index bb2ed19..55c9482 100644 --- a/src/model/half_edge.ts +++ b/src/model/half_edge.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// module BP3D.Model { diff --git a/src/model/model.ts b/src/model/model.ts index dcddfe3..a1eb3cb 100644 --- a/src/model/model.ts +++ b/src/model/model.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// diff --git a/src/model/room.ts b/src/model/room.ts index 5fccfae..b95c46f 100644 --- a/src/model/room.ts +++ b/src/model/room.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// /// diff --git a/src/model/scene.ts b/src/model/scene.ts index f58ddd5..3744e38 100644 --- a/src/model/scene.ts +++ b/src/model/scene.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// diff --git a/src/model/wall.ts b/src/model/wall.ts index e3af69b..af22fa2 100644 --- a/src/model/wall.ts +++ b/src/model/wall.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// /// diff --git a/src/three/controller.ts b/src/three/controller.ts index cb381f4..498de4c 100644 --- a/src/three/controller.ts +++ b/src/three/controller.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// module BP3D.Three { diff --git a/src/three/controls.ts b/src/three/controls.ts index b193663..1e81dac 100644 --- a/src/three/controls.ts +++ b/src/three/controls.ts @@ -8,8 +8,8 @@ Contributors: * @author erich666 / http://erichaines.com */ -/// -/// +/// +/// module BP3D.Three { export var Controls = function (object, domElement) { diff --git a/src/three/edge.ts b/src/three/edge.ts index 81ac438..642fe58 100644 --- a/src/three/edge.ts +++ b/src/three/edge.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// module BP3D.Three { diff --git a/src/three/floor.ts b/src/three/floor.ts index b8f9bfd..00461a9 100644 --- a/src/three/floor.ts +++ b/src/three/floor.ts @@ -1,4 +1,4 @@ -/// +/// /// module BP3D.Three { diff --git a/src/three/floorplan.ts b/src/three/floorplan.ts index d68ccfb..e869324 100644 --- a/src/three/floorplan.ts +++ b/src/three/floorplan.ts @@ -1,4 +1,4 @@ -/// +/// /// /// diff --git a/src/three/hud.ts b/src/three/hud.ts index cc3c5e9..e53e05c 100644 --- a/src/three/hud.ts +++ b/src/three/hud.ts @@ -1,4 +1,4 @@ -/// +/// /// module BP3D.Three { diff --git a/src/three/lights.ts b/src/three/lights.ts index a25aff4..1c32167 100644 --- a/src/three/lights.ts +++ b/src/three/lights.ts @@ -1,4 +1,4 @@ -/// +/// module BP3D.Three { export var Lights = function (scene, floorplan) { diff --git a/src/three/main.ts b/src/three/main.ts index 441bfa4..6f28b3c 100644 --- a/src/three/main.ts +++ b/src/three/main.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// /// /// /// diff --git a/src/three/skybox.ts b/src/three/skybox.ts index 7f7e785..8f5ad31 100644 --- a/src/three/skybox.ts +++ b/src/three/skybox.ts @@ -1,4 +1,4 @@ -/// +/// module BP3D.Three { export var Skybox = function (scene) { From 3e12e15505b6cb870b51c114f07524ee059e5819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Sat, 14 Oct 2017 19:39:09 +0300 Subject: [PATCH 07/16] debug mode of grunt-ts compiles directly into examples folder so that sourcemaps are not broken --- gruntfile.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index 91a381d..769b8e6 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { configuration.watch = { scripts: { files: ['src/**/*.ts'], - tasks: ['compile', 'example'], + tasks: ["ts:debug"], options: { spawn: false, } @@ -37,7 +37,7 @@ module.exports = function (grunt) { configuration.browserSync = { dev: { bsFiles: { - src: 'example/js/*.js' + src: globalConfig.exampleDir }, options: { server: { @@ -59,13 +59,21 @@ module.exports = function (grunt) { declaration: false, sourceMap: true, removeComments: false - } + }, + debug: { + src: globalConfig.sources, + dest: globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js" + }, + release: { + src: globalConfig.sources, + dest: globalConfig.outDir + "/" + globalConfig.moduleName + ".js" + } }; - configuration.ts[globalConfig.moduleName] = { - src: globalConfig.sources, - dest: globalConfig.outDir + "/" + globalConfig.moduleName + ".js" - }; + configuration.ts.debugExample = { + src: globalConfig.sources, + dest: globalConfig.exampleDir + "/" + globalConfig.moduleName + ".js" + }; configuration.concurrent = { target1: ["browserSync", "watch"] @@ -103,10 +111,6 @@ module.exports = function (grunt) { grunt.initConfig(configuration); - grunt.registerTask("compile", [ - "ts:" + globalConfig.moduleName - ]); - grunt.registerTask("example", [ "copy:threejs", "copy:" + globalConfig.moduleName @@ -114,14 +118,14 @@ module.exports = function (grunt) { grunt.registerTask("release", [ "clean", - "compile", + "ts:release", "uglify:" + globalConfig.moduleName, "typedoc:" + globalConfig.moduleName ]); grunt.registerTask("default", [ "clean", - "compile", + "ts:debug", "example", "concurrent:target1" ]); From 1f29f46602aed7b02de3ab3a031753e234e3fe38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20G=C3=BCrarslan?= Date: Sun, 15 Oct 2017 00:11:10 +0300 Subject: [PATCH 08/16] types options added to grunt-ts gruntfile formatted --- example/js/jquery.js | 10351 ------------------------ gruntfile.js | 265 +- src/floorplanner/floorplanner.ts | 1 - src/floorplanner/floorplanner_view.ts | 1 - src/items/floor_item.ts | 1 - src/items/in_wall_floor_item.ts | 1 - src/items/in_wall_item.ts | 1 - src/items/item.ts | 1 - src/items/on_floor_item.ts | 1 - src/items/wall_floor_item.ts | 1 - src/items/wall_item.ts | 1 - src/model/corner.ts | 1 - src/model/floorplan.ts | 2 - src/model/half_edge.ts | 2 - src/model/model.ts | 2 - src/model/room.ts | 2 - src/model/scene.ts | 2 - src/model/wall.ts | 2 - src/three/controller.ts | 2 - src/three/controls.ts | 3 - src/three/edge.ts | 2 - src/three/floor.ts | 1 - src/three/floorplan.ts | 1 - src/three/hud.ts | 1 - src/three/lights.ts | 1 - src/three/main.ts | 2 - src/three/skybox.ts | 1 - 27 files changed, 146 insertions(+), 10506 deletions(-) delete mode 100644 example/js/jquery.js diff --git a/example/js/jquery.js b/example/js/jquery.js deleted file mode 100644 index 6feb110..0000000 --- a/example/js/jquery.js +++ /dev/null @@ -1,10351 +0,0 @@ -/*! - * jQuery JavaScript Library v1.11.3 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2015-04-28T16:19Z - */ - -(function( global, factory ) { - - if ( typeof module === "object" && typeof module.exports === "object" ) { - // For CommonJS and CommonJS-like environments where a proper window is present, - // execute the factory and get jQuery - // For environments that do not inherently posses a window with a document - // (such as Node.js), expose a jQuery-making factory as module.exports - // This accentuates the need for the creation of a real window - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -// - -var deletedIds = []; - -var slice = deletedIds.slice; - -var concat = deletedIds.concat; - -var push = deletedIds.push; - -var indexOf = deletedIds.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var support = {}; - - - -var - version = "1.11.3", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android<4.1, IE<9 - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num != null ? - - // Return just the one element from the set - ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - - // Return all the elements in a clean array - slice.call( this ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: deletedIds.sort, - splice: deletedIds.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - // parseFloat NaNs numeric-cast false positives (null|true|false|"") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - // adding 1 corrects loss of precision from parseFloat (#15100) - return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( support.ownLast ) { - for ( key in obj ) { - return hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - type: function( obj ) { - if ( obj == null ) { - return obj + ""; - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call(obj) ] || "object" : - typeof obj; - }, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Support: Android<4.1, IE<9 - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( indexOf ) { - return indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - while ( j < len ) { - first[ i++ ] = second[ j++ ]; - } - - // Support: IE<9 - // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) - if ( len !== len ) { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - now: function() { - return +( new Date() ); - }, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - - // Support: iOS 8.2 (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = "length" in obj && obj.length, - type = jQuery.type( obj ); - - if ( type === "function" || jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.2.0-pre - * http://sizzlejs.com/ - * - * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2014-12-16 - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // General-purpose constants - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // http://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", - - pseudos = ":(" + characterEncoding + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - nodeType = context.nodeType; - - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - if ( !seed && documentIsHTML ) { - - // Try to shortcut find operations when possible (e.g., not under DocumentFragment) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document (jQuery #6963) - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType !== 1 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, parent, - doc = node ? node.ownerDocument || node : preferredDoc; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - parent = doc.defaultView; - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent !== parent.top ) { - // IE11 does not have attachEvent, so all must suffer - if ( parent.addEventListener ) { - parent.addEventListener( "unload", unloadHandler, false ); - } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", unloadHandler ); - } - } - - /* Support tests - ---------------------------------------------------------------------- */ - documentIsHTML = !isXML( doc ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [ m ] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - docElem.appendChild( div ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( div.querySelectorAll("[msallowcapture^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ - if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push("~="); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibing-combinator selector` fails - if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push(".#.+[+~]"); - } - }); - - assert(function( div ) { - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( div.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch (e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - // Don't keep the element (issue #299) - input[0] = null; - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (oldCache = outerCache[ dir ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - outerCache[ dir ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context !== document && context; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); - - results = results || []; - - // Try to minimize operations if there is no seed and only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -return Sizzle; - -})( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - - -var rneedsContext = jQuery.expr.match.needsContext; - -var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); - - - -var risSimple = /^.[^:#\[\.,]*$/; - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( risSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); -}; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -}); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - init = jQuery.fn.init = function( selector, context ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return typeof rootjQuery.ready !== "undefined" ? - rootjQuery.ready( selector ) : - // Execute immediately if ready is not present - selector( jQuery ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.extend({ - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -jQuery.fn.extend({ - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - matched.push( cur ); - break; - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.unique( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); -var rnotwhite = (/\S+/g); - - - -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( values === progressValues ) { - deferred.notifyWith( contexts, values ); - - } else if ( !(--remaining) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); - - -// The deferred used on DOM ready -var readyList; - -jQuery.fn.ready = function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; -}; - -jQuery.extend({ - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - jQuery( document ).off( "ready" ); - } - } -}); - -/** - * Clean-up method for dom ready events - */ -function detach() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } -} - -/** - * The ready event handler and self cleanup method - */ -function completed() { - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } -} - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - - -var strundefined = typeof undefined; - - - -// Support: IE<9 -// Iteration over object's inherited properties before its own -var i; -for ( i in jQuery( support ) ) { - break; -} -support.ownLast = i !== "0"; - -// Note: most support tests are defined in their respective modules. -// false until the test is run -support.inlineBlockNeedsLayout = false; - -// Execute ASAP in case we need to set body.style.zoom -jQuery(function() { - // Minified: var a,b,c,d - var val, div, body, container; - - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body || !body.style ) { - // Return for frameset docs that don't have a body - return; - } - - // Setup - div = document.createElement( "div" ); - container = document.createElement( "div" ); - container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; - body.appendChild( container ).appendChild( div ); - - if ( typeof div.style.zoom !== strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; - - support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; - if ( val ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); -}); - - - - -(function() { - var div = document.createElement( "div" ); - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } - - // Null elements to avoid leaks in IE. - div = null; -})(); - - -/** - * Determines whether an object can have data - */ -jQuery.acceptData = function( elem ) { - var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], - nodeType = +elem.nodeType || 1; - - // Do not set data on non-element DOM nodes because it will not be cleared (#8335). - return nodeType !== 1 && nodeType !== 9 ? - false : - - // Nodes accept data unless otherwise specified; rejection can be conditional - !noData || noData !== true && elem.getAttribute("classid") === noData; -}; - - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /([A-Z])/g; - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - -function internalData( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var ret, thisCache, - internalKey = jQuery.expando, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - // Avoid exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( typeof name === "string" ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - i = name.length; - while ( i-- ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - /* jshint eqeqeq: false */ - } else if ( support.deleteExpando || cache != cache.window ) { - /* jshint eqeqeq: true */ - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // The following elements (space-suffixed to avoid Object.prototype collisions) - // throw uncatchable exceptions if you attempt to set expando properties - noData: { - "applet ": true, - "embed ": true, - // ...but Flash objects (which have this classid) *can* handle expandos - "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var i, name, data, - elem = this[0], - attrs = elem && elem.attributes; - - // Special expections of .data basically thwart jQuery.access, - // so implement the relevant behavior ourselves - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE11+ - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return arguments.length > 1 ? - - // Sets one value - this.each(function() { - jQuery.data( this, key, value ); - }) : - - // Gets one value - // Try to fetch any internally stored data first - elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - - -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var isHidden = function( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); - }; - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; -}; -var rcheckableType = (/^(?:checkbox|radio)$/i); - - - -(function() { - // Minified: var a,b,c - var input = document.createElement( "input" ), - div = document.createElement( "div" ), - fragment = document.createDocumentFragment(); - - // Setup - div.innerHTML = "
a"; - - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName( "tbody" ).length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = - document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - input.type = "checkbox"; - input.checked = true; - fragment.appendChild( input ); - support.appendChecked = input.checked; - - // Make sure textarea (and checkbox) defaultValue is properly cloned - // Support: IE6-IE11+ - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // #11217 - WebKit loses check when the name is after the checked attribute - fragment.appendChild( div ); - div.innerHTML = ""; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - support.noCloneEvent = true; - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } -})(); - - -(function() { - var i, eventName, - div = document.createElement( "div" ); - - // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) - for ( i in { submit: true, change: true, focusin: true }) { - eventName = "on" + i; - - if ( !(support[ i + "Bubbles" ] = eventName in window) ) { - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - div.setAttribute( eventName, "t" ); - support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; - } - } - - // Null elements to avoid leaks in IE. - div = null; -})(); - - -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && jQuery.acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - // Support: IE < 9, Android < 4.0 - src.returnValue === false ? - returnTrue : - returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && e.stopImmediatePropagation ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - jQuery._removeData( doc, fix ); - } else { - jQuery._data( doc, fix, attaches ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!support.noCloneEvent || !support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - deletedIds.push( id ); - } - } - } - } - } -}); - -jQuery.fn.extend({ - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - remove: function( selector, keepData /* Internal Use Only */ ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map(function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var arg = arguments[ 0 ]; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - arg = this.parentNode; - - jQuery.cleanData( getAll( this ) ); - - if ( arg ) { - arg.replaceChild( elem, this ); - } - }); - - // Force removal if there was no new content (e.g., from empty arguments) - return arg && (arg.length || arg.nodeType) ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - - -var iframe, - elemdisplay = {}; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var style, - elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? - - // Use of this method is a temporary fix (more like optmization) until something better comes along, - // since it was removed from specification and supported only in FF - style.display : jQuery.css( elem[ 0 ], "display" ); - - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); - - return display; -} - -/** - * Try to determine the default display value of an element - * @param {String} nodeName - */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = (iframe || jQuery( "