1/*! 2 * jQuery UI 1.8.24 3 * 4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 * Dual licensed under the MIT or GPL Version 2 licenses. 6 * http://jquery.org/license 7 * 8 * http://docs.jquery.com/UI 9 */ 10(function( $, undefined ) { 11 12// prevent duplicate loading 13// this is only a problem because we proxy existing functions 14// and we don't want to double proxy them 15$.ui = $.ui || {}; 16if ( $.ui.version ) { 17 return; 18} 19 20$.extend( $.ui, { 21 version: "1.8.24", 22 23 keyCode: { 24 ALT: 18, 25 BACKSPACE: 8, 26 CAPS_LOCK: 20, 27 COMMA: 188, 28 COMMAND: 91, 29 COMMAND_LEFT: 91, // COMMAND 30 COMMAND_RIGHT: 93, 31 CONTROL: 17, 32 DELETE: 46, 33 DOWN: 40, 34 END: 35, 35 ENTER: 13, 36 ESCAPE: 27, 37 HOME: 36, 38 INSERT: 45, 39 LEFT: 37, 40 MENU: 93, // COMMAND_RIGHT 41 NUMPAD_ADD: 107, 42 NUMPAD_DECIMAL: 110, 43 NUMPAD_DIVIDE: 111, 44 NUMPAD_ENTER: 108, 45 NUMPAD_MULTIPLY: 106, 46 NUMPAD_SUBTRACT: 109, 47 PAGE_DOWN: 34, 48 PAGE_UP: 33, 49 PERIOD: 190, 50 RIGHT: 39, 51 SHIFT: 16, 52 SPACE: 32, 53 TAB: 9, 54 UP: 38, 55 WINDOWS: 91 // COMMAND 56 } 57}); 58 59// plugins 60$.fn.extend({ 61 propAttr: $.fn.prop || $.fn.attr, 62 63 _focus: $.fn.focus, 64 focus: function( delay, fn ) { 65 return typeof delay === "number" ? 66 this.each(function() { 67 var elem = this; 68 setTimeout(function() { 69 $( elem ).focus(); 70 if ( fn ) { 71 fn.call( elem ); 72 } 73 }, delay ); 74 }) : 75 this._focus.apply( this, arguments ); 76 }, 77 78 scrollParent: function() { 79 var scrollParent; 80 if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { 81 scrollParent = this.parents().filter(function() { 82 return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); 83 }).eq(0); 84 } else { 85 scrollParent = this.parents().filter(function() { 86 return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); 87 }).eq(0); 88 } 89 90 return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; 91 }, 92 93 zIndex: function( zIndex ) { 94 if ( zIndex !== undefined ) { 95 return this.css( "zIndex", zIndex ); 96 } 97 98 if ( this.length ) { 99 var elem = $( this[ 0 ] ), position, value; 100 while ( elem.length && elem[ 0 ] !== document ) { 101 // Ignore z-index if position is set to a value where z-index is ignored by the browser 102 // This makes behavior of this function consistent across browsers 103 // WebKit always returns auto if the element is positioned 104 position = elem.css( "position" ); 105 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 106 // IE returns 0 when zIndex is not specified 107 // other browsers return a string 108 // we ignore the case of nested elements with an explicit value of 0 109 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 110 value = parseInt( elem.css( "zIndex" ), 10 ); 111 if ( !isNaN( value ) && value !== 0 ) { 112 return value; 113 } 114 } 115 elem = elem.parent(); 116 } 117 } 118 119 return 0; 120 }, 121 122 disableSelection: function() { 123 return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + 124 ".ui-disableSelection", function( event ) { 125 event.preventDefault(); 126 }); 127 }, 128 129 enableSelection: function() { 130 return this.unbind( ".ui-disableSelection" ); 131 } 132}); 133 134// support: jQuery <1.8 135if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { 136 $.each( [ "Width", "Height" ], function( i, name ) { 137 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 138 type = name.toLowerCase(), 139 orig = { 140 innerWidth: $.fn.innerWidth, 141 innerHeight: $.fn.innerHeight, 142 outerWidth: $.fn.outerWidth, 143 outerHeight: $.fn.outerHeight 144 }; 145 146 function reduce( elem, size, border, margin ) { 147 $.each( side, function() { 148 size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; 149 if ( border ) { 150 size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; 151 } 152 if ( margin ) { 153 size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; 154 } 155 }); 156 return size; 157 } 158
159 $.fn[ "inner" + name ] = function( size ) { 160 if ( size === undefined ) { 161 return orig[ "inner" + name ].call( this ); 162 } 163 164 return this.each(function() { 165 $( this ).css( type, reduce( this, size ) + "px" ); 166 }); 167 }; 168 169 $.fn[ "outer" + name] = function( size, margin ) { 170 if ( typeof size !== "number" ) { 171 return orig[ "outer" + name ].call( this, size ); 172 } 173 174 return this.each(function() { 175 $( this).css( type, reduce( this, size, true, margin ) + "px" ); 176 }); 177 }; 178 }); 179} 180 181// selectors 182function focusable( element, isTabIndexNotNaN ) { 183 var nodeName = element.nodeName.toLowerCase(); 184 if ( "area" === nodeName ) { 185 var map = element.parentNode, 186 mapName = map.name, 187 img; 188 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 189 return false; 190 } 191 img = $( "img[usemap=#" + mapName + "]" )[0]; 192 return !!img && visible( img ); 193 } 194 return ( /input|select|textarea|button|object/.test( nodeName ) 195 ? !element.disabled 196 : "a" == nodeName 197 ? element.href || isTabIndexNotNaN 198 : isTabIndexNotNaN) 199 // the element and all of its ancestors must be visible 200 && visible( element ); 201} 202 203function visible( element ) { 204 return !$( element ).parents().andSelf().filter(function() { 205 return $.curCSS( this, "visibility" ) === "hidden" || 206 $.expr.filters.hidden( this ); 207 }).length; 208} 209 210$.extend( $.expr[ ":" ], { 211 data: $.expr.createPseudo ? 212 $.expr.createPseudo(function( dataName ) { 213 return function( elem ) { 214 return !!$.data( elem, dataName ); 215 }; 216 }) : 217 // support: jQuery <1.8 218 function( elem, i, match ) { 219 return !!$.data( elem, match[ 3 ] ); 220 }, 221 222 focusable: function( element ) { 223 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 224 }, 225 226 tabbable: function( element ) { 227 var tabIndex = $.attr( element, "tabindex" ), 228 isTabIndexNaN = isNaN( tabIndex ); 229 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 230 } 231}); 232 233// support 234$(function() { 235 var body = document.body, 236 div = body.appendChild( div = document.createElement( "div" ) ); 237 238 // access offsetHeight before setting the style to prevent a layout bug 239 // in IE 9 which causes the elemnt to continue to take up space even 240 // after it is removed from the DOM (#8026) 241 div.offsetHeight; 242 243 $.extend( div.style, { 244 minHeight: "100px", 245 height: "auto", 246 padding: 0, 247 borderWidth: 0 248 }); 249 250 $.support.minHeight = div.offsetHeight === 100; 251 $.support.selectstart = "onselectstart" in div; 252 253 // set display to none to avoid a layout bug in IE 254 // http://dev.jquery.com/ticket/4014 255 body.removeChild( div ).style.display = "none"; 256}); 257 258// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css 259if ( !$.curCSS ) { 260 $.curCSS = $.css; 261} 262 263 264 265 266 267// deprecated 268$.extend( $.ui, { 269 // $.ui.plugin is deprecated. Use the proxy pattern instead. 270 plugin: { 271 add: function( module, option, set ) { 272 var proto = $.ui[ module ].prototype; 273 for ( var i in set ) { 274 proto.plugins[ i ] = proto.plugins[ i ] || []; 275 proto.plugins[ i ].push( [ option, set[ i ] ] ); 276 } 277 }, 278 call: function( instance, name, args ) { 279 var set = instance.plugins[ name ]; 280 if ( !set || !instance.element[ 0 ].parentNode ) { 281 return; 282 } 283 284 for ( var i = 0; i < set.length; i++ ) { 285 if ( instance.options[ set[ i ][ 0 ] ] ) { 286 set[ i ][ 1 ].apply( instance.element, args ); 287 } 288 } 289 } 290 }, 291 292 // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() 293 contains: function( a, b ) { 294 return document.compareDocumentPosition ? 295 a.compareDocumentPosition( b ) & 16 : 296 a !== b && a.contains( b ); 297 }, 298 299 // only used by resizable 300 hasScroll: function( el, a ) { 301 302 //If overflow is hidden, the element might have extra content, but the user wants to hide it 303 if ( $( el ).css( "overflow" ) === "hidden") { 304 return false; 305 } 306 307 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 308 has = false; 309 310 if ( el[ scroll ] > 0 ) { 311 return true; 312 } 313 314 // TODO: determine which cases actually cause this to happen 315 // if the element doesn't have the scroll set, see if it's possible to 316 // set the scroll 317 el[ scroll ] = 1; 318 has = ( el[ scroll ] > 0 ); 319 el[ scroll ] = 0; 320 return has; 321 }, 322
323 // these are odd functions, fix the API or move into individual plugins 324 isOverAxis: function( x, reference, size ) { 325 //Determines when x coordinate is over "b" element axis 326 return ( x > reference ) && ( x < ( reference + size ) ); 327 }, 328 isOver: function( y, x, top, left, height, width ) { 329 //Determines when x, y coordinates is over "b" element 330 return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); 331 } 332}); 333 334})( jQuery ); 335/*! 336 * jQuery UI Widget 1.8.24 337 * 338 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 339 * Dual licensed under the MIT or GPL Version 2 licenses. 340 * http://jquery.org/license 341 * 342 * http://docs.jquery.com/UI/Widget 343 */ 344(function( $, undefined ) { 345 346// jQuery 1.4+ 347if ( $.cleanData ) { 348 var _cleanData = $.cleanData; 349 $.cleanData = function( elems ) { 350 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 351 try { 352 $( elem ).triggerHandler( "remove" ); 353 // http://bugs.jquery.com/ticket/8235 354 } catch( e ) {} 355 } 356 _cleanData( elems ); 357 }; 358} else { 359 var _remove = $.fn.remove; 360 $.fn.remove = function( selector, keepData ) { 361 return this.each(function() { 362 if ( !keepData ) { 363 if ( !selector || $.filter( selector, [ this ] ).length ) { 364 $( "*", this ).add( [ this ] ).each(function() { 365 try { 366 $( this ).triggerHandler( "remove" ); 367 // http://bugs.jquery.com/ticket/8235 368 } catch( e ) {} 369 }); 370 } 371 } 372 return _remove.call( $(this), selector, keepData ); 373 }); 374 }; 375} 376 377$.widget = function( name, base, prototype ) { 378 var namespace = name.split( "." )[ 0 ], 379 fullName; 380 name = name.split( "." )[ 1 ]; 381 fullName = namespace + "-" + name; 382 383 if ( !prototype ) { 384 prototype = base; 385 base = $.Widget; 386 } 387 388 // create selector for plugin 389 $.expr[ ":" ][ fullName ] = function( elem ) { 390 return !!$.data( elem, name ); 391 }; 392 393 $[ namespace ] = $[ namespace ] || {}; 394 $[ namespace ][ name ] = function( options, element ) { 395 // allow instantiation without initializing for simple inheritance 396 if ( arguments.length ) { 397 this._createWidget( options, element ); 398 } 399 }; 400 401 var basePrototype = new base(); 402 // we need to make the options hash a property directly on the new instance 403 // otherwise we'll modify the options hash on the prototype that we're 404 // inheriting from 405// $.each( basePrototype, function( key, val ) { 406// if ( $.isPlainObject(val) ) { 407// basePrototype[ key ] = $.extend( {}, val ); 408// } 409// }); 410 basePrototype.options = $.extend( true, {}, basePrototype.options ); 411 $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { 412 namespace: namespace, 413 widgetName: name, 414 widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, 415 widgetBaseClass: fullName 416 }, prototype ); 417 418 $.widget.bridge( name, $[ namespace ][ name ] ); 419}; 420 421$.widget.bridge = function( name, object ) { 422 $.fn[ name ] = function( options ) { 423 var isMethodCall = typeof options === "string", 424 args = Array.prototype.slice.call( arguments, 1 ), 425 returnValue = this; 426 427 // allow multiple hashes to be passed on init 428 options = !isMethodCall && args.length ? 429 $.extend.apply( null, [ true, options ].concat(args) ) : 430 options; 431 432 // prevent calls to internal methods 433 if ( isMethodCall && options.charAt( 0 ) === "_" ) { 434 return returnValue; 435 } 436 437 if ( isMethodCall ) { 438 this.each(function() { 439 var instance = $.data( this, name ), 440 methodValue = instance && $.isFunction( instance[options] ) ? 441 instance[ options ].apply( instance, args ) : 442 instance; 443 // TODO: add this back in 1.9 and use $.error() (see #5972) 444// if ( !instance ) { 445// throw "cannot call methods on " + name + " prior to initialization; " + 446// "attempted to call method '" + options + "'"; 447// } 448// if ( !$.isFunction( instance[options] ) ) { 449// throw "no such method '" + options + "' for " + name + " widget instance"; 450// } 451// var methodValue = instance[ options ].apply( instance, args ); 452 if ( methodValue !== instance && methodValue !== undefined ) { 453 returnValue = methodValue; 454 return false; 455 } 456 }); 457 } else { 458 this.each(function() { 459 var instance = $.data( this, name ); 460 if ( instance ) { 461 instance.option( options || {} )._init(); 462 } else { 463 $.data( this, name, new object( options, this ) ); 464 } 465 }); 466 } 467 468 return returnValue; 469 }; 470}; 471 472$.Widget = function( options, element ) { 473 // allow instantiation without initializing for simple inheritance 474 if ( arguments.length ) { 475 this._createWidget( options, element ); 476 } 477}; 478 479$.Widget.prototype = { 480 widgetName: "widget", 481 widgetEventPrefix: "", 482 options: { 483 disabled: false 484 }, 485 _createWidget: function( options, element ) { 486 // $.widget.bridge stores the plugin instance, but we do it anyway 487 // so that it's stored even before the _create function runs 488 $.data( element, this.widgetName, this ); 489 this.element = $( element ); 490 this.options = $.extend( true, {}, 491 this.options, 492 this._getCreateOptions(), 493 options ); 494 495 var self = this; 496 this.element.bind( "remove." + this.widgetName, function() { 497 self.destroy(); 498 }); 499 500 this._create(); 501 this._trigger( "create" ); 502 this._init(); 503 }, 504 _getCreateOptions: function() { 505 return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; 506 }, 507 _create: function() {}, 508 _init: function() {}, 509 510 destroy: function() { 511 this.element 512 .unbind( "." + this.widgetName ) 513 .removeData( this.widgetName ); 514 this.widget() 515 .unbind( "." + this.widgetName ) 516 .removeAttr( "aria-disabled" ) 517 .removeClass( 518 this.widgetBaseClass + "-disabled " + 519 "ui-state-disabled" ); 520 }, 521 522 widget: function() { 523 return this.element; 524 }, 525 526 option: function( key, value ) { 527 var options = key; 528 529 if ( arguments.length === 0 ) { 530 // don't return a reference to the internal hash 531 return $.extend( {}, this.options ); 532 } 533 534 if (typeof key === "string" ) { 535 if ( value === undefined ) { 536 return this.options[ key ]; 537 } 538 options = {}; 539 options[ key ] = value; 540 } 541 542 this._setOptions( options ); 543 544 return this; 545 }, 546 _setOptions: function( options ) { 547 var self = this; 548 $.each( options, function( key, value ) { 549 self._setOption( key, value ); 550 }); 551 552 return this; 553 }, 554 _setOption: function( key, value ) { 555 this.options[ key ] = value; 556 557 if ( key === "disabled" ) { 558 this.widget() 559 [ value ? "addClass" : "removeClass"]( 560 this.widgetBaseClass + "-disabled" + " " + 561 "ui-state-disabled" ) 562 .attr( "aria-disabled", value ); 563 } 564 565 return this; 566 }, 567 568 enable: function() { 569 return this._setOption( "disabled", false ); 570 }, 571 disable: function() { 572 return this._setOption( "disabled", true ); 573 }, 574 575 _trigger: function( type, event, data ) { 576 var prop, orig, 577 callback = this.options[ type ]; 578 579 data = data || {}; 580 event = $.Event( event ); 581 event.type = ( type === this.widgetEventPrefix ? 582 type : 583 this.widgetEventPrefix + type ).toLowerCase(); 584 // the original event may come from any element 585 // so we need to reset the target on the new event 586 event.target = this.element[ 0 ]; 587 588 // copy original event properties over to the new event 589 orig = event.originalEvent; 590 if ( orig ) { 591 for ( prop in orig ) { 592 if ( !( prop in event ) ) { 593 event[ prop ] = orig[ prop ]; 594 } 595 } 596 } 597 598 this.element.trigger( event, data ); 599 600 return !( $.isFunction(callback) && 601 callback.call( this.element[0], event, data ) === false || 602 event.isDefaultPrevented() ); 603 } 604}; 605 606}
vendor: 2,649 bytes, lines 606-700
606)( jQuery ); 607/*! 608 * jQuery UI Mouse 1.8.24 609 * 610 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 611 * Dual licensed under the MIT or GPL Version 2 licenses. 612 * http://jquery.org/license 613 * 614 * http://docs.jquery.com/UI/Mouse 615 * 616 * Depends: 617 * jquery.ui.widget.js 618 */ 619(function( $, undefined ) { 620 621var mouseHandled = false; 622$( document ).mouseup( function( e ) { 623 mouseHandled = false; 624}); 625 626$.widget("ui.mouse", { 627 options: { 628 cancel: ':input,option', 629 distance: 1, 630 delay: 0 631 }, 632 _mouseInit: function() { 633 var self = this; 634 635 this.element 636 .bind('mousedown.'+this.widgetName, function(event) { 637 return self._mouseDown(event); 638 }) 639 .bind('click.'+this.widgetName, function(event) { 640 if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { 641 $.removeData(event.target, self.widgetName + '.preventClickEvent'); 642 event.stopImmediatePropagation(); 643 return false; 644 } 645 }); 646 647 this.started = false; 648 }, 649 650 // TODO: make sure destroying one instance of mouse doesn't mess with 651 // other instances of mouse 652 _mouseDestroy: function() { 653 this.element.unbind('.'+this.widgetName); 654 if ( this._mouseMoveDelegate ) { 655 $(document) 656 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 657 .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); 658 } 659 }, 660 661 _mouseDown: function(event) { 662 // don't let more than one widget handle mouseStart 663 if( mouseHandled ) { return }; 664 665 // we may have missed mouseup (out of window) 666 (this._mouseStarted && this._mouseUp(event)); 667 668 this._mouseDownEvent = event; 669 670 var self = this, 671 btnIsLeft = (event.which == 1), 672 // event.target.nodeName works around a bug in IE 8 with 673 // disabled inputs (#7620) 674 elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); 675 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 676 return true; 677 } 678 679 this.mouseDelayMet = !this.options.delay; 680 if (!this.mouseDelayMet) { 681 this._mouseDelayTimer = setTimeout(function() { 682 self.mouseDelayMet = true; 683 }, this.options.delay); 684 } 685 686 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 687 this._mouseStarted = (this._mouseStart(event) !== false); 688 if (!this._mouseStarted) { 689 event.preventDefault(); 690 return true; 691 } 692 } 693 694 // Click event may never have fired (Gecko & Opera) 695 if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { 696 $.removeData(event.target, this.widgetName + '.preventClickEvent'); 697 } 698 699 // these delegates are required to keep context 700 this._mouseMoveDelegate = function(event) {
701 return self._mouseMove(event); 702 }; 703 this._mouseUpDelegate = function(event) { 704 return self._mouseUp(event); 705 }; 706 $(document) 707 .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 708 .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); 709 710 event.preventDefault(); 711 712 mouseHandled = true; 713 return true; 714 }, 715 716 _mouseMove: function(event) { 717 // IE mouseup check - mouseup happened when mouse was out of window 718 if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { 719 return this._mouseUp(event); 720 } 721 722 if (this._mouseStarted) { 723 this._mouseDrag(event); 724 return event.preventDefault(); 725 } 726 727 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 728 this._mouseStarted = 729 (this._mouseStart(this._mouseDownEvent, event) !== false); 730 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 731 } 732 733 return !this._mouseStarted; 734 }, 735 736 _mouseUp: function(event) { 737 $(document) 738 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 739 .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); 740 741 if (this._mouseStarted) { 742 this._mouseStarted = false; 743 744 if (event.target == this._mouseDownEvent.target) { 745 $.data(event.target, this.widgetName + '.preventClickEvent', true); 746 } 747 748 this._mouseStop(event); 749 } 750 751 return false; 752 }, 753 754 _mouseDistanceMet: function(event) { 755 return (Math.max( 756 Math.abs(this._mouseDownEvent.pageX - event.pageX), 757 Math.abs(this._mouseDownEvent.pageY - event.pageY) 758 ) >= this.options.distance 759 ); 760 }, 761 762 _mouseDelayMet: function(event) { 763 return this.mouseDelayMet; 764 }, 765 766 // These are placeholder methods, to be overriden by extending plugin 767 _mouseStart: function(event) {}, 768 _mouseDrag: function(event) {}, 769 _mouseStop: function(event) {}, 770 _mouseCapture: function(event) { return true; } 771}); 772 773})(jQuery); 774/*! 775 * jQuery UI Position 1.8.24 776 * 777 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 778 * Dual licensed under the MIT or GPL Version 2 licenses. 779 * http://jquery.org/license 780 * 781 * http://docs.jquery.com/UI/Position 782 */ 783(function( $, undefined ) { 784 785$.ui = $.ui || {}; 786 787var horizontalPositions = /left|center|right/, 788 verticalPositions = /top|center|bottom/, 789 center = "center", 790 support = {}, 791 _position = $.fn.position, 792 _offset = $.fn.offset; 793 794$.fn.position = function( options ) { 795 if ( !options || !options.of ) { 796 return _position.apply( this, arguments ); 797 } 798 799 // make a copy, we don't want to modify arguments 800 options = $.extend( {}, options ); 801 802 var target = $( options.of ), 803 targetElem = target[0], 804 collision = ( options.collision || "flip" ).split( " " ), 805 offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], 806 targetWidth, 807 targetHeight, 808 basePosition; 809 810 if ( targetElem.nodeType === 9 ) { 811 targetWidth = target.width(); 812 targetHeight = target.height(); 813 basePosition = { top: 0, left: 0 }; 814 // TODO: use $.isWindow() in 1.9 815 } else if ( targetElem.setTimeout ) { 816 targetWidth = target.width(); 817 targetHeight = target.height(); 818 basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; 819 } else if ( targetElem.preventDefault ) { 820 // force left top to allow flipping 821 options.at = "left top"; 822 targetWidth = targetHeight = 0; 823 basePosition = { top: options.of.pageY, left: options.of.pageX }; 824 } else { 825 targetWidth = target.outerWidth(); 826 targetHeight = target.outerHeight(); 827 basePosition = target.offset(); 828 } 829 830 // force my and at to have valid horizontal and veritcal positions 831 // if a value is missing or invalid, it will be converted to center 832 $.each( [ "my", "at" ], function() { 833 var pos = ( options[this] || "" ).split( " " ); 834 if ( pos.length === 1) { 835 pos = horizontalPositions.test( pos[0] ) ? 836 pos.concat( [center] ) : 837 verticalPositions.test( pos[0] ) ? 838 [ center ].concat( pos ) : 839 [ center, center ]; 840 } 841 pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; 842 pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; 843 options[ this ] = pos; 844 }); 845 846 // normalize collision option 847 if ( collision.length === 1 ) { 848 collision[ 1 ] = collision[ 0 ]; 849 } 850 851 // normalize offset option 852 offset[ 0 ] = parseInt( offset[0], 10 ) || 0; 853 if ( offset.length === 1 ) { 854 offset[ 1 ] = offset[ 0 ]; 855 } 856 offset[ 1 ] = parseInt( offset[1], 10 ) || 0; 857 858 if ( options.at[0] === "right" ) { 859 basePosition.left += targetWidth; 860 } else if ( options.at[0] === center ) { 861 basePosition.left += targetWidth / 2; 862 } 863 864 if ( options.at[1] === "bottom" ) { 865 basePosition.top += targetHeight; 866 } else if ( options.at[1] === center ) { 867 basePosition.top += targetHeight / 2; 868 } 869 870 basePosition.left += offset[ 0 ]; 871 basePosition.top += offset[ 1 ]; 872 873 return this.each(function() { 874 var elem = $( this ), 875 elemWidth = elem.outerWidth(), 876 elemHeight = elem.outerHeight(), 877 marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, 878 marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, 879 collisionWidth = elemWidth + marginLeft + 880 ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
881 collisionHeight = elemHeight + marginTop + 882 ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), 883 position = $.extend( {}, basePosition ), 884 collisionPosition; 885 886 if ( options.my[0] === "right" ) { 887 position.left -= elemWidth; 888 } else if ( options.my[0] === center ) { 889 position.left -= elemWidth / 2; 890 } 891 892 if ( options.my[1] === "bottom" ) { 893 position.top -= elemHeight; 894 } else if ( options.my[1] === center ) { 895 position.top -= elemHeight / 2; 896 } 897 898 // prevent fractions if jQuery version doesn't support them (see #5280) 899 if ( !support.fractions ) { 900 position.left = Math.round( position.left ); 901 position.top = Math.round( position.top ); 902 } 903 904 collisionPosition = { 905 left: position.left - marginLeft, 906 top: position.top - marginTop 907 }; 908 909 $.each( [ "left", "top" ], function( i, dir ) { 910 if ( $.ui.position[ collision[i] ] ) { 911 $.ui.position[ collision[i] ][ dir ]( position, { 912 targetWidth: targetWidth, 913 targetHeight: targetHeight, 914 elemWidth: elemWidth, 915 elemHeight: elemHeight, 916 collisionPosition: collisionPosition, 917 collisionWidth: collisionWidth, 918 collisionHeight: collisionHeight, 919 offset: offset, 920 my: options.my, 921 at: options.at 922 }); 923 } 924 }); 925 926 if ( $.fn.bgiframe ) { 927 elem.bgiframe(); 928 } 929 elem.offset( $.extend( position, { using: options.using } ) ); 930 }); 931}; 932 933$.ui.position = { 934 fit: { 935 left: function( position, data ) { 936 var win = $( window ), 937 over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); 938 position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); 939 }, 940 top: function( position, data ) { 941 var win = $( window ), 942 over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); 943 position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); 944 } 945 }, 946 947 flip: { 948 left: function( position, data ) { 949 if ( data.at[0] === center ) { 950 return; 951 } 952 var win = $( window ), 953 over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), 954 myOffset = data.my[ 0 ] === "left" ? 955 -data.elemWidth : 956 data.my[ 0 ] === "right" ? 957 data.elemWidth : 958 0, 959 atOffset = data.at[ 0 ] === "left" ? 960 data.targetWidth : 961 -data.targetWidth, 962 offset = -2 * data.offset[ 0 ]; 963 position.left += data.collisionPosition.left < 0 ? 964 myOffset + atOffset + offset : 965 over > 0 ? 966 myOffset + atOffset + offset : 967 0; 968 }, 969 top: function( position, data ) { 970 if ( data.at[1] === center ) { 971 return; 972 } 973 var win = $( window ), 974 over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), 975 myOffset = data.my[ 1 ] === "top" ? 976 -data.elemHeight : 977 data.my[ 1 ] === "bottom" ? 978 data.elemHeight : 979 0, 980 atOffset = data.at[ 1 ] === "top" ? 981 data.targetHeight : 982 -data.targetHeight, 983 offset = -2 * data.offset[ 1 ]; 984 position.top += data.collisionPosition.top < 0 ? 985 myOffset + atOffset + offset : 986 over > 0 ? 987 myOffset + atOffset + offset : 988 0; 989 } 990 } 991}; 992 993// offset setter from jQuery 1.4 994if ( !$.offset.setOffset ) { 995 $.offset.setOffset = function( elem, options ) { 996 // set position first, in-case top/left are set even on static elem 997 if ( /static/.test( $.curCSS( elem, "position" ) ) ) { 998 elem.style.position = "relative"; 999 } 1000 var curElem = $( elem ), 1001 curOffset = curElem.offset(), 1002 curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0, 1003 curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0, 1004 props = { 1005 top: (options.top - curOffset.top) + curTop, 1006 left: (options.left - curOffset.left) + curLeft 1007 }; 1008 1009 if ( 'using' in options ) { 1010 options.using.call( elem, props ); 1011 } else { 1012 curElem.css( props ); 1013 } 1014 }; 1015 1016 $.fn.offset = function( options ) { 1017 var elem = this[ 0 ]; 1018 if ( !elem || !elem.ownerDocument ) { return null; } 1019 if ( options ) { 1020 if ( $.isFunction( options ) ) { 1021 return this.each(function( i ) { 1022 $( this ).offset( options.call( this, i, $( this ).offset() ) ); 1023 }); 1024 } 1025 return this.each(function() { 1026 $.offset.setOffset( this, options ); 1027 }); 1028 } 1029 return _offset.call( this ); 1030 }; 1031} 1032 1033// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css 1034if ( !$.curCSS ) { 1035 $.curCSS = $.css; 1036} 1037 1038// fraction support test (older versions of jQuery don't support fractions) 1039(function () { 1040 var body = document.getElementsByTagName( "body" )[ 0 ], 1041 div = document.createElement( "div" ), 1042 testElement, testElementParent, testElementStyle, offset, offsetTotal; 1043 1044 //Create a "fake body" for testing based on method used in jQuery.support 1045 testElement = document.createElement( body ? "div" : "body" ); 1046 testElementStyle = { 1047 visibility: "hidden", 1048 width: 0, 1049 height: 0, 1050 border: 0, 1051 margin: 0, 1052 background: "none" 1053 }; 1054 if ( body ) { 1055 $.extend( testElementStyle, { 1056 position: "absolute", 1057 left: "-1000px", 1058 top: "-1000px" 1059 }); 1060 } 1061 for ( var i in testElementStyle ) { 1062 testElement.style[ i ] = testElementStyle[ i ]; 1063 } 1064 testElement.appendChild( div ); 1065 testElementParent = body || document.documentElement; 1066 testElementParent.insertBefore( testElement, testElementParent.firstChild ); 1067 1068 div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;"; 1069 1070 offset = $( div ).offset( function( _, offset ) { 1071 return offset; 1072 }).offset(); 1073 1074 testElement.innerHTML = ""; 1075 testElementParent.removeChild( testElement ); 1076 1077 offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 ); 1078 support.fractions = offsetTotal > 21 && offsetTotal < 22; 1079})(); 1080 1081}( jQuery )); 1082/*! 1083 * jQuery UI Draggable 1.8.24 1084 * 1085 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 1086 * Dual licensed under the MIT or GPL Version 2 licenses. 1087 * http://jquery.org/license 1088 * 1089 * http://docs.jquery.com/UI/Draggables 1090 * 1091 * Depends: 1092 * jquery.ui.core.js 1093 * jquery.ui.mouse.js 1094 * jquery.ui.widget.js 1095 */ 1096(function( $, undefined ) { 1097 1098$.widget("ui.draggable", $.ui.mouse, { 1099 widgetEventPrefix: "drag", 1100 options: { 1101 addClasses: true, 1102 appendTo: "parent", 1103 axis: false, 1104 connectToSortable: false, 1105 containment: false, 1106 cursor: "auto",
1107 cursorAt: false, 1108 grid: false, 1109 handle: false, 1110 helper: "original", 1111 iframeFix: false, 1112 opacity: false, 1113 refreshPositions: false, 1114 revert: false, 1115 revertDuration: 500, 1116 scope: "default", 1117 scroll: true, 1118 scrollSensitivity: 20, 1119 scrollSpeed: 20, 1120 snap: false, 1121 snapMode: "both", 1122 snapTolerance: 20, 1123 stack: false, 1124 zIndex: false 1125 }, 1126 _create: function() { 1127 1128 if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) 1129 this.element[0].style.position = 'relative'; 1130 1131 (this.options.addClasses && this.element.addClass("ui-draggable")); 1132 (this.options.disabled && this.element.addClass("ui-draggable-disabled")); 1133 1134 this._mouseInit(); 1135 1136 }, 1137 1138 destroy: function() { 1139 if(!this.element.data('draggable')) return; 1140 this.element 1141 .removeData("draggable") 1142 .unbind(".draggable") 1143 .removeClass("ui-draggable" 1144 + " ui-draggable-dragging" 1145 + " ui-draggable-disabled"); 1146 this._mouseDestroy(); 1147 1148 return this; 1149 }, 1150 1151 _mouseCapture: function(event) { 1152 1153 var o = this.options; 1154 1155 // among others, prevent a drag on a resizable-handle 1156 if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) 1157 return false; 1158 1159 //Quit if we're not on a valid handle 1160 this.handle = this._getHandle(event); 1161 if (!this.handle) 1162 return false; 1163 1164 if ( o.iframeFix ) { 1165 $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { 1166 $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') 1167 .css({ 1168 width: this.offsetWidth+"px", height: this.offsetHeight+"px", 1169 position: "absolute", opacity: "0.001", zIndex: 1000 1170 }) 1171 .css($(this).offset()) 1172 .appendTo("body"); 1173 }); 1174 } 1175 1176 return true; 1177 1178 }, 1179 1180 _mouseStart: function(event) { 1181 1182 var o = this.options; 1183 1184 //Create and append the visible helper 1185 this.helper = this._createHelper(event); 1186 1187 this.helper.addClass("ui-draggable-dragging"); 1188 1189 //Cache the helper size 1190 this._cacheHelperProportions(); 1191 1192 //If ddmanager is used for droppables, set the global draggable 1193 if($.ui.ddmanager) 1194 $.ui.ddmanager.current = this; 1195 1196 /* 1197 * - Position generation - 1198 * This block generates everything position related - it's the core of draggables. 1199 */ 1200 1201 //Cache the margins of the original element 1202 this._cacheMargins(); 1203 1204 //Store the helper's css position 1205 this.cssPosition = this.helper.css("position"); 1206 this.scrollParent = this.helper.scrollParent(); 1207 1208 //The element's absolute position on the page minus margins 1209 this.offset = this.positionAbs = this.element.offset(); 1210 this.offset = { 1211 top: this.offset.top - this.margins.top, 1212 left: this.offset.left - this.margins.left 1213 }; 1214 1215 $.extend(this.offset, { 1216 click: { //Where the click happened, relative to the element 1217 left: event.pageX - this.offset.left, 1218 top: event.pageY - this.offset.top 1219 }, 1220 parent: this._getParentOffset(), 1221 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 1222 }); 1223 1224 //Generate the original position 1225 this.originalPosition = this.position = this._generatePosition(event); 1226 this.originalPageX = event.pageX; 1227 this.originalPageY = event.pageY; 1228 1229 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied 1230 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 1231 1232 //Set a containment if given in the options 1233 if(o.containment) 1234 this._setContainment(); 1235 1236 //Trigger event + callbacks 1237 if(this._trigger("start", event) === false) { 1238 this._clear(); 1239 return false; 1240 } 1241 1242 //Recache the helper size 1243 this._cacheHelperProportions(); 1244 1245 //Prepare the droppable offsets 1246 if ($.ui.ddmanager && !o.dropBehaviour) 1247 $.ui.ddmanager.prepareOffsets(this, event); 1248 1249 1250 this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position 1251 1252 //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) 1253 if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); 1254 1255 return true; 1256 }, 1257 1258 _mouseDrag: function(event, noPropagation) { 1259 1260 //Compute the helpers position 1261 this.position = this._generatePosition(event); 1262 this.positionAbs = this._convertPositionTo("absolute"); 1263 1264 //Call plugins and callbacks and use the resulting position if something is returned 1265 if (!noPropagation) { 1266 var ui = this._uiHash(); 1267 if(this._trigger('drag', event, ui) === false) { 1268 this._mouseUp({}); 1269 return false;
1270 } 1271 this.position = ui.position; 1272 } 1273 1274 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; 1275 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; 1276 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); 1277 1278 return false; 1279 }, 1280 1281 _mouseStop: function(event) { 1282 1283 //If we are using droppables, inform the manager about the drop 1284 var dropped = false; 1285 if ($.ui.ddmanager && !this.options.dropBehaviour) 1286 dropped = $.ui.ddmanager.drop(this, event); 1287 1288 //if a drop comes from outside (a sortable) 1289 if(this.dropped) { 1290 dropped = this.dropped; 1291 this.dropped = false; 1292 } 1293 1294 //if the original element is no longer in the DOM don't bother to continue (see #8269) 1295 var element = this.element[0], elementInDom = false; 1296 while ( element && (element = element.parentNode) ) { 1297 if (element == document ) { 1298 elementInDom = true; 1299 } 1300 } 1301 if ( !elementInDom && this.options.helper === "original" ) 1302 return false; 1303 1304 if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { 1305 var self = this; 1306 $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { 1307 if(self._trigger("stop", event) !== false) { 1308 self._clear(); 1309 } 1310 }); 1311 } else { 1312 if(this._trigger("stop", event) !== false) { 1313 this._clear(); 1314 } 1315 } 1316 1317 return false; 1318 }, 1319 1320 _mouseUp: function(event) { 1321 //Remove frame helpers 1322 $("div.ui-draggable-iframeFix").each(function() { 1323 this.parentNode.removeChild(this); 1324 }); 1325 1326 //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) 1327 if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); 1328 1329 return $.ui.mouse.prototype._mouseUp.call(this, event); 1330 }, 1331 1332 cancel: function() { 1333 1334 if(this.helper.is(".ui-draggable-dragging")) { 1335 this._mouseUp({}); 1336 } else { 1337 this._clear(); 1338 } 1339 1340 return this; 1341 1342 }, 1343 1344 _getHandle: function(event) { 1345 1346 var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; 1347 $(this.options.handle, this.element) 1348 .find("*") 1349 .andSelf() 1350 .each(function() { 1351 if(this == event.target) handle = true; 1352 }); 1353 1354 return handle; 1355 1356 }, 1357 1358 _createHelper: function(event) { 1359 1360 var o = this.options; 1361 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); 1362 1363 if(!helper.parents('body').length) 1364 helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); 1365 1366 if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) 1367 helper.css("position", "absolute"); 1368 1369 return helper; 1370 1371 }, 1372 1373 _adjustOffsetFromHelper: function(obj) { 1374 if (typeof obj == 'string') { 1375 obj = obj.split(' '); 1376 } 1377 if ($.isArray(obj)) { 1378 obj = {left: +obj[0], top: +obj[1] || 0}; 1379 } 1380 if ('left' in obj) { 1381 this.offset.click.left = obj.left + this.margins.left; 1382 } 1383 if ('right' in obj) { 1384 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 1385 } 1386 if ('top' in obj) { 1387 this.offset.click.top = obj.top + this.margins.top; 1388 } 1389 if ('bottom' in obj) { 1390 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 1391 } 1392 }, 1393 1394 _getParentOffset: function() { 1395 1396 //Get the offsetParent and cache its position 1397 this.offsetParent = this.helper.offsetParent(); 1398 var po = this.offsetParent.offset(); 1399 1400 // This is a special case where we need to modify a offset calculated on start, since the following happened: 1401 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 1402 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 1403 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 1404 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { 1405 po.left += this.scrollParent.scrollLeft(); 1406 po.top += this.scrollParent.scrollTop(); 1407 } 1408 1409 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information 1410 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix 1411 po = { top: 0, left: 0 }; 1412 1413 return { 1414 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),
141410) || 0), 1415 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 1416 }; 1417 1418 }, 1419 1420 _getRelativeOffset: function() { 1421 1422 if(this.cssPosition == "relative") { 1423 var p = this.element.position(); 1424 return { 1425 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 1426 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 1427 }; 1428 } else { 1429 return { top: 0, left: 0 }; 1430 } 1431 1432 }, 1433 1434 _cacheMargins: function() { 1435 this.margins = { 1436 left: (parseInt(this.element.css("marginLeft"),10) || 0), 1437 top: (parseInt(this.element.css("marginTop"),10) || 0), 1438 right: (parseInt(this.element.css("marginRight"),10) || 0), 1439 bottom: (parseInt(this.element.css("marginBottom"),10) || 0) 1440 }; 1441 }, 1442 1443 _cacheHelperProportions: function() { 1444 this.helperProportions = { 1445 width: this.helper.outerWidth(), 1446 height: this.helper.outerHeight() 1447 }; 1448 }, 1449 1450 _setContainment: function() { 1451 1452 var o = this.options; 1453 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 1454 if(o.containment == 'document' || o.containment == 'window') this.containment = [ 1455 o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 1456 o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 1457 (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, 1458 (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 1459 ]; 1460 1461 if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { 1462 var c = $(o.containment); 1463 var ce = c[0]; if(!ce) return; 1464 var co = c.offset(); 1465 var over = ($(ce).css("overflow") != 'hidden'); 1466 1467 this.containment = [ 1468 (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), 1469 (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
1470 (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 - this.margins.right, 1471 (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 - this.margins.bottom 1472 ]; 1473 this.relative_container = c; 1474 1475 } else if(o.containment.constructor == Array) { 1476 this.containment = o.containment; 1477 } 1478 1479 }, 1480 1481 _convertPositionTo: function(d, pos) { 1482 1483 if(!pos) pos = this.position; 1484 var mod = d == "absolute" ? 1 : -1; 1485 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 1486 1487 return { 1488 top: ( 1489 pos.top // The absolute mouse position 1490 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent 1491 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) 1492 - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 1493 ), 1494 left: ( 1495 pos.left // The absolute mouse position 1496 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent 1497 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) 1498 - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 1499 ) 1500 }; 1501 1502 }, 1503 1504 _generatePosition: function(event) { 1505 1506 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 1507 var pageX = event.pageX; 1508 var pageY = event.pageY; 1509 1510 /* 1511 * - Position constraining - 1512 * Constrain the position to a mix of grid, containment. 1513 */ 1514 1515 if(this.originalPosition) { //If we are not dragging yet, we won't check for options 1516 var containment; 1517 if(this.containment) { 1518 if (this.relative_container){ 1519 var co = this.relative_container.offset(); 1520 containment = [ this.containment[0] + co.left, 1521 this.containment[1] + co.top, 1522 this.containment[2] + co.left, 1523 this.containment[3] + co.top ]; 1524 } 1525 else { 1526 containment = this.containment; 1527 } 1528 1529 if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; 1530 if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; 1531 if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; 1532 if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; 1533 } 1534 1535 if(o.grid) { 1536 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) 1537 var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 1538 pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; 1539 1540 var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; 1541 pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; 1542 } 1543 1544 } 1545 1546 return { 1547 top: ( 1548 pageY // The absolute mouse position 1549 - this.offset.click.top // Click offset (relative to the element) 1550 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent 1551 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) 1552 + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 1553 ), 1554 left: ( 1555 pageX // The absolute mouse position 1556 - this.offset.click.left // Click offset (relative to the element) 1557 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent 1558 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) 1559 + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 1560 ) 1561 }; 1562 1563 }, 1564 1565 _clear: function() { 1566 this.helper.removeClass("ui-draggable-dragging"); 1567 if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); 1568 //if($.ui.ddmanager) $.ui.ddmanager.current = null; 1569 this.helper = null; 1570 this.cancelHelperRemoval = false;
1571 }, 1572 1573 // From now on bulk stuff - mainly helpers 1574 1575 _trigger: function(type, event, ui) { 1576 ui = ui || this._uiHash(); 1577 $.ui.plugin.call(this, type, [event, ui]); 1578 if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins 1579 return $.Widget.prototype._trigger.call(this, type, event, ui); 1580 }, 1581 1582 plugins: {}, 1583 1584 _uiHash: function(event) { 1585 return { 1586 helper: this.helper, 1587 position: this.position, 1588 originalPosition: this.originalPosition, 1589 offset: this.positionAbs 1590 }; 1591 } 1592 1593}); 1594 1595$.extend($.ui.draggable, { 1596 version: "1.8.24" 1597}); 1598 1599$.ui.plugin.add("draggable", "connectToSortable", { 1600 start: function(event, ui) { 1601 1602 var inst = $(this).data("draggable"), o = inst.options, 1603 uiSortable = $.extend({}, ui, { item: inst.element }); 1604 inst.sortables = []; 1605 $(o.connectToSortable).each(function() { 1606 var sortable = $.data(this, 'sortable'); 1607 if (sortable && !sortable.options.disabled) { 1608 inst.sortables.push({ 1609 instance: sortable, 1610 shouldRevert: sortable.options.revert 1611 }); 1612 sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). 1613 sortable._trigger("activate", event, uiSortable); 1614 } 1615 }); 1616 1617 }, 1618 stop: function(event, ui) { 1619 1620 //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper 1621 var inst = $(this).data("draggable"), 1622 uiSortable = $.extend({}, ui, { item: inst.element }); 1623 1624 $.each(inst.sortables, function() { 1625 if(this.instance.isOver) { 1626 1627 this.instance.isOver = 0; 1628 1629 inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance 1630 this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) 1631 1632 //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' 1633 if(this.shouldRevert) this.instance.options.revert = true; 1634 1635 //Trigger the stop of the sortable 1636 this.instance._mouseStop(event); 1637 1638 this.instance.options.helper = this.instance.options._helper; 1639 1640 //If the helper has been the original item, restore properties in the sortable 1641 if(inst.options.helper == 'original') 1642 this.instance.currentItem.css({ top: 'auto', left: 'auto' }); 1643 1644 } else { 1645 this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance 1646 this.instance._trigger("deactivate", event, uiSortable); 1647 } 1648 1649 }); 1650 1651 }, 1652 drag: function(event, ui) { 1653 1654 var inst = $(this).data("draggable"), self = this; 1655 1656 var checkPos = function(o) { 1657 var dyClick = this.offset.click.top, dxClick = this.offset.click.left; 1658 var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; 1659 var itemHeight = o.height, itemWidth = o.width; 1660 var itemTop = o.top, itemLeft = o.left; 1661 1662 return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); 1663 }; 1664 1665 $.each(inst.sortables, function(i) { 1666 1667 //Copy over some variables to allow calling the sortable's native _intersectsWith 1668 this.instance.positionAbs = inst.positionAbs; 1669 this.instance.helperProportions = inst.helperProportions; 1670 this.instance.offset.click = inst.offset.click; 1671 1672 if(this.instance._intersectsWith(this.instance.containerCache)) { 1673 1674 //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once 1675 if(!this.instance.isOver) { 1676 1677 this.instance.isOver = 1; 1678 //Now we fake the start of dragging for the sortable instance, 1679 //by cloning the list group item, appending it to the sortable and using it as inst.currentItem 1680 //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) 1681 this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); 1682 this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it 1683 this.instance.options.helper = function() { return ui.helper[0]; }; 1684 1685 event.target = this.instance.currentItem[0]; 1686 this.instance._mouseCapture(event, true); 1687 this.instance._mouseStart(event, true, true); 1688
1689 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes 1690 this.instance.offset.click.top = inst.offset.click.top; 1691 this.instance.offset.click.left = inst.offset.click.left; 1692 this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; 1693 this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; 1694 1695 inst._trigger("toSortable", event); 1696 inst.dropped = this.instance.element; //draggable revert needs that 1697 //hack so receive/update callbacks work (mostly) 1698 inst.currentItem = inst.element; 1699 this.instance.fromOutside = inst; 1700 1701 } 1702 1703 //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable 1704 if(this.instance.currentItem) this.instance._mouseDrag(event); 1705 1706 } else { 1707 1708 //If it doesn't intersect with the sortable, and it intersected before, 1709 //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval 1710 if(this.instance.isOver) { 1711 1712 this.instance.isOver = 0; 1713 this.instance.cancelHelperRemoval = true; 1714 1715 //Prevent reverting on this forced stop 1716 this.instance.options.revert = false; 1717 1718 // The out event needs to be triggered independently 1719 this.instance._trigger('out', event, this.instance._uiHash(this.instance)); 1720 1721 this.instance._mouseStop(event, true); 1722 this.instance.options.helper = this.instance.options._helper; 1723 1724 //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size 1725 this.instance.currentItem.remove(); 1726 if(this.instance.placeholder) this.instance.placeholder.remove(); 1727 1728 inst._trigger("fromSortable", event); 1729 inst.dropped = false; //draggable revert needs that 1730 } 1731 1732 }; 1733 1734 }); 1735 1736 } 1737}); 1738 1739$.ui.plugin.add("draggable", "cursor", { 1740 start: function(event, ui) { 1741 var t = $('body'), o = $(this).data('draggable').options; 1742 if (t.css("cursor")) o._cursor = t.css("cursor"); 1743 t.css("cursor", o.cursor); 1744 }, 1745 stop: function(event, ui) { 1746 var o = $(this).data('draggable').options; 1747 if (o._cursor) $('body').css("cursor", o._cursor); 1748 } 1749}); 1750 1751$.ui.plugin.add("draggable", "opacity", { 1752 start: function(event, ui) { 1753 var t = $(ui.helper), o = $(this).data('draggable').options; 1754 if(t.css("opacity")) o._opacity = t.css("opacity"); 1755 t.css('opacity', o.opacity); 1756 }, 1757 stop: function(event, ui) { 1758 var o = $(this).data('draggable').options; 1759 if(o._opacity) $(ui.helper).css('opacity', o._opacity); 1760 } 1761}); 1762 1763$.ui.plugin.add("draggable", "scroll", { 1764 start: function(event, ui) { 1765 var i = $(this).data("draggable"); 1766 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); 1767 }, 1768 drag: function(event, ui) { 1769 1770 var i = $(this).data("draggable"), o = i.options, scrolled = false; 1771 1772 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { 1773 1774 if(!o.axis || o.axis != 'x') { 1775 if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) 1776 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; 1777 else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) 1778 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; 1779 } 1780 1781 if(!o.axis || o.axis != 'y') { 1782 if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) 1783 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; 1784 else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) 1785 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; 1786 } 1787 1788 } else { 1789 1790 if(!o.axis || o.axis != 'x') { 1791 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) 1792 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 1793 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) 1794 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 1795 } 1796 1797 if(!o.axis || o.axis != 'y') { 1798 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) 1799 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 1800 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 1801 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 1802 } 1803 1804 } 1805 1806 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 1807 $.ui.ddmanager.prepareOffsets(i, event); 1808 1809 } 1810}); 1811 1812$.ui.plugin.add("draggable", "snap", { 1813 start: function(event, ui) { 1814 1815 var i = $(this).data("draggable"), o = i.options; 1816 i.snapElements = []; 1817 1818 $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { 1819 var $t = $(this); var $o = $t.offset(); 1820 if(this != i.element[0]) i.snapElements.push({ 1821 item: this, 1822 width: $t.outerWidth(), height: $t.outerHeight(), 1823 top: $o.top, left: $o.left 1824 }); 1825 }); 1826 1827 }, 1828 drag: function(event, ui) { 1829 1830 var inst = $(this).data("draggable"), o = inst.options; 1831 var d = o.snapTolerance; 1832 1833 var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 1834 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 1835 1836 for (var i = inst.snapElements.length - 1; i >= 0; i--){ 1837 1838 var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, 1839 t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; 1840 1841 //Yes, I know, this is insane ;) 1842 if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { 1843 if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 1844 inst.snapElements[i].snapping = false;
1845 continue; 1846 } 1847 1848 if(o.snapMode != 'inner') { 1849 var ts = Math.abs(t - y2) <= d; 1850 var bs = Math.abs(b - y1) <= d; 1851 var ls = Math.abs(l - x2) <= d; 1852 var rs = Math.abs(r - x1) <= d; 1853 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 1854 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; 1855 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; 1856 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; 1857 } 1858 1859 var first = (ts || bs || ls || rs); 1860 1861 if(o.snapMode != 'outer') { 1862 var ts = Math.abs(t - y1) <= d; 1863 var bs = Math.abs(b - y2) <= d; 1864 var ls = Math.abs(l - x1) <= d; 1865 var rs = Math.abs(r - x2) <= d; 1866 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; 1867 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 1868 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; 1869 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; 1870 } 1871 1872 if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) 1873 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 1874 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 1875 1876 }; 1877 1878 } 1879}); 1880 1881$.ui.plugin.add("draggable", "stack", { 1882 start: function(event, ui) { 1883 1884 var o = $(this).data("draggable").options; 1885 1886 var group = $.makeArray($(o.stack)).sort(function(a,b) { 1887 return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); 1888 }); 1889 if (!group.length) { return; } 1890 1891 var min = parseInt(group[0].style.zIndex) || 0; 1892 $(group).each(function(i) { 1893 this.style.zIndex = min + i; 1894 }); 1895 1896 this[0].style.zIndex = min + group.length; 1897 1898 } 1899}); 1900 1901$.ui.plugin.add("draggable", "zIndex", { 1902 start: function(event, ui) { 1903 var t = $(ui.helper), o = $(this).data("draggable").options; 1904 if(t.css("zIndex")) o._zIndex = t.css("zIndex"); 1905 t.css('zIndex', o.zIndex); 1906 }, 1907 stop: function(event, ui) { 1908 var o = $(this).data("draggable").options; 1909 if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); 1910 } 1911}); 1912 1913})(jQuery); 1914/*! 1915 * jQuery UI Droppable 1.8.24 1916 * 1917 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 1918 * Dual licensed under the MIT or GPL Version 2 licenses. 1919 * http://jquery.org/license 1920 * 1921 * http://docs.jquery.com/UI/Droppables 1922 * 1923 * Depends: 1924 * jquery.ui.core.js 1925 * jquery.ui.widget.js 1926 * jquery.ui.mouse.js 1927 * jquery.ui.draggable.js 1928 */ 1929(function( $, undefined ) { 1930 1931$.widget("ui.droppable", { 1932 widgetEventPrefix: "drop", 1933 options: { 1934 accept: '*', 1935 activeClass: false, 1936 addClasses: true, 1937 greedy: false, 1938 hoverClass: false, 1939 scope: 'default', 1940 tolerance: 'intersect' 1941 }, 1942 _create: function() { 1943 1944 var o = this.options, accept = o.accept; 1945 this.isover = 0; this.isout = 1; 1946 1947 this.accept = $.isFunction(accept) ? accept : function(d) { 1948 return d.is(accept); 1949 }; 1950 1951 //Store the droppable's proportions 1952 this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; 1953 1954 // Add the reference and positions to the manager 1955 $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; 1956 $.ui.ddmanager.droppables[o.scope].push(this); 1957 1958 (o.addClasses && this.element.addClass("ui-droppable")); 1959 1960 }, 1961 1962 destroy: function() { 1963 var drop = $.ui.ddmanager.droppables[this.options.scope]; 1964 for ( var i = 0; i < drop.length; i++ ) 1965 if ( drop[i] == this ) 1966 drop.splice(i, 1); 1967 1968 this.element 1969 .removeClass("ui-droppable ui-droppable-disabled") 1970 .removeData("droppable") 1971 .unbind(".droppable"); 1972 1973 return this; 1974 }, 1975 1976 _setOption: function(key, value) { 1977 1978 if(key == 'accept') { 1979 this.accept = $.isFunction(value) ? value : function(d) { 1980 return d.is(value); 1981 }; 1982 } 1983 $.Widget.prototype._setOption.apply(this, arguments); 1984 }, 1985 1986 _activate: function(event) { 1987 var draggable = $.ui.ddmanager.current; 1988 if(this.options.activeClass) this.element.addClass(this.options.activeClass); 1989 (draggable && this._trigger('activate', event, this.ui(draggable))); 1990 }, 1991 1992 _deactivate: function(event) { 1993 var draggable = $.ui.ddmanager.current; 1994 if(this.options.activeClass) this.element.removeClass(this.options.activeClass); 1995 (draggable && this._trigger('deactivate', event, this.ui(draggable))); 1996 }, 1997 1998 _over: function(event) { 1999 2000 var draggable = $.ui.ddmanager.current; 2001 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element 2002 2003 if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2004 if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); 2005 this._trigger('over', event, this.ui(draggable)); 2006 } 2007 2008 }, 2009 2010 _out: function(event) { 2011 2012 var draggable = $.ui.ddmanager.current; 2013 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element 2014 2015 if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2016 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); 2017 this._trigger('out', event, this.ui(draggable)); 2018 } 2019 2020 }, 2021 2022 _drop: function(event,custom) { 2023 2024 var draggable = custom || $.ui.ddmanager.current; 2025 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element 2026 2027 var childrenIntersection = false;
2028 this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { 2029 var inst = $.data(this, 'droppable'); 2030 if( 2031 inst.options.greedy 2032 && !inst.options.disabled 2033 && inst.options.scope == draggable.options.scope 2034 && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) 2035 && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) 2036 ) { childrenIntersection = true; return false; } 2037 }); 2038 if(childrenIntersection) return false; 2039 2040 if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2041 if(this.options.activeClass) this.element.removeClass(this.options.activeClass); 2042 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); 2043 this._trigger('drop', event, this.ui(draggable)); 2044 return this.element; 2045 } 2046 2047 return false; 2048 2049 }, 2050 2051 ui: function(c) { 2052 return { 2053 draggable: (c.currentItem || c.element), 2054 helper: c.helper, 2055 position: c.position, 2056 offset: c.positionAbs 2057 }; 2058 } 2059 2060}); 2061 2062$.extend($.ui.droppable, { 2063 version: "1.8.24" 2064}); 2065 2066$.ui.intersect = function(draggable, droppable, toleranceMode) { 2067 2068 if (!droppable.offset) return false; 2069 2070 var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, 2071 y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; 2072 var l = droppable.offset.left, r = l + droppable.proportions.width, 2073 t = droppable.offset.top, b = t + droppable.proportions.height; 2074 2075 switch (toleranceMode) { 2076 case 'fit': 2077 return (l <= x1 && x2 <= r 2078 && t <= y1 && y2 <= b); 2079 break; 2080 case 'intersect': 2081 return (l < x1 + (draggable.helperProportions.width / 2) // Right Half 2082 && x2 - (draggable.helperProportions.width / 2) < r // Left Half 2083 && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half 2084 && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half 2085 break; 2086 case 'pointer': 2087 var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), 2088 draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), 2089 isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); 2090 return isOver; 2091 break; 2092 case 'touch': 2093 return ( 2094 (y1 >= t && y1 <= b) || // Top edge touching 2095 (y2 >= t && y2 <= b) || // Bottom edge touching 2096 (y1 < t && y2 > b) // Surrounded vertically 2097 ) && ( 2098 (x1 >= l && x1 <= r) || // Left edge touching 2099 (x2 >= l && x2 <= r) || // Right edge touching 2100 (x1 < l && x2 > r) // Surrounded horizontally 2101 ); 2102 break; 2103 default: 2104 return false; 2105 break; 2106 } 2107 2108}; 2109 2110/* 2111 This manager tracks offsets of draggables and droppables 2112*/ 2113$.ui.ddmanager = { 2114 current: null, 2115 droppables: { 'default': [] }, 2116 prepareOffsets: function(t, event) { 2117 2118 var m = $.ui.ddmanager.droppables[t.options.scope] || []; 2119 var type = event ? event.type : null; // workaround for #2317 2120 var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); 2121 2122 droppablesLoop: for (var i = 0; i < m.length; i++) { 2123 2124 if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted 2125 for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item 2126 m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue 2127 2128 if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables 2129 2130 m[i].offset = m[i].element.offset(); 2131 m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; 2132 2133 } 2134 2135 }, 2136 drop: function(draggable, event) { 2137 2138 var dropped = false;
2139 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 2140 2141 if(!this.options) return; 2142 if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) 2143 dropped = this._drop.call(this, event) || dropped; 2144 2145 if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2146 this.isout = 1; this.isover = 0; 2147 this._deactivate.call(this, event); 2148 } 2149 2150 }); 2151 return dropped; 2152 2153 }, 2154 dragStart: function( draggable, event ) { 2155 //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) 2156 draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() { 2157 if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); 2158 }); 2159 }, 2160 drag: function(draggable, event) { 2161 2162 //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. 2163 if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); 2164 2165 //Run through all droppables and check their positions based on specific tolerance options 2166 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 2167 2168 if(this.options.disabled || this.greedyChild || !this.visible) return; 2169 var intersects = $.ui.intersect(draggable, this, this.options.tolerance); 2170 2171 var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); 2172 if(!c) return; 2173 2174 var parentInstance; 2175 if (this.options.greedy) { 2176 // find droppable parents with same scope 2177 var scope = this.options.scope; 2178 var parent = this.element.parents(':data(droppable)').filter(function () { 2179 return $.data(this, 'droppable').options.scope === scope; 2180 }); 2181 2182 if (parent.length) { 2183 parentInstance = $.data(parent[0], 'droppable'); 2184 parentInstance.greedyChild = (c == 'isover' ? 1 : 0); 2185 } 2186 } 2187 2188 // we just moved into a greedy child 2189 if (parentInstance && c == 'isover') { 2190 parentInstance['isover'] = 0; 2191 parentInstance['isout'] = 1; 2192 parentInstance._out.call(parentInstance, event); 2193 } 2194 2195 this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; 2196 this[c == "isover" ? "_over" : "_out"].call(this, event); 2197 2198 // we just moved out of a greedy child 2199 if (parentInstance && c == 'isout') { 2200 parentInstance['isout'] = 0; 2201 parentInstance['isover'] = 1; 2202 parentInstance._over.call(parentInstance, event); 2203 } 2204 }); 2205 2206 }, 2207 dragStop: function( draggable, event ) { 2208 draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" ); 2209 //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) 2210 if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); 2211 } 2212}; 2213 2214})(jQuery); 2215/*! 2216 * jQuery UI Resizable 1.8.24 2217 * 2218 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 2219 * Dual licensed under the MIT or GPL Version 2 licenses. 2220 * http://jquery.org/license 2221 * 2222 * http://docs.jquery.com/UI/Resizables 2223 * 2224 * Depends: 2225 * jquery.ui.core.js 2226 * jquery.ui.mouse.js 2227 * jquery.ui.widget.js 2228 */ 2229(function( $, undefined ) { 2230 2231$.widget("ui.resizable", $.ui.mouse, { 2232 widgetEventPrefix: "resize", 2233 options: { 2234 alsoResize: false, 2235 animate: false, 2236 animateDuration: "slow", 2237 animateEasing: "swing", 2238 aspectRatio: false, 2239 autoHide: false, 2240 containment: false, 2241 ghost: false, 2242 grid: false, 2243 handles: "e,s,se", 2244 helper: false, 2245 maxHeight: null, 2246 maxWidth: null, 2247 minHeight: 10, 2248 minWidth: 10, 2249 zIndex: 1000 2250 }, 2251 _create: function() { 2252 2253 var self = this, o = this.options; 2254 this.element.addClass("ui-resizable"); 2255 2256 $.extend(this, { 2257 _aspectRatio: !!(o.aspectRatio), 2258 aspectRatio: o.aspectRatio, 2259 originalElement: this.element, 2260 _proportionallyResizeElements: [], 2261 _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null 2262 }); 2263 2264 //Wrap the element if it cannot hold child nodes 2265 if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { 2266 2267 //Create a wrapper element and set the wrapper to the new current internal element 2268 this.element.wrap( 2269 $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ 2270 position: this.element.css('position'), 2271 width: this.element.outerWidth(), 2272 height: this.element.outerHeight(), 2273 top: this.element.css('top'), 2274 left: this.element.css('left') 2275 }) 2276 ); 2277 2278 //Overwrite the original this.element 2279 this.element = this.element.parent().data( 2280 "resizable", this.element.data('resizable') 2281 ); 2282 2283 this.elementIsWrapper = true; 2284 2285 //Move margins to the wrapper 2286 this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); 2287 this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); 2288 2289 //Prevent Safari textarea resize 2290 this.originalResizeStyle = this.originalElement.css('resize'); 2291 this.originalElement.css('resize', 'none'); 2292 2293 //Push the actual element to our proportionallyResize internal array 2294 this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); 2295 2296 // avoid IE jump (hard set the margin) 2297 this.originalElement.css({ margin: this.originalElement.css('margin') }); 2298 2299 // fix handlers offset 2300 this._proportionallyResize(); 2301 2302 } 2303 2304 this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); 2305 if(this.handles.constructor == String) { 2306 2307 if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; 2308 var n = this.handles.split(","); this.handles = {}; 2309 2310 for(var i = 0; i < n.length; i++) { 2311 2312 var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; 2313 var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); 2314 2315 // Apply zIndex to all handles - see #7960 2316 axis.css({ zIndex: o.zIndex }); 2317 2318 //TODO : What's going on here? 2319 if ('se' == handle) { 2320 axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); 2321 }; 2322 2323 //Insert into internal handles object and append to element 2324 this.handles[handle] = '.ui-resizable-'+handle; 2325 this.element.append(axis); 2326 } 2327 2328 } 2329 2330 this._renderAxis = function(target) { 2331 2332 target = target || this.element; 2333 2334 for(var i in this.handles) { 2335 2336 if(this.handles[i].constructor == String) 2337 this.handles[i] = $(this.handles[i], this.element).show(); 2338 2339 //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) 2340 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { 2341 2342 var axis = $(this.handles[i], this.element), padWrapper = 0; 2343 2344 //Checking the correct pad and border 2345 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); 2346 2347 //The padding type i have to apply... 2348 var padPos = [ 'padding',
2349 /ne|nw|n/.test(i) ? 'Top' : 2350 /se|sw|s/.test(i) ? 'Bottom' : 2351 /^e$/.test(i) ? 'Right' : 'Left' ].join(""); 2352 2353 target.css(padPos, padWrapper); 2354 2355 this._proportionallyResize(); 2356 2357 } 2358 2359 //TODO: What's that good for? There's not anything to be executed left 2360 if(!$(this.handles[i]).length) 2361 continue; 2362 2363 } 2364 }; 2365 2366 //TODO: make renderAxis a prototype function 2367 this._renderAxis(this.element); 2368 2369 this._handles = $('.ui-resizable-handle', this.element) 2370 .disableSelection(); 2371 2372 //Matching axis name 2373 this._handles.mouseover(function() { 2374 if (!self.resizing) { 2375 if (this.className) 2376 var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 2377 //Axis, default = se 2378 self.axis = axis && axis[1] ? axis[1] : 'se'; 2379 } 2380 }); 2381 2382 //If we want to auto hide the elements 2383 if (o.autoHide) { 2384 this._handles.hide(); 2385 $(this.element) 2386 .addClass("ui-resizable-autohide") 2387 .hover(function() { 2388 if (o.disabled) return; 2389 $(this).removeClass("ui-resizable-autohide"); 2390 self._handles.show(); 2391 }, 2392 function(){ 2393 if (o.disabled) return; 2394 if (!self.resizing) { 2395 $(this).addClass("ui-resizable-autohide"); 2396 self._handles.hide(); 2397 } 2398 }); 2399 } 2400 2401 //Initialize the mouse interaction 2402 this._mouseInit(); 2403 2404 }, 2405 2406 destroy: function() { 2407 2408 this._mouseDestroy(); 2409 2410 var _destroy = function(exp) { 2411 $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") 2412 .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); 2413 }; 2414 2415 //TODO: Unwrap at same DOM position 2416 if (this.elementIsWrapper) { 2417 _destroy(this.element); 2418 var wrapper = this.element; 2419 wrapper.after( 2420 this.originalElement.css({ 2421 position: wrapper.css('position'), 2422 width: wrapper.outerWidth(), 2423 height: wrapper.outerHeight(), 2424 top: wrapper.css('top'), 2425 left: wrapper.css('left') 2426 }) 2427 ).remove(); 2428 } 2429 2430 this.originalElement.css('resize', this.originalResizeStyle); 2431 _destroy(this.originalElement); 2432 2433 return this; 2434 }, 2435 2436 _mouseCapture: function(event) { 2437 var handle = false; 2438 for (var i in this.handles) { 2439 if ($(this.handles[i])[0] == event.target) { 2440 handle = true; 2441 } 2442 } 2443 2444 return !this.options.disabled && handle; 2445 }, 2446 2447 _mouseStart: function(event) { 2448 2449 var o = this.options, iniPos = this.element.position(), el = this.element; 2450 2451 this.resizing = true; 2452 this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; 2453 2454 // bugfix for http://dev.jquery.com/ticket/1749 2455 if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { 2456 el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); 2457 } 2458 2459 this._renderProxy(); 2460 2461 var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); 2462 2463 if (o.containment) { 2464 curleft += $(o.containment).scrollLeft() || 0; 2465 curtop += $(o.containment).scrollTop() || 0; 2466 } 2467 2468 //Store needed variables 2469 this.offset = this.helper.offset(); 2470 this.position = { left: curleft, top: curtop }; 2471 this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; 2472 this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; 2473 this.originalPosition = { left: curleft, top: curtop }; 2474 this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; 2475 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 2476 2477 //Aspect Ratio 2478 this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); 2479 2480 var cursor = $('.ui-resizable-' + this.axis).css('cursor'); 2481 $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); 2482 2483 el.addClass("ui-resizable-resizing"); 2484 this._propagate("start", event); 2485 return true; 2486 }, 2487 2488 _mouseDrag: function(event) { 2489 2490 //Increase performance, avoid regex 2491 var el = this.helper, o = this.options, props = {}, 2492 self = this, smp = this.originalMousePosition, a = this.axis; 2493 2494 var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; 2495 var trigger = this._change[a]; 2496 if (!trigger) return false;
2497 2498 // Calculate the attrs that will be change 2499 var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; 2500 2501 // Put this in the mouseDrag handler since the user can start pressing shift while resizing 2502 this._updateVirtualBoundaries(event.shiftKey); 2503 if (this._aspectRatio || event.shiftKey) 2504 data = this._updateRatio(data, event); 2505 2506 data = this._respectSize(data, event); 2507 2508 // plugins callbacks need to be called first 2509 this._propagate("resize", event); 2510 2511 el.css({ 2512 top: this.position.top + "px", left: this.position.left + "px", 2513 width: this.size.width + "px", height: this.size.height + "px" 2514 }); 2515 2516 if (!this._helper && this._proportionallyResizeElements.length) 2517 this._proportionallyResize(); 2518 2519 this._updateCache(data); 2520 2521 // calling the user callback at the end 2522 this._trigger('resize', event, this.ui()); 2523 2524 return false; 2525 }, 2526 2527 _mouseStop: function(event) { 2528 2529 this.resizing = false; 2530 var o = this.options, self = this; 2531 2532 if(this._helper) { 2533 var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), 2534 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, 2535 soffsetw = ista ? 0 : self.sizeDiff.width; 2536 2537 var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, 2538 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 2539 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; 2540 2541 if (!o.animate) 2542 this.element.css($.extend(s, { top: top, left: left })); 2543 2544 self.helper.height(self.size.height); 2545 self.helper.width(self.size.width); 2546 2547 if (this._helper && !o.animate) this._proportionallyResize(); 2548 } 2549 2550 $('body').css('cursor', 'auto'); 2551 2552 this.element.removeClass("ui-resizable-resizing"); 2553 2554 this._propagate("stop", event); 2555 2556 if (this._helper) this.helper.remove(); 2557 return false; 2558 2559 }, 2560 2561 _updateVirtualBoundaries: function(forceAspectRatio) { 2562 var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; 2563 2564 b = { 2565 minWidth: isNumber(o.minWidth) ? o.minWidth : 0, 2566 maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, 2567 minHeight: isNumber(o.minHeight) ? o.minHeight : 0, 2568 maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity 2569 }; 2570 2571 if(this._aspectRatio || forceAspectRatio) { 2572 // We want to create an enclosing box whose aspect ration is the requested one 2573 // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension 2574 pMinWidth = b.minHeight * this.aspectRatio; 2575 pMinHeight = b.minWidth / this.aspectRatio; 2576 pMaxWidth = b.maxHeight * this.aspectRatio; 2577 pMaxHeight = b.maxWidth / this.aspectRatio; 2578 2579 if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; 2580 if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; 2581 if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; 2582 if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; 2583 } 2584 this._vBoundaries = b; 2585 }, 2586 2587 _updateCache: function(data) { 2588 var o = this.options; 2589 this.offset = this.helper.offset(); 2590 if (isNumber(data.left)) this.position.left = data.left; 2591 if (isNumber(data.top)) this.position.top = data.top; 2592 if (isNumber(data.height)) this.size.height = data.height; 2593 if (isNumber(data.width)) this.size.width = data.width; 2594 }, 2595 2596 _updateRatio: function(data, event) { 2597 2598 var o = this.options, cpos = this.position, csize = this.size, a = this.axis; 2599 2600 if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); 2601 else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); 2602 2603 if (a == 'sw') { 2604 data.left = cpos.left + (csize.width - data.width); 2605 data.top = null; 2606 } 2607 if (a == 'nw') { 2608 data.top = cpos.top + (csize.height - data.height); 2609 data.left = cpos.left + (csize.width - data.width); 2610 } 2611 2612 return data; 2613 }, 2614 2615 _respectSize: function(data, event) { 2616 2617 var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, 2618 ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 2619 isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); 2620 2621 if (isminw) data.width = o.minWidth; 2622 if (isminh) data.height = o.minHeight; 2623 if (ismaxw) data.width = o.maxWidth; 2624 if (ismaxh) data.height = o.maxHeight; 2625 2626 var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; 2627 var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 2628 2629 if (isminw && cw) data.left = dw - o.minWidth; 2630 if (ismaxw && cw) data.left = dw - o.maxWidth; 2631 if (isminh && ch) data.top = dh - o.minHeight; 2632 if (ismaxh && ch) data.top = dh - o.maxHeight; 2633 2634 // fixing jump error on top/left - bug #2330 2635 var isNotwh = !data.width && !data.height; 2636 if (isNotwh && !data.left && data.top) data.top = null; 2637 else if (isNotwh && !data.top && data.left) data.left = null; 2638 2639 return data; 2640 }, 2641 2642 _proportionallyResize: function() { 2643 2644 var o = this.options; 2645 if (!this._proportionallyResizeElements.length) return; 2646 var element = this.helper || this.element; 2647 2648 for (var i=0; i < this._proportionallyResizeElements.length; i++) { 2649 2650 var prel = this._proportionallyResizeElements[i]; 2651 2652 if (!this.borderDif) { 2653 var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], 2654 p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; 2655 2656 this.borderDif = $.map(b, function(v, i) { 2657 var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; 2658 return border + padding; 2659 }); 2660 } 2661 2662 if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) 2663 continue; 2664 2665 prel.css({ 2666 height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, 2667 width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 2668 }); 2669 2670 }; 2671 2672 }, 2673 2674 _renderProxy: function() { 2675 2676 var el = this.element, o = this.options; 2677 this.elementOffset = el.offset(); 2678 2679 if(this._helper) { 2680 2681 this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); 2682 2683 // fix ie6 offset TODO: This seems broken 2684 var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), 2685 pxyoffset = ( ie6 ? 2 : -1 ); 2686 2687 this.helper.addClass(this._helper).css({ 2688 width: this.element.outerWidth() + pxyoffset, 2689 height: this.element.outerHeight() + pxyoffset, 2690 position: 'absolute', 2691 left: this.elementOffset.left - ie6offset +'px', 2692 top: this.elementOffset.top - ie6offset +'px', 2693 zIndex: ++o.zIndex //TODO: Don't modify option 2694 }); 2695 2696 this.helper 2697 .appendTo("body") 2698 .disableSelection(); 2699 2700 } else { 2701 this.helper = this.element; 2702 } 2703 2704 }, 2705 2706 _change: { 2707 e: function(event, dx, dy) { 2708 return { width: this.originalSize.width + dx }; 2709 }, 2710 w: function(event, dx, dy) { 2711 var o = this.options, cs = this.originalSize, sp = this.originalPosition; 2712 return { left: sp.left + dx, width: cs.width - dx }; 2713 }, 2714 n: function(event, dx, dy) { 2715 var o = this.options, cs = this.originalSize, sp = this.originalPosition; 2716 return { top: sp.top + dy, height: cs.height - dy }; 2717 }, 2718 s: function(event, dx, dy) { 2719 return { height: this.originalSize.height + dy }; 2720 }, 2721 se: function(event, dx, dy) { 2722 return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); 2723 }, 2724 sw: function(event, dx, dy) { 2725 return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); 2726 }, 2727 ne: function(event, dx, dy) { 2728 return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); 2729 }, 2730 nw: function(event, dx, dy) { 2731 return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); 2732 } 2733 }, 2734 2735 _propagate: function(n, event) { 2736 $.ui.plugin.call(this, n, [event, this.ui()]); 2737 (n != "resize" && this._trigger(n, event, this.ui())); 2738 }, 2739 2740 plugins: {}, 2741 2742 ui: function() { 2743 return { 2744 originalElement: this.originalElement, 2745 element: this.element, 2746 helper: this.helper, 2747 position: this.position, 2748 size: this.size, 2749 originalSize: this.originalSize, 2750 originalPosition: this.originalPosition 2751 }; 2752 } 2753 2754}); 2755 2756$.extend($.ui.resizable, { 2757 version: "1.8.24" 2758}); 2759 2760/* 2761 * Resizable Extensions 2762 */ 2763 2764$.ui.plugin.add("resizable", "alsoResize", { 2765 2766 start: function (event, ui) { 2767 var self = $(this).data("resizable"), o = self.options; 2768 2769 var _store = function (exp) { 2770 $(exp).each(function() { 2771 var el = $(this); 2772 el.data("resizable-alsoresize", { 2773 width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), 2774 left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) 2775 }); 2776 }); 2777 }; 2778 2779 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { 2780 if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } 2781 else { $.each(o.alsoResize, function (exp) { _store(exp); }); } 2782 }else{ 2783 _store(o.alsoResize); 2784 } 2785 }, 2786 2787 resize: function (event, ui) { 2788 var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; 2789 2790 var delta = { 2791 height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, 2792 top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 2793 }, 2794 2795 _alsoResize = function (exp, c) { 2796 $(exp).each(function() { 2797 var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, 2798 css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; 2799
2800 $.each(css, function (i, prop) { 2801 var sum = (start[prop]||0) + (delta[prop]||0); 2802 if (sum && sum >= 0) 2803 style[prop] = sum || null; 2804 }); 2805 2806 el.css(style); 2807 }); 2808 }; 2809 2810 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { 2811 $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); 2812 }else{ 2813 _alsoResize(o.alsoResize); 2814 } 2815 }, 2816 2817 stop: function (event, ui) { 2818 $(this).removeData("resizable-alsoresize"); 2819 } 2820}); 2821 2822$.ui.plugin.add("resizable", "animate", { 2823 2824 stop: function(event, ui) { 2825 var self = $(this).data("resizable"), o = self.options; 2826 2827 var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), 2828 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, 2829 soffsetw = ista ? 0 : self.sizeDiff.width; 2830 2831 var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, 2832 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 2833 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; 2834 2835 self.element.animate( 2836 $.extend(style, top && left ? { top: top, left: left } : {}), { 2837 duration: o.animateDuration, 2838 easing: o.animateEasing, 2839 step: function() { 2840 2841 var data = { 2842 width: parseInt(self.element.css('width'), 10), 2843 height: parseInt(self.element.css('height'), 10), 2844 top: parseInt(self.element.css('top'), 10), 2845 left: parseInt(self.element.css('left'), 10) 2846 }; 2847 2848 if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); 2849 2850 // propagating resize, and updating values for each animation step 2851 self._updateCache(data); 2852 self._propagate("resize", event); 2853 2854 } 2855 } 2856 ); 2857 } 2858 2859}); 2860 2861$.ui.plugin.add("resizable", "containment", { 2862 2863 start: function(event, ui) { 2864 var self = $(this).data("resizable"), o = self.options, el = self.element; 2865 var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; 2866 if (!ce) return; 2867 2868 self.containerElement = $(ce); 2869 2870 if (/document/.test(oc) || oc == document) { 2871 self.containerOffset = { left: 0, top: 0 }; 2872 self.containerPosition = { left: 0, top: 0 }; 2873 2874 self.parentData = { 2875 element: $(document), left: 0, top: 0, 2876 width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight 2877 }; 2878 } 2879 2880 // i'm a node, so compute top, left, right, bottom 2881 else { 2882 var element = $(ce), p = []; 2883 $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); 2884 2885 self.containerOffset = element.offset(); 2886 self.containerPosition = element.position(); 2887 self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; 2888 2889 var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, 2890 width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); 2891 2892 self.parentData = { 2893 element: ce, left: co.left, top: co.top, width: width, height: height 2894 }; 2895 } 2896 }, 2897 2898 resize: function(event, ui) { 2899 var self = $(this).data("resizable"), o = self.options, 2900 ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, 2901 pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; 2902 2903 if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; 2904 2905 if (cp.left < (self._helper ? co.left : 0)) { 2906 self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); 2907 if (pRatio) self.size.height = self.size.width / self.aspectRatio; 2908 self.position.left = o.helper ? co.left : 0; 2909 } 2910 2911 if (cp.top < (self._helper ? co.top : 0)) { 2912 self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); 2913 if (pRatio) self.size.width = self.size.height * self.aspectRatio; 2914 self.position.top = self._helper ? co.top : 0; 2915 } 2916 2917 self.offset.left = self.parentData.left+self.position.left; 2918 self.offset.top = self.parentData.top+self.position.top; 2919 2920 var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), 2921 hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); 2922 2923 var isParent = self.containerElement.get(0) == self.element.parent().get(0), 2924 isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); 2925 2926 if(isParent && isOffsetRelative) woset -= self.parentData.left; 2927 2928 if (woset + self.size.width >= self.parentData.width) { 2929 self.size.width = self.parentData.width - woset; 2930 if (pRatio) self.size.height = self.size.width / self.aspectRatio; 2931 } 2932 2933 if (hoset + self.size.height >= self.parentData.height) { 2934 self.size.height = self.parentData.height - hoset; 2935 if (pRatio) self.size.width = self.size.height * self.aspectRatio; 2936 } 2937 }, 2938 2939 stop: function(event, ui){ 2940 var self = $(this).data("resizable"), o = self.options, cp = self.position, 2941 co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; 2942 2943 var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; 2944
2945 if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) 2946 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); 2947 2948 if (self._helper && !o.animate && (/static/).test(ce.css('position'))) 2949 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); 2950 2951 } 2952}); 2953 2954$.ui.plugin.add("resizable", "ghost", { 2955 2956 start: function(event, ui) { 2957 2958 var self = $(this).data("resizable"), o = self.options, cs = self.size; 2959 2960 self.ghost = self.originalElement.clone(); 2961 self.ghost 2962 .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) 2963 .addClass('ui-resizable-ghost') 2964 .addClass(typeof o.ghost == 'string' ? o.ghost : ''); 2965 2966 self.ghost.appendTo(self.helper); 2967 2968 }, 2969 2970 resize: function(event, ui){ 2971 var self = $(this).data("resizable"), o = self.options; 2972 if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); 2973 }, 2974 2975 stop: function(event, ui){ 2976 var self = $(this).data("resizable"), o = self.options; 2977 if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); 2978 } 2979 2980}); 2981 2982$.ui.plugin.add("resizable", "grid", { 2983 2984 resize: function(event, ui) { 2985 var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; 2986 o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; 2987 var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); 2988 2989 if (/^(se|s|e)$/.test(a)) { 2990 self.size.width = os.width + ox; 2991 self.size.height = os.height + oy; 2992 } 2993 else if (/^(ne)$/.test(a)) { 2994 self.size.width = os.width + ox; 2995 self.size.height = os.height + oy; 2996 self.position.top = op.top - oy; 2997 } 2998 else if (/^(sw)$/.test(a)) { 2999 self.size.width = os.width + ox; 3000 self.size.height = os.height + oy; 3001 self.position.left = op.left - ox; 3002 } 3003 else { 3004 self.size.width = os.width + ox; 3005 self.size.height = os.height + oy; 3006 self.position.top = op.top - oy; 3007 self.position.left = op.left - ox; 3008 } 3009 } 3010 3011}); 3012 3013var num = function(v) { 3014 return parseInt(v, 10) || 0; 3015}; 3016 3017var isNumber = function(value) { 3018 return !isNaN(parseInt(value, 10)); 3019}; 3020 3021})(jQuery); 3022/*! 3023 * jQuery UI Selectable 1.8.24 3024 * 3025 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 3026 * Dual licensed under the MIT or GPL Version 2 licenses. 3027 * http://jquery.org/license 3028 * 3029 * http://docs.jquery.com/UI/Selectables 3030 * 3031 * Depends: 3032 * jquery.ui.core.js 3033 * jquery.ui.mouse.js 3034 * jquery.ui.widget.js 3035 */ 3036(function( $, undefined ) { 3037 3038$.widget("ui.selectable", $.ui.mouse, { 3039 options: { 3040 appendTo: 'body', 3041 autoRefresh: true, 3042 distance: 0, 3043 filter: '*', 3044 tolerance: 'touch' 3045 }, 3046 _create: function() { 3047 var self = this; 3048 3049 this.element.addClass("ui-selectable"); 3050 3051 this.dragged = false; 3052 3053 // cache selectee children based on filter 3054 var selectees; 3055 this.refresh = function() { 3056 selectees = $(self.options.filter, self.element[0]); 3057 selectees.addClass("ui-selectee"); 3058 selectees.each(function() { 3059 var $this = $(this); 3060 var pos = $this.offset(); 3061 $.data(this, "selectable-item", { 3062 element: this, 3063 $element: $this, 3064 left: pos.left, 3065 top: pos.top, 3066 right: pos.left + $this.outerWidth(), 3067 bottom: pos.top + $this.outerHeight(), 3068 startselected: false, 3069 selected: $this.hasClass('ui-selected'), 3070 selecting: $this.hasClass('ui-selecting'), 3071 unselecting: $this.hasClass('ui-unselecting') 3072 }); 3073 }); 3074 }; 3075 this.refresh(); 3076 3077 this.selectees = selectees.addClass("ui-selectee"); 3078 3079 this._mouseInit(); 3080 3081 this.helper = $("<div class='ui-selectable-helper'></div>"); 3082 }, 3083 3084 destroy: function() { 3085 this.selectees 3086 .removeClass("ui-selectee") 3087 .removeData("selectable-item"); 3088 this.element 3089 .removeClass("ui-selectable ui-selectable-disabled") 3090 .removeData("selectable") 3091 .unbind(".selectable"); 3092 this._mouseDestroy(); 3093 3094 return this; 3095 }, 3096 3097 _mouseStart: function(event) { 3098 var self = this; 3099 3100 this.opos = [event.pageX, event.pageY]; 3101 3102 if (this.options.disabled) 3103 return; 3104 3105 var options = this.options; 3106 3107 this.selectees = $(options.filter, this.element[0]); 3108 3109 this._trigger("start", event); 3110 3111 $(options.appendTo).append(this.helper); 3112 // position helper (lasso) 3113 this.helper.css({ 3114 "left": event.clientX, 3115 "top": event.clientY, 3116 "width": 0, 3117 "height": 0 3118 }); 3119 3120 if (options.autoRefresh) { 3121 this.refresh(); 3122 } 3123 3124 this.selectees.filter('.ui-selected').each(function() { 3125 var selectee = $.data(this, "selectable-item"); 3126 selectee.startselected = true; 3127 if (!event.metaKey && !event.ctrlKey) { 3128 selectee.$element.removeClass('ui-selected'); 3129 selectee.selected = false;
vendor: 4,195 bytes, lines 3130-3268
3130 selectee.$element.addClass('ui-unselecting'); 3131 selectee.unselecting = true; 3132 // selectable UNSELECTING callback 3133 self._trigger("unselecting", event, { 3134 unselecting: selectee.element 3135 }); 3136 } 3137 }); 3138 3139 $(event.target).parents().andSelf().each(function() { 3140 var selectee = $.data(this, "selectable-item"); 3141 if (selectee) { 3142 var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); 3143 selectee.$element 3144 .removeClass(doSelect ? "ui-unselecting" : "ui-selected") 3145 .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); 3146 selectee.unselecting = !doSelect; 3147 selectee.selecting = doSelect; 3148 selectee.selected = doSelect; 3149 // selectable (UN)SELECTING callback 3150 if (doSelect) { 3151 self._trigger("selecting", event, { 3152 selecting: selectee.element 3153 }); 3154 } else { 3155 self._trigger("unselecting", event, { 3156 unselecting: selectee.element 3157 }); 3158 } 3159 return false; 3160 } 3161 }); 3162 3163 }, 3164 3165 _mouseDrag: function(event) { 3166 var self = this; 3167 this.dragged = true; 3168 3169 if (this.options.disabled) 3170 return; 3171 3172 var options = this.options; 3173 3174 var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; 3175 if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } 3176 if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } 3177 this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); 3178 3179 this.selectees.each(function() { 3180 var selectee = $.data(this, "selectable-item"); 3181 //prevent helper from being selected if appendTo: selectable 3182 if (!selectee || selectee.element == self.element[0]) 3183 return; 3184 var hit = false; 3185 if (options.tolerance == 'touch') { 3186 hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); 3187 } else if (options.tolerance == 'fit') { 3188 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); 3189 } 3190 3191 if (hit) { 3192 // SELECT 3193 if (selectee.selected) { 3194 selectee.$element.removeClass('ui-selected'); 3195 selectee.selected = false; 3196 } 3197 if (selectee.unselecting) { 3198 selectee.$element.removeClass('ui-unselecting'); 3199 selectee.unselecting = false; 3200 } 3201 if (!selectee.selecting) { 3202 selectee.$element.addClass('ui-selecting'); 3203 selectee.selecting = true; 3204 // selectable SELECTING callback 3205 self._trigger("selecting", event, { 3206 selecting: selectee.element 3207 }); 3208 } 3209 } else { 3210 // UNSELECT 3211 if (selectee.selecting) { 3212 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 3213 selectee.$element.removeClass('ui-selecting'); 3214 selectee.selecting = false; 3215 selectee.$element.addClass('ui-selected'); 3216 selectee.selected = true; 3217 } else { 3218 selectee.$element.removeClass('ui-selecting'); 3219 selectee.selecting = false; 3220 if (selectee.startselected) { 3221 selectee.$element.addClass('ui-unselecting'); 3222 selectee.unselecting = true; 3223 } 3224 // selectable UNSELECTING callback 3225 self._trigger("unselecting", event, { 3226 unselecting: selectee.element 3227 }); 3228 } 3229 } 3230 if (selectee.selected) { 3231 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 3232 selectee.$element.removeClass('ui-selected'); 3233 selectee.selected = false; 3234 3235 selectee.$element.addClass('ui-unselecting'); 3236 selectee.unselecting = true; 3237 // selectable UNSELECTING callback 3238 self._trigger("unselecting", event, { 3239 unselecting: selectee.element 3240 }); 3241 } 3242 } 3243 } 3244 }); 3245 3246 return false; 3247 }, 3248 3249 _mouseStop: function(event) { 3250 var self = this; 3251 3252 this.dragged = false; 3253 3254 var options = this.options; 3255 3256 $('.ui-unselecting', this.element[0]).each(function() { 3257 var selectee = $.data(this, "selectable-item"); 3258 selectee.$element.removeClass('ui-unselecting'); 3259 selectee.unselecting = false; 3260 selectee.startselected = false; 3261 self._trigger("unselected", event, { 3262 unselected: selectee.element 3263 }); 3264 }); 3265 $('.ui-selecting', this.element[0]).each(function() { 3266 var selectee = $.data(this, "selectable-item"); 3267 selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); 3268 selectee.selecting = false;
3269 selectee.selected = true; 3270 selectee.startselected = true; 3271 self._trigger("selected", event, { 3272 selected: selectee.element 3273 }); 3274 }); 3275 this._trigger("stop", event); 3276 3277 this.helper.remove(); 3278 3279 return false; 3280 } 3281 3282}); 3283 3284$.extend($.ui.selectable, { 3285 version: "1.8.24" 3286}); 3287 3288})(jQuery); 3289/*! 3290 * jQuery UI Sortable 1.8.24 3291 * 3292 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 3293 * Dual licensed under the MIT or GPL Version 2 licenses. 3294 * http://jquery.org/license 3295 * 3296 * http://docs.jquery.com/UI/Sortables 3297 * 3298 * Depends: 3299 * jquery.ui.core.js 3300 * jquery.ui.mouse.js 3301 * jquery.ui.widget.js 3302 */ 3303(function( $, undefined ) { 3304 3305$.widget("ui.sortable", $.ui.mouse, { 3306 widgetEventPrefix: "sort", 3307 ready: false, 3308 options: { 3309 appendTo: "parent", 3310 axis: false, 3311 connectWith: false, 3312 containment: false, 3313 cursor: 'auto', 3314 cursorAt: false, 3315 dropOnEmpty: true, 3316 forcePlaceholderSize: false, 3317 forceHelperSize: false, 3318 grid: false, 3319 handle: false, 3320 helper: "original", 3321 items: '> *', 3322 opacity: false, 3323 placeholder: false, 3324 revert: false, 3325 scroll: true, 3326 scrollSensitivity: 20, 3327 scrollSpeed: 20, 3328 scope: "default", 3329 tolerance: "intersect", 3330 zIndex: 1000 3331 }, 3332 _create: function() { 3333 3334 var o = this.options; 3335 this.containerCache = {}; 3336 this.element.addClass("ui-sortable"); 3337 3338 //Get the items 3339 this.refresh(); 3340 3341 //Let's determine if the items are being displayed horizontally 3342 this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; 3343 3344 //Let's determine the parent's offset 3345 this.offset = this.element.offset(); 3346 3347 //Initialize mouse events for interaction 3348 this._mouseInit(); 3349 3350 //We're ready to go 3351 this.ready = true 3352 3353 }, 3354 3355 destroy: function() { 3356 $.Widget.prototype.destroy.call( this ); 3357 this.element 3358 .removeClass("ui-sortable ui-sortable-disabled"); 3359 this._mouseDestroy(); 3360 3361 for ( var i = this.items.length - 1; i >= 0; i-- ) 3362 this.items[i].item.removeData(this.widgetName + "-item"); 3363 3364 return this; 3365 }, 3366 3367 _setOption: function(key, value){ 3368 if ( key === "disabled" ) { 3369 this.options[ key ] = value; 3370 3371 this.widget() 3372 [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" ); 3373 } else { 3374 // Don't call widget base _setOption for disable as it adds ui-state-disabled class 3375 $.Widget.prototype._setOption.apply(this, arguments); 3376 } 3377 }, 3378 3379 _mouseCapture: function(event, overrideHandle) { 3380 var that = this; 3381 3382 if (this.reverting) { 3383 return false; 3384 } 3385 3386 if(this.options.disabled || this.options.type == 'static') return false; 3387 3388 //We have to refresh the items data once first 3389 this._refreshItems(event); 3390 3391 //Find out if the clicked node (or one of its parents) is a actual item in this.items 3392 var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { 3393 if($.data(this, that.widgetName + '-item') == self) { 3394 currentItem = $(this); 3395 return false; 3396 } 3397 }); 3398 if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target); 3399 3400 if(!currentItem) return false; 3401 if(this.options.handle && !overrideHandle) { 3402 var validHandle = false; 3403 3404 $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); 3405 if(!validHandle) return false; 3406 } 3407 3408 this.currentItem = currentItem; 3409 this._removeCurrentsFromItems(); 3410 return true; 3411 3412 }, 3413 3414 _mouseStart: function(event, overrideHandle, noActivation) { 3415 3416 var o = this.options, self = this; 3417 this.currentContainer = this; 3418 3419 //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture 3420 this.refreshPositions(); 3421 3422 //Create and append the visible helper 3423 this.helper = this._createHelper(event); 3424 3425 //Cache the helper size 3426 this._cacheHelperProportions(); 3427 3428 /* 3429 * - Position generation - 3430 * This block generates everything position related - it's the core of draggables. 3431 */ 3432 3433 //Cache the margins of the original element 3434 this._cacheMargins(); 3435 3436 //Get the next scrolling parent 3437 this.scrollParent = this.helper.scrollParent(); 3438 3439 //The element's absolute position on the page minus margins 3440 this.offset = this.currentItem.offset(); 3441 this.offset = { 3442 top: this.offset.top - this.margins.top, 3443 left: this.offset.left - this.margins.left 3444 }; 3445 3446 $.extend(this.offset, { 3447 click: { //Where the click happened, relative to the element 3448 left: event.pageX - this.offset.left, 3449 top: event.pageY - this.offset.top 3450 }, 3451 parent: this._getParentOffset(), 3452 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 3453 }); 3454 3455 // Only after we got the offset, we can change the helper's position to absolute 3456 // TODO: Still need to figure out a way to make relative sorting possible 3457 this.helper.css("position", "absolute"); 3458 this.cssPosition = this.helper.css("position"); 3459 3460 //Generate the original position 3461 this.originalPosition = this._generatePosition(event); 3462 this.originalPageX = event.pageX; 3463 this.originalPageY = event.pageY; 3464 3465 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied 3466 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 3467 3468 //Cache the former DOM position 3469 this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; 3470 3471 //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 3472 if(this.helper[0] != this.currentItem[0]) { 3473 this.currentItem.hide(); 3474 } 3475 3476 //Create the placeholder 3477 this._createPlaceholder(); 3478 3479 //Set a containment if given in the options 3480 if(o.containment) 3481 this._setContainment(); 3482 3483 if(o.cursor) { // cursor option 3484 if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); 3485 $('body').css("cursor", o.cursor); 3486 } 3487 3488 if(o.opacity) { // opacity option 3489 if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); 3490 this.helper.css("opacity", o.opacity); 3491 } 3492 3493 if(o.zIndex) { // zIndex option 3494 if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); 3495 this.helper.css("zIndex", o.zIndex); 3496 } 3497 3498 //Prepare scrolling 3499 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') 3500 this.overflowOffset = this.scrollParent.offset(); 3501 3502 //Call callbacks 3503 this._trigger("start", event, this._uiHash()); 3504 3505 //Recache the helper size 3506 if(!this._preserveHelperProportions) 3507 this._cacheHelperProportions(); 3508 3509 3510 //Post 'activate' events to possible containers 3511 if(!noActivation) { 3512 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); } 3513 } 3514 3515 //Prepare possible droppables 3516 if($.ui.ddmanager) 3517 $.ui.ddmanager.current = this; 3518 3519 if ($.ui.ddmanager && !o.dropBehaviour) 3520 $.ui.ddmanager.prepareOffsets(this, event); 3521 3522 this.dragging = true; 3523 3524 this.helper.addClass("ui-sortable-helper"); 3525 this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position 3526 return true; 3527 3528 }, 3529 3530 _mouseDrag: function(event) { 3531 3532 //Compute the helpers position 3533 this.position = this._generatePosition(event); 3534 this.positionAbs = this._convertPositionTo("absolute"); 3535 3536 if (!this.lastPositionAbs) { 3537 this.lastPositionAbs = this.positionAbs; 3538 } 3539 3540 //Do scrolling 3541 if(this.options.scroll) { 3542 var o = this.options, scrolled = false;
3543 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { 3544 3545 if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) 3546 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 3547 else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) 3548 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 3549 3550 if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) 3551 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; 3552 else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) 3553 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; 3554 3555 } else { 3556 3557 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) 3558 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 3559 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) 3560 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 3561 3562 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) 3563 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 3564 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 3565 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 3566 3567 } 3568 3569 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 3570 $.ui.ddmanager.prepareOffsets(this, event); 3571 } 3572 3573 //Regenerate the absolute position used for position checks 3574 this.positionAbs = this._convertPositionTo("absolute"); 3575 3576 //Set the helper position 3577 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; 3578 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; 3579 3580 //Rearrange 3581 for (var i = this.items.length - 1; i >= 0; i--) { 3582 3583 //Cache variables and intersection, continue if no intersection 3584 var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); 3585 if (!intersection) continue; 3586 3587 // Only put the placeholder inside the current Container, skip all 3588 // items form other containers. This works because when moving 3589 // an item from one container to another the 3590 // currentContainer is switched before the placeholder is moved. 3591 // 3592 // Without this moving items in "sub-sortables" can cause the placeholder to jitter 3593 // beetween the outer and inner container. 3594 if (item.instance !== this.currentContainer) continue; 3595 3596 if (itemElement != this.currentItem[0] //cannot intersect with itself 3597 && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before 3598 && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked 3599 && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) 3600 //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container 3601 ) { 3602 3603 this.direction = intersection == 1 ? "down" : "up"; 3604 3605 if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { 3606 this._rearrange(event, item); 3607 } else { 3608 break; 3609 } 3610 3611 this._trigger("change", event, this._uiHash()); 3612 break; 3613 } 3614 } 3615 3616 //Post events to containers 3617 this._contactContainers(event); 3618 3619 //Interconnect with droppables 3620 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); 3621 3622 //Call callbacks 3623 this._trigger('sort', event, this._uiHash()); 3624 3625 this.lastPositionAbs = this.positionAbs; 3626 return false; 3627 3628 }, 3629 3630 _mouseStop: function(event, noPropagation) { 3631 3632 if(!event) return; 3633 3634 //If we are using droppables, inform the manager about the drop 3635 if ($.ui.ddmanager && !this.options.dropBehaviour) 3636 $.ui.ddmanager.drop(this, event); 3637 3638 if(this.options.revert) { 3639 var self = this; 3640 var cur = self.placeholder.offset(); 3641 3642 self.reverting = true; 3643 3644 $(this.helper).animate({ 3645 left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), 3646 top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) 3647 }, parseInt(this.options.revert, 10) || 500, function() { 3648 self._clear(event); 3649 }); 3650 } else { 3651 this._clear(event, noPropagation); 3652 } 3653 3654 return false;
3655 3656 }, 3657 3658 cancel: function() { 3659 3660 var self = this; 3661 3662 if(this.dragging) { 3663 3664 this._mouseUp({ target: null }); 3665 3666 if(this.options.helper == "original") 3667 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 3668 else 3669 this.currentItem.show(); 3670 3671 //Post deactivating events to containers 3672 for (var i = this.containers.length - 1; i >= 0; i--){ 3673 this.containers[i]._trigger("deactivate", null, self._uiHash(this)); 3674 if(this.containers[i].containerCache.over) { 3675 this.containers[i]._trigger("out", null, self._uiHash(this)); 3676 this.containers[i].containerCache.over = 0; 3677 } 3678 } 3679 3680 } 3681 3682 if (this.placeholder) { 3683 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 3684 if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 3685 if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); 3686 3687 $.extend(this, { 3688 helper: null, 3689 dragging: false, 3690 reverting: false, 3691 _noFinalSort: null 3692 }); 3693 3694 if(this.domPosition.prev) { 3695 $(this.domPosition.prev).after(this.currentItem); 3696 } else { 3697 $(this.domPosition.parent).prepend(this.currentItem); 3698 } 3699 } 3700 3701 return this; 3702 3703 }, 3704 3705 serialize: function(o) { 3706 3707 var items = this._getItemsAsjQuery(o && o.connected); 3708 var str = []; o = o || {}; 3709 3710 $(items).each(function() { 3711 var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); 3712 if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); 3713 }); 3714 3715 if(!str.length && o.key) { 3716 str.push(o.key + '='); 3717 } 3718 3719 return str.join('&'); 3720 3721 }, 3722 3723 toArray: function(o) { 3724 3725 var items = this._getItemsAsjQuery(o && o.connected); 3726 var ret = []; o = o || {}; 3727 3728 items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); 3729 return ret; 3730 3731 }, 3732 3733 /* Be careful with the following core functions */ 3734 _intersectsWith: function(item) { 3735 3736 var x1 = this.positionAbs.left, 3737 x2 = x1 + this.helperProportions.width, 3738 y1 = this.positionAbs.top, 3739 y2 = y1 + this.helperProportions.height; 3740 3741 var l = item.left, 3742 r = l + item.width, 3743 t = item.top, 3744 b = t + item.height; 3745 3746 var dyClick = this.offset.click.top, 3747 dxClick = this.offset.click.left; 3748 3749 var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; 3750 3751 if( this.options.tolerance == "pointer" 3752 || this.options.forcePointerForContainers 3753 || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) 3754 ) { 3755 return isOverElement; 3756 } else { 3757 3758 return (l < x1 + (this.helperProportions.width / 2) // Right Half 3759 && x2 - (this.helperProportions.width / 2) < r // Left Half 3760 && t < y1 + (this.helperProportions.height / 2) // Bottom Half 3761 && y2 - (this.helperProportions.height / 2) < b ); // Top Half 3762 3763 } 3764 }, 3765 3766 _intersectsWithPointer: function(item) { 3767 3768 var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), 3769 isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), 3770 isOverElement = isOverElementHeight && isOverElementWidth, 3771 verticalDirection = this._getDragVerticalDirection(), 3772 horizontalDirection = this._getDragHorizontalDirection(); 3773 3774 if (!isOverElement) 3775 return false; 3776 3777 return this.floating ? 3778 ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) 3779 : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); 3780 3781 }, 3782 3783 _intersectsWithSides: function(item) { 3784 3785 var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), 3786 isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), 3787 verticalDirection = this._getDragVerticalDirection(), 3788 horizontalDirection = this._getDragHorizontalDirection(); 3789 3790 if (this.floating && horizontalDirection) { 3791 return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); 3792 } else { 3793 return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); 3794 } 3795 3796 }, 3797 3798 _getDragVerticalDirection: function() { 3799 var delta = this.positionAbs.top - this.lastPositionAbs.top; 3800 return delta != 0 && (delta > 0 ? "down" : "up"); 3801 }, 3802 3803 _getDragHorizontalDirection: function() { 3804 var delta = this.positionAbs.left - this.lastPositionAbs.left; 3805 return delta != 0 && (delta > 0 ? "right" : "left"); 3806 }, 3807 3808 refresh: function(event) { 3809 this._refreshItems(event); 3810 this.refreshPositions(); 3811 return this; 3812 }, 3813 3814 _connectWith: function() { 3815 var options = this.options; 3816 return options.connectWith.constructor == String
3817 ? [options.connectWith] 3818 : options.connectWith; 3819 }, 3820 3821 _getItemsAsjQuery: function(connected) { 3822 3823 var self = this; 3824 var items = []; 3825 var queries = []; 3826 var connectWith = this._connectWith(); 3827 3828 if(connectWith && connected) { 3829 for (var i = connectWith.length - 1; i >= 0; i--){ 3830 var cur = $(connectWith[i]); 3831 for (var j = cur.length - 1; j >= 0; j--){ 3832 var inst = $.data(cur[j], this.widgetName); 3833 if(inst && inst != this && !inst.options.disabled) { 3834 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]); 3835 } 3836 }; 3837 }; 3838 } 3839 3840 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]); 3841 3842 for (var i = queries.length - 1; i >= 0; i--){ 3843 queries[i][0].each(function() { 3844 items.push(this); 3845 }); 3846 }; 3847 3848 return $(items); 3849 3850 }, 3851 3852 _removeCurrentsFromItems: function() { 3853 3854 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 3855 3856 for (var i=0; i < this.items.length; i++) { 3857 3858 for (var j=0; j < list.length; j++) { 3859 if(list[j] == this.items[i].item[0]) 3860 this.items.splice(i,1); 3861 }; 3862 3863 }; 3864 3865 }, 3866 3867 _refreshItems: function(event) { 3868 3869 this.items = []; 3870 this.containers = [this]; 3871 var items = this.items; 3872 var self = this; 3873 var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; 3874 var connectWith = this._connectWith(); 3875 3876 if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down 3877 for (var i = connectWith.length - 1; i >= 0; i--){ 3878 var cur = $(connectWith[i]); 3879 for (var j = cur.length - 1; j >= 0; j--){ 3880 var inst = $.data(cur[j], this.widgetName); 3881 if(inst && inst != this && !inst.options.disabled) { 3882 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); 3883 this.containers.push(inst); 3884 } 3885 }; 3886 }; 3887 } 3888 3889 for (var i = queries.length - 1; i >= 0; i--) { 3890 var targetData = queries[i][1]; 3891 var _queries = queries[i][0]; 3892 3893 for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { 3894 var item = $(_queries[j]); 3895 3896 item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) 3897 3898 items.push({ 3899 item: item, 3900 instance: targetData, 3901 width: 0, height: 0, 3902 left: 0, top: 0 3903 }); 3904 }; 3905 }; 3906 3907 }, 3908 3909 refreshPositions: function(fast) { 3910 3911 //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change 3912 if(this.offsetParent && this.helper) { 3913 this.offset.parent = this._getParentOffset(); 3914 } 3915 3916 for (var i = this.items.length - 1; i >= 0; i--){ 3917 var item = this.items[i]; 3918 3919 //We ignore calculating positions of all connected containers when we're not over them 3920 if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) 3921 continue; 3922 3923 var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; 3924 3925 if (!fast) { 3926 item.width = t.outerWidth(); 3927 item.height = t.outerHeight(); 3928 } 3929 3930 var p = t.offset(); 3931 item.left = p.left; 3932 item.top = p.top; 3933 }; 3934 3935 if(this.options.custom && this.options.custom.refreshContainers
3935) { 3936 this.options.custom.refreshContainers.call(this); 3937 } else { 3938 for (var i = this.containers.length - 1; i >= 0; i--){ 3939 var p = this.containers[i].element.offset(); 3940 this.containers[i].containerCache.left = p.left; 3941 this.containers[i].containerCache.top = p.top; 3942 this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); 3943 this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 3944 }; 3945 } 3946 3947 return this; 3948 }, 3949 3950 _createPlaceholder: function(that) { 3951 3952 var self = that || this, o = self.options; 3953 3954 if(!o.placeholder || o.placeholder.constructor == String) { 3955 var className = o.placeholder; 3956 o.placeholder = { 3957 element: function() { 3958 3959 var el = $(document.createElement(self.currentItem[0].nodeName)) 3960 .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") 3961 .removeClass("ui-sortable-helper")[0]; 3962 3963 if(!className) 3964 el.style.visibility = "hidden"; 3965 3966 return el; 3967 }, 3968 update: function(container, p) { 3969 3970 // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that 3971 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified 3972 if(className && !o.forcePlaceholderSize) return; 3973 3974 //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
3975 if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; 3976 if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; 3977 } 3978 }; 3979 } 3980 3981 //Create the placeholder 3982 self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); 3983 3984 //Append it after the actual current item 3985 self.currentItem.after(self.placeholder); 3986 3987 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 3988 o.placeholder.update(self, self.placeholder); 3989 3990 }, 3991 3992 _contactContainers: function(event) { 3993 3994 // get innermost container that intersects with item 3995 var innermostContainer = null, innermostIndex = null; 3996 3997 3998 for (var i = this.containers.length - 1; i >= 0; i--){ 3999 4000 // never consider a container that's located within the item itself 4001 if($.ui.contains(this.currentItem[0], this.containers[i].element[0])) 4002 continue; 4003 4004 if(this._intersectsWith(this.containers[i].containerCache)) { 4005 4006 // if we've already found a container and it's more "inner" than this, then continue 4007 if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0])) 4008 continue; 4009 4010 innermostContainer = this.containers[i]; 4011 innermostIndex = i; 4012 4013 } else { 4014 // container doesn't intersect. trigger "out" event if necessary 4015 if(this.containers[i].containerCache.over) { 4016 this.containers[i]._trigger("out", event, this._uiHash(this)); 4017 this.containers[i].containerCache.over = 0; 4018 } 4019 } 4020 4021 } 4022 4023 // if no intersecting containers found, return 4024 if(!innermostContainer) return; 4025 4026 // move the item into the container if it's not there already 4027 if(this.containers.length === 1) { 4028 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 4029 this.containers[innermostIndex].containerCache.over = 1; 4030 } else if(this.currentContainer != this.containers[innermostIndex]) { 4031 4032 //When entering a new container, we will find the item with the least distance and append our item near it 4033 var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; 4034 for (var j = this.items.length - 1; j >= 0; j--) { 4035 if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; 4036 var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top; 4037 if(Math.abs(cur - base) < dist) { 4038 dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; 4039 this.direction = (cur - base > 0) ? 'down' : 'up'; 4040 } 4041 } 4042 4043 if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 4044 return; 4045 4046 this.currentContainer = this.containers[innermostIndex]; 4047 itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 4048 this._trigger("change", event, this._uiHash()); 4049 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 4050 4051 //Update the placeholder 4052 this.options.placeholder.update(this.currentContainer, this.placeholder); 4053 4054 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 4055 this.containers[innermostIndex].containerCache.over = 1; 4056 } 4057 4058 4059 }, 4060 4061 _createHelper: function(event) { 4062 4063 var o = this.options; 4064 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); 4065 4066 if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already 4067 $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); 4068 4069 if(helper[0] == this.currentItem[0]) 4070 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
4070: this.currentItem.css("left") }; 4071 4072 if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); 4073 if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); 4074 4075 return helper; 4076 4077 }, 4078 4079 _adjustOffsetFromHelper: function(obj) { 4080 if (typeof obj == 'string') { 4081 obj = obj.split(' '); 4082 } 4083 if ($.isArray(obj)) { 4084 obj = {left: +obj[0], top: +obj[1] || 0}; 4085 } 4086 if ('left' in obj) { 4087 this.offset.click.left = obj.left + this.margins.left; 4088 } 4089 if ('right' in obj) { 4090 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 4091 } 4092 if ('top' in obj) { 4093 this.offset.click.top = obj.top + this.margins.top; 4094 } 4095 if ('bottom' in obj) { 4096 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 4097 } 4098 }, 4099 4100 _getParentOffset: function() { 4101 4102 4103 //Get the offsetParent and cache its position 4104 this.offsetParent = this.helper.offsetParent(); 4105 var po = this.offsetParent.offset(); 4106 4107 // This is a special case where we need to modify a offset calculated on start, since the following happened: 4108 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 4109 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 4110 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 4111 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { 4112 po.left += this.scrollParent.scrollLeft(); 4113 po.top += this.scrollParent.scrollTop(); 4114 } 4115 4116 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information 4117 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix 4118 po = { top: 0, left: 0 }; 4119 4120 return { 4121 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), 4122 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 4123 }; 4124 4125 }, 4126 4127 _getRelativeOffset: function() { 4128 4129 if(this.cssPosition == "relative") { 4130 var p = this.currentItem.position(); 4131 return { 4132 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 4133 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 4134 }; 4135 } else { 4136 return { top: 0, left: 0 }; 4137 } 4138 4139 }, 4140 4141 _cacheMargins: function() { 4142 this.margins = { 4143 left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), 4144 top: (parseInt(this.currentItem.css("marginTop"),10) || 0) 4145 }; 4146 }, 4147 4148 _cacheHelperProportions: function() { 4149 this.helperProportions = { 4150 width: this.helper.outerWidth(), 4151 height: this.helper.outerHeight() 4152 }; 4153 }, 4154 4155 _setContainment: function() { 4156 4157 var o = this.options; 4158 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 4159 if(o.containment == 'document' || o.containment == 'window') this.containment = [ 4160 0 - this.offset.relative.left - this.offset.parent.left, 4161 0 - this.offset.relative.top - this.offset.parent.top, 4162 $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, 4163 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 4164 ]; 4165 4166 if(!(/^(document|window|parent)$/).test(o.containment)) { 4167 var ce = $(o.containment)[0]; 4168 var co = $(o.containment).offset(); 4169 var over = ($(ce).css("overflow") != 'hidden'); 4170 4171 this.containment = [ 4172 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, 4173 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, 4174 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, 4175 co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),
417510) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top 4176 ]; 4177 } 4178 4179 }, 4180 4181 _convertPositionTo: function(d, pos) { 4182 4183 if(!pos) pos = this.position; 4184 var mod = d == "absolute" ? 1 : -1; 4185 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 4186 4187 return { 4188 top: ( 4189 pos.top // The absolute mouse position 4190 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent 4191 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) 4192 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 4193 ), 4194 left: ( 4195 pos.left // The absolute mouse position 4196 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent 4197 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) 4198 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 4199 ) 4200 }; 4201 4202 }, 4203 4204 _generatePosition: function(event) { 4205 4206 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 4207 4208 // This is another very weird special case that only happens for relative elements: 4209 // 1. If the css position is relative 4210 // 2. and the scroll parent is the document or similar to the offset parent 4211 // we have to refresh the relative offset during the scroll so there are no jumps 4212 if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { 4213 this.offset.relative = this._getRelativeOffset(); 4214 } 4215 4216 var pageX = event.pageX; 4217 var pageY = event.pageY; 4218 4219 /* 4220 * - Position constraining - 4221 * Constrain the position to a mix of grid, containment. 4222 */ 4223 4224 if(this.originalPosition) { //If we are not dragging yet, we won't check for options 4225 4226 if(this.containment) { 4227 if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; 4228 if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; 4229 if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; 4230 if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; 4231 } 4232 4233 if(o.grid) { 4234 var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 4235 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; 4236 4237 var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 4238 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; 4239 } 4240 4241 } 4242 4243 return { 4244 top: ( 4245 pageY // The absolute mouse position 4246 - this.offset.click.top // Click offset (relative to the element) 4247 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent 4248 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) 4249 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 4250 ), 4251 left: ( 4252 pageX // The absolute mouse position 4253 - this.offset.click.left // Click offset (relative to the element) 4254 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent 4255 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) 4256 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 4257 ) 4258 }; 4259 4260 }, 4261 4262 _rearrange: function(event, i, a, hardRefresh) { 4263 4264 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)); 4265 4266 //Various things done here to improve the performance: 4267 // 1. we create a setTimeout, that calls refreshPositions 4268 // 2. on the instance, we have a counter variable, that get's higher after every append 4269 // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same 4270 // 4. this lets only the last addition to the timeout stack through 4271 this.counter = this.counter ? ++this.counter : 1;
4272 var self = this, counter = this.counter; 4273 4274 window.setTimeout(function() { 4275 if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 4276 },0); 4277 4278 }, 4279 4280 _clear: function(event, noPropagation) { 4281 4282 this.reverting = false; 4283 // We delay all events that have to be triggered to after the point where the placeholder has been removed and 4284 // everything else normalized again 4285 var delayedTriggers = [], self = this; 4286 4287 // We first have to update the dom position of the actual currentItem 4288 // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) 4289 if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); 4290 this._noFinalSort = null; 4291 4292 if(this.helper[0] == this.currentItem[0]) { 4293 for(var i in this._storedCSS) { 4294 if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; 4295 } 4296 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 4297 } else { 4298 this.currentItem.show(); 4299 } 4300 4301 if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); 4302 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 4303 4304 // Check if the items Container has Changed and trigger appropriate 4305 // events. 4306 if (this !== this.currentContainer) { 4307 if(!noPropagation) { 4308 delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); 4309 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); 4310 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); 4311 } 4312 } 4313 4314 //Post events to containers 4315 for (var i = this.containers.length - 1; i >= 0; i--){ 4316 if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 4317 if(this.containers[i].containerCache.over) { 4318 delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 4319 this.containers[i].containerCache.over = 0; 4320 } 4321 } 4322 4323 //Do what was originally in plugins 4324 if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor 4325 if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity 4326 if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index 4327 4328 this.dragging = false; 4329 if(this.cancelHelperRemoval) { 4330 if(!noPropagation) { 4331 this._trigger("beforeStop", event, this._uiHash()); 4332 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 4333 this._trigger("stop", event, this._uiHash()); 4334 } 4335 4336 this.fromOutside = false;
4337 return false; 4338 } 4339 4340 if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); 4341 4342 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 4343 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 4344 4345 if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; 4346 4347 if(!noPropagation) { 4348 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 4349 this._trigger("stop", event, this._uiHash()); 4350 } 4351 4352 this.fromOutside = false; 4353 return true; 4354 4355 }, 4356 4357 _trigger: function() { 4358 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 4359 this.cancel(); 4360 } 4361 }, 4362 4363 _uiHash: function(inst) { 4364 var self = inst || this; 4365 return { 4366 helper: self.helper, 4367 placeholder: self.placeholder || $([]), 4368 position: self.position, 4369 originalPosition: self.originalPosition, 4370 offset: self.positionAbs, 4371 item: self.currentItem, 4372 sender: inst ? inst.element : null 4373 }; 4374 } 4375 4376}); 4377 4378$.extend($.ui.sortable, { 4379 version: "1.8.24" 4380}); 4381 4382})(jQuery); 4383/*! 4384 * jQuery UI Accordion 1.8.24 4385 * 4386 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 4387 * Dual licensed under the MIT or GPL Version 2 licenses. 4388 * http://jquery.org/license 4389 * 4390 * http://docs.jquery.com/UI/Accordion 4391 * 4392 * Depends: 4393 * jquery.ui.core.js 4394 * jquery.ui.widget.js 4395 */ 4396(function( $, undefined ) { 4397 4398$.widget( "ui.accordion", { 4399 options: { 4400 active: 0, 4401 animated: "slide", 4402 autoHeight: true, 4403 clearStyle: false, 4404 collapsible: false, 4405 event: "click", 4406 fillSpace: false, 4407 header: "> li > :first-child,> :not(li):even", 4408 icons: { 4409 header: "ui-icon-triangle-1-e", 4410 headerSelected: "ui-icon-triangle-1-s" 4411 }, 4412 navigation: false, 4413 navigationFilter: function() { 4414 return this.href.toLowerCase() === location.href.toLowerCase(); 4415 } 4416 }, 4417 4418 _create: function() { 4419 var self = this, 4420 options = self.options; 4421 4422 self.running = 0; 4423 4424 self.element 4425 .addClass( "ui-accordion ui-widget ui-helper-reset" ) 4426 // in lack of child-selectors in CSS 4427 // we need to mark top-LIs in a UL-accordion for some IE-fix 4428 .children( "li" ) 4429 .addClass( "ui-accordion-li-fix" ); 4430 4431 self.headers = self.element.find( options.header ) 4432 .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) 4433 .bind( "mouseenter.accordion", function() { 4434 if ( options.disabled ) { 4435 return; 4436 } 4437 $( this ).addClass( "ui-state-hover" ); 4438 }) 4439 .bind( "mouseleave.accordion", function() { 4440 if ( options.disabled ) { 4441 return; 4442 } 4443 $( this ).removeClass( "ui-state-hover" ); 4444 }) 4445 .bind( "focus.accordion", function() { 4446 if ( options.disabled ) { 4447 return; 4448 } 4449 $( this ).addClass( "ui-state-focus" ); 4450 }) 4451 .bind( "blur.accordion", function() { 4452 if ( options.disabled ) { 4453 return; 4454 } 4455 $( this ).removeClass( "ui-state-focus" ); 4456 }); 4457 4458 self.headers.next() 4459 .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); 4460 4461 if ( options.navigation ) { 4462 var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); 4463 if ( current.length ) { 4464 var header = current.closest( ".ui-accordion-header" ); 4465 if ( header.length ) { 4466 // anchor within header 4467 self.active = header; 4468 } else { 4469 // anchor within content 4470 self.active = current.closest( ".ui-accordion-content" ).prev(); 4471 } 4472 } 4473 } 4474 4475 self.active = self._findActive( self.active || options.active ) 4476 .addClass( "ui-state-default ui-state-active" ) 4477 .toggleClass( "ui-corner-all" ) 4478 .toggleClass( "ui-corner-top" ); 4479 self.active.next().addClass( "ui-accordion-content-active" ); 4480 4481 self._createIcons(); 4482 self.resize(); 4483 4484 // ARIA 4485 self.element.attr( "role", "tablist" ); 4486 4487 self.headers 4488 .attr( "role", "tab" ) 4489 .bind( "keydown.accordion", function( event ) { 4490 return self._keydown( event ); 4491 }) 4492 .next() 4493 .attr( "role", "tabpanel" ); 4494 4495 self.headers 4496 .not( self.active || "" ) 4497 .attr({ 4498 "aria-expanded": "false", 4499 "aria-selected": "false", 4500 tabIndex: -1 4501 }) 4502 .next() 4503 .hide(); 4504 4505 // make sure at least one header is in the tab order 4506 if ( !self.active.length ) { 4507 self.headers.eq( 0 ).attr( "tabIndex", 0 ); 4508 } else { 4509 self.active 4510 .attr({ 4511 "aria-expanded": "true", 4512 "aria-selected": "true", 4513 tabIndex: 0 4514 }); 4515 } 4516 4517 // only need links in tab order for Safari 4518 if ( !$.browser.safari ) { 4519 self.headers.find( "a" ).attr( "tabIndex", -1 ); 4520 } 4521 4522 if ( options.event ) { 4523 self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { 4524 self._clickHandler.call( self, event, this ); 4525 event.preventDefault(); 4526 }); 4527 } 4528 }, 4529 4530 _createIcons: function() { 4531 var options = this.options; 4532 if ( options.icons ) { 4533 $( "<span></span>" ) 4534 .addClass( "ui-icon " + options.icons.header ) 4535 .prependTo( this.headers ); 4536 this.active.children( ".ui-icon" ) 4537 .toggleClass(options.icons.header) 4538 .toggleClass(options.icons.headerSelected); 4539 this.element.addClass( "ui-accordion-icons" ); 4540 } 4541 }, 4542 4543 _destroyIcons: function() { 4544 this.headers.children( ".ui-icon" ).remove(); 4545 this.element.removeClass( "ui-accordion-icons" ); 4546 }, 4547 4548 destroy: function() { 4549 var options = this.options; 4550 4551 this.element 4552 .removeClass( "ui-accordion ui-widget ui-helper-reset" ) 4553 .removeAttr( "role" ); 4554 4555 this.headers 4556 .unbind( ".accordion" ) 4557 .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) 4558 .removeAttr( "role" ) 4559 .removeAttr( "aria-expanded" ) 4560 .removeAttr( "aria-selected" ) 4561 .removeAttr( "tabIndex" ); 4562 4563 this.headers.find( "a" ).removeAttr( "tabIndex" ); 4564 this._destroyIcons(); 4565 var contents = this.headers.next() 4566 .css( "display", "" ) 4567 .removeAttr( "role" ) 4568 .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); 4569 if ( options.autoHeight || options.fillHeight ) { 4570 contents.css( "height", "" ); 4571 } 4572 4573 return $.Widget.prototype.destroy.call( this ); 4574 }, 4575 4576 _setOption: function( key, value ) { 4577 $.Widget.prototype._setOption.apply( this, arguments ); 4578 4579 if ( key == "active" ) { 4580 this.activate( value ); 4581 } 4582 if ( key == "icons" ) { 4583 this._destroyIcons(); 4584 if ( value ) { 4585 this._createIcons(); 4586 } 4587 } 4588 // #5332 - opacity doesn't cascade to positioned elements in IE 4589 // so we need to add the disabled class to the headers and panels 4590 if ( key == "disabled" ) { 4591 this.headers.add(this.headers.next()) 4592 [ value ? "addClass" : "removeClass" ]( 4593 "ui-accordion-disabled ui-state-disabled" ); 4594 } 4595 }, 4596 4597 _keydown: function( event ) { 4598 if ( this.options.disabled || event.altKey || event.ctrlKey ) { 4599 return; 4600 } 4601 4602 var keyCode = $.ui.keyCode, 4603 length = this.headers.length, 4604 currentIndex = this.headers.index( event.target ), 4605 toFocus = false;
4606 4607 switch ( event.keyCode ) { 4608 case keyCode.RIGHT: 4609 case keyCode.DOWN: 4610 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 4611 break; 4612 case keyCode.LEFT: 4613 case keyCode.UP: 4614 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 4615 break; 4616 case keyCode.SPACE: 4617 case keyCode.ENTER: 4618 this._clickHandler( { target: event.target }, event.target ); 4619 event.preventDefault(); 4620 } 4621 4622 if ( toFocus ) { 4623 $( event.target ).attr( "tabIndex", -1 ); 4624 $( toFocus ).attr( "tabIndex", 0 ); 4625 toFocus.focus(); 4626 return false; 4627 } 4628 4629 return true; 4630 }, 4631 4632 resize: function() { 4633 var options = this.options, 4634 maxHeight; 4635 4636 if ( options.fillSpace ) { 4637 if ( $.browser.msie ) { 4638 var defOverflow = this.element.parent().css( "overflow" ); 4639 this.element.parent().css( "overflow", "hidden"); 4640 } 4641 maxHeight = this.element.parent().height(); 4642 if ($.browser.msie) { 4643 this.element.parent().css( "overflow", defOverflow ); 4644 } 4645 4646 this.headers.each(function() { 4647 maxHeight -= $( this ).outerHeight( true ); 4648 }); 4649 4650 this.headers.next() 4651 .each(function() { 4652 $( this ).height( Math.max( 0, maxHeight - 4653 $( this ).innerHeight() + $( this ).height() ) ); 4654 }) 4655 .css( "overflow", "auto" ); 4656 } else if ( options.autoHeight ) { 4657 maxHeight = 0; 4658 this.headers.next() 4659 .each(function() { 4660 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 4661 }) 4662 .height( maxHeight ); 4663 } 4664 4665 return this; 4666 }, 4667 4668 activate: function( index ) { 4669 // TODO this gets called on init, changing the option without an explicit call for that 4670 this.options.active = index; 4671 // call clickHandler with custom event 4672 var active = this._findActive( index )[ 0 ]; 4673 this._clickHandler( { target: active }, active ); 4674 4675 return this; 4676 }, 4677 4678 _findActive: function( selector ) { 4679 return selector 4680 ? typeof selector === "number" 4681 ? this.headers.filter( ":eq(" + selector + ")" ) 4682 : this.headers.not( this.headers.not( selector ) ) 4683 : selector === false 4684 ? $( [] ) 4685 : this.headers.filter( ":eq(0)" ); 4686 }, 4687 4688 // TODO isn't event.target enough? why the separate target argument? 4689 _clickHandler: function( event, target ) { 4690 var options = this.options; 4691 if ( options.disabled ) { 4692 return; 4693 } 4694 4695 // called only when using activate(false) to close all parts programmatically 4696 if ( !event.target ) { 4697 if ( !options.collapsible ) { 4698 return; 4699 } 4700 this.active 4701 .removeClass( "ui-state-active ui-corner-top" ) 4702 .addClass( "ui-state-default ui-corner-all" ) 4703 .children( ".ui-icon" ) 4704 .removeClass( options.icons.headerSelected ) 4705 .addClass( options.icons.header ); 4706 this.active.next().addClass( "ui-accordion-content-active" ); 4707 var toHide = this.active.next(), 4708 data = { 4709 options: options, 4710 newHeader: $( [] ), 4711 oldHeader: options.active, 4712 newContent: $( [] ), 4713 oldContent: toHide 4714 }, 4715 toShow = ( this.active = $( [] ) ); 4716 this._toggle( toShow, toHide, data ); 4717 return; 4718 } 4719 4720 // get the click target 4721 var clicked = $( event.currentTarget || target ), 4722 clickedIsActive = clicked[0] === this.active[0]; 4723 4724 // TODO the option is changed, is that correct? 4725 // TODO if it is correct, shouldn't that happen after determining that the click is valid? 4726 options.active = options.collapsible && clickedIsActive ? 4727 false : 4728 this.headers.index( clicked ); 4729 4730 // if animations are still active, or the active header is the target, ignore click 4731 if ( this.running || ( !options.collapsible && clickedIsActive ) ) { 4732 return; 4733 } 4734 4735 // find elements to show and hide 4736 var active = this.active, 4737 toShow = clicked.next(), 4738 toHide = this.active.next(), 4739 data = { 4740 options: options, 4741 newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, 4742 oldHeader: this.active, 4743 newContent: clickedIsActive && options.collapsible ? $([]) : toShow, 4744 oldContent: toHide 4745 }, 4746 down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); 4747 4748 // when the call to ._toggle() comes after the class changes 4749 // it causes a very odd bug in IE 8 (see #6720) 4750 this.active = clickedIsActive ? $([]) : clicked; 4751 this._toggle( toShow, toHide, data, clickedIsActive, down ); 4752 4753 // switch classes 4754 active 4755 .removeClass( "ui-state-active ui-corner-top" ) 4756 .addClass( "ui-state-default ui-corner-all" ) 4757 .children( ".ui-icon" ) 4758 .removeClass( options.icons.headerSelected )
4759 .addClass( options.icons.header ); 4760 if ( !clickedIsActive ) { 4761 clicked 4762 .removeClass( "ui-state-default ui-corner-all" ) 4763 .addClass( "ui-state-active ui-corner-top" ) 4764 .children( ".ui-icon" ) 4765 .removeClass( options.icons.header ) 4766 .addClass( options.icons.headerSelected ); 4767 clicked 4768 .next() 4769 .addClass( "ui-accordion-content-active" ); 4770 } 4771 4772 return; 4773 }, 4774 4775 _toggle: function( toShow, toHide, data, clickedIsActive, down ) { 4776 var self = this, 4777 options = self.options; 4778 4779 self.toShow = toShow; 4780 self.toHide = toHide; 4781 self.data = data; 4782 4783 var complete = function() { 4784 if ( !self ) { 4785 return; 4786 } 4787 return self._completed.apply( self, arguments ); 4788 }; 4789 4790 // trigger changestart event 4791 self._trigger( "changestart", null, self.data ); 4792 4793 // count elements to animate 4794 self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); 4795 4796 if ( options.animated ) { 4797 var animOptions = {}; 4798 4799 if ( options.collapsible && clickedIsActive ) { 4800 animOptions = { 4801 toShow: $( [] ), 4802 toHide: toHide, 4803 complete: complete, 4804 down: down, 4805 autoHeight: options.autoHeight || options.fillSpace 4806 }; 4807 } else { 4808 animOptions = { 4809 toShow: toShow, 4810 toHide: toHide, 4811 complete: complete, 4812 down: down, 4813 autoHeight: options.autoHeight || options.fillSpace 4814 }; 4815 } 4816 4817 if ( !options.proxied ) { 4818 options.proxied = options.animated; 4819 } 4820 4821 if ( !options.proxiedDuration ) { 4822 options.proxiedDuration = options.duration; 4823 } 4824 4825 options.animated = $.isFunction( options.proxied ) ? 4826 options.proxied( animOptions ) : 4827 options.proxied; 4828 4829 options.duration = $.isFunction( options.proxiedDuration ) ? 4830 options.proxiedDuration( animOptions ) : 4831 options.proxiedDuration; 4832 4833 var animations = $.ui.accordion.animations, 4834 duration = options.duration, 4835 easing = options.animated; 4836 4837 if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { 4838 easing = "slide"; 4839 } 4840 if ( !animations[ easing ] ) { 4841 animations[ easing ] = function( options ) { 4842 this.slide( options, { 4843 easing: easing, 4844 duration: duration || 700 4845 }); 4846 }; 4847 } 4848 4849 animations[ easing ]( animOptions ); 4850 } else { 4851 if ( options.collapsible && clickedIsActive ) { 4852 toShow.toggle(); 4853 } else { 4854 toHide.hide(); 4855 toShow.show(); 4856 } 4857 4858 complete( true ); 4859 } 4860 4861 // TODO assert that the blur and focus triggers are really necessary, remove otherwise 4862 toHide.prev() 4863 .attr({ 4864 "aria-expanded": "false", 4865 "aria-selected": "false", 4866 tabIndex: -1 4867 }) 4868 .blur(); 4869 toShow.prev() 4870 .attr({ 4871 "aria-expanded": "true", 4872 "aria-selected": "true", 4873 tabIndex: 0 4874 }) 4875 .focus(); 4876 }, 4877 4878 _completed: function( cancel ) { 4879 this.running = cancel ? 0 : --this.running; 4880 if ( this.running ) { 4881 return; 4882 } 4883 4884 if ( this.options.clearStyle ) { 4885 this.toShow.add( this.toHide ).css({ 4886 height: "", 4887 overflow: "" 4888 }); 4889 } 4890 4891 // other classes are removed before the animation; this one needs to stay until completed 4892 this.toHide.removeClass( "ui-accordion-content-active" ); 4893 // Work around for rendering bug in IE (#5421) 4894 if ( this.toHide.length ) { 4895 this.toHide.parent()[0].className = this.toHide.parent()[0].className; 4896 } 4897 4898 this._trigger( "change", null, this.data ); 4899 } 4900}); 4901 4902$.extend( $.ui.accordion, { 4903 version: "1.8.24", 4904 animations: { 4905 slide: function( options, additions ) { 4906 options = $.extend({ 4907 easing: "swing", 4908 duration: 300 4909 }, options, additions ); 4910 if ( !options.toHide.size() ) { 4911 options.toShow.animate({ 4912 height: "show", 4913 paddingTop: "show", 4914 paddingBottom: "show" 4915 }, options ); 4916 return; 4917 } 4918 if ( !options.toShow.size() ) { 4919 options.toHide.animate({ 4920 height: "hide", 4921 paddingTop: "hide", 4922 paddingBottom: "hide" 4923 }, options ); 4924 return; 4925 } 4926 var overflow = options.toShow.css( "overflow" ), 4927 percentDone = 0, 4928 showProps = {}, 4929 hideProps = {}, 4930 fxAttrs = [ "height", "paddingTop", "paddingBottom" ], 4931 originalWidth; 4932 // fix width before calculating height of hidden element 4933 var s = options.toShow; 4934 originalWidth = s[0].style.width; 4935 s.width( s.parent().width() 4936 - parseFloat( s.css( "paddingLeft" ) ) 4937 - parseFloat( s.css( "paddingRight" ) ) 4938 - ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 ) 4939 - ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) ); 4940 4941 $.each( fxAttrs, function( i, prop ) { 4942 hideProps[ prop ] = "hide"; 4943 4944 var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); 4945 showProps[ prop ] = { 4946 value: parts[ 1 ], 4947 unit: parts[ 2 ] || "px" 4948 }; 4949 }); 4950 options.toShow.css({ height: 0, overflow: "hidden" }).show(); 4951 options.toHide 4952 .filter( ":hidden" ) 4953 .each( options.complete ) 4954 .end() 4955 .filter( ":visible" ) 4956 .animate( hideProps, { 4957 step: function( now, settings ) { 4958 // only calculate the percent when animating height 4959 // IE gets very inconsistent results when animating elements 4960 // with small values, which is common for padding 4961 if ( settings.prop == "height" ) { 4962 percentDone = ( settings.end - settings.start === 0 ) ? 0 : 4963 ( settings.now - settings.start ) / ( settings.end - settings.start ); 4964 } 4965 4966 options.toShow[ 0 ].style[ settings.prop ] = 4967 ( percentDone * showProps[ settings.prop ].value ) 4968 + showProps[ settings.prop ].unit; 4969 }, 4970 duration: options.duration, 4971 easing: options.easing, 4972 complete: function() { 4973 if ( !options.autoHeight ) { 4974 options.toShow.css( "height", "" ); 4975 } 4976 options.toShow.css({ 4977 width: originalWidth, 4978 overflow: overflow 4979 }); 4980 options.complete(); 4981 } 4982 }); 4983 }, 4984 bounceslide: function( options ) { 4985 this.slide( options, { 4986 easing: options.down ? "easeOutBounce" : "swing", 4987 duration: options.down ? 1000 : 200 4988 }); 4989 } 4990 } 4991}); 4992 4993})( jQuery ); 4994/*! 4995 * jQuery UI Autocomplete 1.8.24 4996 * 4997 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 4998 * Dual licensed under the MIT or GPL Version 2 licenses. 4999 * http://jquery.org/license 5000 * 5001 * http://docs.jquery.com/UI/Autocomplete 5002 * 5003 * Depends: 5004 * jquery.ui.core.js 5005 * jquery.ui.widget.js 5006 * jquery.ui.position.js 5007 */ 5008(function( $, undefined ) { 5009 5010// used to prevent race conditions with remote data sources 5011var requestIndex = 0; 5012 5013$.widget( "ui.autocomplete", { 5014 options: { 5015 appendTo: "body", 5016 autoFocus: false, 5017 delay: 300, 5018 minLength: 1, 5019 position: { 5020 my: "left top", 5021 at: "left bottom", 5022 collision: "none" 5023 }, 5024 source: null 5025 }, 5026 5027 pending: 0, 5028 5029 _create: function() { 5030 var self = this, 5031 doc = this.element[ 0 ].ownerDocument, 5032 suppressKeyPress; 5033 this.isMultiLine = this.element.is( "textarea" ); 5034 5035 this.element 5036 .addClass( "ui-autocomplete-input" ) 5037 .attr( "autocomplete", "off" ) 5038 // TODO verify these actually work as intended 5039 .attr({ 5040 role: "textbox", 5041 "aria-autocomplete": "list", 5042 "aria-haspopup": "true" 5043 }) 5044 .bind( "keydown.autocomplete", function( event ) { 5045 if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) { 5046 return; 5047 } 5048 5049 suppressKeyPress = false;
5050 var keyCode = $.ui.keyCode; 5051 switch( event.keyCode ) { 5052 case keyCode.PAGE_UP: 5053 self._move( "previousPage", event ); 5054 break; 5055 case keyCode.PAGE_DOWN: 5056 self._move( "nextPage", event ); 5057 break; 5058 case keyCode.UP: 5059 self._keyEvent( "previous", event ); 5060 break; 5061 case keyCode.DOWN: 5062 self._keyEvent( "next", event ); 5063 break; 5064 case keyCode.ENTER: 5065 case keyCode.NUMPAD_ENTER: 5066 // when menu is open and has focus 5067 if ( self.menu.active ) { 5068 // #6055 - Opera still allows the keypress to occur 5069 // which causes forms to submit 5070 suppressKeyPress = true; 5071 event.preventDefault(); 5072 } 5073 //passthrough - ENTER and TAB both select the current element 5074 case keyCode.TAB: 5075 if ( !self.menu.active ) { 5076 return; 5077 } 5078 self.menu.select( event ); 5079 break; 5080 case keyCode.ESCAPE: 5081 self.element.val( self.term ); 5082 self.close( event ); 5083 break; 5084 default: 5085 // keypress is triggered before the input value is changed 5086 clearTimeout( self.searching ); 5087 self.searching = setTimeout(function() { 5088 // only search if the value has changed 5089 if ( self.term != self.element.val() ) { 5090 self.selectedItem = null; 5091 self.search( null, event ); 5092 } 5093 }, self.options.delay ); 5094 break; 5095 } 5096 }) 5097 .bind( "keypress.autocomplete", function( event ) { 5098 if ( suppressKeyPress ) { 5099 suppressKeyPress = false; 5100 event.preventDefault(); 5101 } 5102 }) 5103 .bind( "focus.autocomplete", function() { 5104 if ( self.options.disabled ) { 5105 return; 5106 } 5107 5108 self.selectedItem = null; 5109 self.previous = self.element.val(); 5110 }) 5111 .bind( "blur.autocomplete", function( event ) { 5112 if ( self.options.disabled ) { 5113 return; 5114 } 5115 5116 clearTimeout( self.searching ); 5117 // clicks on the menu (or a button to trigger a search) will cause a blur event 5118 self.closing = setTimeout(function() { 5119 self.close( event ); 5120 self._change( event ); 5121 }, 150 ); 5122 }); 5123 this._initSource(); 5124 this.menu = $( "<ul></ul>" ) 5125 .addClass( "ui-autocomplete" ) 5126 .appendTo( $( this.options.appendTo || "body", doc )[0] ) 5127 // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) 5128 .mousedown(function( event ) { 5129 // clicking on the scrollbar causes focus to shift to the body 5130 // but we can't detect a mouseup or a click immediately afterward 5131 // so we have to track the next mousedown and close the menu if 5132 // the user clicks somewhere outside of the autocomplete 5133 var menuElement = self.menu.element[ 0 ]; 5134 if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { 5135 setTimeout(function() { 5136 $( document ).one( 'mousedown', function( event ) { 5137 if ( event.target !== self.element[ 0 ] && 5138 event.target !== menuElement && 5139 !$.ui.contains( menuElement, event.target ) ) { 5140 self.close(); 5141 } 5142 }); 5143 }, 1 ); 5144 } 5145 5146 // use another timeout to make sure the blur-event-handler on the input was already triggered 5147 setTimeout(function() { 5148 clearTimeout( self.closing ); 5149 }, 13); 5150 }) 5151 .menu({ 5152 focus: function( event, ui ) { 5153 var item = ui.item.data( "item.autocomplete" ); 5154 if ( false !== self._trigger( "focus", event, { item: item } ) ) { 5155 // use value to match what will end up in the input, if it was a key event 5156 if ( /^key/.test(event.originalEvent.type) ) { 5157 self.element.val( item.value ); 5158 } 5159 } 5160 }, 5161 selected: function( event, ui ) { 5162 var item = ui.item.data( "item.autocomplete" ), 5163 previous = self.previous; 5164 5165 // only trigger when focus was lost (click on menu) 5166 if ( self.element[0] !== doc.activeElement ) { 5167 self.element.focus(); 5168 self.previous = previous; 5169 // #6109 - IE triggers two focus events and the second 5170 // is asynchronous, so we need to reset the previous 5171 // term synchronously and asynchronously :-( 5172 setTimeout(function() { 5173 self.previous = previous; 5174 self.selectedItem = item; 5175 }, 1); 5176 } 5177 5178 if ( false !== self._trigger( "select", event, { item: item } ) ) { 5179 self.element.val( item.value ); 5180 } 5181 // reset the term after the select event 5182 // this allows custom select handling to work properly 5183 self.term = self.element.val(); 5184 5185 self.close( event ); 5186 self.selectedItem = item; 5187 }, 5188 blur: function( event, ui ) { 5189 // don't set the value of the text field if it's already correct 5190 // this prevents moving the cursor unnecessarily 5191 if ( self.menu.element.is(":visible") && 5192 ( self.element.val() !== self.term ) ) { 5193 self.element.val( self.term ); 5194 } 5195 } 5196 }) 5197 .zIndex( this.element.zIndex() + 1 ) 5198 // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 5199 .css({ top: 0, left: 0 }) 5200 .hide() 5201 .data( "menu" ); 5202 if ( $.fn.bgiframe ) { 5203 this.menu.element.bgiframe(); 5204 } 5205 // turning off autocomplete prevents the browser from remembering the 5206 // value when navigating through history, so we re-enable autocomplete 5207 // if the page is unloaded before the widget is destroyed. #7790 5208 self.beforeunloadHandler = function() { 5209 self.element.removeAttr( "autocomplete" ); 5210 }; 5211 $( window ).bind( "beforeunload", self.beforeunloadHandler ); 5212 }, 5213 5214 destroy: function() { 5215 this.element 5216 .removeClass( "ui-autocomplete-input" ) 5217 .removeAttr( "autocomplete" ) 5218 .removeAttr( "role" ) 5219 .removeAttr( "aria-autocomplete" ) 5220 .removeAttr( "aria-haspopup" ); 5221 this.menu.element.remove(); 5222 $( window ).unbind( "beforeunload", this.beforeunloadHandler ); 5223 $.Widget.prototype.destroy.call( this ); 5224 }, 5225 5226 _setOption: function( key, value ) { 5227 $.Widget.prototype._setOption.apply( this, arguments ); 5228 if ( key === "source" ) { 5229 this._initSource(); 5230 } 5231 if ( key === "appendTo" ) { 5232 this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) 5233 } 5234 if ( key === "disabled" && value && this.xhr ) { 5235 this.xhr.abort(); 5236 } 5237 }, 5238 5239 _initSource: function() { 5240 var self = this, 5241 array, 5242 url; 5243 if ( $.isArray(this.options.source) ) { 5244 array = this.options.source; 5245 this.source = function( request, response ) { 5246 response( $.ui.autocomplete.filter(array, request.term) ); 5247 }; 5248 } else if ( typeof this.options.source === "string" ) { 5249 url = this.options.source; 5250 this.source = function( request, response ) { 5251 if ( self.xhr ) { 5252 self.xhr.abort(); 5253 } 5254 self.xhr = $.ajax({ 5255 url: url, 5256 data: request, 5257 dataType: "json", 5258 success: function( data, status ) { 5259 response( data ); 5260 }, 5261 error: function() { 5262 response( [] ); 5263 } 5264 }); 5265 }; 5266 } else { 5267 this.source = this.options.source; 5268 } 5269 }, 5270 5271 search: function( value, event ) { 5272 value = value != null ? value : this.element.val(); 5273 5274 // always save the actual value, not the one passed as an argument 5275 this.term = this.element.val(); 5276 5277 if ( value.length < this.options.minLength ) { 5278 return this.close( event ); 5279 } 5280 5281 clearTimeout( this.closing ); 5282 if ( this._trigger( "search", event ) === false ) { 5283 return; 5284 } 5285 5286 return this._search( value ); 5287 }, 5288 5289 _search: function( value ) { 5290 this.pending++; 5291 this.element.addClass( "ui-autocomplete-loading" ); 5292 5293 this.source( { term: value }, this._response() ); 5294 }, 5295 5296 _response: function() { 5297 var that = this, 5298 index = ++requestIndex; 5299 5300 return function( content ) { 5301 if ( index === requestIndex ) { 5302 that.__response( content ); 5303 } 5304 5305 that.pending--; 5306 if ( !that.pending ) { 5307 that.element.removeClass( "ui-autocomplete-loading" ); 5308 } 5309 }; 5310 }, 5311 5312 __response: function( content ) { 5313 if ( !this.options.disabled && content && content.length ) { 5314 content = this._normalize( content ); 5315 this._suggest( content ); 5316 this._trigger( "open" ); 5317 } else { 5318 this.close(); 5319 } 5320 }, 5321 5322 close: function( event ) { 5323 clearTimeout( this.closing ); 5324 if ( this.menu.element.is(":visible") ) { 5325 this.menu.element.hide(); 5326 this.menu.deactivate(); 5327 this._trigger( "close", event ); 5328 } 5329 }, 5330 5331 _change: function( event ) { 5332 if ( this.previous !== this.element.val() ) { 5333 this._trigger( "change", event, { item: this.selectedItem } ); 5334 } 5335 }, 5336 5337 _normalize: function( items ) { 5338 // assume all items have the right format when the first item is complete 5339 if ( items.length && items[0].label && items[0].value ) { 5340 return items; 5341 } 5342 return $.map( items, function(item) { 5343 if ( typeof item === "string" ) { 5344 return { 5345 label: item, 5346 value: item 5347 }; 5348 } 5349 return $.extend({ 5350 label: item.label || item.value, 5351 value: item.value || item.label 5352 }, item ); 5353 }); 5354 }, 5355 5356 _suggest: function( items ) { 5357 var ul = this.menu.element 5358 .empty() 5359 .zIndex( this.element.zIndex() + 1 ); 5360 this._renderMenu( ul, items ); 5361 // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate 5362 this.menu.deactivate(); 5363 this.menu.refresh(); 5364 5365 // size and position menu 5366 ul.show(); 5367 this._resizeMenu(); 5368 ul.position( $.extend({ 5369 of: this.element 5370 }, this.options.position )); 5371 5372 if ( this.options.autoFocus ) { 5373 this.menu.next( new $.Event("mouseover") ); 5374 } 5375 }, 5376 5377 _resizeMenu: function() { 5378 var ul = this.menu.element; 5379 ul.outerWidth( Math.max( 5380 // Firefox wraps long text (possibly a rounding bug) 5381 // so we add 1px to avoid the wrapping (#7513) 5382 ul.width( "" ).outerWidth() + 1, 5383 this.element.outerWidth() 5384 ) ); 5385 }, 5386 5387 _renderMenu: function( ul, items ) { 5388 var self = this; 5389 $.each( items, function( index, item ) { 5390 self._renderItem( ul, item ); 5391 }); 5392 }, 5393 5394 _renderItem: function( ul, item) { 5395 return $( "<li></li>" ) 5396 .data( "item.autocomplete", item ) 5397 .append( $( "<a></a>" ).text( item.label ) ) 5398 .appendTo( ul ); 5399 }, 5400 5401 _move: function( direction, event ) { 5402 if ( !this.menu.element.is(":visible") ) { 5403 this.search( null, event ); 5404 return; 5405 } 5406 if ( this.menu.first() && /^previous/.test(direction) || 5407 this.menu.last() && /^next/.test(direction) ) { 5408 this.element.val( this.term ); 5409 this.menu.deactivate(); 5410 return; 5411 } 5412 this.menu[ direction ]( event ); 5413 }, 5414 5415 widget: function() { 5416 return this.menu.element; 5417 }, 5418 _keyEvent: function( keyEvent, event ) { 5419 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 5420 this._move( keyEvent, event ); 5421 5422 // prevents moving cursor to beginning/end of the text field in some browsers 5423 event.preventDefault(); 5424 } 5425 } 5426}); 5427 5428$.extend( $.ui.autocomplete, { 5429 escapeRegex: function( value ) { 5430 return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 5431 }, 5432 filter: function(array, term) { 5433 var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); 5434 return $.grep( array, function(value) { 5435 return matcher.test( value.label || value.value || value ); 5436 }); 5437 } 5438}); 5439 5440}( jQuery )); 5441 5442/* 5443 * jQuery UI Menu (not officially released) 5444 * 5445 * This widget isn't yet finished and the API is subject to change. We plan to finish 5446 * it for the next release. You're welcome to give it a try anyway and give us feedback,
5447 * as long as you're okay with migrating your code later on. We can help with that, too. 5448 * 5449 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 5450 * Dual licensed under the MIT or GPL Version 2 licenses. 5451 * http://jquery.org/license 5452 * 5453 * http://docs.jquery.com/UI/Menu 5454 * 5455 * Depends: 5456 * jquery.ui.core.js 5457 * jquery.ui.widget.js 5458 */ 5459(function($) { 5460 5461$.widget("ui.menu", { 5462 _create: function() { 5463 var self = this; 5464 this.element 5465 .addClass("ui-menu ui-widget ui-widget-content ui-corner-all") 5466 .attr({ 5467 role: "listbox", 5468 "aria-activedescendant": "ui-active-menuitem" 5469 }) 5470 .click(function( event ) { 5471 if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) { 5472 return; 5473 } 5474 // temporary 5475 event.preventDefault(); 5476 self.select( event ); 5477 }); 5478 this.refresh(); 5479 }, 5480 5481 refresh: function() { 5482 var self = this; 5483 5484 // don't refresh list items that are already adapted 5485 var items = this.element.children("li:not(.ui-menu-item):has(a)") 5486 .addClass("ui-menu-item") 5487 .attr("role", "menuitem"); 5488 5489 items.children("a") 5490 .addClass("ui-corner-all") 5491 .attr("tabindex", -1) 5492 // mouseenter doesn't work with event delegation 5493 .mouseenter(function( event ) { 5494 self.activate( event, $(this).parent() ); 5495 }) 5496 .mouseleave(function() { 5497 self.deactivate(); 5498 }); 5499 }, 5500 5501 activate: function( event, item ) { 5502 this.deactivate(); 5503 if (this.hasScroll()) { 5504 var offset = item.offset().top - this.element.offset().top, 5505 scroll = this.element.scrollTop(), 5506 elementHeight = this.element.height(); 5507 if (offset < 0) { 5508 this.element.scrollTop( scroll + offset); 5509 } else if (offset >= elementHeight) { 5510 this.element.scrollTop( scroll + offset - elementHeight + item.height()); 5511 } 5512 } 5513 this.active = item.eq(0) 5514 .children("a") 5515 .addClass("ui-state-hover") 5516 .attr("id", "ui-active-menuitem") 5517 .end(); 5518 this._trigger("focus", event, { item: item }); 5519 }, 5520 5521 deactivate: function() { 5522 if (!this.active) { return; } 5523 5524 this.active.children("a") 5525 .removeClass("ui-state-hover") 5526 .removeAttr("id"); 5527 this._trigger("blur"); 5528 this.active = null; 5529 }, 5530 5531 next: function(event) { 5532 this.move("next", ".ui-menu-item:first", event); 5533 }, 5534 5535 previous: function(event) { 5536 this.move("prev", ".ui-menu-item:last", event); 5537 }, 5538 5539 first: function() { 5540 return this.active && !this.active.prevAll(".ui-menu-item").length; 5541 }, 5542 5543 last: function() { 5544 return this.active && !this.active.nextAll(".ui-menu-item").length; 5545 }, 5546 5547 move: function(direction, edge, event) { 5548 if (!this.active) { 5549 this.activate(event, this.element.children(edge)); 5550 return; 5551 } 5552 var next = this.active[direction + "All"](".ui-menu-item").eq(0); 5553 if (next.length) { 5554 this.activate(event, next); 5555 } else { 5556 this.activate(event, this.element.children(edge)); 5557 } 5558 }, 5559 5560 // TODO merge with previousPage 5561 nextPage: function(event) { 5562 if (this.hasScroll()) { 5563 // TODO merge with no-scroll-else 5564 if (!this.active || this.last()) { 5565 this.activate(event, this.element.children(".ui-menu-item:first")); 5566 return; 5567 } 5568 var base = this.active.offset().top, 5569 height = this.element.height(), 5570 result = this.element.children(".ui-menu-item").filter(function() { 5571 var close = $(this).offset().top - base - height + $(this).height(); 5572 // TODO improve approximation 5573 return close < 10 && close > -10; 5574 }); 5575 5576 // TODO try to catch this earlier when scrollTop indicates the last page anyway 5577 if (!result.length) { 5578 result = this.element.children(".ui-menu-item:last"); 5579 } 5580 this.activate(event, result); 5581 } else { 5582 this.activate(event, this.element.children(".ui-menu-item") 5583 .filter(!this.active || this.last() ? ":first" : ":last")); 5584 } 5585 }, 5586 5587 // TODO merge with nextPage 5588 previousPage: function(event) { 5589 if (this.hasScroll()) { 5590 // TODO merge with no-scroll-else 5591 if (!this.active || this.first()) { 5592 this.activate(event, this.element.children(".ui-menu-item:last")); 5593 return; 5594 } 5595 5596 var base = this.active.offset().top, 5597 height = this.element.height(), 5598 result = this.element.children(".ui-menu-item").filter(function() { 5599 var close = $(this).offset().top - base + height - $(this).height(); 5600 // TODO improve approximation 5601 return close < 10 && close > -10; 5602 }); 5603 5604 // TODO try to catch this earlier when scrollTop indicates the last page anyway 5605 if (!result.length) { 5606 result = this.element.children(".ui-menu-item:first"); 5607 } 5608 this.activate(event, result); 5609 } else { 5610 this.activate(event, this.element.children(".ui-menu-item") 5611 .filter(!this.active || this.first() ? ":last" : ":first")); 5612 } 5613 }, 5614 5615 hasScroll: function() { 5616 return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight"); 5617 }, 5618 5619 select: function( event ) { 5620 this._trigger("selected", event, { item: this.active }); 5621 } 5622}); 5623 5624}(jQuery)); 5625/*! 5626 * jQuery UI Button 1.8.24 5627 * 5628 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5629 * Dual licensed under the MIT or GPL Version 2 licenses. 5630 * http://jquery.org/license 5631 * 5632 * http://docs.jquery.com/UI/Button 5633 * 5634 * Depends: 5635 * jquery.ui.core.js 5636 * jquery.ui.widget.js 5637 */ 5638(function( $, undefined ) { 5639 5640var lastActive, startXPos, startYPos, clickDragged, 5641 baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", 5642 stateClasses = "ui-state-hover ui-state-active ", 5643 typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", 5644 formResetHandler = function() { 5645 var buttons = $( this ).find( ":ui-button" ); 5646 setTimeout(function() { 5647 buttons.button( "refresh" ); 5648 }, 1 ); 5649 }, 5650 radioGroup = function( radio ) { 5651 var name = radio.name, 5652 form = radio.form, 5653 radios = $( [] ); 5654 if ( name ) { 5655 if ( form ) { 5656 radios = $( form ).find( "[name='" + name + "']" ); 5657 } else { 5658 radios = $( "[name='" + name + "']", radio.ownerDocument ) 5659 .filter(function() { 5660 return !this.form; 5661 }); 5662 } 5663 } 5664 return radios; 5665 }; 5666 5667$.widget( "ui.button", { 5668 options: { 5669 disabled: null, 5670 text: true, 5671 label: null, 5672 icons: { 5673 primary: null, 5674 secondary: null 5675 } 5676 }, 5677 _create: function() { 5678 this.element.closest( "form" ) 5679 .unbind( "reset.button" ) 5680 .bind( "reset.button", formResetHandler ); 5681 5682 if ( typeof this.options.disabled !== "boolean" ) { 5683 this.options.disabled = !!this.element.propAttr( "disabled" ); 5684 } else { 5685 this.element.propAttr( "disabled", this.options.disabled ); 5686 } 5687 5688 this._determineButtonType(); 5689 this.hasTitle = !!this.buttonElement.attr( "title" ); 5690 5691 var self = this, 5692 options = this.options, 5693 toggleButton = this.type === "checkbox" || this.type === "radio", 5694 hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), 5695 focusClass = "ui-state-focus"; 5696 5697 if ( options.label === null ) { 5698 options.label = this.buttonElement.html(); 5699 } 5700 5701 this.buttonElement 5702 .addClass( baseClasses ) 5703 .attr( "role", "button" ) 5704 .bind( "mouseenter.button", function() { 5705 if ( options.disabled ) { 5706 return; 5707 } 5708 $( this ).addClass( "ui-state-hover" ); 5709 if ( this === lastActive ) { 5710 $( this ).addClass( "ui-state-active" ); 5711 } 5712 }) 5713 .bind( "mouseleave.button", function() { 5714 if ( options.disabled ) { 5715 return; 5716 } 5717 $( this ).removeClass( hoverClass ); 5718 }) 5719 .bind( "click.button", function( event ) { 5720 if ( options.disabled ) { 5721 event.preventDefault(); 5722 event.stopImmediatePropagation(); 5723 } 5724 }); 5725 5726 this.element 5727 .bind( "focus.button", function() { 5728 // no need to check disabled, focus won't be triggered anyway 5729 self.buttonElement.addClass( focusClass ); 5730 }) 5731 .bind( "blur.button", function() { 5732 self.buttonElement.removeClass( focusClass ); 5733 }); 5734 5735 if ( toggleButton ) { 5736 this.element.bind( "change.button", function() { 5737 if ( clickDragged ) { 5738 return; 5739 } 5740 self.refresh(); 5741 }); 5742 // if mouse moves between mousedown and mouseup (drag) set clickDragged flag 5743 // prevents issue where button state changes but checkbox/radio checked state 5744 // does not in Firefox (see ticket #6970) 5745 this.buttonElement 5746 .bind( "mousedown.button", function( event ) { 5747 if ( options.disabled ) { 5748 return; 5749 } 5750 clickDragged = false;
vendor: 5,765 bytes, lines 5751-5950
5751 startXPos = event.pageX; 5752 startYPos = event.pageY; 5753 }) 5754 .bind( "mouseup.button", function( event ) { 5755 if ( options.disabled ) { 5756 return; 5757 } 5758 if ( startXPos !== event.pageX || startYPos !== event.pageY ) { 5759 clickDragged = true; 5760 } 5761 }); 5762 } 5763 5764 if ( this.type === "checkbox" ) { 5765 this.buttonElement.bind( "click.button", function() { 5766 if ( options.disabled || clickDragged ) { 5767 return false; 5768 } 5769 $( this ).toggleClass( "ui-state-active" ); 5770 self.buttonElement.attr( "aria-pressed", self.element[0].checked ); 5771 }); 5772 } else if ( this.type === "radio" ) { 5773 this.buttonElement.bind( "click.button", function() { 5774 if ( options.disabled || clickDragged ) { 5775 return false; 5776 } 5777 $( this ).addClass( "ui-state-active" ); 5778 self.buttonElement.attr( "aria-pressed", "true" ); 5779 5780 var radio = self.element[ 0 ]; 5781 radioGroup( radio ) 5782 .not( radio ) 5783 .map(function() { 5784 return $( this ).button( "widget" )[ 0 ]; 5785 }) 5786 .removeClass( "ui-state-active" ) 5787 .attr( "aria-pressed", "false" ); 5788 }); 5789 } else { 5790 this.buttonElement 5791 .bind( "mousedown.button", function() { 5792 if ( options.disabled ) { 5793 return false; 5794 } 5795 $( this ).addClass( "ui-state-active" ); 5796 lastActive = this; 5797 $( document ).one( "mouseup", function() { 5798 lastActive = null; 5799 }); 5800 }) 5801 .bind( "mouseup.button", function() { 5802 if ( options.disabled ) { 5803 return false; 5804 } 5805 $( this ).removeClass( "ui-state-active" ); 5806 }) 5807 .bind( "keydown.button", function(event) { 5808 if ( options.disabled ) { 5809 return false; 5810 } 5811 if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { 5812 $( this ).addClass( "ui-state-active" ); 5813 } 5814 }) 5815 .bind( "keyup.button", function() { 5816 $( this ).removeClass( "ui-state-active" ); 5817 }); 5818 5819 if ( this.buttonElement.is("a") ) { 5820 this.buttonElement.keyup(function(event) { 5821 if ( event.keyCode === $.ui.keyCode.SPACE ) { 5822 // TODO pass through original event correctly (just as 2nd argument doesn't work) 5823 $( this ).click(); 5824 } 5825 }); 5826 } 5827 } 5828 5829 // TODO: pull out $.Widget's handling for the disabled option into 5830 // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can 5831 // be overridden by individual plugins 5832 this._setOption( "disabled", options.disabled ); 5833 this._resetButton(); 5834 }, 5835 5836 _determineButtonType: function() { 5837 5838 if ( this.element.is(":checkbox") ) { 5839 this.type = "checkbox"; 5840 } else if ( this.element.is(":radio") ) { 5841 this.type = "radio"; 5842 } else if ( this.element.is("input") ) { 5843 this.type = "input"; 5844 } else { 5845 this.type = "button"; 5846 } 5847 5848 if ( this.type === "checkbox" || this.type === "radio" ) { 5849 // we don't search against the document in case the element 5850 // is disconnected from the DOM 5851 var ancestor = this.element.parents().filter(":last"), 5852 labelSelector = "label[for='" + this.element.attr("id") + "']"; 5853 this.buttonElement = ancestor.find( labelSelector ); 5854 if ( !this.buttonElement.length ) { 5855 ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); 5856 this.buttonElement = ancestor.filter( labelSelector ); 5857 if ( !this.buttonElement.length ) { 5858 this.buttonElement = ancestor.find( labelSelector ); 5859 } 5860 } 5861 this.element.addClass( "ui-helper-hidden-accessible" ); 5862 5863 var checked = this.element.is( ":checked" ); 5864 if ( checked ) { 5865 this.buttonElement.addClass( "ui-state-active" ); 5866 } 5867 this.buttonElement.attr( "aria-pressed", checked ); 5868 } else { 5869 this.buttonElement = this.element; 5870 } 5871 }, 5872 5873 widget: function() { 5874 return this.buttonElement; 5875 }, 5876 5877 destroy: function() { 5878 this.element 5879 .removeClass( "ui-helper-hidden-accessible" ); 5880 this.buttonElement 5881 .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) 5882 .removeAttr( "role" ) 5883 .removeAttr( "aria-pressed" ) 5884 .html( this.buttonElement.find(".ui-button-text").html() ); 5885 5886 if ( !this.hasTitle ) { 5887 this.buttonElement.removeAttr( "title" ); 5888 } 5889 5890 $.Widget.prototype.destroy.call( this ); 5891 }, 5892 5893 _setOption: function( key, value ) { 5894 $.Widget.prototype._setOption.apply( this, arguments ); 5895 if ( key === "disabled" ) { 5896 if ( value ) { 5897 this.element.propAttr( "disabled", true ); 5898 } else { 5899 this.element.propAttr( "disabled", false ); 5900 } 5901 return; 5902 } 5903 this._resetButton(); 5904 }, 5905 5906 refresh: function() { 5907 var isDisabled = this.element.is( ":disabled" ); 5908 if ( isDisabled !== this.options.disabled ) { 5909 this._setOption( "disabled", isDisabled ); 5910 } 5911 if ( this.type === "radio" ) { 5912 radioGroup( this.element[0] ).each(function() { 5913 if ( $( this ).is( ":checked" ) ) { 5914 $( this ).button( "widget" ) 5915 .addClass( "ui-state-active" ) 5916 .attr( "aria-pressed", "true" ); 5917 } else { 5918 $( this ).button( "widget" ) 5919 .removeClass( "ui-state-active" ) 5920 .attr( "aria-pressed", "false" ); 5921 } 5922 }); 5923 } else if ( this.type === "checkbox" ) { 5924 if ( this.element.is( ":checked" ) ) { 5925 this.buttonElement 5926 .addClass( "ui-state-active" ) 5927 .attr( "aria-pressed", "true" ); 5928 } else { 5929 this.buttonElement 5930 .removeClass( "ui-state-active" ) 5931 .attr( "aria-pressed", "false" ); 5932 } 5933 } 5934 }, 5935 5936 _resetButton: function() { 5937 if ( this.type === "input" ) { 5938 if ( this.options.label ) { 5939 this.element.val( this.options.label ); 5940 } 5941 return; 5942 } 5943 var buttonElement = this.buttonElement.removeClass( typeClasses ), 5944 buttonText = $( "<span></span>", this.element[0].ownerDocument ) 5945 .addClass( "ui-button-text" ) 5946 .html( this.options.label ) 5947 .appendTo( buttonElement.empty() ) 5948 .text(), 5949 icons = this.options.icons, 5950 multipleIcons = icons.primary && icons.secondary,
5951 buttonClasses = []; 5952 5953 if ( icons.primary || icons.secondary ) { 5954 if ( this.options.text ) { 5955 buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); 5956 } 5957 5958 if ( icons.primary ) { 5959 buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); 5960 } 5961 5962 if ( icons.secondary ) { 5963 buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); 5964 } 5965 5966 if ( !this.options.text ) { 5967 buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); 5968 5969 if ( !this.hasTitle ) { 5970 buttonElement.attr( "title", buttonText ); 5971 } 5972 } 5973 } else { 5974 buttonClasses.push( "ui-button-text-only" ); 5975 } 5976 buttonElement.addClass( buttonClasses.join( " " ) ); 5977 } 5978}); 5979 5980$.widget( "ui.buttonset", { 5981 options: { 5982 items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" 5983 }, 5984 5985 _create: function() { 5986 this.element.addClass( "ui-buttonset" ); 5987 }, 5988 5989 _init: function() { 5990 this.refresh(); 5991 }, 5992 5993 _setOption: function( key, value ) { 5994 if ( key === "disabled" ) { 5995 this.buttons.button( "option", key, value ); 5996 } 5997 5998 $.Widget.prototype._setOption.apply( this, arguments ); 5999 }, 6000 6001 refresh: function() { 6002 var rtl = this.element.css( "direction" ) === "rtl"; 6003 6004 this.buttons = this.element.find( this.options.items ) 6005 .filter( ":ui-button" ) 6006 .button( "refresh" ) 6007 .end() 6008 .not( ":ui-button" ) 6009 .button() 6010 .end() 6011 .map(function() { 6012 return $( this ).button( "widget" )[ 0 ]; 6013 }) 6014 .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) 6015 .filter( ":first" ) 6016 .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) 6017 .end() 6018 .filter( ":last" ) 6019 .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) 6020 .end() 6021 .end(); 6022 }, 6023 6024 destroy: function() { 6025 this.element.removeClass( "ui-buttonset" ); 6026 this.buttons 6027 .map(function() { 6028 return $( this ).button( "widget" )[ 0 ]; 6029 }) 6030 .removeClass( "ui-corner-left ui-corner-right" ) 6031 .end() 6032 .button( "destroy" ); 6033 6034 $.Widget.prototype.destroy.call( this ); 6035 } 6036}); 6037 6038}( jQuery ) ); 6039/*! 6040 * jQuery UI Dialog 1.8.24 6041 * 6042 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 6043 * Dual licensed under the MIT or GPL Version 2 licenses. 6044 * http://jquery.org/license 6045 * 6046 * http://docs.jquery.com/UI/Dialog 6047 * 6048 * Depends: 6049 * jquery.ui.core.js 6050 * jquery.ui.widget.js 6051 * jquery.ui.button.js 6052 * jquery.ui.draggable.js 6053 * jquery.ui.mouse.js 6054 * jquery.ui.position.js 6055 * jquery.ui.resizable.js 6056 */ 6057(function( $, undefined ) { 6058 6059var uiDialogClasses = 6060 'ui-dialog ' + 6061 'ui-widget ' + 6062 'ui-widget-content ' + 6063 'ui-corner-all ', 6064 sizeRelatedOptions = { 6065 buttons: true, 6066 height: true, 6067 maxHeight: true, 6068 maxWidth: true, 6069 minHeight: true, 6070 minWidth: true, 6071 width: true 6072 }, 6073 resizableRelatedOptions = { 6074 maxHeight: true, 6075 maxWidth: true, 6076 minHeight: true, 6077 minWidth: true 6078 }; 6079 6080$.widget("ui.dialog", { 6081 options: { 6082 autoOpen: true, 6083 buttons: {}, 6084 closeOnEscape: true, 6085 closeText: 'close', 6086 dialogClass: '', 6087 draggable: true, 6088 hide: null, 6089 height: 'auto', 6090 maxHeight: false, 6091 maxWidth: false, 6092 minHeight: 150, 6093 minWidth: 150, 6094 modal: false, 6095 position: { 6096 my: 'center', 6097 at: 'center', 6098 collision: 'fit', 6099 // ensure that the titlebar is never outside the document 6100 using: function(pos) { 6101 var topOffset = $(this).css(pos).offset().top; 6102 if (topOffset < 0) { 6103 $(this).css('top', pos.top - topOffset); 6104 } 6105 } 6106 }, 6107 resizable: true, 6108 show: null, 6109 stack: true, 6110 title: '', 6111 width: 300, 6112 zIndex: 1000 6113 }, 6114 6115 _create: function() { 6116 this.originalTitle = this.element.attr('title'); 6117 // #5742 - .attr() might return a DOMElement 6118 if ( typeof this.originalTitle !== "string" ) { 6119 this.originalTitle = ""; 6120 } 6121 6122 this.options.title = this.options.title || this.originalTitle; 6123 var self = this, 6124 options = self.options, 6125 6126 title = options.title || ' ', 6127 titleId = $.ui.dialog.getTitleId(self.element), 6128 6129 uiDialog = (self.uiDialog = $('<div></div>')) 6130 .appendTo(document.body) 6131 .hide() 6132 .addClass(uiDialogClasses + options.dialogClass) 6133 .css({ 6134 zIndex: options.zIndex 6135 }) 6136 // setting tabIndex makes the div focusable 6137 // setting outline to 0 prevents a border on focus in Mozilla 6138 .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { 6139 if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 6140 event.keyCode === $.ui.keyCode.ESCAPE) { 6141 6142 self.close(event); 6143 event.preventDefault(); 6144 } 6145 }) 6146 .attr({ 6147 role: 'dialog', 6148 'aria-labelledby': titleId 6149 }) 6150 .mousedown(function(event) { 6151 self.moveToTop(false, event); 6152 }), 6153 6154 uiDialogContent = self.element 6155 .show() 6156 .removeAttr('title') 6157 .addClass( 6158 'ui-dialog-content ' + 6159 'ui-widget-content') 6160 .appendTo(uiDialog), 6161 6162 uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>')) 6163 .addClass( 6164 'ui-dialog-titlebar ' + 6165 'ui-widget-header ' + 6166 'ui-corner-all ' + 6167 'ui-helper-clearfix' 6168 ) 6169 .prependTo(uiDialog), 6170 6171 uiDialogTitlebarClose = $('<a href="#"></a>') 6172 .addClass( 6173 'ui-dialog-titlebar-close ' + 6174 'ui-corner-all' 6175 ) 6176 .attr('role', 'button') 6177 .hover( 6178 function() { 6179 uiDialogTitlebarClose.addClass('ui-state-hover'); 6180 }, 6181 function() { 6182 uiDialogTitlebarClose.removeClass('ui-state-hover'); 6183 } 6184 ) 6185 .focus(function() { 6186 uiDialogTitlebarClose.addClass('ui-state-focus'); 6187 }) 6188 .blur(function() { 6189 uiDialogTitlebarClose.removeClass('ui-state-focus'); 6190 }) 6191 .click(function(event) { 6192 self.close(event); 6193 return false;
6194 }) 6195 .appendTo(uiDialogTitlebar), 6196 6197 uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>')) 6198 .addClass( 6199 'ui-icon ' + 6200 'ui-icon-closethick' 6201 ) 6202 .text(options.closeText) 6203 .appendTo(uiDialogTitlebarClose), 6204 6205 uiDialogTitle = $('<span></span>') 6206 .addClass('ui-dialog-title') 6207 .attr('id', titleId) 6208 .html(title) 6209 .prependTo(uiDialogTitlebar); 6210 6211 //handling of deprecated beforeclose (vs beforeClose) option 6212 //Ticket #4669 http://dev.jqueryui.com/ticket/4669 6213 //TODO: remove in 1.9pre 6214 if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { 6215 options.beforeClose = options.beforeclose; 6216 } 6217 6218 uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); 6219 6220 if (options.draggable && $.fn.draggable) { 6221 self._makeDraggable(); 6222 } 6223 if (options.resizable && $.fn.resizable) { 6224 self._makeResizable(); 6225 } 6226 6227 self._createButtons(options.buttons); 6228 self._isOpen = false; 6229 6230 if ($.fn.bgiframe) { 6231 uiDialog.bgiframe(); 6232 } 6233 }, 6234 6235 _init: function() { 6236 if ( this.options.autoOpen ) { 6237 this.open(); 6238 } 6239 }, 6240 6241 destroy: function() { 6242 var self = this; 6243 6244 if (self.overlay) { 6245 self.overlay.destroy(); 6246 } 6247 self.uiDialog.hide(); 6248 self.element 6249 .unbind('.dialog') 6250 .removeData('dialog') 6251 .removeClass('ui-dialog-content ui-widget-content') 6252 .hide().appendTo('body'); 6253 self.uiDialog.remove(); 6254 6255 if (self.originalTitle) { 6256 self.element.attr('title', self.originalTitle); 6257 } 6258 6259 return self; 6260 }, 6261 6262 widget: function() { 6263 return this.uiDialog; 6264 }, 6265 6266 close: function(event) { 6267 var self = this, 6268 maxZ, thisZ; 6269 6270 if (false === self._trigger('beforeClose', event)) { 6271 return; 6272 } 6273 6274 if (self.overlay) { 6275 self.overlay.destroy(); 6276 } 6277 self.uiDialog.unbind('keypress.ui-dialog'); 6278 6279 self._isOpen = false; 6280 6281 if (self.options.hide) { 6282 self.uiDialog.hide(self.options.hide, function() { 6283 self._trigger('close', event); 6284 }); 6285 } else { 6286 self.uiDialog.hide(); 6287 self._trigger('close', event); 6288 } 6289 6290 $.ui.dialog.overlay.resize(); 6291 6292 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 6293 if (self.options.modal) { 6294 maxZ = 0; 6295 $('.ui-dialog').each(function() { 6296 if (this !== self.uiDialog[0]) { 6297 thisZ = $(this).css('z-index'); 6298 if(!isNaN(thisZ)) { 6299 maxZ = Math.max(maxZ, thisZ); 6300 } 6301 } 6302 }); 6303 $.ui.dialog.maxZ = maxZ; 6304 } 6305 6306 return self; 6307 }, 6308 6309 isOpen: function() { 6310 return this._isOpen; 6311 }, 6312 6313 // the force parameter allows us to move modal dialogs to their correct 6314 // position on open 6315 moveToTop: function(force, event) { 6316 var self = this, 6317 options = self.options, 6318 saveScroll; 6319 6320 if ((options.modal && !force) || 6321 (!options.stack && !options.modal)) { 6322 return self._trigger('focus', event); 6323 } 6324 6325 if (options.zIndex > $.ui.dialog.maxZ) { 6326 $.ui.dialog.maxZ = options.zIndex; 6327 } 6328 if (self.overlay) { 6329 $.ui.dialog.maxZ += 1; 6330 self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); 6331 } 6332 6333 //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. 6334 // http://ui.jquery.com/bugs/ticket/3193 6335 saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() }; 6336 $.ui.dialog.maxZ += 1; 6337 self.uiDialog.css('z-index', $.ui.dialog.maxZ); 6338 self.element.attr(saveScroll); 6339 self._trigger('focus', event); 6340 6341 return self; 6342 }, 6343 6344 open: function() { 6345 if (this._isOpen) { return; } 6346 6347 var self = this, 6348 options = self.options, 6349 uiDialog = self.uiDialog; 6350 6351 self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; 6352 self._size(); 6353 self._position(options.position); 6354 uiDialog.show(options.show); 6355 self.moveToTop(true); 6356 6357 // prevent tabbing out of modal dialogs 6358 if ( options.modal ) { 6359 uiDialog.bind( "keydown.ui-dialog", function( event ) { 6360 if ( event.keyCode !== $.ui.keyCode.TAB ) { 6361 return; 6362 } 6363 6364 var tabbables = $(':tabbable', this), 6365 first = tabbables.filter(':first'), 6366 last = tabbables.filter(':last'); 6367 6368 if (event.target === last[0] && !event.shiftKey) { 6369 first.focus(1); 6370 return false;
6371 } else if (event.target === first[0] && event.shiftKey) { 6372 last.focus(1); 6373 return false; 6374 } 6375 }); 6376 } 6377 6378 // set focus to the first tabbable element in the content area or the first button 6379 // if there are no tabbable elements, set focus on the dialog itself 6380 $(self.element.find(':tabbable').get().concat( 6381 uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( 6382 uiDialog.get()))).eq(0).focus(); 6383 6384 self._isOpen = true; 6385 self._trigger('open'); 6386 6387 return self; 6388 }, 6389 6390 _createButtons: function(buttons) { 6391 var self = this, 6392 hasButtons = false, 6393 uiDialogButtonPane = $('<div></div>') 6394 .addClass( 6395 'ui-dialog-buttonpane ' + 6396 'ui-widget-content ' + 6397 'ui-helper-clearfix' 6398 ), 6399 uiButtonSet = $( "<div></div>" ) 6400 .addClass( "ui-dialog-buttonset" ) 6401 .appendTo( uiDialogButtonPane ); 6402 6403 // if we already have a button pane, remove it 6404 self.uiDialog.find('.ui-dialog-buttonpane').remove(); 6405 6406 if (typeof buttons === 'object' && buttons !== null) { 6407 $.each(buttons, function() { 6408 return !(hasButtons = true); 6409 }); 6410 } 6411 if (hasButtons) { 6412 $.each(buttons, function(name, props) { 6413 props = $.isFunction( props ) ? 6414 { click: props, text: name } : 6415 props; 6416 var button = $('<button type="button"></button>') 6417 .click(function() { 6418 props.click.apply(self.element[0], arguments); 6419 }) 6420 .appendTo(uiButtonSet); 6421 // can't use .attr( props, true ) with jQuery 1.3.2. 6422 $.each( props, function( key, value ) { 6423 if ( key === "click" ) { 6424 return; 6425 } 6426 if ( key in button ) { 6427 button[ key ]( value ); 6428 } else { 6429 button.attr( key, value ); 6430 } 6431 }); 6432 if ($.fn.button) { 6433 button.button(); 6434 } 6435 }); 6436 uiDialogButtonPane.appendTo(self.uiDialog); 6437 } 6438 }, 6439 6440 _makeDraggable: function() { 6441 var self = this, 6442 options = self.options, 6443 doc = $(document), 6444 heightBeforeDrag; 6445 6446 function filteredUi(ui) { 6447 return { 6448 position: ui.position, 6449 offset: ui.offset 6450 }; 6451 } 6452 6453 self.uiDialog.draggable({ 6454 cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', 6455 handle: '.ui-dialog-titlebar', 6456 containment: 'document', 6457 start: function(event, ui) { 6458 heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); 6459 $(this).height($(this).height()).addClass("ui-dialog-dragging"); 6460 self._trigger('dragStart', event, filteredUi(ui)); 6461 }, 6462 drag: function(event, ui) { 6463 self._trigger('drag', event, filteredUi(ui)); 6464 }, 6465 stop: function(event, ui) { 6466 options.position = [ui.position.left - doc.scrollLeft(), 6467 ui.position.top - doc.scrollTop()]; 6468 $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); 6469 self._trigger('dragStop', event, filteredUi(ui)); 6470 $.ui.dialog.overlay.resize(); 6471 } 6472 }); 6473 }, 6474 6475 _makeResizable: function(handles) { 6476 handles = (handles === undefined ? this.options.resizable : handles); 6477 var self = this, 6478 options = self.options, 6479 // .ui-resizable has position: relative defined in the stylesheet 6480 // but dialogs have to use absolute or fixed positioning 6481 position = self.uiDialog.css('position'), 6482 resizeHandles = (typeof handles === 'string' ? 6483 handles : 6484 'n,e,s,w,se,sw,ne,nw' 6485 ); 6486 6487 function filteredUi(ui) { 6488 return { 6489 originalPosition: ui.originalPosition, 6490 originalSize: ui.originalSize, 6491 position: ui.position, 6492 size: ui.size 6493 }; 6494 } 6495 6496 self.uiDialog.resizable({ 6497 cancel: '.ui-dialog-content', 6498 containment: 'document', 6499 alsoResize: self.element, 6500 maxWidth: options.maxWidth, 6501 maxHeight: options.maxHeight, 6502 minWidth: options.minWidth, 6503 minHeight: self._minHeight(), 6504 handles: resizeHandles, 6505 start: function(event, ui) { 6506 $(this).addClass("ui-dialog-resizing"); 6507 self._trigger('resizeStart', event, filteredUi(ui)); 6508 }, 6509 resize: function(event, ui) { 6510 self._trigger('resize', event, filteredUi(ui)); 6511 }, 6512 stop: function(event, ui) { 6513 $(this).removeClass("ui-dialog-resizing"); 6514 options.height = $(this).height(); 6515 options.width = $(this).width(); 6516 self._trigger('resizeStop', event, filteredUi(ui)); 6517 $.ui.dialog.overlay.resize(); 6518 } 6519 }) 6520 .css('position', position) 6521 .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); 6522 }, 6523 6524 _minHeight: function() { 6525 var options = this.options; 6526 6527 if (options.height === 'auto') { 6528 return options.minHeight; 6529 } else { 6530 return Math.min(options.minHeight, options.height); 6531 } 6532 }, 6533 6534 _position: function(position) { 6535 var myAt = [], 6536 offset = [0, 0], 6537 isVisible; 6538 6539 if (position) { 6540 // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( 6541 // if (typeof position == 'string' || $.isArray(position)) { 6542 // myAt = $.isArray(position) ? position : position.split(' '); 6543 6544 if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { 6545 myAt = position.split ? position.split(' ') : [position[0], position[1]]; 6546 if (myAt.length === 1) { 6547 myAt[1] = myAt[0]; 6548 } 6549 6550 $.each(['left', 'top'], function(i, offsetPosition) { 6551 if (+myAt[i] === myAt[i]) { 6552 offset[i] = myAt[i]; 6553 myAt[i] = offsetPosition; 6554 } 6555 }); 6556 6557 position = { 6558 my: myAt.join(" "), 6559 at: myAt.join(" "),
6560 offset: offset.join(" ") 6561 }; 6562 } 6563 6564 position = $.extend({}, $.ui.dialog.prototype.options.position, position); 6565 } else { 6566 position = $.ui.dialog.prototype.options.position; 6567 } 6568 6569 // need to show the dialog to get the actual offset in the position plugin 6570 isVisible = this.uiDialog.is(':visible'); 6571 if (!isVisible) { 6572 this.uiDialog.show(); 6573 } 6574 this.uiDialog 6575 // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 6576 .css({ top: 0, left: 0 }) 6577 .position($.extend({ of: window }, position)); 6578 if (!isVisible) { 6579 this.uiDialog.hide(); 6580 } 6581 }, 6582 6583 _setOptions: function( options ) { 6584 var self = this, 6585 resizableOptions = {}, 6586 resize = false; 6587 6588 $.each( options, function( key, value ) { 6589 self._setOption( key, value ); 6590 6591 if ( key in sizeRelatedOptions ) { 6592 resize = true; 6593 } 6594 if ( key in resizableRelatedOptions ) { 6595 resizableOptions[ key ] = value; 6596 } 6597 }); 6598 6599 if ( resize ) { 6600 this._size(); 6601 } 6602 if ( this.uiDialog.is( ":data(resizable)" ) ) { 6603 this.uiDialog.resizable( "option", resizableOptions ); 6604 } 6605 }, 6606 6607 _setOption: function(key, value){ 6608 var self = this, 6609 uiDialog = self.uiDialog; 6610 6611 switch (key) { 6612 //handling of deprecated beforeclose (vs beforeClose) option 6613 //Ticket #4669 http://dev.jqueryui.com/ticket/4669 6614 //TODO: remove in 1.9pre 6615 case "beforeclose": 6616 key = "beforeClose"; 6617 break; 6618 case "buttons": 6619 self._createButtons(value); 6620 break; 6621 case "closeText": 6622 // ensure that we always pass a string 6623 self.uiDialogTitlebarCloseText.text("" + value); 6624 break; 6625 case "dialogClass": 6626 uiDialog 6627 .removeClass(self.options.dialogClass) 6628 .addClass(uiDialogClasses + value); 6629 break; 6630 case "disabled": 6631 if (value) { 6632 uiDialog.addClass('ui-dialog-disabled'); 6633 } else { 6634 uiDialog.removeClass('ui-dialog-disabled'); 6635 } 6636 break; 6637 case "draggable": 6638 var isDraggable = uiDialog.is( ":data(draggable)" ); 6639 if ( isDraggable && !value ) { 6640 uiDialog.draggable( "destroy" ); 6641 } 6642 6643 if ( !isDraggable && value ) { 6644 self._makeDraggable(); 6645 } 6646 break; 6647 case "position": 6648 self._position(value); 6649 break; 6650 case "resizable": 6651 // currently resizable, becoming non-resizable 6652 var isResizable = uiDialog.is( ":data(resizable)" ); 6653 if (isResizable && !value) { 6654 uiDialog.resizable('destroy'); 6655 } 6656 6657 // currently resizable, changing handles 6658 if (isResizable && typeof value === 'string') { 6659 uiDialog.resizable('option', 'handles', value); 6660 } 6661 6662 // currently non-resizable, becoming resizable 6663 if (!isResizable && value !== false) { 6664 self._makeResizable(value); 6665 } 6666 break; 6667 case "title": 6668 // convert whatever was passed in o a string, for html() to not throw up 6669 $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); 6670 break; 6671 } 6672 6673 $.Widget.prototype._setOption.apply(self, arguments); 6674 }, 6675 6676 _size: function() { 6677 /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 6678 * divs will both have width and height set, so we need to reset them 6679 */ 6680 var options = this.options, 6681 nonContentHeight, 6682 minContentHeight, 6683 isVisible = this.uiDialog.is( ":visible" ); 6684 6685 // reset content sizing 6686 this.element.show().css({ 6687 width: 'auto', 6688 minHeight: 0, 6689 height: 0 6690 }); 6691 6692 if (options.minWidth > options.width) { 6693 options.width = options.minWidth; 6694 } 6695 6696 // reset wrapper sizing 6697 // determine the height of all the non-content elements 6698 nonContentHeight = this.uiDialog.css({ 6699 height: 'auto', 6700 width: options.width 6701 }) 6702 .height(); 6703 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 6704 6705 if ( options.height === "auto" ) { 6706 // only needed for IE6 support 6707 if ( $.support.minHeight ) { 6708 this.element.css({ 6709 minHeight: minContentHeight, 6710 height: "auto" 6711 }); 6712 } else { 6713 this.uiDialog.show(); 6714 var autoHeight = this.element.css( "height", "auto" ).height(); 6715 if ( !isVisible ) { 6716 this.uiDialog.hide(); 6717 } 6718 this.element.height( Math.max( autoHeight, minContentHeight ) ); 6719 } 6720 } else { 6721 this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); 6722 } 6723 6724 if (this.uiDialog.is(':data(resizable)')) { 6725 this.uiDialog.resizable('option', 'minHeight', this._minHeight()); 6726 } 6727 } 6728}); 6729 6730$.extend($.ui.dialog, { 6731 version: "1.8.24", 6732 6733 uuid: 0, 6734 maxZ: 0, 6735 6736 getTitleId: function($el) { 6737 var id = $el.attr('id'); 6738 if (!id) { 6739 this.uuid += 1; 6740 id = this.uuid; 6741 } 6742 return 'ui-dialog-title-' + id; 6743 }, 6744 6745 overlay: function(dialog) { 6746 this.$el = $.ui.dialog.overlay.create(dialog); 6747 } 6748}); 6749 6750$.extend($.ui.dialog.overlay, { 6751 instances: [], 6752 // reuse old instances due to IE memory leak with alpha transparency (see #5185) 6753 oldInstances: [], 6754 maxZ: 0, 6755 events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), 6756 function(event) { return event + '.dialog-overlay'; }).join(' '), 6757 create: function(dialog) { 6758 if (this.instances.length === 0) { 6759 // prevent use of anchors and inputs 6760 // we use a setTimeout in case the overlay is created from an 6761 // event that we're going to be cancelling (see #2804) 6762 setTimeout(function() { 6763 // handle $(el).dialog().dialog('close') (see #4065) 6764 if ($.ui.dialog.overlay.instances.length) { 6765 $(document).bind($.ui.dialog.overlay.events, function(event) { 6766 // stop events if the z-index of the target is < the z-index of the overlay 6767 // we cannot return true when we don't want to cancel the event (#3523) 6768 if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { 6769 return false;
6770 } 6771 }); 6772 } 6773 }, 1); 6774 6775 // allow closing by pressing the escape key 6776 $(document).bind('keydown.dialog-overlay', function(event) { 6777 if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 6778 event.keyCode === $.ui.keyCode.ESCAPE) { 6779 6780 dialog.close(event); 6781 event.preventDefault(); 6782 } 6783 }); 6784 6785 // handle window resize 6786 $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); 6787 } 6788 6789 var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay')) 6790 .appendTo(document.body) 6791 .css({ 6792 width: this.width(), 6793 height: this.height() 6794 }); 6795 6796 if ($.fn.bgiframe) { 6797 $el.bgiframe(); 6798 } 6799 6800 this.instances.push($el); 6801 return $el; 6802 }, 6803 6804 destroy: function($el) { 6805 var indexOf = $.inArray($el, this.instances); 6806 if (indexOf != -1){ 6807 this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); 6808 } 6809 6810 if (this.instances.length === 0) { 6811 $([document, window]).unbind('.dialog-overlay'); 6812 } 6813 6814 $el.remove(); 6815 6816 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 6817 var maxZ = 0; 6818 $.each(this.instances, function() { 6819 maxZ = Math.max(maxZ, this.css('z-index')); 6820 }); 6821 this.maxZ = maxZ; 6822 }, 6823 6824 height: function() { 6825 var scrollHeight, 6826 offsetHeight; 6827 // handle IE 6 6828 if ($.browser.msie && $.browser.version < 7) { 6829 scrollHeight = Math.max( 6830 document.documentElement.scrollHeight, 6831 document.body.scrollHeight 6832 ); 6833 offsetHeight = Math.max( 6834 document.documentElement.offsetHeight, 6835 document.body.offsetHeight 6836 ); 6837 6838 if (scrollHeight < offsetHeight) { 6839 return $(window).height() + 'px'; 6840 } else { 6841 return scrollHeight + 'px'; 6842 } 6843 // handle "good" browsers 6844 } else { 6845 return $(document).height() + 'px'; 6846 } 6847 }, 6848 6849 width: function() { 6850 var scrollWidth, 6851 offsetWidth; 6852 // handle IE 6853 if ( $.browser.msie ) { 6854 scrollWidth = Math.max( 6855 document.documentElement.scrollWidth, 6856 document.body.scrollWidth 6857 ); 6858 offsetWidth = Math.max( 6859 document.documentElement.offsetWidth, 6860 document.body.offsetWidth 6861 ); 6862 6863 if (scrollWidth < offsetWidth) { 6864 return $(window).width() + 'px'; 6865 } else { 6866 return scrollWidth + 'px'; 6867 } 6868 // handle "good" browsers 6869 } else { 6870 return $(document).width() + 'px'; 6871 } 6872 }, 6873 6874 resize: function() { 6875 /* If the dialog is draggable and the user drags it past the 6876 * right edge of the window, the document becomes wider so we 6877 * need to stretch the overlay. If the user then drags the 6878 * dialog back to the left, the document will become narrower, 6879 * so we need to shrink the overlay to the appropriate size. 6880 * This is handled by shrinking the overlay before setting it 6881 * to the full document size. 6882 */ 6883 var $overlays = $([]); 6884 $.each($.ui.dialog.overlay.instances, function() { 6885 $overlays = $overlays.add(this); 6886 }); 6887 6888 $overlays.css({ 6889 width: 0, 6890 height: 0 6891 }).css({ 6892 width: $.ui.dialog.overlay.width(), 6893 height: $.ui.dialog.overlay.height() 6894 }); 6895 } 6896}); 6897 6898$.extend($.ui.dialog.overlay.prototype, { 6899 destroy: function() { 6900 $.ui.dialog.overlay.destroy(this.$el); 6901 } 6902}); 6903 6904}(jQuery)); 6905/*! 6906 * jQuery UI Slider 1.8.24 6907 * 6908 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 6909 * Dual licensed under the MIT or GPL Version 2 licenses. 6910 * http://jquery.org/license 6911 * 6912 * http://docs.jquery.com/UI/Slider 6913 * 6914 * Depends: 6915 * jquery.ui.core.js 6916 * jquery.ui.mouse.js 6917 * jquery.ui.widget.js 6918 */ 6919(function( $, undefined ) { 6920 6921// number of pages in a slider 6922// (how many times can you page up/down to go through the whole range) 6923var numPages = 5; 6924 6925$.widget( "ui.slider", $.ui.mouse, { 6926 6927 widgetEventPrefix: "slide", 6928 6929 options: { 6930 animate: false, 6931 distance: 0, 6932 max: 100, 6933 min: 0, 6934 orientation: "horizontal", 6935 range: false, 6936 step: 1, 6937 value: 0, 6938 values: null 6939 }, 6940 6941 _create: function() { 6942 var self = this, 6943 o = this.options, 6944 existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), 6945 handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", 6946 handleCount = ( o.values && o.values.length ) || 1, 6947 handles = []; 6948 6949 this._keySliding = false;
6950 this._mouseSliding = false; 6951 this._animateOff = true; 6952 this._handleIndex = null; 6953 this._detectOrientation(); 6954 this._mouseInit(); 6955 6956 this.element 6957 .addClass( "ui-slider" + 6958 " ui-slider-" + this.orientation + 6959 " ui-widget" + 6960 " ui-widget-content" + 6961 " ui-corner-all" + 6962 ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); 6963 6964 this.range = $([]); 6965 6966 if ( o.range ) { 6967 if ( o.range === true ) { 6968 if ( !o.values ) { 6969 o.values = [ this._valueMin(), this._valueMin() ]; 6970 } 6971 if ( o.values.length && o.values.length !== 2 ) { 6972 o.values = [ o.values[0], o.values[0] ]; 6973 } 6974 } 6975 6976 this.range = $( "<div></div>" ) 6977 .appendTo( this.element ) 6978 .addClass( "ui-slider-range" + 6979 // note: this isn't the most fittingly semantic framework class for this element, 6980 // but worked best visually with a variety of themes 6981 " ui-widget-header" + 6982 ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); 6983 } 6984 6985 for ( var i = existingHandles.length; i < handleCount; i += 1 ) { 6986 handles.push( handle ); 6987 } 6988 6989 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) ); 6990 6991 this.handle = this.handles.eq( 0 ); 6992 6993 this.handles.add( this.range ).filter( "a" ) 6994 .click(function( event ) { 6995 event.preventDefault(); 6996 }) 6997 .hover(function() { 6998 if ( !o.disabled ) { 6999 $( this ).addClass( "ui-state-hover" ); 7000 } 7001 }, function() { 7002 $( this ).removeClass( "ui-state-hover" ); 7003 }) 7004 .focus(function() { 7005 if ( !o.disabled ) { 7006 $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); 7007 $( this ).addClass( "ui-state-focus" ); 7008 } else { 7009 $( this ).blur(); 7010 } 7011 }) 7012 .blur(function() { 7013 $( this ).removeClass( "ui-state-focus" ); 7014 }); 7015 7016 this.handles.each(function( i ) { 7017 $( this ).data( "index.ui-slider-handle", i ); 7018 }); 7019 7020 this.handles 7021 .keydown(function( event ) { 7022 var index = $( this ).data( "index.ui-slider-handle" ), 7023 allowed, 7024 curVal, 7025 newVal, 7026 step; 7027 7028 if ( self.options.disabled ) { 7029 return; 7030 } 7031 7032 switch ( event.keyCode ) { 7033 case $.ui.keyCode.HOME: 7034 case $.ui.keyCode.END: 7035 case $.ui.keyCode.PAGE_UP: 7036 case $.ui.keyCode.PAGE_DOWN: 7037 case $.ui.keyCode.UP: 7038 case $.ui.keyCode.RIGHT: 7039 case $.ui.keyCode.DOWN: 7040 case $.ui.keyCode.LEFT: 7041 event.preventDefault(); 7042 if ( !self._keySliding ) { 7043 self._keySliding = true; 7044 $( this ).addClass( "ui-state-active" ); 7045 allowed = self._start( event, index ); 7046 if ( allowed === false ) { 7047 return; 7048 } 7049 } 7050 break; 7051 } 7052 7053 step = self.options.step; 7054 if ( self.options.values && self.options.values.length ) { 7055 curVal = newVal = self.values( index ); 7056 } else { 7057 curVal = newVal = self.value(); 7058 } 7059 7060 switch ( event.keyCode ) { 7061 case $.ui.keyCode.HOME: 7062 newVal = self._valueMin(); 7063 break; 7064 case $.ui.keyCode.END: 7065 newVal = self._valueMax(); 7066 break; 7067 case $.ui.keyCode.PAGE_UP: 7068 newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) ); 7069 break; 7070 case $.ui.keyCode.PAGE_DOWN: 7071 newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) ); 7072 break; 7073 case $.ui.keyCode.UP: 7074 case $.ui.keyCode.RIGHT: 7075 if ( curVal === self._valueMax() ) { 7076 return; 7077 } 7078 newVal = self._trimAlignValue( curVal + step ); 7079 break; 7080 case $.ui.keyCode.DOWN: 7081 case $.ui.keyCode.LEFT: 7082 if ( curVal === self._valueMin() ) { 7083 return; 7084 } 7085 newVal = self._trimAlignValue( curVal - step ); 7086 break; 7087 } 7088 7089 self._slide( event, index, newVal ); 7090 }) 7091 .keyup(function( event ) { 7092 var index = $( this ).data( "index.ui-slider-handle" ); 7093 7094 if ( self._keySliding ) { 7095 self._keySliding = false; 7096 self._stop( event, index ); 7097 self._change( event, index ); 7098 $( this ).removeClass( "ui-state-active" ); 7099 } 7100 7101 }); 7102 7103 this._refreshValue(); 7104 7105 this._animateOff = false; 7106 }, 7107 7108 destroy: function() { 7109 this.handles.remove(); 7110 this.range.remove(); 7111 7112 this.element 7113 .removeClass( "ui-slider" + 7114 " ui-slider-horizontal" + 7115 " ui-slider-vertical" + 7116 " ui-slider-disabled" + 7117 " ui-widget" + 7118 " ui-widget-content" + 7119 " ui-corner-all" ) 7120 .removeData( "slider" ) 7121 .unbind( ".slider" ); 7122 7123 this._mouseDestroy(); 7124 7125 return this; 7126 }, 7127 7128 _mouseCapture: function( event ) { 7129 var o = this.options, 7130 position, 7131 normValue, 7132 distance, 7133 closestHandle, 7134 self, 7135 index, 7136 allowed, 7137 offset, 7138 mouseOverHandle; 7139 7140 if ( o.disabled ) { 7141 return false;
vendor: 10,617 bytes, lines 7142-7532
7142 } 7143 7144 this.elementSize = { 7145 width: this.element.outerWidth(), 7146 height: this.element.outerHeight() 7147 }; 7148 this.elementOffset = this.element.offset(); 7149 7150 position = { x: event.pageX, y: event.pageY }; 7151 normValue = this._normValueFromMouse( position ); 7152 distance = this._valueMax() - this._valueMin() + 1; 7153 self = this; 7154 this.handles.each(function( i ) { 7155 var thisDistance = Math.abs( normValue - self.values(i) ); 7156 if ( distance > thisDistance ) { 7157 distance = thisDistance; 7158 closestHandle = $( this ); 7159 index = i; 7160 } 7161 }); 7162 7163 // workaround for bug #3736 (if both handles of a range are at 0, 7164 // the first is always used as the one with least distance, 7165 // and moving it is obviously prevented by preventing negative ranges) 7166 if( o.range === true && this.values(1) === o.min ) { 7167 index += 1; 7168 closestHandle = $( this.handles[index] ); 7169 } 7170 7171 allowed = this._start( event, index ); 7172 if ( allowed === false ) { 7173 return false; 7174 } 7175 this._mouseSliding = true; 7176 7177 self._handleIndex = index; 7178 7179 closestHandle 7180 .addClass( "ui-state-active" ) 7181 .focus(); 7182 7183 offset = closestHandle.offset(); 7184 mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); 7185 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 7186 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 7187 top: event.pageY - offset.top - 7188 ( closestHandle.height() / 2 ) - 7189 ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - 7190 ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + 7191 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) 7192 }; 7193 7194 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 7195 this._slide( event, index, normValue ); 7196 } 7197 this._animateOff = true; 7198 return true; 7199 }, 7200 7201 _mouseStart: function( event ) { 7202 return true; 7203 }, 7204 7205 _mouseDrag: function( event ) { 7206 var position = { x: event.pageX, y: event.pageY }, 7207 normValue = this._normValueFromMouse( position ); 7208 7209 this._slide( event, this._handleIndex, normValue ); 7210 7211 return false; 7212 }, 7213 7214 _mouseStop: function( event ) { 7215 this.handles.removeClass( "ui-state-active" ); 7216 this._mouseSliding = false; 7217 7218 this._stop( event, this._handleIndex ); 7219 this._change( event, this._handleIndex ); 7220 7221 this._handleIndex = null; 7222 this._clickOffset = null; 7223 this._animateOff = false; 7224 7225 return false; 7226 }, 7227 7228 _detectOrientation: function() { 7229 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 7230 }, 7231 7232 _normValueFromMouse: function( position ) { 7233 var pixelTotal, 7234 pixelMouse, 7235 percentMouse, 7236 valueTotal, 7237 valueMouse; 7238 7239 if ( this.orientation === "horizontal" ) { 7240 pixelTotal = this.elementSize.width; 7241 pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); 7242 } else { 7243 pixelTotal = this.elementSize.height; 7244 pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); 7245 } 7246 7247 percentMouse = ( pixelMouse / pixelTotal ); 7248 if ( percentMouse > 1 ) { 7249 percentMouse = 1; 7250 } 7251 if ( percentMouse < 0 ) { 7252 percentMouse = 0; 7253 } 7254 if ( this.orientation === "vertical" ) { 7255 percentMouse = 1 - percentMouse; 7256 } 7257 7258 valueTotal = this._valueMax() - this._valueMin(); 7259 valueMouse = this._valueMin() + percentMouse * valueTotal; 7260 7261 return this._trimAlignValue( valueMouse ); 7262 }, 7263 7264 _start: function( event, index ) { 7265 var uiHash = { 7266 handle: this.handles[ index ], 7267 value: this.value() 7268 }; 7269 if ( this.options.values && this.options.values.length ) { 7270 uiHash.value = this.values( index ); 7271 uiHash.values = this.values(); 7272 } 7273 return this._trigger( "start", event, uiHash ); 7274 }, 7275 7276 _slide: function( event, index, newVal ) { 7277 var otherVal, 7278 newValues, 7279 allowed; 7280 7281 if ( this.options.values && this.options.values.length ) { 7282 otherVal = this.values( index ? 0 : 1 ); 7283 7284 if ( ( this.options.values.length === 2 && this.options.range === true ) && 7285 ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) 7286 ) { 7287 newVal = otherVal; 7288 } 7289 7290 if ( newVal !== this.values( index ) ) { 7291 newValues = this.values(); 7292 newValues[ index ] = newVal; 7293 // A slide can be canceled by returning false from the slide callback 7294 allowed = this._trigger( "slide", event, { 7295 handle: this.handles[ index ], 7296 value: newVal, 7297 values: newValues 7298 } ); 7299 otherVal = this.values( index ? 0 : 1 ); 7300 if ( allowed !== false ) { 7301 this.values( index, newVal, true ); 7302 } 7303 } 7304 } else { 7305 if ( newVal !== this.value() ) { 7306 // A slide can be canceled by returning false from the slide callback 7307 allowed = this._trigger( "slide", event, { 7308 handle: this.handles[ index ], 7309 value: newVal 7310 } ); 7311 if ( allowed !== false ) { 7312 this.value( newVal ); 7313 } 7314 } 7315 } 7316 }, 7317 7318 _stop: function( event, index ) { 7319 var uiHash = { 7320 handle: this.handles[ index ], 7321 value: this.value() 7322 }; 7323 if ( this.options.values && this.options.values.length ) { 7324 uiHash.value = this.values( index ); 7325 uiHash.values = this.values(); 7326 } 7327 7328 this._trigger( "stop", event, uiHash ); 7329 }, 7330 7331 _change: function( event, index ) { 7332 if ( !this._keySliding && !this._mouseSliding ) { 7333 var uiHash = { 7334 handle: this.handles[ index ], 7335 value: this.value() 7336 }; 7337 if ( this.options.values && this.options.values.length ) { 7338 uiHash.value = this.values( index ); 7339 uiHash.values = this.values(); 7340 } 7341 7342 this._trigger( "change", event, uiHash ); 7343 } 7344 }, 7345 7346 value: function( newValue ) { 7347 if ( arguments.length ) { 7348 this.options.value = this._trimAlignValue( newValue ); 7349 this._refreshValue(); 7350 this._change( null, 0 ); 7351 return; 7352 } 7353 7354 return this._value(); 7355 }, 7356 7357 values: function( index, newValue ) { 7358 var vals, 7359 newValues, 7360 i; 7361 7362 if ( arguments.length > 1 ) { 7363 this.options.values[ index ] = this._trimAlignValue( newValue ); 7364 this._refreshValue(); 7365 this._change( null, index ); 7366 return; 7367 } 7368 7369 if ( arguments.length ) { 7370 if ( $.isArray( arguments[ 0 ] ) ) { 7371 vals = this.options.values; 7372 newValues = arguments[ 0 ]; 7373 for ( i = 0; i < vals.length; i += 1 ) { 7374 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 7375 this._change( null, i ); 7376 } 7377 this._refreshValue(); 7378 } else { 7379 if ( this.options.values && this.options.values.length ) { 7380 return this._values( index ); 7381 } else { 7382 return this.value(); 7383 } 7384 } 7385 } else { 7386 return this._values(); 7387 } 7388 }, 7389 7390 _setOption: function( key, value ) { 7391 var i, 7392 valsLength = 0; 7393 7394 if ( $.isArray( this.options.values ) ) { 7395 valsLength = this.options.values.length; 7396 } 7397 7398 $.Widget.prototype._setOption.apply( this, arguments ); 7399 7400 switch ( key ) { 7401 case "disabled": 7402 if ( value ) { 7403 this.handles.filter( ".ui-state-focus" ).blur(); 7404 this.handles.removeClass( "ui-state-hover" ); 7405 this.handles.propAttr( "disabled", true ); 7406 this.element.addClass( "ui-disabled" ); 7407 } else { 7408 this.handles.propAttr( "disabled", false ); 7409 this.element.removeClass( "ui-disabled" ); 7410 } 7411 break; 7412 case "orientation": 7413 this._detectOrientation(); 7414 this.element 7415 .removeClass( "ui-slider-horizontal ui-slider-vertical" ) 7416 .addClass( "ui-slider-" + this.orientation ); 7417 this._refreshValue(); 7418 break; 7419 case "value": 7420 this._animateOff = true; 7421 this._refreshValue(); 7422 this._change( null, 0 ); 7423 this._animateOff = false; 7424 break; 7425 case "values": 7426 this._animateOff = true; 7427 this._refreshValue(); 7428 for ( i = 0; i < valsLength; i += 1 ) { 7429 this._change( null, i ); 7430 } 7431 this._animateOff = false; 7432 break; 7433 } 7434 }, 7435 7436 //internal value getter 7437 // _value() returns value trimmed by min and max, aligned by step 7438 _value: function() { 7439 var val = this.options.value; 7440 val = this._trimAlignValue( val ); 7441 7442 return val; 7443 }, 7444 7445 //internal values getter 7446 // _values() returns array of values trimmed by min and max, aligned by step 7447 // _values( index ) returns single value trimmed by min and max, aligned by step 7448 _values: function( index ) { 7449 var val, 7450 vals, 7451 i; 7452 7453 if ( arguments.length ) { 7454 val = this.options.values[ index ]; 7455 val = this._trimAlignValue( val ); 7456 7457 return val; 7458 } else { 7459 // .slice() creates a copy of the array 7460 // this copy gets trimmed by min and max and then returned 7461 vals = this.options.values.slice(); 7462 for ( i = 0; i < vals.length; i+= 1) { 7463 vals[ i ] = this._trimAlignValue( vals[ i ] ); 7464 } 7465 7466 return vals; 7467 } 7468 }, 7469 7470 // returns the step-aligned value that val is closest to, between (inclusive) min and max 7471 _trimAlignValue: function( val ) { 7472 if ( val <= this._valueMin() ) { 7473 return this._valueMin(); 7474 } 7475 if ( val >= this._valueMax() ) { 7476 return this._valueMax(); 7477 } 7478 var step = ( this.options.step > 0 ) ? this.options.step : 1, 7479 valModStep = (val - this._valueMin()) % step, 7480 alignValue = val - valModStep; 7481 7482 if ( Math.abs(valModStep) * 2 >= step ) { 7483 alignValue += ( valModStep > 0 ) ? step : ( -step ); 7484 } 7485 7486 // Since JavaScript has problems with large floats, round 7487 // the final value to 5 digits after the decimal point (see #4124) 7488 return parseFloat( alignValue.toFixed(5) ); 7489 }, 7490 7491 _valueMin: function() { 7492 return this.options.min; 7493 }, 7494 7495 _valueMax: function() { 7496 return this.options.max; 7497 }, 7498 7499 _refreshValue: function() { 7500 var oRange = this.options.range, 7501 o = this.options, 7502 self = this, 7503 animate = ( !this._animateOff ) ? o.animate : false, 7504 valPercent, 7505 _set = {}, 7506 lastValPercent, 7507 value, 7508 valueMin, 7509 valueMax; 7510 7511 if ( this.options.values && this.options.values.length ) { 7512 this.handles.each(function( i, j ) { 7513 valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; 7514 _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 7515 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 7516 if ( self.options.range === true ) { 7517 if ( self.orientation === "horizontal" ) { 7518 if ( i === 0 ) { 7519 self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); 7520 } 7521 if ( i === 1 ) { 7522 self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 7523 } 7524 } else { 7525 if ( i === 0 ) { 7526 self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); 7527 } 7528 if ( i === 1 ) { 7529 self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 7530 } 7531 } 7532 }
7533 lastValPercent = valPercent; 7534 }); 7535 } else { 7536 value = this.value(); 7537 valueMin = this._valueMin(); 7538 valueMax = this._valueMax(); 7539 valPercent = ( valueMax !== valueMin ) ? 7540 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 7541 0; 7542 _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 7543 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 7544 7545 if ( oRange === "min" && this.orientation === "horizontal" ) { 7546 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); 7547 } 7548 if ( oRange === "max" && this.orientation === "horizontal" ) { 7549 this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 7550 } 7551 if ( oRange === "min" && this.orientation === "vertical" ) { 7552 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); 7553 } 7554 if ( oRange === "max" && this.orientation === "vertical" ) { 7555 this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 7556 } 7557 } 7558 } 7559 7560}); 7561 7562$.extend( $.ui.slider, { 7563 version: "1.8.24" 7564}); 7565 7566}(jQuery)); 7567/*! 7568 * jQuery UI Tabs 1.8.24 7569 * 7570 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 7571 * Dual licensed under the MIT or GPL Version 2 licenses. 7572 * http://jquery.org/license 7573 * 7574 * http://docs.jquery.com/UI/Tabs 7575 * 7576 * Depends: 7577 * jquery.ui.core.js 7578 * jquery.ui.widget.js 7579 */ 7580(function( $, undefined ) { 7581 7582var tabId = 0, 7583 listId = 0; 7584 7585function getNextTabId() { 7586 return ++tabId; 7587} 7588 7589function getNextListId() { 7590 return ++listId; 7591} 7592 7593$.widget( "ui.tabs", { 7594 options: { 7595 add: null, 7596 ajaxOptions: null, 7597 cache: false, 7598 cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } 7599 collapsible: false, 7600 disable: null, 7601 disabled: [], 7602 enable: null, 7603 event: "click", 7604 fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } 7605 idPrefix: "ui-tabs-", 7606 load: null, 7607 panelTemplate: "<div></div>", 7608 remove: null, 7609 select: null, 7610 show: null, 7611 spinner: "<em>Loading…</em>", 7612 tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>" 7613 }, 7614 7615 _create: function() { 7616 this._tabify( true ); 7617 }, 7618 7619 _setOption: function( key, value ) { 7620 if ( key == "selected" ) { 7621 if (this.options.collapsible && value == this.options.selected ) { 7622 return; 7623 } 7624 this.select( value ); 7625 } else { 7626 this.options[ key ] = value; 7627 this._tabify(); 7628 } 7629 }, 7630 7631 _tabId: function( a ) { 7632 return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || 7633 this.options.idPrefix + getNextTabId(); 7634 }, 7635 7636 _sanitizeSelector: function( hash ) { 7637 // we need this because an id may contain a ":" 7638 return hash.replace( /:/g, "\\:" ); 7639 }, 7640 7641 _cookie: function() { 7642 var cookie = this.cookie || 7643 ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); 7644 return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); 7645 }, 7646 7647 _ui: function( tab, panel ) { 7648 return { 7649 tab: tab, 7650 panel: panel, 7651 index: this.anchors.index( tab ) 7652 }; 7653 }, 7654 7655 _cleanup: function() { 7656 // restore all former loading tabs labels 7657 this.lis.filter( ".ui-state-processing" ) 7658 .removeClass( "ui-state-processing" ) 7659 .find( "span:data(label.tabs)" ) 7660 .each(function() { 7661 var el = $( this ); 7662 el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); 7663 }); 7664 }, 7665 7666 _tabify: function( init ) { 7667 var self = this, 7668 o = this.options, 7669 fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash 7670 7671 this.list = this.element.find( "ol,ul" ).eq( 0 ); 7672 this.lis = $( " > li:has(a[href])", this.list ); 7673 this.anchors = this.lis.map(function() { 7674 return $( "a", this )[ 0 ]; 7675 }); 7676 this.panels = $( [] ); 7677 7678 this.anchors.each(function( i, a ) { 7679 var href = $( a ).attr( "href" ); 7680 // For dynamically created HTML that contains a hash as href IE < 8 expands 7681 // such href to the full page url with hash and then misinterprets tab as ajax. 7682 // Same consideration applies for an added tab with a fragment identifier 7683 // since a[href=#fragment-identifier] does unexpectedly not match. 7684 // Thus normalize href attribute... 7685 var hrefBase = href.split( "#" )[ 0 ], 7686 baseEl;
7687 if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || 7688 ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { 7689 href = a.hash; 7690 a.href = href; 7691 } 7692 7693 // inline tab 7694 if ( fragmentId.test( href ) ) { 7695 self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); 7696 // remote tab 7697 // prevent loading the page itself if href is just "#" 7698 } else if ( href && href !== "#" ) { 7699 // required for restore on destroy 7700 $.data( a, "href.tabs", href ); 7701 7702 // TODO until #3808 is fixed strip fragment identifier from url 7703 // (IE fails to load from such url) 7704 $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); 7705 7706 var id = self._tabId( a ); 7707 a.href = "#" + id; 7708 var $panel = self.element.find( "#" + id ); 7709 if ( !$panel.length ) { 7710 $panel = $( o.panelTemplate ) 7711 .attr( "id", id ) 7712 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 7713 .insertAfter( self.panels[ i - 1 ] || self.list ); 7714 $panel.data( "destroy.tabs", true ); 7715 } 7716 self.panels = self.panels.add( $panel ); 7717 // invalid tab href 7718 } else { 7719 o.disabled.push( i ); 7720 } 7721 }); 7722 7723 // initialization from scratch 7724 if ( init ) { 7725 // attach necessary classes for styling 7726 this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); 7727 this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); 7728 this.lis.addClass( "ui-state-default ui-corner-top" ); 7729 this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); 7730 7731 // Selected tab 7732 // use "selected" option or try to retrieve: 7733 // 1. from fragment identifier in url 7734 // 2. from cookie 7735 // 3. from selected class attribute on <li> 7736 if ( o.selected === undefined ) { 7737 if ( location.hash ) { 7738 this.anchors.each(function( i, a ) { 7739 if ( a.hash == location.hash ) { 7740 o.selected = i; 7741 return false; 7742 } 7743 }); 7744 } 7745 if ( typeof o.selected !== "number" && o.cookie ) { 7746 o.selected = parseInt( self._cookie(), 10 ); 7747 } 7748 if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { 7749 o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); 7750 } 7751 o.selected = o.selected || ( this.lis.length ? 0 : -1 ); 7752 } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release 7753 o.selected = -1; 7754 } 7755 7756 // sanity check - default to first tab... 7757 o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) 7758 ? o.selected 7759 : 0; 7760 7761 // Take disabling tabs via class attribute from HTML 7762 // into account and update option properly. 7763 // A selected tab cannot become disabled. 7764 o.disabled = $.unique( o.disabled.concat( 7765 $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { 7766 return self.lis.index( n ); 7767 }) 7768 ) ).sort(); 7769 7770 if ( $.inArray( o.selected, o.disabled ) != -1 ) { 7771 o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); 7772 } 7773 7774 // highlight selected tab 7775 this.panels.addClass( "ui-tabs-hide" ); 7776 this.lis.removeClass( "ui-tabs-selected ui-state-active" ); 7777 // check for length avoids error when initializing empty list 7778 if ( o.selected >= 0 && this.anchors.length ) { 7779 self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); 7780 this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); 7781 7782 // seems to be expected behavior that the show callback is fired 7783 self.element.queue( "tabs", function() { 7784 self._trigger( "show", null, 7785 self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); 7786 }); 7787 7788 this.load( o.selected ); 7789 } 7790 7791 // clean up to avoid memory leaks in certain versions of IE 6 7792 // TODO: namespace this event 7793 $( window ).bind( "unload", function() { 7794 self.lis.add( self.anchors ).unbind( ".tabs" ); 7795 self.lis = self.anchors = self.panels = null; 7796 }); 7797 // update selected after add/remove 7798 } else { 7799 o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); 7800 } 7801 7802 // update collapsible 7803 // TODO: use .toggleClass() 7804 this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); 7805 7806 // set or update cookie after init and add/remove respectively 7807 if ( o.cookie ) { 7808 this._cookie( o.selected, o.cookie ); 7809 } 7810 7811 // disable tabs 7812 for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { 7813 $( li )[ $.inArray( i, o.disabled ) != -1 && 7814 // TODO: use .toggleClass() 7815 !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); 7816 } 7817 7818 // reset cache if switching from cached to not cached 7819 if ( o.cache === false ) { 7820 this.anchors.removeData( "cache.tabs" ); 7821 } 7822 7823 // remove all handlers before, tabify may run on existing tabs after add or option change 7824 this.lis.add( this.anchors ).unbind( ".tabs" ); 7825 7826 if ( o.event !== "mouseover" ) { 7827 var addState = function( state, el ) { 7828 if ( el.is( ":not(.ui-state-disabled)" ) ) { 7829 el.addClass( "ui-state-" + state ); 7830 } 7831 }; 7832 var removeState = function( state, el ) { 7833 el.removeClass( "ui-state-" + state ); 7834 }; 7835 this.lis.bind( "mouseover.tabs" , function() { 7836 addState( "hover", $( this ) ); 7837 }); 7838 this.lis.bind( "mouseout.tabs", function() { 7839 removeState( "hover", $( this ) ); 7840 }); 7841 this.anchors.bind( "focus.tabs", function() { 7842 addState( "focus", $( this ).closest( "li" ) ); 7843 }); 7844 this.anchors.bind( "blur.tabs", function() { 7845 removeState( "focus", $( this ).closest( "li" ) ); 7846 }); 7847 } 7848 7849 // set up animations 7850 var hideFx, showFx; 7851 if ( o.fx ) { 7852 if ( $.isArray( o.fx ) ) { 7853 hideFx = o.fx[ 0 ]; 7854 showFx = o.fx[ 1 ]; 7855 } else { 7856 hideFx = showFx = o.fx; 7857 } 7858 } 7859 7860 // Reset certain styles left over from animation 7861 // and prevent IE's ClearType bug... 7862 function resetStyle( $el, fx ) { 7863 $el.css( "display", "" ); 7864 if ( !$.support.opacity && fx.opacity ) { 7865 $el[ 0 ].style.removeAttribute( "filter" ); 7866 } 7867 } 7868 7869 // Show a tab... 7870 var showTab = showFx 7871 ? function( clicked, $show ) { 7872 $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); 7873 $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way 7874 .animate( showFx, showFx.duration || "normal", function() { 7875 resetStyle( $show, showFx ); 7876 self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); 7877 }); 7878 } 7879 : function( clicked, $show ) { 7880 $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); 7881 $show.removeClass( "ui-tabs-hide" ); 7882 self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); 7883 }; 7884 7885 // Hide a tab, $show is optional... 7886 var hideTab = hideFx 7887 ? function( clicked, $hide ) { 7888 $hide.animate( hideFx, hideFx.duration || "normal", function() { 7889 self.lis.removeClass( "ui-tabs-selected ui-state-active" ); 7890 $hide.addClass( "ui-tabs-hide" ); 7891 resetStyle( $hide, hideFx ); 7892 self.element.dequeue( "tabs" ); 7893 }); 7894 } 7895 : function( clicked, $hide, $show ) { 7896 self.lis.removeClass( "ui-tabs-selected ui-state-active" ); 7897 $hide.addClass( "ui-tabs-hide" ); 7898 self.element.dequeue( "tabs" ); 7899 }; 7900 7901 // attach tab event handler, unbind to avoid duplicates from former tabifying... 7902 this.anchors.bind( o.event + ".tabs", function() { 7903 var el = this, 7904 $li = $(el).closest( "li" ), 7905 $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), 7906 $show = self.element.find( self._sanitizeSelector( el.hash ) ); 7907 7908 // If tab is already selected and not collapsible or tab disabled or 7909 // or is already loading or click callback returns false stop here. 7910 // Check if click handler returns false last so that it is not executed 7911 // for a disabled or loading tab! 7912 if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || 7913 $li.hasClass( "ui-state-disabled" ) || 7914 $li.hasClass( "ui-state-processing" ) || 7915 self.panels.filter( ":animated" ).length || 7916 self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { 7917 this.blur(); 7918 return false;
7919 } 7920 7921 o.selected = self.anchors.index( this ); 7922 7923 self.abort(); 7924 7925 // if tab may be closed 7926 if ( o.collapsible ) { 7927 if ( $li.hasClass( "ui-tabs-selected" ) ) { 7928 o.selected = -1; 7929 7930 if ( o.cookie ) { 7931 self._cookie( o.selected, o.cookie ); 7932 } 7933 7934 self.element.queue( "tabs", function() { 7935 hideTab( el, $hide ); 7936 }).dequeue( "tabs" ); 7937 7938 this.blur(); 7939 return false; 7940 } else if ( !$hide.length ) { 7941 if ( o.cookie ) { 7942 self._cookie( o.selected, o.cookie ); 7943 } 7944 7945 self.element.queue( "tabs", function() { 7946 showTab( el, $show ); 7947 }); 7948 7949 // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 7950 self.load( self.anchors.index( this ) ); 7951 7952 this.blur(); 7953 return false; 7954 } 7955 } 7956 7957 if ( o.cookie ) { 7958 self._cookie( o.selected, o.cookie ); 7959 } 7960 7961 // show new tab 7962 if ( $show.length ) { 7963 if ( $hide.length ) { 7964 self.element.queue( "tabs", function() { 7965 hideTab( el, $hide ); 7966 }); 7967 } 7968 self.element.queue( "tabs", function() { 7969 showTab( el, $show ); 7970 }); 7971 7972 self.load( self.anchors.index( this ) ); 7973 } else { 7974 throw "jQuery UI Tabs: Mismatching fragment identifier."; 7975 } 7976 7977 // Prevent IE from keeping other link focussed when using the back button 7978 // and remove dotted border from clicked link. This is controlled via CSS 7979 // in modern browsers; blur() removes focus from address bar in Firefox 7980 // which can become a usability and annoying problem with tabs('rotate'). 7981 if ( $.browser.msie ) { 7982 this.blur(); 7983 } 7984 }); 7985 7986 // disable click in any case 7987 this.anchors.bind( "click.tabs", function(){ 7988 return false; 7989 }); 7990 }, 7991 7992 _getIndex: function( index ) { 7993 // meta-function to give users option to provide a href string instead of a numerical index. 7994 // also sanitizes numerical indexes to valid values. 7995 if ( typeof index == "string" ) { 7996 index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); 7997 } 7998 7999 return index; 8000 }, 8001 8002 destroy: function() { 8003 var o = this.options; 8004 8005 this.abort(); 8006 8007 this.element 8008 .unbind( ".tabs" ) 8009 .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) 8010 .removeData( "tabs" ); 8011 8012 this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); 8013 8014 this.anchors.each(function() { 8015 var href = $.data( this, "href.tabs" ); 8016 if ( href ) { 8017 this.href = href; 8018 } 8019 var $this = $( this ).unbind( ".tabs" ); 8020 $.each( [ "href", "load", "cache" ], function( i, prefix ) { 8021 $this.removeData( prefix + ".tabs" ); 8022 }); 8023 }); 8024 8025 this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { 8026 if ( $.data( this, "destroy.tabs" ) ) { 8027 $( this ).remove(); 8028 } else { 8029 $( this ).removeClass([ 8030 "ui-state-default", 8031 "ui-corner-top", 8032 "ui-tabs-selected", 8033 "ui-state-active", 8034 "ui-state-hover", 8035 "ui-state-focus", 8036 "ui-state-disabled", 8037 "ui-tabs-panel", 8038 "ui-widget-content", 8039 "ui-corner-bottom", 8040 "ui-tabs-hide" 8041 ].join( " " ) ); 8042 } 8043 }); 8044 8045 if ( o.cookie ) { 8046 this._cookie( null, o.cookie ); 8047 } 8048 8049 return this; 8050 }, 8051 8052 add: function( url, label, index ) { 8053 if ( index === undefined ) { 8054 index = this.anchors.length; 8055 } 8056 8057 var self = this, 8058 o = this.options, 8059 $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), 8060 id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); 8061 8062 $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); 8063 8064 // try to find an existing element before creating a new one 8065 var $panel = self.element.find( "#" + id ); 8066 if ( !$panel.length ) { 8067 $panel = $( o.panelTemplate ) 8068 .attr( "id", id ) 8069 .data( "destroy.tabs", true ); 8070 } 8071 $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); 8072 8073 if ( index >= this.lis.length ) { 8074 $li.appendTo( this.list ); 8075 $panel.appendTo( this.list[ 0 ].parentNode ); 8076 } else { 8077 $li.insertBefore( this.lis[ index ] ); 8078 $panel.insertBefore( this.panels[ index ] ); 8079 } 8080 8081 o.disabled = $.map( o.disabled, function( n, i ) { 8082 return n >= index ? ++n : n; 8083 }); 8084 8085 this._tabify(); 8086 8087 if ( this.anchors.length == 1 ) { 8088 o.selected = 0; 8089 $li.addClass( "ui-tabs-selected ui-state-active" ); 8090 $panel.removeClass( "ui-tabs-hide" ); 8091 this.element.queue( "tabs", function() { 8092 self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); 8093 }); 8094 8095 this.load( 0 ); 8096 } 8097 8098 this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 8099 return this; 8100 }, 8101 8102 remove: function( index ) { 8103 index = this._getIndex( index ); 8104 var o = this.options, 8105 $li = this.lis.eq( index ).remove(), 8106 $panel = this.panels.eq( index ).remove(); 8107 8108 // If selected tab was removed focus tab to the right or 8109 // in case the last tab was removed the tab to the left. 8110 if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { 8111 this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); 8112 } 8113 8114 o.disabled = $.map( 8115 $.grep( o.disabled, function(n, i) {
8116 return n != index; 8117 }), 8118 function( n, i ) { 8119 return n >= index ? --n : n; 8120 }); 8121 8122 this._tabify(); 8123 8124 this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); 8125 return this; 8126 }, 8127 8128 enable: function( index ) { 8129 index = this._getIndex( index ); 8130 var o = this.options; 8131 if ( $.inArray( index, o.disabled ) == -1 ) { 8132 return; 8133 } 8134 8135 this.lis.eq( index ).removeClass( "ui-state-disabled" ); 8136 o.disabled = $.grep( o.disabled, function( n, i ) { 8137 return n != index; 8138 }); 8139 8140 this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 8141 return this; 8142 }, 8143 8144 disable: function( index ) { 8145 index = this._getIndex( index ); 8146 var self = this, o = this.options; 8147 // cannot disable already selected tab 8148 if ( index != o.selected ) { 8149 this.lis.eq( index ).addClass( "ui-state-disabled" ); 8150 8151 o.disabled.push( index ); 8152 o.disabled.sort(); 8153 8154 this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 8155 } 8156 8157 return this; 8158 }, 8159 8160 select: function( index ) { 8161 index = this._getIndex( index ); 8162 if ( index == -1 ) { 8163 if ( this.options.collapsible && this.options.selected != -1 ) { 8164 index = this.options.selected; 8165 } else { 8166 return this; 8167 } 8168 } 8169 this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); 8170 return this; 8171 }, 8172 8173 load: function( index ) { 8174 index = this._getIndex( index ); 8175 var self = this, 8176 o = this.options, 8177 a = this.anchors.eq( index )[ 0 ], 8178 url = $.data( a, "load.tabs" ); 8179 8180 this.abort(); 8181 8182 // not remote or from cache 8183 if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { 8184 this.element.dequeue( "tabs" ); 8185 return; 8186 } 8187 8188 // load remote from here on 8189 this.lis.eq( index ).addClass( "ui-state-processing" ); 8190 8191 if ( o.spinner ) { 8192 var span = $( "span", a ); 8193 span.data( "label.tabs", span.html() ).html( o.spinner ); 8194 } 8195 8196 this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { 8197 url: url, 8198 success: function( r, s ) { 8199 self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); 8200 8201 // take care of tab labels 8202 self._cleanup(); 8203 8204 if ( o.cache ) { 8205 $.data( a, "cache.tabs", true ); 8206 } 8207 8208 self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); 8209 try { 8210 o.ajaxOptions.success( r, s ); 8211 } 8212 catch ( e ) {} 8213 }, 8214 error: function( xhr, s, e ) { 8215 // take care of tab labels 8216 self._cleanup(); 8217 8218 self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); 8219 try { 8220 // Passing index avoid a race condition when this method is 8221 // called after the user has selected another tab. 8222 // Pass the anchor that initiated this request allows 8223 // loadError to manipulate the tab content panel via $(a.hash) 8224 o.ajaxOptions.error( xhr, s, index, a ); 8225 } 8226 catch ( e ) {} 8227 } 8228 } ) ); 8229 8230 // last, so that load event is fired before show... 8231 self.element.dequeue( "tabs" ); 8232 8233 return this; 8234 }, 8235 8236 abort: function() { 8237 // stop possibly running animations 8238 this.element.queue( [] ); 8239 this.panels.stop( false, true ); 8240 8241 // "tabs" queue must not contain more than two elements, 8242 // which are the callbacks for the latest clicked tab... 8243 this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); 8244 8245 // terminate pending requests from other tabs 8246 if ( this.xhr ) { 8247 this.xhr.abort(); 8248 delete this.xhr; 8249 } 8250 8251 // take care of tab labels 8252 this._cleanup(); 8253 return this; 8254 }, 8255 8256 url: function( index, url ) { 8257 this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); 8258 return this; 8259 }, 8260 8261 length: function() { 8262 return this.anchors.length; 8263 } 8264}); 8265 8266$.extend( $.ui.tabs, { 8267 version: "1.8.24" 8268}); 8269 8270/* 8271 * Tabs Extensions 8272 */ 8273 8274/* 8275 * Rotate 8276 */ 8277$.extend( $.ui.tabs.prototype, { 8278 rotation: null, 8279 rotate: function( ms, continuing ) { 8280 var self = this, 8281 o = this.options; 8282 8283 var rotate = self._rotate || ( self._rotate = function( e ) { 8284 clearTimeout( self.rotation ); 8285 self.rotation = setTimeout(function() { 8286 var t = o.selected; 8287 self.select( ++t < self.anchors.length ? t : 0 ); 8288 }, ms ); 8289 8290 if ( e ) { 8291 e.stopPropagation(); 8292 } 8293 }); 8294 8295 var stop = self._unrotate || ( self._unrotate = !continuing 8296 ? function(e) { 8297 if (e.clientX) { // in case of a true click 8298 self.rotate(null); 8299 } 8300 } 8301 : function( e ) { 8302 rotate(); 8303 }); 8304 8305 // start rotation 8306 if ( ms ) {
8307 this.element.bind( "tabsshow", rotate ); 8308 this.anchors.bind( o.event + ".tabs", stop ); 8309 rotate(); 8310 // stop rotation 8311 } else { 8312 clearTimeout( self.rotation ); 8313 this.element.unbind( "tabsshow", rotate ); 8314 this.anchors.unbind( o.event + ".tabs", stop ); 8315 delete this._rotate; 8316 delete this._unrotate; 8317 } 8318 8319 return this; 8320 } 8321}); 8322 8323})( jQuery ); 8324/*! 8325 * jQuery UI Datepicker 1.8.24 8326 * 8327 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 8328 * Dual licensed under the MIT or GPL Version 2 licenses. 8329 * http://jquery.org/license 8330 * 8331 * http://docs.jquery.com/UI/Datepicker 8332 * 8333 * Depends: 8334 * jquery.ui.core.js 8335 */ 8336(function( $, undefined ) { 8337 8338$.extend($.ui, { datepicker: { version: "1.8.24" } }); 8339 8340var PROP_NAME = 'datepicker'; 8341var dpuuid = new Date().getTime(); 8342var instActive; 8343 8344/* Date picker manager. 8345 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 8346 Settings for (groups of) date pickers are maintained in an instance object, 8347 allowing multiple different settings on the same page. */ 8348 8349function Datepicker() { 8350 this.debug = false; // Change this to true to start debugging 8351 this._curInst = null; // The current instance in use 8352 this._keyEvent = false; // If the last event was a key event 8353 this._disabledInputs = []; // List of date picker inputs that have been disabled 8354 this._datepickerShowing = false; // True if the popup picker is showing , false if not 8355 this._inDialog = false; // True if showing within a "dialog", false if not 8356 this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division 8357 this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class 8358 this._appendClass = 'ui-datepicker-append'; // The name of the append marker class 8359 this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class 8360 this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class 8361 this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class 8362 this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class 8363 this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class 8364 this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class 8365 this.regional = []; // Available regional settings, indexed by language code 8366 this.regional[''] = { // Default regional settings 8367 closeText: 'Done', // Display text for close link 8368 prevText: 'Prev', // Display text for previous month link 8369 nextText: 'Next', // Display text for next month link 8370 currentText: 'Today', // Display text for current month link 8371 monthNames: ['January','February','March','April','May','June', 8372 'July','August','September','October','November','December'], // Names of months for drop-down and formatting 8373 monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting 8374 dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting 8375 dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting 8376 dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday 8377 weekHeader: 'Wk', // Column header for week of the year 8378 dateFormat: 'mm/dd/yy', // See format options on parseDate 8379 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 8380 isRTL: false, // True if right-to-left language, false if left-to-right 8381 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 8382 yearSuffix: '' // Additional text to append to the year in the month headers 8383 }; 8384 this._defaults = { // Global defaults for all the date picker instances 8385 showOn: 'focus', // 'focus' for popup on focus, 8386 // 'button' for trigger button, or 'both' for either 8387 showAnim: 'fadeIn', // Name of jQuery animation for popup 8388 showOptions: {}, // Options for enhanced animations 8389 defaultDate: null, // Used when field is blank: actual date, 8390 // +/-number for offset from today, null for today 8391 appendText: '', // Display text following the input box, e.g. showing the format 8392 buttonText: '...', // Text for trigger button
vendor: 4,476 bytes, lines 8393-8473
8393 buttonImage: '', // URL for trigger button image 8394 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 8395 hideIfNoPrevNext: false, // True to hide next/previous month links 8396 // if not applicable, false to just disable them 8397 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 8398 gotoCurrent: false, // True if today link goes back to current selection instead 8399 changeMonth: false, // True if month can be selected directly, false if only prev/next 8400 changeYear: false, // True if year can be selected directly, false if only prev/next 8401 yearRange: 'c-10:c+10', // Range of years to display in drop-down, 8402 // either relative to today's year (-nn:+nn), relative to currently displayed year 8403 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 8404 showOtherMonths: false, // True to show dates in other months, false to leave blank 8405 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 8406 showWeek: false, // True to show week of the year, false to not show it 8407 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 8408 // takes a Date and returns the number of the week for it 8409 shortYearCutoff: '+10', // Short year values < this are in the current century, 8410 // > this are in the previous century, 8411 // string value starting with '+' for current year + value 8412 minDate: null, // The earliest selectable date, or null for no limit 8413 maxDate: null, // The latest selectable date, or null for no limit 8414 duration: 'fast', // Duration of display/closure 8415 beforeShowDay: null, // Function that takes a date and returns an array with 8416 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', 8417 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 8418 beforeShow: null, // Function that takes an input field and 8419 // returns a set of custom settings for the date picker 8420 onSelect: null, // Define a callback function when a date is selected 8421 onChangeMonthYear: null, // Define a callback function when the month or year is changed 8422 onClose: null, // Define a callback function when the datepicker is closed 8423 numberOfMonths: 1, // Number of months to show at a time 8424 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 8425 stepMonths: 1, // Number of months to step back/forward 8426 stepBigMonths: 12, // Number of months to step back/forward for the big links 8427 altField: '', // Selector for an alternate field to store selected dates into 8428 altFormat: '', // The date format to use for the alternate field 8429 constrainInput: true, // The input is constrained by the current date format 8430 showButtonPanel: false, // True to show button panel, false to not show it 8431 autoSize: false, // True to size the input for the date format, false to leave as is 8432 disabled: false // The initial disabled state 8433 }; 8434 $.extend(this._defaults, this.regional['']); 8435 this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')); 8436} 8437 8438$.extend(Datepicker.prototype, { 8439 /* Class name added to elements to indicate already configured with a date picker. */ 8440 markerClassName: 'hasDatepicker', 8441 8442 //Keep track of the maximum number of rows displayed (see #7043) 8443 maxRows: 4, 8444 8445 /* Debug logging (if enabled). */ 8446 log: function () { 8447 if (this.debug) 8448 console.log.apply('', arguments); 8449 }, 8450 8451 // TODO rename to "widget" when switching to widget factory 8452 _widgetDatepicker: function() { 8453 return this.dpDiv; 8454 }, 8455 8456 /* Override the default settings for all instances of the date picker. 8457 @param settings object - the new settings to use as defaults (anonymous object) 8458 @return the manager object */ 8459 setDefaults: function(settings) { 8460 extendRemove(this._defaults, settings || {}); 8461 return this; 8462 }, 8463 8464 /* Attach the date picker to a jQuery selection. 8465 @param target element - the target input field or division or span 8466 @param settings object - the new settings to use for this date picker instance (anonymous) */ 8467 _attachDatepicker: function(target, settings) { 8468 // check for settings on the control itself - in namespace 'date:' 8469 var inlineSettings = null; 8470 for (var attrName in this._defaults) { 8471 var attrValue = target.getAttribute('date:' + attrName); 8472 if (attrValue) { 8473 inlineSettings = inlineSettings || {};
8474 try { 8475 inlineSettings[attrName] = eval(attrValue); 8476 } catch (err) { 8477 inlineSettings[attrName] = attrValue; 8478 } 8479 } 8480 } 8481 var nodeName = target.nodeName.toLowerCase(); 8482 var inline = (nodeName == 'div' || nodeName == 'span'); 8483 if (!target.id) { 8484 this.uuid += 1; 8485 target.id = 'dp' + this.uuid; 8486 } 8487 var inst = this._newInst($(target), inline); 8488 inst.settings = $.extend({}, settings || {}, inlineSettings || {}); 8489 if (nodeName == 'input') { 8490 this._connectDatepicker(target, inst); 8491 } else if (inline) { 8492 this._inlineDatepicker(target, inst); 8493 } 8494 }, 8495 8496 /* Create a new instance object. */ 8497 _newInst: function(target, inline) { 8498 var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars 8499 return {id: id, input: target, // associated target 8500 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 8501 drawMonth: 0, drawYear: 0, // month being drawn 8502 inline: inline, // is datepicker inline or not 8503 dpDiv: (!inline ? this.dpDiv : // presentation div 8504 bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}; 8505 }, 8506 8507 /* Attach the date picker to an input field. */ 8508 _connectDatepicker: function(target, inst) { 8509 var input = $(target); 8510 inst.append = $([]); 8511 inst.trigger = $([]); 8512 if (input.hasClass(this.markerClassName)) 8513 return; 8514 this._attachments(input, inst); 8515 input.addClass(this.markerClassName).keydown(this._doKeyDown). 8516 keypress(this._doKeyPress).keyup(this._doKeyUp). 8517 bind("setData.datepicker", function(event, key, value) { 8518 inst.settings[key] = value; 8519 }).bind("getData.datepicker", function(event, key) { 8520 return this._get(inst, key); 8521 }); 8522 this._autoSize(inst); 8523 $.data(target, PROP_NAME, inst); 8524 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 8525 if( inst.settings.disabled ) { 8526 this._disableDatepicker( target ); 8527 } 8528 }, 8529 8530 /* Make attachments based on settings. */ 8531 _attachments: function(input, inst) { 8532 var appendText = this._get(inst, 'appendText'); 8533 var isRTL = this._get(inst, 'isRTL'); 8534 if (inst.append) 8535 inst.append.remove(); 8536 if (appendText) { 8537 inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); 8538 input[isRTL ? 'before' : 'after'](inst.append); 8539 } 8540 input.unbind('focus', this._showDatepicker); 8541 if (inst.trigger) 8542 inst.trigger.remove(); 8543 var showOn = this._get(inst, 'showOn'); 8544 if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field 8545 input.focus(this._showDatepicker); 8546 if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked 8547 var buttonText = this._get(inst, 'buttonText'); 8548 var buttonImage = this._get(inst, 'buttonImage'); 8549 inst.trigger = $(this._get(inst, 'buttonImageOnly') ? 8550 $('<img/>').addClass(this._triggerClass). 8551 attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 8552 $('<button type="button"></button>').addClass(this._triggerClass). 8553 html(buttonImage == '' ? buttonText : $('<img/>').attr( 8554 { src:buttonImage, alt:buttonText, title:buttonText }))); 8555 input[isRTL ? 'before' : 'after'](inst.trigger); 8556 inst.trigger.click(function() { 8557 if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) 8558 $.datepicker._hideDatepicker(); 8559 else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { 8560 $.datepicker._hideDatepicker(); 8561 $.datepicker._showDatepicker(input[0]); 8562 } else 8563 $.datepicker._showDatepicker(input[0]); 8564 return false; 8565 }); 8566 } 8567 }, 8568 8569 /* Apply the maximum length for the date format. */ 8570 _autoSize: function(inst) { 8571 if (this._get(inst, 'autoSize') && !inst.inline) { 8572 var date = new Date(2009, 12 - 1, 20); // Ensure double digits 8573 var dateFormat = this._get(inst, 'dateFormat'); 8574 if (dateFormat.match(/[DM]/)) { 8575 var findMax = function(names) { 8576 var max = 0; 8577 var maxI = 0; 8578 for (var i = 0; i < names.length; i++) { 8579 if (names[i].length > max) { 8580 max = names[i].length; 8581 maxI = i; 8582 } 8583 }
8584 return maxI; 8585 }; 8586 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 8587 'monthNames' : 'monthNamesShort')))); 8588 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 8589 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); 8590 } 8591 inst.input.attr('size', this._formatDate(inst, date).length); 8592 } 8593 }, 8594 8595 /* Attach an inline date picker to a div. */ 8596 _inlineDatepicker: function(target, inst) { 8597 var divSpan = $(target); 8598 if (divSpan.hasClass(this.markerClassName)) 8599 return; 8600 divSpan.addClass(this.markerClassName).append(inst.dpDiv). 8601 bind("setData.datepicker", function(event, key, value){ 8602 inst.settings[key] = value; 8603 }).bind("getData.datepicker", function(event, key){ 8604 return this._get(inst, key); 8605 }); 8606 $.data(target, PROP_NAME, inst); 8607 this._setDate(inst, this._getDefaultDate(inst), true); 8608 this._updateDatepicker(inst); 8609 this._updateAlternate(inst); 8610 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 8611 if( inst.settings.disabled ) { 8612 this._disableDatepicker( target ); 8613 } 8614 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 8615 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 8616 inst.dpDiv.css( "display", "block" ); 8617 }, 8618 8619 /* Pop-up the date picker in a "dialog" box. 8620 @param input element - ignored 8621 @param date string or Date - the initial date to display 8622 @param onSelect function - the function to call when a date is selected 8623 @param settings object - update the dialog date picker instance's settings (anonymous object) 8624 @param pos int[2] - coordinates for the dialog's position within the screen or 8625 event - with x/y coordinates or 8626 leave empty for default (screen centre) 8627 @return the manager object */ 8628 _dialogDatepicker: function(input, date, onSelect, settings, pos) { 8629 var inst = this._dialogInst; // internal instance 8630 if (!inst) { 8631 this.uuid += 1; 8632 var id = 'dp' + this.uuid; 8633 this._dialogInput = $('<input type="text" id="' + id + 8634 '" style="position: absolute; top: -100px; width: 0px;"/>'); 8635 this._dialogInput.keydown(this._doKeyDown); 8636 $('body').append(this._dialogInput); 8637 inst = this._dialogInst = this._newInst(this._dialogInput, false); 8638 inst.settings = {}; 8639 $.data(this._dialogInput[0], PROP_NAME, inst); 8640 } 8641 extendRemove(inst.settings, settings || {}); 8642 date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); 8643 this._dialogInput.val(date); 8644 8645 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 8646 if (!this._pos) { 8647 var browserWidth = document.documentElement.clientWidth; 8648 var browserHeight = document.documentElement.clientHeight; 8649 var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 8650 var scrollY = document.documentElement.scrollTop || document.body.scrollTop; 8651 this._pos = // should use actual width/height below 8652 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 8653 } 8654 8655 // move input on screen for focus, but hidden behind dialog 8656 this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); 8657 inst.settings.onSelect = onSelect; 8658 this._inDialog = true; 8659 this.dpDiv.addClass(this._dialogClass); 8660 this._showDatepicker(this._dialogInput[0]); 8661 if ($.blockUI) 8662 $.blockUI(this.dpDiv); 8663 $.data(this._dialogInput[0], PROP_NAME, inst); 8664 return this; 8665 }, 8666 8667 /* Detach a datepicker from its control. 8668 @param target element - the target input field or division or span */ 8669 _destroyDatepicker: function(target) { 8670 var $target = $(target); 8671 var inst = $.data(target, PROP_NAME); 8672 if (!$target.hasClass(this.markerClassName)) { 8673 return; 8674 } 8675 var nodeName = target.nodeName.toLowerCase(); 8676 $.removeData(target, PROP_NAME); 8677 if (nodeName == 'input') { 8678 inst.append.remove(); 8679 inst.trigger.remove(); 8680 $target.removeClass(this.markerClassName). 8681 unbind('focus', this._showDatepicker). 8682 unbind('keydown', this._doKeyDown). 8683 unbind('keypress', this._doKeyPress). 8684 unbind('keyup', this._doKeyUp); 8685 } else if (nodeName == 'div' || nodeName == 'span') 8686 $target.removeClass(this.markerClassName).empty(); 8687 }, 8688 8689 /* Enable the date picker to a jQuery selection. 8690 @param target element - the target input field or division or span */ 8691 _enableDatepicker: function(target) { 8692 var $target = $(target); 8693 var inst = $.data(target, PROP_NAME); 8694 if (!$target.hasClass(this.markerClassName)) { 8695 return; 8696 } 8697 var nodeName = target.nodeName.toLowerCase(); 8698 if (nodeName == 'input') { 8699 target.disabled = false;
8700 inst.trigger.filter('button'). 8701 each(function() { this.disabled = false; }).end(). 8702 filter('img').css({opacity: '1.0', cursor: ''}); 8703 } 8704 else if (nodeName == 'div' || nodeName == 'span') { 8705 var inline = $target.children('.' + this._inlineClass); 8706 inline.children().removeClass('ui-state-disabled'); 8707 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 8708 removeAttr("disabled"); 8709 } 8710 this._disabledInputs = $.map(this._disabledInputs, 8711 function(value) { return (value == target ? null : value); }); // delete entry 8712 }, 8713 8714 /* Disable the date picker to a jQuery selection. 8715 @param target element - the target input field or division or span */ 8716 _disableDatepicker: function(target) { 8717 var $target = $(target); 8718 var inst = $.data(target, PROP_NAME); 8719 if (!$target.hasClass(this.markerClassName)) { 8720 return; 8721 } 8722 var nodeName = target.nodeName.toLowerCase(); 8723 if (nodeName == 'input') { 8724 target.disabled = true; 8725 inst.trigger.filter('button'). 8726 each(function() { this.disabled = true; }).end(). 8727 filter('img').css({opacity: '0.5', cursor: 'default'}); 8728 } 8729 else if (nodeName == 'div' || nodeName == 'span') { 8730 var inline = $target.children('.' + this._inlineClass); 8731 inline.children().addClass('ui-state-disabled'); 8732 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 8733 attr("disabled", "disabled"); 8734 } 8735 this._disabledInputs = $.map(this._disabledInputs, 8736 function(value) { return (value == target ? null : value); }); // delete entry 8737 this._disabledInputs[this._disabledInputs.length] = target; 8738 }, 8739 8740 /* Is the first field in a jQuery collection disabled as a datepicker? 8741 @param target element - the target input field or division or span 8742 @return boolean - true if disabled, false if enabled */ 8743 _isDisabledDatepicker: function(target) { 8744 if (!target) { 8745 return false; 8746 } 8747 for (var i = 0; i < this._disabledInputs.length; i++) { 8748 if (this._disabledInputs[i] == target) 8749 return true; 8750 } 8751 return false; 8752 }, 8753 8754 /* Retrieve the instance data for the target control. 8755 @param target element - the target input field or division or span 8756 @return object - the associated instance data 8757 @throws error if a jQuery problem getting data */ 8758 _getInst: function(target) { 8759 try { 8760 return $.data(target, PROP_NAME); 8761 } 8762 catch (err) { 8763 throw 'Missing instance data for this datepicker'; 8764 } 8765 }, 8766 8767 /* Update or retrieve the settings for a date picker attached to an input field or division. 8768 @param target element - the target input field or division or span 8769 @param name object - the new settings to update or 8770 string - the name of the setting to change or retrieve, 8771 when retrieving also 'all' for all instance settings or 8772 'defaults' for all global defaults 8773 @param value any - the new value for the setting 8774 (omit if above is an object or to retrieve a value) */ 8775 _optionDatepicker: function(target, name, value) { 8776 var inst = this._getInst(target); 8777 if (arguments.length == 2 && typeof name == 'string') { 8778 return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : 8779 (inst ? (name == 'all' ? $.extend({}, inst.settings) : 8780 this._get(inst, name)) : null)); 8781 } 8782 var settings = name || {}; 8783 if (typeof name == 'string') { 8784 settings = {}; 8785 settings[name] = value; 8786 } 8787 if (inst) { 8788 if (this._curInst == inst) { 8789 this._hideDatepicker(); 8790 } 8791 var date = this._getDateDatepicker(target, true); 8792 var minDate = this._getMinMaxDate(inst, 'min'); 8793 var maxDate = this._getMinMaxDate(inst, 'max'); 8794 extendRemove(inst.settings, settings); 8795 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 8796 if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) 8797 inst.settings.minDate = this._formatDate(inst, minDate); 8798 if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) 8799 inst.settings.maxDate = this._formatDate(inst, maxDate); 8800 this._attachments($(target), inst); 8801 this._autoSize(inst); 8802 this._setDate(inst, date); 8803 this._updateAlternate(inst); 8804 this._updateDatepicker(inst); 8805 } 8806 }, 8807 8808 // change method deprecated 8809 _changeDatepicker: function(target, name, value) { 8810 this._optionDatepicker(target, name, value); 8811 }, 8812 8813 /* Redraw the date picker attached to an input field or division. 8814 @param target element - the target input field or division or span */ 8815 _refreshDatepicker: function(target) { 8816 var inst = this._getInst(target); 8817 if (inst) { 8818 this._updateDatepicker(inst); 8819 } 8820 }, 8821 8822 /* Set the dates for a jQuery selection. 8823 @param target element - the target input field or division or span 8824 @param date Date - the new date */ 8825 _setDateDatepicker: function(target, date) { 8826 var inst = this._getInst(target); 8827 if (inst) { 8828 this._setDate(inst, date); 8829 this._updateDatepicker(inst); 8830 this._updateAlternate(inst); 8831 } 8832 }, 8833 8834 /* Get the date(s) for the first entry in a jQuery selection. 8835 @param target element - the target input field or division or span 8836 @param noDefault boolean - true if no default date is to be used 8837 @return Date - the current date */ 8838 _getDateDatepicker: function(target, noDefault) { 8839 var inst = this._getInst(target); 8840 if (inst && !inst.inline) 8841 this._setDateFromField(inst, noDefault); 8842 return (inst ? this._getDate(inst) : null); 8843 }, 8844 8845 /* Handle keystrokes. */ 8846 _doKeyDown: function(event) { 8847 var inst = $.datepicker._getInst(event.target); 8848 var handled = true; 8849 var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); 8850 inst._keyEvent = true; 8851 if ($.datepicker._datepickerShowing) 8852 switch (event.keyCode) { 8853 case 9: $.datepicker._hideDatepicker(); 8854 handled = false;
8855 break; // hide on tab out 8856 case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + 8857 $.datepicker._currentClass + ')', inst.dpDiv); 8858 if (sel[0]) 8859 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 8860 var onSelect = $.datepicker._get(inst, 'onSelect'); 8861 if (onSelect) { 8862 var dateStr = $.datepicker._formatDate(inst); 8863 8864 // trigger custom callback 8865 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 8866 } 8867 else 8868 $.datepicker._hideDatepicker(); 8869 return false; // don't submit the form 8870 break; // select the value on enter 8871 case 27: $.datepicker._hideDatepicker(); 8872 break; // hide on escape 8873 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 8874 -$.datepicker._get(inst, 'stepBigMonths') : 8875 -$.datepicker._get(inst, 'stepMonths')), 'M'); 8876 break; // previous month/year on page up/+ ctrl 8877 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 8878 +$.datepicker._get(inst, 'stepBigMonths') : 8879 +$.datepicker._get(inst, 'stepMonths')), 'M'); 8880 break; // next month/year on page down/+ ctrl 8881 case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); 8882 handled = event.ctrlKey || event.metaKey; 8883 break; // clear on ctrl or command +end 8884 case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); 8885 handled = event.ctrlKey || event.metaKey; 8886 break; // current on ctrl or command +home 8887 case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); 8888 handled = event.ctrlKey || event.metaKey; 8889 // -1 day on ctrl or command +left 8890 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? 8891 -$.datepicker._get(inst, 'stepBigMonths') : 8892 -$.datepicker._get(inst, 'stepMonths')), 'M'); 8893 // next month/year on alt +left on Mac 8894 break; 8895 case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); 8896 handled = event.ctrlKey || event.metaKey; 8897 break; // -1 week on ctrl or command +up 8898 case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); 8899 handled = event.ctrlKey || event.metaKey; 8900 // +1 day on ctrl or command +right 8901 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? 8902 +$.datepicker._get(inst, 'stepBigMonths') : 8903 +$.datepicker._get(inst, 'stepMonths')), 'M'); 8904 // next month/year on alt +right 8905 break; 8906 case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); 8907 handled = event.ctrlKey || event.metaKey; 8908 break; // +1 week on ctrl or command +down 8909 default: handled = false; 8910 } 8911 else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home 8912 $.datepicker._showDatepicker(this); 8913 else { 8914 handled = false; 8915 } 8916 if (handled) { 8917 event.preventDefault(); 8918 event.stopPropagation(); 8919 } 8920 }, 8921 8922 /* Filter entered characters - based on date format. */ 8923 _doKeyPress: function(event) { 8924 var inst = $.datepicker._getInst(event.target); 8925 if ($.datepicker._get(inst, 'constrainInput')) { 8926 var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); 8927 var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); 8928 return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); 8929 } 8930 }, 8931 8932 /* Synchronise manual entry and field/alternate field. */ 8933 _doKeyUp: function(event) { 8934 var inst = $.datepicker._getInst(event.target);
8935 if (inst.input.val() != inst.lastVal) { 8936 try { 8937 var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), 8938 (inst.input ? inst.input.val() : null), 8939 $.datepicker._getFormatConfig(inst)); 8940 if (date) { // only if valid 8941 $.datepicker._setDateFromField(inst); 8942 $.datepicker._updateAlternate(inst); 8943 $.datepicker._updateDatepicker(inst); 8944 } 8945 } 8946 catch (err) { 8947 $.datepicker.log(err); 8948 } 8949 } 8950 return true; 8951 }, 8952 8953 /* Pop-up the date picker for a given input field. 8954 If false returned from beforeShow event handler do not show. 8955 @param input element - the input field attached to the date picker or 8956 event - if triggered by focus */ 8957 _showDatepicker: function(input) { 8958 input = input.target || input; 8959 if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger 8960 input = $('input', input.parentNode)[0]; 8961 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here 8962 return; 8963 var inst = $.datepicker._getInst(input); 8964 if ($.datepicker._curInst && $.datepicker._curInst != inst) { 8965 $.datepicker._curInst.dpDiv.stop(true, true); 8966 if ( inst && $.datepicker._datepickerShowing ) { 8967 $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); 8968 } 8969 } 8970 var beforeShow = $.datepicker._get(inst, 'beforeShow'); 8971 var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 8972 if(beforeShowSettings === false){ 8973 //false 8974 return; 8975 } 8976 extendRemove(inst.settings, beforeShowSettings); 8977 inst.lastVal = null; 8978 $.datepicker._lastInput = input; 8979 $.datepicker._setDateFromField(inst); 8980 if ($.datepicker._inDialog) // hide cursor 8981 input.value = ''; 8982 if (!$.datepicker._pos) { // position below input 8983 $.datepicker._pos = $.datepicker._findPos(input); 8984 $.datepicker._pos[1] += input.offsetHeight; // add the height 8985 } 8986 var isFixed = false; 8987 $(input).parents().each(function() { 8988 isFixed |= $(this).css('position') == 'fixed'; 8989 return !isFixed; 8990 }); 8991 if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled 8992 $.datepicker._pos[0] -= document.documentElement.scrollLeft; 8993 $.datepicker._pos[1] -= document.documentElement.scrollTop; 8994 } 8995 var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; 8996 $.datepicker._pos = null; 8997 //to avoid flashes on Firefox 8998 inst.dpDiv.empty(); 8999 // determine sizing offscreen 9000 inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); 9001 $.datepicker._updateDatepicker(inst); 9002 // fix width for dynamic number of date pickers 9003 // and adjust position before showing 9004 offset = $.datepicker._checkOffset(inst, offset, isFixed); 9005 inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? 9006 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', 9007 left: offset.left + 'px', top: offset.top + 'px'}); 9008 if (!inst.inline) { 9009 var showAnim = $.datepicker._get(inst, 'showAnim'); 9010 var duration = $.datepicker._get(inst, 'duration'); 9011 var postProcess = function() { 9012 var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only 9013 if( !! cover.length ){ 9014 var borders = $.datepicker._getBorders(inst.dpDiv); 9015 cover.css({left: -borders[0], top: -borders[1], 9016 width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); 9017 } 9018 }; 9019 inst.dpDiv.zIndex($(input).zIndex()+1); 9020 $.datepicker._datepickerShowing = true; 9021 if ($.effects && $.effects[showAnim]) 9022 inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); 9023 else 9024 inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); 9025 if (!showAnim || !duration) 9026 postProcess(); 9027 if (inst.input.is(':visible') && !inst.input.is(':disabled')) 9028 inst.input.focus(); 9029 $.datepicker._curInst = inst; 9030 } 9031 }, 9032 9033 /* Generate the date picker content. */ 9034 _updateDatepicker: function(inst) { 9035 var self = this; 9036 self.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 9037 var borders = $.datepicker._getBorders(inst.dpDiv); 9038 instActive = inst; // for delegate hover events 9039 inst.dpDiv.empty().append(this._generateHTML(inst)); 9040 this._attachHandlers(inst);
9041 var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only 9042 if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 9043 cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) 9044 } 9045 inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); 9046 var numMonths = this._getNumberOfMonths(inst); 9047 var cols = numMonths[1]; 9048 var width = 17; 9049 inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); 9050 if (cols > 1) 9051 inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); 9052 inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + 9053 'Class']('ui-datepicker-multi'); 9054 inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 9055 'Class']('ui-datepicker-rtl'); 9056 if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && 9057 // #6694 - don't focus the input if it's already focused 9058 // this breaks the change event in IE 9059 inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) 9060 inst.input.focus(); 9061 // deffered render of the years select (to avoid flashes on Firefox) 9062 if( inst.yearshtml ){ 9063 var origyearshtml = inst.yearshtml; 9064 setTimeout(function(){ 9065 //assure that inst.yearshtml didn't change. 9066 if( origyearshtml === inst.yearshtml && inst.yearshtml ){ 9067 inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); 9068 } 9069 origyearshtml = inst.yearshtml = null; 9070 }, 0); 9071 } 9072 }, 9073 9074 /* Retrieve the size of left and top borders for an element. 9075 @param elem (jQuery object) the element of interest 9076 @return (number[2]) the left and top borders */ 9077 _getBorders: function(elem) { 9078 var convert = function(value) { 9079 return {thin: 1, medium: 2, thick: 3}[value] || value; 9080 }; 9081 return [parseFloat(convert(elem.css('border-left-width'))), 9082 parseFloat(convert(elem.css('border-top-width')))]; 9083 }, 9084 9085 /* Check positioning to remain on screen. */ 9086 _checkOffset: function(inst, offset, isFixed) { 9087 var dpWidth = inst.dpDiv.outerWidth(); 9088 var dpHeight = inst.dpDiv.outerHeight(); 9089 var inputWidth = inst.input ? inst.input.outerWidth() : 0; 9090 var inputHeight = inst.input ? inst.input.outerHeight() : 0; 9091 var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); 9092 var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 9093 9094 offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); 9095 offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; 9096 offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 9097 9098 // now check if datepicker is showing outside window viewport - move to a better place if so. 9099 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 9100 Math.abs(offset.left + dpWidth - viewWidth) : 0); 9101 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 9102 Math.abs(dpHeight + inputHeight) : 0); 9103 9104 return offset; 9105 }, 9106 9107 /* Find an object's position on the screen. */ 9108 _findPos: function(obj) { 9109 var inst = this._getInst(obj); 9110 var isRTL = this._get(inst, 'isRTL'); 9111 while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { 9112 obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; 9113 } 9114 var position = $(obj).offset(); 9115 return [position.left, position.top]; 9116 }, 9117 9118 /* Hide the date picker from view. 9119 @param input element - the input field attached to the date picker */ 9120 _hideDatepicker: function(input) { 9121 var inst = this._curInst; 9122 if (!inst || (input && inst != $.data(input, PROP_NAME))) 9123 return; 9124 if (this._datepickerShowing) { 9125 var showAnim = this._get(inst, 'showAnim'); 9126 var duration = this._get(inst, 'duration'); 9127 var postProcess = function() { 9128 $.datepicker._tidyDialog(inst); 9129 }; 9130 if ($.effects && $.effects[showAnim]) 9131 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); 9132 else 9133 inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : 9134 (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); 9135 if (!showAnim) 9136 postProcess(); 9137 this._datepickerShowing = false;
9138 var onClose = this._get(inst, 'onClose'); 9139 if (onClose) 9140 onClose.apply((inst.input ? inst.input[0] : null), 9141 [(inst.input ? inst.input.val() : ''), inst]); 9142 this._lastInput = null; 9143 if (this._inDialog) { 9144 this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); 9145 if ($.blockUI) { 9146 $.unblockUI(); 9147 $('body').append(this.dpDiv); 9148 } 9149 } 9150 this._inDialog = false; 9151 } 9152 }, 9153 9154 /* Tidy up after a dialog display. */ 9155 _tidyDialog: function(inst) { 9156 inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); 9157 }, 9158 9159 /* Close date picker if clicked elsewhere. */ 9160 _checkExternalClick: function(event) { 9161 if (!$.datepicker._curInst) 9162 return; 9163 9164 var $target = $(event.target), 9165 inst = $.datepicker._getInst($target[0]); 9166 9167 if ( ( ( $target[0].id != $.datepicker._mainDivId && 9168 $target.parents('#' + $.datepicker._mainDivId).length == 0 && 9169 !$target.hasClass($.datepicker.markerClassName) && 9170 !$target.closest("." + $.datepicker._triggerClass).length && 9171 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || 9172 ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) ) 9173 $.datepicker._hideDatepicker(); 9174 }, 9175 9176 /* Adjust one of the date sub-fields. */ 9177 _adjustDate: function(id, offset, period) { 9178 var target = $(id); 9179 var inst = this._getInst(target[0]); 9180 if (this._isDisabledDatepicker(target[0])) { 9181 return; 9182 } 9183 this._adjustInstDate(inst, offset + 9184 (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning 9185 period); 9186 this._updateDatepicker(inst); 9187 }, 9188 9189 /* Action for current link. */ 9190 _gotoToday: function(id) { 9191 var target = $(id); 9192 var inst = this._getInst(target[0]); 9193 if (this._get(inst, 'gotoCurrent') && inst.currentDay) { 9194 inst.selectedDay = inst.currentDay; 9195 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 9196 inst.drawYear = inst.selectedYear = inst.currentYear; 9197 } 9198 else { 9199 var date = new Date(); 9200 inst.selectedDay = date.getDate(); 9201 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9202 inst.drawYear = inst.selectedYear = date.getFullYear(); 9203 } 9204 this._notifyChange(inst); 9205 this._adjustDate(target); 9206 }, 9207 9208 /* Action for selecting a new month/year. */ 9209 _selectMonthYear: function(id, select, period) { 9210 var target = $(id); 9211 var inst = this._getInst(target[0]); 9212 inst['selected' + (period == 'M' ? 'Month' : 'Year')] = 9213 inst['draw' + (period == 'M' ? 'Month' : 'Year')] = 9214 parseInt(select.options[select.selectedIndex].value,10); 9215 this._notifyChange(inst); 9216 this._adjustDate(target); 9217 }, 9218 9219 /* Action for selecting a day. */ 9220 _selectDay: function(id, month, year, td) { 9221 var target = $(id); 9222 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 9223 return; 9224 } 9225 var inst = this._getInst(target[0]); 9226 inst.selectedDay = inst.currentDay = $('a', td).html(); 9227 inst.selectedMonth = inst.currentMonth = month; 9228 inst.selectedYear = inst.currentYear = year; 9229 this._selectDate(id, this._formatDate(inst, 9230 inst.currentDay, inst.currentMonth, inst.currentYear)); 9231 }, 9232 9233 /* Erase the input field and hide the date picker. */ 9234 _clearDate: function(id) { 9235 var target = $(id); 9236 var inst = this._getInst(target[0]); 9237 this._selectDate(target, ''); 9238 }, 9239 9240 /* Update the input field with the selected date. */ 9241 _selectDate: function(id, dateStr) { 9242 var target = $(id); 9243 var inst = this._getInst(target[0]); 9244 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 9245 if (inst.input) 9246 inst.input.val(dateStr); 9247 this._updateAlternate(inst); 9248 var onSelect = this._get(inst, 'onSelect'); 9249 if (onSelect) 9250 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 9251 else if (inst.input) 9252 inst.input.trigger('change'); // fire the change event 9253 if (inst.inline) 9254 this._updateDatepicker(inst); 9255 else { 9256 this._hideDatepicker(); 9257 this._lastInput = inst.input[0]; 9258 if (typeof(inst.input[0]) != 'object') 9259 inst.input.focus(); // restore focus 9260 this._lastInput = null; 9261 } 9262 }, 9263 9264 /* Update any alternate field to synchronise with the main field. */ 9265 _updateAlternate: function(inst) { 9266 var altField = this._get(inst, 'altField'); 9267 if (altField) { // update alternate field too 9268 var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); 9269 var date = this._getDate(inst); 9270 var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 9271 $(altField).each(function() { $(this).val(dateStr); }); 9272 } 9273 }, 9274 9275 /* Set as beforeShowDay function to prevent selection of weekends. 9276 @param date Date - the date to customise 9277 @return [boolean, string] - is this date selectable?, what is its CSS class? */ 9278 noWeekends: function(date) { 9279 var day = date.getDay(); 9280 return [(day > 0 && day < 6), '']; 9281 }, 9282 9283 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 9284 @param date Date - the date to get the week for 9285 @return number - the number of the week within the year that contains this date */ 9286 iso8601Week: function(date) { 9287 var checkDate = new Date(date.getTime()); 9288 // Find Thursday of this week starting on Monday 9289 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 9290 var time = checkDate.getTime(); 9291 checkDate.setMonth(0); // Compare with Jan 1 9292 checkDate.setDate(1); 9293 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 9294 }, 9295 9296 /* Parse a string value into a date object. 9297 See formatDate below for the possible formats. 9298
9299 @param format string - the expected format of the date 9300 @param value string - the date in the above format 9301 @param settings Object - attributes include: 9302 shortYearCutoff number - the cutoff year for determining the century (optional) 9303 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9304 dayNames string[7] - names of the days from Sunday (optional) 9305 monthNamesShort string[12] - abbreviated names of the months (optional) 9306 monthNames string[12] - names of the months (optional) 9307 @return Date - the extracted date value or null if value is blank */ 9308 parseDate: function (format, value, settings) { 9309 if (format == null || value == null) 9310 throw 'Invalid arguments'; 9311 value = (typeof value == 'object' ? value.toString() : value + ''); 9312 if (value == '') 9313 return null; 9314 var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; 9315 shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : 9316 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 9317 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; 9318 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; 9319 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; 9320 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; 9321 var year = -1; 9322 var month = -1; 9323 var day = -1; 9324 var doy = -1; 9325 var literal = false; 9326 // Check whether a format character is doubled 9327 var lookAhead = function(match) { 9328 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 9329 if (matches) 9330 iFormat++; 9331 return matches; 9332 }; 9333 // Extract a number from the string value 9334 var getNumber = function(match) { 9335 var isDoubled = lookAhead(match); 9336 var size = (match == '@' ? 14 : (match == '!' ? 20 : 9337 (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); 9338 var digits = new RegExp('^\\d{1,' + size + '}'); 9339 var num = value.substring(iValue).match(digits); 9340 if (!num) 9341 throw 'Missing number at position ' + iValue; 9342 iValue += num[0].length; 9343 return parseInt(num[0], 10); 9344 }; 9345 // Extract a name from the string value and convert to an index 9346 var getName = function(match, shortNames, longNames) { 9347 var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 9348 return [ [k, v] ]; 9349 }).sort(function (a, b) { 9350 return -(a[1].length - b[1].length); 9351 }); 9352 var index = -1; 9353 $.each(names, function (i, pair) { 9354 var name = pair[1]; 9355 if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) { 9356 index = pair[0]; 9357 iValue += name.length; 9358 return false; 9359 } 9360 }); 9361 if (index != -1) 9362 return index + 1; 9363 else 9364 throw 'Unknown name at position ' + iValue; 9365 }; 9366 // Confirm that a literal character matches the string value 9367 var checkLiteral = function() { 9368 if (value.charAt(iValue) != format.charAt(iFormat)) 9369 throw 'Unexpected literal at position ' + iValue; 9370 iValue++; 9371 }; 9372 var iValue = 0; 9373 for (var iFormat = 0; iFormat < format.length; iFormat++) { 9374 if (literal) 9375 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 9376 literal = false; 9377 else 9378 checkLiteral(); 9379 else 9380 switch (format.charAt(iFormat)) { 9381 case 'd': 9382 day = getNumber('d'); 9383 break; 9384 case 'D': 9385 getName('D', dayNamesShort, dayNames); 9386 break; 9387 case 'o': 9388 doy = getNumber('o'); 9389 break; 9390 case 'm': 9391 month = getNumber('m'); 9392 break; 9393 case 'M': 9394 month = getName('M', monthNamesShort, monthNames); 9395 break; 9396 case 'y': 9397 year = getNumber('y'); 9398 break; 9399 case '@': 9400 var date = new Date(getNumber('@')); 9401 year = date.getFullYear(); 9402 month = date.getMonth() + 1; 9403 day = date.getDate(); 9404 break; 9405 case '!': 9406 var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); 9407 year = date.getFullYear();
9408 month = date.getMonth() + 1; 9409 day = date.getDate(); 9410 break; 9411 case "'": 9412 if (lookAhead("'")) 9413 checkLiteral(); 9414 else 9415 literal = true; 9416 break; 9417 default: 9418 checkLiteral(); 9419 } 9420 } 9421 if (iValue < value.length){ 9422 throw "Extra/unparsed characters found in date: " + value.substring(iValue); 9423 } 9424 if (year == -1) 9425 year = new Date().getFullYear(); 9426 else if (year < 100) 9427 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 9428 (year <= shortYearCutoff ? 0 : -100); 9429 if (doy > -1) { 9430 month = 1; 9431 day = doy; 9432 do { 9433 var dim = this._getDaysInMonth(year, month - 1); 9434 if (day <= dim) 9435 break; 9436 month++; 9437 day -= dim; 9438 } while (true); 9439 } 9440 var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 9441 if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) 9442 throw 'Invalid date'; // E.g. 31/02/00 9443 return date; 9444 }, 9445 9446 /* Standard date formats. */ 9447 ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) 9448 COOKIE: 'D, dd M yy', 9449 ISO_8601: 'yy-mm-dd', 9450 RFC_822: 'D, d M y', 9451 RFC_850: 'DD, dd-M-y', 9452 RFC_1036: 'D, d M y', 9453 RFC_1123: 'D, d M yy', 9454 RFC_2822: 'D, d M yy', 9455 RSS: 'D, d M y', // RFC 822 9456 TICKS: '!', 9457 TIMESTAMP: '@', 9458 W3C: 'yy-mm-dd', // ISO 8601 9459 9460 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 9461 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 9462 9463 /* Format a date object into a string value. 9464 The format can be combinations of the following: 9465 d - day of month (no leading zero) 9466 dd - day of month (two digit) 9467 o - day of year (no leading zeros) 9468 oo - day of year (three digit) 9469 D - day name short 9470 DD - day name long 9471 m - month of year (no leading zero) 9472 mm - month of year (two digit) 9473 M - month name short 9474 MM - month name long 9475 y - year (two digit) 9476 yy - year (four digit) 9477 @ - Unix timestamp (ms since 01/01/1970) 9478 ! - Windows ticks (100ns since 01/01/0001) 9479 '...' - literal text 9480 '' - single quote 9481 9482 @param format string - the desired format of the date 9483 @param date Date - the date value to format 9484 @param settings Object - attributes include: 9485 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9486 dayNames string[7] - names of the days from Sunday (optional) 9487 monthNamesShort string[12] - abbreviated names of the months (optional) 9488 monthNames string[12] - names of the months (optional) 9489 @return string - the date in the above format */ 9490 formatDate: function (format, date, settings) { 9491 if (!date) 9492 return ''; 9493 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; 9494 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; 9495 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; 9496 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; 9497 // Check whether a format character is doubled 9498 var lookAhead = function(match) { 9499 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 9500 if (matches) 9501 iFormat++; 9502 return matches; 9503 }; 9504 // Format a number, with leading zero if necessary 9505 var formatNumber = function(match, value, len) { 9506 var num = '' + value; 9507 if (lookAhead(match)) 9508 while (num.length < len) 9509 num = '0' + num; 9510 return num; 9511 }; 9512 // Format a name, short or long as requested 9513 var formatName = function(match, value, shortNames, longNames) { 9514 return (lookAhead(match) ? longNames[value] : shortNames[value]); 9515 }; 9516 var output = ''; 9517 var literal = false; 9518 if (date) 9519 for (var iFormat = 0; iFormat < format.length; iFormat++) { 9520 if (literal) 9521 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 9522 literal = false; 9523 else 9524 output += format.charAt(iFormat); 9525 else 9526 switch (format.charAt(iFormat)) { 9527 case 'd': 9528 output += formatNumber('d', date.getDate(), 2); 9529 break; 9530 case 'D': 9531 output += formatName('D', date.getDay(), dayNamesShort, dayNames); 9532 break; 9533 case 'o': 9534 output += formatNumber('o', 9535 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 9536 break; 9537 case 'm': 9538 output += formatNumber('m', date.getMonth() + 1, 2); 9539 break; 9540 case 'M': 9541 output += formatName('M', date.getMonth(), monthNamesShort, monthNames); 9542 break; 9543 case 'y': 9544 output += (lookAhead('y') ? date.getFullYear() : 9545 (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); 9546 break; 9547 case '@': 9548 output += date.getTime(); 9549 break; 9550 case '!': 9551 output += date.getTime() * 10000 + this._ticksTo1970; 9552 break;
9553 case "'": 9554 if (lookAhead("'")) 9555 output += "'"; 9556 else 9557 literal = true; 9558 break; 9559 default: 9560 output += format.charAt(iFormat); 9561 } 9562 } 9563 return output; 9564 }, 9565 9566 /* Extract all possible characters from the date format. */ 9567 _possibleChars: function (format) { 9568 var chars = ''; 9569 var literal = false; 9570 // Check whether a format character is doubled 9571 var lookAhead = function(match) { 9572 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 9573 if (matches) 9574 iFormat++; 9575 return matches; 9576 }; 9577 for (var iFormat = 0; iFormat < format.length; iFormat++) 9578 if (literal) 9579 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 9580 literal = false; 9581 else 9582 chars += format.charAt(iFormat); 9583 else 9584 switch (format.charAt(iFormat)) { 9585 case 'd': case 'm': case 'y': case '@': 9586 chars += '0123456789'; 9587 break; 9588 case 'D': case 'M': 9589 return null; // Accept anything 9590 case "'": 9591 if (lookAhead("'")) 9592 chars += "'"; 9593 else 9594 literal = true; 9595 break; 9596 default: 9597 chars += format.charAt(iFormat); 9598 } 9599 return chars; 9600 }, 9601 9602 /* Get a setting value, defaulting if necessary. */ 9603 _get: function(inst, name) { 9604 return inst.settings[name] !== undefined ? 9605 inst.settings[name] : this._defaults[name]; 9606 }, 9607 9608 /* Parse existing date and initialise date picker. */ 9609 _setDateFromField: function(inst, noDefault) { 9610 if (inst.input.val() == inst.lastVal) { 9611 return; 9612 } 9613 var dateFormat = this._get(inst, 'dateFormat'); 9614 var dates = inst.lastVal = inst.input ? inst.input.val() : null; 9615 var date, defaultDate; 9616 date = defaultDate = this._getDefaultDate(inst); 9617 var settings = this._getFormatConfig(inst); 9618 try { 9619 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 9620 } catch (event) { 9621 this.log(event); 9622 dates = (noDefault ? '' : dates); 9623 } 9624 inst.selectedDay = date.getDate(); 9625 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9626 inst.drawYear = inst.selectedYear = date.getFullYear(); 9627 inst.currentDay = (dates ? date.getDate() : 0); 9628 inst.currentMonth = (dates ? date.getMonth() : 0); 9629 inst.currentYear = (dates ? date.getFullYear() : 0); 9630 this._adjustInstDate(inst); 9631 }, 9632 9633 /* Retrieve the default date shown on opening. */ 9634 _getDefaultDate: function(inst) { 9635 return this._restrictMinMax(inst, 9636 this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); 9637 }, 9638 9639 /* A date may be specified as an exact value or a relative one. */ 9640 _determineDate: function(inst, date, defaultDate) { 9641 var offsetNumeric = function(offset) { 9642 var date = new Date(); 9643 date.setDate(date.getDate() + offset); 9644 return date; 9645 }; 9646 var offsetString = function(offset) { 9647 try { 9648 return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), 9649 offset, $.datepicker._getFormatConfig(inst)); 9650 } 9651 catch (e) { 9652 // Ignore 9653 } 9654 var date = (offset.toLowerCase().match(/^c/) ? 9655 $.datepicker._getDate(inst) : null) || new Date(); 9656 var year = date.getFullYear(); 9657 var month = date.getMonth(); 9658 var day = date.getDate(); 9659 var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; 9660 var matches = pattern.exec(offset); 9661 while (matches) { 9662 switch (matches[2] || 'd') { 9663 case 'd' : case 'D' : 9664 day += parseInt(matches[1],10); break; 9665 case 'w' : case 'W' : 9666 day += parseInt(matches[1],10) * 7; break; 9667 case 'm' : case 'M' : 9668 month += parseInt(matches[1],10); 9669 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 9670 break; 9671 case 'y': case 'Y' : 9672 year += parseInt(matches[1],10); 9673 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 9674 break; 9675 } 9676 matches = pattern.exec(offset); 9677 } 9678 return new Date(year, month, day); 9679 }; 9680 var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : 9681 (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 9682 newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); 9683 if (newDate) { 9684 newDate.setHours(0); 9685 newDate.setMinutes(0); 9686 newDate.setSeconds(0); 9687 newDate.setMilliseconds(0); 9688 } 9689 return this._daylightSavingAdjust(newDate); 9690 }, 9691 9692 /* Handle switch to/from daylight saving. 9693 Hours may be non-zero on daylight saving cut-over: 9694 > 12 when midnight changeover, but then cannot generate 9695 midnight datetime, so jump to 1AM, otherwise reset. 9696 @param date (Date) the date to check 9697 @return (Date) the corrected date */ 9698 _daylightSavingAdjust: function(date) { 9699 if (!date) return null; 9700 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 9701 return date; 9702 }, 9703 9704 /* Set the date(s) directly. */ 9705 _setDate: function(inst, date, noChange) { 9706 var clear = !date; 9707 var origMonth = inst.selectedMonth; 9708 var origYear = inst.selectedYear; 9709 var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 9710 inst.selectedDay = inst.currentDay = newDate.getDate(); 9711 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 9712 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 9713 if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) 9714 this._notifyChange(inst); 9715 this._adjustInstDate(inst); 9716 if (inst.input) { 9717 inst.input.val(clear ? '' : this._formatDate(inst)); 9718 } 9719 }, 9720 9721 /* Retrieve the date(s) directly. */ 9722 _getDate: function(inst) { 9723 var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : 9724 this._daylightSavingAdjust(new Date( 9725 inst.currentYear, inst.currentMonth, inst.currentDay))); 9726 return startDate; 9727 }, 9728 9729 /* Attach the onxxx handlers. These are declared statically so 9730 * they work with static code transformers like Caja. 9731 */ 9732 _attachHandlers: function(inst) { 9733 var stepMonths = this._get(inst, 'stepMonths'); 9734 var id = '#' + inst.id.replace( /\\\\/g, "\\" );
9735 inst.dpDiv.find('[data-handler]').map(function () { 9736 var handler = { 9737 prev: function () { 9738 window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); 9739 }, 9740 next: function () { 9741 window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); 9742 }, 9743 hide: function () { 9744 window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); 9745 }, 9746 today: function () { 9747 window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); 9748 }, 9749 selectDay: function () { 9750 window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); 9751 return false; 9752 }, 9753 selectMonth: function () { 9754 window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); 9755 return false; 9756 }, 9757 selectYear: function () { 9758 window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); 9759 return false; 9760 } 9761 }; 9762 $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); 9763 }); 9764 }, 9765 9766 /* Generate the HTML for the current state of the date picker. */ 9767 _generateHTML: function(inst) { 9768 var today = new Date(); 9769 today = this._daylightSavingAdjust( 9770 new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time 9771 var isRTL = this._get(inst, 'isRTL'); 9772 var showButtonPanel = this._get(inst, 'showButtonPanel'); 9773 var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); 9774 var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); 9775 var numMonths = this._getNumberOfMonths(inst); 9776 var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); 9777 var stepMonths = this._get(inst, 'stepMonths'); 9778 var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); 9779 var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 9780 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 9781 var minDate = this._getMinMaxDate(inst, 'min'); 9782 var maxDate = this._getMinMaxDate(inst, 'max'); 9783 var drawMonth = inst.drawMonth - showCurrentAtPos; 9784 var drawYear = inst.drawYear; 9785 if (drawMonth < 0) { 9786 drawMonth += 12; 9787 drawYear--; 9788 } 9789 if (maxDate) { 9790 var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 9791 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 9792 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 9793 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 9794 drawMonth--; 9795 if (drawMonth < 0) { 9796 drawMonth = 11; 9797 drawYear--; 9798 } 9799 } 9800 } 9801 inst.drawMonth = drawMonth; 9802 inst.drawYear = drawYear; 9803 var prevText = this._get(inst, 'prevText'); 9804 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 9805 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 9806 this._getFormatConfig(inst))); 9807 var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 9808 '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' + 9809 ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : 9810 (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); 9811 var nextText = this._get(inst, 'nextText'); 9812 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 9813 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 9814 this._getFormatConfig(inst))); 9815 var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 9816 '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' + 9817 ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : 9818 (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); 9819 var currentText = this._get(inst, 'currentText'); 9820 var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); 9821 currentText = (!navigationAsDateFormat ? currentText : 9822 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 9823 var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' + 9824 this._get(inst, 'closeText') + '</button>' : ''); 9825 var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + 9826 (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' + 9827 '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; 9828 var firstDay = parseInt(this._get(inst, 'firstDay'),10); 9829 firstDay = (isNaN(firstDay) ? 0 : firstDay); 9830 var showWeek = this._get(inst, 'showWeek'); 9831 var dayNames = this._get(inst, 'dayNames'); 9832 var dayNamesShort = this._get(inst, 'dayNamesShort'); 9833 var dayNamesMin = this._get(inst, 'dayNamesMin'); 9834 var monthNames = this._get(inst, 'monthNames'); 9835 var monthNamesShort = this._get(inst, 'monthNamesShort'); 9836 var beforeShowDay = this._get(inst, 'beforeShowDay'); 9837 var showOtherMonths = this._get(inst, 'showOtherMonths'); 9838 var selectOtherMonths = this._get(inst, 'selectOtherMonths'); 9839 var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; 9840 var defaultDate = this._getDefaultDate(inst); 9841 var html = ''; 9842 for (var row = 0; row < numMonths[0]; row++) { 9843 var group = ''; 9844 this.maxRows = 4; 9845 for (var col = 0; col < numMonths[1]; col++) { 9846 var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 9847 var cornerClass = ' ui-corner-all'; 9848 var calender = ''; 9849 if (isMultiMonth) { 9850 calender += '<div class="ui-datepicker-group'; 9851 if (numMonths[1] > 1) 9852 switch (col) { 9853 case 0: calender += ' ui-datepicker-group-first'; 9854 cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; 9855 case numMonths[1]-1: calender += ' ui-datepicker-group-last'; 9856 cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; 9857 default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break; 9858 } 9859 calender += '">'; 9860 } 9861 calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + 9862 (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + 9863 (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + 9864 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 9865 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 9866 '</div><table class="ui-datepicker-calendar"><thead>' + 9867 '<tr>'; 9868 var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); 9869 for (var dow = 0; dow < 7; dow++) { // days of the week 9870 var day = (dow + firstDay) % 7; 9871 thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>
9871' + 9872 '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; 9873 } 9874 calender += thead + '</tr></thead><tbody>'; 9875 var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 9876 if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) 9877 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 9878 var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 9879 var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 9880 var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 9881 this.maxRows = numRows; 9882 var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 9883 for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows 9884 calender += '<tr>'; 9885 var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + 9886 this._get(inst, 'calculateWeek')(printDate) + '</td>'); 9887 for (var dow = 0; dow < 7; dow++) { // create date picker days 9888 var daySettings = (beforeShowDay ? 9889 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); 9890 var otherMonth = (printDate.getMonth() != drawMonth); 9891 var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 9892 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 9893 tbody += '<td class="' + 9894 ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends 9895 (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months 9896 ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key 9897 (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? 9898 // or defaultDate is current printedDate and defaultDate is selectedDate 9899 ' ' + this._dayOverClass : '') + // highlight selected day 9900 (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days 9901 (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates 9902 (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day 9903 (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) 9904 ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title 9905 (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions 9906 (otherMonth && !showOtherMonths ? ' ' : // display for other months 9907 (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + 9908 (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + 9909 (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day 9910 (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months 9911 '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date 9912 printDate.setDate(printDate.getDate() + 1); 9913 printDate = this._daylightSavingAdjust(printDate); 9914 } 9915 calender += tbody + '</tr>'; 9916 } 9917 drawMonth++; 9918 if (drawMonth > 11) { 9919 drawMonth = 0; 9920 drawYear++; 9921 } 9922 calender += '</tbody></table>' + (isMultiMonth ? '</div>' + 9923 ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); 9924 group += calender; 9925 } 9926 html += group; 9927 } 9928 html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? 9929 '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); 9930 inst._keyEvent = false; 9931 return html; 9932 }, 9933 9934 /* Generate the month and year header. */ 9935 _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, 9936 secondary, monthNames, monthNamesShort) { 9937 var changeMonth = this._get(inst, 'changeMonth'); 9938 var changeYear = this._get(inst, 'changeYear'); 9939 var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); 9940 var html = '<div class="ui-datepicker-title">'; 9941 var monthHtml = ''; 9942 // month selection 9943 if (secondary || !changeMonth) 9944 monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>'; 9945 else { 9946 var inMinYear = (minDate && minDate.getFullYear() == drawYear); 9947 var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); 9948 monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
9949 for (var month = 0; month < 12; month++) { 9950 if ((!inMinYear || month >= minDate.getMonth()) && 9951 (!inMaxYear || month <= maxDate.getMonth())) 9952 monthHtml += '<option value="' + month + '"' + 9953 (month == drawMonth ? ' selected="selected"' : '') + 9954 '>' + monthNamesShort[month] + '</option>'; 9955 } 9956 monthHtml += '</select>'; 9957 } 9958 if (!showMonthAfterYear) 9959 html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); 9960 // year selection 9961 if ( !inst.yearshtml ) { 9962 inst.yearshtml = ''; 9963 if (secondary || !changeYear) 9964 html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; 9965 else { 9966 // determine range of years to display 9967 var years = this._get(inst, 'yearRange').split(':'); 9968 var thisYear = new Date().getFullYear(); 9969 var determineYear = function(value) { 9970 var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : 9971 (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : 9972 parseInt(value, 10))); 9973 return (isNaN(year) ? thisYear : year); 9974 }; 9975 var year = determineYear(years[0]); 9976 var endYear = Math.max(year, determineYear(years[1] || '')); 9977 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 9978 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 9979 inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">'; 9980 for (; year <= endYear; year++) { 9981 inst.yearshtml += '<option value="' + year + '"' + 9982 (year == drawYear ? ' selected="selected"' : '') + 9983 '>' + year + '</option>'; 9984 } 9985 inst.yearshtml += '</select>'; 9986 9987 html += inst.yearshtml; 9988 inst.yearshtml = null; 9989 } 9990 } 9991 html += this._get(inst, 'yearSuffix'); 9992 if (showMonthAfterYear) 9993 html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; 9994 html += '</div>'; // Close datepicker_header 9995 return html; 9996 }, 9997 9998 /* Adjust one of the date sub-fields. */ 9999 _adjustInstDate: function(inst, offset, period) { 10000 var year = inst.drawYear + (period == 'Y' ? offset : 0); 10001 var month = inst.drawMonth + (period == 'M' ? offset : 0); 10002 var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + 10003 (period == 'D' ? offset : 0); 10004 var date = this._restrictMinMax(inst, 10005 this._daylightSavingAdjust(new Date(year, month, day))); 10006 inst.selectedDay = date.getDate(); 10007 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10008 inst.drawYear = inst.selectedYear = date.getFullYear(); 10009 if (period == 'M' || period == 'Y') 10010 this._notifyChange(inst); 10011 }, 10012 10013 /* Ensure a date is within any min/max bounds. */ 10014 _restrictMinMax: function(inst, date) { 10015 var minDate = this._getMinMaxDate(inst, 'min'); 10016 var maxDate = this._getMinMaxDate(inst, 'max'); 10017 var newDate = (minDate && date < minDate ? minDate : date); 10018 newDate = (maxDate && newDate > maxDate ? maxDate : newDate); 10019 return newDate; 10020 }, 10021 10022 /* Notify change of month/year. */ 10023 _notifyChange: function(inst) { 10024 var onChange = this._get(inst, 'onChangeMonthYear'); 10025 if (onChange) 10026 onChange.apply((inst.input ? inst.input[0] : null), 10027 [inst.selectedYear, inst.selectedMonth + 1, inst]); 10028 }, 10029 10030 /* Determine the number of months to show. */ 10031 _getNumberOfMonths: function(inst) { 10032 var numMonths = this._get(inst, 'numberOfMonths'); 10033 return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); 10034 }, 10035 10036 /* Determine the current maximum date - ensure no time components are set. */ 10037 _getMinMaxDate: function(inst, minMax) { 10038 return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); 10039 }, 10040 10041 /* Find the number of days in a given month. */ 10042 _getDaysInMonth: function(year, month) { 10043 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 10044 }, 10045 10046 /* Find the day of the week of the first of a month. */ 10047 _getFirstDayOfMonth: function(year, month) { 10048 return new Date(year, month, 1).getDay(); 10049 }, 10050 10051 /* Determines if we should allow a "next/prev" month display change. */ 10052 _canAdjustMonth: function(inst, offset, curYear, curMonth) { 10053 var numMonths = this._getNumberOfMonths(inst); 10054 var date = this._daylightSavingAdjust(new Date(curYear, 10055 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 10056 if (offset < 0) 10057 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 10058 return this._isInRange(inst, date); 10059 }, 10060 10061 /* Is the given date in the accepted range? */ 10062 _isInRange: function(inst, date) { 10063 var minDate = this._getMinMaxDate(inst, 'min'); 10064 var maxDate = this._getMinMaxDate(inst, 'max'); 10065 return ((!minDate || date.getTime() >= minDate.getTime()) && 10066 (!maxDate || date.getTime() <= maxDate.getTime())); 10067 }, 10068 10069 /* Provide the configuration settings for formatting/parsing. */ 10070 _getFormatConfig: function(inst) { 10071 var shortYearCutoff = this._get(inst, 'shortYearCutoff'); 10072 shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : 10073 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 10074 return {shortYearCutoff: shortYearCutoff, 10075 dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), 10076 monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; 10077 }, 10078 10079 /* Format the given date for display. */ 10080 _formatDate: function(inst, day, month, year) { 10081 if (!day) { 10082 inst.currentDay = inst.selectedDay; 10083 inst.currentMonth = inst.selectedMonth; 10084 inst.currentYear = inst.selectedYear; 10085 } 10086 var date = (day ? (typeof day == 'object' ? day : 10087 this._daylightSavingAdjust(new Date(year, month, day))) : 10088 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 10089 return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); 10090 } 10091}); 10092 10093/* 10094 * Bind hover events for datepicker elements. 10095 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 10096 * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 10097 */ 10098function bindHover(dpDiv) { 10099 var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; 10100 return dpDiv.bind('mouseout', function(event) { 10101 var elem = $( event.target ).closest( selector ); 10102 if ( !elem.length ) { 10103 return; 10104 } 10105 elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); 10106 }) 10107 .bind('mouseover', function(event) { 10108 var elem = $( event.target ).closest( selector ); 10109 if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || 10110 !elem.length ) { 10111 return; 10112 } 10113 elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); 10114 elem.addClass('ui-state-hover'); 10115 if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); 10116 if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); 10117 }); 10118} 10119 10120/* jQuery extend now ignores nulls! */ 10121function extendRemove(target, props) { 10122 $.extend(target, props); 10123 for (var name in props) 10124 if (props[name] == null || props[name] == undefined) 10125 target[name] = props[name]; 10126 return target; 10127}; 10128 10129/* Determine whether an object is an array. */ 10130function isArray(a) { 10131 return (a && (($.browser.safari && typeof a == 'object' && a.length) || 10132 (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); 10133}; 10134 10135/* Invoke the datepicker functionality. 10136 @param options string - a command, optionally followed by additional parameters or 10137 Object - settings for attaching new datepicker functionality 10138 @return jQuery object */ 10139$.fn.datepicker = function(options){ 10140 10141 /* Verify an empty collection wasn't passed - Fixes #6976 */ 10142 if ( !this.length ) { 10143 return this; 10144 } 10145 10146 /* Initialise the date picker. */ 10147 if (!$.datepicker.initialized) { 10148 $(document).mousedown($.datepicker._checkExternalClick). 10149 find('body').append($.datepicker.dpDiv); 10150 $.datepicker.initialized = true; 10151 } 10152 10153 var otherArgs = Array.prototype.slice.call(arguments, 1); 10154 if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) 10155 return $.datepicker['_' + options + 'Datepicker']. 10156 apply($.datepicker, [this[0]].concat(otherArgs)); 10157 if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') 10158 return $.datepicker['_' + options + 'Datepicker']. 10159 apply($.datepicker, [this[0]].concat(otherArgs)); 10160 return this.each(function() { 10161 typeof options == 'string' ? 10162 $.datepicker['_' + options + 'Datepicker']. 10163 apply($.datepicker, [this].concat(otherArgs)) : 10164 $.datepicker._attachDatepicker(this, options); 10165 }); 10166}; 10167 10168$.datepicker = new Datepicker(); // singleton instance 10169$.datepicker.initialized = false;
10170$.datepicker.uuid = new Date().getTime(); 10171$.datepicker.version = "1.8.24"; 10172 10173// Workaround for #4055 10174// Add another global to avoid noConflict issues with inline event handlers 10175window['DP_jQuery_' + dpuuid] = $; 10176 10177})(jQuery); 10178/*! 10179 * jQuery UI Progressbar 1.8.24 10180 * 10181 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 10182 * Dual licensed under the MIT or GPL Version 2 licenses. 10183 * http://jquery.org/license 10184 * 10185 * http://docs.jquery.com/UI/Progressbar 10186 * 10187 * Depends: 10188 * jquery.ui.core.js 10189 * jquery.ui.widget.js 10190 */ 10191(function( $, undefined ) { 10192 10193$.widget( "ui.progressbar", { 10194 options: { 10195 value: 0, 10196 max: 100 10197 }, 10198 10199 min: 0, 10200 10201 _create: function() { 10202 this.element 10203 .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) 10204 .attr({ 10205 role: "progressbar", 10206 "aria-valuemin": this.min, 10207 "aria-valuemax": this.options.max, 10208 "aria-valuenow": this._value() 10209 }); 10210 10211 this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) 10212 .appendTo( this.element ); 10213 10214 this.oldValue = this._value(); 10215 this._refreshValue(); 10216 }, 10217 10218 destroy: function() { 10219 this.element 10220 .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) 10221 .removeAttr( "role" ) 10222 .removeAttr( "aria-valuemin" ) 10223 .removeAttr( "aria-valuemax" ) 10224 .removeAttr( "aria-valuenow" ); 10225 10226 this.valueDiv.remove(); 10227 10228 $.Widget.prototype.destroy.apply( this, arguments ); 10229 }, 10230 10231 value: function( newValue ) { 10232 if ( newValue === undefined ) { 10233 return this._value(); 10234 } 10235 10236 this._setOption( "value", newValue ); 10237 return this; 10238 }, 10239 10240 _setOption: function( key, value ) { 10241 if ( key === "value" ) { 10242 this.options.value = value; 10243 this._refreshValue(); 10244 if ( this._value() === this.options.max ) { 10245 this._trigger( "complete" ); 10246 } 10247 } 10248 10249 $.Widget.prototype._setOption.apply( this, arguments ); 10250 }, 10251 10252 _value: function() { 10253 var val = this.options.value; 10254 // normalize invalid value 10255 if ( typeof val !== "number" ) { 10256 val = 0; 10257 } 10258 return Math.min( this.options.max, Math.max( this.min, val ) ); 10259 }, 10260 10261 _percentage: function() { 10262 return 100 * this._value() / this.options.max; 10263 }, 10264 10265 _refreshValue: function() { 10266 var value = this.value(); 10267 var percentage = this._percentage(); 10268 10269 if ( this.oldValue !== value ) { 10270 this.oldValue = value; 10271 this._trigger( "change" ); 10272 } 10273 10274 this.valueDiv 10275 .toggle( value > this.min ) 10276 .toggleClass( "ui-corner-right", value === this.options.max ) 10277 .width( percentage.toFixed(0) + "%" ); 10278 this.element.attr( "aria-valuenow", value ); 10279 } 10280}); 10281 10282$.extend( $.ui.progressbar, { 10283 version: "1.8.24" 10284}); 10285 10286})( jQuery ); 10287/*! 10288 * jQuery UI Effects 1.8.24 10289 * 10290 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 10291 * Dual licensed under the MIT or GPL Version 2 licenses. 10292 * http://jquery.org/license 10293 * 10294 * http://docs.jquery.com/UI/Effects/ 10295 */ 10296;jQuery.effects || (function($, undefined) { 10297 10298$.effects = {}; 10299 10300 10301 10302/******************************************************************************/ 10303/****************************** COLOR ANIMATIONS ******************************/ 10304/******************************************************************************/ 10305 10306// override the animation for color styles 10307$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 10308 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'], 10309function(i, attr) { 10310 $.fx.step[attr] = function(fx) { 10311 if (!fx.colorInit) { 10312 fx.start = getColor(fx.elem, attr); 10313 fx.end = getRGB(fx.end); 10314 fx.colorInit = true; 10315 } 10316 10317 fx.elem.style[attr] = 'rgb(' + 10318 Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' + 10319 Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' + 10320 Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')'; 10321 }; 10322}); 10323 10324// Color Conversion functions from highlightFade 10325// By Blair Mitchelmore 10326// http://jquery.offput.ca/highlightFade/ 10327 10328// Parse strings looking for color tuples [255,255,255] 10329function getRGB(color) { 10330 var result; 10331 10332 // Check if we're already dealing with an array of colors 10333 if ( color && color.constructor == Array && color.length == 3 ) 10334 return color; 10335 10336 // Look for rgb(num,num,num) 10337 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 10338 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; 10339 10340 // Look for rgb(num%,num%,num%) 10341 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 10342 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 10343 10344 // Look for #a0b1c2 10345 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 10346 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 10347 10348 // Look for #fff 10349 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 10350 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 10351 10352 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 10353 if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) 10354 return colors['transparent']; 10355 10356 // Otherwise, we're most likely dealing with a named color 10357 return colors[$.trim(color).toLowerCase()]; 10358} 10359 10360function getColor(elem, attr) { 10361 var color; 10362 10363 do { 10364 // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css 10365 color = ($.curCSS || $.css)(elem, attr); 10366 10367 // Keep going until we find an element that has color, or we hit the body 10368 if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) 10369 break; 10370 10371 attr = "backgroundColor";
10372 } while ( elem = elem.parentNode ); 10373 10374 return getRGB(color); 10375}; 10376 10377// Some named colors to work with 10378// From Interface by Stefan Petre 10379// http://interface.eyecon.ro/ 10380 10381var colors = { 10382 aqua:[0,255,255], 10383 azure:[240,255,255], 10384 beige:[245,245,220], 10385 black:[0,0,0], 10386 blue:[0,0,255], 10387 brown:[165,42,42], 10388 cyan:[0,255,255], 10389 darkblue:[0,0,139], 10390 darkcyan:[0,139,139], 10391 darkgrey:[169,169,169], 10392 darkgreen:[0,100,0], 10393 darkkhaki:[189,183,107], 10394 darkmagenta:[139,0,139], 10395 darkolivegreen:[85,107,47], 10396 darkorange:[255,140,0], 10397 darkorchid:[153,50,204], 10398 darkred:[139,0,0], 10399 darksalmon:[233,150,122], 10400 darkviolet:[148,0,211], 10401 fuchsia:[255,0,255], 10402 gold:[255,215,0], 10403 green:[0,128,0], 10404 indigo:[75,0,130], 10405 khaki:[240,230,140], 10406 lightblue:[173,216,230], 10407 lightcyan:[224,255,255], 10408 lightgreen:[144,238,144], 10409 lightgrey:[211,211,211], 10410 lightpink:[255,182,193], 10411 lightyellow:[255,255,224], 10412 lime:[0,255,0], 10413 magenta:[255,0,255], 10414 maroon:[128,0,0], 10415 navy:[0,0,128], 10416 olive:[128,128,0], 10417 orange:[255,165,0], 10418 pink:[255,192,203], 10419 purple:[128,0,128], 10420 violet:[128,0,128], 10421 red:[255,0,0], 10422 silver:[192,192,192], 10423 white:[255,255,255], 10424 yellow:[255,255,0], 10425 transparent: [255,255,255] 10426}; 10427 10428 10429 10430/******************************************************************************/ 10431/****************************** CLASS ANIMATIONS ******************************/ 10432/******************************************************************************/ 10433 10434var classAnimationActions = ['add', 'remove', 'toggle'], 10435 shorthandStyles = { 10436 border: 1, 10437 borderBottom: 1, 10438 borderColor: 1, 10439 borderLeft: 1, 10440 borderRight: 1, 10441 borderTop: 1, 10442 borderWidth: 1, 10443 margin: 1, 10444 padding: 1 10445 }; 10446 10447function getElementStyles() { 10448 var style = document.defaultView 10449 ? document.defaultView.getComputedStyle(this, null) 10450 : this.currentStyle, 10451 newStyle = {}, 10452 key, 10453 camelCase; 10454 10455 // webkit enumerates style porperties 10456 if (style && style.length && style[0] && style[style[0]]) { 10457 var len = style.length; 10458 while (len--) { 10459 key = style[len]; 10460 if (typeof style[key] == 'string') { 10461 camelCase = key.replace(/\-(\w)/g, function(all, letter){ 10462 return letter.toUpperCase(); 10463 }); 10464 newStyle[camelCase] = style[key]; 10465 } 10466 } 10467 } else { 10468 for (key in style) { 10469 if (typeof style[key] === 'string') { 10470 newStyle[key] = style[key]; 10471 } 10472 } 10473 } 10474 10475 return newStyle; 10476} 10477 10478function filterStyles(styles) { 10479 var name, value; 10480 for (name in styles) { 10481 value = styles[name]; 10482 if ( 10483 // ignore null and undefined values 10484 value == null || 10485 // ignore functions (when does this occur?) 10486 $.isFunction(value) || 10487 // shorthand styles that need to be expanded 10488 name in shorthandStyles || 10489 // ignore scrollbars (break in IE) 10490 (/scrollbar/).test(name) || 10491 10492 // only colors or values that can be converted to numbers 10493 (!(/color/i).test(name) && isNaN(parseFloat(value))) 10494 ) { 10495 delete styles[name]; 10496 } 10497 } 10498 10499 return styles; 10500} 10501 10502function styleDifference(oldStyle, newStyle) { 10503 var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459 10504 name; 10505 10506 for (name in newStyle) { 10507 if (oldStyle[name] != newStyle[name]) { 10508 diff[name] = newStyle[name]; 10509 } 10510 } 10511 10512 return diff; 10513} 10514 10515$.effects.animateClass = function(value, duration, easing, callback) { 10516 if ($.isFunction(easing)) { 10517 callback = easing; 10518 easing = null; 10519 } 10520 10521 return this.queue(function() { 10522 var that = $(this), 10523 originalStyleAttr = that.attr('style') || ' ', 10524 originalStyle = filterStyles(getElementStyles.call(this)), 10525 newStyle, 10526 className = that.attr('class') || ""; 10527 10528 $.each(classAnimationActions, function(i, action) { 10529 if (value[action]) { 10530 that[action + 'Class'](value[action]); 10531 } 10532 }); 10533 newStyle = filterStyles(getElementStyles.call(this)); 10534 that.attr('class', className); 10535 10536 that.animate(styleDifference(originalStyle, newStyle), { 10537 queue: false, 10538 duration: duration, 10539 easing: easing, 10540 complete: function() { 10541 $.each(classAnimationActions, function(i, action) { 10542 if (value[action]) { that[action + 'Class'](value[action]); } 10543 }); 10544 // work around bug in IE by clearing the cssText before setting it 10545 if (typeof that.attr('style') == 'object') { 10546 that.attr('style').cssText = ''; 10547 that.attr('style').cssText = originalStyleAttr; 10548 } else { 10549 that.attr('style', originalStyleAttr); 10550 } 10551 if (callback) { callback.apply(this, arguments); } 10552 $.dequeue( this ); 10553 } 10554 }); 10555 }); 10556}; 10557 10558$.fn.extend({ 10559 _addClass: $.fn.addClass, 10560 addClass: function(classNames, speed, easing, callback) { 10561 return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); 10562 }, 10563 10564 _removeClass: $.fn.removeClass, 10565 removeClass: function(classNames,speed,easing,callback) { 10566 return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); 10567 }, 10568 10569 _toggleClass: $.fn.toggleClass, 10570 toggleClass: function(classNames, force, speed, easing, callback) { 10571 if ( typeof force == "boolean" || force === undefined ) { 10572 if ( !speed ) { 10573 // without speed parameter; 10574 return this._toggleClass(classNames, force); 10575 } else { 10576 return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); 10577 } 10578 } else { 10579 // without switch parameter; 10580 return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); 10581 } 10582 }, 10583 10584 switchClass: function(remove,add,speed,easing,callback) { 10585 return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); 10586 } 10587}); 10588 10589 10590 10591/******************************************************************************/ 10592/*********************************** EFFECTS **********************************/ 10593/******************************************************************************/ 10594 10595$.extend($.effects, { 10596 version: "1.8.24", 10597 10598 // Saves a set of properties in a data storage 10599 save: function(element, set) { 10600 for(var i=0; i < set.length; i++) { 10601 if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); 10602 } 10603 }, 10604 10605 // Restores a set of previously saved properties from a data storage 10606 restore: function(element, set) { 10607 for(var i=0; i < set.length; i++) { 10608 if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); 10609 } 10610 }, 10611 10612 setMode: function(el, mode) { 10613 if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle 10614 return mode; 10615 }, 10616 10617 getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value 10618 // this should be a little more flexible in the future to handle a string & hash 10619 var y, x; 10620 switch (origin[0]) { 10621 case 'top': y = 0; break; 10622 case 'middle': y = 0.5; break; 10623 case 'bottom': y = 1; break; 10624 default: y = origin[0] / original.height; 10625 }; 10626 switch (origin[1]) { 10627 case 'left': x = 0; break; 10628 case 'center': x = 0.5; break; 10629 case 'right': x = 1; break; 10630 default: x = origin[1] / original.width; 10631 }; 10632 return {x: x, y: y}; 10633 }, 10634
10635 // Wraps the element around a wrapper that copies position properties 10636 createWrapper: function(element) { 10637 10638 // if the element is already wrapped, return it 10639 if (element.parent().is('.ui-effects-wrapper')) { 10640 return element.parent(); 10641 } 10642 10643 // wrap the element 10644 var props = { 10645 width: element.outerWidth(true), 10646 height: element.outerHeight(true), 10647 'float': element.css('float') 10648 }, 10649 wrapper = $('<div></div>') 10650 .addClass('ui-effects-wrapper') 10651 .css({ 10652 fontSize: '100%', 10653 background: 'transparent', 10654 border: 'none', 10655 margin: 0, 10656 padding: 0 10657 }), 10658 active = document.activeElement; 10659 10660 // support: Firefox 10661 // Firefox incorrectly exposes anonymous content 10662 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 10663 try { 10664 active.id; 10665 } catch( e ) { 10666 active = document.body; 10667 } 10668 10669 element.wrap( wrapper ); 10670 10671 // Fixes #7595 - Elements lose focus when wrapped. 10672 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 10673 $( active ).focus(); 10674 } 10675 10676 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element 10677 10678 // transfer positioning properties to the wrapper 10679 if (element.css('position') == 'static') { 10680 wrapper.css({ position: 'relative' }); 10681 element.css({ position: 'relative' }); 10682 } else { 10683 $.extend(props, { 10684 position: element.css('position'), 10685 zIndex: element.css('z-index') 10686 }); 10687 $.each(['top', 'left', 'bottom', 'right'], function(i, pos) { 10688 props[pos] = element.css(pos); 10689 if (isNaN(parseInt(props[pos], 10))) { 10690 props[pos] = 'auto'; 10691 } 10692 }); 10693 element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' }); 10694 } 10695 10696 return wrapper.css(props).show(); 10697 }, 10698 10699 removeWrapper: function(element) { 10700 var parent, 10701 active = document.activeElement; 10702 10703 if (element.parent().is('.ui-effects-wrapper')) { 10704 parent = element.parent().replaceWith(element); 10705 // Fixes #7595 - Elements lose focus when wrapped. 10706 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 10707 $( active ).focus(); 10708 } 10709 return parent; 10710 } 10711 10712 return element; 10713 }, 10714 10715 setTransition: function(element, list, factor, value) { 10716 value = value || {}; 10717 $.each(list, function(i, x){ 10718 var unit = element.cssUnit(x); 10719 if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; 10720 }); 10721 return value; 10722 } 10723}); 10724 10725 10726function _normalizeArguments(effect, options, speed, callback) { 10727 // shift params for method overloading 10728 if (typeof effect == 'object') { 10729 callback = options; 10730 speed = null; 10731 options = effect; 10732 effect = options.effect; 10733 } 10734 if ($.isFunction(options)) { 10735 callback = options; 10736 speed = null; 10737 options = {}; 10738 } 10739 if (typeof options == 'number' || $.fx.speeds[options]) { 10740 callback = speed; 10741 speed = options; 10742 options = {}; 10743 } 10744 if ($.isFunction(speed)) { 10745 callback = speed; 10746 speed = null; 10747 } 10748 10749 options = options || {}; 10750 10751 speed = speed || options.duration; 10752 speed = $.fx.off ? 0 : typeof speed == 'number' 10753 ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default; 10754 10755 callback = callback || options.complete; 10756 10757 return [effect, options, speed, callback]; 10758} 10759 10760function standardSpeed( speed ) { 10761 // valid standard speeds 10762 if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { 10763 return true; 10764 } 10765 10766 // invalid strings - treat as "normal" speed 10767 if ( typeof speed === "string" && !$.effects[ speed ] ) { 10768 return true; 10769 } 10770 10771 return false; 10772} 10773 10774$.fn.extend({ 10775 effect: function(effect, options, speed, callback) { 10776 var args = _normalizeArguments.apply(this, arguments), 10777 // TODO: make effects take actual parameters instead of a hash 10778 args2 = { 10779 options: args[1], 10780 duration: args[2], 10781 callback: args[3] 10782 }, 10783 mode = args2.options.mode, 10784 effectMethod = $.effects[effect]; 10785 10786 if ( $.fx.off || !effectMethod ) { 10787 // delegate to the original method (e.g., .show()) if possible 10788 if ( mode ) { 10789 return this[ mode ]( args2.duration, args2.callback ); 10790 } else { 10791 return this.each(function() { 10792 if ( args2.callback ) { 10793 args2.callback.call( this ); 10794 } 10795 }); 10796 } 10797 } 10798 10799 return effectMethod.call(this, args2); 10800 }, 10801 10802 _show: $.fn.show, 10803 show: function(speed) { 10804 if ( standardSpeed( speed ) ) { 10805 return this._show.apply(this, arguments); 10806 } else { 10807 var args = _normalizeArguments.apply(this, arguments); 10808 args[1].mode = 'show'; 10809 return this.effect.apply(this, args); 10810 } 10811 }, 10812 10813 _hide: $.fn.hide, 10814 hide: function(speed) { 10815 if ( standardSpeed( speed ) ) { 10816 return this._hide.apply(this, arguments); 10817 } else { 10818 var args = _normalizeArguments.apply(this, arguments); 10819 args[1].mode = 'hide'; 10820 return this.effect.apply(this, args); 10821 } 10822 }, 10823 10824 // jQuery core overloads toggle and creates _toggle 10825 __toggle: $.fn.toggle, 10826 toggle: function(speed) { 10827 if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { 10828 return this.__toggle.apply(this, arguments); 10829 } else { 10830 var args = _normalizeArguments.apply(this, arguments); 10831 args[1].mode = 'toggle'; 10832 return this.effect.apply(this, args); 10833 } 10834 }, 10835 10836 // helper functions 10837 cssUnit: function(key) { 10838 var style = this.css(key), val = []; 10839 $.each( ['em','px','%','pt'], function(i, unit){ 10840 if(style.indexOf(unit) > 0) 10841 val = [parseFloat(style), unit]; 10842 }); 10843 return val; 10844 } 10845}); 10846 10847 10848 10849/******************************************************************************/ 10850/*********************************** EASING ***********************************/ 10851/******************************************************************************/ 10852 10853// based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 10854 10855var baseEasings = {}; 10856 10857$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 10858 baseEasings[ name ] = function( p ) { 10859 return Math.pow( p, i + 2 ); 10860 }; 10861}); 10862 10863$.extend( baseEasings, { 10864 Sine: function ( p ) { 10865 return 1 - Math.cos( p * Math.PI / 2 ); 10866 }, 10867 Circ: function ( p ) { 10868 return 1 - Math.sqrt( 1 - p * p ); 10869 }, 10870 Elastic: function( p ) { 10871 return p === 0 || p === 1 ? p : 10872 -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); 10873 }, 10874 Back: function( p ) { 10875 return p * p * ( 3 * p - 2 ); 10876 }, 10877 Bounce: function ( p ) { 10878 var pow2, 10879 bounce = 4; 10880 10881 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 10882 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 10883 } 10884}); 10885 10886$.each( baseEasings, function( name, easeIn ) {
10887 $.easing[ "easeIn" + name ] = easeIn; 10888 $.easing[ "easeOut" + name ] = function( p ) { 10889 return 1 - easeIn( 1 - p ); 10890 }; 10891 $.easing[ "easeInOut" + name ] = function( p ) { 10892 return p < .5 ? 10893 easeIn( p * 2 ) / 2 : 10894 easeIn( p * -2 + 2 ) / -2 + 1; 10895 }; 10896}); 10897 10898})(jQuery); 10899/*! 10900 * jQuery UI Effects Blind 1.8.24 10901 * 10902 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 10903 * Dual licensed under the MIT or GPL Version 2 licenses. 10904 * http://jquery.org/license 10905 * 10906 * http://docs.jquery.com/UI/Effects/Blind 10907 * 10908 * Depends: 10909 * jquery.effects.core.js 10910 */ 10911(function( $, undefined ) { 10912 10913$.effects.blind = function(o) { 10914 10915 return this.queue(function() { 10916 10917 // Create element 10918 var el = $(this), props = ['position','top','bottom','left','right']; 10919 10920 // Set options 10921 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 10922 var direction = o.options.direction || 'vertical'; // Default direction 10923 10924 // Adjust 10925 $.effects.save(el, props); el.show(); // Save & Show 10926 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 10927 var ref = (direction == 'vertical') ? 'height' : 'width'; 10928 var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); 10929 if(mode == 'show') wrapper.css(ref, 0); // Shift 10930 10931 // Animation 10932 var animation = {}; 10933 animation[ref] = mode == 'show' ? distance : 0; 10934 10935 // Animate 10936 wrapper.animate(animation, o.duration, o.options.easing, function() { 10937 if(mode == 'hide') el.hide(); // Hide 10938 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 10939 if(o.callback) o.callback.apply(el[0], arguments); // Callback 10940 el.dequeue(); 10941 }); 10942 10943 }); 10944 10945}; 10946 10947})(jQuery); 10948/*! 10949 * jQuery UI Effects Bounce 1.8.24 10950 * 10951 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 10952 * Dual licensed under the MIT or GPL Version 2 licenses. 10953 * http://jquery.org/license 10954 * 10955 * http://docs.jquery.com/UI/Effects/Bounce 10956 * 10957 * Depends: 10958 * jquery.effects.core.js 10959 */ 10960(function( $, undefined ) { 10961 10962$.effects.bounce = function(o) { 10963 10964 return this.queue(function() { 10965 10966 // Create element 10967 var el = $(this), props = ['position','top','bottom','left','right']; 10968 10969 // Set options 10970 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 10971 var direction = o.options.direction || 'up'; // Default direction 10972 var distance = o.options.distance || 20; // Default distance 10973 var times = o.options.times || 5; // Default # of times 10974 var speed = o.duration || 250; // Default speed per bounce 10975 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE 10976 10977 // Adjust 10978 $.effects.save(el, props); el.show(); // Save & Show 10979 $.effects.createWrapper(el); // Create Wrapper 10980 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 10981 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 10982 var distance = o.options.distance || (ref == 'top' ? el.outerHeight(true) / 3 : el.outerWidth(true) / 3); 10983 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 10984 if (mode == 'hide') distance = distance / (times * 2); 10985 if (mode != 'hide') times--; 10986 10987 // Animate 10988 if (mode == 'show') { // Show Bounce 10989 var animation = {opacity: 1}; 10990 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 10991 el.animate(animation, speed / 2, o.options.easing); 10992 distance = distance / 2; 10993 times--; 10994 }; 10995 for (var i = 0; i < times; i++) { // Bounces 10996 var animation1 = {}, animation2 = {}; 10997 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 10998 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 10999 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); 11000 distance = (mode == 'hide') ? distance * 2 : distance / 2; 11001 }; 11002 if (mode == 'hide') { // Last Bounce 11003 var animation = {opacity: 0}; 11004 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 11005 el.animate(animation, speed / 2, o.options.easing, function(){ 11006 el.hide(); // Hide 11007 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11008 if(o.callback) o.callback.apply(this, arguments); // Callback 11009 }); 11010 } else { 11011 var animation1 = {}, animation2 = {}; 11012 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 11013 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 11014 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ 11015 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11016 if(o.callback) o.callback.apply(this, arguments); // Callback 11017 }); 11018 }; 11019 el.queue('fx', function() { el.dequeue(); }); 11020 el.dequeue(); 11021 }); 11022 11023}; 11024 11025})(jQuery); 11026/*! 11027 * jQuery UI Effects Clip 1.8.24 11028 * 11029 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11030 * Dual licensed under the MIT or GPL Version 2 licenses. 11031 * http://jquery.org/license 11032 * 11033 * http://docs.jquery.com/UI/Effects/Clip 11034 * 11035 * Depends:
11036 * jquery.effects.core.js 11037 */ 11038(function( $, undefined ) { 11039 11040$.effects.clip = function(o) { 11041 11042 return this.queue(function() { 11043 11044 // Create element 11045 var el = $(this), props = ['position','top','bottom','left','right','height','width']; 11046 11047 // Set options 11048 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 11049 var direction = o.options.direction || 'vertical'; // Default direction 11050 11051 // Adjust 11052 $.effects.save(el, props); el.show(); // Save & Show 11053 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 11054 var animate = el[0].tagName == 'IMG' ? wrapper : el; 11055 var ref = { 11056 size: (direction == 'vertical') ? 'height' : 'width', 11057 position: (direction == 'vertical') ? 'top' : 'left' 11058 }; 11059 var distance = (direction == 'vertical') ? animate.height() : animate.width(); 11060 if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift 11061 11062 // Animation 11063 var animation = {}; 11064 animation[ref.size] = mode == 'show' ? distance : 0; 11065 animation[ref.position] = mode == 'show' ? 0 : distance / 2; 11066 11067 // Animate 11068 animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 11069 if(mode == 'hide') el.hide(); // Hide 11070 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11071 if(o.callback) o.callback.apply(el[0], arguments); // Callback 11072 el.dequeue(); 11073 }}); 11074 11075 }); 11076 11077}; 11078 11079})(jQuery); 11080/*! 11081 * jQuery UI Effects Drop 1.8.24 11082 * 11083 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11084 * Dual licensed under the MIT or GPL Version 2 licenses. 11085 * http://jquery.org/license 11086 * 11087 * http://docs.jquery.com/UI/Effects/Drop 11088 * 11089 * Depends: 11090 * jquery.effects.core.js 11091 */ 11092(function( $, undefined ) { 11093 11094$.effects.drop = function(o) { 11095 11096 return this.queue(function() { 11097 11098 // Create element 11099 var el = $(this), props = ['position','top','bottom','left','right','opacity']; 11100 11101 // Set options 11102 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 11103 var direction = o.options.direction || 'left'; // Default Direction 11104 11105 // Adjust 11106 $.effects.save(el, props); el.show(); // Save & Show 11107 $.effects.createWrapper(el); // Create Wrapper 11108 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 11109 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 11110 var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) / 2 : el.outerWidth( true ) / 2); 11111 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 11112 11113 // Animation 11114 var animation = {opacity: mode == 'show' ? 1 : 0}; 11115 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; 11116 11117 // Animate 11118 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 11119 if(mode == 'hide') el.hide(); // Hide 11120 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11121 if(o.callback) o.callback.apply(this, arguments); // Callback 11122 el.dequeue(); 11123 }}); 11124 11125 }); 11126 11127}; 11128 11129})(jQuery); 11130/*! 11131 * jQuery UI Effects Explode 1.8.24 11132 * 11133 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11134 * Dual licensed under the MIT or GPL Version 2 licenses. 11135 * http://jquery.org/license 11136 * 11137 * http://docs.jquery.com/UI/Effects/Explode 11138 * 11139 * Depends: 11140 * jquery.effects.core.js 11141 */ 11142(function( $, undefined ) { 11143 11144$.effects.explode = function(o) { 11145 11146 return this.queue(function() { 11147 11148 var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; 11149 var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; 11150 11151 o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; 11152 var el = $(this).show().css('visibility', 'hidden'); 11153 var offset = el.offset(); 11154 11155 //Substract the margins - not fixing the problem yet. 11156 offset.top -= parseInt(el.css("marginTop"),10) || 0; 11157 offset.left -= parseInt(el.css("marginLeft"),10) || 0; 11158 11159 var width = el.outerWidth(true); 11160 var height = el.outerHeight(true); 11161 11162 for(var i=0;i<rows;i++) { // = 11163 for(var j=0;j<cells;j++) { // || 11164 el 11165 .clone() 11166 .appendTo('body') 11167 .wrap('<div></div>') 11168 .css({ 11169 position: 'absolute', 11170 visibility: 'visible', 11171 left: -j*(width/cells), 11172 top: -i*(height/rows) 11173 }) 11174 .parent() 11175 .addClass('ui-effects-explode') 11176 .css({ 11177 position: 'absolute', 11178 overflow: 'hidden', 11179 width: width/cells, 11180 height: height/rows, 11181 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), 11182 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), 11183 opacity: o.options.mode == 'show' ? 0 : 1 11184 }).animate({ 11185 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), 11186 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), 11187 opacity: o.options.mode == 'show' ? 1 : 0 11188 }, o.duration || 500); 11189 } 11190 } 11191 11192 // Set a timeout, to call the callback approx. when the other animations have finished 11193 setTimeout(function() { 11194 11195 o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); 11196 if(o.callback) o.callback.apply(el[0]); // Callback 11197 el.dequeue(); 11198 11199 $('div.ui-effects-explode').remove(); 11200 11201 }, o.duration || 500); 11202 11203 11204 }); 11205 11206}; 11207 11208})(jQuery); 11209/*! 11210 * jQuery UI Effects Fade 1.8.24 11211 * 11212 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11213 * Dual licensed under the MIT or GPL Version 2 licenses. 11214 * http://jquery.org/license 11215 * 11216 * http://docs.jquery.com/UI/Effects/Fade 11217 * 11218 * Depends:
11219 * jquery.effects.core.js 11220 */ 11221(function( $, undefined ) { 11222 11223$.effects.fade = function(o) { 11224 return this.queue(function() { 11225 var elem = $(this), 11226 mode = $.effects.setMode(elem, o.options.mode || 'hide'); 11227 11228 elem.animate({ opacity: mode }, { 11229 queue: false, 11230 duration: o.duration, 11231 easing: o.options.easing, 11232 complete: function() { 11233 (o.callback && o.callback.apply(this, arguments)); 11234 elem.dequeue(); 11235 } 11236 }); 11237 }); 11238}; 11239 11240})(jQuery); 11241/*! 11242 * jQuery UI Effects Fold 1.8.24 11243 * 11244 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11245 * Dual licensed under the MIT or GPL Version 2 licenses. 11246 * http://jquery.org/license 11247 * 11248 * http://docs.jquery.com/UI/Effects/Fold 11249 * 11250 * Depends: 11251 * jquery.effects.core.js 11252 */ 11253(function( $, undefined ) { 11254 11255$.effects.fold = function(o) { 11256 11257 return this.queue(function() { 11258 11259 // Create element 11260 var el = $(this), props = ['position','top','bottom','left','right']; 11261 11262 // Set options 11263 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 11264 var size = o.options.size || 15; // Default fold size 11265 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value 11266 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; 11267 11268 // Adjust 11269 $.effects.save(el, props); el.show(); // Save & Show 11270 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 11271 var widthFirst = ((mode == 'show') != horizFirst); 11272 var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; 11273 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; 11274 var percent = /([0-9]+)%/.exec(size); 11275 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; 11276 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift 11277 11278 // Animation 11279 var animation1 = {}, animation2 = {}; 11280 animation1[ref[0]] = mode == 'show' ? distance[0] : size; 11281 animation2[ref[1]] = mode == 'show' ? distance[1] : 0; 11282 11283 // Animate 11284 wrapper.animate(animation1, duration, o.options.easing) 11285 .animate(animation2, duration, o.options.easing, function() { 11286 if(mode == 'hide') el.hide(); // Hide 11287 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11288 if(o.callback) o.callback.apply(el[0], arguments); // Callback 11289 el.dequeue(); 11290 }); 11291 11292 }); 11293 11294}; 11295 11296})(jQuery); 11297/*! 11298 * jQuery UI Effects Highlight 1.8.24 11299 * 11300 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11301 * Dual licensed under the MIT or GPL Version 2 licenses. 11302 * http://jquery.org/license 11303 * 11304 * http://docs.jquery.com/UI/Effects/Highlight 11305 * 11306 * Depends: 11307 * jquery.effects.core.js 11308 */ 11309(function( $, undefined ) { 11310 11311$.effects.highlight = function(o) { 11312 return this.queue(function() { 11313 var elem = $(this), 11314 props = ['backgroundImage', 'backgroundColor', 'opacity'], 11315 mode = $.effects.setMode(elem, o.options.mode || 'show'), 11316 animation = { 11317 backgroundColor: elem.css('backgroundColor') 11318 }; 11319 11320 if (mode == 'hide') { 11321 animation.opacity = 0; 11322 } 11323 11324 $.effects.save(elem, props); 11325 elem 11326 .show() 11327 .css({ 11328 backgroundImage: 'none', 11329 backgroundColor: o.options.color || '#ffff99' 11330 }) 11331 .animate(animation, { 11332 queue: false, 11333 duration: o.duration, 11334 easing: o.options.easing, 11335 complete: function() { 11336 (mode == 'hide' && elem.hide()); 11337 $.effects.restore(elem, props); 11338 (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter')); 11339 (o.callback && o.callback.apply(this, arguments)); 11340 elem.dequeue(); 11341 } 11342 }); 11343 }); 11344}; 11345 11346})(jQuery); 11347/*! 11348 * jQuery UI Effects Pulsate 1.8.24 11349 * 11350 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11351 * Dual licensed under the MIT or GPL Version 2 licenses. 11352 * http://jquery.org/license 11353 * 11354 * http://docs.jquery.com/UI/Effects/Pulsate 11355 * 11356 * Depends: 11357 * jquery.effects.core.js 11358 */ 11359(function( $, undefined ) { 11360 11361$.effects.pulsate = function(o) { 11362 return this.queue(function() { 11363 var elem = $(this), 11364 mode = $.effects.setMode(elem, o.options.mode || 'show'), 11365 times = ((o.options.times || 5) * 2) - 1, 11366 duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2, 11367 isVisible = elem.is(':visible'), 11368 animateTo = 0; 11369 11370 if (!isVisible) { 11371 elem.css('opacity', 0).show(); 11372 animateTo = 1; 11373 } 11374 11375 if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { 11376 times--; 11377 } 11378 11379 for (var i = 0; i < times; i++) { 11380 elem.animate({ opacity: animateTo }, duration, o.options.easing); 11381 animateTo = (animateTo + 1) % 2; 11382 } 11383 11384 elem.animate({ opacity: animateTo }, duration, o.options.easing, function() { 11385 if (animateTo == 0) { 11386 elem.hide(); 11387 } 11388 (o.callback && o.callback.apply(this, arguments)); 11389 }); 11390 11391 elem 11392 .queue('fx', function() { elem.dequeue(); }) 11393 .dequeue(); 11394 }); 11395}; 11396 11397})(jQuery); 11398/*! 11399 * jQuery UI Effects Scale 1.8.24 11400 * 11401 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11402 * Dual licensed under the MIT or GPL Version 2 licenses. 11403 * http://jquery.org/license 11404 * 11405 * http://docs.jquery.com/UI/Effects/Scale 11406 * 11407 * Depends:
11408 * jquery.effects.core.js 11409 */ 11410(function( $, undefined ) { 11411 11412$.effects.puff = function(o) { 11413 return this.queue(function() { 11414 var elem = $(this), 11415 mode = $.effects.setMode(elem, o.options.mode || 'hide'), 11416 percent = parseInt(o.options.percent, 10) || 150, 11417 factor = percent / 100, 11418 original = { height: elem.height(), width: elem.width() }; 11419 11420 $.extend(o.options, { 11421 fade: true, 11422 mode: mode, 11423 percent: mode == 'hide' ? percent : 100, 11424 from: mode == 'hide' 11425 ? original 11426 : { 11427 height: original.height * factor, 11428 width: original.width * factor 11429 } 11430 }); 11431 11432 elem.effect('scale', o.options, o.duration, o.callback); 11433 elem.dequeue(); 11434 }); 11435}; 11436 11437$.effects.scale = function(o) { 11438 11439 return this.queue(function() { 11440 11441 // Create element 11442 var el = $(this); 11443 11444 // Set options 11445 var options = $.extend(true, {}, o.options); 11446 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 11447 var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent 11448 var direction = o.options.direction || 'both'; // Set default axis 11449 var origin = o.options.origin; // The origin of the scaling 11450 if (mode != 'effect') { // Set default origin and restore for show/hide 11451 options.origin = origin || ['middle','center']; 11452 options.restore = true; 11453 } 11454 var original = {height: el.height(), width: el.width()}; // Save original 11455 el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state 11456 11457 // Adjust 11458 var factor = { // Set scaling factor 11459 y: direction != 'horizontal' ? (percent / 100) : 1, 11460 x: direction != 'vertical' ? (percent / 100) : 1 11461 }; 11462 el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state 11463 11464 if (o.options.fade) { // Fade option to support puff 11465 if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; 11466 if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; 11467 }; 11468 11469 // Animation 11470 options.from = el.from; options.to = el.to; options.mode = mode; 11471 11472 // Animate 11473 el.effect('size', options, o.duration, o.callback); 11474 el.dequeue(); 11475 }); 11476 11477}; 11478 11479$.effects.size = function(o) { 11480 11481 return this.queue(function() { 11482 11483 // Create element 11484 var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity']; 11485 var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore 11486 var props2 = ['width','height','overflow']; // Copy for children 11487 var cProps = ['fontSize']; 11488 var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; 11489 var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; 11490 11491 // Set options 11492 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 11493 var restore = o.options.restore || false; // Default restore 11494 var scale = o.options.scale || 'both'; // Default scale mode 11495 var origin = o.options.origin; // The origin of the sizing 11496 var original = {height: el.height(), width: el.width()}; // Save original 11497 el.from = o.options.from || original; // Default from state 11498 el.to = o.options.to || original; // Default to state 11499 // Adjust 11500 if (origin) { // Calculate baseline shifts 11501 var baseline = $.effects.getBaseline(origin, original); 11502 el.from.top = (original.height - el.from.height) * baseline.y; 11503 el.from.left = (original.width - el.from.width) * baseline.x; 11504 el.to.top = (original.height - el.to.height) * baseline.y; 11505 el.to.left = (original.width - el.to.width) * baseline.x; 11506 }; 11507 var factor = { // Set scaling factor 11508 from: {y: el.from.height / original.height, x: el.from.width / original.width}, 11509 to: {y: el.to.height / original.height, x: el.to.width / original.width} 11510 }; 11511 if (scale == 'box' || scale == 'both') { // Scale the css box 11512 if (factor.from.y != factor.to.y) { // Vertical props scaling 11513 props = props.concat(vProps); 11514 el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); 11515 el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); 11516 }; 11517 if (factor.from.x != factor.to.x) { // Horizontal props scaling 11518 props = props.concat(hProps); 11519 el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); 11520 el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); 11521 }; 11522 }; 11523 if (scale == 'content' || scale == 'both') { // Scale the content 11524 if (factor.from.y != factor.to.y) { // Vertical props scaling 11525 props = props.concat(cProps); 11526 el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); 11527 el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); 11528 }; 11529 }; 11530 $.effects.save(el, restore ? props : props1); el.show(); // Save & Show 11531 $.effects.createWrapper(el); // Create Wrapper 11532 el.css('overflow','hidden').css(el.from); // Shift 11533 11534 // Animate 11535 if (scale == 'content' || scale == 'both') { // Scale the children 11536 vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size 11537 hProps = hProps.concat(['marginLeft','marginRight']); // Add margins 11538 props2 = props.concat(vProps).concat(hProps); // Concat 11539 el.find("*[width]").each(function(){ 11540 var child = $(this); 11541 if (restore) $.effects.save(child, props2); 11542 var c_original = {height: child.height(), width: child.width()}; // Save original 11543 child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; 11544 child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; 11545 if (factor.from.y != factor.to.y) { // Vertical props scaling 11546 child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); 11547 child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); 11548 }; 11549 if (factor.from.x != factor.to.x) { // Horizontal props scaling 11550 child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); 11551 child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); 11552 }; 11553 child.css(child.from); // Shift children
11554 child.animate(child.to, o.duration, o.options.easing, function(){ 11555 if (restore) $.effects.restore(child, props2); // Restore children 11556 }); // Animate children 11557 }); 11558 }; 11559 11560 // Animate 11561 el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 11562 if (el.to.opacity === 0) { 11563 el.css('opacity', el.from.opacity); 11564 } 11565 if(mode == 'hide') el.hide(); // Hide 11566 $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore 11567 if(o.callback) o.callback.apply(this, arguments); // Callback 11568 el.dequeue(); 11569 }}); 11570 11571 }); 11572 11573}; 11574 11575})(jQuery); 11576/*! 11577 * jQuery UI Effects Shake 1.8.24 11578 * 11579 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11580 * Dual licensed under the MIT or GPL Version 2 licenses. 11581 * http://jquery.org/license 11582 * 11583 * http://docs.jquery.com/UI/Effects/Shake 11584 * 11585 * Depends: 11586 * jquery.effects.core.js 11587 */ 11588(function( $, undefined ) { 11589 11590$.effects.shake = function(o) { 11591 11592 return this.queue(function() { 11593 11594 // Create element 11595 var el = $(this), props = ['position','top','bottom','left','right']; 11596 11597 // Set options 11598 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 11599 var direction = o.options.direction || 'left'; // Default direction 11600 var distance = o.options.distance || 20; // Default distance 11601 var times = o.options.times || 3; // Default # of times 11602 var speed = o.duration || o.options.duration || 140; // Default speed per shake 11603 11604 // Adjust 11605 $.effects.save(el, props); el.show(); // Save & Show 11606 $.effects.createWrapper(el); // Create Wrapper 11607 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 11608 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 11609 11610 // Animation 11611 var animation = {}, animation1 = {}, animation2 = {}; 11612 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 11613 animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; 11614 animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; 11615 11616 // Animate 11617 el.animate(animation, speed, o.options.easing); 11618 for (var i = 1; i < times; i++) { // Shakes 11619 el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); 11620 }; 11621 el.animate(animation1, speed, o.options.easing). 11622 animate(animation, speed / 2, o.options.easing, function(){ // Last shake 11623 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11624 if(o.callback) o.callback.apply(this, arguments); // Callback 11625 }); 11626 el.queue('fx', function() { el.dequeue(); }); 11627 el.dequeue(); 11628 }); 11629 11630}; 11631 11632})(jQuery); 11633/*! 11634 * jQuery UI Effects Slide 1.8.24 11635 * 11636 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11637 * Dual licensed under the MIT or GPL Version 2 licenses. 11638 * http://jquery.org/license 11639 * 11640 * http://docs.jquery.com/UI/Effects/Slide 11641 * 11642 * Depends: 11643 * jquery.effects.core.js 11644 */ 11645(function( $, undefined ) { 11646 11647$.effects.slide = function(o) { 11648 11649 return this.queue(function() { 11650 11651 // Create element 11652 var el = $(this), props = ['position','top','bottom','left','right']; 11653 11654 // Set options 11655 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode 11656 var direction = o.options.direction || 'left'; // Default Direction 11657 11658 // Adjust 11659 $.effects.save(el, props); el.show(); // Save & Show 11660 $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 11661 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 11662 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 11663 var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) : el.outerWidth( true )); 11664 if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift 11665 11666 // Animation 11667 var animation = {}; 11668 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; 11669 11670 // Animate 11671 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 11672 if(mode == 'hide') el.hide(); // Hide 11673 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 11674 if(o.callback) o.callback.apply(this, arguments); // Callback 11675 el.dequeue(); 11676 }}); 11677 11678 }); 11679 11680}; 11681 11682})(jQuery); 11683/*! 11684 * jQuery UI Effects Transfer 1.8.24 11685 * 11686 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 11687 * Dual licensed under the MIT or GPL Version 2 licenses. 11688 * http://jquery.org/license 11689 * 11690 * http://docs.jquery.com/UI/Effects/Transfer 11691 * 11692 * Depends:
11693 * jquery.effects.core.js 11694 */ 11695(function( $, undefined ) { 11696 11697$.effects.transfer = function(o) { 11698 return this.queue(function() { 11699 var elem = $(this), 11700 target = $(o.options.to), 11701 endPosition = target.offset(), 11702 animation = { 11703 top: endPosition.top, 11704 left: endPosition.left, 11705 height: target.innerHeight(), 11706 width: target.innerWidth() 11707 }, 11708 startPosition = elem.offset(), 11709 transfer = $('<div class="ui-effects-transfer"></div>') 11710 .appendTo(document.body) 11711 .addClass(o.options.className) 11712 .css({ 11713 top: startPosition.top, 11714 left: startPosition.left, 11715 height: elem.innerHeight(), 11716 width: elem.innerWidth(), 11717 position: 'absolute' 11718 }) 11719 .animate(animation, o.duration, o.options.easing, function() { 11720 transfer.remove(); 11721 (o.callback && o.callback.apply(elem[0], arguments)); 11722 elem.dequeue(); 11723 }); 11724 }); 11725}; 11726 11727})(jQuery);
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.