wp/wp-includes/js/jquery/ui/slider.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 /*!
     1 /*!
     2  * jQuery UI Slider 1.12.1
     2  * jQuery UI Slider 1.13.1
     3  * http://jqueryui.com
     3  * http://jqueryui.com
     4  *
     4  *
     5  * Copyright jQuery Foundation and other contributors
     5  * Copyright jQuery Foundation and other contributors
     6  * Released under the MIT license.
     6  * Released under the MIT license.
     7  * http://jquery.org/license
     7  * http://jquery.org/license
    15 //>>css.structure: ../../themes/base/core.css
    15 //>>css.structure: ../../themes/base/core.css
    16 //>>css.structure: ../../themes/base/slider.css
    16 //>>css.structure: ../../themes/base/slider.css
    17 //>>css.theme: ../../themes/base/theme.css
    17 //>>css.theme: ../../themes/base/theme.css
    18 
    18 
    19 ( function( factory ) {
    19 ( function( factory ) {
       
    20 	"use strict";
       
    21 
    20 	if ( typeof define === "function" && define.amd ) {
    22 	if ( typeof define === "function" && define.amd ) {
    21 
    23 
    22 		// AMD. Register as an anonymous module.
    24 		// AMD. Register as an anonymous module.
    23 		define( [
    25 		define( [
    24 			"jquery",
    26 			"jquery",
    28 	} else {
    30 	} else {
    29 
    31 
    30 		// Browser globals
    32 		// Browser globals
    31 		factory( jQuery );
    33 		factory( jQuery );
    32 	}
    34 	}
    33 }( function( $ ) {
    35 } )( function( $ ) {
       
    36 "use strict";
    34 
    37 
    35 return $.widget( "ui.slider", $.ui.mouse, {
    38 return $.widget( "ui.slider", $.ui.mouse, {
    36 	version: "1.12.1",
    39 	version: "1.13.1",
    37 	widgetEventPrefix: "slide",
    40 	widgetEventPrefix: "slide",
    38 
    41 
    39 	options: {
    42 	options: {
    40 		animate: false,
    43 		animate: false,
    41 		classes: {
    44 		classes: {
   128 			if ( options.range === true ) {
   131 			if ( options.range === true ) {
   129 				if ( !options.values ) {
   132 				if ( !options.values ) {
   130 					options.values = [ this._valueMin(), this._valueMin() ];
   133 					options.values = [ this._valueMin(), this._valueMin() ];
   131 				} else if ( options.values.length && options.values.length !== 2 ) {
   134 				} else if ( options.values.length && options.values.length !== 2 ) {
   132 					options.values = [ options.values[ 0 ], options.values[ 0 ] ];
   135 					options.values = [ options.values[ 0 ], options.values[ 0 ] ];
   133 				} else if ( $.isArray( options.values ) ) {
   136 				} else if ( Array.isArray( options.values ) ) {
   134 					options.values = options.values.slice( 0 );
   137 					options.values = options.values.slice( 0 );
   135 				}
   138 				}
   136 			}
   139 			}
   137 
   140 
   138 			if ( !this.range || !this.range.length ) {
   141 			if ( !this.range || !this.range.length ) {
   391 			this._change( null, index );
   394 			this._change( null, index );
   392 			return;
   395 			return;
   393 		}
   396 		}
   394 
   397 
   395 		if ( arguments.length ) {
   398 		if ( arguments.length ) {
   396 			if ( $.isArray( arguments[ 0 ] ) ) {
   399 			if ( Array.isArray( arguments[ 0 ] ) ) {
   397 				vals = this.options.values;
   400 				vals = this.options.values;
   398 				newValues = arguments[ 0 ];
   401 				newValues = arguments[ 0 ];
   399 				for ( i = 0; i < vals.length; i += 1 ) {
   402 				for ( i = 0; i < vals.length; i += 1 ) {
   400 					vals[ i ] = this._trimAlignValue( newValues[ i ] );
   403 					vals[ i ] = this._trimAlignValue( newValues[ i ] );
   401 					this._change( null, i );
   404 					this._change( null, i );
   425 				this.options.value = this._values( this.options.values.length - 1 );
   428 				this.options.value = this._values( this.options.values.length - 1 );
   426 				this.options.values = null;
   429 				this.options.values = null;
   427 			}
   430 			}
   428 		}
   431 		}
   429 
   432 
   430 		if ( $.isArray( this.options.values ) ) {
   433 		if ( Array.isArray( this.options.values ) ) {
   431 			valsLength = this.options.values.length;
   434 			valsLength = this.options.values.length;
   432 		}
   435 		}
   433 
   436 
   434 		this._super( key, value );
   437 		this._super( key, value );
   435 
   438 
   637 		} else {
   640 		} else {
   638 			value = this.value();
   641 			value = this.value();
   639 			valueMin = this._valueMin();
   642 			valueMin = this._valueMin();
   640 			valueMax = this._valueMax();
   643 			valueMax = this._valueMax();
   641 			valPercent = ( valueMax !== valueMin ) ?
   644 			valPercent = ( valueMax !== valueMin ) ?
   642 					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
   645 				( value - valueMin ) / ( valueMax - valueMin ) * 100 :
   643 					0;
   646 				0;
   644 			_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
   647 			_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
   645 			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
   648 			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
   646 
   649 
   647 			if ( oRange === "min" && this.orientation === "horizontal" ) {
   650 			if ( oRange === "min" && this.orientation === "horizontal" ) {
   648 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
   651 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
   745 			}
   748 			}
   746 		}
   749 		}
   747 	}
   750 	}
   748 } );
   751 } );
   749 
   752 
   750 } ) );
   753 } );