vendor: 6,512 bytes, lines 1-260
1/*! jQuery UI - v1.11.4 - 2016-01-01 2* http://jqueryui.com 3* Includes: core.js, widget.js, mouse.js, slider.js 4* Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 6(function( factory ) { 7 if ( typeof define === "function" && define.amd ) { 8 9 // AMD. Register as an anonymous module. 10 define([ "jquery" ], factory ); 11 } else { 12 13 // Browser globals 14 factory( jQuery ); 15 } 16}(function( $ ) { 17/*! 18 * jQuery UI Core 1.11.4 19 * http://jqueryui.com 20 * 21 * Copyright jQuery Foundation and other contributors 22 * Released under the MIT license. 23 * http://jquery.org/license 24 * 25 * http://api.jqueryui.com/category/ui-core/ 26 */ 27 28 29// $.ui might exist from components with no dependencies, e.g., $.ui.position 30$.ui = $.ui || {}; 31 32$.extend( $.ui, { 33 version: "1.11.4", 34 35 keyCode: { 36 BACKSPACE: 8, 37 COMMA: 188, 38 DELETE: 46, 39 DOWN: 40, 40 END: 35, 41 ENTER: 13, 42 ESCAPE: 27, 43 HOME: 36, 44 LEFT: 37, 45 PAGE_DOWN: 34, 46 PAGE_UP: 33, 47 PERIOD: 190, 48 RIGHT: 39, 49 SPACE: 32, 50 TAB: 9, 51 UP: 38 52 } 53}); 54 55// plugins 56$.fn.extend({ 57 scrollParent: function( includeHidden ) { 58 var position = this.css( "position" ), 59 excludeStaticParent = position === "absolute", 60 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 61 scrollParent = this.parents().filter( function() { 62 var parent = $( this ); 63 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 64 return false; 65 } 66 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); 67 }).eq( 0 ); 68 69 return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; 70 }, 71 72 uniqueId: (function() { 73 var uuid = 0; 74 75 return function() { 76 return this.each(function() { 77 if ( !this.id ) { 78 this.id = "ui-id-" + ( ++uuid ); 79 } 80 }); 81 }; 82 })(), 83 84 removeUniqueId: function() { 85 return this.each(function() { 86 if ( /^ui-id-\d+$/.test( this.id ) ) { 87 $( this ).removeAttr( "id" ); 88 } 89 }); 90 } 91}); 92 93// selectors 94function focusable( element, isTabIndexNotNaN ) { 95 var map, mapName, img, 96 nodeName = element.nodeName.toLowerCase(); 97 if ( "area" === nodeName ) { 98 map = element.parentNode; 99 mapName = map.name; 100 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 101 return false; 102 } 103 img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; 104 return !!img && visible( img ); 105 } 106 return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ? 107 !element.disabled : 108 "a" === nodeName ? 109 element.href || isTabIndexNotNaN : 110 isTabIndexNotNaN) && 111 // the element and all of its ancestors must be visible 112 visible( element ); 113} 114 115function visible( element ) { 116 return $.expr.filters.visible( element ) && 117 !$( element ).parents().addBack().filter(function() { 118 return $.css( this, "visibility" ) === "hidden"; 119 }).length; 120} 121 122$.extend( $.expr[ ":" ], { 123 data: $.expr.createPseudo ? 124 $.expr.createPseudo(function( dataName ) { 125 return function( elem ) { 126 return !!$.data( elem, dataName ); 127 }; 128 }) : 129 // support: jQuery <1.8 130 function( elem, i, match ) { 131 return !!$.data( elem, match[ 3 ] ); 132 }, 133 134 focusable: function( element ) { 135 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 136 }, 137 138 tabbable: function( element ) { 139 var tabIndex = $.attr( element, "tabindex" ), 140 isTabIndexNaN = isNaN( tabIndex ); 141 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 142 } 143}); 144 145// support: jQuery <1.8 146if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { 147 $.each( [ "Width", "Height" ], function( i, name ) { 148 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 149 type = name.toLowerCase(), 150 orig = { 151 innerWidth: $.fn.innerWidth, 152 innerHeight: $.fn.innerHeight, 153 outerWidth: $.fn.outerWidth, 154 outerHeight: $.fn.outerHeight 155 }; 156 157 function reduce( elem, size, border, margin ) { 158 $.each( side, function() { 159 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 160 if ( border ) { 161 size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 162 } 163 if ( margin ) { 164 size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 165 } 166 }); 167 return size; 168 } 169 170 $.fn[ "inner" + name ] = function( size ) { 171 if ( size === undefined ) { 172 return orig[ "inner" + name ].call( this ); 173 } 174 175 return this.each(function() { 176 $( this ).css( type, reduce( this, size ) + "px" ); 177 }); 178 }; 179 180 $.fn[ "outer" + name] = function( size, margin ) { 181 if ( typeof size !== "number" ) { 182 return orig[ "outer" + name ].call( this, size ); 183 } 184 185 return this.each(function() { 186 $( this).css( type, reduce( this, size, true, margin ) + "px" ); 187 }); 188 }; 189 }); 190} 191 192// support: jQuery <1.8 193if ( !$.fn.addBack ) { 194 $.fn.addBack = function( selector ) { 195 return this.add( selector == null ? 196 this.prevObject : this.prevObject.filter( selector ) 197 ); 198 }; 199} 200 201// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 202if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { 203 $.fn.removeData = (function( removeData ) { 204 return function( key ) { 205 if ( arguments.length ) { 206 return removeData.call( this, $.camelCase( key ) ); 207 } else { 208 return removeData.call( this ); 209 } 210 }; 211 })( $.fn.removeData ); 212} 213 214// deprecated 215$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 216 217$.fn.extend({ 218 focus: (function( orig ) { 219 return function( delay, fn ) { 220 return typeof delay === "number" ? 221 this.each(function() { 222 var elem = this; 223 setTimeout(function() { 224 $( elem ).focus(); 225 if ( fn ) { 226 fn.call( elem ); 227 } 228 }, delay ); 229 }) : 230 orig.apply( this, arguments ); 231 }; 232 })( $.fn.focus ), 233 234 disableSelection: (function() { 235 var eventType = "onselectstart" in document.createElement( "div" ) ? 236 "selectstart" : 237 "mousedown"; 238 239 return function() { 240 return this.bind( eventType + ".ui-disableSelection", function( event ) { 241 event.preventDefault(); 242 }); 243 }; 244 })(), 245 246 enableSelection: function() { 247 return this.unbind( ".ui-disableSelection" ); 248 }, 249 250 zIndex: function( zIndex ) { 251 if ( zIndex !== undefined ) { 252 return this.css( "zIndex", zIndex ); 253 } 254 255 if ( this.length ) { 256 var elem = $( this[ 0 ] ), position, value; 257 while ( elem.length && elem[ 0 ] !== document ) { 258 // Ignore z-index if position is set to a value where z-index is ignored by the browser 259 // This makes behavior of this function consistent across browsers 260 // Wink
vendor: 40,946 bytes, lines 260-1746
260it always returns auto if the element is positioned 261 position = elem.css( "position" ); 262 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 263 // IE returns 0 when zIndex is not specified 264 // other browsers return a string 265 // we ignore the case of nested elements with an explicit value of 0 266 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 267 value = parseInt( elem.css( "zIndex" ), 10 ); 268 if ( !isNaN( value ) && value !== 0 ) { 269 return value; 270 } 271 } 272 elem = elem.parent(); 273 } 274 } 275 276 return 0; 277 } 278}); 279 280// $.ui.plugin is deprecated. Use $.widget() extensions instead. 281$.ui.plugin = { 282 add: function( module, option, set ) { 283 var i, 284 proto = $.ui[ module ].prototype; 285 for ( i in set ) { 286 proto.plugins[ i ] = proto.plugins[ i ] || []; 287 proto.plugins[ i ].push( [ option, set[ i ] ] ); 288 } 289 }, 290 call: function( instance, name, args, allowDisconnected ) { 291 var i, 292 set = instance.plugins[ name ]; 293 294 if ( !set ) { 295 return; 296 } 297 298 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 299 return; 300 } 301 302 for ( i = 0; i < set.length; i++ ) { 303 if ( instance.options[ set[ i ][ 0 ] ] ) { 304 set[ i ][ 1 ].apply( instance.element, args ); 305 } 306 } 307 } 308}; 309 310 311/*! 312 * jQuery UI Widget 1.11.4 313 * http://jqueryui.com 314 * 315 * Copyright jQuery Foundation and other contributors 316 * Released under the MIT license. 317 * http://jquery.org/license 318 * 319 * http://api.jqueryui.com/jQuery.widget/ 320 */ 321 322 323var widget_uuid = 0, 324 widget_slice = Array.prototype.slice; 325 326$.cleanData = (function( orig ) { 327 return function( elems ) { 328 var events, elem, i; 329 for ( i = 0; (elem = elems[i]) != null; i++ ) { 330 try { 331 332 // Only trigger remove when necessary to save time 333 events = $._data( elem, "events" ); 334 if ( events && events.remove ) { 335 $( elem ).triggerHandler( "remove" ); 336 } 337 338 // http://bugs.jquery.com/ticket/8235 339 } catch ( e ) {} 340 } 341 orig( elems ); 342 }; 343})( $.cleanData ); 344 345$.widget = function( name, base, prototype ) { 346 var fullName, existingConstructor, constructor, basePrototype, 347 // proxiedPrototype allows the provided prototype to remain unmodified 348 // so that it can be used as a mixin for multiple widgets (#8876) 349 proxiedPrototype = {}, 350 namespace = name.split( "." )[ 0 ]; 351 352 name = name.split( "." )[ 1 ]; 353 fullName = namespace + "-" + name; 354 355 if ( !prototype ) { 356 prototype = base; 357 base = $.Widget; 358 } 359 360 // create selector for plugin 361 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 362 return !!$.data( elem, fullName ); 363 }; 364 365 $[ namespace ] = $[ namespace ] || {}; 366 existingConstructor = $[ namespace ][ name ]; 367 constructor = $[ namespace ][ name ] = function( options, element ) { 368 // allow instantiation without "new" keyword 369 if ( !this._createWidget ) { 370 return new constructor( options, element ); 371 } 372 373 // allow instantiation without initializing for simple inheritance 374 // must use "new" keyword (the code above always passes args) 375 if ( arguments.length ) { 376 this._createWidget( options, element ); 377 } 378 }; 379 // extend with the existing constructor to carry over any static properties 380 $.extend( constructor, existingConstructor, { 381 version: prototype.version, 382 // copy the object used to create the prototype in case we need to 383 // redefine the widget later 384 _proto: $.extend( {}, prototype ), 385 // track widgets that inherit from this widget in case this widget is 386 // redefined after a widget inherits from it 387 _childConstructors: [] 388 }); 389 390 basePrototype = new base(); 391 // we need to make the options hash a property directly on the new instance 392 // otherwise we'll modify the options hash on the prototype that we're 393 // inheriting from 394 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 395 $.each( prototype, function( prop, value ) { 396 if ( !$.isFunction( value ) ) { 397 proxiedPrototype[ prop ] = value; 398 return; 399 } 400 proxiedPrototype[ prop ] = (function() { 401 var _super = function() { 402 return base.prototype[ prop ].apply( this, arguments ); 403 }, 404 _superApply = function( args ) { 405 return base.prototype[ prop ].apply( this, args ); 406 }; 407 return function() { 408 var __super = this._super, 409 __superApply = this._superApply, 410 returnValue; 411 412 this._super = _super; 413 this._superApply = _superApply; 414 415 returnValue = value.apply( this, arguments ); 416 417 this._super = __super; 418 this._superApply = __superApply; 419 420 return returnValue; 421 }; 422 })(); 423 }); 424 constructor.prototype = $.widget.extend( basePrototype, { 425 // TODO: remove support for widgetEventPrefix 426 // always use the name + a colon as the prefix, e.g., draggable:start 427 // don't prefix for widgets that aren't DOM-based 428 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 429 }, proxiedPrototype, { 430 constructor: constructor, 431 namespace: namespace, 432 widgetName: name, 433 widgetFullName: fullName 434 }); 435 436 // If this widget is being redefined then we need to find all widgets that 437 // are inheriting from it and redefine all of them so that they inherit from 438 // the new version of this widget. We're essentially trying to replace one 439 // level in the prototype chain. 440 if ( existingConstructor ) { 441 $.each( existingConstructor._childConstructors, function( i, child ) { 442 var childPrototype = child.prototype; 443 444 // redefine the child widget using the same prototype that was 445 // originally used, but inherit from the new version of the base 446 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 447 }); 448 // remove the list of existing child constructors from the old constructor 449 // so the old child constructors can be garbage collected 450 delete existingConstructor._childConstructors; 451 } else { 452 base._childConstructors.push( constructor ); 453 } 454 455 $.widget.bridge( name, constructor ); 456 457 return constructor; 458}; 459 460$.widget.extend = function( target ) { 461 var input = widget_slice.call( arguments, 1 ), 462 inputIndex = 0, 463 inputLength = input.length, 464 key, 465 value; 466 for ( ; inputIndex < inputLength; inputIndex++ ) { 467 for ( key in input[ inputIndex ] ) { 468 value = input[ inputIndex ][ key ]; 469 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 470 // Clone objects 471 if ( $.isPlainObject( value ) ) { 472 target[ key ] = $.isPlainObject( target[ key ] ) ? 473 $.widget.extend( {}, target[ key ], value ) : 474 // Don't extend strings, arrays, etc. with objects 475 $.widget.extend( {}, value ); 476 // Copy everything else by reference 477 } else { 478 target[ key ] = value; 479 } 480 } 481 } 482 } 483 return target; 484}; 485 486$.widget.bridge = function( name, object ) { 487 var fullName = object.prototype.widgetFullName || name; 488 $.fn[ name ] = function( options ) { 489 var isMethodCall = typeof options === "string", 490 args = widget_slice.call( arguments, 1 ), 491 returnValue = this; 492 493 if ( isMethodCall ) { 494 this.each(function() { 495 var methodValue, 496 instance = $.data( this, fullName ); 497 if ( options === "instance" ) { 498 returnValue = instance; 499 return false; 500 } 501 if ( !instance ) { 502 return $.error( "cannot call methods on " + name + " prior to initialization; " + 503 "attempted to call method '" + options + "'" ); 504 } 505 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 506 return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 507 } 508 methodValue = instance[ options ].apply( instance, args ); 509 if ( methodValue !== instance && methodValue !== undefined ) { 510 returnValue = methodValue && methodValue.jquery ? 511 returnValue.pushStack( methodValue.get() ) : 512 methodValue; 513 return false; 514 } 515 }); 516 } else { 517 518 // Allow multiple hashes to be passed on init 519 if ( args.length ) { 520 options = $.widget.extend.apply( null, [ options ].concat(args) ); 521 } 522 523 this.each(function() { 524 var instance = $.data( this, fullName ); 525 if ( instance ) { 526 instance.option( options || {} ); 527 if ( instance._init ) { 528 instance._init(); 529 } 530 } else { 531 $.data( this, fullName, new object( options, this ) ); 532 } 533 }); 534 } 535 536 return returnValue; 537 }; 538}; 539 540$.Widget = function( /* options, element */ ) {}; 541$.Widget._childConstructors = []; 542 543$.Widget.prototype = { 544 widgetName: "widget", 545 widgetEventPrefix: "", 546 defaultElement: "<div>", 547 options: { 548 disabled: false, 549 550 // callbacks 551 create: null 552 }, 553 _createWidget: function( options, element ) { 554 element = $( element || this.defaultElement || this )[ 0 ]; 555 this.element = $( element ); 556 this.uuid = widget_uuid++; 557 this.eventNamespace = "." + this.widgetName + this.uuid; 558 559 this.bindings = $(); 560 this.hoverable = $(); 561 this.focusable = $(); 562 563 if ( element !== this ) { 564 $.data( element, this.widgetFullName, this ); 565 this._on( true, this.element, { 566 remove: function( event ) { 567 if ( event.target === element ) { 568 this.destroy(); 569 } 570 } 571 }); 572 this.document = $( element.style ? 573 // element within the document 574 element.ownerDocument : 575 // element is window or document 576 element.document || element ); 577 this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 578 } 579 580 this.options = $.widget.extend( {}, 581 this.options, 582 this._getCreateOptions(), 583 options ); 584 585 this._create(); 586 this._trigger( "create", null, this._getCreateEventData() ); 587 this._init(); 588 }, 589 _getCreateOptions: $.noop, 590 _getCreateEventData: $.noop, 591 _create: $.noop, 592 _init: $.noop, 593 594 destroy: function() { 595 this._destroy(); 596 // we can probably remove the unbind calls in 2.0 597 // all event bindings should go through this._on() 598 this.element 599 .unbind( this.eventNamespace ) 600 .removeData( this.widgetFullName ) 601 // support: jquery <1.6.3 602 // http://bugs.jquery.com/ticket/9413 603 .removeData( $.camelCase( this.widgetFullName ) ); 604 this.widget() 605 .unbind( this.eventNamespace ) 606 .removeAttr( "aria-disabled" ) 607 .removeClass( 608 this.widgetFullName + "-disabled " + 609 "ui-state-disabled" ); 610 611 // clean up events and states 612 this.bindings.unbind( this.eventNamespace ); 613 this.hoverable.removeClass( "ui-state-hover" ); 614 this.focusable.removeClass( "ui-state-focus" ); 615 }, 616 _destroy: $.noop, 617 618 widget: function() { 619 return this.element; 620 }, 621 622 option: function( key, value ) { 623 var options = key, 624 parts, 625 curOption, 626 i; 627 628 if ( arguments.length === 0 ) { 629 // don't return a reference to the internal hash 630 return $.widget.extend( {}, this.options ); 631 } 632 633 if ( typeof key === "string" ) { 634 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 635 options = {}; 636 parts = key.split( "." ); 637 key = parts.shift(); 638 if ( parts.length ) { 639 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 640 for ( i = 0; i < parts.length - 1; i++ ) { 641 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 642 curOption = curOption[ parts[ i ] ]; 643 } 644 key = parts.pop(); 645 if ( arguments.length === 1 ) { 646 return curOption[ key ] === undefined ? null : curOption[ key ]; 647 } 648 curOption[ key ] = value; 649 } else { 650 if ( arguments.length === 1 ) { 651 return this.options[ key ] === undefined ? null : this.options[ key ]; 652 } 653 options[ key ] = value; 654 } 655 } 656 657 this._setOptions( options ); 658 659 return this; 660 }, 661 _setOptions: function( options ) { 662 var key; 663 664 for ( key in options ) { 665 this._setOption( key, options[ key ] ); 666 } 667 668 return this; 669 }, 670 _setOption: function( key, value ) { 671 this.options[ key ] = value; 672 673 if ( key === "disabled" ) { 674 this.widget() 675 .toggleClass( this.widgetFullName + "-disabled", !!value ); 676 677 // If the widget is becoming disabled, then nothing is interactive 678 if ( value ) { 679 this.hoverable.removeClass( "ui-state-hover" ); 680 this.focusable.removeClass( "ui-state-focus" ); 681 } 682 } 683 684 return this; 685 }, 686 687 enable: function() { 688 return this._setOptions({ disabled: false }); 689 }, 690 disable: function() { 691 return this._setOptions({ disabled: true }); 692 }, 693 694 _on: function( suppressDisabledCheck, element, handlers ) { 695 var delegateElement, 696 instance = this; 697 698 // no suppressDisabledCheck flag, shuffle arguments 699 if ( typeof suppressDisabledCheck !== "boolean" ) { 700 handlers = element; 701 element = suppressDisabledCheck; 702 suppressDisabledCheck = false; 703 } 704 705 // no element argument, shuffle and use this.element 706 if ( !handlers ) { 707 handlers = element; 708 element = this.element; 709 delegateElement = this.widget(); 710 } else { 711 element = delegateElement = $( element ); 712 this.bindings = this.bindings.add( element ); 713 } 714 715 $.each( handlers, function( event, handler ) { 716 function handlerProxy() { 717 // allow widgets to customize the disabled handling 718 // - disabled as an array instead of boolean 719 // - disabled class as method for disabling individual parts 720 if ( !suppressDisabledCheck && 721 ( instance.options.disabled === true || 722 $( this ).hasClass( "ui-state-disabled" ) ) ) { 723 return; 724 } 725 return ( typeof handler === "string" ? instance[ handler ] : handler ) 726 .apply( instance, arguments ); 727 } 728 729 // copy the guid so direct unbinding works 730 if ( typeof handler !== "string" ) { 731 handlerProxy.guid = handler.guid = 732 handler.guid || handlerProxy.guid || $.guid++; 733 } 734 735 var match = event.match( /^([\w:-]*)\s*(.*)$/ ), 736 eventName = match[1] + instance.eventNamespace, 737 selector = match[2]; 738 if ( selector ) { 739 delegateElement.delegate( selector, eventName, handlerProxy ); 740 } else { 741 element.bind( eventName, handlerProxy ); 742 } 743 }); 744 }, 745 746 _off: function( element, eventName ) { 747 eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + 748 this.eventNamespace; 749 element.unbind( eventName ).undelegate( eventName ); 750 751 // Clear the stack to avoid memory leaks (#10056) 752 this.bindings = $( this.bindings.not( element ).get() ); 753 this.focusable = $( this.focusable.not( element ).get() ); 754 this.hoverable = $( this.hoverable.not( element ).get() ); 755 }, 756 757 _delay: function( handler, delay ) { 758 function handlerProxy() { 759 return ( typeof handler === "string" ? instance[ handler ] : handler ) 760 .apply( instance, arguments ); 761 } 762 var instance = this; 763 return setTimeout( handlerProxy, delay || 0 ); 764 }, 765 766 _hoverable: function( element ) { 767 this.hoverable = this.hoverable.add( element ); 768 this._on( element, { 769 mouseenter: function( event ) { 770 $( event.currentTarget ).addClass( "ui-state-hover" ); 771 }, 772 mouseleave: function( event ) { 773 $( event.currentTarget ).removeClass( "ui-state-hover" ); 774 } 775 }); 776 }, 777 778 _focusable: function( element ) { 779 this.focusable = this.focusable.add( element ); 780 this._on( element, { 781 focusin: function( event ) { 782 $( event.currentTarget ).addClass( "ui-state-focus" ); 783 }, 784 focusout: function( event ) { 785 $( event.currentTarget ).removeClass( "ui-state-focus" ); 786 } 787 }); 788 }, 789 790 _trigger: function( type, event, data ) { 791 var prop, orig, 792 callback = this.options[ type ]; 793 794 data = data || {}; 795 event = $.Event( event ); 796 event.type = ( type === this.widgetEventPrefix ? 797 type : 798 this.widgetEventPrefix + type ).toLowerCase(); 799 // the original event may come from any element 800 // so we need to reset the target on the new event 801 event.target = this.element[ 0 ]; 802 803 // copy original event properties over to the new event 804 orig = event.originalEvent; 805 if ( orig ) { 806 for ( prop in orig ) { 807 if ( !( prop in event ) ) { 808 event[ prop ] = orig[ prop ]; 809 } 810 } 811 } 812 813 this.element.trigger( event, data ); 814 return !( $.isFunction( callback ) && 815 callback.apply( this.element[0], [ event ].concat( data ) ) === false || 816 event.isDefaultPrevented() ); 817 } 818}; 819 820$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 821 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 822 if ( typeof options === "string" ) { 823 options = { effect: options }; 824 } 825 var hasOptions, 826 effectName = !options ? 827 method : 828 options === true || typeof options === "number" ? 829 defaultEffect : 830 options.effect || defaultEffect; 831 options = options || {}; 832 if ( typeof options === "number" ) { 833 options = { duration: options }; 834 } 835 hasOptions = !$.isEmptyObject( options ); 836 options.complete = callback; 837 if ( options.delay ) { 838 element.delay( options.delay ); 839 } 840 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 841 element[ method ]( options ); 842 } else if ( effectName !== method && element[ effectName ] ) { 843 element[ effectName ]( options.duration, options.easing, callback ); 844 } else { 845 element.queue(function( next ) { 846 $( this )[ method ](); 847 if ( callback ) { 848 callback.call( element[ 0 ] ); 849 } 850 next(); 851 }); 852 } 853 }; 854}); 855 856var widget = $.widget; 857 858 859/*! 860 * jQuery UI Mouse 1.11.4 861 * http://jqueryui.com 862 * 863 * Copyright jQuery Foundation and other contributors 864 * Released under the MIT license. 865 * http://jquery.org/license 866 * 867 * http://api.jqueryui.com/mouse/ 868 */ 869 870 871var mouseHandled = false; 872$( document ).mouseup( function() { 873 mouseHandled = false; 874}); 875 876var mouse = $.widget("ui.mouse", { 877 version: "1.11.4", 878 options: { 879 cancel: "input,textarea,button,select,option", 880 distance: 1, 881 delay: 0 882 }, 883 _mouseInit: function() { 884 var that = this; 885 886 this.element 887 .bind("mousedown." + this.widgetName, function(event) { 888 return that._mouseDown(event); 889 }) 890 .bind("click." + this.widgetName, function(event) { 891 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 892 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 893 event.stopImmediatePropagation(); 894 return false; 895 } 896 }); 897 898 this.started = false; 899 }, 900 901 // TODO: make sure destroying one instance of mouse doesn't mess with 902 // other instances of mouse 903 _mouseDestroy: function() { 904 this.element.unbind("." + this.widgetName); 905 if ( this._mouseMoveDelegate ) { 906 this.document 907 .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) 908 .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); 909 } 910 }, 911 912 _mouseDown: function(event) { 913 // don't let more than one widget handle mouseStart 914 if ( mouseHandled ) { 915 return; 916 } 917 918 this._mouseMoved = false; 919 920 // we may have missed mouseup (out of window) 921 (this._mouseStarted && this._mouseUp(event)); 922 923 this._mouseDownEvent = event; 924 925 var that = this, 926 btnIsLeft = (event.which === 1), 927 // event.target.nodeName works around a bug in IE 8 with 928 // disabled inputs (#7620) 929 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); 930 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 931 return true; 932 } 933 934 this.mouseDelayMet = !this.options.delay; 935 if (!this.mouseDelayMet) { 936 this._mouseDelayTimer = setTimeout(function() { 937 that.mouseDelayMet = true; 938 }, this.options.delay); 939 } 940 941 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 942 this._mouseStarted = (this._mouseStart(event) !== false); 943 if (!this._mouseStarted) { 944 event.preventDefault(); 945 return true; 946 } 947 } 948 949 // Click event may never have fired (Gecko & Opera) 950 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 951 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 952 } 953 954 // these delegates are required to keep context 955 this._mouseMoveDelegate = function(event) { 956 return that._mouseMove(event); 957 }; 958 this._mouseUpDelegate = function(event) { 959 return that._mouseUp(event); 960 }; 961 962 this.document 963 .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 964 .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); 965 966 event.preventDefault(); 967 968 mouseHandled = true; 969 return true; 970 }, 971 972 _mouseMove: function(event) { 973 // Only check for mouseups outside the document if you've moved inside the document 974 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 975 // fire a mousemove event if content is placed under the cursor. See #7778 976 // Support: IE <9 977 if ( this._mouseMoved ) { 978 // IE mouseup check - mouseup happened when mouse was out of window 979 if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { 980 return this._mouseUp(event); 981 982 // Iframe mouseup check - mouseup occurred in another document 983 } else if ( !event.which ) { 984 return this._mouseUp( event ); 985 } 986 } 987 988 if ( event.which || event.button ) { 989 this._mouseMoved = true; 990 } 991 992 if (this._mouseStarted) { 993 this._mouseDrag(event); 994 return event.preventDefault(); 995 } 996 997 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 998 this._mouseStarted = 999 (this._mouseStart(this._mouseDownEvent, event) !== false); 1000 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 1001 } 1002 1003 return !this._mouseStarted; 1004 }, 1005 1006 _mouseUp: function(event) { 1007 this.document 1008 .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1009 .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1010 1011 if (this._mouseStarted) { 1012 this._mouseStarted = false; 1013 1014 if (event.target === this._mouseDownEvent.target) { 1015 $.data(event.target, this.widgetName + ".preventClickEvent", true); 1016 } 1017 1018 this._mouseStop(event); 1019 } 1020 1021 mouseHandled = false; 1022 return false; 1023 }, 1024 1025 _mouseDistanceMet: function(event) { 1026 return (Math.max( 1027 Math.abs(this._mouseDownEvent.pageX - event.pageX), 1028 Math.abs(this._mouseDownEvent.pageY - event.pageY) 1029 ) >= this.options.distance 1030 ); 1031 }, 1032 1033 _mouseDelayMet: function(/* event */) { 1034 return this.mouseDelayMet; 1035 }, 1036 1037 // These are placeholder methods, to be overriden by extending plugin 1038 _mouseStart: function(/* event */) {}, 1039 _mouseDrag: function(/* event */) {}, 1040 _mouseStop: function(/* event */) {}, 1041 _mouseCapture: function(/* event */) { return true; } 1042}); 1043 1044 1045/*! 1046 * jQuery UI Slider 1.11.4 1047 * http://jqueryui.com 1048 * 1049 * Copyright jQuery Foundation and other contributors 1050 * Released under the MIT license. 1051 * http://jquery.org/license 1052 * 1053 * http://api.jqueryui.com/slider/ 1054 */ 1055 1056 1057var slider = $.widget( "ui.slider", $.ui.mouse, { 1058 version: "1.11.4", 1059 widgetEventPrefix: "slide", 1060 1061 options: { 1062 animate: false, 1063 distance: 0, 1064 max: 100, 1065 min: 0, 1066 orientation: "horizontal", 1067 range: false, 1068 step: 1, 1069 value: 0, 1070 values: null, 1071 1072 // callbacks 1073 change: null, 1074 slide: null, 1075 start: null, 1076 stop: null 1077 }, 1078 1079 // number of pages in a slider 1080 // (how many times can you page up/down to go through the whole range) 1081 numPages: 5, 1082 1083 _create: function() { 1084 this._keySliding = false; 1085 this._mouseSliding = false; 1086 this._animateOff = true; 1087 this._handleIndex = null; 1088 this._detectOrientation(); 1089 this._mouseInit(); 1090 this._calculateNewMax(); 1091 1092 this.element 1093 .addClass( "ui-slider" + 1094 " ui-slider-" + this.orientation + 1095 " ui-widget" + 1096 " ui-widget-content" + 1097 " ui-corner-all"); 1098 1099 this._refresh(); 1100 this._setOption( "disabled", this.options.disabled ); 1101 1102 this._animateOff = false; 1103 }, 1104 1105 _refresh: function() { 1106 this._createRange(); 1107 this._createHandles(); 1108 this._setupEvents(); 1109 this._refreshValue(); 1110 }, 1111 1112 _createHandles: function() { 1113 var i, handleCount, 1114 options = this.options, 1115 existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), 1116 handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>", 1117 handles = []; 1118 1119 handleCount = ( options.values && options.values.length ) || 1; 1120 1121 if ( existingHandles.length > handleCount ) { 1122 existingHandles.slice( handleCount ).remove(); 1123 existingHandles = existingHandles.slice( 0, handleCount ); 1124 } 1125 1126 for ( i = existingHandles.length; i < handleCount; i++ ) { 1127 handles.push( handle ); 1128 } 1129 1130 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 1131 1132 this.handle = this.handles.eq( 0 ); 1133 1134 this.handles.each(function( i ) { 1135 $( this ).data( "ui-slider-handle-index", i ); 1136 }); 1137 }, 1138 1139 _createRange: function() { 1140 var options = this.options, 1141 classes = ""; 1142 1143 if ( options.range ) { 1144 if ( options.range === true ) { 1145 if ( !options.values ) { 1146 options.values = [ this._valueMin(), this._valueMin() ]; 1147 } else if ( options.values.length && options.values.length !== 2 ) { 1148 options.values = [ options.values[0], options.values[0] ]; 1149 } else if ( $.isArray( options.values ) ) { 1150 options.values = options.values.slice(0); 1151 } 1152 } 1153 1154 if ( !this.range || !this.range.length ) { 1155 this.range = $( "<div></div>" ) 1156 .appendTo( this.element ); 1157 1158 classes = "ui-slider-range" + 1159 // note: this isn't the most fittingly semantic framework class for this element, 1160 // but worked best visually with a variety of themes 1161 " ui-widget-header ui-corner-all"; 1162 } else { 1163 this.range.removeClass( "ui-slider-range-min ui-slider-range-max" ) 1164 // Handle range switching from true to min/max 1165 .css({ 1166 "left": "", 1167 "bottom": "" 1168 }); 1169 } 1170 1171 this.range.addClass( classes + 1172 ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) ); 1173 } else { 1174 if ( this.range ) { 1175 this.range.remove(); 1176 } 1177 this.range = null; 1178 } 1179 }, 1180 1181 _setupEvents: function() { 1182 this._off( this.handles ); 1183 this._on( this.handles, this._handleEvents ); 1184 this._hoverable( this.handles ); 1185 this._focusable( this.handles ); 1186 }, 1187 1188 _destroy: function() { 1189 this.handles.remove(); 1190 if ( this.range ) { 1191 this.range.remove(); 1192 } 1193 1194 this.element 1195 .removeClass( "ui-slider" + 1196 " ui-slider-horizontal" + 1197 " ui-slider-vertical" + 1198 " ui-widget" + 1199 " ui-widget-content" + 1200 " ui-corner-all" ); 1201 1202 this._mouseDestroy(); 1203 }, 1204 1205 _mouseCapture: function( event ) { 1206 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 1207 that = this, 1208 o = this.options; 1209 1210 if ( o.disabled ) { 1211 return false; 1212 } 1213 1214 this.elementSize = { 1215 width: this.element.outerWidth(), 1216 height: this.element.outerHeight() 1217 }; 1218 this.elementOffset = this.element.offset(); 1219 1220 position = { x: event.pageX, y: event.pageY }; 1221 normValue = this._normValueFromMouse( position ); 1222 distance = this._valueMax() - this._valueMin() + 1; 1223 this.handles.each(function( i ) { 1224 var thisDistance = Math.abs( normValue - that.values(i) ); 1225 if (( distance > thisDistance ) || 1226 ( distance === thisDistance && 1227 (i === that._lastChangedValue || that.values(i) === o.min ))) { 1228 distance = thisDistance; 1229 closestHandle = $( this ); 1230 index = i; 1231 } 1232 }); 1233 1234 allowed = this._start( event, index ); 1235 if ( allowed === false ) { 1236 return false; 1237 } 1238 this._mouseSliding = true; 1239 1240 this._handleIndex = index; 1241 1242 closestHandle 1243 .addClass( "ui-state-active" ) 1244 .focus(); 1245 1246 offset = closestHandle.offset(); 1247 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 1248 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 1249 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 1250 top: event.pageY - offset.top - 1251 ( closestHandle.height() / 2 ) - 1252 ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - 1253 ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + 1254 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) 1255 }; 1256 1257 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 1258 this._slide( event, index, normValue ); 1259 } 1260 this._animateOff = true; 1261 return true; 1262 }, 1263 1264 _mouseStart: function() { 1265 return true; 1266 }, 1267 1268 _mouseDrag: function( event ) { 1269 var position = { x: event.pageX, y: event.pageY }, 1270 normValue = this._normValueFromMouse( position ); 1271 1272 this._slide( event, this._handleIndex, normValue ); 1273 1274 return false; 1275 }, 1276 1277 _mouseStop: function( event ) { 1278 this.handles.removeClass( "ui-state-active" ); 1279 this._mouseSliding = false; 1280 1281 this._stop( event, this._handleIndex ); 1282 this._change( event, this._handleIndex ); 1283 1284 this._handleIndex = null; 1285 this._clickOffset = null; 1286 this._animateOff = false; 1287 1288 return false; 1289 }, 1290 1291 _detectOrientation: function() { 1292 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 1293 }, 1294 1295 _normValueFromMouse: function( position ) { 1296 var pixelTotal, 1297 pixelMouse, 1298 percentMouse, 1299 valueTotal, 1300 valueMouse; 1301 1302 if ( this.orientation === "horizontal" ) { 1303 pixelTotal = this.elementSize.width; 1304 pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); 1305 } else { 1306 pixelTotal = this.elementSize.height; 1307 pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); 1308 } 1309 1310 percentMouse = ( pixelMouse / pixelTotal ); 1311 if ( percentMouse > 1 ) { 1312 percentMouse = 1; 1313 } 1314 if ( percentMouse < 0 ) { 1315 percentMouse = 0; 1316 } 1317 if ( this.orientation === "vertical" ) { 1318 percentMouse = 1 - percentMouse; 1319 } 1320 1321 valueTotal = this._valueMax() - this._valueMin(); 1322 valueMouse = this._valueMin() + percentMouse * valueTotal; 1323 1324 return this._trimAlignValue( valueMouse ); 1325 }, 1326 1327 _start: function( event, index ) { 1328 var uiHash = { 1329 handle: this.handles[ index ], 1330 value: this.value() 1331 }; 1332 if ( this.options.values && this.options.values.length ) { 1333 uiHash.value = this.values( index ); 1334 uiHash.values = this.values(); 1335 } 1336 return this._trigger( "start", event, uiHash ); 1337 }, 1338 1339 _slide: function( event, index, newVal ) { 1340 var otherVal, 1341 newValues, 1342 allowed; 1343 1344 if ( this.options.values && this.options.values.length ) { 1345 otherVal = this.values( index ? 0 : 1 ); 1346 1347 if ( ( this.options.values.length === 2 && this.options.range === true ) && 1348 ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) 1349 ) { 1350 newVal = otherVal; 1351 } 1352 1353 if ( newVal !== this.values( index ) ) { 1354 newValues = this.values(); 1355 newValues[ index ] = newVal; 1356 // A slide can be canceled by returning false from the slide callback 1357 allowed = this._trigger( "slide", event, { 1358 handle: this.handles[ index ], 1359 value: newVal, 1360 values: newValues 1361 } ); 1362 otherVal = this.values( index ? 0 : 1 ); 1363 if ( allowed !== false ) { 1364 this.values( index, newVal ); 1365 } 1366 } 1367 } else { 1368 if ( newVal !== this.value() ) { 1369 // A slide can be canceled by returning false from the slide callback 1370 allowed = this._trigger( "slide", event, { 1371 handle: this.handles[ index ], 1372 value: newVal 1373 } ); 1374 if ( allowed !== false ) { 1375 this.value( newVal ); 1376 } 1377 } 1378 } 1379 }, 1380 1381 _stop: function( event, index ) { 1382 var uiHash = { 1383 handle: this.handles[ index ], 1384 value: this.value() 1385 }; 1386 if ( this.options.values && this.options.values.length ) { 1387 uiHash.value = this.values( index ); 1388 uiHash.values = this.values(); 1389 } 1390 1391 this._trigger( "stop", event, uiHash ); 1392 }, 1393 1394 _change: function( event, index ) { 1395 if ( !this._keySliding && !this._mouseSliding ) { 1396 var uiHash = { 1397 handle: this.handles[ index ], 1398 value: this.value() 1399 }; 1400 if ( this.options.values && this.options.values.length ) { 1401 uiHash.value = this.values( index ); 1402 uiHash.values = this.values(); 1403 } 1404 1405 //store the last changed value index for reference when handles overlap 1406 this._lastChangedValue = index; 1407 1408 this._trigger( "change", event, uiHash ); 1409 } 1410 }, 1411 1412 value: function( newValue ) { 1413 if ( arguments.length ) { 1414 this.options.value = this._trimAlignValue( newValue ); 1415 this._refreshValue(); 1416 this._change( null, 0 ); 1417 return; 1418 } 1419 1420 return this._value(); 1421 }, 1422 1423 values: function( index, newValue ) { 1424 var vals, 1425 newValues, 1426 i; 1427 1428 if ( arguments.length > 1 ) { 1429 this.options.values[ index ] = this._trimAlignValue( newValue ); 1430 this._refreshValue(); 1431 this._change( null, index ); 1432 return; 1433 } 1434 1435 if ( arguments.length ) { 1436 if ( $.isArray( arguments[ 0 ] ) ) { 1437 vals = this.options.values; 1438 newValues = arguments[ 0 ]; 1439 for ( i = 0; i < vals.length; i += 1 ) { 1440 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 1441 this._change( null, i ); 1442 } 1443 this._refreshValue(); 1444 } else { 1445 if ( this.options.values && this.options.values.length ) { 1446 return this._values( index ); 1447 } else { 1448 return this.value(); 1449 } 1450 } 1451 } else { 1452 return this._values(); 1453 } 1454 }, 1455 1456 _setOption: function( key, value ) { 1457 var i, 1458 valsLength = 0; 1459 1460 if ( key === "range" && this.options.range === true ) { 1461 if ( value === "min" ) { 1462 this.options.value = this._values( 0 ); 1463 this.options.values = null; 1464 } else if ( value === "max" ) { 1465 this.options.value = this._values( this.options.values.length - 1 ); 1466 this.options.values = null; 1467 } 1468 } 1469 1470 if ( $.isArray( this.options.values ) ) { 1471 valsLength = this.options.values.length; 1472 } 1473 1474 if ( key === "disabled" ) { 1475 this.element.toggleClass( "ui-state-disabled", !!value ); 1476 } 1477 1478 this._super( key, value ); 1479 1480 switch ( key ) { 1481 case "orientation": 1482 this._detectOrientation(); 1483 this.element 1484 .removeClass( "ui-slider-horizontal ui-slider-vertical" ) 1485 .addClass( "ui-slider-" + this.orientation ); 1486 this._refreshValue(); 1487 1488 // Reset positioning from previous orientation 1489 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 1490 break; 1491 case "value": 1492 this._animateOff = true; 1493 this._refreshValue(); 1494 this._change( null, 0 ); 1495 this._animateOff = false; 1496 break; 1497 case "values": 1498 this._animateOff = true; 1499 this._refreshValue(); 1500 for ( i = 0; i < valsLength; i += 1 ) { 1501 this._change( null, i ); 1502 } 1503 this._animateOff = false; 1504 break; 1505 case "step": 1506 case "min": 1507 case "max": 1508 this._animateOff = true; 1509 this._calculateNewMax(); 1510 this._refreshValue(); 1511 this._animateOff = false; 1512 break; 1513 case "range": 1514 this._animateOff = true; 1515 this._refresh(); 1516 this._animateOff = false; 1517 break; 1518 } 1519 }, 1520 1521 //internal value getter 1522 // _value() returns value trimmed by min and max, aligned by step 1523 _value: function() { 1524 var val = this.options.value; 1525 val = this._trimAlignValue( val ); 1526 1527 return val; 1528 }, 1529 1530 //internal values getter 1531 // _values() returns array of values trimmed by min and max, aligned by step 1532 // _values( index ) returns single value trimmed by min and max, aligned by step 1533 _values: function( index ) { 1534 var val, 1535 vals, 1536 i; 1537 1538 if ( arguments.length ) { 1539 val = this.options.values[ index ]; 1540 val = this._trimAlignValue( val ); 1541 1542 return val; 1543 } else if ( this.options.values && this.options.values.length ) { 1544 // .slice() creates a copy of the array 1545 // this copy gets trimmed by min and max and then returned 1546 vals = this.options.values.slice(); 1547 for ( i = 0; i < vals.length; i += 1) { 1548 vals[ i ] = this._trimAlignValue( vals[ i ] ); 1549 } 1550 1551 return vals; 1552 } else { 1553 return []; 1554 } 1555 }, 1556 1557 // returns the step-aligned value that val is closest to, between (inclusive) min and max 1558 _trimAlignValue: function( val ) { 1559 if ( val <= this._valueMin() ) { 1560 return this._valueMin(); 1561 } 1562 if ( val >= this._valueMax() ) { 1563 return this._valueMax(); 1564 } 1565 var step = ( this.options.step > 0 ) ? this.options.step : 1, 1566 valModStep = (val - this._valueMin()) % step, 1567 alignValue = val - valModStep; 1568 1569 if ( Math.abs(valModStep) * 2 >= step ) { 1570 alignValue += ( valModStep > 0 ) ? step : ( -step ); 1571 } 1572 1573 // Since JavaScript has problems with large floats, round 1574 // the final value to 5 digits after the decimal point (see #4124) 1575 return parseFloat( alignValue.toFixed(5) ); 1576 }, 1577 1578 _calculateNewMax: function() { 1579 var max = this.options.max, 1580 min = this._valueMin(), 1581 step = this.options.step, 1582 aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step; 1583 max = aboveMin + min; 1584 this.max = parseFloat( max.toFixed( this._precision() ) ); 1585 }, 1586 1587 _precision: function() { 1588 var precision = this._precisionOf( this.options.step ); 1589 if ( this.options.min !== null ) { 1590 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 1591 } 1592 return precision; 1593 }, 1594 1595 _precisionOf: function( num ) { 1596 var str = num.toString(), 1597 decimal = str.indexOf( "." ); 1598 return decimal === -1 ? 0 : str.length - decimal - 1; 1599 }, 1600 1601 _valueMin: function() { 1602 return this.options.min; 1603 }, 1604 1605 _valueMax: function() { 1606 return this.max; 1607 }, 1608 1609 _refreshValue: function() { 1610 var lastValPercent, valPercent, value, valueMin, valueMax, 1611 oRange = this.options.range, 1612 o = this.options, 1613 that = this, 1614 animate = ( !this._animateOff ) ? o.animate : false, 1615 _set = {}; 1616 1617 if ( this.options.values && this.options.values.length ) { 1618 this.handles.each(function( i ) { 1619 valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; 1620 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 1621 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 1622 if ( that.options.range === true ) { 1623 if ( that.orientation === "horizontal" ) { 1624 if ( i === 0 ) { 1625 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); 1626 } 1627 if ( i === 1 ) { 1628 that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 1629 } 1630 } else { 1631 if ( i === 0 ) { 1632 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); 1633 } 1634 if ( i === 1 ) { 1635 that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 1636 } 1637 } 1638 } 1639 lastValPercent = valPercent; 1640 }); 1641 } else { 1642 value = this.value(); 1643 valueMin = this._valueMin(); 1644 valueMax = this._valueMax(); 1645 valPercent = ( valueMax !== valueMin ) ? 1646 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 1647 0; 1648 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 1649 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 1650 1651 if ( oRange === "min" && this.orientation === "horizontal" ) { 1652 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); 1653 } 1654 if ( oRange === "max" && this.orientation === "horizontal" ) { 1655 this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 1656 } 1657 if ( oRange === "min" && this.orientation === "vertical" ) { 1658 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); 1659 } 1660 if ( oRange === "max" && this.orientation === "vertical" ) { 1661 this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 1662 } 1663 } 1664 }, 1665 1666 _handleEvents: { 1667 keydown: function( event ) { 1668 var allowed, curVal, newVal, step, 1669 index = $( event.target ).data( "ui-slider-handle-index" ); 1670 1671 switch ( event.keyCode ) { 1672 case $.ui.keyCode.HOME: 1673 case $.ui.keyCode.END: 1674 case $.ui.keyCode.PAGE_UP: 1675 case $.ui.keyCode.PAGE_DOWN: 1676 case $.ui.keyCode.UP: 1677 case $.ui.keyCode.RIGHT: 1678 case $.ui.keyCode.DOWN: 1679 case $.ui.keyCode.LEFT: 1680 event.preventDefault(); 1681 if ( !this._keySliding ) { 1682 this._keySliding = true; 1683 $( event.target ).addClass( "ui-state-active" ); 1684 allowed = this._start( event, index ); 1685 if ( allowed === false ) { 1686 return; 1687 } 1688 } 1689 break; 1690 } 1691 1692 step = this.options.step; 1693 if ( this.options.values && this.options.values.length ) { 1694 curVal = newVal = this.values( index ); 1695 } else { 1696 curVal = newVal = this.value(); 1697 } 1698 1699 switch ( event.keyCode ) { 1700 case $.ui.keyCode.HOME: 1701 newVal = this._valueMin(); 1702 break; 1703 case $.ui.keyCode.END: 1704 newVal = this._valueMax(); 1705 break; 1706 case $.ui.keyCode.PAGE_UP: 1707 newVal = this._trimAlignValue( 1708 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 1709 ); 1710 break; 1711 case $.ui.keyCode.PAGE_DOWN: 1712 newVal = this._trimAlignValue( 1713 curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) ); 1714 break; 1715 case $.ui.keyCode.UP: 1716 case $.ui.keyCode.RIGHT: 1717 if ( curVal === this._valueMax() ) { 1718 return; 1719 } 1720 newVal = this._trimAlignValue( curVal + step ); 1721 break; 1722 case $.ui.keyCode.DOWN: 1723 case $.ui.keyCode.LEFT: 1724 if ( curVal === this._valueMin() ) { 1725 return; 1726 } 1727 newVal = this._trimAlignValue( curVal - step ); 1728 break; 1729 } 1730 1731 this._slide( event, index, newVal ); 1732 }, 1733 keyup: function( event ) { 1734 var index = $( event.target ).data( "ui-slider-handle-index" ); 1735 1736 if ( this._keySliding ) { 1737 this._keySliding = false; 1738 this._stop( event, index ); 1739 this._change( event, index ); 1740 $( event.target ).removeClass( "ui-state-active" ); 1741 } 1742 } 1743 } 1744}); 1745 1746
1747 1748}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.