--- /tmp/git-annex-8.20211011-2x4nsal2e/debian/git-annex_8.20211011-2_amd64.deb
+++ git-annex_8.20211011-2_amd64.deb
├── file list
│ @@ -1,3 +1,3 @@
│ -rw-r--r-- 0 0 0 4 2021-10-18 22:09:52.000000 debian-binary
│ --rw-r--r-- 0 0 0 18480 2021-10-18 22:09:52.000000 control.tar.xz
│ --rw-r--r-- 0 0 0 12634552 2021-10-18 22:09:52.000000 data.tar.xz
│ +-rw-r--r-- 0 0 0 18484 2021-10-18 22:09:52.000000 control.tar.xz
│ +-rw-r--r-- 0 0 0 12634824 2021-10-18 22:09:52.000000 data.tar.xz
├── control.tar.xz
│ ├── control.tar
│ │ ├── ./md5sums
│ │ │ ├── ./md5sums
│ │ │ │┄ Files differ
├── data.tar.xz
│ ├── data.tar
│ │ ├── file list
│ │ │ @@ -365,15 +365,15 @@
│ │ │ -rw-r--r-- 0 root (0) root (0) 2324 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/sandbox.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 5400 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/scalability.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security/
│ │ │ -rw-r--r-- 0 root (0) root (0) 2721 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security/CVE-2014-6274.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2744 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security/CVE-2017-12976.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 6753 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security/CVE-2018-10857_and_CVE-2018-10859.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2822 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security/checksum_exposure_to_encrypted_special_remotes.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 16745 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 16751 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/security.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2367 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/shortcuts.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2261 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/sidebar.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 29828 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/sitemap.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/special_remotes/
│ │ │ -rw-r--r-- 0 root (0) root (0) 42902 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/special_remotes/S3.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7450 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/special_remotes/adb.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 7665 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/special_remotes/bittorrent.html
│ │ │ @@ -548,15 +548,15 @@
│ │ │ -rw-r--r-- 0 root (0) root (0) 2274 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_assistant_archiving.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 4721 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_assistant_introduction.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 4913 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_assistant_lan.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2634 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_assistant_sync_demo.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2327 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_views_demo.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2562 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_watch_demo.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2620 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos/git-annex_weppapp_demo.html
│ │ │ --rw-r--r-- 0 root (0) root (0) 6207 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos.html
│ │ │ +-rw-r--r-- 0 root (0) root (0) 6211 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/videos.html
│ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/
│ │ │ -rw-r--r-- 0 root (0) root (0) 8760 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/adding_a_remote.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 2134 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/adding_files.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 3884 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/automatically_managing_content.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 3850 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/backups.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 1913 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/creating_a_repository.html
│ │ │ -rw-r--r-- 0 root (0) root (0) 3463 2021-10-18 22:09:52.000000 ./usr/share/doc/git-annex/html/walkthrough/fsck__58___verifying_your_data.html
│ │ ├── ./usr/bin/git-annex
│ │ │ ├── readelf --wide --notes {}
│ │ │ │ @@ -1,12 +1,12 @@
│ │ │ │
│ │ │ │ Displaying notes found in: .note.ABI-tag
│ │ │ │ Owner Data size Description
│ │ │ │ GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 3.2.0
│ │ │ │
│ │ │ │ Displaying notes found in: .note.gnu.build-id
│ │ │ │ Owner Data size Description
│ │ │ │ - GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 6c9ac2fb001249ce4652dc9ad4635b4ae500bb5e
│ │ │ │ + GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 8179d87d3711f853805c165d097d0e3e910b30f4
│ │ │ │
│ │ │ │ Displaying notes found in: .note.gnu.gold-version
│ │ │ │ Owner Data size Description
│ │ │ │ GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) Version: gold 1.16
│ │ │ ├── strings --all --bytes=8 {}
│ │ │ │ @@ -8726,9050 +8726,309 @@
│ │ │ │ repogroups
│ │ │ │ RepoGroupR
│ │ │ │ LicenseR
│ │ │ │ noscript
│ │ │ │ NoScriptAutoR
│ │ │ │ NoScriptR
│ │ │ │ DashboardR
│ │ │ │ -syncicon.gif
│ │ │ │ -favicon.ico
│ │ │ │ -activityicon.gif
│ │ │ │ -js/longpolling.js
│ │ │ │ -connfails=0;
│ │ │ │ -longpollcallbacks = $.Callbacks();
│ │ │ │ -// Updates a div with a specified id, by polling an url,
│ │ │ │ -// which should return a new div, with the same id.
│ │ │ │ -function longpoll_div(url, divid, cont, fail) {
│ │ │ │ - $.ajax({
│ │ │ │ - 'url': url,
│ │ │ │ - 'dataType': 'html',
│ │ │ │ - 'success': function(data, status, jqxhr) {
│ │ │ │ - $('#' + divid).replaceWith(data);
│ │ │ │ - longpollcallbacks.fire();
│ │ │ │ - connfails=0;
│ │ │ │ - cont();
│ │ │ │ - 'error': function(jqxhr, msg, e) {
│ │ │ │ - connfails=connfails+1;
│ │ │ │ - // It's normal to get 1 failure per longpolling
│ │ │ │ - // element when navigating away from a page.
│ │ │ │ - // So 12 allows up to 4 longpolling elements per
│ │ │ │ - // page.
│ │ │ │ - if (connfails > 12) {
│ │ │ │ - fail();
│ │ │ │ - else {
│ │ │ │ - cont();
│ │ │ │ -function longpoll_data(url, cont) {
│ │ │ │ - $.ajax({
│ │ │ │ - 'url': url,
│ │ │ │ - 'dataType': 'text',
│ │ │ │ - 'success': function(data, status, jqxhr) {
│ │ │ │ - connfails=0;
│ │ │ │ - cont(1, data);
│ │ │ │ - 'error': function(jqxhr, msg, e) {
│ │ │ │ - connfails=connfails+1;
│ │ │ │ - cont(0);
│ │ │ │ -js/jquery.ui.widget.js
│ │ │ │ - * jQuery UI Widget 1.10.4
│ │ │ │ - * http://jqueryui.com
│ │ │ │ - * Copyright 2014 jQuery Foundation and other contributors
│ │ │ │ - * Released under the MIT license.
│ │ │ │ - * http://jquery.org/license
│ │ │ │ - * http://api.jqueryui.com/jQuery.widget/
│ │ │ │ -(function( $, undefined ) {
│ │ │ │ -var uuid = 0,
│ │ │ │ - slice = Array.prototype.slice,
│ │ │ │ - _cleanData = $.cleanData;
│ │ │ │ -$.cleanData = function( elems ) {
│ │ │ │ - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
│ │ │ │ - $( elem ).triggerHandler( "remove" );
│ │ │ │ - // http://bugs.jquery.com/ticket/8235
│ │ │ │ - } catch( e ) {}
│ │ │ │ - _cleanData( elems );
│ │ │ │ -$.widget = function( name, base, prototype ) {
│ │ │ │ - var fullName, existingConstructor, constructor, basePrototype,
│ │ │ │ - // proxiedPrototype allows the provided prototype to remain unmodified
│ │ │ │ - // so that it can be used as a mixin for multiple widgets (#8876)
│ │ │ │ - proxiedPrototype = {},
│ │ │ │ - namespace = name.split( "." )[ 0 ];
│ │ │ │ - name = name.split( "." )[ 1 ];
│ │ │ │ - fullName = namespace + "-" + name;
│ │ │ │ - if ( !prototype ) {
│ │ │ │ - prototype = base;
│ │ │ │ - base = $.Widget;
│ │ │ │ - // create selector for plugin
│ │ │ │ - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
│ │ │ │ - return !!$.data( elem, fullName );
│ │ │ │ - $[ namespace ] = $[ namespace ] || {};
│ │ │ │ - existingConstructor = $[ namespace ][ name ];
│ │ │ │ - constructor = $[ namespace ][ name ] = function( options, element ) {
│ │ │ │ - // allow instantiation without "new" keyword
│ │ │ │ - if ( !this._createWidget ) {
│ │ │ │ - return new constructor( options, element );
│ │ │ │ - // allow instantiation without initializing for simple inheritance
│ │ │ │ - // must use "new" keyword (the code above always passes args)
│ │ │ │ - if ( arguments.length ) {
│ │ │ │ - this._createWidget( options, element );
│ │ │ │ - // extend with the existing constructor to carry over any static properties
│ │ │ │ - $.extend( constructor, existingConstructor, {
│ │ │ │ - version: prototype.version,
│ │ │ │ - // copy the object used to create the prototype in case we need to
│ │ │ │ - // redefine the widget later
│ │ │ │ - _proto: $.extend( {}, prototype ),
│ │ │ │ - // track widgets that inherit from this widget in case this widget is
│ │ │ │ - // redefined after a widget inherits from it
│ │ │ │ - _childConstructors: []
│ │ │ │ - basePrototype = new base();
│ │ │ │ - // we need to make the options hash a property directly on the new instance
│ │ │ │ - // otherwise we'll modify the options hash on the prototype that we're
│ │ │ │ - // inheriting from
│ │ │ │ - basePrototype.options = $.widget.extend( {}, basePrototype.options );
│ │ │ │ - $.each( prototype, function( prop, value ) {
│ │ │ │ - if ( !$.isFunction( value ) ) {
│ │ │ │ - proxiedPrototype[ prop ] = value;
│ │ │ │ - return;
│ │ │ │ - proxiedPrototype[ prop ] = (function() {
│ │ │ │ - var _super = function() {
│ │ │ │ - return base.prototype[ prop ].apply( this, arguments );
│ │ │ │ - _superApply = function( args ) {
│ │ │ │ - return base.prototype[ prop ].apply( this, args );
│ │ │ │ - return function() {
│ │ │ │ - var __super = this._super,
│ │ │ │ - __superApply = this._superApply,
│ │ │ │ - returnValue;
│ │ │ │ - this._super = _super;
│ │ │ │ - this._superApply = _superApply;
│ │ │ │ - returnValue = value.apply( this, arguments );
│ │ │ │ - this._super = __super;
│ │ │ │ - this._superApply = __superApply;
│ │ │ │ - return returnValue;
│ │ │ │ - constructor.prototype = $.widget.extend( basePrototype, {
│ │ │ │ - // TODO: remove support for widgetEventPrefix
│ │ │ │ - // always use the name + a colon as the prefix, e.g., draggable:start
│ │ │ │ - // don't prefix for widgets that aren't DOM-based
│ │ │ │ - widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
│ │ │ │ - }, proxiedPrototype, {
│ │ │ │ - constructor: constructor,
│ │ │ │ - namespace: namespace,
│ │ │ │ - widgetName: name,
│ │ │ │ - widgetFullName: fullName
│ │ │ │ - // If this widget is being redefined then we need to find all widgets that
│ │ │ │ - // are inheriting from it and redefine all of them so that they inherit from
│ │ │ │ - // the new version of this widget. We're essentially trying to replace one
│ │ │ │ - // level in the prototype chain.
│ │ │ │ - if ( existingConstructor ) {
│ │ │ │ - $.each( existingConstructor._childConstructors, function( i, child ) {
│ │ │ │ - var childPrototype = child.prototype;
│ │ │ │ - // redefine the child widget using the same prototype that was
│ │ │ │ - // originally used, but inherit from the new version of the base
│ │ │ │ - $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
│ │ │ │ - // remove the list of existing child constructors from the old constructor
│ │ │ │ - // so the old child constructors can be garbage collected
│ │ │ │ - delete existingConstructor._childConstructors;
│ │ │ │ - } else {
│ │ │ │ - base._childConstructors.push( constructor );
│ │ │ │ - $.widget.bridge( name, constructor );
│ │ │ │ -$.widget.extend = function( target ) {
│ │ │ │ - var input = slice.call( arguments, 1 ),
│ │ │ │ - inputIndex = 0,
│ │ │ │ - inputLength = input.length,
│ │ │ │ - value;
│ │ │ │ - for ( ; inputIndex < inputLength; inputIndex++ ) {
│ │ │ │ - for ( key in input[ inputIndex ] ) {
│ │ │ │ - value = input[ inputIndex ][ key ];
│ │ │ │ - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
│ │ │ │ - // Clone objects
│ │ │ │ - if ( $.isPlainObject( value ) ) {
│ │ │ │ - target[ key ] = $.isPlainObject( target[ key ] ) ?
│ │ │ │ - $.widget.extend( {}, target[ key ], value ) :
│ │ │ │ - // Don't extend strings, arrays, etc. with objects
│ │ │ │ - $.widget.extend( {}, value );
│ │ │ │ - // Copy everything else by reference
│ │ │ │ - } else {
│ │ │ │ - target[ key ] = value;
│ │ │ │ - return target;
│ │ │ │ -$.widget.bridge = function( name, object ) {
│ │ │ │ - var fullName = object.prototype.widgetFullName || name;
│ │ │ │ - $.fn[ name ] = function( options ) {
│ │ │ │ - var isMethodCall = typeof options === "string",
│ │ │ │ - args = slice.call( arguments, 1 ),
│ │ │ │ - returnValue = this;
│ │ │ │ - // allow multiple hashes to be passed on init
│ │ │ │ - options = !isMethodCall && args.length ?
│ │ │ │ - $.widget.extend.apply( null, [ options ].concat(args) ) :
│ │ │ │ - options;
│ │ │ │ - if ( isMethodCall ) {
│ │ │ │ - this.each(function() {
│ │ │ │ - var methodValue,
│ │ │ │ - instance = $.data( this, fullName );
│ │ │ │ - if ( !instance ) {
│ │ │ │ - return $.error( "cannot call methods on " + name + " prior to initialization; " +
│ │ │ │ - "attempted to call method '" + options + "'" );
│ │ │ │ - if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
│ │ │ │ - return $.error( "no such method '" + options + "' for " + name + " widget instance" );
│ │ │ │ - methodValue = instance[ options ].apply( instance, args );
│ │ │ │ - if ( methodValue !== instance && methodValue !== undefined ) {
│ │ │ │ - returnValue = methodValue && methodValue.jquery ?
│ │ │ │ - returnValue.pushStack( methodValue.get() ) :
│ │ │ │ - methodValue;
│ │ │ │ - return false;
│ │ │ │ - } else {
│ │ │ │ - this.each(function() {
│ │ │ │ - var instance = $.data( this, fullName );
│ │ │ │ - if ( instance ) {
│ │ │ │ - instance.option( options || {} )._init();
│ │ │ │ - } else {
│ │ │ │ - $.data( this, fullName, new object( options, this ) );
│ │ │ │ - return returnValue;
│ │ │ │ -$.Widget = function( /* options, element */ ) {};
│ │ │ │ -$.Widget._childConstructors = [];
│ │ │ │ -$.Widget.prototype = {
│ │ │ │ - widgetName: "widget",
│ │ │ │ - widgetEventPrefix: "",
│ │ │ │ - defaultElement: "
",
│ │ │ │ - options: {
│ │ │ │ - disabled: false,
│ │ │ │ - // callbacks
│ │ │ │ - create: null
│ │ │ │ - _createWidget: function( options, element ) {
│ │ │ │ - element = $( element || this.defaultElement || this )[ 0 ];
│ │ │ │ - this.element = $( element );
│ │ │ │ - this.uuid = uuid++;
│ │ │ │ - this.eventNamespace = "." + this.widgetName + this.uuid;
│ │ │ │ - this.options = $.widget.extend( {},
│ │ │ │ - this.options,
│ │ │ │ - this._getCreateOptions(),
│ │ │ │ - options );
│ │ │ │ - this.bindings = $();
│ │ │ │ - this.hoverable = $();
│ │ │ │ - this.focusable = $();
│ │ │ │ - if ( element !== this ) {
│ │ │ │ - $.data( element, this.widgetFullName, this );
│ │ │ │ - this._on( true, this.element, {
│ │ │ │ - remove: function( event ) {
│ │ │ │ - if ( event.target === element ) {
│ │ │ │ - this.destroy();
│ │ │ │ - this.document = $( element.style ?
│ │ │ │ - // element within the document
│ │ │ │ - element.ownerDocument :
│ │ │ │ - // element is window or document
│ │ │ │ - element.document || element );
│ │ │ │ - this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
│ │ │ │ - this._create();
│ │ │ │ - this._trigger( "create", null, this._getCreateEventData() );
│ │ │ │ - this._init();
│ │ │ │ - _getCreateOptions: $.noop,
│ │ │ │ - _getCreateEventData: $.noop,
│ │ │ │ - _create: $.noop,
│ │ │ │ - _init: $.noop,
│ │ │ │ - destroy: function() {
│ │ │ │ - this._destroy();
│ │ │ │ - // we can probably remove the unbind calls in 2.0
│ │ │ │ - // all event bindings should go through this._on()
│ │ │ │ - this.element
│ │ │ │ - .unbind( this.eventNamespace )
│ │ │ │ - // 1.9 BC for #7810
│ │ │ │ - // TODO remove dual storage
│ │ │ │ - .removeData( this.widgetName )
│ │ │ │ - .removeData( this.widgetFullName )
│ │ │ │ - // support: jquery <1.6.3
│ │ │ │ - // http://bugs.jquery.com/ticket/9413
│ │ │ │ - .removeData( $.camelCase( this.widgetFullName ) );
│ │ │ │ - this.widget()
│ │ │ │ - .unbind( this.eventNamespace )
│ │ │ │ - .removeAttr( "aria-disabled" )
│ │ │ │ - .removeClass(
│ │ │ │ - this.widgetFullName + "-disabled " +
│ │ │ │ - "ui-state-disabled" );
│ │ │ │ - // clean up events and states
│ │ │ │ - this.bindings.unbind( this.eventNamespace );
│ │ │ │ - this.hoverable.removeClass( "ui-state-hover" );
│ │ │ │ - this.focusable.removeClass( "ui-state-focus" );
│ │ │ │ - _destroy: $.noop,
│ │ │ │ - widget: function() {
│ │ │ │ - return this.element;
│ │ │ │ - option: function( key, value ) {
│ │ │ │ - var options = key,
│ │ │ │ - parts,
│ │ │ │ - curOption,
│ │ │ │ - if ( arguments.length === 0 ) {
│ │ │ │ - // don't return a reference to the internal hash
│ │ │ │ - return $.widget.extend( {}, this.options );
│ │ │ │ - if ( typeof key === "string" ) {
│ │ │ │ - // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
│ │ │ │ - options = {};
│ │ │ │ - parts = key.split( "." );
│ │ │ │ - key = parts.shift();
│ │ │ │ - if ( parts.length ) {
│ │ │ │ - curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
│ │ │ │ - for ( i = 0; i < parts.length - 1; i++ ) {
│ │ │ │ - curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
│ │ │ │ - curOption = curOption[ parts[ i ] ];
│ │ │ │ - key = parts.pop();
│ │ │ │ - if ( arguments.length === 1 ) {
│ │ │ │ - return curOption[ key ] === undefined ? null : curOption[ key ];
│ │ │ │ - curOption[ key ] = value;
│ │ │ │ - } else {
│ │ │ │ - if ( arguments.length === 1 ) {
│ │ │ │ - return this.options[ key ] === undefined ? null : this.options[ key ];
│ │ │ │ - options[ key ] = value;
│ │ │ │ - this._setOptions( options );
│ │ │ │ - return this;
│ │ │ │ - _setOptions: function( options ) {
│ │ │ │ - var key;
│ │ │ │ - for ( key in options ) {
│ │ │ │ - this._setOption( key, options[ key ] );
│ │ │ │ - return this;
│ │ │ │ - _setOption: function( key, value ) {
│ │ │ │ - this.options[ key ] = value;
│ │ │ │ - if ( key === "disabled" ) {
│ │ │ │ - this.widget()
│ │ │ │ - .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
│ │ │ │ - .attr( "aria-disabled", value );
│ │ │ │ - this.hoverable.removeClass( "ui-state-hover" );
│ │ │ │ - this.focusable.removeClass( "ui-state-focus" );
│ │ │ │ - return this;
│ │ │ │ - enable: function() {
│ │ │ │ - return this._setOption( "disabled", false );
│ │ │ │ - disable: function() {
│ │ │ │ - return this._setOption( "disabled", true );
│ │ │ │ - _on: function( suppressDisabledCheck, element, handlers ) {
│ │ │ │ - var delegateElement,
│ │ │ │ - instance = this;
│ │ │ │ - // no suppressDisabledCheck flag, shuffle arguments
│ │ │ │ - if ( typeof suppressDisabledCheck !== "boolean" ) {
│ │ │ │ - handlers = element;
│ │ │ │ - element = suppressDisabledCheck;
│ │ │ │ - suppressDisabledCheck = false;
│ │ │ │ - // no element argument, shuffle and use this.element
│ │ │ │ - if ( !handlers ) {
│ │ │ │ - handlers = element;
│ │ │ │ - element = this.element;
│ │ │ │ - delegateElement = this.widget();
│ │ │ │ - } else {
│ │ │ │ - // accept selectors, DOM elements
│ │ │ │ - element = delegateElement = $( element );
│ │ │ │ - this.bindings = this.bindings.add( element );
│ │ │ │ - $.each( handlers, function( event, handler ) {
│ │ │ │ - function handlerProxy() {
│ │ │ │ - // allow widgets to customize the disabled handling
│ │ │ │ - // - disabled as an array instead of boolean
│ │ │ │ - // - disabled class as method for disabling individual parts
│ │ │ │ - if ( !suppressDisabledCheck &&
│ │ │ │ - ( instance.options.disabled === true ||
│ │ │ │ - $( this ).hasClass( "ui-state-disabled" ) ) ) {
│ │ │ │ - return;
│ │ │ │ - return ( typeof handler === "string" ? instance[ handler ] : handler )
│ │ │ │ - .apply( instance, arguments );
│ │ │ │ - // copy the guid so direct unbinding works
│ │ │ │ - if ( typeof handler !== "string" ) {
│ │ │ │ - handlerProxy.guid = handler.guid =
│ │ │ │ - handler.guid || handlerProxy.guid || $.guid++;
│ │ │ │ - var match = event.match( /^(\w+)\s*(.*)$/ ),
│ │ │ │ - eventName = match[1] + instance.eventNamespace,
│ │ │ │ - selector = match[2];
│ │ │ │ - if ( selector ) {
│ │ │ │ - delegateElement.delegate( selector, eventName, handlerProxy );
│ │ │ │ - } else {
│ │ │ │ - element.bind( eventName, handlerProxy );
│ │ │ │ - _off: function( element, eventName ) {
│ │ │ │ - eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
│ │ │ │ - element.unbind( eventName ).undelegate( eventName );
│ │ │ │ - _delay: function( handler, delay ) {
│ │ │ │ - function handlerProxy() {
│ │ │ │ - return ( typeof handler === "string" ? instance[ handler ] : handler )
│ │ │ │ - .apply( instance, arguments );
│ │ │ │ - var instance = this;
│ │ │ │ - return setTimeout( handlerProxy, delay || 0 );
│ │ │ │ - _hoverable: function( element ) {
│ │ │ │ - this.hoverable = this.hoverable.add( element );
│ │ │ │ - this._on( element, {
│ │ │ │ - mouseenter: function( event ) {
│ │ │ │ - $( event.currentTarget ).addClass( "ui-state-hover" );
│ │ │ │ - mouseleave: function( event ) {
│ │ │ │ - $( event.currentTarget ).removeClass( "ui-state-hover" );
│ │ │ │ - _focusable: function( element ) {
│ │ │ │ - this.focusable = this.focusable.add( element );
│ │ │ │ - this._on( element, {
│ │ │ │ - focusin: function( event ) {
│ │ │ │ - $( event.currentTarget ).addClass( "ui-state-focus" );
│ │ │ │ - focusout: function( event ) {
│ │ │ │ - $( event.currentTarget ).removeClass( "ui-state-focus" );
│ │ │ │ - _trigger: function( type, event, data ) {
│ │ │ │ - var prop, orig,
│ │ │ │ - callback = this.options[ type ];
│ │ │ │ - data = data || {};
│ │ │ │ - event = $.Event( event );
│ │ │ │ - event.type = ( type === this.widgetEventPrefix ?
│ │ │ │ - type :
│ │ │ │ - this.widgetEventPrefix + type ).toLowerCase();
│ │ │ │ - // the original event may come from any element
│ │ │ │ - // so we need to reset the target on the new event
│ │ │ │ - event.target = this.element[ 0 ];
│ │ │ │ - // copy original event properties over to the new event
│ │ │ │ - orig = event.originalEvent;
│ │ │ │ - if ( orig ) {
│ │ │ │ - for ( prop in orig ) {
│ │ │ │ - if ( !( prop in event ) ) {
│ │ │ │ - event[ prop ] = orig[ prop ];
│ │ │ │ - this.element.trigger( event, data );
│ │ │ │ - return !( $.isFunction( callback ) &&
│ │ │ │ - callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
│ │ │ │ - event.isDefaultPrevented() );
│ │ │ │ -$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
│ │ │ │ - $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
│ │ │ │ - if ( typeof options === "string" ) {
│ │ │ │ - options = { effect: options };
│ │ │ │ - var hasOptions,
│ │ │ │ - effectName = !options ?
│ │ │ │ - method :
│ │ │ │ - options === true || typeof options === "number" ?
│ │ │ │ - defaultEffect :
│ │ │ │ - options.effect || defaultEffect;
│ │ │ │ - options = options || {};
│ │ │ │ - if ( typeof options === "number" ) {
│ │ │ │ - options = { duration: options };
│ │ │ │ - hasOptions = !$.isEmptyObject( options );
│ │ │ │ - options.complete = callback;
│ │ │ │ - if ( options.delay ) {
│ │ │ │ - element.delay( options.delay );
│ │ │ │ - if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
│ │ │ │ - element[ method ]( options );
│ │ │ │ - } else if ( effectName !== method && element[ effectName ] ) {
│ │ │ │ - element[ effectName ]( options.duration, options.easing, callback );
│ │ │ │ - } else {
│ │ │ │ - element.queue(function( next ) {
│ │ │ │ - $( this )[ method ]();
│ │ │ │ - if ( callback ) {
│ │ │ │ - callback.call( element[ 0 ] );
│ │ │ │ - next();
│ │ │ │ -})( jQuery );
│ │ │ │ -js/jquery.ui.sortable.js
│ │ │ │ - * jQuery UI Sortable 1.10.4
│ │ │ │ - * http://jqueryui.com
│ │ │ │ - * Copyright 2014 jQuery Foundation and other contributors
│ │ │ │ - * Released under the MIT license.
│ │ │ │ - * http://jquery.org/license
│ │ │ │ - * http://api.jqueryui.com/sortable/
│ │ │ │ - * Depends:
│ │ │ │ - * jquery.ui.core.js
│ │ │ │ - * jquery.ui.mouse.js
│ │ │ │ - * jquery.ui.widget.js
│ │ │ │ -(function( $, undefined ) {
│ │ │ │ -function isOverAxis( x, reference, size ) {
│ │ │ │ - return ( x > reference ) && ( x < ( reference + size ) );
│ │ │ │ -function isFloating(item) {
│ │ │ │ - return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
│ │ │ │ -$.widget("ui.sortable", $.ui.mouse, {
│ │ │ │ - version: "1.10.4",
│ │ │ │ - widgetEventPrefix: "sort",
│ │ │ │ - ready: false,
│ │ │ │ - options: {
│ │ │ │ - appendTo: "parent",
│ │ │ │ - axis: false,
│ │ │ │ - connectWith: false,
│ │ │ │ - containment: false,
│ │ │ │ - cursor: "auto",
│ │ │ │ - cursorAt: false,
│ │ │ │ - dropOnEmpty: true,
│ │ │ │ - forcePlaceholderSize: false,
│ │ │ │ - forceHelperSize: false,
│ │ │ │ - grid: false,
│ │ │ │ - handle: false,
│ │ │ │ - helper: "original",
│ │ │ │ - items: "> *",
│ │ │ │ - opacity: false,
│ │ │ │ - placeholder: false,
│ │ │ │ - revert: false,
│ │ │ │ - scroll: true,
│ │ │ │ - scrollSensitivity: 20,
│ │ │ │ - scrollSpeed: 20,
│ │ │ │ - scope: "default",
│ │ │ │ - tolerance: "intersect",
│ │ │ │ - zIndex: 1000,
│ │ │ │ - // callbacks
│ │ │ │ - activate: null,
│ │ │ │ - beforeStop: null,
│ │ │ │ - change: null,
│ │ │ │ - deactivate: null,
│ │ │ │ - out: null,
│ │ │ │ - over: null,
│ │ │ │ - receive: null,
│ │ │ │ - remove: null,
│ │ │ │ - sort: null,
│ │ │ │ - start: null,
│ │ │ │ - stop: null,
│ │ │ │ - update: null
│ │ │ │ - _create: function() {
│ │ │ │ - var o = this.options;
│ │ │ │ - this.containerCache = {};
│ │ │ │ - this.element.addClass("ui-sortable");
│ │ │ │ - //Get the items
│ │ │ │ - this.refresh();
│ │ │ │ - //Let's determine if the items are being displayed horizontally
│ │ │ │ - this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false;
│ │ │ │ - //Let's determine the parent's offset
│ │ │ │ - this.offset = this.element.offset();
│ │ │ │ - //Initialize mouse events for interaction
│ │ │ │ - this._mouseInit();
│ │ │ │ - //We're ready to go
│ │ │ │ - this.ready = true;
│ │ │ │ - _destroy: function() {
│ │ │ │ - this.element
│ │ │ │ - .removeClass("ui-sortable ui-sortable-disabled");
│ │ │ │ - this._mouseDestroy();
│ │ │ │ - for ( var i = this.items.length - 1; i >= 0; i-- ) {
│ │ │ │ - this.items[i].item.removeData(this.widgetName + "-item");
│ │ │ │ - return this;
│ │ │ │ - _setOption: function(key, value){
│ │ │ │ - if ( key === "disabled" ) {
│ │ │ │ - this.options[ key ] = value;
│ │ │ │ - this.widget().toggleClass( "ui-sortable-disabled", !!value );
│ │ │ │ - } else {
│ │ │ │ - // Don't call widget base _setOption for disable as it adds ui-state-disabled class
│ │ │ │ - $.Widget.prototype._setOption.apply(this, arguments);
│ │ │ │ - _mouseCapture: function(event, overrideHandle) {
│ │ │ │ - var currentItem = null,
│ │ │ │ - validHandle = false,
│ │ │ │ - that = this;
│ │ │ │ - if (this.reverting) {
│ │ │ │ - return false;
│ │ │ │ - if(this.options.disabled || this.options.type === "static") {
│ │ │ │ - return false;
│ │ │ │ - //We have to refresh the items data once first
│ │ │ │ - this._refreshItems(event);
│ │ │ │ - //Find out if the clicked node (or one of its parents) is a actual item in this.items
│ │ │ │ - $(event.target).parents().each(function() {
│ │ │ │ - if($.data(this, that.widgetName + "-item") === that) {
│ │ │ │ - currentItem = $(this);
│ │ │ │ - return false;
│ │ │ │ - if($.data(event.target, that.widgetName + "-item") === that) {
│ │ │ │ - currentItem = $(event.target);
│ │ │ │ - if(!currentItem) {
│ │ │ │ - return false;
│ │ │ │ - if(this.options.handle && !overrideHandle) {
│ │ │ │ - $(this.options.handle, currentItem).find("*").addBack().each(function() {
│ │ │ │ - if(this === event.target) {
│ │ │ │ - validHandle = true;
│ │ │ │ - if(!validHandle) {
│ │ │ │ - return false;
│ │ │ │ - this.currentItem = currentItem;
│ │ │ │ - this._removeCurrentsFromItems();
│ │ │ │ - return true;
│ │ │ │ - _mouseStart: function(event, overrideHandle, noActivation) {
│ │ │ │ - var i, body,
│ │ │ │ - o = this.options;
│ │ │ │ - this.currentContainer = this;
│ │ │ │ - //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
│ │ │ │ - this.refreshPositions();
│ │ │ │ - //Create and append the visible helper
│ │ │ │ - this.helper = this._createHelper(event);
│ │ │ │ - //Cache the helper size
│ │ │ │ - this._cacheHelperProportions();
│ │ │ │ - * - Position generation -
│ │ │ │ - * This block generates everything position related - it's the core of draggables.
│ │ │ │ - //Cache the margins of the original element
│ │ │ │ - this._cacheMargins();
│ │ │ │ - //Get the next scrolling parent
│ │ │ │ - this.scrollParent = this.helper.scrollParent();
│ │ │ │ - //The element's absolute position on the page minus margins
│ │ │ │ - this.offset = this.currentItem.offset();
│ │ │ │ - this.offset = {
│ │ │ │ - top: this.offset.top - this.margins.top,
│ │ │ │ - left: this.offset.left - this.margins.left
│ │ │ │ - $.extend(this.offset, {
│ │ │ │ - click: { //Where the click happened, relative to the element
│ │ │ │ - left: event.pageX - this.offset.left,
│ │ │ │ - top: event.pageY - this.offset.top
│ │ │ │ - parent: this._getParentOffset(),
│ │ │ │ - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
│ │ │ │ - // Only after we got the offset, we can change the helper's position to absolute
│ │ │ │ - // TODO: Still need to figure out a way to make relative sorting possible
│ │ │ │ - this.helper.css("position", "absolute");
│ │ │ │ - this.cssPosition = this.helper.css("position");
│ │ │ │ - //Generate the original position
│ │ │ │ - this.originalPosition = this._generatePosition(event);
│ │ │ │ - this.originalPageX = event.pageX;
│ │ │ │ - this.originalPageY = event.pageY;
│ │ │ │ - //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
│ │ │ │ - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
│ │ │ │ - //Cache the former DOM position
│ │ │ │ - this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
│ │ │ │ - //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
│ │ │ │ - if(this.helper[0] !== this.currentItem[0]) {
│ │ │ │ - this.currentItem.hide();
│ │ │ │ - //Create the placeholder
│ │ │ │ - this._createPlaceholder();
│ │ │ │ - //Set a containment if given in the options
│ │ │ │ - if(o.containment) {
│ │ │ │ - this._setContainment();
│ │ │ │ - if( o.cursor && o.cursor !== "auto" ) { // cursor option
│ │ │ │ - body = this.document.find( "body" );
│ │ │ │ - // support: IE
│ │ │ │ - this.storedCursor = body.css( "cursor" );
│ │ │ │ - body.css( "cursor", o.cursor );
│ │ │ │ - this.storedStylesheet = $( "" ).appendTo( body );
│ │ │ │ - if(o.opacity) { // opacity option
│ │ │ │ - if (this.helper.css("opacity")) {
│ │ │ │ - this._storedOpacity = this.helper.css("opacity");
│ │ │ │ - this.helper.css("opacity", o.opacity);
│ │ │ │ - if(o.zIndex) { // zIndex option
│ │ │ │ - if (this.helper.css("zIndex")) {
│ │ │ │ - this._storedZIndex = this.helper.css("zIndex");
│ │ │ │ - this.helper.css("zIndex", o.zIndex);
│ │ │ │ - //Prepare scrolling
│ │ │ │ - if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
│ │ │ │ - this.overflowOffset = this.scrollParent.offset();
│ │ │ │ - //Call callbacks
│ │ │ │ - this._trigger("start", event, this._uiHash());
│ │ │ │ - //Recache the helper size
│ │ │ │ - if(!this._preserveHelperProportions) {
│ │ │ │ - this._cacheHelperProportions();
│ │ │ │ - //Post "activate" events to possible containers
│ │ │ │ - if( !noActivation ) {
│ │ │ │ - for ( i = this.containers.length - 1; i >= 0; i-- ) {
│ │ │ │ - this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
│ │ │ │ - //Prepare possible droppables
│ │ │ │ - if($.ui.ddmanager) {
│ │ │ │ - $.ui.ddmanager.current = this;
│ │ │ │ - if ($.ui.ddmanager && !o.dropBehaviour) {
│ │ │ │ - $.ui.ddmanager.prepareOffsets(this, event);
│ │ │ │ - this.dragging = true;
│ │ │ │ - this.helper.addClass("ui-sortable-helper");
│ │ │ │ - this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
│ │ │ │ - return true;
│ │ │ │ - _mouseDrag: function(event) {
│ │ │ │ - var i, item, itemElement, intersection,
│ │ │ │ - o = this.options,
│ │ │ │ - scrolled = false;
│ │ │ │ - //Compute the helpers position
│ │ │ │ - this.position = this._generatePosition(event);
│ │ │ │ - this.positionAbs = this._convertPositionTo("absolute");
│ │ │ │ - if (!this.lastPositionAbs) {
│ │ │ │ - this.lastPositionAbs = this.positionAbs;
│ │ │ │ - //Do scrolling
│ │ │ │ - if(this.options.scroll) {
│ │ │ │ - if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
│ │ │ │ - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
│ │ │ │ - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
│ │ │ │ - } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
│ │ │ │ - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
│ │ │ │ - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
│ │ │ │ - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
│ │ │ │ - } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
│ │ │ │ - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
│ │ │ │ - } else {
│ │ │ │ - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
│ │ │ │ - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
│ │ │ │ - } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
│ │ │ │ - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
│ │ │ │ - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
│ │ │ │ - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
│ │ │ │ - } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
│ │ │ │ - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
│ │ │ │ - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
│ │ │ │ - $.ui.ddmanager.prepareOffsets(this, event);
│ │ │ │ - //Regenerate the absolute position used for position checks
│ │ │ │ - this.positionAbs = this._convertPositionTo("absolute");
│ │ │ │ - //Set the helper position
│ │ │ │ - if(!this.options.axis || this.options.axis !== "y") {
│ │ │ │ - this.helper[0].style.left = this.position.left+"px";
│ │ │ │ - if(!this.options.axis || this.options.axis !== "x") {
│ │ │ │ - this.helper[0].style.top = this.position.top+"px";
│ │ │ │ - //Rearrange
│ │ │ │ - for (i = this.items.length - 1; i >= 0; i--) {
│ │ │ │ - //Cache variables and intersection, continue if no intersection
│ │ │ │ - item = this.items[i];
│ │ │ │ - itemElement = item.item[0];
│ │ │ │ - intersection = this._intersectsWithPointer(item);
│ │ │ │ - if (!intersection) {
│ │ │ │ - continue;
│ │ │ │ - // Only put the placeholder inside the current Container, skip all
│ │ │ │ - // items from other containers. This works because when moving
│ │ │ │ - // an item from one container to another the
│ │ │ │ - // currentContainer is switched before the placeholder is moved.
│ │ │ │ - // Without this, moving items in "sub-sortables" can cause
│ │ │ │ - // the placeholder to jitter beetween the outer and inner container.
│ │ │ │ - if (item.instance !== this.currentContainer) {
│ │ │ │ - continue;
│ │ │ │ - // cannot intersect with itself
│ │ │ │ - // no useless actions that have been done before
│ │ │ │ - // no action if the item moved is the parent of the item checked
│ │ │ │ - if (itemElement !== this.currentItem[0] &&
│ │ │ │ - this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
│ │ │ │ - !$.contains(this.placeholder[0], itemElement) &&
│ │ │ │ - (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
│ │ │ │ - this.direction = intersection === 1 ? "down" : "up";
│ │ │ │ - if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
│ │ │ │ - this._rearrange(event, item);
│ │ │ │ - } else {
│ │ │ │ - break;
│ │ │ │ - this._trigger("change", event, this._uiHash());
│ │ │ │ - break;
│ │ │ │ - //Post events to containers
│ │ │ │ - this._contactContainers(event);
│ │ │ │ - //Interconnect with droppables
│ │ │ │ - if($.ui.ddmanager) {
│ │ │ │ - $.ui.ddmanager.drag(this, event);
│ │ │ │ - //Call callbacks
│ │ │ │ - this._trigger("sort", event, this._uiHash());
│ │ │ │ - this.lastPositionAbs = this.positionAbs;
│ │ │ │ - return false;
│ │ │ │ - _mouseStop: function(event, noPropagation) {
│ │ │ │ - if(!event) {
│ │ │ │ - return;
│ │ │ │ - //If we are using droppables, inform the manager about the drop
│ │ │ │ - if ($.ui.ddmanager && !this.options.dropBehaviour) {
│ │ │ │ - $.ui.ddmanager.drop(this, event);
│ │ │ │ - if(this.options.revert) {
│ │ │ │ - var that = this,
│ │ │ │ - cur = this.placeholder.offset(),
│ │ │ │ - axis = this.options.axis,
│ │ │ │ - animation = {};
│ │ │ │ - if ( !axis || axis === "x" ) {
│ │ │ │ - animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
│ │ │ │ - if ( !axis || axis === "y" ) {
│ │ │ │ - animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
│ │ │ │ - this.reverting = true;
│ │ │ │ - $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
│ │ │ │ - that._clear(event);
│ │ │ │ - } else {
│ │ │ │ - this._clear(event, noPropagation);
│ │ │ │ - return false;
│ │ │ │ - cancel: function() {
│ │ │ │ - if(this.dragging) {
│ │ │ │ - this._mouseUp({ target: null });
│ │ │ │ - if(this.options.helper === "original") {
│ │ │ │ - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
│ │ │ │ - } else {
│ │ │ │ - this.currentItem.show();
│ │ │ │ - //Post deactivating events to containers
│ │ │ │ - for (var i = this.containers.length - 1; i >= 0; i--){
│ │ │ │ - this.containers[i]._trigger("deactivate", null, this._uiHash(this));
│ │ │ │ - if(this.containers[i].containerCache.over) {
│ │ │ │ - this.containers[i]._trigger("out", null, this._uiHash(this));
│ │ │ │ - this.containers[i].containerCache.over = 0;
│ │ │ │ - if (this.placeholder) {
│ │ │ │ - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
│ │ │ │ - if(this.placeholder[0].parentNode) {
│ │ │ │ - this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
│ │ │ │ - if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
│ │ │ │ - this.helper.remove();
│ │ │ │ - $.extend(this, {
│ │ │ │ - helper: null,
│ │ │ │ - dragging: false,
│ │ │ │ - reverting: false,
│ │ │ │ - _noFinalSort: null
│ │ │ │ - if(this.domPosition.prev) {
│ │ │ │ - $(this.domPosition.prev).after(this.currentItem);
│ │ │ │ - } else {
│ │ │ │ - $(this.domPosition.parent).prepend(this.currentItem);
│ │ │ │ - return this;
│ │ │ │ - serialize: function(o) {
│ │ │ │ - var items = this._getItemsAsjQuery(o && o.connected),
│ │ │ │ - str = [];
│ │ │ │ - o = o || {};
│ │ │ │ - $(items).each(function() {
│ │ │ │ - var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
│ │ │ │ - if (res) {
│ │ │ │ - str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
│ │ │ │ - if(!str.length && o.key) {
│ │ │ │ - str.push(o.key + "=");
│ │ │ │ - return str.join("&");
│ │ │ │ - toArray: function(o) {
│ │ │ │ - var items = this._getItemsAsjQuery(o && o.connected),
│ │ │ │ - ret = [];
│ │ │ │ - o = o || {};
│ │ │ │ - items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
│ │ │ │ - return ret;
│ │ │ │ - /* Be careful with the following core functions */
│ │ │ │ - _intersectsWith: function(item) {
│ │ │ │ - var x1 = this.positionAbs.left,
│ │ │ │ - x2 = x1 + this.helperProportions.width,
│ │ │ │ - y1 = this.positionAbs.top,
│ │ │ │ - y2 = y1 + this.helperProportions.height,
│ │ │ │ - l = item.left,
│ │ │ │ - r = l + item.width,
│ │ │ │ - t = item.top,
│ │ │ │ - b = t + item.height,
│ │ │ │ - dyClick = this.offset.click.top,
│ │ │ │ - dxClick = this.offset.click.left,
│ │ │ │ - isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
│ │ │ │ - isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
│ │ │ │ - isOverElement = isOverElementHeight && isOverElementWidth;
│ │ │ │ - if ( this.options.tolerance === "pointer" ||
│ │ │ │ - this.options.forcePointerForContainers ||
│ │ │ │ - (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
│ │ │ │ - return isOverElement;
│ │ │ │ - } else {
│ │ │ │ - return (l < x1 + (this.helperProportions.width / 2) && // Right Half
│ │ │ │ - x2 - (this.helperProportions.width / 2) < r && // Left Half
│ │ │ │ - t < y1 + (this.helperProportions.height / 2) && // Bottom Half
│ │ │ │ - y2 - (this.helperProportions.height / 2) < b ); // Top Half
│ │ │ │ - _intersectsWithPointer: function(item) {
│ │ │ │ - var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
│ │ │ │ - isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
│ │ │ │ - isOverElement = isOverElementHeight && isOverElementWidth,
│ │ │ │ - verticalDirection = this._getDragVerticalDirection(),
│ │ │ │ - horizontalDirection = this._getDragHorizontalDirection();
│ │ │ │ - if (!isOverElement) {
│ │ │ │ - return false;
│ │ │ │ - return this.floating ?
│ │ │ │ - ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
│ │ │ │ - : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
│ │ │ │ - _intersectsWithSides: function(item) {
│ │ │ │ - var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
│ │ │ │ - isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
│ │ │ │ - verticalDirection = this._getDragVerticalDirection(),
│ │ │ │ - horizontalDirection = this._getDragHorizontalDirection();
│ │ │ │ - if (this.floating && horizontalDirection) {
│ │ │ │ - return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
│ │ │ │ - } else {
│ │ │ │ - return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
│ │ │ │ - _getDragVerticalDirection: function() {
│ │ │ │ - var delta = this.positionAbs.top - this.lastPositionAbs.top;
│ │ │ │ - return delta !== 0 && (delta > 0 ? "down" : "up");
│ │ │ │ - _getDragHorizontalDirection: function() {
│ │ │ │ - var delta = this.positionAbs.left - this.lastPositionAbs.left;
│ │ │ │ - return delta !== 0 && (delta > 0 ? "right" : "left");
│ │ │ │ - refresh: function(event) {
│ │ │ │ - this._refreshItems(event);
│ │ │ │ - this.refreshPositions();
│ │ │ │ - return this;
│ │ │ │ - _connectWith: function() {
│ │ │ │ - var options = this.options;
│ │ │ │ - return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
│ │ │ │ - _getItemsAsjQuery: function(connected) {
│ │ │ │ - var i, j, cur, inst,
│ │ │ │ - items = [],
│ │ │ │ - queries = [],
│ │ │ │ - connectWith = this._connectWith();
│ │ │ │ - if(connectWith && connected) {
│ │ │ │ - for (i = connectWith.length - 1; i >= 0; i--){
│ │ │ │ - cur = $(connectWith[i]);
│ │ │ │ - for ( j = cur.length - 1; j >= 0; j--){
│ │ │ │ - inst = $.data(cur[j], this.widgetFullName);
│ │ │ │ - if(inst && inst !== this && !inst.options.disabled) {
│ │ │ │ - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
│ │ │ │ - queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
│ │ │ │ - function addItems() {
│ │ │ │ - items.push( this );
│ │ │ │ - for (i = queries.length - 1; i >= 0; i--){
│ │ │ │ - queries[i][0].each( addItems );
│ │ │ │ - return $(items);
│ │ │ │ - _removeCurrentsFromItems: function() {
│ │ │ │ - var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
│ │ │ │ - this.items = $.grep(this.items, function (item) {
│ │ │ │ - for (var j=0; j < list.length; j++) {
│ │ │ │ - if(list[j] === item.item[0]) {
│ │ │ │ - return false;
│ │ │ │ - return true;
│ │ │ │ - _refreshItems: function(event) {
│ │ │ │ - this.items = [];
│ │ │ │ - this.containers = [this];
│ │ │ │ - var i, j, cur, inst, targetData, _queries, item, queriesLength,
│ │ │ │ - items = this.items,
│ │ │ │ - queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
│ │ │ │ - connectWith = this._connectWith();
│ │ │ │ - if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
│ │ │ │ - for (i = connectWith.length - 1; i >= 0; i--){
│ │ │ │ - cur = $(connectWith[i]);
│ │ │ │ - for (j = cur.length - 1; j >= 0; j--){
│ │ │ │ - inst = $.data(cur[j], this.widgetFullName);
│ │ │ │ - if(inst && inst !== this && !inst.options.disabled) {
│ │ │ │ - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
│ │ │ │ - this.containers.push(inst);
│ │ │ │ - for (i = queries.length - 1; i >= 0; i--) {
│ │ │ │ - targetData = queries[i][1];
│ │ │ │ - _queries = queries[i][0];
│ │ │ │ - for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
│ │ │ │ - item = $(_queries[j]);
│ │ │ │ - item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
│ │ │ │ - items.push({
│ │ │ │ - item: item,
│ │ │ │ - instance: targetData,
│ │ │ │ - width: 0, height: 0,
│ │ │ │ - left: 0, top: 0
│ │ │ │ - refreshPositions: function(fast) {
│ │ │ │ - //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
│ │ │ │ - if(this.offsetParent && this.helper) {
│ │ │ │ - this.offset.parent = this._getParentOffset();
│ │ │ │ - var i, item, t, p;
│ │ │ │ - for (i = this.items.length - 1; i >= 0; i--){
│ │ │ │ - item = this.items[i];
│ │ │ │ - //We ignore calculating positions of all connected containers when we're not over them
│ │ │ │ - if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
│ │ │ │ - continue;
│ │ │ │ - t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
│ │ │ │ - if (!fast) {
│ │ │ │ - item.width = t.outerWidth();
│ │ │ │ - item.height = t.outerHeight();
│ │ │ │ - p = t.offset();
│ │ │ │ - item.left = p.left;
│ │ │ │ - item.top = p.top;
│ │ │ │ - if(this.options.custom && this.options.custom.refreshContainers) {
│ │ │ │ - this.options.custom.refreshContainers.call(this);
│ │ │ │ - } else {
│ │ │ │ - for (i = this.containers.length - 1; i >= 0; i--){
│ │ │ │ - p = this.containers[i].element.offset();
│ │ │ │ - this.containers[i].containerCache.left = p.left;
│ │ │ │ - this.containers[i].containerCache.top = p.top;
│ │ │ │ - this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
│ │ │ │ - this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
│ │ │ │ - return this;
│ │ │ │ - _createPlaceholder: function(that) {
│ │ │ │ - that = that || this;
│ │ │ │ - var className,
│ │ │ │ - o = that.options;
│ │ │ │ - if(!o.placeholder || o.placeholder.constructor === String) {
│ │ │ │ - className = o.placeholder;
│ │ │ │ - o.placeholder = {
│ │ │ │ - element: function() {
│ │ │ │ - var nodeName = that.currentItem[0].nodeName.toLowerCase(),
│ │ │ │ - element = $( "<" + nodeName + ">", that.document[0] )
│ │ │ │ - .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
│ │ │ │ - .removeClass("ui-sortable-helper");
│ │ │ │ - if ( nodeName === "tr" ) {
│ │ │ │ - that.currentItem.children().each(function() {
│ │ │ │ - $( "
| ", that.document[0] )
│ │ │ │ - .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
│ │ │ │ - .appendTo( element );
│ │ │ │ - });
│ │ │ │ - } else if ( nodeName === "img" ) {
│ │ │ │ - element.attr( "src", that.currentItem.attr( "src" ) );
│ │ │ │ - if ( !className ) {
│ │ │ │ - element.css( "visibility", "hidden" );
│ │ │ │ - return element;
│ │ │ │ - update: function(container, p) {
│ │ │ │ - // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
│ │ │ │ - // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
│ │ │ │ - if(className && !o.forcePlaceholderSize) {
│ │ │ │ - return;
│ │ │ │ - //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
│ │ │ │ - if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
│ │ │ │ - if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
│ │ │ │ - //Create the placeholder
│ │ │ │ - that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
│ │ │ │ - //Append it after the actual current item
│ │ │ │ - that.currentItem.after(that.placeholder);
│ │ │ │ - //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
│ │ │ │ - o.placeholder.update(that, that.placeholder);
│ │ │ │ - _contactContainers: function(event) {
│ │ │ │ - var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
│ │ │ │ - innermostContainer = null,
│ │ │ │ - innermostIndex = null;
│ │ │ │ - // get innermost container that intersects with item
│ │ │ │ - for (i = this.containers.length - 1; i >= 0; i--) {
│ │ │ │ - // never consider a container that's located within the item itself
│ │ │ │ - if($.contains(this.currentItem[0], this.containers[i].element[0])) {
│ │ │ │ - continue;
│ │ │ │ - if(this._intersectsWith(this.containers[i].containerCache)) {
│ │ │ │ - // if we've already found a container and it's more "inner" than this, then continue
│ │ │ │ - if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
│ │ │ │ - continue;
│ │ │ │ - innermostContainer = this.containers[i];
│ │ │ │ - innermostIndex = i;
│ │ │ │ - } else {
│ │ │ │ - // container doesn't intersect. trigger "out" event if necessary
│ │ │ │ - if(this.containers[i].containerCache.over) {
│ │ │ │ - this.containers[i]._trigger("out", event, this._uiHash(this));
│ │ │ │ - this.containers[i].containerCache.over = 0;
│ │ │ │ - // if no intersecting containers found, return
│ │ │ │ - if(!innermostContainer) {
│ │ │ │ - return;
│ │ │ │ - // move the item into the container if it's not there already
│ │ │ │ - if(this.containers.length === 1) {
│ │ │ │ - if (!this.containers[innermostIndex].containerCache.over) {
│ │ │ │ - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
│ │ │ │ - this.containers[innermostIndex].containerCache.over = 1;
│ │ │ │ - } else {
│ │ │ │ - //When entering a new container, we will find the item with the least distance and append our item near it
│ │ │ │ - dist = 10000;
│ │ │ │ - itemWithLeastDistance = null;
│ │ │ │ - floating = innermostContainer.floating || isFloating(this.currentItem);
│ │ │ │ - posProperty = floating ? "left" : "top";
│ │ │ │ - sizeProperty = floating ? "width" : "height";
│ │ │ │ - base = this.positionAbs[posProperty] + this.offset.click[posProperty];
│ │ │ │ - for (j = this.items.length - 1; j >= 0; j--) {
│ │ │ │ - if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
│ │ │ │ - continue;
│ │ │ │ - if(this.items[j].item[0] === this.currentItem[0]) {
│ │ │ │ - continue;
│ │ │ │ - if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) {
│ │ │ │ - continue;
│ │ │ │ - cur = this.items[j].item.offset()[posProperty];
│ │ │ │ - nearBottom = false;
│ │ │ │ - if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
│ │ │ │ - nearBottom = true;
│ │ │ │ - cur += this.items[j][sizeProperty];
│ │ │ │ - if(Math.abs(cur - base) < dist) {
│ │ │ │ - dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
│ │ │ │ - this.direction = nearBottom ? "up": "down";
│ │ │ │ - //Check if dropOnEmpty is enabled
│ │ │ │ - if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
│ │ │ │ - return;
│ │ │ │ - if(this.currentContainer === this.containers[innermostIndex]) {
│ │ │ │ - return;
│ │ │ │ - itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
│ │ │ │ - this._trigger("change", event, this._uiHash());
│ │ │ │ - this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
│ │ │ │ - this.currentContainer = this.containers[innermostIndex];
│ │ │ │ - //Update the placeholder
│ │ │ │ - this.options.placeholder.update(this.currentContainer, this.placeholder);
│ │ │ │ - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
│ │ │ │ - this.containers[innermostIndex].containerCache.over = 1;
│ │ │ │ - _createHelper: function(event) {
│ │ │ │ - var o = this.options,
│ │ │ │ - helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
│ │ │ │ - //Add the helper to the DOM if that didn't happen already
│ │ │ │ - if(!helper.parents("body").length) {
│ │ │ │ - $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
│ │ │ │ - if(helper[0] === this.currentItem[0]) {
│ │ │ │ - this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
│ │ │ │ - if(!helper[0].style.width || o.forceHelperSize) {
│ │ │ │ - helper.width(this.currentItem.width());
│ │ │ │ - if(!helper[0].style.height || o.forceHelperSize) {
│ │ │ │ - helper.height(this.currentItem.height());
│ │ │ │ - return helper;
│ │ │ │ - _adjustOffsetFromHelper: function(obj) {
│ │ │ │ - if (typeof obj === "string") {
│ │ │ │ - obj = obj.split(" ");
│ │ │ │ - if ($.isArray(obj)) {
│ │ │ │ - obj = {left: +obj[0], top: +obj[1] || 0};
│ │ │ │ - if ("left" in obj) {
│ │ │ │ - this.offset.click.left = obj.left + this.margins.left;
│ │ │ │ - if ("right" in obj) {
│ │ │ │ - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
│ │ │ │ - if ("top" in obj) {
│ │ │ │ - this.offset.click.top = obj.top + this.margins.top;
│ │ │ │ - if ("bottom" in obj) {
│ │ │ │ - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
│ │ │ │ - _getParentOffset: function() {
│ │ │ │ - //Get the offsetParent and cache its position
│ │ │ │ - this.offsetParent = this.helper.offsetParent();
│ │ │ │ - var po = this.offsetParent.offset();
│ │ │ │ - // This is a special case where we need to modify a offset calculated on start, since the following happened:
│ │ │ │ - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
│ │ │ │ - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
│ │ │ │ - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
│ │ │ │ - if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
│ │ │ │ - po.left += this.scrollParent.scrollLeft();
│ │ │ │ - po.top += this.scrollParent.scrollTop();
│ │ │ │ - // This needs to be actually done for all browsers, since pageX/pageY includes this information
│ │ │ │ - // with an ugly IE fix
│ │ │ │ - if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
│ │ │ │ - po = { top: 0, left: 0 };
│ │ │ │ - return {
│ │ │ │ - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
│ │ │ │ - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
│ │ │ │ - _getRelativeOffset: function() {
│ │ │ │ - if(this.cssPosition === "relative") {
│ │ │ │ - var p = this.currentItem.position();
│ │ │ │ - return {
│ │ │ │ - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
│ │ │ │ - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
│ │ │ │ - } else {
│ │ │ │ - return { top: 0, left: 0 };
│ │ │ │ - _cacheMargins: function() {
│ │ │ │ - this.margins = {
│ │ │ │ - left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
│ │ │ │ - top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
│ │ │ │ - _cacheHelperProportions: function() {
│ │ │ │ - this.helperProportions = {
│ │ │ │ - width: this.helper.outerWidth(),
│ │ │ │ - height: this.helper.outerHeight()
│ │ │ │ - _setContainment: function() {
│ │ │ │ - var ce, co, over,
│ │ │ │ - o = this.options;
│ │ │ │ - if(o.containment === "parent") {
│ │ │ │ - o.containment = this.helper[0].parentNode;
│ │ │ │ - if(o.containment === "document" || o.containment === "window") {
│ │ │ │ - this.containment = [
│ │ │ │ - 0 - this.offset.relative.left - this.offset.parent.left,
│ │ │ │ - 0 - this.offset.relative.top - this.offset.parent.top,
│ │ │ │ - $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
│ │ │ │ - ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
│ │ │ │ - if(!(/^(document|window|parent)$/).test(o.containment)) {
│ │ │ │ - ce = $(o.containment)[0];
│ │ │ │ - co = $(o.containment).offset();
│ │ │ │ - over = ($(ce).css("overflow") !== "hidden");
│ │ │ │ - this.containment = [
│ │ │ │ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
│ │ │ │ - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
│ │ │ │ - co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
│ │ │ │ - co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
│ │ │ │ - _convertPositionTo: function(d, pos) {
│ │ │ │ - if(!pos) {
│ │ │ │ - pos = this.position;
│ │ │ │ - var mod = d === "absolute" ? 1 : -1,
│ │ │ │ - scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
│ │ │ │ - scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
│ │ │ │ - return {
│ │ │ │ - top: (
│ │ │ │ - pos.top + // The absolute mouse position
│ │ │ │ - this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
│ │ │ │ - this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
│ │ │ │ - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
│ │ │ │ - left: (
│ │ │ │ - pos.left + // The absolute mouse position
│ │ │ │ - this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
│ │ │ │ - this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
│ │ │ │ - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
│ │ │ │ - _generatePosition: function(event) {
│ │ │ │ - var top, left,
│ │ │ │ - o = this.options,
│ │ │ │ - pageX = event.pageX,
│ │ │ │ - pageY = event.pageY,
│ │ │ │ - scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
│ │ │ │ - // This is another very weird special case that only happens for relative elements:
│ │ │ │ - // 1. If the css position is relative
│ │ │ │ - // 2. and the scroll parent is the document or similar to the offset parent
│ │ │ │ - // we have to refresh the relative offset during the scroll so there are no jumps
│ │ │ │ - if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
│ │ │ │ - this.offset.relative = this._getRelativeOffset();
│ │ │ │ - * - Position constraining -
│ │ │ │ - * Constrain the position to a mix of grid, containment.
│ │ │ │ - if(this.originalPosition) { //If we are not dragging yet, we won't check for options
│ │ │ │ - if(this.containment) {
│ │ │ │ - if(event.pageX - this.offset.click.left < this.containment[0]) {
│ │ │ │ - pageX = this.containment[0] + this.offset.click.left;
│ │ │ │ - if(event.pageY - this.offset.click.top < this.containment[1]) {
│ │ │ │ - pageY = this.containment[1] + this.offset.click.top;
│ │ │ │ - if(event.pageX - this.offset.click.left > this.containment[2]) {
│ │ │ │ - pageX = this.containment[2] + this.offset.click.left;
│ │ │ │ - if(event.pageY - this.offset.click.top > this.containment[3]) {
│ │ │ │ - pageY = this.containment[3] + this.offset.click.top;
│ │ │ │ - if(o.grid) {
│ │ │ │ - top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
│ │ │ │ - pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
│ │ │ │ - left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
│ │ │ │ - pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
│ │ │ │ - return {
│ │ │ │ - top: (
│ │ │ │ - pageY - // The absolute mouse position
│ │ │ │ - this.offset.click.top - // Click offset (relative to the element)
│ │ │ │ - this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
│ │ │ │ - this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
│ │ │ │ - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
│ │ │ │ - left: (
│ │ │ │ - pageX - // The absolute mouse position
│ │ │ │ - this.offset.click.left - // Click offset (relative to the element)
│ │ │ │ - this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
│ │ │ │ - this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
│ │ │ │ - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
│ │ │ │ - _rearrange: function(event, i, a, hardRefresh) {
│ │ │ │ - a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
│ │ │ │ - //Various things done here to improve the performance:
│ │ │ │ - // 1. we create a setTimeout, that calls refreshPositions
│ │ │ │ - // 2. on the instance, we have a counter variable, that get's higher after every append
│ │ │ │ - // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
│ │ │ │ - // 4. this lets only the last addition to the timeout stack through
│ │ │ │ - this.counter = this.counter ? ++this.counter : 1;
│ │ │ │ - var counter = this.counter;
│ │ │ │ - this._delay(function() {
│ │ │ │ - if(counter === this.counter) {
│ │ │ │ - this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
│ │ │ │ - _clear: function(event, noPropagation) {
│ │ │ │ - this.reverting = false;
│ │ │ │ - // We delay all events that have to be triggered to after the point where the placeholder has been removed and
│ │ │ │ - // everything else normalized again
│ │ │ │ - var i,
│ │ │ │ - delayedTriggers = [];
│ │ │ │ - // We first have to update the dom position of the actual currentItem
│ │ │ │ - // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
│ │ │ │ - if(!this._noFinalSort && this.currentItem.parent().length) {
│ │ │ │ - this.placeholder.before(this.currentItem);
│ │ │ │ - this._noFinalSort = null;
│ │ │ │ - if(this.helper[0] === this.currentItem[0]) {
│ │ │ │ - for(i in this._storedCSS) {
│ │ │ │ - if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
│ │ │ │ - this._storedCSS[i] = "";
│ │ │ │ - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
│ │ │ │ - } else {
│ │ │ │ - this.currentItem.show();
│ │ │ │ - if(this.fromOutside && !noPropagation) {
│ │ │ │ - delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
│ │ │ │ - if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
│ │ │ │ - delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
│ │ │ │ - // Check if the items Container has Changed and trigger appropriate
│ │ │ │ - // events.
│ │ │ │ - if (this !== this.currentContainer) {
│ │ │ │ - if(!noPropagation) {
│ │ │ │ - delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
│ │ │ │ - delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
│ │ │ │ - delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
│ │ │ │ - //Post events to containers
│ │ │ │ - function delayEvent( type, instance, container ) {
│ │ │ │ - return function( event ) {
│ │ │ │ - container._trigger( type, event, instance._uiHash( instance ) );
│ │ │ │ - for (i = this.containers.length - 1; i >= 0; i--){
│ │ │ │ - if (!noPropagation) {
│ │ │ │ - delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
│ │ │ │ - if(this.containers[i].containerCache.over) {
│ │ │ │ - delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
│ │ │ │ - this.containers[i].containerCache.over = 0;
│ │ │ │ - //Do what was originally in plugins
│ │ │ │ - if ( this.storedCursor ) {
│ │ │ │ - this.document.find( "body" ).css( "cursor", this.storedCursor );
│ │ │ │ - this.storedStylesheet.remove();
│ │ │ │ - if(this._storedOpacity) {
│ │ │ │ - this.helper.css("opacity", this._storedOpacity);
│ │ │ │ - if(this._storedZIndex) {
│ │ │ │ - this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
│ │ │ │ - this.dragging = false;
│ │ │ │ - if(this.cancelHelperRemoval) {
│ │ │ │ - if(!noPropagation) {
│ │ │ │ - this._trigger("beforeStop", event, this._uiHash());
│ │ │ │ - for (i=0; i < delayedTriggers.length; i++) {
│ │ │ │ - delayedTriggers[i].call(this, event);
│ │ │ │ - } //Trigger all delayed events
│ │ │ │ - this._trigger("stop", event, this._uiHash());
│ │ │ │ - this.fromOutside = false;
│ │ │ │ - return false;
│ │ │ │ - if(!noPropagation) {
│ │ │ │ - this._trigger("beforeStop", event, this._uiHash());
│ │ │ │ - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
│ │ │ │ - this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
│ │ │ │ - if(this.helper[0] !== this.currentItem[0]) {
│ │ │ │ - this.helper.remove();
│ │ │ │ - this.helper = null;
│ │ │ │ - if(!noPropagation) {
│ │ │ │ - for (i=0; i < delayedTriggers.length; i++) {
│ │ │ │ - delayedTriggers[i].call(this, event);
│ │ │ │ - } //Trigger all delayed events
│ │ │ │ - this._trigger("stop", event, this._uiHash());
│ │ │ │ - this.fromOutside = false;
│ │ │ │ - return true;
│ │ │ │ - _trigger: function() {
│ │ │ │ - if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
│ │ │ │ - this.cancel();
│ │ │ │ - _uiHash: function(_inst) {
│ │ │ │ - var inst = _inst || this;
│ │ │ │ - return {
│ │ │ │ - helper: inst.helper,
│ │ │ │ - placeholder: inst.placeholder || $([]),
│ │ │ │ - position: inst.position,
│ │ │ │ - originalPosition: inst.originalPosition,
│ │ │ │ - offset: inst.positionAbs,
│ │ │ │ - item: inst.currentItem,
│ │ │ │ - sender: _inst ? _inst.element : null
│ │ │ │ -})(jQuery);
│ │ │ │ -js/jquery.ui.mouse.js
│ │ │ │ - * jQuery UI Mouse 1.10.4
│ │ │ │ - * http://jqueryui.com
│ │ │ │ - * Copyright 2014 jQuery Foundation and other contributors
│ │ │ │ - * Released under the MIT license.
│ │ │ │ - * http://jquery.org/license
│ │ │ │ - * http://api.jqueryui.com/mouse/
│ │ │ │ - * Depends:
│ │ │ │ - * jquery.ui.widget.js
│ │ │ │ -(function( $, undefined ) {
│ │ │ │ -var mouseHandled = false;
│ │ │ │ -$( document ).mouseup( function() {
│ │ │ │ - mouseHandled = false;
│ │ │ │ -$.widget("ui.mouse", {
│ │ │ │ - version: "1.10.4",
│ │ │ │ - options: {
│ │ │ │ - cancel: "input,textarea,button,select,option",
│ │ │ │ - distance: 1,
│ │ │ │ - delay: 0
│ │ │ │ - _mouseInit: function() {
│ │ │ │ - var that = this;
│ │ │ │ - this.element
│ │ │ │ - .bind("mousedown."+this.widgetName, function(event) {
│ │ │ │ - return that._mouseDown(event);
│ │ │ │ - .bind("click."+this.widgetName, function(event) {
│ │ │ │ - if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
│ │ │ │ - $.removeData(event.target, that.widgetName + ".preventClickEvent");
│ │ │ │ - event.stopImmediatePropagation();
│ │ │ │ - return false;
│ │ │ │ - this.started = false;
│ │ │ │ - // TODO: make sure destroying one instance of mouse doesn't mess with
│ │ │ │ - // other instances of mouse
│ │ │ │ - _mouseDestroy: function() {
│ │ │ │ - this.element.unbind("."+this.widgetName);
│ │ │ │ - if ( this._mouseMoveDelegate ) {
│ │ │ │ - $(document)
│ │ │ │ - .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
│ │ │ │ - .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
│ │ │ │ - _mouseDown: function(event) {
│ │ │ │ - // don't let more than one widget handle mouseStart
│ │ │ │ - if( mouseHandled ) { return; }
│ │ │ │ - // we may have missed mouseup (out of window)
│ │ │ │ - (this._mouseStarted && this._mouseUp(event));
│ │ │ │ - this._mouseDownEvent = event;
│ │ │ │ - var that = this,
│ │ │ │ - btnIsLeft = (event.which === 1),
│ │ │ │ - // event.target.nodeName works around a bug in IE 8 with
│ │ │ │ - // disabled inputs (#7620)
│ │ │ │ - elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
│ │ │ │ - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
│ │ │ │ - return true;
│ │ │ │ - this.mouseDelayMet = !this.options.delay;
│ │ │ │ - if (!this.mouseDelayMet) {
│ │ │ │ - this._mouseDelayTimer = setTimeout(function() {
│ │ │ │ - that.mouseDelayMet = true;
│ │ │ │ - }, this.options.delay);
│ │ │ │ - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
│ │ │ │ - this._mouseStarted = (this._mouseStart(event) !== false);
│ │ │ │ - if (!this._mouseStarted) {
│ │ │ │ - event.preventDefault();
│ │ │ │ - return true;
│ │ │ │ - // Click event may never have fired (Gecko & Opera)
│ │ │ │ - if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
│ │ │ │ - $.removeData(event.target, this.widgetName + ".preventClickEvent");
│ │ │ │ - // these delegates are required to keep context
│ │ │ │ - this._mouseMoveDelegate = function(event) {
│ │ │ │ - return that._mouseMove(event);
│ │ │ │ - this._mouseUpDelegate = function(event) {
│ │ │ │ - return that._mouseUp(event);
│ │ │ │ - $(document)
│ │ │ │ - .bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
│ │ │ │ - .bind("mouseup."+this.widgetName, this._mouseUpDelegate);
│ │ │ │ - event.preventDefault();
│ │ │ │ - mouseHandled = true;
│ │ │ │ - return true;
│ │ │ │ - _mouseMove: function(event) {
│ │ │ │ - // IE mouseup check - mouseup happened when mouse was out of window
│ │ │ │ - if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
│ │ │ │ - return this._mouseUp(event);
│ │ │ │ - if (this._mouseStarted) {
│ │ │ │ - this._mouseDrag(event);
│ │ │ │ - return event.preventDefault();
│ │ │ │ - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
│ │ │ │ - this._mouseStarted =
│ │ │ │ - (this._mouseStart(this._mouseDownEvent, event) !== false);
│ │ │ │ - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
│ │ │ │ - return !this._mouseStarted;
│ │ │ │ - _mouseUp: function(event) {
│ │ │ │ - $(document)
│ │ │ │ - .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
│ │ │ │ - .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
│ │ │ │ - if (this._mouseStarted) {
│ │ │ │ - this._mouseStarted = false;
│ │ │ │ - if (event.target === this._mouseDownEvent.target) {
│ │ │ │ - $.data(event.target, this.widgetName + ".preventClickEvent", true);
│ │ │ │ - this._mouseStop(event);
│ │ │ │ - return false;
│ │ │ │ - _mouseDistanceMet: function(event) {
│ │ │ │ - return (Math.max(
│ │ │ │ - Math.abs(this._mouseDownEvent.pageX - event.pageX),
│ │ │ │ - Math.abs(this._mouseDownEvent.pageY - event.pageY)
│ │ │ │ - ) >= this.options.distance
│ │ │ │ - _mouseDelayMet: function(/* event */) {
│ │ │ │ - return this.mouseDelayMet;
│ │ │ │ - // These are placeholder methods, to be overriden by extending plugin
│ │ │ │ - _mouseStart: function(/* event */) {},
│ │ │ │ - _mouseDrag: function(/* event */) {},
│ │ │ │ - _mouseStop: function(/* event */) {},
│ │ │ │ - _mouseCapture: function(/* event */) { return true; }
│ │ │ │ -})(jQuery);
│ │ │ │ -js/jquery.ui.core.js
│ │ │ │ - * jQuery UI Core 1.10.4
│ │ │ │ - * http://jqueryui.com
│ │ │ │ - * Copyright 2014 jQuery Foundation and other contributors
│ │ │ │ - * Released under the MIT license.
│ │ │ │ - * http://jquery.org/license
│ │ │ │ - * http://api.jqueryui.com/category/ui-core/
│ │ │ │ -(function( $, undefined ) {
│ │ │ │ -var uuid = 0,
│ │ │ │ - runiqueId = /^ui-id-\d+$/;
│ │ │ │ -// $.ui might exist from components with no dependencies, e.g., $.ui.position
│ │ │ │ -$.ui = $.ui || {};
│ │ │ │ -$.extend( $.ui, {
│ │ │ │ - version: "1.10.4",
│ │ │ │ - keyCode: {
│ │ │ │ - BACKSPACE: 8,
│ │ │ │ - COMMA: 188,
│ │ │ │ - DELETE: 46,
│ │ │ │ - DOWN: 40,
│ │ │ │ - END: 35,
│ │ │ │ - ENTER: 13,
│ │ │ │ - ESCAPE: 27,
│ │ │ │ - HOME: 36,
│ │ │ │ - LEFT: 37,
│ │ │ │ - NUMPAD_ADD: 107,
│ │ │ │ - NUMPAD_DECIMAL: 110,
│ │ │ │ - NUMPAD_DIVIDE: 111,
│ │ │ │ - NUMPAD_ENTER: 108,
│ │ │ │ - NUMPAD_MULTIPLY: 106,
│ │ │ │ - NUMPAD_SUBTRACT: 109,
│ │ │ │ - PAGE_DOWN: 34,
│ │ │ │ - PAGE_UP: 33,
│ │ │ │ - PERIOD: 190,
│ │ │ │ - RIGHT: 39,
│ │ │ │ - SPACE: 32,
│ │ │ │ - TAB: 9,
│ │ │ │ - UP: 38
│ │ │ │ -// plugins
│ │ │ │ -$.fn.extend({
│ │ │ │ - focus: (function( orig ) {
│ │ │ │ - return function( delay, fn ) {
│ │ │ │ - return typeof delay === "number" ?
│ │ │ │ - this.each(function() {
│ │ │ │ - var elem = this;
│ │ │ │ - setTimeout(function() {
│ │ │ │ - $( elem ).focus();
│ │ │ │ - if ( fn ) {
│ │ │ │ - fn.call( elem );
│ │ │ │ - }, delay );
│ │ │ │ - }) :
│ │ │ │ - orig.apply( this, arguments );
│ │ │ │ - })( $.fn.focus ),
│ │ │ │ - scrollParent: function() {
│ │ │ │ - var scrollParent;
│ │ │ │ - if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
│ │ │ │ - scrollParent = this.parents().filter(function() {
│ │ │ │ - return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
│ │ │ │ - }).eq(0);
│ │ │ │ - } else {
│ │ │ │ - scrollParent = this.parents().filter(function() {
│ │ │ │ - return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
│ │ │ │ - }).eq(0);
│ │ │ │ - return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
│ │ │ │ - zIndex: function( zIndex ) {
│ │ │ │ - if ( zIndex !== undefined ) {
│ │ │ │ - return this.css( "zIndex", zIndex );
│ │ │ │ - if ( this.length ) {
│ │ │ │ - var elem = $( this[ 0 ] ), position, value;
│ │ │ │ - while ( elem.length && elem[ 0 ] !== document ) {
│ │ │ │ - // Ignore z-index if position is set to a value where z-index is ignored by the browser
│ │ │ │ - // This makes behavior of this function consistent across browsers
│ │ │ │ - // WebKit always returns auto if the element is positioned
│ │ │ │ - position = elem.css( "position" );
│ │ │ │ - if ( position === "absolute" || position === "relative" || position === "fixed" ) {
│ │ │ │ - // IE returns 0 when zIndex is not specified
│ │ │ │ - // other browsers return a string
│ │ │ │ - // we ignore the case of nested elements with an explicit value of 0
│ │ │ │ - //
│ │ │ │ - value = parseInt( elem.css( "zIndex" ), 10 );
│ │ │ │ - if ( !isNaN( value ) && value !== 0 ) {
│ │ │ │ - return value;
│ │ │ │ - elem = elem.parent();
│ │ │ │ - return 0;
│ │ │ │ - uniqueId: function() {
│ │ │ │ - return this.each(function() {
│ │ │ │ - if ( !this.id ) {
│ │ │ │ - this.id = "ui-id-" + (++uuid);
│ │ │ │ - removeUniqueId: function() {
│ │ │ │ - return this.each(function() {
│ │ │ │ - if ( runiqueId.test( this.id ) ) {
│ │ │ │ - $( this ).removeAttr( "id" );
│ │ │ │ -// selectors
│ │ │ │ -function focusable( element, isTabIndexNotNaN ) {
│ │ │ │ - var map, mapName, img,
│ │ │ │ - nodeName = element.nodeName.toLowerCase();
│ │ │ │ - if ( "area" === nodeName ) {
│ │ │ │ - map = element.parentNode;
│ │ │ │ - mapName = map.name;
│ │ │ │ - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
│ │ │ │ - return false;
│ │ │ │ - img = $( "img[usemap=#" + mapName + "]" )[0];
│ │ │ │ - return !!img && visible( img );
│ │ │ │ - return ( /input|select|textarea|button|object/.test( nodeName ) ?
│ │ │ │ - !element.disabled :
│ │ │ │ - "a" === nodeName ?
│ │ │ │ - element.href || isTabIndexNotNaN :
│ │ │ │ - isTabIndexNotNaN) &&
│ │ │ │ - // the element and all of its ancestors must be visible
│ │ │ │ - visible( element );
│ │ │ │ -function visible( element ) {
│ │ │ │ - return $.expr.filters.visible( element ) &&
│ │ │ │ - !$( element ).parents().addBack().filter(function() {
│ │ │ │ - return $.css( this, "visibility" ) === "hidden";
│ │ │ │ - }).length;
│ │ │ │ -$.extend( $.expr[ ":" ], {
│ │ │ │ - data: $.expr.createPseudo ?
│ │ │ │ - $.expr.createPseudo(function( dataName ) {
│ │ │ │ - return function( elem ) {
│ │ │ │ - return !!$.data( elem, dataName );
│ │ │ │ - // support: jQuery <1.8
│ │ │ │ - function( elem, i, match ) {
│ │ │ │ - return !!$.data( elem, match[ 3 ] );
│ │ │ │ - focusable: function( element ) {
│ │ │ │ - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
│ │ │ │ - tabbable: function( element ) {
│ │ │ │ - var tabIndex = $.attr( element, "tabindex" ),
│ │ │ │ - isTabIndexNaN = isNaN( tabIndex );
│ │ │ │ - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
│ │ │ │ -// support: jQuery <1.8
│ │ │ │ -if ( !$( "
" ).outerWidth( 1 ).jquery ) {
│ │ │ │ - $.each( [ "Width", "Height" ], function( i, name ) {
│ │ │ │ - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
│ │ │ │ - type = name.toLowerCase(),
│ │ │ │ - orig = {
│ │ │ │ - innerWidth: $.fn.innerWidth,
│ │ │ │ - innerHeight: $.fn.innerHeight,
│ │ │ │ - outerWidth: $.fn.outerWidth,
│ │ │ │ - outerHeight: $.fn.outerHeight
│ │ │ │ - function reduce( elem, size, border, margin ) {
│ │ │ │ - $.each( side, function() {
│ │ │ │ - size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
│ │ │ │ - if ( border ) {
│ │ │ │ - size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
│ │ │ │ - if ( margin ) {
│ │ │ │ - size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
│ │ │ │ - return size;
│ │ │ │ - $.fn[ "inner" + name ] = function( size ) {
│ │ │ │ - if ( size === undefined ) {
│ │ │ │ - return orig[ "inner" + name ].call( this );
│ │ │ │ - return this.each(function() {
│ │ │ │ - $( this ).css( type, reduce( this, size ) + "px" );
│ │ │ │ - $.fn[ "outer" + name] = function( size, margin ) {
│ │ │ │ - if ( typeof size !== "number" ) {
│ │ │ │ - return orig[ "outer" + name ].call( this, size );
│ │ │ │ - return this.each(function() {
│ │ │ │ - $( this).css( type, reduce( this, size, true, margin ) + "px" );
│ │ │ │ -// support: jQuery <1.8
│ │ │ │ -if ( !$.fn.addBack ) {
│ │ │ │ - $.fn.addBack = function( selector ) {
│ │ │ │ - return this.add( selector == null ?
│ │ │ │ - this.prevObject : this.prevObject.filter( selector )
│ │ │ │ -// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
│ │ │ │ -if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
│ │ │ │ - $.fn.removeData = (function( removeData ) {
│ │ │ │ - return function( key ) {
│ │ │ │ - if ( arguments.length ) {
│ │ │ │ - return removeData.call( this, $.camelCase( key ) );
│ │ │ │ - } else {
│ │ │ │ - return removeData.call( this );
│ │ │ │ - })( $.fn.removeData );
│ │ │ │ -// deprecated
│ │ │ │ -$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
│ │ │ │ -$.support.selectstart = "onselectstart" in document.createElement( "div" );
│ │ │ │ -$.fn.extend({
│ │ │ │ - disableSelection: function() {
│ │ │ │ - return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
│ │ │ │ - ".ui-disableSelection", function( event ) {
│ │ │ │ - event.preventDefault();
│ │ │ │ - enableSelection: function() {
│ │ │ │ - return this.unbind( ".ui-disableSelection" );
│ │ │ │ -$.extend( $.ui, {
│ │ │ │ - // $.ui.plugin is deprecated. Use $.widget() extensions instead.
│ │ │ │ - plugin: {
│ │ │ │ - add: function( module, option, set ) {
│ │ │ │ - var i,
│ │ │ │ - proto = $.ui[ module ].prototype;
│ │ │ │ - for ( i in set ) {
│ │ │ │ - proto.plugins[ i ] = proto.plugins[ i ] || [];
│ │ │ │ - proto.plugins[ i ].push( [ option, set[ i ] ] );
│ │ │ │ - call: function( instance, name, args ) {
│ │ │ │ - var i,
│ │ │ │ - set = instance.plugins[ name ];
│ │ │ │ - if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
│ │ │ │ - return;
│ │ │ │ - for ( i = 0; i < set.length; i++ ) {
│ │ │ │ - if ( instance.options[ set[ i ][ 0 ] ] ) {
│ │ │ │ - set[ i ][ 1 ].apply( instance.element, args );
│ │ │ │ - // only used by resizable
│ │ │ │ - hasScroll: function( el, a ) {
│ │ │ │ - //If overflow is hidden, the element might have extra content, but the user wants to hide it
│ │ │ │ - if ( $( el ).css( "overflow" ) === "hidden") {
│ │ │ │ - return false;
│ │ │ │ - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
│ │ │ │ - has = false;
│ │ │ │ - if ( el[ scroll ] > 0 ) {
│ │ │ │ - return true;
│ │ │ │ - // TODO: determine which cases actually cause this to happen
│ │ │ │ - // if the element doesn't have the scroll set, see if it's possible to
│ │ │ │ - // set the scroll
│ │ │ │ - el[ scroll ] = 1;
│ │ │ │ - has = ( el[ scroll ] > 0 );
│ │ │ │ - el[ scroll ] = 0;
│ │ │ │ - return has;
│ │ │ │ -})( jQuery );
│ │ │ │ -js/jquery.full.js
│ │ │ │ - * jQuery JavaScript Library v2.1.0
│ │ │ │ - * 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: 2014-01-23T21:10Z
│ │ │ │ -(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 arr = [];
│ │ │ │ -var slice = arr.slice;
│ │ │ │ -var concat = arr.concat;
│ │ │ │ -var push = arr.push;
│ │ │ │ -var indexOf = arr.indexOf;
│ │ │ │ -var class2type = {};
│ │ │ │ -var toString = class2type.toString;
│ │ │ │ -var hasOwn = class2type.hasOwnProperty;
│ │ │ │ -var trim = "".trim;
│ │ │ │ -var support = {};
│ │ │ │ - // Use the correct document accordingly with window argument (sandbox)
│ │ │ │ - document = window.document,
│ │ │ │ - version = "2.1.0",
│ │ │ │ - // 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 );
│ │ │ │ - // 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 a 'clean' array
│ │ │ │ - ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
│ │ │ │ - // Return just the object
│ │ │ │ - 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: arr.sort,
│ │ │ │ - splice: arr.splice
│ │ │ │ -jQuery.extend = jQuery.fn.extend = function() {
│ │ │ │ - var options, name, src, copy, copyIsArray, 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 ] || {};
│ │ │ │ - // 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;
│ │ │ │ - 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,
│ │ │ │ - isWindow: function( obj ) {
│ │ │ │ - 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
│ │ │ │ - return obj - parseFloat( obj ) >= 0;
│ │ │ │ - isPlainObject: function( obj ) {
│ │ │ │ - // Not plain objects:
│ │ │ │ - // - Any object or value whose internal [[Class]] property is not "[object Object]"
│ │ │ │ - // - DOM nodes
│ │ │ │ - // - window
│ │ │ │ - if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
│ │ │ │ - return false;
│ │ │ │ - // Support: Firefox <20
│ │ │ │ - // The try/catch suppresses exceptions thrown when attempting to access
│ │ │ │ - // the "constructor" property of certain host objects, ie. |window.location|
│ │ │ │ - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
│ │ │ │ - if ( obj.constructor &&
│ │ │ │ - !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
│ │ │ │ - return false;
│ │ │ │ - } catch ( e ) {
│ │ │ │ - return false;
│ │ │ │ - // If the function hasn't returned already, we're confident that
│ │ │ │ - // |obj| is a plain object, created by {} or constructed with new Object
│ │ │ │ - return true;
│ │ │ │ - isEmptyObject: function( obj ) {
│ │ │ │ - var name;
│ │ │ │ - for ( name in obj ) {
│ │ │ │ - return false;
│ │ │ │ - return true;
│ │ │ │ - type: function( obj ) {
│ │ │ │ - if ( obj == null ) {
│ │ │ │ - return obj + "";
│ │ │ │ - // Support: Android < 4.0, iOS < 6 (functionish RegExp)
│ │ │ │ - return typeof obj === "object" || typeof obj === "function" ?
│ │ │ │ - class2type[ toString.call(obj) ] || "object" :
│ │ │ │ - typeof obj;
│ │ │ │ - // Evaluates a script in a global context
│ │ │ │ - globalEval: function( code ) {
│ │ │ │ - var script,
│ │ │ │ - indirect = eval;
│ │ │ │ - code = jQuery.trim( code );
│ │ │ │ - if ( code ) {
│ │ │ │ - // If the code includes a valid, prologue position
│ │ │ │ - // strict mode pragma, execute code by injecting a
│ │ │ │ - // script tag into the document.
│ │ │ │ - if ( code.indexOf("use strict") === 1 ) {
│ │ │ │ - script = document.createElement("script");
│ │ │ │ - script.text = code;
│ │ │ │ - document.head.appendChild( script ).parentNode.removeChild( script );
│ │ │ │ - } else {
│ │ │ │ - // Otherwise, avoid the DOM node creation, insertion
│ │ │ │ - // and removal by using an indirect global eval
│ │ │ │ - indirect( code );
│ │ │ │ - // 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;
│ │ │ │ - trim: function( text ) {
│ │ │ │ - return text == null ? "" : trim.call( text );
│ │ │ │ - // 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 ) {
│ │ │ │ - return arr == null ? -1 : indexOf.call( arr, elem, i );
│ │ │ │ - merge: function( first, second ) {
│ │ │ │ - var len = +second.length,
│ │ │ │ - j = 0,
│ │ │ │ - i = first.length;
│ │ │ │ - for ( ; j < len; j++ ) {
│ │ │ │ - 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 tmp, args, proxy;
│ │ │ │ - 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: Date.now,
│ │ │ │ - // 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 ) {
│ │ │ │ - var length = 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 v1.10.16
│ │ │ │ - * http://sizzlejs.com/
│ │ │ │ - * Copyright 2013 jQuery Foundation, Inc. and other contributors
│ │ │ │ - * Released under the MIT license
│ │ │ │ - * http://jquery.org/license
│ │ │ │ - * Date: 2014-01-13
│ │ │ │ -(function( window ) {
│ │ │ │ - support,
│ │ │ │ - getText,
│ │ │ │ - compile,
│ │ │ │ - outermostContext,
│ │ │ │ - sortInput,
│ │ │ │ - hasDuplicate,
│ │ │ │ - // Local document vars
│ │ │ │ - setDocument,
│ │ │ │ - document,
│ │ │ │ - docElem,
│ │ │ │ - documentIsHTML,
│ │ │ │ - rbuggyQSA,
│ │ │ │ - rbuggyMatches,
│ │ │ │ - matches,
│ │ │ │ - contains,
│ │ │ │ - // Instance-specific data
│ │ │ │ - expando = "sizzle" + -(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
│ │ │ │ - strundefined = typeof undefined,
│ │ │ │ - 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 if we can't use a native one
│ │ │ │ - indexOf = arr.indexOf || function( elem ) {
│ │ │ │ - var i = 0,
│ │ │ │ - len = this.length;
│ │ │ │ - for ( ; i < len; i++ ) {
│ │ │ │ - if ( this[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#" ),
│ │ │ │ - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
│ │ │ │ - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
│ │ │ │ - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
│ │ │ │ - // Prefer arguments quoted,
│ │ │ │ - // then not containing pseudos/brackets,
│ │ │ │ - // then attribute selectors/non-parenthetical expressions,
│ │ │ │ - // then anything else
│ │ │ │ - // These preferences are here to reduce the number of selectors
│ │ │ │ - // needing tokenize in the PSEUDO preFilter
│ │ │ │ - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
│ │ │ │ - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
│ │ │ │ - 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
│ │ │ │ - // 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 );
│ │ │ │ -// Optimize for push.apply( _, NodeList )
│ │ │ │ - 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 || [];
│ │ │ │ - if ( !selector || typeof selector !== "string" ) {
│ │ │ │ - return results;
│ │ │ │ - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
│ │ │ │ - return [];
│ │ │ │ - if ( documentIsHTML && !seed ) {
│ │ │ │ - // Shortcuts
│ │ │ │ - if ( (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 && context.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 === 9 && 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");
│ │ │ │ - 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 !== strundefined && 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,
│ │ │ │ - doc = node ? node.ownerDocument || node : preferredDoc,
│ │ │ │ - parent = doc.defaultView;
│ │ │ │ - // 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;
│ │ │ │ - // Support tests
│ │ │ │ - documentIsHTML = !isXML( doc );
│ │ │ │ - // 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", function() {
│ │ │ │ - setDocument();
│ │ │ │ - }, false );
│ │ │ │ - } else if ( parent.attachEvent ) {
│ │ │ │ - parent.attachEvent( "onunload", function() {
│ │ │ │ - setDocument();
│ │ │ │ - /* 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;
│ │ │ │ - // Check if getElementsByClassName can be trusted
│ │ │ │ - support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
│ │ │ │ - div.innerHTML = "";
│ │ │ │ - // Support: Safari<4
│ │ │ │ - // Catch class over-caching
│ │ │ │ - div.firstChild.className = "i";
│ │ │ │ - // Support: Opera<10
│ │ │ │ - // Catch gEBCN failure to find non-leading classes
│ │ │ │ - return div.getElementsByClassName("i").length === 2;
│ │ │ │ - // 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 !== strundefined && 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 !== strundefined && elem.getAttributeNode("id");
│ │ │ │ - return node && node.value === attrId;
│ │ │ │ - Expr.find["TAG"] = support.getElementsByTagName ?
│ │ │ │ - function( tag, context ) {
│ │ │ │ - if ( typeof context.getElementsByTagName !== strundefined ) {
│ │ │ │ - return context.getElementsByTagName( tag );
│ │ │ │ - function( tag, context ) {
│ │ │ │ - var elem,
│ │ │ │ - tmp = [],
│ │ │ │ - i = 0,
│ │ │ │ - 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 ( typeof context.getElementsByClassName !== strundefined && 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
│ │ │ │ - div.innerHTML = "";
│ │ │ │ - // Support: IE8, Opera 10-12
│ │ │ │ - // Nothing should be selected when empty strings follow ^= or $= or *=
│ │ │ │ - if ( div.querySelectorAll("[t^='']").length ) {
│ │ │ │ - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
│ │ │ │ - // Support: IE8
│ │ │ │ - // Boolean attributes and "value" are not treated correctly
│ │ │ │ - if ( !div.querySelectorAll("[selected]").length ) {
│ │ │ │ - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
│ │ │ │ - // 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");
│ │ │ │ - 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.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
│ │ │ │ - // 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.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
│ │ │ │ - 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.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
│ │ │ │ - // 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] ) {
│ │ │ │ - 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 :
│ │ │ │ - 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 ) ) ) {
│ │ │ │ - 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 ?
│ │ │ │ - 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[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[5] && match[2];
│ │ │ │ - if ( matchExpr["CHILD"].test( match[0] ) ) {
│ │ │ │ - return null;
│ │ │ │ - // Accept quoted arguments as-is
│ │ │ │ - if ( match[3] && match[4] !== undefined ) {
│ │ │ │ - match[2] = match[4];
│ │ │ │ - // 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 !== strundefined && 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 + " " ).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.call( 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 );
│ │ │ │ - return !results.pop();
│ │ │ │ - "has": markFunction(function( selector ) {
│ │ │ │ - return function( elem ) {
│ │ │ │ - return Sizzle( selector, elem ).length > 0;
│ │ │ │ - "contains": markFunction(function( text ) {
│ │ │ │ - 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();
│ │ │ │ -function tokenize( 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 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.call( 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.call( checkContext, elem ) > -1;
│ │ │ │ - }, implicitRelative, true ),
│ │ │ │ - matchers = [ function( elem, context, xml ) {
│ │ │ │ - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
│ │ │ │ - (checkContext = context).nodeType ?
│ │ │ │ - matchContext( elem, context, xml ) :
│ │ │ │ - matchAnyContext( elem, context, xml ) );
│ │ │ │ - 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, group /* Internal Use Only */ ) {
│ │ │ │ - setMatchers = [],
│ │ │ │ - elementMatchers = [],
│ │ │ │ - cached = compilerCache[ selector + " " ];
│ │ │ │ - if ( !cached ) {
│ │ │ │ - // Generate a function of recursive functions that can be used to check each element
│ │ │ │ - if ( !group ) {
│ │ │ │ - group = tokenize( selector );
│ │ │ │ - i = group.length;
│ │ │ │ - while ( i-- ) {
│ │ │ │ - cached = matcherFromTokens( group[i] );
│ │ │ │ - if ( cached[ expando ] ) {
│ │ │ │ - setMatchers.push( cached );
│ │ │ │ - } else {
│ │ │ │ - elementMatchers.push( cached );
│ │ │ │ - // Cache the compiled function
│ │ │ │ - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
│ │ │ │ - return cached;
│ │ │ │ -function multipleContexts( selector, contexts, results ) {
│ │ │ │ - var i = 0,
│ │ │ │ - len = contexts.length;
│ │ │ │ - for ( ; i < len; i++ ) {
│ │ │ │ - Sizzle( selector, contexts[i], results );
│ │ │ │ - return results;
│ │ │ │ -function select( selector, context, results, seed ) {
│ │ │ │ - var i, tokens, token, type, find,
│ │ │ │ - match = tokenize( selector );
│ │ │ │ - if ( !seed ) {
│ │ │ │ - // Try to minimize operations if there is 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;
│ │ │ │ - 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
│ │ │ │ - // Provide `match` to avoid retokenization if we modified the selector above
│ │ │ │ - compile( selector, match )(
│ │ │ │ - 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
│ │ │ │ -// 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 ( indexOf.call( qualifier, elem ) >= 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,
│ │ │ │ - len = this.length,
│ │ │ │ - ret = [],
│ │ │ │ - self = this;
│ │ │ │ - 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,
│ │ │ │ - // 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[0] === "<" && selector[ 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 ) {
│ │ │ │ - // 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 = [],
│ │ │ │ - truncate = until !== undefined;
│ │ │ │ - while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
│ │ │ │ - if ( elem.nodeType === 1 ) {
│ │ │ │ - if ( truncate && jQuery( elem ).is( until ) ) {
│ │ │ │ - break;
│ │ │ │ - matched.push( elem );
│ │ │ │ - return matched;
│ │ │ │ - sibling: function( n, elem ) {
│ │ │ │ - var matched = [];
│ │ │ │ - for ( ; n; n = n.nextSibling ) {
│ │ │ │ - if ( n.nodeType === 1 && n !== elem ) {
│ │ │ │ - matched.push( n );
│ │ │ │ - return matched;
│ │ │ │ -jQuery.fn.extend({
│ │ │ │ - has: function( target ) {
│ │ │ │ - var targets = jQuery( target, this ),
│ │ │ │ - l = targets.length;
│ │ │ │ - return this.filter(function() {
│ │ │ │ - var i = 0;
│ │ │ │ - for ( ; i < l; 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 ) :
│ │ │ │ - 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 indexOf.call( jQuery( elem ), this[ 0 ] );
│ │ │ │ - // Locate the position of the desired element
│ │ │ │ - return indexOf.call( this,
│ │ │ │ - // If it receives a jQuery object, the first element is used
│ │ │ │ - elem.jquery ? elem[ 0 ] : elem
│ │ │ │ - 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 ) {
│ │ │ │ - while ( (cur = cur[dir]) && 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 elem.contentDocument || jQuery.merge( [], elem.childNodes );
│ │ │ │ -}, function( name, fn ) {
│ │ │ │ - jQuery.fn[ name ] = function( until, selector ) {
│ │ │ │ - var matched = jQuery.map( this, fn, until );
│ │ │ │ - if ( name.slice( -5 ) !== "Until" ) {
│ │ │ │ - selector = until;
│ │ │ │ - if ( selector && typeof selector === "string" ) {
│ │ │ │ - matched = jQuery.filter( selector, matched );
│ │ │ │ - if ( this.length > 1 ) {
│ │ │ │ - // Remove duplicates
│ │ │ │ - if ( !guaranteedUnique[ name ] ) {
│ │ │ │ - jQuery.unique( matched );
│ │ │ │ - // Reverse order for parents* and prev-derivatives
│ │ │ │ - if ( rparentsprev.test( name ) ) {
│ │ │ │ - matched.reverse();
│ │ │ │ - return this.pushStack( matched );
│ │ │ │ -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 // Last fire value (for non-forgettable lists)
│ │ │ │ - memory,
│ │ │ │ - // Flag to know if list was already fired
│ │ │ │ - fired,
│ │ │ │ - // Flag to know if list is currently firing
│ │ │ │ - firing,
│ │ │ │ - // First callback to fire (used internally by add and fireWith)
│ │ │ │ - firingStart,
│ │ │ │ - // End of the loop when firing
│ │ │ │ - firingLength,
│ │ │ │ - // Index of currently firing callback (modified by remove if needed)
│ │ │ │ - firingIndex,
│ │ │ │ - // 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;
│ │ │ │ - // 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.trigger ) {
│ │ │ │ - jQuery( document ).trigger("ready").off("ready");
│ │ │ │ - * The ready event handler and self cleanup method
│ │ │ │ -function completed() {
│ │ │ │ - document.removeEventListener( "DOMContentLoaded", completed, false );
│ │ │ │ - window.removeEventListener( "load", completed, false );
│ │ │ │ - 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 );
│ │ │ │ - } else {
│ │ │ │ - // Use the handy event callback
│ │ │ │ - document.addEventListener( "DOMContentLoaded", completed, false );
│ │ │ │ - // A fallback to window.onload, that will always work
│ │ │ │ - window.addEventListener( "load", completed, false );
│ │ │ │ - return readyList.promise( obj );
│ │ │ │ -// Kick off the DOM ready check even if the user does not
│ │ │ │ -jQuery.ready.promise();
│ │ │ │ -// 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,
│ │ │ │ - len = 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 < len; i++ ) {
│ │ │ │ - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
│ │ │ │ - return chainable ?
│ │ │ │ - elems :
│ │ │ │ - // Gets
│ │ │ │ - bulk ?
│ │ │ │ - fn.call( elems ) :
│ │ │ │ - len ? fn( elems[0], key ) : emptyGet;
│ │ │ │ - * Determines whether an object can have data
│ │ │ │ -jQuery.acceptData = function( owner ) {
│ │ │ │ - // Accepts only:
│ │ │ │ - // - Node
│ │ │ │ - // - Node.ELEMENT_NODE
│ │ │ │ - // - Node.DOCUMENT_NODE
│ │ │ │ - // - Object
│ │ │ │ - // - Any
│ │ │ │ - /* jshint -W018 */
│ │ │ │ - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
│ │ │ │ -function Data() {
│ │ │ │ - // Support: Android < 4,
│ │ │ │ - // Old WebKit does not have Object.preventExtensions/freeze method,
│ │ │ │ - // return new empty object instead with no [[set]] accessor
│ │ │ │ - Object.defineProperty( this.cache = {}, 0, {
│ │ │ │ - get: function() {
│ │ │ │ - return {};
│ │ │ │ - this.expando = jQuery.expando + Math.random();
│ │ │ │ -Data.uid = 1;
│ │ │ │ -Data.accepts = jQuery.acceptData;
│ │ │ │ -Data.prototype = {
│ │ │ │ - key: function( owner ) {
│ │ │ │ - // We can accept data for non-element nodes in modern browsers,
│ │ │ │ - // but we should not, see #8335.
│ │ │ │ - // Always return the key for a frozen object.
│ │ │ │ - if ( !Data.accepts( owner ) ) {
│ │ │ │ - return 0;
│ │ │ │ - var descriptor = {},
│ │ │ │ - // Check if the owner object already has a cache key
│ │ │ │ - unlock = owner[ this.expando ];
│ │ │ │ - // If not, create one
│ │ │ │ - if ( !unlock ) {
│ │ │ │ - unlock = Data.uid++;
│ │ │ │ - // Secure it in a non-enumerable, non-writable property
│ │ │ │ - try {
│ │ │ │ - descriptor[ this.expando ] = { value: unlock };
│ │ │ │ - Object.defineProperties( owner, descriptor );
│ │ │ │ - // Support: Android < 4
│ │ │ │ - // Fallback to a less secure definition
│ │ │ │ - } catch ( e ) {
│ │ │ │ - descriptor[ this.expando ] = unlock;
│ │ │ │ - jQuery.extend( owner, descriptor );
│ │ │ │ - // Ensure the cache object
│ │ │ │ - if ( !this.cache[ unlock ] ) {
│ │ │ │ - this.cache[ unlock ] = {};
│ │ │ │ - return unlock;
│ │ │ │ - set: function( owner, data, value ) {
│ │ │ │ - var prop,
│ │ │ │ - // There may be an unlock assigned to this node,
│ │ │ │ - // if there is no entry for this "owner", create one inline
│ │ │ │ - // and set the unlock as though an owner entry had always existed
│ │ │ │ - unlock = this.key( owner ),
│ │ │ │ - cache = this.cache[ unlock ];
│ │ │ │ - // Handle: [ owner, key, value ] args
│ │ │ │ - if ( typeof data === "string" ) {
│ │ │ │ - cache[ data ] = value;
│ │ │ │ - // Handle: [ owner, { properties } ] args
│ │ │ │ - } else {
│ │ │ │ - // Fresh assignments by object are shallow copied
│ │ │ │ - if ( jQuery.isEmptyObject( cache ) ) {
│ │ │ │ - jQuery.extend( this.cache[ unlock ], data );
│ │ │ │ - // Otherwise, copy the properties one-by-one to the cache object
│ │ │ │ - } else {
│ │ │ │ - for ( prop in data ) {
│ │ │ │ - cache[ prop ] = data[ prop ];
│ │ │ │ - return cache;
│ │ │ │ - get: function( owner, key ) {
│ │ │ │ - // Either a valid cache is found, or will be created.
│ │ │ │ - // New caches will be created and the unlock returned,
│ │ │ │ - // allowing direct access to the newly created
│ │ │ │ - // empty data object. A valid owner object must be provided.
│ │ │ │ - var cache = this.cache[ this.key( owner ) ];
│ │ │ │ - return key === undefined ?
│ │ │ │ - cache : cache[ key ];
│ │ │ │ - access: function( owner, key, value ) {
│ │ │ │ - var stored;
│ │ │ │ - // In cases where either:
│ │ │ │ - // 1. No key was specified
│ │ │ │ - // 2. A string key was specified, but no value provided
│ │ │ │ - // Take the "read" path and allow the get method to determine
│ │ │ │ - // which value to return, respectively either:
│ │ │ │ - // 1. The entire cache object
│ │ │ │ - // 2. The data stored at the key
│ │ │ │ - if ( key === undefined ||
│ │ │ │ - ((key && typeof key === "string") && value === undefined) ) {
│ │ │ │ - stored = this.get( owner, key );
│ │ │ │ - return stored !== undefined ?
│ │ │ │ - stored : this.get( owner, jQuery.camelCase(key) );
│ │ │ │ - // [*]When the key is not a string, or both a key and value
│ │ │ │ - // are specified, set or extend (existing objects) with either:
│ │ │ │ - // 1. An object of properties
│ │ │ │ - // 2. A key and value
│ │ │ │ - this.set( owner, key, value );
│ │ │ │ - // Since the "set" path can have two possible entry points
│ │ │ │ - // return the expected data based on which path was taken[*]
│ │ │ │ - return value !== undefined ? value : key;
│ │ │ │ - remove: function( owner, key ) {
│ │ │ │ - var i, name, camel,
│ │ │ │ - unlock = this.key( owner ),
│ │ │ │ - cache = this.cache[ unlock ];
│ │ │ │ - if ( key === undefined ) {
│ │ │ │ - this.cache[ unlock ] = {};
│ │ │ │ - } else {
│ │ │ │ - // Support array or space separated string of keys
│ │ │ │ - if ( jQuery.isArray( key ) ) {
│ │ │ │ - // 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 = key.concat( key.map( jQuery.camelCase ) );
│ │ │ │ - } else {
│ │ │ │ - camel = jQuery.camelCase( key );
│ │ │ │ - // Try the string as a key before any manipulation
│ │ │ │ - if ( key in cache ) {
│ │ │ │ - name = [ key, camel ];
│ │ │ │ - } else {
│ │ │ │ - // If a key with the spaces exists, use it.
│ │ │ │ - // Otherwise, create an array by matching non-whitespace
│ │ │ │ - name = camel;
│ │ │ │ - name = name in cache ?
│ │ │ │ - [ name ] : ( name.match( rnotwhite ) || [] );
│ │ │ │ - i = name.length;
│ │ │ │ - while ( i-- ) {
│ │ │ │ - delete cache[ name[ i ] ];
│ │ │ │ - hasData: function( owner ) {
│ │ │ │ - return !jQuery.isEmptyObject(
│ │ │ │ - this.cache[ owner[ this.expando ] ] || {}
│ │ │ │ - discard: function( owner ) {
│ │ │ │ - if ( owner[ this.expando ] ) {
│ │ │ │ - delete this.cache[ owner[ this.expando ] ];
│ │ │ │ -var data_priv = new Data();
│ │ │ │ -var data_user = new Data();
│ │ │ │ - Implementation Summary
│ │ │ │ - 1. Enforce API surface and semantic compatibility with 1.9.x branch
│ │ │ │ - 2. Improve the module's maintainability by reducing the storage
│ │ │ │ - paths to a single mechanism.
│ │ │ │ - 3. Use the same single mechanism to support "private" and "user" data.
│ │ │ │ - 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
│ │ │ │ - 5. Avoid exposing implementation details on user objects (eg. expando properties)
│ │ │ │ - 6. Provide a clear path for implementation upgrade to WeakMap in 2014
│ │ │ │ -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
│ │ │ │ - rmultiDash = /([A-Z])/g;
│ │ │ │ -function dataAttr( elem, key, data ) {
│ │ │ │ - var name;
│ │ │ │ - // If nothing was found internally, try to fetch any
│ │ │ │ - // data from the HTML5 data-* attribute
│ │ │ │ - if ( data === undefined && elem.nodeType === 1 ) {
│ │ │ │ - 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
│ │ │ │ - data_user.set( elem, key, data );
│ │ │ │ - } else {
│ │ │ │ - data = undefined;
│ │ │ │ - return data;
│ │ │ │ -jQuery.extend({
│ │ │ │ - hasData: function( elem ) {
│ │ │ │ - return data_user.hasData( elem ) || data_priv.hasData( elem );
│ │ │ │ - data: function( elem, name, data ) {
│ │ │ │ - return data_user.access( elem, name, data );
│ │ │ │ - removeData: function( elem, name ) {
│ │ │ │ - data_user.remove( elem, name );
│ │ │ │ - // TODO: Now that all calls to _data and _removeData have been replaced
│ │ │ │ - // with direct calls to data_priv methods, these can be deprecated.
│ │ │ │ - _data: function( elem, name, data ) {
│ │ │ │ - return data_priv.access( elem, name, data );
│ │ │ │ - _removeData: function( elem, name ) {
│ │ │ │ - data_priv.remove( elem, name );
│ │ │ │ -jQuery.fn.extend({
│ │ │ │ - data: function( key, value ) {
│ │ │ │ - var i, name, data,
│ │ │ │ - elem = this[ 0 ],
│ │ │ │ - attrs = elem && elem.attributes;
│ │ │ │ - // Gets all values
│ │ │ │ - if ( key === undefined ) {
│ │ │ │ - if ( this.length ) {
│ │ │ │ - data = data_user.get( elem );
│ │ │ │ - if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
│ │ │ │ - i = attrs.length;
│ │ │ │ - while ( i-- ) {
│ │ │ │ - name = attrs[ i ].name;
│ │ │ │ - if ( name.indexOf( "data-" ) === 0 ) {
│ │ │ │ - name = jQuery.camelCase( name.slice(5) );
│ │ │ │ - dataAttr( elem, name, data[ name ] );
│ │ │ │ - data_priv.set( elem, "hasDataAttrs", true );
│ │ │ │ - return data;
│ │ │ │ - // Sets multiple values
│ │ │ │ - if ( typeof key === "object" ) {
│ │ │ │ - return this.each(function() {
│ │ │ │ - data_user.set( this, key );
│ │ │ │ - return access( this, function( value ) {
│ │ │ │ - var data,
│ │ │ │ - camelKey = jQuery.camelCase( key );
│ │ │ │ - // The calling jQuery object (element matches) is not empty
│ │ │ │ - // (and therefore has an element appears at this[ 0 ]) and the
│ │ │ │ - // `value` parameter was not undefined. An empty jQuery object
│ │ │ │ - // will result in `undefined` for elem = this[ 0 ] which will
│ │ │ │ - // throw an exception if an attempt to read a data cache is made.
│ │ │ │ - if ( elem && value === undefined ) {
│ │ │ │ - // Attempt to get data from the cache
│ │ │ │ - // with the key as-is
│ │ │ │ - data = data_user.get( elem, key );
│ │ │ │ - if ( data !== undefined ) {
│ │ │ │ - return data;
│ │ │ │ - // Attempt to get data from the cache
│ │ │ │ - // with the key camelized
│ │ │ │ - data = data_user.get( elem, camelKey );
│ │ │ │ - if ( data !== undefined ) {
│ │ │ │ - return data;
│ │ │ │ - // Attempt to "discover" the data in
│ │ │ │ - // HTML5 custom data-* attrs
│ │ │ │ - data = dataAttr( elem, camelKey, undefined );
│ │ │ │ - if ( data !== undefined ) {
│ │ │ │ - return data;
│ │ │ │ - // We tried really hard, but the data doesn't exist.
│ │ │ │ - return;
│ │ │ │ - // Set the data...
│ │ │ │ - this.each(function() {
│ │ │ │ - // First, attempt to store a copy or reference of any
│ │ │ │ - // data that might've been store with a camelCased key.
│ │ │ │ - var data = data_user.get( this, camelKey );
│ │ │ │ - // For HTML5 data-* attribute interop, we have to
│ │ │ │ - // store property names with dashes in a camelCase form.
│ │ │ │ - // This might not apply to all properties...*
│ │ │ │ - data_user.set( this, camelKey, value );
│ │ │ │ - // *... In the case of properties that might _actually_
│ │ │ │ - // have dashes, we need to also store a copy of that
│ │ │ │ - // unchanged property.
│ │ │ │ - if ( key.indexOf("-") !== -1 && data !== undefined ) {
│ │ │ │ - data_user.set( this, key, value );
│ │ │ │ - }, null, value, arguments.length > 1, null, true );
│ │ │ │ - removeData: function( key ) {
│ │ │ │ - return this.each(function() {
│ │ │ │ - data_user.remove( this, key );
│ │ │ │ -jQuery.extend({
│ │ │ │ - queue: function( elem, type, data ) {
│ │ │ │ - var queue;
│ │ │ │ - if ( elem ) {
│ │ │ │ - type = ( type || "fx" ) + "queue";
│ │ │ │ - queue = data_priv.get( elem, type );
│ │ │ │ - // Speed up dequeue by getting out quickly if this is just a lookup
│ │ │ │ - if ( data ) {
│ │ │ │ - if ( !queue || jQuery.isArray( data ) ) {
│ │ │ │ - queue = data_priv.access( 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 data_priv.get( elem, key ) || data_priv.access( elem, key, {
│ │ │ │ - empty: jQuery.Callbacks("once memory").add(function() {
│ │ │ │ - data_priv.remove( elem, [ type + "queue", 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 = data_priv.get( 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 );
│ │ │ │ -var rcheckableType = (/^(?:checkbox|radio)$/i);
│ │ │ │ -(function() {
│ │ │ │ - var fragment = document.createDocumentFragment(),
│ │ │ │ - div = fragment.appendChild( document.createElement( "div" ) );
│ │ │ │ - // #11217 - WebKit loses check when the name is after the checked attribute
│ │ │ │ - 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;
│ │ │ │ - // Make sure textarea (and checkbox) defaultValue is properly cloned
│ │ │ │ - // Support: IE9-IE11+
│ │ │ │ - div.innerHTML = "";
│ │ │ │ - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
│ │ │ │ -var strundefined = typeof undefined;
│ │ │ │ -support.focusinBubbles = "onfocusin" in window;
│ │ │ │ - rkeyEvent = /^key/,
│ │ │ │ - rmouseEvent = /^(?:mouse|contextmenu)|click/,
│ │ │ │ - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
│ │ │ │ - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
│ │ │ │ -function returnTrue() {
│ │ │ │ - return true;
│ │ │ │ -function returnFalse() {
│ │ │ │ - return false;
│ │ │ │ -function safeActiveElement() {
│ │ │ │ - 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 handleObjIn, eventHandle, tmp,
│ │ │ │ - events, t, handleObj,
│ │ │ │ - special, handlers, type, namespaces, origType,
│ │ │ │ - elemData = data_priv.get( 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 && jQuery.event.triggered !== e.type ?
│ │ │ │ - jQuery.event.dispatch.apply( elem, arguments ) : undefined;
│ │ │ │ - // 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 if the special events handler returns false
│ │ │ │ - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
│ │ │ │ - if ( elem.addEventListener ) {
│ │ │ │ - elem.addEventListener( type, eventHandle, false );
│ │ │ │ - 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;
│ │ │ │ - // Detach an event or set of events from an element
│ │ │ │ - remove: function( elem, types, handler, selector, mappedTypes ) {
│ │ │ │ - var j, origCount, tmp,
│ │ │ │ - events, t, handleObj,
│ │ │ │ - special, handlers, type, namespaces, origType,
│ │ │ │ - elemData = data_priv.hasData( elem ) && data_priv.get( 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;
│ │ │ │ - data_priv.remove( elem, "events" );
│ │ │ │ - trigger: function( event, data, elem, onlyHandlers ) {
│ │ │ │ - var i, cur, tmp, bubbleType, ontype, handle, special,
│ │ │ │ - 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 = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( 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.
│ │ │ │ - // Don't do default actions on window, that's where global variables be (#6170)
│ │ │ │ - if ( ontype && jQuery.isFunction( 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;
│ │ │ │ - elem[ type ]();
│ │ │ │ - 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, j, ret, matched, handleObj,
│ │ │ │ - handlerQueue = [],
│ │ │ │ - args = slice.call( arguments ),
│ │ │ │ - handlers = ( data_priv.get( 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 i, matches, sel, handleObj,
│ │ │ │ - handlerQueue = [],
│ │ │ │ - delegateCount = handlers.delegateCount,
│ │ │ │ - cur = event.target;
│ │ │ │ - // Find delegate handlers
│ │ │ │ - // Black-hole SVG