1/*! 2 * jQuery JavaScript Library v1.7.1 3 * http://jquery.com/ 4 * 5 * Copyright 2011, John Resig 6 * Dual licensed under the MIT or GPL Version 2 licenses. 7 * http://jquery.org/license 8 * 9 * Includes Sizzle.js 10 * http://sizzlejs.com/ 11 * Copyright 2011, The Dojo Foundation 12 * Released under the MIT, BSD, and GPL Licenses. 13 * 14 * Date: Mon Nov 21 21:11:03 2011 -0500 15 */ 16(function( window, undefined ) { 17 18// Use the correct document accordingly with window argument (sandbox) 19var document = window.document, 20 navigator = window.navigator, 21 location = window.location; 22var jQuery = (function() { 23 24// Define a local copy of jQuery 25var jQuery = function( selector, context ) { 26 // The jQuery object is actually just the init constructor 'enhanced' 27 return new jQuery.fn.init( selector, context, rootjQuery ); 28 }, 29 30 // Map over jQuery in case of overwrite 31 _jQuery = window.jQuery, 32 33 // Map over the $ in case of overwrite 34 _$ = window.$, 35 36 // A central reference to the root jQuery(document) 37 rootjQuery, 38 39 // A simple way to check for HTML strings or ID strings 40 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 41 quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 42 43 // Check if a string has a non-whitespace character in it 44 rnotwhite = /\S/, 45 46 // Used for trimming whitespace 47 trimLeft = /^\s+/, 48 trimRight = /\s+$/, 49 50 // Match a standalone tag 51 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 52 53 // JSON RegExp 54 rvalidchars = /^[\],:{}\s]*$/, 55 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 56 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 57 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 58 59 // Useragent RegExp 60 rwebkit = /(webkit)[ \/]([\w.]+)/, 61 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 62 rmsie = /(msie) ([\w.]+)/, 63 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 64 65 // Matches dashed string for camelizing 66 rdashAlpha = /-([a-z]|[0-9])/ig, 67 rmsPrefix = /^-ms-/, 68 69 // Used by jQuery.camelCase as callback to replace() 70 fcamelCase = function( all, letter ) { 71 return ( letter + "" ).toUpperCase(); 72 }, 73 74 // Keep a UserAgent string for use with jQuery.browser 75 userAgent = navigator.userAgent, 76 77 // For matching the engine and version of the browser 78 browserMatch, 79 80 // The deferred used on DOM ready 81 readyList, 82 83 // The ready event handler 84 DOMContentLoaded, 85 86 // Save a reference to some core methods 87 toString = Object.prototype.toString, 88 hasOwn = Object.prototype.hasOwnProperty, 89 push = Array.prototype.push, 90 slice = Array.prototype.slice, 91 trim = String.prototype.trim, 92 indexOf = Array.prototype.indexOf, 93 94 // [[Class]] -> type pairs 95 class2type = {}; 96 97jQuery.fn = jQuery.prototype = { 98 constructor: jQuery, 99 init: function( selector, context, rootjQuery ) { 100 var match, elem, ret, doc; 101 102 // Handle $(""), $(null), or $(undefined) 103 if ( !selector ) { 104 return this; 105 } 106 107 // Handle $(DOMElement) 108 if ( selector.nodeType ) { 109 this.context = this[0] = selector; 110 this.length = 1; 111 return this; 112 } 113 114 // The body element only exists once, optimize finding it 115 if ( selector === "body" && !context && document.body ) { 116 this.context = document; 117 this[0] = document.body; 118 this.selector = selector; 119 this.length = 1; 120 return this; 121 } 122 123 // Handle HTML strings 124 if ( typeof selector === "string" ) { 125 // Are we dealing with HTML string or an ID? 126 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { 127 // Assume that strings that start and end with <> are HTML and skip the regex check 128 match = [ null, selector, null ]; 129 130 } else { 131 match = quickExpr.exec( selector ); 132 } 133 134 // Verify a match, and that no context was specified for #id 135 if ( match && (match[1] || !context) ) { 136 137 // HANDLE: $(html) -> $(array) 138 if ( match[1] ) { 139 context = context instanceof jQuery ? context[0] : context; 140 doc = ( context ? context.ownerDocument || context : document ); 141 142 // If a single string is passed in and it's a single tag 143 // just do a createElement and skip the rest 144 ret = rsingleTag.exec( selector ); 145 146 if ( ret ) { 147 if ( jQuery.isPlainObject( context ) ) { 148 selector = [ document.createElement( ret[1] ) ]; 149 jQuery.fn.attr.call( selector, context, true ); 150 151 } else { 152 selector = [ doc.createElement( ret[1] ) ]; 153 } 154 155 } else { 156 ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); 157 selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; 158 } 159 160 return jQuery.merge( this, selector ); 161 162 // HANDLE: $("#id") 163 } else { 164 elem = document.getElementById( match[2] ); 165 166 // Check parentNode to catch when Blackberry 4.6 returns 167 // nodes that are no longer in the document #6963 168 if ( elem && elem.parentNode ) { 169 // Handle the case where IE and Opera return items 170 // by name instead of ID 171 if ( elem.id !== match[2] ) { 172 return rootjQuery.find( selector ); 173 } 174 175 // Otherwise, we inject the element directly into the jQuery object 176 this.length = 1; 177 this[0] = elem; 178 } 179 180 this.context = document; 181 this.selector = selector; 182 return this; 183 } 184 185 // HANDLE: $(expr, $(...)) 186 } else if ( !context || context.jquery ) { 187 return ( context || rootjQuery ).find( selector ); 188 189 // HANDLE: $(expr, context) 190 // (which is just equivalent to: $(context).find(expr) 191 } else { 192 return this.constructor( context ).find( selector ); 193 } 194 195 // HANDLE: $(function) 196 // Shortcut for document ready 197 } else if ( jQuery.isFunction( selector ) ) { 198 return rootjQuery.ready( selector ); 199 } 200 201 if ( selector.selector !== undefined ) { 202 this.selector = selector.selector; 203 this.context = selector.context; 204 } 205 206 return jQuery.makeArray( selector, this ); 207 }, 208 209 // Start with an empty selector 210 selector: "", 211 212 // The current version of jQuery being used 213 jquery: "1.7.1", 214 215 // The default length of a jQuery object is 0 216 length: 0, 217 218 // The number of elements contained in the matched element set 219 size: function() { 220 return this.length; 221 }, 222 223 toArray: function() { 224 return slice.call( this, 0 ); 225 }, 226 227 // Get the Nth element in the matched element set OR 228 // Get the whole matched element set as a clean array 229 get: function( num ) { 230 return num == null ? 231 232 // Return a 'clean' array 233 this.toArray() : 234 235 // Return just the object 236 ( num < 0 ? this[ this.length + num ] : this[ num ] ); 237 }, 238 239 // Take an array of elements and push it onto the stack 240 // (returning the new matched element set) 241 pushStack: function( elems, name, selector ) { 242 // Build a new jQuery matched element set 243 var ret = this.constructor(); 244 245 if ( jQuery.isArray( elems ) ) { 246 push.apply( ret, elems ); 247 248 } else { 249 jQuery.merge( ret, elems ); 250 } 251 252 // Add the old object onto the stack (as a reference)
vendor: 4,209 bytes, lines 253-433
253 ret.prevObject = this; 254 255 ret.context = this.context; 256 257 if ( name === "find" ) { 258 ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; 259 } else if ( name ) { 260 ret.selector = this.selector + "." + name + "(" + selector + ")"; 261 } 262 263 // Return the newly-formed element set 264 return ret; 265 }, 266 267 // Execute a callback for every element in the matched set. 268 // (You can seed the arguments with an array of args, but this is 269 // only used internally.) 270 each: function( callback, args ) { 271 return jQuery.each( this, callback, args ); 272 }, 273 274 ready: function( fn ) { 275 // Attach the listeners 276 jQuery.bindReady(); 277 278 // Add the callback 279 readyList.add( fn ); 280 281 return this; 282 }, 283 284 eq: function( i ) { 285 i = +i; 286 return i === -1 ? 287 this.slice( i ) : 288 this.slice( i, i + 1 ); 289 }, 290 291 first: function() { 292 return this.eq( 0 ); 293 }, 294 295 last: function() { 296 return this.eq( -1 ); 297 }, 298 299 slice: function() { 300 return this.pushStack( slice.apply( this, arguments ), 301 "slice", slice.call(arguments).join(",") ); 302 }, 303 304 map: function( callback ) { 305 return this.pushStack( jQuery.map(this, function( elem, i ) { 306 return callback.call( elem, i, elem ); 307 })); 308 }, 309 310 end: function() { 311 return this.prevObject || this.constructor(null); 312 }, 313 314 // For internal use only. 315 // Behaves like an Array's method, not like a jQuery method. 316 push: push, 317 sort: [].sort, 318 splice: [].splice 319}; 320 321// Give the init function the jQuery prototype for later instantiation 322jQuery.fn.init.prototype = jQuery.fn; 323 324jQuery.extend = jQuery.fn.extend = function() { 325 var options, name, src, copy, copyIsArray, clone, 326 target = arguments[0] || {}, 327 i = 1, 328 length = arguments.length, 329 deep = false; 330 331 // Handle a deep copy situation 332 if ( typeof target === "boolean" ) { 333 deep = target; 334 target = arguments[1] || {}; 335 // skip the boolean and the target 336 i = 2; 337 } 338 339 // Handle case when target is a string or something (possible in deep copy) 340 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 341 target = {}; 342 } 343 344 // extend jQuery itself if only one argument is passed 345 if ( length === i ) { 346 target = this; 347 --i; 348 } 349 350 for ( ; i < length; i++ ) { 351 // Only deal with non-null/undefined values 352 if ( (options = arguments[ i ]) != null ) { 353 // Extend the base object 354 for ( name in options ) { 355 src = target[ name ]; 356 copy = options[ name ]; 357 358 // Prevent never-ending loop 359 if ( target === copy ) { 360 continue; 361 } 362 363 // Recurse if we're merging plain objects or arrays 364 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 365 if ( copyIsArray ) { 366 copyIsArray = false; 367 clone = src && jQuery.isArray(src) ? src : []; 368 369 } else { 370 clone = src && jQuery.isPlainObject(src) ? src : {}; 371 } 372 373 // Never move original objects, clone them 374 target[ name ] = jQuery.extend( deep, clone, copy ); 375 376 // Don't bring in undefined values 377 } else if ( copy !== undefined ) { 378 target[ name ] = copy; 379 } 380 } 381 } 382 } 383 384 // Return the modified object 385 return target; 386}; 387 388jQuery.extend({ 389 noConflict: function( deep ) { 390 if ( window.$ === jQuery ) { 391 window.$ = _$; 392 } 393 394 if ( deep && window.jQuery === jQuery ) { 395 window.jQuery = _jQuery; 396 } 397 398 return jQuery; 399 }, 400 401 // Is the DOM ready to be used? Set to true once it occurs. 402 isReady: false, 403 404 // A counter to track how many items to wait for before 405 // the ready event fires. See #6781 406 readyWait: 1, 407 408 // Hold (or release) the ready event 409 holdReady: function( hold ) { 410 if ( hold ) { 411 jQuery.readyWait++; 412 } else { 413 jQuery.ready( true ); 414 } 415 }, 416 417 // Handle when the DOM is ready 418 ready: function( wait ) { 419 // Either a released hold or an DOMready/load event and not yet ready 420 if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { 421 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 422 if ( !document.body ) { 423 return setTimeout( jQuery.ready, 1 ); 424 } 425 426 // Remember that the DOM is ready 427 jQuery.isReady = true; 428 429 // If a normal DOM Ready event fired, decrement, and wait if need be 430 if ( wait !== true && --jQuery.readyWait > 0 ) { 431 return; 432 } 433
434 // If there are functions bound, to execute 435 readyList.fireWith( document, [ jQuery ] ); 436 437 // Trigger any bound ready events 438 if ( jQuery.fn.trigger ) { 439 jQuery( document ).trigger( "ready" ).off( "ready" ); 440 } 441 } 442 }, 443 444 bindReady: function() { 445 if ( readyList ) { 446 return; 447 } 448 449 readyList = jQuery.Callbacks( "once memory" ); 450 451 // Catch cases where $(document).ready() is called after the 452 // browser event has already occurred. 453 if ( document.readyState === "complete" ) { 454 // Handle it asynchronously to allow scripts the opportunity to delay ready 455 return setTimeout( jQuery.ready, 1 ); 456 } 457 458 // Mozilla, Opera and webkit nightlies currently support this event 459 if ( document.addEventListener ) { 460 // Use the handy event callback 461 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 462 463 // A fallback to window.onload, that will always work 464 window.addEventListener( "load", jQuery.ready, false ); 465 466 // If IE event model is used 467 } else if ( document.attachEvent ) { 468 // ensure firing before onload, 469 // maybe late but safe also for iframes 470 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 471 472 // A fallback to window.onload, that will always work 473 window.attachEvent( "onload", jQuery.ready ); 474 475 // If IE and not a frame 476 // continually check to see if the document is ready 477 var toplevel = false; 478 479 try { 480 toplevel = window.frameElement == null; 481 } catch(e) {} 482 483 if ( document.documentElement.doScroll && toplevel ) { 484 doScrollCheck(); 485 } 486 } 487 }, 488 489 // See test/unit/core.js for details concerning isFunction. 490 // Since version 1.3, DOM methods and functions like alert 491 // aren't supported. They return false on IE (#2968). 492 isFunction: function( obj ) { 493 return jQuery.type(obj) === "function"; 494 }, 495 496 isArray: Array.isArray || function( obj ) { 497 return jQuery.type(obj) === "array"; 498 }, 499 500 // A crude way of determining if an object is a window 501 isWindow: function( obj ) { 502 return obj && typeof obj === "object" && "setInterval" in obj; 503 }, 504 505 isNumeric: function( obj ) { 506 return !isNaN( parseFloat(obj) ) && isFinite( obj ); 507 }, 508 509 type: function( obj ) { 510 return obj == null ? 511 String( obj ) : 512 class2type[ toString.call(obj) ] || "object"; 513 }, 514 515 isPlainObject: function( obj ) { 516 // Must be an Object. 517 // Because of IE, we also have to check the presence of the constructor property. 518 // Make sure that DOM nodes and window objects don't pass through, as well 519 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 520 return false; 521 } 522 523 try { 524 // Not own constructor property must be Object 525 if ( obj.constructor && 526 !hasOwn.call(obj, "constructor") && 527 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 528 return false; 529 } 530 } catch ( e ) { 531 // IE8,9 Will throw exceptions on certain host objects #9897 532 return false; 533 } 534 535 // Own properties are enumerated firstly, so to speed up, 536 // if last one is own, then all properties are own. 537 538 var key; 539 for ( key in obj ) {} 540 541 return key === undefined || hasOwn.call( obj, key ); 542 }, 543 544 isEmptyObject: function( obj ) { 545 for ( var name in obj ) { 546 return false; 547 } 548 return true; 549 }, 550 551 error: function( msg ) { 552 throw new Error( msg ); 553 }, 554 555 parseJSON: function( data ) { 556 if ( typeof data !== "string" || !data ) { 557 return null; 558 } 559 560 // Make sure leading/trailing whitespace is removed (IE can't handle it) 561 data = jQuery.trim( data ); 562 563 // Attempt to parse using the native JSON parser first 564 if ( window.JSON && window.JSON.parse ) { 565 return window.JSON.parse( data ); 566 } 567 568 // Make sure the incoming data is actual JSON 569 // Logic borrowed from http://json.org/json2.js 570 if ( rvalidchars.test( data.replace( rvalidescape, "@" ) 571 .replace( rvalidtokens, "]" ) 572 .replace( rvalidbraces, "")) ) { 573 574 return ( new Function( "return " + data ) )(); 575 576 } 577 jQuery.error( "Invalid JSON: " + data ); 578 }, 579 580 // Cross-browser xml parsing 581 parseXML: function( data ) { 582 var xml, tmp; 583 try { 584 if ( window.DOMParser ) { // Standard 585 tmp = new DOMParser(); 586 xml = tmp.parseFromString( data , "text/xml" ); 587 } else { // IE 588 xml = new ActiveXObject( "Microsoft.XMLDOM" ); 589 xml.async = "false"; 590 xml.loadXML( data ); 591 } 592 } catch( e ) { 593 xml = undefined; 594 } 595 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 596 jQuery.error( "Invalid XML: " + data ); 597 } 598 return xml; 599 }, 600 601 noop: function() {}, 602 603 // Evaluates a script in a global context 604 // Workarounds based on findings by Jim Driscoll 605 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 606 globalEval: function( data ) { 607 if ( data && rnotwhite.test( data ) ) { 608 // We use execScript on Internet Explorer 609 // We use an anonymous function so that context is window 610 // rather than jQuery in Firefox 611 ( window.execScript || function( data ) { 612 window[ "eval" ].call( window, data ); 613 } )( data ); 614 } 615 }, 616 617 // Convert dashed to camelCase; used by the css and data modules 618 // Microsoft forgot to hump their vendor prefix (#9572) 619 camelCase: function( string ) { 620 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 621 }, 622
623 nodeName: function( elem, name ) { 624 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 625 }, 626 627 // args is for internal usage only 628 each: function( object, callback, args ) { 629 var name, i = 0, 630 length = object.length, 631 isObj = length === undefined || jQuery.isFunction( object ); 632 633 if ( args ) { 634 if ( isObj ) { 635 for ( name in object ) { 636 if ( callback.apply( object[ name ], args ) === false ) { 637 break; 638 } 639 } 640 } else { 641 for ( ; i < length; ) { 642 if ( callback.apply( object[ i++ ], args ) === false ) { 643 break; 644 } 645 } 646 } 647 648 // A special, fast, case for the most common use of each 649 } else { 650 if ( isObj ) { 651 for ( name in object ) { 652 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { 653 break; 654 } 655 } 656 } else { 657 for ( ; i < length; ) { 658 if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { 659 break; 660 } 661 } 662 } 663 } 664 665 return object; 666 }, 667 668 // Use native String.trim function wherever possible 669 trim: trim ? 670 function( text ) { 671 return text == null ? 672 "" : 673 trim.call( text ); 674 } : 675 676 // Otherwise use our own trimming functionality 677 function( text ) { 678 return text == null ? 679 "" : 680 text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); 681 }, 682 683 // results is for internal usage only 684 makeArray: function( array, results ) { 685 var ret = results || []; 686 687 if ( array != null ) { 688 // The window, strings (and functions) also have 'length' 689 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 690 var type = jQuery.type( array ); 691 692 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { 693 push.call( ret, array ); 694 } else { 695 jQuery.merge( ret, array ); 696 } 697 } 698 699 return ret; 700 }, 701 702 inArray: function( elem, array, i ) { 703 var len; 704 705 if ( array ) { 706 if ( indexOf ) { 707 return indexOf.call( array, elem, i ); 708 } 709 710 len = array.length; 711 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 712 713 for ( ; i < len; i++ ) { 714 // Skip accessing in sparse arrays 715 if ( i in array && array[ i ] === elem ) { 716 return i; 717 } 718 } 719 } 720 721 return -1; 722 }, 723 724 merge: function( first, second ) { 725 var i = first.length, 726 j = 0; 727 728 if ( typeof second.length === "number" ) { 729 for ( var l = second.length; j < l; j++ ) { 730 first[ i++ ] = second[ j ]; 731 } 732 733 } else { 734 while ( second[j] !== undefined ) { 735 first[ i++ ] = second[ j++ ]; 736 } 737 } 738 739 first.length = i; 740 741 return first; 742 }, 743 744 grep: function( elems, callback, inv ) { 745 var ret = [], retVal; 746 inv = !!inv; 747 748 // Go through the array, only saving the items 749 // that pass the validator function 750 for ( var i = 0, length = elems.length; i < length; i++ ) { 751 retVal = !!callback( elems[ i ], i ); 752 if ( inv !== retVal ) { 753 ret.push( elems[ i ] ); 754 } 755 } 756 757 return ret; 758 }, 759 760 // arg is for internal usage only 761 map: function( elems, callback, arg ) { 762 var value, key, ret = [], 763 i = 0, 764 length = elems.length, 765 // jquery objects are treated as arrays 766 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; 767 768 // Go through the array, translating each of the items to their 769 if ( isArray ) { 770 for ( ; i < length; i++ ) { 771 value = callback( elems[ i ], i, arg ); 772 773 if ( value != null ) { 774 ret[ ret.length ] = value; 775 } 776 } 777 778 // Go through every key on the object, 779 } else { 780 for ( key in elems ) { 781 value = callback( elems[ key ], key, arg ); 782 783 if ( value != null ) { 784 ret[ ret.length ] = value; 785 } 786 } 787 } 788 789 // Flatten any nested arrays 790 return ret.concat.apply( [], ret ); 791 }, 792 793 // A global GUID counter for objects 794 guid: 1, 795 796 // Bind a function to a context, optionally partially applying any 797 // arguments. 798 proxy: function( fn, context ) { 799 if ( typeof context === "string" ) { 800 var tmp = fn[ context ]; 801 context = fn; 802 fn = tmp; 803 } 804 805 // Quick check to determine if target is callable, in the spec 806 // this throws a TypeError, but we will just return undefined. 807 if ( !jQuery.isFunction( fn ) ) { 808 return undefined; 809 } 810 811 // Simulated bind 812 var args = slice.call( arguments, 2 ), 813 proxy = function() { 814 return fn.apply( context, args.concat( slice.call( arguments ) ) ); 815 }; 816 817 // Set the guid of unique handler to the same of original handler, so it can be removed 818 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 819 820 return proxy; 821 }, 822 823 // Mutifunctional method to get and set values to a collection 824 // The value/s can optionally be executed if it's a function 825 access: function( elems, key, value, exec, fn, pass ) { 826 var length = elems.length; 827 828 // Setting many attributes 829 if ( typeof key === "object" ) { 830 for ( var k in key ) { 831 jQuery.access( elems, k, key[k], exec, fn, value ); 832 } 833 return elems; 834 } 835 836 // Setting one attribute 837 if ( value !== undefined ) { 838 // Optionally, function values get executed if exec is true 839 exec = !pass && exec && jQuery.isFunction(value); 840 841 for ( var i = 0; i < length; i++ ) { 842 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); 843 } 844 845 return elems; 846 } 847 848 // Getting an attribute 849 return length ? fn( elems[0], key ) : undefined; 850 }, 851 852 now: function() { 853 return ( new Date() ).getTime(); 854 }, 855 856 // Use of jQuery.browser is frowned upon. 857 // More details: http://docs.jquery.com/Utilities/jQuery.browser 858 uaMatch: function( ua ) { 859 ua = ua.toLowerCase(); 860 861 var match = rwebkit.exec( ua ) || 862 ropera.exec( ua ) || 863 rmsie.exec( ua ) || 864 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 865 []; 866 867 return { browser: match[1] || "", version: match[2] || "0" }; 868 }, 869 870 sub: function() { 871 function jQuerySub( selector, context ) { 872 return new jQuerySub.fn.init( selector, context ); 873 } 874 jQuery.extend( true, jQuerySub, this ); 875 jQuerySub.superclass = this; 876 jQuerySub.fn = jQuerySub.prototype = this(); 877 jQuerySub.fn.constructor = jQuerySub; 878 jQuerySub.sub = this.sub; 879 jQuerySub.fn.init = function init( selector, context ) { 880 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { 881 context = jQuerySub( context ); 882 } 883 884 return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); 885 }; 886 jQuerySub.fn.init.prototype = jQuerySub.fn; 887 var rootjQuerySub = jQuerySub(document); 888 return jQuerySub; 889 }, 890 891 browser: {} 892}); 893 894// Populate the class2type map 895jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { 896 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 897}); 898 899browserMatch = jQuery.uaMatch( userAgent ); 900if ( browserMatch.browser ) { 901 jQuery.browser[ browserMatch.browser ] = true; 902 jQuery.browser.version = browserMatch.version; 903} 904 905// Deprecated, use jQuery.browser.webkit instead 906if ( jQuery.browser.webkit ) { 907 jQuery.browser.safari = true; 908} 909
910// IE doesn't match non-breaking spaces with \s 911if ( rnotwhite.test( "\xA0" ) ) { 912 trimLeft = /^[\s\xA0]+/; 913 trimRight = /[\s\xA0]+$/; 914} 915 916// All jQuery objects should point back to these 917rootjQuery = jQuery(document); 918 919// Cleanup functions for the document ready method 920if ( document.addEventListener ) { 921 DOMContentLoaded = function() { 922 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 923 jQuery.ready(); 924 }; 925 926} else if ( document.attachEvent ) { 927 DOMContentLoaded = function() { 928 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 929 if ( document.readyState === "complete" ) { 930 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 931 jQuery.ready(); 932 } 933 }; 934} 935 936// The DOM ready check for Internet Explorer 937function doScrollCheck() { 938 if ( jQuery.isReady ) { 939 return; 940 } 941 942 try { 943 // If IE is used, use the trick by Diego Perini 944 // http://javascript.nwbox.com/IEContentLoaded/ 945 document.documentElement.doScroll("left"); 946 } catch(e) { 947 setTimeout( doScrollCheck, 1 ); 948 return; 949 } 950 951 // and execute any waiting functions 952 jQuery.ready(); 953} 954 955return jQuery; 956 957})(); 958 959 960// String to Object flags format cache 961var flagsCache = {}; 962 963// Convert String-formatted flags into Object-formatted ones and store in cache 964function createFlags( flags ) { 965 var object = flagsCache[ flags ] = {}, 966 i, length; 967 flags = flags.split( /\s+/ ); 968 for ( i = 0, length = flags.length; i < length; i++ ) { 969 object[ flags[i] ] = true; 970 } 971 return object; 972} 973 974/* 975 * Create a callback list using the following parameters: 976 * 977 * flags: an optional list of space-separated flags that will change how 978 * the callback list behaves 979 * 980 * By default a callback list will act like an event callback list and can be 981 * "fired" multiple times. 982 * 983 * Possible flags: 984 * 985 * once: will ensure the callback list can only be fired once (like a Deferred) 986 * 987 * memory: will keep track of previous values and will call any callback added 988 * after the list has been fired right away with the latest "memorized" 989 * values (like a Deferred) 990 * 991 * unique: will ensure a callback can only be added once (no duplicate in the list) 992 * 993 * stopOnFalse: interrupt callings when a callback returns false 994 * 995 */ 996jQuery.Callbacks = function( flags ) { 997 998 // Convert flags from String-formatted to Object-formatted 999 // (we check in cache first) 1000 flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; 1001 1002 var // Actual callback list 1003 list = [], 1004 // Stack of fire calls for repeatable lists 1005 stack = [], 1006 // Last fire value (for non-forgettable lists) 1007 memory, 1008 // Flag to know if list is currently firing 1009 firing, 1010 // First callback to fire (used internally by add and fireWith) 1011 firingStart, 1012 // End of the loop when firing 1013 firingLength, 1014 // Index of currently firing callback (modified by remove if needed) 1015 firingIndex, 1016 // Add one or several callbacks to the list 1017 add = function( args ) { 1018 var i, 1019 length, 1020 elem, 1021 type, 1022 actual; 1023 for ( i = 0, length = args.length; i < length; i++ ) { 1024 elem = args[ i ]; 1025 type = jQuery.type( elem ); 1026 if ( type === "array" ) { 1027 // Inspect recursively 1028 add( elem ); 1029 } else if ( type === "function" ) { 1030 // Add if not in unique mode and callback is not in 1031 if ( !flags.unique || !self.has( elem ) ) { 1032 list.push( elem ); 1033 } 1034 } 1035 } 1036 }, 1037 // Fire callbacks 1038 fire = function( context, args ) { 1039 args = args || []; 1040 memory = !flags.memory || [ context, args ]; 1041 firing = true; 1042 firingIndex = firingStart || 0; 1043 firingStart = 0; 1044 firingLength = list.length; 1045 for ( ; list && firingIndex < firingLength; firingIndex++ ) { 1046 if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { 1047 memory = true; // Mark as halted 1048 break; 1049 } 1050 } 1051 firing = false; 1052 if ( list ) { 1053 if ( !flags.once ) { 1054 if ( stack && stack.length ) { 1055 memory = stack.shift(); 1056 self.fireWith( memory[ 0 ], memory[ 1 ] ); 1057 } 1058 } else if ( memory === true ) { 1059 self.disable(); 1060 } else { 1061 list = []; 1062 } 1063 } 1064 }, 1065 // Actual Callbacks object 1066 self = { 1067 // Add a callback or a collection of callbacks to the list 1068 add: function() { 1069 if ( list ) { 1070 var length = list.length; 1071 add( arguments ); 1072 // Do we need to add the callbacks to the 1073 // current firing batch? 1074 if ( firing ) { 1075 firingLength = list.length; 1076 // With memory, if we're not firing then 1077 // we should call right away, unless previous 1078 // firing was halted (stopOnFalse) 1079 } else if ( memory && memory !== true ) { 1080 firingStart = length; 1081 fire( memory[ 0 ], memory[ 1 ] ); 1082 } 1083 } 1084 return this; 1085 }, 1086 // Remove a callback from the list 1087 remove: function() { 1088 if ( list ) { 1089 var args = arguments, 1090 argIndex = 0, 1091 argLength = args.length; 1092 for ( ; argIndex < argLength ; argIndex++ ) { 1093 for ( var i = 0; i < list.length; i++ ) { 1094 if ( args[ argIndex ] === list[ i ] ) { 1095 // Handle firingIndex and firingLength 1096 if ( firing ) { 1097 if ( i <= firingLength ) { 1098 firingLength--; 1099 if ( i <= firingIndex ) { 1100 firingIndex--; 1101 } 1102 } 1103 } 1104 // Remove the element 1105 list.splice( i--, 1 ); 1106 // If we have some unicity property then 1107 // we only need to do this once 1108 if ( flags.unique ) { 1109 break; 1110 } 1111 } 1112 } 1113 } 1114 } 1115 return this; 1116 }, 1117 // Control if a given callback is in the list 1118 has: function( fn ) { 1119 if ( list ) { 1120 var i = 0, 1121 length = list.length; 1122 for ( ; i < length; i++ ) { 1123 if ( fn === list[ i ] ) { 1124 return true; 1125 } 1126 } 1127 } 1128 return false;
1129 }, 1130 // Remove all callbacks from the list 1131 empty: function() { 1132 list = []; 1133 return this; 1134 }, 1135 // Have the list do nothing anymore 1136 disable: function() { 1137 list = stack = memory = undefined; 1138 return this; 1139 }, 1140 // Is it disabled? 1141 disabled: function() { 1142 return !list; 1143 }, 1144 // Lock the list in its current state 1145 lock: function() { 1146 stack = undefined; 1147 if ( !memory || memory === true ) { 1148 self.disable(); 1149 } 1150 return this; 1151 }, 1152 // Is it locked? 1153 locked: function() { 1154 return !stack; 1155 }, 1156 // Call all callbacks with the given context and arguments 1157 fireWith: function( context, args ) { 1158 if ( stack ) { 1159 if ( firing ) { 1160 if ( !flags.once ) { 1161 stack.push( [ context, args ] ); 1162 } 1163 } else if ( !( flags.once && memory ) ) { 1164 fire( context, args ); 1165 } 1166 } 1167 return this; 1168 }, 1169 // Call all the callbacks with the given arguments 1170 fire: function() { 1171 self.fireWith( this, arguments ); 1172 return this; 1173 }, 1174 // To know if the callbacks have already been called at least once 1175 fired: function() { 1176 return !!memory; 1177 } 1178 }; 1179 1180 return self; 1181}; 1182 1183 1184 1185 1186var // Static reference to slice 1187 sliceDeferred = [].slice; 1188 1189jQuery.extend({ 1190 1191 Deferred: function( func ) { 1192 var doneList = jQuery.Callbacks( "once memory" ), 1193 failList = jQuery.Callbacks( "once memory" ), 1194 progressList = jQuery.Callbacks( "memory" ), 1195 state = "pending", 1196 lists = { 1197 resolve: doneList, 1198 reject: failList, 1199 notify: progressList 1200 }, 1201 promise = { 1202 done: doneList.add, 1203 fail: failList.add, 1204 progress: progressList.add, 1205 1206 state: function() { 1207 return state; 1208 }, 1209 1210 // Deprecated 1211 isResolved: doneList.fired, 1212 isRejected: failList.fired, 1213 1214 then: function( doneCallbacks, failCallbacks, progressCallbacks ) { 1215 deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); 1216 return this; 1217 }, 1218 always: function() { 1219 deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); 1220 return this; 1221 }, 1222 pipe: function( fnDone, fnFail, fnProgress ) { 1223 return jQuery.Deferred(function( newDefer ) { 1224 jQuery.each( { 1225 done: [ fnDone, "resolve" ], 1226 fail: [ fnFail, "reject" ], 1227 progress: [ fnProgress, "notify" ] 1228 }, function( handler, data ) { 1229 var fn = data[ 0 ], 1230 action = data[ 1 ], 1231 returned; 1232 if ( jQuery.isFunction( fn ) ) { 1233 deferred[ handler ](function() { 1234 returned = fn.apply( this, arguments ); 1235 if ( returned && jQuery.isFunction( returned.promise ) ) { 1236 returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); 1237 } else { 1238 newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); 1239 } 1240 }); 1241 } else { 1242 deferred[ handler ]( newDefer[ action ] ); 1243 } 1244 }); 1245 }).promise(); 1246 }, 1247 // Get a promise for this deferred 1248 // If obj is provided, the promise aspect is added to the object 1249 promise: function( obj ) { 1250 if ( obj == null ) { 1251 obj = promise; 1252 } else { 1253 for ( var key in promise ) { 1254 obj[ key ] = promise[ key ]; 1255 } 1256 } 1257 return obj; 1258 } 1259 }, 1260 deferred = promise.promise({}), 1261 key; 1262 1263 for ( key in lists ) { 1264 deferred[ key ] = lists[ key ].fire; 1265 deferred[ key + "With" ] = lists[ key ].fireWith; 1266 } 1267 1268 // Handle state 1269 deferred.done( function() { 1270 state = "resolved"; 1271 }, failList.disable, progressList.lock ).fail( function() { 1272 state = "rejected"; 1273 }, doneList.disable, progressList.lock ); 1274 1275 // Call given func if any 1276 if ( func ) { 1277 func.call( deferred, deferred ); 1278 } 1279 1280 // All done! 1281 return deferred; 1282 }, 1283 1284 // Deferred helper 1285 when: function( firstParam ) { 1286 var args = sliceDeferred.call( arguments, 0 ), 1287 i = 0, 1288 length = args.length, 1289 pValues = new Array( length ), 1290 count = length, 1291 pCount = length, 1292 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? 1293 firstParam : 1294 jQuery.Deferred(), 1295 promise = deferred.promise(); 1296 function resolveFunc( i ) { 1297 return function( value ) { 1298 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1299 if ( !( --count ) ) { 1300 deferred.resolveWith( deferred, args ); 1301 } 1302 }; 1303 } 1304 function progressFunc( i ) { 1305 return function( value ) { 1306 pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1307 deferred.notifyWith( promise, pValues ); 1308 }; 1309 } 1310 if ( length > 1 ) { 1311 for ( ; i < length; i++ ) { 1312 if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { 1313 args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); 1314 } else { 1315 --count; 1316 } 1317 } 1318 if ( !count ) { 1319 deferred.resolveWith( deferred, args ); 1320 } 1321 } else if ( deferred !== firstParam ) { 1322 deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); 1323 } 1324 return promise; 1325 } 1326}); 1327 1328 1329 1330 1331jQuery.support = (function() { 1332 1333 var support, 1334 all, 1335 a, 1336 select, 1337 opt, 1338 input, 1339 marginDiv, 1340 fragment, 1341 tds, 1342 events, 1343 eventName, 1344 i, 1345 isSupported, 1346 div = document.createElement( "div" ), 1347 documentElement = document.documentElement; 1348 1349 // Preliminary tests 1350 div.setAttribute("className", "t"); 1351 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a>
1351<input type='checkbox'/>"; 1352 1353 all = div.getElementsByTagName( "*" ); 1354 a = div.getElementsByTagName( "a" )[ 0 ]; 1355 1356 // Can't get basic test support 1357 if ( !all || !all.length || !a ) { 1358 return {}; 1359 } 1360 1361 // First batch of supports tests 1362 select = document.createElement( "select" ); 1363 opt = select.appendChild( document.createElement("option") ); 1364 input = div.getElementsByTagName( "input" )[ 0 ]; 1365 1366 support = { 1367 // IE strips leading whitespace when .innerHTML is used 1368 leadingWhitespace: ( div.firstChild.nodeType === 3 ), 1369 1370 // Make sure that tbody elements aren't automatically inserted 1371 // IE will insert them into empty tables 1372 tbody: !div.getElementsByTagName("tbody").length, 1373 1374 // Make sure that link elements get serialized correctly by innerHTML 1375 // This requires a wrapper element in IE 1376 htmlSerialize: !!div.getElementsByTagName("link").length, 1377 1378 // Get the style information from getAttribute 1379 // (IE uses .cssText instead) 1380 style: /top/.test( a.getAttribute("style") ), 1381 1382 // Make sure that URLs aren't manipulated 1383 // (IE normalizes it by default) 1384 hrefNormalized: ( a.getAttribute("href") === "/a" ), 1385 1386 // Make sure that element opacity exists 1387 // (IE uses filter instead) 1388 // Use a regex to work around a WebKit issue. See #5145 1389 opacity: /^0.55/.test( a.style.opacity ), 1390 1391 // Verify style float existence 1392 // (IE uses styleFloat instead of cssFloat) 1393 cssFloat: !!a.style.cssFloat, 1394 1395 // Make sure that if no value is specified for a checkbox 1396 // that it defaults to "on". 1397 // (WebKit defaults to "" instead) 1398 checkOn: ( input.value === "on" ), 1399 1400 // Make sure that a selected-by-default option has a working selected property. 1401 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 1402 optSelected: opt.selected, 1403 1404 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 1405 getSetAttribute: div.className !== "t", 1406 1407 // Tests for enctype support on a form(#6743) 1408 enctype: !!document.createElement("form").enctype, 1409 1410 // Makes sure cloning an html5 element does not cause problems 1411 // Where outerHTML is undefined, this still works 1412 html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", 1413 1414 // Will be defined later 1415 submitBubbles: true, 1416 changeBubbles: true, 1417 focusinBubbles: false, 1418 deleteExpando: true, 1419 noCloneEvent: true, 1420 inlineBlockNeedsLayout: false, 1421 shrinkWrapBlocks: false, 1422 reliableMarginRight: true 1423 }; 1424 1425 // Make sure checked status is properly cloned 1426 input.checked = true; 1427 support.noCloneChecked = input.cloneNode( true ).checked; 1428 1429 // Make sure that the options inside disabled selects aren't marked as disabled 1430 // (WebKit marks them as disabled) 1431 select.disabled = true; 1432 support.optDisabled = !opt.disabled; 1433 1434 // Test to see if it's possible to delete an expando from an element 1435 // Fails in Internet Explorer 1436 try { 1437 delete div.test; 1438 } catch( e ) { 1439 support.deleteExpando = false; 1440 } 1441 1442 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { 1443 div.attachEvent( "onclick", function() { 1444 // Cloning a node shouldn't copy over any 1445 // bound event handlers (IE does this) 1446 support.noCloneEvent = false; 1447 }); 1448 div.cloneNode( true ).fireEvent( "onclick" ); 1449 } 1450 1451 // Check if a radio maintains its value 1452 // after being appended to the DOM 1453 input = document.createElement("input"); 1454 input.value = "t"; 1455 input.setAttribute("type", "radio"); 1456 support.radioValue = input.value === "t"; 1457 1458 input.setAttribute("checked", "checked"); 1459 div.appendChild( input ); 1460 fragment = document.createDocumentFragment(); 1461 fragment.appendChild( div.lastChild ); 1462 1463 // WebKit doesn't clone checked state correctly in fragments 1464 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; 1465 1466 // Check if a disconnected checkbox will retain its checked 1467 // value of true after appended to the DOM (IE6/7) 1468 support.appendChecked = input.checked; 1469 1470 fragment.removeChild( input ); 1471 fragment.appendChild( div ); 1472 1473 div.innerHTML = ""; 1474 1475 // Check if div with explicit width and no margin-right incorrectly 1476 // gets computed margin-right based on width of container. For more 1477 // info see bug #3333 1478 // Fails in WebKit before Feb 2011 nightlies 1479 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1480 if ( window.getComputedStyle ) { 1481 marginDiv = document.createElement( "div" ); 1482 marginDiv.style.width = "0"; 1483 marginDiv.style.marginRight = "0"; 1484 div.style.width = "2px"; 1485 div.appendChild( marginDiv ); 1486 support.reliableMarginRight = 1487 ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; 1488 } 1489 1490 // Technique from Juriy Zaytsev 1491 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 1492 // We only care about the case where non-standard event systems 1493 // are used, namely in IE. Short-circuiting here helps us to 1494 // avoid an eval call (in setAttribute) which can cause CSP 1495 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP 1496 if ( div.attachEvent ) { 1497 for( i in { 1498 submit: 1, 1499 change: 1, 1500 focusin: 1 1501 }) { 1502 eventName = "on" + i; 1503 isSupported = ( eventName in div ); 1504 if ( !isSupported ) { 1505 div.setAttribute( eventName, "return;" ); 1506 isSupported = ( typeof div[ eventName ] === "function" ); 1507 } 1508 support[ i + "Bubbles" ] = isSupported; 1509 } 1510 } 1511 1512 fragment.removeChild( div ); 1513 1514 // Null elements to avoid leaks in IE 1515 fragment = select = opt = marginDiv = div = input = null; 1516 1517 // Run tests that need a body at doc ready 1518 jQuery(function() { 1519 var container, outer, inner, table, td, offsetSupport, 1520 conMarginTop, ptlm, vb, style, html, 1521 body = document.getElementsByTagName("body")[0]; 1522 1523 if ( !body ) { 1524 // Return for frameset docs that don't have a body 1525 return; 1526 } 1527 1528 conMarginTop = 1; 1529 ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; 1530 vb = "visibility:hidden;border:0;"; 1531 style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; 1532 html = "<div " + style + "><div></div></div>" + 1533 "<table " + style + " cellpadding='0' cellspacing='0'>" + 1534 "<tr><td></td></tr></table>"; 1535 1536 container = document.createElement("div"); 1537 container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; 1538 body.insertBefore( container, body.firstChild ); 1539 1540 // Construct the test element 1541 div = document.createElement("div"); 1542 container.appendChild( div ); 1543 1544 // Check if table cells still have offsetWidth/Height when they are set 1545 // to display:none and there are still other visible table cells in a 1546 // table row; if so, offsetWidth/Height are not reliable for use when 1547 // determining if an element has been hidden directly using 1548 // display:none (it is still safe to use offsets if a parent element is 1549 // hidden; don safety goggles and see bug #4512 for more information). 1550 // (only IE 8 fails this test) 1551 div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; 1552 tds = div.getElementsByTagName( "td" ); 1553 isSupported = ( tds[ 0 ].offsetHeight === 0 ); 1554 1555 tds[ 0 ].style.display = ""; 1556 tds[ 1 ].style.display = "none"; 1557 1558 // Check if empty table cells still have offsetWidth/Height 1559 // (IE <= 8 fail this test) 1560 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); 1561 1562 // Figure out if the W3C box model works as expected 1563 div.innerHTML = ""; 1564 div.style.width = div.style.paddingLeft = "1px"; 1565 jQuery.boxModel = support.boxModel = div.offsetWidth === 2; 1566 1567 if ( typeof div.style.zoom !== "undefined" ) { 1568 // Check if natively block-level elements act like inline-block 1569 // elements when setting their display to 'inline' and giving 1570 // them layout 1571 // (IE < 8 does this) 1572 div.style.display = "inline"; 1573 div.style.zoom = 1; 1574 support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); 1575 1576 // Check if elements with layout shrink-wrap their children 1577 // (IE 6 does this) 1578 div.style.display = ""; 1579 div.innerHTML = "<div style='width:4px;'></div>"; 1580 support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); 1581 } 1582 1583 div.style.cssText = ptlm + vb; 1584 div.innerHTML = html; 1585 1586 outer = div.firstChild; 1587 inner = outer.firstChild; 1588 td = outer.nextSibling.firstChild.firstChild; 1589 1590 offsetSupport = { 1591 doesNotAddBorder: ( inner.offsetTop !== 5 ), 1592 doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) 1593 }; 1594 1595 inner.style.position = "fixed"; 1596 inner.style.top = "20px"; 1597 1598 // safari subtracts parent border width here which is 5px 1599 offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); 1600 inner.style.position = inner.style.top = ""; 1601 1602 outer.style.overflow = "hidden"; 1603 outer.style.position = "relative"; 1604 1605 offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); 1606 offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); 1607 1608 body.removeChild( container ); 1609 div = container = null; 1610 1611 jQuery.extend( support, offsetSupport ); 1612 }); 1613 1614 return support; 1615})(); 1616 1617 1618 1619 1620var rbrace = /^(?:\{.*\}|\[.*\])$/, 1621 rmultiDash = /([A-Z])/g; 1622 1623jQuery.extend({ 1624 cache: {}, 1625 1626 // Please use with caution 1627 uuid: 0, 1628 1629 // Unique for each copy of jQuery on the page 1630 // Non-digits removed to match rinlinejQuery 1631 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), 1632 1633 // The following elements throw uncatchable exceptions if you 1634 // attempt to add expando properties to them. 1635 noData: { 1636 "embed": true, 1637 // Ban all objects except for Flash (which handle expandos) 1638 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 1639 "applet": true 1640 }, 1641 1642 hasData: function( elem ) { 1643 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; 1644 return !!elem && !isEmptyDataObject( elem ); 1645 }, 1646 1647 data: function( elem, name, data, pvt /* Internal Use Only */ ) { 1648 if ( !jQuery.acceptData( elem ) ) { 1649 return; 1650 } 1651 1652 var privateCache, thisCache, ret, 1653 internalKey = jQuery.expando, 1654 getByName = typeof name === "string", 1655 1656 // We have to handle DOM nodes and JS objects differently because IE6-7 1657 // can't GC object references properly across the DOM-JS boundary 1658 isNode = elem.nodeType, 1659 1660 // Only DOM nodes need the global jQuery cache; JS object data is 1661 // attached directly to the object so GC can occur automatically 1662 cache = isNode ? jQuery.cache : elem, 1663 1664 // Only defining an ID for JS objects if its cache already exists allows 1665 // the code to shortcut on the same path as a DOM node with no cache 1666 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, 1667 isEvents = name === "events"; 1668 1669 // Avoid doing any more work than we need to when trying to get data on an 1670 // object that has no data at all 1671 if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { 1672 return; 1673 } 1674 1675 if ( !id ) { 1676 // Only DOM nodes need a new unique ID for each element since their data 1677 // ends up in the global cache 1678 if ( isNode ) { 1679 elem[ internalKey ] = id = ++jQuery.uuid; 1680 } else { 1681 id = internalKey; 1682 } 1683 } 1684 1685 if ( !cache[ id ] ) { 1686 cache[ id ] = {}; 1687 1688 // Avoids exposing jQuery metadata on plain JS objects when the object 1689 // is serialized using JSON.stringify 1690 if ( !isNode ) { 1691 cache[ id ].toJSON = jQuery.noop; 1692 } 1693 } 1694
1695 // An object can be passed to jQuery.data instead of a key/value pair; this gets 1696 // shallow copied over onto the existing cache 1697 if ( typeof name === "object" || typeof name === "function" ) { 1698 if ( pvt ) { 1699 cache[ id ] = jQuery.extend( cache[ id ], name ); 1700 } else { 1701 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 1702 } 1703 } 1704 1705 privateCache = thisCache = cache[ id ]; 1706 1707 // jQuery data() is stored in a separate object inside the object's internal data 1708 // cache in order to avoid key collisions between internal data and user-defined 1709 // data. 1710 if ( !pvt ) { 1711 if ( !thisCache.data ) { 1712 thisCache.data = {}; 1713 } 1714 1715 thisCache = thisCache.data; 1716 } 1717 1718 if ( data !== undefined ) { 1719 thisCache[ jQuery.camelCase( name ) ] = data; 1720 } 1721 1722 // Users should not attempt to inspect the internal events object using jQuery.data, 1723 // it is undocumented and subject to change. But does anyone listen? No. 1724 if ( isEvents && !thisCache[ name ] ) { 1725 return privateCache.events; 1726 } 1727 1728 // Check for both converted-to-camel and non-converted data property names 1729 // If a data property was specified 1730 if ( getByName ) { 1731 1732 // First Try to find as-is property data 1733 ret = thisCache[ name ]; 1734 1735 // Test for null|undefined property data 1736 if ( ret == null ) { 1737 1738 // Try to find the camelCased property 1739 ret = thisCache[ jQuery.camelCase( name ) ]; 1740 } 1741 } else { 1742 ret = thisCache; 1743 } 1744 1745 return ret; 1746 }, 1747 1748 removeData: function( elem, name, pvt /* Internal Use Only */ ) { 1749 if ( !jQuery.acceptData( elem ) ) { 1750 return; 1751 } 1752 1753 var thisCache, i, l, 1754 1755 // Reference to internal data cache key 1756 internalKey = jQuery.expando, 1757 1758 isNode = elem.nodeType, 1759 1760 // See jQuery.data for more information 1761 cache = isNode ? jQuery.cache : elem, 1762 1763 // See jQuery.data for more information 1764 id = isNode ? elem[ internalKey ] : internalKey; 1765 1766 // If there is already no cache entry for this object, there is no 1767 // purpose in continuing 1768 if ( !cache[ id ] ) { 1769 return; 1770 } 1771 1772 if ( name ) { 1773 1774 thisCache = pvt ? cache[ id ] : cache[ id ].data; 1775 1776 if ( thisCache ) { 1777 1778 // Support array or space separated string names for data keys 1779 if ( !jQuery.isArray( name ) ) { 1780 1781 // try the string as a key before any manipulation 1782 if ( name in thisCache ) { 1783 name = [ name ]; 1784 } else { 1785 1786 // split the camel cased version by spaces unless a key with the spaces exists 1787 name = jQuery.camelCase( name ); 1788 if ( name in thisCache ) { 1789 name = [ name ]; 1790 } else { 1791 name = name.split( " " ); 1792 } 1793 } 1794 } 1795 1796 for ( i = 0, l = name.length; i < l; i++ ) { 1797 delete thisCache[ name[i] ]; 1798 } 1799 1800 // If there is no data left in the cache, we want to continue 1801 // and let the cache object itself get destroyed 1802 if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { 1803 return; 1804 } 1805 } 1806 } 1807 1808 // See jQuery.data for more information 1809 if ( !pvt ) { 1810 delete cache[ id ].data; 1811 1812 // Don't destroy the parent cache unless the internal data object 1813 // had been the only thing left in it 1814 if ( !isEmptyDataObject(cache[ id ]) ) { 1815 return; 1816 } 1817 } 1818 1819 // Browsers that fail expando deletion also refuse to delete expandos on 1820 // the window, but it will allow it on all other JS objects; other browsers 1821 // don't care 1822 // Ensure that `cache` is not a window object #10080 1823 if ( jQuery.support.deleteExpando || !cache.setInterval ) { 1824 delete cache[ id ]; 1825 } else { 1826 cache[ id ] = null; 1827 } 1828 1829 // We destroyed the cache and need to eliminate the expando on the node to avoid 1830 // false lookups in the cache for entries that no longer exist 1831 if ( isNode ) { 1832 // IE does not allow us to delete expando properties from nodes, 1833 // nor does it have a removeAttribute function on Document nodes; 1834 // we must handle all of these cases 1835 if ( jQuery.support.deleteExpando ) { 1836 delete elem[ internalKey ]; 1837 } else if ( elem.removeAttribute ) { 1838 elem.removeAttribute( internalKey ); 1839 } else { 1840 elem[ internalKey ] = null; 1841 } 1842 } 1843 }, 1844 1845 // For internal use only. 1846 _data: function( elem, name, data ) { 1847 return jQuery.data( elem, name, data, true ); 1848 }, 1849 1850 // A method for determining if a DOM node can handle the data expando 1851 acceptData: function( elem ) { 1852 if ( elem.nodeName ) { 1853 var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; 1854 1855 if ( match ) { 1856 return !(match === true || elem.getAttribute("classid") !== match); 1857 } 1858 } 1859 1860 return true; 1861 } 1862}); 1863 1864jQuery.fn.extend({ 1865 data: function( key, value ) { 1866 var parts, attr, name, 1867 data = null; 1868 1869 if ( typeof key === "undefined" ) { 1870 if ( this.length ) { 1871 data = jQuery.data( this[0] ); 1872 1873 if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { 1874 attr = this[0].attributes; 1875 for ( var i = 0, l = attr.length; i < l; i++ ) { 1876 name = attr[i].name; 1877
1878 if ( name.indexOf( "data-" ) === 0 ) { 1879 name = jQuery.camelCase( name.substring(5) ); 1880 1881 dataAttr( this[0], name, data[ name ] ); 1882 } 1883 } 1884 jQuery._data( this[0], "parsedAttrs", true ); 1885 } 1886 } 1887 1888 return data; 1889 1890 } else if ( typeof key === "object" ) { 1891 return this.each(function() { 1892 jQuery.data( this, key ); 1893 }); 1894 } 1895 1896 parts = key.split("."); 1897 parts[1] = parts[1] ? "." + parts[1] : ""; 1898 1899 if ( value === undefined ) { 1900 data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 1901 1902 // Try to fetch any internally stored data first 1903 if ( data === undefined && this.length ) { 1904 data = jQuery.data( this[0], key ); 1905 data = dataAttr( this[0], key, data ); 1906 } 1907 1908 return data === undefined && parts[1] ? 1909 this.data( parts[0] ) : 1910 data; 1911 1912 } else { 1913 return this.each(function() { 1914 var self = jQuery( this ), 1915 args = [ parts[0], value ]; 1916 1917 self.triggerHandler( "setData" + parts[1] + "!", args ); 1918 jQuery.data( this, key, value ); 1919 self.triggerHandler( "changeData" + parts[1] + "!", args ); 1920 }); 1921 } 1922 }, 1923 1924 removeData: function( key ) { 1925 return this.each(function() { 1926 jQuery.removeData( this, key ); 1927 }); 1928 } 1929}); 1930 1931function dataAttr( elem, key, data ) { 1932 // If nothing was found internally, try to fetch any 1933 // data from the HTML5 data-* attribute 1934 if ( data === undefined && elem.nodeType === 1 ) { 1935 1936 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 1937 1938 data = elem.getAttribute( name ); 1939 1940 if ( typeof data === "string" ) { 1941 try { 1942 data = data === "true" ? true : 1943 data === "false" ? false : 1944 data === "null" ? null : 1945 jQuery.isNumeric( data ) ? parseFloat( data ) : 1946 rbrace.test( data ) ? jQuery.parseJSON( data ) : 1947 data; 1948 } catch( e ) {} 1949 1950 // Make sure we set the data so it isn't changed later 1951 jQuery.data( elem, key, data ); 1952 1953 } else { 1954 data = undefined; 1955 } 1956 } 1957 1958 return data; 1959} 1960 1961// checks a cache object for emptiness 1962function isEmptyDataObject( obj ) { 1963 for ( var name in obj ) { 1964 1965 // if the public data object is empty, the private is still empty 1966 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { 1967 continue; 1968 } 1969 if ( name !== "toJSON" ) { 1970 return false; 1971 } 1972 } 1973 1974 return true; 1975} 1976 1977 1978 1979 1980function handleQueueMarkDefer( elem, type, src ) { 1981 var deferDataKey = type + "defer", 1982 queueDataKey = type + "queue", 1983 markDataKey = type + "mark", 1984 defer = jQuery._data( elem, deferDataKey ); 1985 if ( defer && 1986 ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && 1987 ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { 1988 // Give room for hard-coded callbacks to fire first 1989 // and eventually mark/queue something else on the element 1990 setTimeout( function() { 1991 if ( !jQuery._data( elem, queueDataKey ) && 1992 !jQuery._data( elem, markDataKey ) ) { 1993 jQuery.removeData( elem, deferDataKey, true ); 1994 defer.fire(); 1995 } 1996 }, 0 ); 1997 } 1998} 1999 2000jQuery.extend({ 2001 2002 _mark: function( elem, type ) { 2003 if ( elem ) { 2004 type = ( type || "fx" ) + "mark"; 2005 jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); 2006 } 2007 }, 2008 2009 _unmark: function( force, elem, type ) { 2010 if ( force !== true ) { 2011 type = elem; 2012 elem = force; 2013 force = false; 2014 } 2015 if ( elem ) { 2016 type = type || "fx"; 2017 var key = type + "mark", 2018 count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); 2019 if ( count ) { 2020 jQuery._data( elem, key, count ); 2021 } else { 2022 jQuery.removeData( elem, key, true ); 2023 handleQueueMarkDefer( elem, type, "mark" ); 2024 } 2025 } 2026 }, 2027 2028 queue: function( elem, type, data ) { 2029 var q; 2030 if ( elem ) { 2031 type = ( type || "fx" ) + "queue"; 2032 q = jQuery._data( elem, type ); 2033 2034 // Speed up dequeue by getting out quickly if this is just a lookup 2035 if ( data ) { 2036 if ( !q || jQuery.isArray(data) ) { 2037 q = jQuery._data( elem, type, jQuery.makeArray(data) ); 2038 } else { 2039 q.push( data ); 2040 } 2041 } 2042 return q || []; 2043 } 2044 }, 2045 2046 dequeue: function( elem, type ) { 2047 type = type || "fx"; 2048 2049 var queue = jQuery.queue( elem, type ), 2050 fn = queue.shift(), 2051 hooks = {}; 2052 2053 // If the fx queue is dequeued, always remove the progress sentinel 2054 if ( fn === "inprogress" ) { 2055 fn = queue.shift(); 2056 } 2057 2058 if ( fn ) { 2059 // Add a progress sentinel to prevent the fx queue from being 2060 // automatically dequeued 2061 if ( type === "fx" ) { 2062 queue.unshift( "inprogress" ); 2063 } 2064 2065 jQuery._data( elem, type + ".run", hooks ); 2066 fn.call( elem, function() { 2067 jQuery.dequeue( elem, type ); 2068 }, hooks ); 2069 } 2070 2071 if ( !queue.length ) { 2072 jQuery.removeData( elem, type + "queue " + type + ".run", true ); 2073 handleQueueMarkDefer( elem, type, "queue" ); 2074 } 2075 } 2076}); 2077 2078jQuery.fn.extend({ 2079 queue: function( type, data ) { 2080 if ( typeof type !== "string" ) { 2081 data = type; 2082 type = "fx"; 2083 } 2084 2085 if ( data === undefined ) { 2086 return jQuery.queue( this[0], type ); 2087 } 2088 return this.each(function() { 2089 var queue = jQuery.queue( this, type, data ); 2090 2091 if ( type === "fx" && queue[0] !== "inprogress" ) { 2092 jQuery.dequeue( this, type ); 2093 } 2094 }); 2095 }, 2096 dequeue: function( type ) { 2097 return this.each(function() { 2098 jQuery.dequeue( this, type ); 2099 }); 2100 }, 2101 // Based off of the plugin by Clint Helfers, with permission. 2102 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 2103 delay: function( time, type ) { 2104 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 2105 type = type || "fx"; 2106 2107 return this.queue( type, function( next, hooks ) { 2108 var timeout = setTimeout( next, time ); 2109 hooks.stop = function() { 2110 clearTimeout( timeout ); 2111 }; 2112 }); 2113 }, 2114 clearQueue: function( type ) { 2115 return this.queue( type || "fx", [] ); 2116 }, 2117 // Get a promise resolved when queues of a certain type 2118 // are emptied (fx is the type by default) 2119 promise: function( type, object ) { 2120 if ( typeof type !== "string" ) { 2121 object = type; 2122 type = undefined; 2123 } 2124 type = type || "fx"; 2125 var defer = jQuery.Deferred(), 2126 elements = this, 2127 i = elements.length, 2128 count = 1, 2129 deferDataKey = type + "defer", 2130 queueDataKey = type + "queue", 2131 markDataKey = type + "mark", 2132 tmp; 2133 function resolve() { 2134 if ( !( --count ) ) { 2135 defer.resolveWith( elements, [ elements ] ); 2136 } 2137 } 2138 while( i-- ) { 2139 if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || 2140 ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || 2141 jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && 2142 jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { 2143 count++; 2144 tmp.add( resolve ); 2145 } 2146 } 2147 resolve(); 2148 return defer.promise(); 2149 } 2150}); 2151 2152 2153 2154 2155var rclass = /[\n\t\r]/g, 2156 rspace = /\s+/, 2157 rreturn = /\r/g, 2158 rtype = /^(?:button|input)$/i, 2159 rfocusable = /^(?:button|input|object|select|textarea)$/i, 2160 rclickable = /^a(?:rea)?$/i, 2161 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 2162 getSetAttribute = jQuery.support.getSetAttribute, 2163 nodeHook, boolHook, fixSpecified; 2164 2165jQuery.fn.extend({ 2166 attr: function( name, value ) { 2167 return jQuery.access( this, name, value, true, jQuery.attr ); 2168 }, 2169 2170 removeAttr: function( name ) { 2171 return this.each(function() { 2172 jQuery.removeAttr( this, name ); 2173 }); 2174 }, 2175 2176 prop: function( name, value ) { 2177 return jQuery.access( this, name, value, true, jQuery.prop ); 2178 }, 2179 2180 removeProp: function( name ) { 2181 name = jQuery.propFix[ name ] || name; 2182 return this.each(function() { 2183 // try/catch handles cases where IE balks (such as removing a property on window) 2184 try { 2185 this[ name ] = undefined; 2186 delete this[ name ]; 2187 } catch( e ) {} 2188 }); 2189 }, 2190 2191 addClass: function( value ) { 2192 var classNames, i, l, elem, 2193 setClass, c, cl; 2194 2195 if ( jQuery.isFunction( value ) ) { 2196 return this.each(function( j ) { 2197 jQuery( this ).addClass( value.call(this, j, this.className) ); 2198 }); 2199 } 2200 2201 if ( value && typeof value === "string" ) { 2202 classNames = value.split( rspace ); 2203 2204 for ( i = 0, l = this.length; i < l; i++ ) { 2205 elem = this[ i ]; 2206 2207 if ( elem.nodeType === 1 ) { 2208 if ( !elem.className && classNames.length === 1 ) { 2209 elem.className = value; 2210 2211 } else { 2212 setClass = " " + elem.className + " "; 2213 2214 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2215 if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { 2216 setClass += classNames[ c ] + " "; 2217 } 2218 } 2219 elem.className = jQuery.trim( setClass ); 2220 } 2221 } 2222 } 2223 } 2224 2225 return this; 2226 }, 2227 2228 removeClass: function( value ) { 2229 var classNames, i, l, elem, className, c, cl; 2230 2231 if ( jQuery.isFunction( value ) ) { 2232 return this.each(function( j ) { 2233 jQuery( this ).removeClass( value.call(this, j, this.className) ); 2234 }); 2235 } 2236 2237 if ( (value && typeof value === "string") || value === undefined ) { 2238 classNames = ( value || "" ).split( rspace ); 2239 2240 for ( i = 0, l = this.length; i < l; i++ ) { 2241 elem = this[ i ]; 2242 2243 if ( elem.nodeType === 1 && elem.className ) { 2244 if ( value ) { 2245 className = (" " + elem.className + " ").replace( rclass, " " ); 2246 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2247 className = className.replace(" " + classNames[ c ] + " ", " "); 2248 } 2249 elem.className = jQuery.trim( className ); 2250 2251 } else { 2252 elem.className = ""; 2253 } 2254 } 2255 } 2256 } 2257 2258 return this; 2259 }, 2260 2261 toggleClass: function( value, stateVal ) { 2262 var type = typeof value, 2263 isBool = typeof stateVal === "boolean"; 2264 2265 if ( jQuery.isFunction( value ) ) { 2266 return this.each(function( i ) { 2267 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); 2268 }); 2269 } 2270 2271 return this.each(function() { 2272 if ( type === "string" ) { 2273 // toggle individual class names 2274 var className, 2275 i = 0, 2276 self = jQuery( this ), 2277 state = stateVal, 2278 classNames = value.split( rspace ); 2279 2280 while ( (className = classNames[ i++ ]) ) { 2281 // check each className given, space seperated list 2282 state = isBool ? state : !self.hasClass( className ); 2283 self[ state ? "addClass" : "removeClass" ]( className ); 2284 } 2285 2286 } else if ( type === "undefined" || type === "boolean" ) { 2287 if ( this.className ) { 2288 // store className if set 2289 jQuery._data( this, "__className__", this.className ); 2290 } 2291 2292 // toggle whole className 2293 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; 2294 } 2295 }); 2296 }, 2297 2298 hasClass: function( selector ) { 2299 var className = " " + selector + " ", 2300 i = 0, 2301 l = this.length; 2302 for ( ; i < l; i++ ) { 2303 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { 2304 return true; 2305 } 2306 } 2307 2308 return false;
2309 }, 2310 2311 val: function( value ) { 2312 var hooks, ret, isFunction, 2313 elem = this[0]; 2314 2315 if ( !arguments.length ) { 2316 if ( elem ) { 2317 hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; 2318 2319 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { 2320 return ret; 2321 } 2322 2323 ret = elem.value; 2324 2325 return typeof ret === "string" ? 2326 // handle most common string cases 2327 ret.replace(rreturn, "") : 2328 // handle cases where value is null/undef or number 2329 ret == null ? "" : ret; 2330 } 2331 2332 return; 2333 } 2334 2335 isFunction = jQuery.isFunction( value ); 2336 2337 return this.each(function( i ) { 2338 var self = jQuery(this), val; 2339 2340 if ( this.nodeType !== 1 ) { 2341 return; 2342 } 2343 2344 if ( isFunction ) { 2345 val = value.call( this, i, self.val() ); 2346 } else { 2347 val = value; 2348 } 2349 2350 // Treat null/undefined as ""; convert numbers to string 2351 if ( val == null ) { 2352 val = ""; 2353 } else if ( typeof val === "number" ) { 2354 val += ""; 2355 } else if ( jQuery.isArray( val ) ) { 2356 val = jQuery.map(val, function ( value ) { 2357 return value == null ? "" : value + ""; 2358 }); 2359 } 2360 2361 hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; 2362 2363 // If set returns undefined, fall back to normal setting 2364 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { 2365 this.value = val; 2366 } 2367 }); 2368 } 2369}); 2370 2371jQuery.extend({ 2372 valHooks: { 2373 option: { 2374 get: function( elem ) { 2375 // attributes.value is undefined in Blackberry 4.7 but 2376 // uses .value. See #6932 2377 var val = elem.attributes.value; 2378 return !val || val.specified ? elem.value : elem.text; 2379 } 2380 }, 2381 select: { 2382 get: function( elem ) { 2383 var value, i, max, option, 2384 index = elem.selectedIndex, 2385 values = [], 2386 options = elem.options, 2387 one = elem.type === "select-one"; 2388 2389 // Nothing was selected 2390 if ( index < 0 ) { 2391 return null; 2392 } 2393 2394 // Loop through all the selected options 2395 i = one ? index : 0; 2396 max = one ? index + 1 : options.length; 2397 for ( ; i < max; i++ ) { 2398 option = options[ i ]; 2399 2400 // Don't return options that are disabled or in a disabled optgroup 2401 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 2402 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { 2403 2404 // Get the specific value for the option 2405 value = jQuery( option ).val(); 2406 2407 // We don't need an array for one selects 2408 if ( one ) { 2409 return value; 2410 } 2411 2412 // Multi-Selects return an array 2413 values.push( value ); 2414 } 2415 } 2416 2417 // Fixes Bug #2551 -- select.val() broken in IE after form.reset() 2418 if ( one && !values.length && options.length ) { 2419 return jQuery( options[ index ] ).val(); 2420 } 2421 2422 return values; 2423 }, 2424 2425 set: function( elem, value ) { 2426 var values = jQuery.makeArray( value ); 2427 2428 jQuery(elem).find("option").each(function() { 2429 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; 2430 }); 2431 2432 if ( !values.length ) { 2433 elem.selectedIndex = -1; 2434 } 2435 return values; 2436 } 2437 } 2438 }, 2439 2440 attrFn: { 2441 val: true, 2442 css: true, 2443 html: true, 2444 text: true, 2445 data: true, 2446 width: true, 2447 height: true, 2448 offset: true 2449 }, 2450 2451 attr: function( elem, name, value, pass ) { 2452 var ret, hooks, notxml, 2453 nType = elem.nodeType; 2454 2455 // don't get/set attributes on text, comment and attribute nodes 2456 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 2457 return; 2458 } 2459 2460 if ( pass && name in jQuery.attrFn ) { 2461 return jQuery( elem )[ name ]( value ); 2462 } 2463 2464 // Fallback to prop when attributes are not supported 2465 if ( typeof elem.getAttribute === "undefined" ) { 2466 return jQuery.prop( elem, name, value ); 2467 } 2468 2469 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 2470 2471 // All attributes are lowercase 2472 // Grab necessary hook if one is defined 2473 if ( notxml ) { 2474 name = name.toLowerCase(); 2475 hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); 2476 } 2477 2478 if ( value !== undefined ) { 2479 2480 if ( value === null ) { 2481 jQuery.removeAttr( elem, name ); 2482 return; 2483 2484 } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { 2485 return ret; 2486 2487 } else { 2488 elem.setAttribute( name, "" + value ); 2489 return value; 2490 } 2491 2492 } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { 2493 return ret; 2494 2495 } else { 2496 2497 ret = elem.getAttribute( name ); 2498 2499 // Non-existent attributes return null, we normalize to undefined 2500 return ret === null ? 2501 undefined : 2502 ret; 2503 } 2504 }, 2505 2506 removeAttr: function( elem, value ) { 2507 var propName, attrNames, name, l, 2508 i = 0; 2509 2510 if ( value && elem.nodeType === 1 ) { 2511 attrNames = value.toLowerCase().split( rspace ); 2512 l = attrNames.length; 2513 2514 for ( ; i < l; i++ ) { 2515 name = attrNames[ i ]; 2516
vendor: 5,612 bytes, lines 2517-2709
2517 if ( name ) { 2518 propName = jQuery.propFix[ name ] || name; 2519 2520 // See #9699 for explanation of this approach (setting first, then removal) 2521 jQuery.attr( elem, name, "" ); 2522 elem.removeAttribute( getSetAttribute ? name : propName ); 2523 2524 // Set corresponding property to false for boolean attributes 2525 if ( rboolean.test( name ) && propName in elem ) { 2526 elem[ propName ] = false; 2527 } 2528 } 2529 } 2530 } 2531 }, 2532 2533 attrHooks: { 2534 type: { 2535 set: function( elem, value ) { 2536 // We can't allow the type property to be changed (since it causes problems in IE) 2537 if ( rtype.test( elem.nodeName ) && elem.parentNode ) { 2538 jQuery.error( "type property can't be changed" ); 2539 } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { 2540 // Setting the type on a radio button after the value resets the value in IE6-9 2541 // Reset value to it's default in case type is set after value 2542 // This is for element creation 2543 var val = elem.value; 2544 elem.setAttribute( "type", value ); 2545 if ( val ) { 2546 elem.value = val; 2547 } 2548 return value; 2549 } 2550 } 2551 }, 2552 // Use the value property for back compat 2553 // Use the nodeHook for button elements in IE6/7 (#1954) 2554 value: { 2555 get: function( elem, name ) { 2556 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { 2557 return nodeHook.get( elem, name ); 2558 } 2559 return name in elem ? 2560 elem.value : 2561 null; 2562 }, 2563 set: function( elem, value, name ) { 2564 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { 2565 return nodeHook.set( elem, value, name ); 2566 } 2567 // Does not return so that setAttribute is also used 2568 elem.value = value; 2569 } 2570 } 2571 }, 2572 2573 propFix: { 2574 tabindex: "tabIndex", 2575 readonly: "readOnly", 2576 "for": "htmlFor", 2577 "class": "className", 2578 maxlength: "maxLength", 2579 cellspacing: "cellSpacing", 2580 cellpadding: "cellPadding", 2581 rowspan: "rowSpan", 2582 colspan: "colSpan", 2583 usemap: "useMap", 2584 frameborder: "frameBorder", 2585 contenteditable: "contentEditable" 2586 }, 2587 2588 prop: function( elem, name, value ) { 2589 var ret, hooks, notxml, 2590 nType = elem.nodeType; 2591 2592 // don't get/set properties on text, comment and attribute nodes 2593 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 2594 return; 2595 } 2596 2597 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 2598 2599 if ( notxml ) { 2600 // Fix name and attach hooks 2601 name = jQuery.propFix[ name ] || name; 2602 hooks = jQuery.propHooks[ name ]; 2603 } 2604 2605 if ( value !== undefined ) { 2606 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { 2607 return ret; 2608 2609 } else { 2610 return ( elem[ name ] = value ); 2611 } 2612 2613 } else { 2614 if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { 2615 return ret; 2616 2617 } else { 2618 return elem[ name ]; 2619 } 2620 } 2621 }, 2622 2623 propHooks: { 2624 tabIndex: { 2625 get: function( elem ) { 2626 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 2627 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 2628 var attributeNode = elem.getAttributeNode("tabindex"); 2629 2630 return attributeNode && attributeNode.specified ? 2631 parseInt( attributeNode.value, 10 ) : 2632 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 2633 0 : 2634 undefined; 2635 } 2636 } 2637 } 2638}); 2639 2640// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) 2641jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; 2642 2643// Hook for boolean attributes 2644boolHook = { 2645 get: function( elem, name ) { 2646 // Align boolean attributes with corresponding properties 2647 // Fall back to attribute presence where some booleans are not supported 2648 var attrNode, 2649 property = jQuery.prop( elem, name ); 2650 return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? 2651 name.toLowerCase() : 2652 undefined; 2653 }, 2654 set: function( elem, value, name ) { 2655 var propName; 2656 if ( value === false ) { 2657 // Remove boolean attributes when set to false 2658 jQuery.removeAttr( elem, name ); 2659 } else { 2660 // value is true since we know at this point it's type boolean and not false 2661 // Set boolean attributes to the same name and set the DOM property 2662 propName = jQuery.propFix[ name ] || name; 2663 if ( propName in elem ) { 2664 // Only set the IDL specifically if it already exists on the element 2665 elem[ propName ] = true; 2666 } 2667 2668 elem.setAttribute( name, name.toLowerCase() ); 2669 } 2670 return name; 2671 } 2672}; 2673 2674// IE6/7 do not support getting/setting some attributes with get/setAttribute 2675if ( !getSetAttribute ) { 2676 2677 fixSpecified = { 2678 name: true, 2679 id: true 2680 }; 2681 2682 // Use this for any attribute in IE6/7 2683 // This fixes almost every IE6/7 issue 2684 nodeHook = jQuery.valHooks.button = { 2685 get: function( elem, name ) { 2686 var ret; 2687 ret = elem.getAttributeNode( name ); 2688 return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? 2689 ret.nodeValue : 2690 undefined; 2691 }, 2692 set: function( elem, value, name ) { 2693 // Set the existing or create a new attribute node 2694 var ret = elem.getAttributeNode( name ); 2695 if ( !ret ) { 2696 ret = document.createAttribute( name ); 2697 elem.setAttributeNode( ret ); 2698 } 2699 return ( ret.nodeValue = value + "" ); 2700 } 2701 }; 2702 2703 // Apply the nodeHook to tabindex 2704 jQuery.attrHooks.tabindex.set = nodeHook.set; 2705 2706 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 2707 // This is for removals 2708 jQuery.each([ "width", "height" ], function( i, name ) { 2709 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2710 set: function( elem, value ) { 2711 if ( value === "" ) { 2712 elem.setAttribute( name, "auto" ); 2713 return value; 2714 } 2715 } 2716 }); 2717 }); 2718 2719 // Set contenteditable to false on removals(#10429) 2720 // Setting to empty string throws an error as an invalid value 2721 jQuery.attrHooks.contenteditable = { 2722 get: nodeHook.get, 2723 set: function( elem, value, name ) { 2724 if ( value === "" ) { 2725 value = "false"; 2726 } 2727 nodeHook.set( elem, value, name ); 2728 } 2729 }; 2730} 2731 2732 2733// Some attributes require a special call on IE 2734if ( !jQuery.support.hrefNormalized ) { 2735 jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { 2736 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { 2737 get: function( elem ) { 2738 var ret = elem.getAttribute( name, 2 ); 2739 return ret === null ? undefined : ret; 2740 } 2741 }); 2742 }); 2743} 2744 2745if ( !jQuery.support.style ) { 2746 jQuery.attrHooks.style = { 2747 get: function( elem ) { 2748 // Return undefined in the case of empty string 2749 // Normalize to lowercase since IE uppercases css property names 2750 return elem.style.cssText.toLowerCase() || undefined; 2751 }, 2752 set: function( elem, value ) { 2753 return ( elem.style.cssText = "" + value ); 2754 } 2755 }; 2756} 2757 2758// Safari mis-reports the default selected property of an option 2759// Accessing the parent's selectedIndex property fixes it 2760if ( !jQuery.support.optSelected ) { 2761 jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { 2762 get: function( elem ) { 2763 var parent = elem.parentNode; 2764 2765 if ( parent ) { 2766 parent.selectedIndex; 2767 2768 // Make sure that it also works with optgroups, see #5701 2769 if ( parent.parentNode ) { 2770 parent.parentNode.selectedIndex; 2771 } 2772 } 2773 return null; 2774 } 2775 }); 2776} 2777 2778// IE6/7 call enctype encoding 2779if ( !jQuery.support.enctype ) { 2780 jQuery.propFix.enctype = "encoding"; 2781} 2782 2783// Radios and checkboxes getter/setter 2784if ( !jQuery.support.checkOn ) { 2785 jQuery.each([ "radio", "checkbox" ], function() { 2786 jQuery.valHooks[ this ] = { 2787 get: function( elem ) { 2788 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 2789 return elem.getAttribute("value") === null ? "on" : elem.value; 2790 } 2791 }; 2792 }); 2793} 2794jQuery.each([ "radio", "checkbox" ], function() { 2795 jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { 2796 set: function( elem, value ) { 2797 if ( jQuery.isArray( value ) ) { 2798 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); 2799 } 2800 } 2801 }); 2802}); 2803 2804 2805 2806 2807var rformElems = /^(?:textarea|input|select)$/i, 2808 rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, 2809 rhoverHack = /\bhover(\.\S+)?\b/, 2810 rkeyEvent = /^key/, 2811 rmouseEvent = /^(?:mouse|contextmenu)|click/, 2812 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 2813 rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, 2814 quickParse = function( selector ) { 2815 var quick = rquickIs.exec( selector ); 2816 if ( quick ) { 2817 // 0 1 2 3 2818 // [ _, tag, id, class ] 2819 quick[1] = ( quick[1] || "" ).toLowerCase(); 2820 quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); 2821 } 2822 return quick; 2823 }, 2824 quickIs = function( elem, m ) { 2825 var attrs = elem.attributes || {}; 2826 return ( 2827 (!m[1] || elem.nodeName.toLowerCase() === m[1]) && 2828 (!m[2] || (attrs.id || {}).value === m[2]) && 2829 (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) 2830 ); 2831 }, 2832 hoverHack = function( events ) { 2833 return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); 2834 }; 2835 2836/* 2837 * Helper functions for managing events -- not part of the public interface. 2838 * Props to Dean Edwards' addEvent library for many of the ideas. 2839 */ 2840jQuery.event = { 2841 2842 add: function( elem, types, handler, data, selector ) { 2843 2844 var elemData, eventHandle, events, 2845 t, tns, type, namespaces, handleObj, 2846 handleObjIn, quick, handlers, special; 2847 2848 // Don't attach events to noData or text/comment nodes (allow plain objects tho) 2849 if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { 2850 return; 2851 } 2852 2853 // Caller can pass in an object of custom data in lieu of the handler 2854 if ( handler.handler ) { 2855 handleObjIn = handler; 2856 handler = handleObjIn.handler; 2857 } 2858 2859 // Make sure that the handler has a unique ID, used to find/remove it later 2860 if ( !handler.guid ) { 2861 handler.guid = jQuery.guid++; 2862 } 2863 2864 // Init the element's event structure and main handler, if this is the first 2865 events = elemData.events; 2866 if ( !events ) { 2867 elemData.events = events = {}; 2868 } 2869 eventHandle = elemData.handle; 2870 if ( !eventHandle ) { 2871 elemData.handle = eventHandle = function( e ) { 2872 // Discard the second event of a jQuery.event.trigger() and 2873 // when an event is called after a page has unloaded 2874 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? 2875 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 2876 undefined; 2877 }; 2878 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 2879 eventHandle.elem = elem; 2880 } 2881 2882 // Handle multiple events separated by a space 2883 // jQuery(...).bind("mouseover mouseout", fn); 2884 types = jQuery.trim( hoverHack(types) ).split( " " ); 2885 for ( t = 0; t < types.length; t++ ) { 2886 2887 tns = rtypenamespace.exec( types[t] ) || []; 2888 type = tns[1];
vendor: 4,277 bytes, lines 2889-3023
2889 namespaces = ( tns[2] || "" ).split( "." ).sort(); 2890 2891 // If event changes its type, use the special event handlers for the changed type 2892 special = jQuery.event.special[ type ] || {}; 2893 2894 // If selector defined, determine special event api type, otherwise given type 2895 type = ( selector ? special.delegateType : special.bindType ) || type; 2896 2897 // Update special based on newly reset type 2898 special = jQuery.event.special[ type ] || {}; 2899 2900 // handleObj is passed to all event handlers 2901 handleObj = jQuery.extend({ 2902 type: type, 2903 origType: tns[1], 2904 data: data, 2905 handler: handler, 2906 guid: handler.guid, 2907 selector: selector, 2908 quick: quickParse( selector ), 2909 namespace: namespaces.join(".") 2910 }, handleObjIn ); 2911 2912 // Init the event handler queue if we're the first 2913 handlers = events[ type ]; 2914 if ( !handlers ) { 2915 handlers = events[ type ] = []; 2916 handlers.delegateCount = 0; 2917 2918 // Only use addEventListener/attachEvent if the special events handler returns false 2919 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 2920 // Bind the global event handler to the element 2921 if ( elem.addEventListener ) { 2922 elem.addEventListener( type, eventHandle, false ); 2923 2924 } else if ( elem.attachEvent ) { 2925 elem.attachEvent( "on" + type, eventHandle ); 2926 } 2927 } 2928 } 2929 2930 if ( special.add ) { 2931 special.add.call( elem, handleObj ); 2932 2933 if ( !handleObj.handler.guid ) { 2934 handleObj.handler.guid = handler.guid; 2935 } 2936 } 2937 2938 // Add to the element's handler list, delegates in front 2939 if ( selector ) { 2940 handlers.splice( handlers.delegateCount++, 0, handleObj ); 2941 } else { 2942 handlers.push( handleObj ); 2943 } 2944 2945 // Keep track of which events have ever been used, for event optimization 2946 jQuery.event.global[ type ] = true; 2947 } 2948 2949 // Nullify elem to prevent memory leaks in IE 2950 elem = null; 2951 }, 2952 2953 global: {}, 2954 2955 // Detach an event or set of events from an element 2956 remove: function( elem, types, handler, selector, mappedTypes ) { 2957 2958 var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), 2959 t, tns, type, origType, namespaces, origCount, 2960 j, events, special, handle, eventType, handleObj; 2961 2962 if ( !elemData || !(events = elemData.events) ) { 2963 return; 2964 } 2965 2966 // Once for each type.namespace in types; type may be omitted 2967 types = jQuery.trim( hoverHack( types || "" ) ).split(" "); 2968 for ( t = 0; t < types.length; t++ ) { 2969 tns = rtypenamespace.exec( types[t] ) || []; 2970 type = origType = tns[1]; 2971 namespaces = tns[2]; 2972 2973 // Unbind all events (on this namespace, if provided) for the element 2974 if ( !type ) { 2975 for ( type in events ) { 2976 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 2977 } 2978 continue; 2979 } 2980 2981 special = jQuery.event.special[ type ] || {}; 2982 type = ( selector? special.delegateType : special.bindType ) || type; 2983 eventType = events[ type ] || []; 2984 origCount = eventType.length; 2985 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 2986 2987 // Remove matching events 2988 for ( j = 0; j < eventType.length; j++ ) { 2989 handleObj = eventType[ j ]; 2990 2991 if ( ( mappedTypes || origType === handleObj.origType ) && 2992 ( !handler || handler.guid === handleObj.guid ) && 2993 ( !namespaces || namespaces.test( handleObj.namespace ) ) && 2994 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { 2995 eventType.splice( j--, 1 ); 2996 2997 if ( handleObj.selector ) { 2998 eventType.delegateCount--; 2999 } 3000 if ( special.remove ) { 3001 special.remove.call( elem, handleObj ); 3002 } 3003 } 3004 } 3005 3006 // Remove generic event handler if we removed something and no more handlers exist 3007 // (avoids potential for endless recursion during removal of special event handlers) 3008 if ( eventType.length === 0 && origCount !== eventType.length ) { 3009 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { 3010 jQuery.removeEvent( elem, type, elemData.handle ); 3011 } 3012 3013 delete events[ type ]; 3014 } 3015 } 3016 3017 // Remove the expando if it's no longer used 3018 if ( jQuery.isEmptyObject( events ) ) { 3019 handle = elemData.handle; 3020 if ( handle ) { 3021 handle.elem = null; 3022 } 3023
3024 // removeData also checks for emptiness and clears the expando if empty 3025 // so use it instead of delete 3026 jQuery.removeData( elem, [ "events", "handle" ], true ); 3027 } 3028 }, 3029 3030 // Events that are safe to short-circuit if no handlers are attached. 3031 // Native DOM events should not be added, they may have inline handlers. 3032 customEvent: { 3033 "getData": true, 3034 "setData": true, 3035 "changeData": true 3036 }, 3037 3038 trigger: function( event, data, elem, onlyHandlers ) { 3039 // Don't do events on text and comment nodes 3040 if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { 3041 return; 3042 } 3043 3044 // Event object or event type 3045 var type = event.type || event, 3046 namespaces = [], 3047 cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; 3048 3049 // focus/blur morphs to focusin/out; ensure we're not firing them right now 3050 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 3051 return; 3052 } 3053 3054 if ( type.indexOf( "!" ) >= 0 ) { 3055 // Exclusive events trigger only for the exact event (no namespaces) 3056 type = type.slice(0, -1); 3057 exclusive = true; 3058 } 3059 3060 if ( type.indexOf( "." ) >= 0 ) { 3061 // Namespaced trigger; create a regexp to match event type in handle() 3062 namespaces = type.split("."); 3063 type = namespaces.shift(); 3064 namespaces.sort(); 3065 } 3066 3067 if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { 3068 // No jQuery handlers for this event type, and it can't have inline handlers 3069 return; 3070 } 3071 3072 // Caller can pass in an Event, Object, or just an event type string 3073 event = typeof event === "object" ? 3074 // jQuery.Event object 3075 event[ jQuery.expando ] ? event : 3076 // Object literal 3077 new jQuery.Event( type, event ) : 3078 // Just the event type (string) 3079 new jQuery.Event( type ); 3080 3081 event.type = type; 3082 event.isTrigger = true; 3083 event.exclusive = exclusive; 3084 event.namespace = namespaces.join( "." ); 3085 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 3086 ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; 3087 3088 // Handle a global trigger 3089 if ( !elem ) { 3090 3091 // TODO: Stop taunting the data cache; remove global events and always attach to document 3092 cache = jQuery.cache; 3093 for ( i in cache ) { 3094 if ( cache[ i ].events && cache[ i ].events[ type ] ) { 3095 jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); 3096 } 3097 } 3098 return; 3099 } 3100 3101 // Clean up the event in case it is being reused 3102 event.result = undefined; 3103 if ( !event.target ) { 3104 event.target = elem; 3105 } 3106 3107 // Clone any incoming data and prepend the event, creating the handler arg list 3108 data = data != null ? jQuery.makeArray( data ) : []; 3109 data.unshift( event ); 3110 3111 // Allow special events to draw outside the lines 3112 special = jQuery.event.special[ type ] || {}; 3113 if ( special.trigger && special.trigger.apply( elem, data ) === false ) { 3114 return; 3115 } 3116 3117 // Determine event propagation path in advance, per W3C events spec (#9951) 3118 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 3119 eventPath = [[ elem, special.bindType || type ]]; 3120 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 3121 3122 bubbleType = special.delegateType || type; 3123 cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; 3124 old = null; 3125 for ( ; cur; cur = cur.parentNode ) { 3126 eventPath.push([ cur, bubbleType ]); 3127 old = cur; 3128 } 3129 3130 // Only add window if we got to document (e.g., not plain obj or detached DOM) 3131 if ( old && old === elem.ownerDocument ) { 3132 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); 3133 } 3134 } 3135 3136 // Fire handlers on the event path 3137 for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { 3138 3139 cur = eventPath[i][0]; 3140 event.type = eventPath[i][1]; 3141 3142 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); 3143 if ( handle ) { 3144 handle.apply( cur, data ); 3145 } 3146 // Note that this is a bare JS function and not a jQuery handler 3147 handle = ontype && cur[ ontype ]; 3148 if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { 3149 event.preventDefault(); 3150 } 3151 } 3152 event.type = type; 3153 3154 // If nobody prevented the default action, do it now 3155 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 3156 3157 if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && 3158 !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { 3159 3160 // Call a native DOM method on the target with the same name name as the event. 3161 // Can't use an .isFunction() check here because IE6/7 fails that test. 3162 // Don't do default actions on window, that's where global variables be (#6170) 3163 // IE<9 dies on focus/blur to hidden element (#1486) 3164 if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { 3165 3166 // Don't re-trigger an onFOO event when we call its FOO() method 3167 old = elem[ ontype ]; 3168 3169 if ( old ) { 3170 elem[ ontype ] = null; 3171 } 3172 3173 // Prevent re-triggering of the same event, since we already bubbled it above 3174 jQuery.event.triggered = type; 3175 elem[ type ](); 3176 jQuery.event.triggered = undefined; 3177 3178 if ( old ) { 3179 elem[ ontype ] = old; 3180 } 3181 } 3182 } 3183 } 3184 3185 return event.result; 3186 }, 3187 3188 dispatch: function( event ) { 3189 3190 // Make a writable jQuery.Event from the native event object 3191 event = jQuery.event.fix( event || window.event ); 3192 3193 var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), 3194 delegateCount = handlers.delegateCount, 3195 args = [].slice.call( arguments, 0 ), 3196 run_all = !event.exclusive && !event.namespace, 3197 handlerQueue = [], 3198 i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; 3199 3200 // Use the fix-ed jQuery.Event rather than the (read-only) native event 3201 args[0] = event; 3202 event.delegateTarget = this; 3203 3204 // Determine handlers that should run if there are delegated events 3205 // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) 3206 if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { 3207 3208 // Pregenerate a single jQuery object for reuse with .is() 3209 jqcur = jQuery(this); 3210 jqcur.context = this.ownerDocument || this; 3211 3212 for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { 3213 selMatch = {}; 3214 matches = []; 3215 jqcur[0] = cur; 3216 for ( i = 0; i < delegateCount; i++ ) { 3217 handleObj = handlers[ i ]; 3218 sel = handleObj.selector; 3219 3220 if ( selMatch[ sel ] === undefined ) { 3221 selMatch[ sel ] = ( 3222 handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) 3223 ); 3224 } 3225 if ( selMatch[ sel ] ) { 3226 matches.push( handleObj ); 3227 } 3228 } 3229 if ( matches.length ) { 3230 handlerQueue.push({ elem: cur, matches: matches }); 3231 } 3232 } 3233 } 3234 3235 // Add the remaining (directly-bound) handlers 3236 if ( handlers.length > delegateCount ) { 3237 handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); 3238 } 3239 3240 // Run delegates first; they may want to stop propagation beneath us 3241 for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { 3242 matched = handlerQueue[ i ]; 3243 event.currentTarget = matched.elem; 3244 3245 for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { 3246 handleObj = matched.matches[ j ]; 3247 3248 // Triggered event must either 1) be non-exclusive and have no namespace, or 3249 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 3250 if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { 3251 3252 event.data = handleObj.data; 3253 event.handleObj = handleObj; 3254 3255 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) 3256 .apply( matched.elem, args ); 3257 3258 if ( ret !== undefined ) { 3259 event.result = ret; 3260 if ( ret === false ) { 3261 event.preventDefault(); 3262 event.stopPropagation(); 3263 } 3264 } 3265 } 3266 } 3267 } 3268 3269 return event.result; 3270 }, 3271 3272 // Includes some event props shared by KeyEvent and MouseEvent 3273 // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** 3274 props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 3275 3276 fixHooks: {}, 3277 3278 keyHooks: {
vendor: 15,758 bytes, lines 3279-3840
3279 props: "char charCode key keyCode".split(" "), 3280 filter: function( event, original ) { 3281 3282 // Add which for key events 3283 if ( event.which == null ) { 3284 event.which = original.charCode != null ? original.charCode : original.keyCode; 3285 } 3286 3287 return event; 3288 } 3289 }, 3290 3291 mouseHooks: { 3292 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 3293 filter: function( event, original ) { 3294 var eventDoc, doc, body, 3295 button = original.button, 3296 fromElement = original.fromElement; 3297 3298 // Calculate pageX/Y if missing and clientX/Y available 3299 if ( event.pageX == null && original.clientX != null ) { 3300 eventDoc = event.target.ownerDocument || document; 3301 doc = eventDoc.documentElement; 3302 body = eventDoc.body; 3303 3304 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 3305 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); 3306 } 3307 3308 // Add relatedTarget, if necessary 3309 if ( !event.relatedTarget && fromElement ) { 3310 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 3311 } 3312 3313 // Add which for click: 1 === left; 2 === middle; 3 === right 3314 // Note: button is not normalized, so don't use it 3315 if ( !event.which && button !== undefined ) { 3316 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 3317 } 3318 3319 return event; 3320 } 3321 }, 3322 3323 fix: function( event ) { 3324 if ( event[ jQuery.expando ] ) { 3325 return event; 3326 } 3327 3328 // Create a writable copy of the event object and normalize some properties 3329 var i, prop, 3330 originalEvent = event, 3331 fixHook = jQuery.event.fixHooks[ event.type ] || {}, 3332 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 3333 3334 event = jQuery.Event( originalEvent ); 3335 3336 for ( i = copy.length; i; ) { 3337 prop = copy[ --i ]; 3338 event[ prop ] = originalEvent[ prop ]; 3339 } 3340 3341 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) 3342 if ( !event.target ) { 3343 event.target = originalEvent.srcElement || document; 3344 } 3345 3346 // Target should not be a text node (#504, Safari) 3347 if ( event.target.nodeType === 3 ) { 3348 event.target = event.target.parentNode; 3349 } 3350 3351 // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) 3352 if ( event.metaKey === undefined ) { 3353 event.metaKey = event.ctrlKey; 3354 } 3355 3356 return fixHook.filter? fixHook.filter( event, originalEvent ) : event; 3357 }, 3358 3359 special: { 3360 ready: { 3361 // Make sure the ready event is setup 3362 setup: jQuery.bindReady 3363 }, 3364 3365 load: { 3366 // Prevent triggered image.load events from bubbling to window.load 3367 noBubble: true 3368 }, 3369 3370 focus: { 3371 delegateType: "focusin" 3372 }, 3373 blur: { 3374 delegateType: "focusout" 3375 }, 3376 3377 beforeunload: { 3378 setup: function( data, namespaces, eventHandle ) { 3379 // We only want to do this special case on windows 3380 if ( jQuery.isWindow( this ) ) { 3381 this.onbeforeunload = eventHandle; 3382 } 3383 }, 3384 3385 teardown: function( namespaces, eventHandle ) { 3386 if ( this.onbeforeunload === eventHandle ) { 3387 this.onbeforeunload = null; 3388 } 3389 } 3390 } 3391 }, 3392 3393 simulate: function( type, elem, event, bubble ) { 3394 // Piggyback on a donor event to simulate a different one. 3395 // Fake originalEvent to avoid donor's stopPropagation, but if the 3396 // simulated event prevents default then we do the same on the donor. 3397 var e = jQuery.extend( 3398 new jQuery.Event(), 3399 event, 3400 { type: type, 3401 isSimulated: true, 3402 originalEvent: {} 3403 } 3404 ); 3405 if ( bubble ) { 3406 jQuery.event.trigger( e, null, elem ); 3407 } else { 3408 jQuery.event.dispatch.call( elem, e ); 3409 } 3410 if ( e.isDefaultPrevented() ) { 3411 event.preventDefault(); 3412 } 3413 } 3414}; 3415 3416// Some plugins are using, but it's undocumented/deprecated and will be removed. 3417// The 1.7 special event interface should provide all the hooks needed now. 3418jQuery.event.handle = jQuery.event.dispatch; 3419 3420jQuery.removeEvent = document.removeEventListener ? 3421 function( elem, type, handle ) { 3422 if ( elem.removeEventListener ) { 3423 elem.removeEventListener( type, handle, false ); 3424 } 3425 } : 3426 function( elem, type, handle ) { 3427 if ( elem.detachEvent ) { 3428 elem.detachEvent( "on" + type, handle ); 3429 } 3430 }; 3431 3432jQuery.Event = function( src, props ) { 3433 // Allow instantiation without the 'new' keyword 3434 if ( !(this instanceof jQuery.Event) ) { 3435 return new jQuery.Event( src, props ); 3436 } 3437 3438 // Event object 3439 if ( src && src.type ) { 3440 this.originalEvent = src; 3441 this.type = src.type; 3442 3443 // Events bubbling up the document may have been marked as prevented 3444 // by a handler lower down the tree; reflect the correct value. 3445 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || 3446 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; 3447 3448 // Event type 3449 } else { 3450 this.type = src; 3451 } 3452 3453 // Put explicitly provided properties onto the event object 3454 if ( props ) { 3455 jQuery.extend( this, props ); 3456 } 3457 3458 // Create a timestamp if incoming event doesn't have one 3459 this.timeStamp = src && src.timeStamp || jQuery.now(); 3460 3461 // Mark it as fixed 3462 this[ jQuery.expando ] = true; 3463}; 3464 3465function returnFalse() { 3466 return false; 3467} 3468function returnTrue() { 3469 return true; 3470} 3471 3472// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 3473// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 3474jQuery.Event.prototype = { 3475 preventDefault: function() { 3476 this.isDefaultPrevented = returnTrue; 3477 3478 var e = this.originalEvent; 3479 if ( !e ) { 3480 return; 3481 } 3482 3483 // if preventDefault exists run it on the original event 3484 if ( e.preventDefault ) { 3485 e.preventDefault(); 3486 3487 // otherwise set the returnValue property of the original event to false (IE) 3488 } else { 3489 e.returnValue = false; 3490 } 3491 }, 3492 stopPropagation: function() { 3493 this.isPropagationStopped = returnTrue; 3494 3495 var e = this.originalEvent; 3496 if ( !e ) { 3497 return; 3498 } 3499 // if stopPropagation exists run it on the original event 3500 if ( e.stopPropagation ) { 3501 e.stopPropagation(); 3502 } 3503 // otherwise set the cancelBubble property of the original event to true (IE) 3504 e.cancelBubble = true; 3505 }, 3506 stopImmediatePropagation: function() { 3507 this.isImmediatePropagationStopped = returnTrue; 3508 this.stopPropagation(); 3509 }, 3510 isDefaultPrevented: returnFalse, 3511 isPropagationStopped: returnFalse, 3512 isImmediatePropagationStopped: returnFalse 3513}; 3514 3515// Create mouseenter/leave events using mouseover/out and event-time checks 3516jQuery.each({ 3517 mouseenter: "mouseover", 3518 mouseleave: "mouseout" 3519}, function( orig, fix ) { 3520 jQuery.event.special[ orig ] = { 3521 delegateType: fix, 3522 bindType: fix, 3523 3524 handle: function( event ) { 3525 var target = this, 3526 related = event.relatedTarget, 3527 handleObj = event.handleObj, 3528 selector = handleObj.selector, 3529 ret; 3530 3531 // For mousenter/leave call the handler if related is outside the target. 3532 // NB: No relatedTarget if the mouse left/entered the browser window 3533 if ( !related || (related !== target && !jQuery.contains( target, related )) ) { 3534 event.type = handleObj.origType; 3535 ret = handleObj.handler.apply( this, arguments ); 3536 event.type = fix; 3537 } 3538 return ret; 3539 } 3540 }; 3541}); 3542 3543// IE submit delegation 3544if ( !jQuery.support.submitBubbles ) { 3545 3546 jQuery.event.special.submit = { 3547 setup: function() { 3548 // Only need this for delegated form submit events 3549 if ( jQuery.nodeName( this, "form" ) ) { 3550 return false; 3551 } 3552 3553 // Lazy-add a submit handler when a descendant form may potentially be submitted 3554 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 3555 // Node name check avoids a VML-related crash in IE (#9807) 3556 var elem = e.target, 3557 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; 3558 if ( form && !form._submit_attached ) { 3559 jQuery.event.add( form, "submit._submit", function( event ) { 3560 // If form was submitted by the user, bubble the event up the tree 3561 if ( this.parentNode && !event.isTrigger ) { 3562 jQuery.event.simulate( "submit", this.parentNode, event, true ); 3563 } 3564 }); 3565 form._submit_attached = true; 3566 } 3567 }); 3568 // return undefined since we don't need an event listener 3569 }, 3570 3571 teardown: function() { 3572 // Only need this for delegated form submit events 3573 if ( jQuery.nodeName( this, "form" ) ) { 3574 return false; 3575 } 3576 3577 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 3578 jQuery.event.remove( this, "._submit" ); 3579 } 3580 }; 3581} 3582 3583// IE change delegation and checkbox/radio fix 3584if ( !jQuery.support.changeBubbles ) { 3585 3586 jQuery.event.special.change = { 3587 3588 setup: function() { 3589 3590 if ( rformElems.test( this.nodeName ) ) { 3591 // IE doesn't fire change on a check/radio until blur; trigger it on click 3592 // after a propertychange. Eat the blur-change in special.change.handle. 3593 // This still fires onchange a second time for check/radio after blur. 3594 if ( this.type === "checkbox" || this.type === "radio" ) { 3595 jQuery.event.add( this, "propertychange._change", function( event ) { 3596 if ( event.originalEvent.propertyName === "checked" ) { 3597 this._just_changed = true; 3598 } 3599 }); 3600 jQuery.event.add( this, "click._change", function( event ) { 3601 if ( this._just_changed && !event.isTrigger ) { 3602 this._just_changed = false; 3603 jQuery.event.simulate( "change", this, event, true ); 3604 } 3605 }); 3606 } 3607 return false; 3608 } 3609 // Delegated event; lazy-add a change handler on descendant inputs 3610 jQuery.event.add( this, "beforeactivate._change", function( e ) { 3611 var elem = e.target; 3612 3613 if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { 3614 jQuery.event.add( elem, "change._change", function( event ) { 3615 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 3616 jQuery.event.simulate( "change", this.parentNode, event, true ); 3617 } 3618 }); 3619 elem._change_attached = true; 3620 } 3621 }); 3622 }, 3623 3624 handle: function( event ) { 3625 var elem = event.target; 3626 3627 // Swallow native change events from checkbox/radio, we already triggered them above 3628 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { 3629 return event.handleObj.handler.apply( this, arguments ); 3630 } 3631 }, 3632 3633 teardown: function() { 3634 jQuery.event.remove( this, "._change" ); 3635 3636 return rformElems.test( this.nodeName ); 3637 } 3638 }; 3639} 3640 3641// Create "bubbling" focus and blur events 3642if ( !jQuery.support.focusinBubbles ) { 3643 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { 3644 3645 // Attach a single capturing handler while someone wants focusin/focusout 3646 var attaches = 0, 3647 handler = function( event ) { 3648 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); 3649 }; 3650 3651 jQuery.event.special[ fix ] = { 3652 setup: function() { 3653 if ( attaches++ === 0 ) { 3654 document.addEventListener( orig, handler, true ); 3655 } 3656 }, 3657 teardown: function() { 3658 if ( --attaches === 0 ) { 3659 document.removeEventListener( orig, handler, true ); 3660 } 3661 } 3662 }; 3663 }); 3664} 3665 3666jQuery.fn.extend({ 3667 3668 on: function( types, selector, data, fn, /*INTERNAL*/ one ) { 3669 var origFn, type; 3670 3671 // Types can be a map of types/handlers 3672 if ( typeof types === "object" ) { 3673 // ( types-Object, selector, data ) 3674 if ( typeof selector !== "string" ) { 3675 // ( types-Object, data ) 3676 data = selector; 3677 selector = undefined; 3678 } 3679 for ( type in types ) { 3680 this.on( type, selector, data, types[ type ], one ); 3681 } 3682 return this; 3683 } 3684 3685 if ( data == null && fn == null ) { 3686 // ( types, fn ) 3687 fn = selector; 3688 data = selector = undefined; 3689 } else if ( fn == null ) { 3690 if ( typeof selector === "string" ) { 3691 // ( types, selector, fn ) 3692 fn = data; 3693 data = undefined; 3694 } else { 3695 // ( types, data, fn ) 3696 fn = data; 3697 data = selector; 3698 selector = undefined; 3699 } 3700 } 3701 if ( fn === false ) { 3702 fn = returnFalse; 3703 } else if ( !fn ) { 3704 return this; 3705 } 3706 3707 if ( one === 1 ) { 3708 origFn = fn; 3709 fn = function( event ) { 3710 // Can use an empty set, since event contains the info 3711 jQuery().off( event ); 3712 return origFn.apply( this, arguments ); 3713 }; 3714 // Use same guid so caller can remove using origFn 3715 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 3716 } 3717 return this.each( function() { 3718 jQuery.event.add( this, types, fn, data, selector ); 3719 }); 3720 }, 3721 one: function( types, selector, data, fn ) { 3722 return this.on.call( this, types, selector, data, fn, 1 ); 3723 }, 3724 off: function( types, selector, fn ) { 3725 if ( types && types.preventDefault && types.handleObj ) { 3726 // ( event ) dispatched jQuery.Event 3727 var handleObj = types.handleObj; 3728 jQuery( types.delegateTarget ).off( 3729 handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, 3730 handleObj.selector, 3731 handleObj.handler 3732 ); 3733 return this; 3734 } 3735 if ( typeof types === "object" ) { 3736 // ( types-object [, selector] ) 3737 for ( var type in types ) { 3738 this.off( type, selector, types[ type ] ); 3739 } 3740 return this; 3741 } 3742 if ( selector === false || typeof selector === "function" ) { 3743 // ( types [, fn] ) 3744 fn = selector; 3745 selector = undefined; 3746 } 3747 if ( fn === false ) { 3748 fn = returnFalse; 3749 } 3750 return this.each(function() { 3751 jQuery.event.remove( this, types, fn, selector ); 3752 }); 3753 }, 3754 3755 bind: function( types, data, fn ) { 3756 return this.on( types, null, data, fn ); 3757 }, 3758 unbind: function( types, fn ) { 3759 return this.off( types, null, fn ); 3760 }, 3761 3762 live: function( types, data, fn ) { 3763 jQuery( this.context ).on( types, this.selector, data, fn ); 3764 return this; 3765 }, 3766 die: function( types, fn ) { 3767 jQuery( this.context ).off( types, this.selector || "**", fn ); 3768 return this; 3769 }, 3770 3771 delegate: function( selector, types, data, fn ) { 3772 return this.on( types, selector, data, fn ); 3773 }, 3774 undelegate: function( selector, types, fn ) { 3775 // ( namespace ) or ( selector, types [, fn] ) 3776 return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); 3777 }, 3778 3779 trigger: function( type, data ) { 3780 return this.each(function() { 3781 jQuery.event.trigger( type, data, this ); 3782 }); 3783 }, 3784 triggerHandler: function( type, data ) { 3785 if ( this[0] ) { 3786 return jQuery.event.trigger( type, data, this[0], true ); 3787 } 3788 }, 3789 3790 toggle: function( fn ) { 3791 // Save reference to arguments for access in closure 3792 var args = arguments, 3793 guid = fn.guid || jQuery.guid++, 3794 i = 0, 3795 toggler = function( event ) { 3796 // Figure out which function to execute 3797 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; 3798 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); 3799 3800 // Make sure that clicks stop 3801 event.preventDefault(); 3802 3803 // and execute the function 3804 return args[ lastToggle ].apply( this, arguments ) || false; 3805 }; 3806 3807 // link all the functions, so any of them can unbind this click handler 3808 toggler.guid = guid; 3809 while ( i < args.length ) { 3810 args[ i++ ].guid = guid; 3811 } 3812 3813 return this.click( toggler ); 3814 }, 3815 3816 hover: function( fnOver, fnOut ) { 3817 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 3818 } 3819}); 3820 3821jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 3822 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 3823 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 3824 3825 // Handle event binding 3826 jQuery.fn[ name ] = function( data, fn ) { 3827 if ( fn == null ) { 3828 fn = data; 3829 data = null; 3830 } 3831 3832 return arguments.length > 0 ? 3833 this.on( name, null, data, fn ) : 3834 this.trigger( name ); 3835 }; 3836 3837 if ( jQuery.attrFn ) { 3838 jQuery.attrFn[ name ] = true; 3839 } 3840
3841 if ( rkeyEvent.test( name ) ) { 3842 jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; 3843 } 3844 3845 if ( rmouseEvent.test( name ) ) { 3846 jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; 3847 } 3848}); 3849 3850 3851 3852/*! 3853 * Sizzle CSS Selector Engine 3854 * Copyright 2011, The Dojo Foundation 3855 * Released under the MIT, BSD, and GPL Licenses. 3856 * More information: http://sizzlejs.com/ 3857 */ 3858(function(){ 3859 3860var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 3861 expando = "sizcache" + (Math.random() + '').replace('.', ''), 3862 done = 0, 3863 toString = Object.prototype.toString, 3864 hasDuplicate = false, 3865 baseHasDuplicate = true, 3866 rBackslash = /\\/g, 3867 rReturn = /\r\n/g, 3868 rNonWord = /\W/; 3869 3870// Here we check if the JavaScript engine is using some sort of 3871// optimization where it does not always call our comparision 3872// function. If that is the case, discard the hasDuplicate value. 3873// Thus far that includes Google Chrome. 3874[0, 0].sort(function() { 3875 baseHasDuplicate = false; 3876 return 0; 3877}); 3878 3879var Sizzle = function( selector, context, results, seed ) { 3880 results = results || []; 3881 context = context || document; 3882 3883 var origContext = context; 3884 3885 if ( context.nodeType !== 1 && context.nodeType !== 9 ) { 3886 return []; 3887 } 3888 3889 if ( !selector || typeof selector !== "string" ) { 3890 return results; 3891 } 3892 3893 var m, set, checkSet, extra, ret, cur, pop, i, 3894 prune = true, 3895 contextXML = Sizzle.isXML( context ), 3896 parts = [], 3897 soFar = selector; 3898 3899 // Reset the position of the chunker regexp (start from head) 3900 do { 3901 chunker.exec( "" ); 3902 m = chunker.exec( soFar ); 3903 3904 if ( m ) { 3905 soFar = m[3]; 3906 3907 parts.push( m[1] ); 3908 3909 if ( m[2] ) { 3910 extra = m[3]; 3911 break; 3912 } 3913 } 3914 } while ( m ); 3915 3916 if ( parts.length > 1 && origPOS.exec( selector ) ) { 3917 3918 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 3919 set = posProcess( parts[0] + parts[1], context, seed ); 3920 3921 } else { 3922 set = Expr.relative[ parts[0] ] ? 3923 [ context ] : 3924 Sizzle( parts.shift(), context ); 3925 3926 while ( parts.length ) { 3927 selector = parts.shift(); 3928 3929 if ( Expr.relative[ selector ] ) { 3930 selector += parts.shift(); 3931 } 3932 3933 set = posProcess( selector, set, seed ); 3934 } 3935 } 3936 3937 } else { 3938 // Take a shortcut and set the context if the root selector is an ID 3939 // (but not if it'll be faster if the inner selector is an ID) 3940 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 3941 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { 3942 3943 ret = Sizzle.find( parts.shift(), context, contextXML ); 3944 context = ret.expr ? 3945 Sizzle.filter( ret.expr, ret.set )[0] : 3946 ret.set[0]; 3947 } 3948 3949 if ( context ) { 3950 ret = seed ? 3951 { expr: parts.pop(), set: makeArray(seed) } : 3952 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); 3953 3954 set = ret.expr ? 3955 Sizzle.filter( ret.expr, ret.set ) : 3956 ret.set; 3957 3958 if ( parts.length > 0 ) { 3959 checkSet = makeArray( set ); 3960 3961 } else { 3962 prune = false;
3963 } 3964 3965 while ( parts.length ) { 3966 cur = parts.pop(); 3967 pop = cur; 3968 3969 if ( !Expr.relative[ cur ] ) { 3970 cur = ""; 3971 } else { 3972 pop = parts.pop(); 3973 } 3974 3975 if ( pop == null ) { 3976 pop = context; 3977 } 3978 3979 Expr.relative[ cur ]( checkSet, pop, contextXML ); 3980 } 3981 3982 } else { 3983 checkSet = parts = []; 3984 } 3985 } 3986 3987 if ( !checkSet ) { 3988 checkSet = set; 3989 } 3990 3991 if ( !checkSet ) { 3992 Sizzle.error( cur || selector ); 3993 } 3994 3995 if ( toString.call(checkSet) === "[object Array]" ) { 3996 if ( !prune ) { 3997 results.push.apply( results, checkSet ); 3998 3999 } else if ( context && context.nodeType === 1 ) { 4000 for ( i = 0; checkSet[i] != null; i++ ) { 4001 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { 4002 results.push( set[i] ); 4003 } 4004 } 4005 4006 } else { 4007 for ( i = 0; checkSet[i] != null; i++ ) { 4008 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 4009 results.push( set[i] ); 4010 } 4011 } 4012 } 4013 4014 } else { 4015 makeArray( checkSet, results ); 4016 } 4017 4018 if ( extra ) { 4019 Sizzle( extra, origContext, results, seed ); 4020 Sizzle.uniqueSort( results ); 4021 } 4022 4023 return results; 4024}; 4025 4026Sizzle.uniqueSort = function( results ) { 4027 if ( sortOrder ) { 4028 hasDuplicate = baseHasDuplicate; 4029 results.sort( sortOrder ); 4030 4031 if ( hasDuplicate ) { 4032 for ( var i = 1; i < results.length; i++ ) { 4033 if ( results[i] === results[ i - 1 ] ) { 4034 results.splice( i--, 1 ); 4035 } 4036 } 4037 } 4038 } 4039 4040 return results; 4041}; 4042 4043Sizzle.matches = function( expr, set ) { 4044 return Sizzle( expr, null, null, set ); 4045}; 4046 4047Sizzle.matchesSelector = function( node, expr ) { 4048 return Sizzle( expr, null, null, [node] ).length > 0; 4049}; 4050 4051Sizzle.find = function( expr, context, isXML ) { 4052 var set, i, len, match, type, left; 4053 4054 if ( !expr ) { 4055 return []; 4056 } 4057 4058 for ( i = 0, len = Expr.order.length; i < len; i++ ) { 4059 type = Expr.order[i]; 4060 4061 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { 4062 left = match[1]; 4063 match.splice( 1, 1 ); 4064 4065 if ( left.substr( left.length - 1 ) !== "\\" ) { 4066 match[1] = (match[1] || "").replace( rBackslash, "" ); 4067 set = Expr.find[ type ]( match, context, isXML ); 4068 4069 if ( set != null ) { 4070 expr = expr.replace( Expr.match[ type ], "" ); 4071 break; 4072 } 4073 } 4074 } 4075 } 4076 4077 if ( !set ) { 4078 set = typeof context.getElementsByTagName !== "undefined" ? 4079 context.getElementsByTagName( "*" ) : 4080 []; 4081 } 4082 4083 return { set: set, expr: expr }; 4084}; 4085 4086Sizzle.filter = function( expr, set, inplace, not ) { 4087 var match, anyFound, 4088 type, found, item, filter, left, 4089 i, pass, 4090 old = expr, 4091 result = [], 4092 curLoop = set, 4093 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); 4094 4095 while ( expr && set.length ) { 4096 for ( type in Expr.filter ) { 4097 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { 4098 filter = Expr.filter[ type ]; 4099 left = match[1]; 4100 4101 anyFound = false; 4102 4103 match.splice(1,1); 4104 4105 if ( left.substr( left.length - 1 ) === "\\" ) { 4106 continue; 4107 } 4108 4109 if ( curLoop === result ) { 4110 result = []; 4111 } 4112 4113 if ( Expr.preFilter[ type ] ) { 4114 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); 4115 4116 if ( !match ) { 4117 anyFound = found = true; 4118 4119 } else if ( match === true ) { 4120 continue; 4121 } 4122 } 4123 4124 if ( match ) { 4125 for ( i = 0; (item = curLoop[i]) != null; i++ ) { 4126 if ( item ) { 4127 found = filter( item, match, i, curLoop ); 4128 pass = not ^ found; 4129 4130 if ( inplace && found != null ) { 4131 if ( pass ) { 4132 anyFound = true; 4133 4134 } else { 4135 curLoop[i] = false; 4136 } 4137 4138 } else if ( pass ) { 4139 result.push( item ); 4140 anyFound = true; 4141 } 4142 } 4143 } 4144 } 4145 4146 if ( found !== undefined ) { 4147 if ( !inplace ) { 4148 curLoop = result; 4149 } 4150 4151 expr = expr.replace( Expr.match[ type ], "" ); 4152 4153 if ( !anyFound ) { 4154 return []; 4155 } 4156 4157 break; 4158 } 4159 } 4160 } 4161 4162 // Improper expression 4163 if ( expr === old ) { 4164 if ( anyFound == null ) { 4165 Sizzle.error( expr ); 4166 4167 } else { 4168 break; 4169 } 4170 } 4171 4172 old = expr; 4173 } 4174 4175 return curLoop; 4176}; 4177 4178Sizzle.error = function( msg ) { 4179 throw new Error( "Syntax error, unrecognized expression: " + msg ); 4180}; 4181 4182/** 4183 * Utility function for retreiving the text value of an array of DOM nodes 4184 * @param {Array|Element} elem 4185 */ 4186var getText = Sizzle.getText = function( elem ) { 4187 var i, node, 4188 nodeType = elem.nodeType, 4189 ret = ""; 4190 4191 if ( nodeType ) { 4192 if ( nodeType === 1 || nodeType === 9 ) { 4193 // Use textContent || innerText for elements 4194 if ( typeof elem.textContent === 'string' ) { 4195 return elem.textContent; 4196 } else if ( typeof elem.innerText === 'string' ) { 4197 // Replace IE's carriage returns 4198 return elem.innerText.replace( rReturn, '' ); 4199 } else { 4200 // Traverse it's children 4201 for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { 4202 ret += getText( elem ); 4203 } 4204 } 4205 } else if ( nodeType === 3 || nodeType === 4 ) { 4206 return elem.nodeValue; 4207 } 4208 } else { 4209 4210 // If no nodeType, this is expected to be an array 4211 for ( i = 0; (node = elem[i]); i++ ) {
4212 // Do not traverse comment nodes 4213 if ( node.nodeType !== 8 ) { 4214 ret += getText( node ); 4215 } 4216 } 4217 } 4218 return ret; 4219}; 4220 4221var Expr = Sizzle.selectors = { 4222 order: [ "ID", "NAME", "TAG" ], 4223 4224 match: { 4225 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4226 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4227 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, 4228 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, 4229 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, 4230 CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, 4231 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, 4232 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ 4233 }, 4234 4235 leftMatch: {}, 4236 4237 attrMap: { 4238 "class": "className", 4239 "for": "htmlFor" 4240 }, 4241 4242 attrHandle: { 4243 href: function( elem ) { 4244 return elem.getAttribute( "href" ); 4245 }, 4246 type: function( elem ) { 4247 return elem.getAttribute( "type" ); 4248 } 4249 }, 4250 4251 relative: { 4252 "+": function(checkSet, part){ 4253 var isPartStr = typeof part === "string", 4254 isTag = isPartStr && !rNonWord.test( part ), 4255 isPartStrNotTag = isPartStr && !isTag; 4256 4257 if ( isTag ) { 4258 part = part.toLowerCase(); 4259 } 4260 4261 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { 4262 if ( (elem = checkSet[i]) ) { 4263 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} 4264 4265 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? 4266 elem || false : 4267 elem === part; 4268 } 4269 } 4270 4271 if ( isPartStrNotTag ) { 4272 Sizzle.filter( part, checkSet, true ); 4273 } 4274 }, 4275 4276 ">": function( checkSet, part ) { 4277 var elem, 4278 isPartStr = typeof part === "string", 4279 i = 0, 4280 l = checkSet.length; 4281 4282 if ( isPartStr && !rNonWord.test( part ) ) { 4283 part = part.toLowerCase(); 4284 4285 for ( ; i < l; i++ ) { 4286 elem = checkSet[i]; 4287 4288 if ( elem ) { 4289 var parent = elem.parentNode; 4290 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; 4291 } 4292 } 4293 4294 } else { 4295 for ( ; i < l; i++ ) { 4296 elem = checkSet[i]; 4297 4298 if ( elem ) { 4299 checkSet[i] = isPartStr ? 4300 elem.parentNode : 4301 elem.parentNode === part; 4302 } 4303 } 4304 4305 if ( isPartStr ) { 4306 Sizzle.filter( part, checkSet, true ); 4307 } 4308 } 4309 }, 4310 4311 "": function(checkSet, part, isXML){ 4312 var nodeCheck, 4313 doneName = done++, 4314 checkFn = dirCheck; 4315 4316 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4317 part = part.toLowerCase(); 4318 nodeCheck = part; 4319 checkFn = dirNodeCheck; 4320 } 4321 4322 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); 4323 }, 4324 4325 "~": function( checkSet, part, isXML ) { 4326 var nodeCheck, 4327 doneName = done++, 4328 checkFn = dirCheck; 4329 4330 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4331 part = part.toLowerCase(); 4332 nodeCheck = part; 4333 checkFn = dirNodeCheck; 4334 } 4335 4336 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); 4337 } 4338 }, 4339 4340 find: { 4341 ID: function( match, context, isXML ) { 4342 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4343 var m = context.getElementById(match[1]); 4344 // Check parentNode to catch when Blackberry 4.6 returns 4345 // nodes that are no longer in the document #6963 4346 return m && m.parentNode ? [m] : []; 4347 } 4348 }, 4349 4350 NAME: function( match, context ) { 4351 if ( typeof context.getElementsByName !== "undefined" ) { 4352 var ret = [], 4353 results = context.getElementsByName( match[1] ); 4354 4355 for ( var i = 0, l = results.length; i < l; i++ ) { 4356 if ( results[i].getAttribute("name") === match[1] ) { 4357 ret.push( results[i] ); 4358 } 4359 } 4360 4361 return ret.length === 0 ? null : ret; 4362 } 4363 }, 4364 4365 TAG: function( match, context ) { 4366 if ( typeof context.getElementsByTagName !== "undefined" ) { 4367 return context.getElementsByTagName( match[1] ); 4368 } 4369 } 4370 }, 4371 preFilter: { 4372 CLASS: function( match, curLoop, inplace, result, not, isXML ) { 4373 match = " " + match[1].replace( rBackslash, "" ) + " "; 4374 4375 if ( isXML ) { 4376 return match; 4377 } 4378 4379 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { 4380 if ( elem ) { 4381 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { 4382 if ( !inplace ) { 4383 result.push( elem ); 4384 } 4385 4386 } else if ( inplace ) { 4387 curLoop[i] = false;
4388 } 4389 } 4390 } 4391 4392 return false; 4393 }, 4394 4395 ID: function( match ) { 4396 return match[1].replace( rBackslash, "" ); 4397 }, 4398 4399 TAG: function( match, curLoop ) { 4400 return match[1].replace( rBackslash, "" ).toLowerCase(); 4401 }, 4402 4403 CHILD: function( match ) { 4404 if ( match[1] === "nth" ) { 4405 if ( !match[2] ) { 4406 Sizzle.error( match[0] ); 4407 } 4408 4409 match[2] = match[2].replace(/^\+|\s*/g, ''); 4410 4411 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 4412 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( 4413 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || 4414 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 4415 4416 // calculate the numbers (first)n+(last) including if they are negative 4417 match[2] = (test[1] + (test[2] || 1)) - 0; 4418 match[3] = test[3] - 0; 4419 } 4420 else if ( match[2] ) { 4421 Sizzle.error( match[0] ); 4422 } 4423 4424 // TODO: Move to normal caching system 4425 match[0] = done++; 4426 4427 return match; 4428 }, 4429 4430 ATTR: function( match, curLoop, inplace, result, not, isXML ) { 4431 var name = match[1] = match[1].replace( rBackslash, "" ); 4432 4433 if ( !isXML && Expr.attrMap[name] ) { 4434 match[1] = Expr.attrMap[name]; 4435 } 4436 4437 // Handle if an un-quoted value was used 4438 match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); 4439 4440 if ( match[2] === "~=" ) { 4441 match[4] = " " + match[4] + " "; 4442 } 4443 4444 return match; 4445 }, 4446 4447 PSEUDO: function( match, curLoop, inplace, result, not ) { 4448 if ( match[1] === "not" ) { 4449 // If we're dealing with a complex expression, or a simple one 4450 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { 4451 match[3] = Sizzle(match[3], null, null, curLoop); 4452 4453 } else { 4454 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 4455 4456 if ( !inplace ) { 4457 result.push.apply( result, ret ); 4458 } 4459 4460 return false; 4461 } 4462 4463 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { 4464 return true; 4465 } 4466 4467 return match; 4468 }, 4469 4470 POS: function( match ) { 4471 match.unshift( true ); 4472 4473 return match; 4474 } 4475 }, 4476 4477 filters: { 4478 enabled: function( elem ) { 4479 return elem.disabled === false && elem.type !== "hidden"; 4480 }, 4481 4482 disabled: function( elem ) { 4483 return elem.disabled === true; 4484 }, 4485 4486 checked: function( elem ) { 4487 return elem.checked === true; 4488 }, 4489 4490 selected: function( elem ) { 4491 // Accessing this property makes selected-by-default 4492 // options in Safari work properly 4493 if ( elem.parentNode ) { 4494 elem.parentNode.selectedIndex; 4495 } 4496 4497 return elem.selected === true; 4498 }, 4499 4500 parent: function( elem ) { 4501 return !!elem.firstChild; 4502 }, 4503 4504 empty: function( elem ) { 4505 return !elem.firstChild; 4506 }, 4507 4508 has: function( elem, i, match ) { 4509 return !!Sizzle( match[3], elem ).length; 4510 }, 4511 4512 header: function( elem ) { 4513 return (/h\d/i).test( elem.nodeName ); 4514 }, 4515 4516 text: function( elem ) { 4517 var attr = elem.getAttribute( "type" ), type = elem.type; 4518 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 4519 // use getAttribute instead to test this case 4520 return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); 4521 }, 4522 4523 radio: function( elem ) { 4524 return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; 4525 }, 4526 4527 checkbox: function( elem ) { 4528 return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; 4529 }, 4530 4531 file: function( elem ) { 4532 return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; 4533 }, 4534 4535 password: function( elem ) { 4536 return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; 4537 }, 4538 4539 submit: function( elem ) { 4540 var name = elem.nodeName.toLowerCase(); 4541 return (name === "input" || name === "button") && "submit" === elem.type; 4542 }, 4543 4544 image: function( elem ) { 4545 return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; 4546 }, 4547 4548 reset: function( elem ) { 4549 var name = elem.nodeName.toLowerCase(); 4550 return (name === "input" || name === "button") && "reset" === elem.type; 4551 }, 4552 4553 button: function( elem ) { 4554 var name = elem.nodeName.toLowerCase(); 4555 return name === "input" && "button" === elem.type || name === "button"; 4556 }, 4557 4558 input: function( elem ) { 4559 return (/input|select|textarea|button/i).test( elem.nodeName ); 4560 }, 4561 4562 focus: function( elem ) { 4563 return elem === elem.ownerDocument.activeElement; 4564 } 4565 }, 4566 setFilters: { 4567 first: function( elem, i ) { 4568 return i === 0; 4569 }, 4570 4571 last: function( elem, i, match, array ) { 4572 return i === array.length - 1; 4573 }, 4574 4575 even: function( elem, i ) { 4576 return i % 2 === 0; 4577 }, 4578 4579 odd: function( elem, i ) { 4580 return i % 2 === 1; 4581 }, 4582 4583 lt: function( elem, i, match ) { 4584 return i < match[3] - 0; 4585 }, 4586 4587 gt: function( elem, i, match ) { 4588 return i > match[3] - 0; 4589 }, 4590 4591 nth: function( elem, i, match ) { 4592 return match[3] - 0 === i; 4593 }, 4594 4595 eq: function( elem, i, match ) { 4596 return match[3] - 0 === i; 4597 } 4598 }, 4599 filter: { 4600 PSEUDO: function( elem, match, i, array ) { 4601 var name = match[1], 4602 filter = Expr.filters[ name ]; 4603 4604 if ( filter ) { 4605 return filter( elem, i, match, array ); 4606 4607 } else if ( name === "contains" ) { 4608 return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; 4609 4610 } else if ( name === "not" ) { 4611 var not = match[3]; 4612 4613 for ( var j = 0, l = not.length; j < l; j++ ) { 4614 if ( not[j] === elem ) { 4615 return false;
4616 } 4617 } 4618 4619 return true; 4620 4621 } else { 4622 Sizzle.error( name ); 4623 } 4624 }, 4625 4626 CHILD: function( elem, match ) { 4627 var first, last, 4628 doneName, parent, cache, 4629 count, diff, 4630 type = match[1], 4631 node = elem; 4632 4633 switch ( type ) { 4634 case "only": 4635 case "first": 4636 while ( (node = node.previousSibling) ) { 4637 if ( node.nodeType === 1 ) { 4638 return false; 4639 } 4640 } 4641 4642 if ( type === "first" ) { 4643 return true; 4644 } 4645 4646 node = elem; 4647 4648 case "last": 4649 while ( (node = node.nextSibling) ) { 4650 if ( node.nodeType === 1 ) { 4651 return false; 4652 } 4653 } 4654 4655 return true; 4656 4657 case "nth": 4658 first = match[2]; 4659 last = match[3]; 4660 4661 if ( first === 1 && last === 0 ) { 4662 return true; 4663 } 4664 4665 doneName = match[0]; 4666 parent = elem.parentNode; 4667 4668 if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { 4669 count = 0; 4670 4671 for ( node = parent.firstChild; node; node = node.nextSibling ) { 4672 if ( node.nodeType === 1 ) { 4673 node.nodeIndex = ++count; 4674 } 4675 } 4676 4677 parent[ expando ] = doneName; 4678 } 4679 4680 diff = elem.nodeIndex - last; 4681 4682 if ( first === 0 ) { 4683 return diff === 0; 4684 4685 } else { 4686 return ( diff % first === 0 && diff / first >= 0 ); 4687 } 4688 } 4689 }, 4690 4691 ID: function( elem, match ) { 4692 return elem.nodeType === 1 && elem.getAttribute("id") === match; 4693 }, 4694 4695 TAG: function( elem, match ) { 4696 return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; 4697 }, 4698 4699 CLASS: function( elem, match ) { 4700 return (" " + (elem.className || elem.getAttribute("class")) + " ") 4701 .indexOf( match ) > -1; 4702 }, 4703 4704 ATTR: function( elem, match ) { 4705 var name = match[1], 4706 result = Sizzle.attr ? 4707 Sizzle.attr( elem, name ) : 4708 Expr.attrHandle[ name ] ? 4709 Expr.attrHandle[ name ]( elem ) : 4710 elem[ name ] != null ? 4711 elem[ name ] : 4712 elem.getAttribute( name ), 4713 value = result + "", 4714 type = match[2], 4715 check = match[4]; 4716 4717 return result == null ? 4718 type === "!=" : 4719 !type && Sizzle.attr ? 4720 result != null : 4721 type === "=" ? 4722 value === check : 4723 type === "*=" ? 4724 value.indexOf(check) >= 0 : 4725 type === "~=" ? 4726 (" " + value + " ").indexOf(check) >= 0 : 4727 !check ? 4728 value && result !== false : 4729 type === "!=" ? 4730 value !== check : 4731 type === "^=" ? 4732 value.indexOf(check) === 0 : 4733 type === "$=" ? 4734 value.substr(value.length - check.length) === check : 4735 type === "|=" ? 4736 value === check || value.substr(0, check.length + 1) === check + "-" : 4737 false; 4738 }, 4739 4740 POS: function( elem, match, i, array ) { 4741 var name = match[2], 4742 filter = Expr.setFilters[ name ]; 4743 4744 if ( filter ) { 4745 return filter( elem, i, match, array ); 4746 } 4747 } 4748 } 4749}; 4750 4751var origPOS = Expr.match.POS, 4752 fescape = function(all, num){ 4753 return "\\" + (num - 0 + 1); 4754 }; 4755 4756for ( var type in Expr.match ) { 4757 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); 4758 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); 4759} 4760 4761var makeArray = function( array, results ) { 4762 array = Array.prototype.slice.call( array, 0 ); 4763 4764 if ( results ) { 4765 results.push.apply( results, array ); 4766 return results; 4767 } 4768 4769 return array; 4770}; 4771 4772// Perform a simple check to determine if the browser is capable of 4773// converting a NodeList to an array using builtin methods. 4774// Also verifies that the returned array holds DOM nodes 4775// (which is not the case in the Blackberry browser) 4776try { 4777 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; 4778 4779// Provide a fallback method if it does not work 4780} catch( e ) { 4781 makeArray = function( array, results ) { 4782 var i = 0, 4783 ret = results || []; 4784 4785 if ( toString.call(array) === "[object Array]" ) { 4786 Array.prototype.push.apply( ret, array ); 4787 4788 } else { 4789 if ( typeof array.length === "number" ) { 4790 for ( var l = array.length; i < l; i++ ) { 4791 ret.push( array[i] ); 4792 } 4793 4794 } else { 4795 for ( ; array[i]; i++ ) {
4796 ret.push( array[i] ); 4797 } 4798 } 4799 } 4800 4801 return ret; 4802 }; 4803} 4804 4805var sortOrder, siblingCheck; 4806 4807if ( document.documentElement.compareDocumentPosition ) { 4808 sortOrder = function( a, b ) { 4809 if ( a === b ) { 4810 hasDuplicate = true; 4811 return 0; 4812 } 4813 4814 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { 4815 return a.compareDocumentPosition ? -1 : 1; 4816 } 4817 4818 return a.compareDocumentPosition(b) & 4 ? -1 : 1; 4819 }; 4820 4821} else { 4822 sortOrder = function( a, b ) { 4823 // The nodes are identical, we can exit early 4824 if ( a === b ) { 4825 hasDuplicate = true; 4826 return 0; 4827 4828 // Fallback to using sourceIndex (in IE) if it's available on both nodes 4829 } else if ( a.sourceIndex && b.sourceIndex ) { 4830 return a.sourceIndex - b.sourceIndex; 4831 } 4832 4833 var al, bl, 4834 ap = [], 4835 bp = [], 4836 aup = a.parentNode, 4837 bup = b.parentNode, 4838 cur = aup; 4839 4840 // If the nodes are siblings (or identical) we can do a quick check 4841 if ( aup === bup ) { 4842 return siblingCheck( a, b ); 4843 4844 // If no parents were found then the nodes are disconnected 4845 } else if ( !aup ) { 4846 return -1; 4847 4848 } else if ( !bup ) { 4849 return 1; 4850 } 4851 4852 // Otherwise they're somewhere else in the tree so we need 4853 // to build up a full list of the parentNodes for comparison 4854 while ( cur ) { 4855 ap.unshift( cur ); 4856 cur = cur.parentNode; 4857 } 4858 4859 cur = bup; 4860 4861 while ( cur ) { 4862 bp.unshift( cur ); 4863 cur = cur.parentNode; 4864 } 4865 4866 al = ap.length; 4867 bl = bp.length; 4868 4869 // Start walking down the tree looking for a discrepancy 4870 for ( var i = 0; i < al && i < bl; i++ ) { 4871 if ( ap[i] !== bp[i] ) { 4872 return siblingCheck( ap[i], bp[i] ); 4873 } 4874 } 4875 4876 // We ended someplace up the tree so do a sibling check 4877 return i === al ? 4878 siblingCheck( a, bp[i], -1 ) : 4879 siblingCheck( ap[i], b, 1 ); 4880 }; 4881 4882 siblingCheck = function( a, b, ret ) { 4883 if ( a === b ) { 4884 return ret; 4885 } 4886 4887 var cur = a.nextSibling; 4888 4889 while ( cur ) { 4890 if ( cur === b ) { 4891 return -1; 4892 } 4893 4894 cur = cur.nextSibling; 4895 } 4896 4897 return 1; 4898 }; 4899} 4900 4901// Check to see if the browser returns elements by name when 4902// querying by getElementById (and provide a workaround) 4903(function(){ 4904 // We're going to inject a fake input element with a specified name 4905 var form = document.createElement("div"), 4906 id = "script" + (new Date()).getTime(), 4907 root = document.documentElement; 4908 4909 form.innerHTML = "<a name='" + id + "'/>"; 4910 4911 // Inject it into the root element, check its status, and remove it quickly 4912 root.insertBefore( form, root.firstChild ); 4913 4914 // The workaround has to do additional checks after a getElementById 4915 // Which slows things down for other browsers (hence the branching) 4916 if ( document.getElementById( id ) ) { 4917 Expr.find.ID = function( match, context, isXML ) { 4918 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4919 var m = context.getElementById(match[1]); 4920 4921 return m ? 4922 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? 4923 [m] : 4924 undefined : 4925 []; 4926 } 4927 }; 4928 4929 Expr.filter.ID = function( elem, match ) { 4930 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 4931 4932 return elem.nodeType === 1 && node && node.nodeValue === match; 4933 }; 4934 } 4935 4936 root.removeChild( form ); 4937 4938 // release memory in IE 4939 root = form = null; 4940})(); 4941 4942(function(){ 4943 // Check to see if the browser returns only elements 4944 // when doing getElementsByTagName("*") 4945 4946 // Create a fake element 4947 var div = document.createElement("div"); 4948 div.appendChild( document.createComment("") ); 4949 4950 // Make sure no comments are found 4951 if ( div.getElementsByTagName("*").length > 0 ) { 4952 Expr.find.TAG = function( match, context ) { 4953 var results = context.getElementsByTagName( match[1] ); 4954 4955 // Filter out possible comments 4956 if ( match[1] === "*" ) { 4957 var tmp = []; 4958 4959 for ( var i = 0; results[i]; i++ ) { 4960 if ( results[i].nodeType === 1 ) { 4961 tmp.push( results[i] ); 4962 } 4963 } 4964 4965 results = tmp; 4966 } 4967 4968 return results; 4969 }; 4970 } 4971 4972 // Check to see if an attribute returns normalized href attributes 4973 div.innerHTML = "<a href='#'></a>"; 4974 4975 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && 4976 div.firstChild.getAttribute("href") !== "#" ) { 4977 4978 Expr.attrHandle.href = function( elem ) { 4979 return elem.getAttribute( "href", 2 ); 4980 }; 4981 } 4982 4983 // release memory in IE 4984 div = null; 4985})(); 4986 4987if ( document.querySelectorAll ) { 4988 (function(){
4989 var oldSizzle = Sizzle, 4990 div = document.createElement("div"), 4991 id = "__sizzle__"; 4992 4993 div.innerHTML = "<p class='TEST'></p>"; 4994 4995 // Safari can't handle uppercase or unicode characters when 4996 // in quirks mode. 4997 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { 4998 return; 4999 } 5000 5001 Sizzle = function( query, context, extra, seed ) { 5002 context = context || document; 5003 5004 // Only use querySelectorAll on non-XML documents 5005 // (ID selectors don't work in non-HTML documents) 5006 if ( !seed && !Sizzle.isXML(context) ) { 5007 // See if we find a selector to speed up 5008 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); 5009 5010 if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { 5011 // Speed-up: Sizzle("TAG") 5012 if ( match[1] ) { 5013 return makeArray( context.getElementsByTagName( query ), extra ); 5014 5015 // Speed-up: Sizzle(".CLASS") 5016 } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { 5017 return makeArray( context.getElementsByClassName( match[2] ), extra ); 5018 } 5019 } 5020 5021 if ( context.nodeType === 9 ) { 5022 // Speed-up: Sizzle("body") 5023 // The body element only exists once, optimize finding it 5024 if ( query === "body" && context.body ) { 5025 return makeArray( [ context.body ], extra ); 5026 5027 // Speed-up: Sizzle("#ID") 5028 } else if ( match && match[3] ) { 5029 var elem = context.getElementById( match[3] ); 5030 5031 // Check parentNode to catch when Blackberry 4.6 returns 5032 // nodes that are no longer in the document #6963 5033 if ( elem && elem.parentNode ) { 5034 // Handle the case where IE and Opera return items 5035 // by name instead of ID 5036 if ( elem.id === match[3] ) { 5037 return makeArray( [ elem ], extra ); 5038 } 5039 5040 } else { 5041 return makeArray( [], extra ); 5042 } 5043 } 5044 5045 try { 5046 return makeArray( context.querySelectorAll(query), extra ); 5047 } catch(qsaError) {} 5048 5049 // qSA works strangely on Element-rooted queries 5050 // We can work around this by specifying an extra ID on the root 5051 // and working up from there (Thanks to Andrew Dupont for the technique) 5052 // IE 8 doesn't work on object elements 5053 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { 5054 var oldContext = context, 5055 old = context.getAttribute( "id" ), 5056 nid = old || id, 5057 hasParent = context.parentNode, 5058 relativeHierarchySelector = /^\s*[+~]/.test( query ); 5059 5060 if ( !old ) { 5061 context.setAttribute( "id", nid ); 5062 } else { 5063 nid = nid.replace( /'/g, "\\$&" ); 5064 } 5065 if ( relativeHierarchySelector && hasParent ) { 5066 context = context.parentNode; 5067 } 5068 5069 try { 5070 if ( !relativeHierarchySelector || hasParent ) { 5071 return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); 5072 } 5073 5074 } catch(pseudoError) { 5075 } finally { 5076 if ( !old ) { 5077 oldContext.removeAttribute( "id" ); 5078 } 5079 } 5080 } 5081 } 5082 5083 return oldSizzle(query, context, extra, seed); 5084 }; 5085 5086 for ( var prop in oldSizzle ) { 5087 Sizzle[ prop ] = oldSizzle[ prop ]; 5088 } 5089 5090 // release memory in IE 5091 div = null; 5092 })(); 5093} 5094 5095(function(){ 5096 var html = document.documentElement, 5097 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; 5098 5099 if ( matches ) { 5100 // Check to see if it's possible to do matchesSelector 5101 // on a disconnected node (IE 9 fails this) 5102 var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), 5103 pseudoWorks = false; 5104 5105 try { 5106 // This should fail with an exception 5107 // Gecko does not error, returns false instead
5108 matches.call( document.documentElement, "[test!='']:sizzle" ); 5109 5110 } catch( pseudoError ) { 5111 pseudoWorks = true; 5112 } 5113 5114 Sizzle.matchesSelector = function( node, expr ) { 5115 // Make sure that attribute selectors are quoted 5116 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); 5117 5118 if ( !Sizzle.isXML( node ) ) { 5119 try { 5120 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { 5121 var ret = matches.call( node, expr ); 5122 5123 // IE 9's matchesSelector returns false on disconnected nodes 5124 if ( ret || !disconnectedMatch || 5125 // As well, disconnected nodes are said to be in a document 5126 // fragment in IE 9, so check for that 5127 node.document && node.document.nodeType !== 11 ) { 5128 return ret; 5129 } 5130 } 5131 } catch(e) {} 5132 } 5133 5134 return Sizzle(expr, null, null, [node]).length > 0; 5135 }; 5136 } 5137})(); 5138 5139(function(){ 5140 var div = document.createElement("div"); 5141 5142 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 5143 5144 // Opera can't find a second classname (in 9.6) 5145 // Also, make sure that getElementsByClassName actually exists 5146 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { 5147 return; 5148 } 5149 5150 // Safari caches class attributes, doesn't catch changes (in 3.2) 5151 div.lastChild.className = "e"; 5152 5153 if ( div.getElementsByClassName("e").length === 1 ) { 5154 return; 5155 } 5156 5157 Expr.order.splice(1, 0, "CLASS"); 5158 Expr.find.CLASS = function( match, context, isXML ) { 5159 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { 5160 return context.getElementsByClassName(match[1]); 5161 } 5162 }; 5163 5164 // release memory in IE 5165 div = null; 5166})(); 5167 5168function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 5169 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 5170 var elem = checkSet[i]; 5171 5172 if ( elem ) { 5173 var match = false; 5174 5175 elem = elem[dir]; 5176 5177 while ( elem ) { 5178 if ( elem[ expando ] === doneName ) { 5179 match = checkSet[elem.sizset]; 5180 break; 5181 } 5182 5183 if ( elem.nodeType === 1 && !isXML ){ 5184 elem[ expando ] = doneName; 5185 elem.sizset = i; 5186 } 5187 5188 if ( elem.nodeName.toLowerCase() === cur ) { 5189 match = elem; 5190 break; 5191 } 5192 5193 elem = elem[dir]; 5194 } 5195 5196 checkSet[i] = match; 5197 } 5198 } 5199} 5200 5201function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 5202 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 5203 var elem = checkSet[i]; 5204 5205 if ( elem ) { 5206 var match = false; 5207 5208 elem = elem[dir]; 5209 5210 while ( elem ) { 5211 if ( elem[ expando ] === doneName ) { 5212 match = checkSet[elem.sizset]; 5213 break; 5214 } 5215 5216 if ( elem.nodeType === 1 ) { 5217 if ( !isXML ) { 5218 elem[ expando ] = doneName; 5219 elem.sizset = i; 5220 } 5221 5222 if ( typeof cur !== "string" ) { 5223 if ( elem === cur ) { 5224 match = true; 5225 break; 5226 } 5227 5228 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { 5229 match = elem; 5230 break; 5231 } 5232 } 5233 5234 elem = elem[dir]; 5235 } 5236 5237 checkSet[i] = match; 5238 } 5239 } 5240} 5241 5242if ( document.documentElement.contains ) { 5243 Sizzle.contains = function( a, b ) { 5244 return a !== b && (a.contains ? a.contains(b) : true); 5245 }; 5246 5247} else if ( document.documentElement.compareDocumentPosition ) { 5248 Sizzle.contains = function( a, b ) { 5249 return !!(a.compareDocumentPosition(b) & 16); 5250 }; 5251 5252} else { 5253 Sizzle.contains = function() { 5254 return false; 5255 }; 5256} 5257 5258Sizzle.isXML = function( elem ) { 5259 // documentElement is verified for cases where it doesn't yet exist 5260 // (such as loading iframes in IE - #4833) 5261 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; 5262 5263 return documentElement ? documentElement.nodeName !== "HTML" : false; 5264}; 5265 5266var posProcess = function( selector, context, seed ) { 5267 var match, 5268 tmpSet = [], 5269 later = "", 5270 root = context.nodeType ? [context] : context; 5271 5272 // Position selectors must be done after the filter 5273 // And so must :not(positional) so we move all PSEUDOs to the end 5274 while ( (match = Expr.match.PSEUDO.exec( selector )) ) { 5275 later += match[0]; 5276 selector = selector.replace( Expr.match.PSEUDO, "" ); 5277 } 5278 5279 selector = Expr.relative[selector] ? selector + "*" : selector; 5280 5281 for ( var i = 0, l = root.length; i < l; i++ ) { 5282 Sizzle( selector, root[i], tmpSet, seed ); 5283 } 5284 5285 return Sizzle.filter( later, tmpSet ); 5286}; 5287 5288// EXPOSE 5289// Override sizzle attribute retrieval 5290Sizzle.attr = jQuery.attr; 5291Sizzle.selectors.attrMap = {}; 5292jQuery.find = Sizzle; 5293jQuery.expr = Sizzle.selectors; 5294jQuery.expr[":"] = jQuery.expr.filters; 5295jQuery.unique = Sizzle.uniqueSort; 5296jQuery.text = Sizzle.getText; 5297jQuery.isXMLDoc = Sizzle.isXML; 5298jQuery.contains = Sizzle.contains; 5299 5300 5301})(); 5302 5303 5304var runtil = /Until$/, 5305 rparentsprev = /^(?:parents|prevUntil|prevAll)/, 5306 // Note: This RegExp should be improved, or likely pulled from Sizzle 5307 rmultiselector = /,/, 5308 isSimple = /^.[^:#\[\.,]*$/, 5309 slice = Array.prototype.slice, 5310 POS = jQuery.expr.match.POS, 5311 // methods guaranteed to produce a unique set when starting from a unique set 5312 guaranteedUnique = { 5313 children: true, 5314 contents: true, 5315 next: true, 5316 prev: true 5317 }; 5318 5319jQuery.fn.extend({ 5320 find: function( selector ) { 5321 var self = this, 5322 i, l; 5323 5324 if ( typeof selector !== "string" ) {
5325 return jQuery( selector ).filter(function() { 5326 for ( i = 0, l = self.length; i < l; i++ ) { 5327 if ( jQuery.contains( self[ i ], this ) ) { 5328 return true; 5329 } 5330 } 5331 }); 5332 } 5333 5334 var ret = this.pushStack( "", "find", selector ), 5335 length, n, r; 5336 5337 for ( i = 0, l = this.length; i < l; i++ ) { 5338 length = ret.length; 5339 jQuery.find( selector, this[i], ret ); 5340 5341 if ( i > 0 ) { 5342 // Make sure that the results are unique 5343 for ( n = length; n < ret.length; n++ ) { 5344 for ( r = 0; r < length; r++ ) { 5345 if ( ret[r] === ret[n] ) { 5346 ret.splice(n--, 1); 5347 break; 5348 } 5349 } 5350 } 5351 } 5352 } 5353 5354 return ret; 5355 }, 5356 5357 has: function( target ) { 5358 var targets = jQuery( target ); 5359 return this.filter(function() { 5360 for ( var i = 0, l = targets.length; i < l; i++ ) { 5361 if ( jQuery.contains( this, targets[i] ) ) { 5362 return true; 5363 } 5364 } 5365 }); 5366 }, 5367 5368 not: function( selector ) { 5369 return this.pushStack( winnow(this, selector, false), "not", selector); 5370 }, 5371 5372 filter: function( selector ) { 5373 return this.pushStack( winnow(this, selector, true), "filter", selector ); 5374 }, 5375 5376 is: function( selector ) { 5377 return !!selector && ( 5378 typeof selector === "string" ? 5379 // If this is a positional selector, check membership in the returned set 5380 // so $("p:first").is("p:last") won't return true for a doc with two "p". 5381 POS.test( selector ) ? 5382 jQuery( selector, this.context ).index( this[0] ) >= 0 : 5383 jQuery.filter( selector, this ).length > 0 : 5384 this.filter( selector ).length > 0 ); 5385 }, 5386 5387 closest: function( selectors, context ) { 5388 var ret = [], i, l, cur = this[0]; 5389 5390 // Array (deprecated as of jQuery 1.7) 5391 if ( jQuery.isArray( selectors ) ) { 5392 var level = 1; 5393 5394 while ( cur && cur.ownerDocument && cur !== context ) { 5395 for ( i = 0; i < selectors.length; i++ ) { 5396 5397 if ( jQuery( cur ).is( selectors[ i ] ) ) { 5398 ret.push({ selector: selectors[ i ], elem: cur, level: level }); 5399 } 5400 } 5401 5402 cur = cur.parentNode; 5403 level++; 5404 } 5405 5406 return ret; 5407 } 5408 5409 // String 5410 var pos = POS.test( selectors ) || typeof selectors !== "string" ? 5411 jQuery( selectors, context || this.context ) : 5412 0; 5413 5414 for ( i = 0, l = this.length; i < l; i++ ) { 5415 cur = this[i]; 5416 5417 while ( cur ) { 5418 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { 5419 ret.push( cur ); 5420 break; 5421 5422 } else { 5423 cur = cur.parentNode; 5424 if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { 5425 break; 5426 } 5427 } 5428 } 5429 } 5430 5431 ret = ret.length > 1 ? jQuery.unique( ret ) : ret; 5432 5433 return this.pushStack( ret, "closest", selectors ); 5434 }, 5435 5436 // Determine the position of an element within 5437 // the matched set of elements 5438 index: function( elem ) { 5439 5440 // No argument, return index in parent 5441 if ( !elem ) { 5442 return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; 5443 } 5444 5445 // index in selector 5446 if ( typeof elem === "string" ) { 5447 return jQuery.inArray( this[0], jQuery( elem ) ); 5448 } 5449 5450 // Locate the position of the desired element 5451 return jQuery.inArray( 5452 // If it receives a jQuery object, the first element is used 5453 elem.jquery ? elem[0] : elem, this ); 5454 }, 5455 5456 add: function( selector, context ) { 5457 var set = typeof selector === "string" ? 5458 jQuery( selector, context ) : 5459 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), 5460 all = jQuery.merge( this.get(), set ); 5461 5462 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? 5463 all : 5464 jQuery.unique( all ) ); 5465 }, 5466 5467 andSelf: function() { 5468 return this.add( this.prevObject ); 5469 } 5470}); 5471 5472// A painfully simple check to see if an element is disconnected 5473// from a document (should be improved, where feasible). 5474function isDisconnected( node ) { 5475 return !node || !node.parentNode || node.parentNode.nodeType === 11; 5476} 5477 5478jQuery.each({ 5479 parent: function( elem ) { 5480 var parent = elem.parentNode; 5481 return parent && parent.nodeType !== 11 ? parent : null; 5482 }, 5483 parents: function( elem ) { 5484 return jQuery.dir( elem, "parentNode" ); 5485 }, 5486 parentsUntil: function( elem, i, until ) { 5487 return jQuery.dir( elem, "parentNode", until ); 5488 }, 5489 next: function( elem ) { 5490 return jQuery.nth( elem, 2, "nextSibling" ); 5491 }, 5492 prev: function( elem ) { 5493 return jQuery.nth( elem, 2, "previousSibling" ); 5494 }, 5495 nextAll: function( elem ) { 5496 return jQuery.dir( elem, "nextSibling" ); 5497 }, 5498 prevAll: function( elem ) { 5499 return jQuery.dir( elem, "previousSibling" ); 5500 }, 5501 nextUntil: function( elem, i, until ) { 5502 return jQuery.dir( elem, "nextSibling", until ); 5503 }, 5504 prevUntil: function( elem, i, until ) { 5505 return jQuery.dir( elem, "previousSibling", until ); 5506 }, 5507 siblings: function( elem ) { 5508 return jQuery.sibling( elem.parentNode.firstChild, elem ); 5509 }, 5510 children: function( elem ) { 5511 return jQuery.sibling( elem.firstChild ); 5512 }, 5513 contents: function( elem ) { 5514 return jQuery.nodeName( elem, "iframe" ) ? 5515 elem.contentDocument || elem.contentWindow.document : 5516 jQuery.makeArray( elem.childNodes ); 5517 } 5518}, function( name, fn ) { 5519 jQuery.fn[ name ] = function( until, selector ) { 5520 var ret = jQuery.map( this, fn, until ); 5521 5522 if ( !runtil.test( name ) ) { 5523 selector = until; 5524 } 5525 5526 if ( selector && typeof selector === "string" ) { 5527 ret = jQuery.filter( selector, ret ); 5528 } 5529 5530 ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; 5531 5532 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { 5533 ret = ret.reverse(); 5534 } 5535 5536 return this.pushStack( ret, name, slice.call( arguments ).join(",") ); 5537 }; 5538}); 5539 5540jQuery.extend({ 5541 filter: function( expr, elems, not ) { 5542 if ( not ) { 5543 expr = ":not(" + expr + ")"; 5544 } 5545 5546 return elems.length === 1 ? 5547 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : 5548 jQuery.find.matches(expr, elems); 5549 }, 5550 5551 dir: function( elem, dir, until ) { 5552 var matched = [], 5553 cur = elem[ dir ]; 5554 5555 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { 5556 if ( cur.nodeType === 1 ) { 5557 matched.push( cur ); 5558 } 5559 cur = cur[dir]; 5560 } 5561 return matched; 5562 }, 5563 5564 nth: function( cur, result, dir, elem ) { 5565 result = result || 1; 5566 var num = 0; 5567 5568 for ( ; cur; cur = cur[dir] ) { 5569 if ( cur.nodeType === 1 && ++num === result ) { 5570 break; 5571 } 5572 } 5573 5574 return cur; 5575 }, 5576 5577 sibling: function( n, elem ) { 5578 var r = []; 5579 5580 for ( ; n; n = n.nextSibling ) { 5581 if ( n.nodeType === 1 && n !== elem ) { 5582 r.push( n ); 5583 } 5584 } 5585 5586 return r; 5587 } 5588}); 5589 5590// Implement the identical functionality for filter and not 5591function winnow( elements, qualifier, keep ) { 5592 5593 // Can't pass null or undefined to indexOf in Firefox 4 5594 // Set to 0 to skip string check 5595 qualifier = qualifier || 0; 5596 5597 if ( jQuery.isFunction( qualifier ) ) { 5598 return jQuery.grep(elements, function( elem, i ) { 5599 var retVal = !!qualifier.call( elem, i, elem ); 5600 return retVal === keep; 5601 }); 5602 5603 } else if ( qualifier.nodeType ) { 5604 return jQuery.grep(elements, function( elem, i ) { 5605 return ( elem === qualifier ) === keep; 5606 }); 5607 5608 } else if ( typeof qualifier === "string" ) { 5609 var filtered = jQuery.grep(elements, function( elem ) { 5610 return elem.nodeType === 1; 5611 }); 5612 5613 if ( isSimple.test( qualifier ) ) { 5614 return jQuery.filter(qualifier, filtered, !keep); 5615 } else { 5616 qualifier = jQuery.filter( qualifier, filtered ); 5617 } 5618 } 5619 5620 return jQuery.grep(elements, function( elem, i ) { 5621 return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; 5622 }); 5623} 5624 5625 5626 5627 5628function createSafeFragment( document ) { 5629 var list = nodeNames.split( "|" ),
vendor: 3,540 bytes, lines 5630-5767
5630 safeFrag = document.createDocumentFragment(); 5631 5632 if ( safeFrag.createElement ) { 5633 while ( list.length ) { 5634 safeFrag.createElement( 5635 list.pop() 5636 ); 5637 } 5638 } 5639 return safeFrag; 5640} 5641 5642var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + 5643 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 5644 rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, 5645 rleadingWhitespace = /^\s+/, 5646 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, 5647 rtagName = /<([\w:]+)/, 5648 rtbody = /<tbody/i, 5649 rhtml = /<|&#?\w+;/, 5650 rnoInnerhtml = /<(?:script|style)/i, 5651 rnocache = /<(?:script|object|embed|option|style)/i, 5652 rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"), 5653 // checked="checked" or checked 5654 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5655 rscriptType = /\/(java|ecma)script/i, 5656 rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/, 5657 wrapMap = { 5658 option: [ 1, "<select multiple='multiple'>", "</select>" ], 5659 legend: [ 1, "<fieldset>", "</fieldset>" ], 5660 thead: [ 1, "<table>", "</table>" ], 5661 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 5662 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 5663 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 5664 area: [ 1, "<map>", "</map>" ], 5665 _default: [ 0, "", "" ] 5666 }, 5667 safeFragment = createSafeFragment( document ); 5668 5669wrapMap.optgroup = wrapMap.option; 5670wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5671wrapMap.th = wrapMap.td; 5672 5673// IE can't serialize <link> and <script> tags normally 5674if ( !jQuery.support.htmlSerialize ) { 5675 wrapMap._default = [ 1, "div<div>", "</div>" ]; 5676} 5677 5678jQuery.fn.extend({ 5679 text: function( text ) { 5680 if ( jQuery.isFunction(text) ) { 5681 return this.each(function(i) { 5682 var self = jQuery( this ); 5683 5684 self.text( text.call(this, i, self.text()) ); 5685 }); 5686 } 5687 5688 if ( typeof text !== "object" && text !== undefined ) { 5689 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 5690 } 5691 5692 return jQuery.text( this ); 5693 }, 5694 5695 wrapAll: function( html ) { 5696 if ( jQuery.isFunction( html ) ) { 5697 return this.each(function(i) { 5698 jQuery(this).wrapAll( html.call(this, i) ); 5699 }); 5700 } 5701 5702 if ( this[0] ) { 5703 // The elements to wrap the target around 5704 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); 5705 5706 if ( this[0].parentNode ) { 5707 wrap.insertBefore( this[0] ); 5708 } 5709 5710 wrap.map(function() { 5711 var elem = this; 5712 5713 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 5714 elem = elem.firstChild; 5715 } 5716 5717 return elem; 5718 }).append( this ); 5719 } 5720 5721 return this; 5722 }, 5723 5724 wrapInner: function( html ) { 5725 if ( jQuery.isFunction( html ) ) { 5726 return this.each(function(i) { 5727 jQuery(this).wrapInner( html.call(this, i) ); 5728 }); 5729 } 5730 5731 return this.each(function() { 5732 var self = jQuery( this ), 5733 contents = self.contents(); 5734 5735 if ( contents.length ) { 5736 contents.wrapAll( html ); 5737 5738 } else { 5739 self.append( html ); 5740 } 5741 }); 5742 }, 5743 5744 wrap: function( html ) { 5745 var isFunction = jQuery.isFunction( html ); 5746 5747 return this.each(function(i) { 5748 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); 5749 }); 5750 }, 5751 5752 unwrap: function() { 5753 return this.parent().each(function() { 5754 if ( !jQuery.nodeName( this, "body" ) ) { 5755 jQuery( this ).replaceWith( this.childNodes ); 5756 } 5757 }).end(); 5758 }, 5759 5760 append: function() { 5761 return this.domManip(arguments, true, function( elem ) { 5762 if ( this.nodeType === 1 ) { 5763 this.appendChild( elem ); 5764 } 5765 }); 5766 }, 5767
5768 prepend: function() { 5769 return this.domManip(arguments, true, function( elem ) { 5770 if ( this.nodeType === 1 ) { 5771 this.insertBefore( elem, this.firstChild ); 5772 } 5773 }); 5774 }, 5775 5776 before: function() { 5777 if ( this[0] && this[0].parentNode ) { 5778 return this.domManip(arguments, false, function( elem ) { 5779 this.parentNode.insertBefore( elem, this ); 5780 }); 5781 } else if ( arguments.length ) { 5782 var set = jQuery.clean( arguments ); 5783 set.push.apply( set, this.toArray() ); 5784 return this.pushStack( set, "before", arguments ); 5785 } 5786 }, 5787 5788 after: function() { 5789 if ( this[0] && this[0].parentNode ) { 5790 return this.domManip(arguments, false, function( elem ) { 5791 this.parentNode.insertBefore( elem, this.nextSibling ); 5792 }); 5793 } else if ( arguments.length ) { 5794 var set = this.pushStack( this, "after", arguments ); 5795 set.push.apply( set, jQuery.clean(arguments) ); 5796 return set; 5797 } 5798 }, 5799 5800 // keepData is for internal use only--do not document 5801 remove: function( selector, keepData ) { 5802 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 5803 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { 5804 if ( !keepData && elem.nodeType === 1 ) { 5805 jQuery.cleanData( elem.getElementsByTagName("*") ); 5806 jQuery.cleanData( [ elem ] ); 5807 } 5808 5809 if ( elem.parentNode ) { 5810 elem.parentNode.removeChild( elem ); 5811 } 5812 } 5813 } 5814 5815 return this; 5816 }, 5817 5818 empty: function() { 5819 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 5820 // Remove element nodes and prevent memory leaks 5821 if ( elem.nodeType === 1 ) { 5822 jQuery.cleanData( elem.getElementsByTagName("*") ); 5823 } 5824 5825 // Remove any remaining nodes 5826 while ( elem.firstChild ) { 5827 elem.removeChild( elem.firstChild ); 5828 } 5829 } 5830 5831 return this; 5832 }, 5833 5834 clone: function( dataAndEvents, deepDataAndEvents ) { 5835 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5836 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5837 5838 return this.map( function () { 5839 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 5840 }); 5841 }, 5842 5843 html: function( value ) { 5844 if ( value === undefined ) { 5845 return this[0] && this[0].nodeType === 1 ? 5846 this[0].innerHTML.replace(rinlinejQuery, "") : 5847 null; 5848 5849 // See if we can take a shortcut and just use innerHTML 5850 } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 5851 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && 5852 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { 5853 5854 value = value.replace(rxhtmlTag, "<$1></$2>"); 5855 5856 try { 5857 for ( var i = 0, l = this.length; i < l; i++ ) { 5858 // Remove element nodes and prevent memory leaks 5859 if ( this[i].nodeType === 1 ) { 5860 jQuery.cleanData( this[i].getElementsByTagName("*") ); 5861 this[i].innerHTML = value; 5862 } 5863 } 5864 5865 // If using innerHTML throws an exception, use the fallback method 5866 } catch(e) { 5867 this.empty().append( value ); 5868 } 5869 5870 } else if ( jQuery.isFunction( value ) ) { 5871 this.each(function(i){ 5872 var self = jQuery( this ); 5873 5874 self.html( value.call(this, i, self.html()) ); 5875 }); 5876 5877 } else { 5878 this.empty().append( value ); 5879 } 5880 5881 return this; 5882 }, 5883 5884 replaceWith: function( value ) { 5885 if ( this[0] && this[0].parentNode ) { 5886 // Make sure that the elements are removed from the DOM before they are inserted 5887 // this can help fix replacing a parent with child elements 5888 if ( jQuery.isFunction( value ) ) { 5889 return this.each(function(i) { 5890 var self = jQuery(this), old = self.html(); 5891 self.replaceWith( value.call( this, i, old ) ); 5892 }); 5893 } 5894 5895 if ( typeof value !== "string" ) { 5896 value = jQuery( value ).detach(); 5897 } 5898 5899 return this.each(function() { 5900 var next = this.nextSibling, 5901 parent = this.parentNode; 5902 5903 jQuery( this ).remove(); 5904 5905 if ( next ) { 5906 jQuery(next).before( value ); 5907 } else { 5908 jQuery(parent).append( value ); 5909 } 5910 }); 5911 } else { 5912 return this.length ? 5913 this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : 5914 this; 5915 } 5916 }, 5917 5918 detach: function( selector ) { 5919 return this.remove( selector, true ); 5920 }, 5921 5922 domManip: function( args, table, callback ) { 5923 var results, first, fragment, parent, 5924 value = args[0], 5925 scripts = []; 5926 5927 // We can't cloneNode fragments that contain checked, in WebKit 5928 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { 5929 return this.each(function() { 5930 jQuery(this).domManip( args, table, callback, true ); 5931 }); 5932 } 5933 5934 if ( jQuery.isFunction(value) ) { 5935 return this.each(function(i) { 5936 var self = jQuery(this); 5937 args[0] = value.call(this, i, table ? self.html() : undefined); 5938 self.domManip( args, table, callback ); 5939 }); 5940 } 5941 5942 if ( this[0] ) { 5943 parent = value && value.parentNode; 5944 5945 // If we're in a fragment, just use that instead of building a new one 5946 if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { 5947 results = { fragment: parent }; 5948 5949 } else { 5950 results = jQuery.buildFragment( args, this, scripts ); 5951 } 5952 5953 fragment = results.fragment; 5954 5955 if ( fragment.childNodes.length === 1 ) { 5956 first = fragment = fragment.firstChild; 5957 } else { 5958 first = fragment.firstChild; 5959 } 5960 5961 if ( first ) { 5962 table = table && jQuery.nodeName( first, "tr" ); 5963 5964 for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { 5965 callback.call( 5966 table ? 5967 root(this[i], first) : 5968 this[i], 5969 // Make sure that we do not leak memory by inadvertently discarding 5970 // the original fragment (which might have attached data) instead of 5971 // using it; in addition, use the original fragment object for the last 5972 // item instead of first because it can end up being emptied incorrectly 5973 // in certain situations (Bug #8070). 5974 // Fragments from the fragment cache must always be cloned and never used 5975 // in place. 5976 results.cacheable || ( l > 1 && i < lastIndex ) ? 5977 jQuery.clone( fragment, true, true ) : 5978 fragment 5979 ); 5980 } 5981 } 5982 5983 if ( scripts.length ) { 5984 jQuery.each( scripts, evalScript ); 5985 } 5986 } 5987 5988 return this; 5989 } 5990}); 5991 5992function root( elem, cur ) { 5993 return jQuery.nodeName(elem, "table") ? 5994 (elem.getElementsByTagName("tbody")[0] || 5995 elem.appendChild(elem.ownerDocument.createElement("tbody"))) : 5996 elem; 5997} 5998 5999function cloneCopyEvent( src, dest ) { 6000
6001 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 6002 return; 6003 } 6004 6005 var type, i, l, 6006 oldData = jQuery._data( src ), 6007 curData = jQuery._data( dest, oldData ), 6008 events = oldData.events; 6009 6010 if ( events ) { 6011 delete curData.handle; 6012 curData.events = {}; 6013 6014 for ( type in events ) { 6015 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6016 jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); 6017 } 6018 } 6019 } 6020 6021 // make the cloned public data object a copy from the original 6022 if ( curData.data ) { 6023 curData.data = jQuery.extend( {}, curData.data ); 6024 } 6025} 6026 6027function cloneFixAttributes( src, dest ) { 6028 var nodeName; 6029 6030 // We do not need to do anything for non-Elements 6031 if ( dest.nodeType !== 1 ) { 6032 return; 6033 } 6034 6035 // clearAttributes removes the attributes, which we don't want, 6036 // but also removes the attachEvent events, which we *do* want 6037 if ( dest.clearAttributes ) { 6038 dest.clearAttributes(); 6039 } 6040 6041 // mergeAttributes, in contrast, only merges back on the 6042 // original attributes, not the events 6043 if ( dest.mergeAttributes ) { 6044 dest.mergeAttributes( src ); 6045 } 6046 6047 nodeName = dest.nodeName.toLowerCase(); 6048 6049 // IE6-8 fail to clone children inside object elements that use 6050 // the proprietary classid attribute value (rather than the type 6051 // attribute) to identify the type of content to display 6052 if ( nodeName === "object" ) { 6053 dest.outerHTML = src.outerHTML; 6054 6055 } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { 6056 // IE6-8 fails to persist the checked state of a cloned checkbox 6057 // or radio button. Worse, IE6-7 fail to give the cloned element 6058 // a checked appearance if the defaultChecked value isn't also set 6059 if ( src.checked ) { 6060 dest.defaultChecked = dest.checked = src.checked; 6061 } 6062 6063 // IE6-7 get confused and end up setting the value of a cloned 6064 // checkbox/radio button to an empty string instead of "on" 6065 if ( dest.value !== src.value ) { 6066 dest.value = src.value; 6067 } 6068 6069 // IE6-8 fails to return the selected option to the default selected 6070 // state when cloning options 6071 } else if ( nodeName === "option" ) { 6072 dest.selected = src.defaultSelected; 6073 6074 // IE6-8 fails to set the defaultValue to the correct value when 6075 // cloning other types of input fields 6076 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6077 dest.defaultValue = src.defaultValue; 6078 } 6079 6080 // Event data gets referenced instead of copied if the expando 6081 // gets copied too 6082 dest.removeAttribute( jQuery.expando ); 6083} 6084 6085jQuery.buildFragment = function( args, nodes, scripts ) { 6086 var fragment, cacheable, cacheresults, doc, 6087 first = args[ 0 ]; 6088 6089 // nodes may contain either an explicit document object, 6090 // a jQuery collection or context object. 6091 // If nodes[0] contains a valid object to assign to doc 6092 if ( nodes && nodes[0] ) { 6093 doc = nodes[0].ownerDocument || nodes[0]; 6094 } 6095 6096 // Ensure that an attr object doesn't incorrectly stand in as a document object 6097 // Chrome and Firefox seem to allow this to occur and will throw exception 6098 // Fixes #8950 6099 if ( !doc.createDocumentFragment ) { 6100 doc = document; 6101 } 6102 6103 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document 6104 // Cloning options loses the selected state, so don't cache them 6105 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment 6106 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache 6107 // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 6108 if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && 6109 first.charAt(0) === "<" && !rnocache.test( first ) && 6110 (jQuery.support.checkClone || !rchecked.test( first )) && 6111 (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { 6112 6113 cacheable = true; 6114 6115 cacheresults = jQuery.fragments[ first ]; 6116 if ( cacheresults && cacheresults !== 1 ) { 6117 fragment = cacheresults; 6118 } 6119 } 6120 6121 if ( !fragment ) { 6122 fragment = doc.createDocumentFragment(); 6123 jQuery.clean( args, doc, fragment, scripts ); 6124 } 6125 6126 if ( cacheable ) {
6127 jQuery.fragments[ first ] = cacheresults ? fragment : 1; 6128 } 6129 6130 return { fragment: fragment, cacheable: cacheable }; 6131}; 6132 6133jQuery.fragments = {}; 6134 6135jQuery.each({ 6136 appendTo: "append", 6137 prependTo: "prepend", 6138 insertBefore: "before", 6139 insertAfter: "after", 6140 replaceAll: "replaceWith" 6141}, function( name, original ) { 6142 jQuery.fn[ name ] = function( selector ) { 6143 var ret = [], 6144 insert = jQuery( selector ), 6145 parent = this.length === 1 && this[0].parentNode; 6146 6147 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { 6148 insert[ original ]( this[0] ); 6149 return this; 6150 6151 } else { 6152 for ( var i = 0, l = insert.length; i < l; i++ ) { 6153 var elems = ( i > 0 ? this.clone(true) : this ).get(); 6154 jQuery( insert[i] )[ original ]( elems ); 6155 ret = ret.concat( elems ); 6156 } 6157 6158 return this.pushStack( ret, name, insert.selector ); 6159 } 6160 }; 6161}); 6162 6163function getAll( elem ) { 6164 if ( typeof elem.getElementsByTagName !== "undefined" ) { 6165 return elem.getElementsByTagName( "*" ); 6166 6167 } else if ( typeof elem.querySelectorAll !== "undefined" ) { 6168 return elem.querySelectorAll( "*" ); 6169 6170 } else { 6171 return []; 6172 } 6173} 6174 6175// Used in clean, fixes the defaultChecked property 6176function fixDefaultChecked( elem ) { 6177 if ( elem.type === "checkbox" || elem.type === "radio" ) { 6178 elem.defaultChecked = elem.checked; 6179 } 6180} 6181// Finds all inputs and passes them to fixDefaultChecked 6182function findInputs( elem ) { 6183 var nodeName = ( elem.nodeName || "" ).toLowerCase(); 6184 if ( nodeName === "input" ) { 6185 fixDefaultChecked( elem ); 6186 // Skip scripts, get other children 6187 } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { 6188 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); 6189 } 6190} 6191 6192// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js 6193function shimCloneNode( elem ) { 6194 var div = document.createElement( "div" ); 6195 safeFragment.appendChild( div ); 6196 6197 div.innerHTML = elem.outerHTML; 6198 return div.firstChild; 6199} 6200 6201jQuery.extend({ 6202 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6203 var srcElements, 6204 destElements, 6205 i, 6206 // IE<=8 does not properly clone detached, unknown element nodes 6207 clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ? 6208 elem.cloneNode( true ) : 6209 shimCloneNode( elem ); 6210 6211 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && 6212 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { 6213 // IE copies events bound via attachEvent when using cloneNode. 6214 // Calling detachEvent on the clone will also remove the events 6215 // from the original. In order to get around this, we use some 6216 // proprietary methods to clear the events. Thanks to MooTools 6217 // guys for this hotness. 6218 6219 cloneFixAttributes( elem, clone ); 6220 6221 // Using Sizzle here is crazy slow, so we use getElementsByTagName instead 6222 srcElements = getAll( elem ); 6223 destElements = getAll( clone ); 6224 6225 // Weird iteration because IE will replace the length property 6226 // with an element if you are cloning the body and one of the 6227 // elements on the page has a name or id of "length" 6228 for ( i = 0; srcElements[i]; ++i ) { 6229 // Ensure that the destination node is not null; Fixes #9587 6230 if ( destElements[i] ) { 6231 cloneFixAttributes( srcElements[i], destElements[i] ); 6232 } 6233 } 6234 } 6235 6236 // Copy the events from the original to the clone 6237 if ( dataAndEvents ) { 6238 cloneCopyEvent( elem, clone ); 6239 6240 if ( deepDataAndEvents ) { 6241 srcElements = getAll( elem ); 6242 destElements = getAll( clone ); 6243 6244 for ( i = 0; srcElements[i]; ++i ) { 6245 cloneCopyEvent( srcElements[i], destElements[i] ); 6246 } 6247 } 6248 } 6249 6250 srcElements = destElements = null; 6251 6252 // Return the cloned set 6253 return clone; 6254 }, 6255 6256 clean: function( elems, context, fragment, scripts ) { 6257 var checkScriptType; 6258 6259 context = context || document; 6260 6261 // !context.createElement fails in IE with an error but returns typeof 'object' 6262 if ( typeof context.createElement === "undefined" ) { 6263 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 6264 } 6265 6266 var ret = [], j; 6267 6268 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 6269 if ( typeof elem === "number" ) { 6270 elem += ""; 6271 } 6272 6273 if ( !elem ) { 6274 continue; 6275 } 6276 6277 // Convert html string into DOM nodes 6278 if ( typeof elem === "string" ) { 6279 if ( !rhtml.test( elem ) ) { 6280 elem = context.createTextNode( elem ); 6281 } else { 6282 // Fix "XHTML"-style tags in all browsers 6283 elem = elem.replace(rxhtmlTag, "<$1></$2>"); 6284 6285 // Trim whitespace, otherwise indexOf won't work as expected 6286 var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), 6287 wrap = wrapMap[ tag ] || wrapMap._default, 6288 depth = wrap[0], 6289 div = context.createElement("div"); 6290 6291 // Append wrapper element to unknown element safe doc fragment 6292 if ( context === document ) { 6293 // Use the fragment we've already created for this document 6294 safeFragment.appendChild( div ); 6295 } else { 6296 // Use a fragment created with the owner document 6297 createSafeFragment( context ).appendChild( div ); 6298 } 6299 6300 // Go to html and back, then peel off extra wrappers 6301 div.innerHTML = wrap[1] + elem + wrap[2]; 6302 6303 // Move to the right depth 6304 while ( depth-- ) {
6305 div = div.lastChild; 6306 } 6307 6308 // Remove IE's autoinserted <tbody> from table fragments 6309 if ( !jQuery.support.tbody ) { 6310 6311 // String was a <table>, *may* have spurious <tbody> 6312 var hasBody = rtbody.test(elem), 6313 tbody = tag === "table" && !hasBody ? 6314 div.firstChild && div.firstChild.childNodes : 6315 6316 // String was a bare <thead> or <tfoot> 6317 wrap[1] === "<table>" && !hasBody ? 6318 div.childNodes : 6319 []; 6320 6321 for ( j = tbody.length - 1; j >= 0 ; --j ) { 6322 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { 6323 tbody[ j ].parentNode.removeChild( tbody[ j ] ); 6324 } 6325 } 6326 } 6327 6328 // IE completely kills leading whitespace when innerHTML is used 6329 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 6330 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); 6331 } 6332 6333 elem = div.childNodes; 6334 } 6335 } 6336 6337 // Resets defaultChecked for any radios and checkboxes 6338 // about to be appended to the DOM in IE 6/7 (#8060) 6339 var len; 6340 if ( !jQuery.support.appendChecked ) { 6341 if ( elem[0] && typeof (len = elem.length) === "number" ) { 6342 for ( j = 0; j < len; j++ ) { 6343 findInputs( elem[j] ); 6344 } 6345 } else { 6346 findInputs( elem ); 6347 } 6348 } 6349 6350 if ( elem.nodeType ) { 6351 ret.push( elem ); 6352 } else { 6353 ret = jQuery.merge( ret, elem ); 6354 } 6355 } 6356 6357 if ( fragment ) { 6358 checkScriptType = function( elem ) { 6359 return !elem.type || rscriptType.test( elem.type ); 6360 }; 6361 for ( i = 0; ret[i]; i++ ) { 6362 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { 6363 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); 6364 6365 } else { 6366 if ( ret[i].nodeType === 1 ) { 6367 var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType ); 6368 6369 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); 6370 } 6371 fragment.appendChild( ret[i] ); 6372 } 6373 } 6374 } 6375 6376 return ret; 6377 }, 6378 6379 cleanData: function( elems ) { 6380 var data, id, 6381 cache = jQuery.cache, 6382 special = jQuery.event.special, 6383 deleteExpando = jQuery.support.deleteExpando; 6384 6385 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 6386 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { 6387 continue; 6388 } 6389 6390 id = elem[ jQuery.expando ]; 6391 6392 if ( id ) { 6393 data = cache[ id ]; 6394 6395 if ( data && data.events ) { 6396 for ( var type in data.events ) { 6397 if ( special[ type ] ) { 6398 jQuery.event.remove( elem, type ); 6399 6400 // This is a shortcut to avoid jQuery.event.remove's overhead 6401 } else { 6402 jQuery.removeEvent( elem, type, data.handle ); 6403 } 6404 } 6405 6406 // Null the DOM reference to avoid IE6/7/8 leak (#7054) 6407 if ( data.handle ) { 6408 data.handle.elem = null; 6409 } 6410 } 6411 6412 if ( deleteExpando ) { 6413 delete elem[ jQuery.expando ]; 6414 6415 } else if ( elem.removeAttribute ) { 6416 elem.removeAttribute( jQuery.expando ); 6417 } 6418 6419 delete cache[ id ]; 6420 } 6421 } 6422 } 6423}); 6424 6425function evalScript( i, elem ) { 6426 if ( elem.src ) { 6427 jQuery.ajax({ 6428 url: elem.src, 6429 async: false, 6430 dataType: "script" 6431 }); 6432 } else { 6433 jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); 6434 } 6435 6436 if ( elem.parentNode ) { 6437 elem.parentNode.removeChild( elem ); 6438 } 6439} 6440 6441 6442 6443 6444var ralpha = /alpha\([^)]*\)/i, 6445 ropacity = /opacity=([^)]*)/, 6446 // fixed for IE9, see #8346 6447 rupper = /([A-Z]|^ms)/g, 6448 rnumpx = /^-?\d+(?:px)?$/i, 6449 rnum = /^-?\d/, 6450 rrelNum = /^([\-+])=([\-+.\de]+)/, 6451 6452 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6453 cssWidth = [ "Left", "Right" ], 6454 cssHeight = [ "Top", "Bottom" ], 6455 curCSS, 6456 6457 getComputedStyle, 6458 currentStyle; 6459 6460jQuery.fn.css = function( name, value ) { 6461 // Setting 'undefined' is a no-op 6462 if ( arguments.length === 2 && value === undefined ) { 6463 return this; 6464 } 6465 6466 return jQuery.access( this, name, value, true, function( elem, name, value ) { 6467 return value !== undefined ? 6468 jQuery.style( elem, name, value ) : 6469 jQuery.css( elem, name ); 6470 }); 6471}; 6472 6473jQuery.extend({ 6474 // Add in style property hooks for overriding the default 6475 // behavior of getting and setting a style property 6476 cssHooks: { 6477 opacity: { 6478 get: function( elem, computed ) { 6479 if ( computed ) { 6480 // We should always get a number back from opacity 6481 var ret = curCSS( elem, "opacity", "opacity" ); 6482 return ret === "" ? "1" : ret; 6483 6484 } else { 6485 return elem.style.opacity; 6486 } 6487 } 6488 } 6489 }, 6490 6491 // Exclude the following css properties to add px 6492 cssNumber: { 6493 "fillOpacity": true, 6494 "fontWeight": true, 6495 "lineHeight": true, 6496 "opacity": true, 6497 "orphans": true, 6498 "widows": true, 6499 "zIndex": true, 6500 "zoom": true 6501 }, 6502 6503 // Add in properties whose names you wish to fix before 6504 // setting or getting the value 6505 cssProps: { 6506 // normalize float css property 6507 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" 6508 }, 6509 6510 // Get and set the style property on a DOM Node 6511 style: function( elem, name, value, extra ) { 6512 // Don't set styles on text and comment nodes 6513 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6514 return; 6515 } 6516 6517 // Make sure that we're working with the right name 6518 var ret, type, origName = jQuery.camelCase( name ), 6519 style = elem.style, hooks = jQuery.cssHooks[ origName ]; 6520 6521 name = jQuery.cssProps[ origName ] || origName; 6522 6523 // Check if we're setting a value 6524 if ( value !== undefined ) { 6525 type = typeof value; 6526 6527 // convert relative number strings (+= or -=) to relative numbers. #7345 6528 if ( type === "string" && (ret = rrelNum.exec( value )) ) { 6529 value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); 6530 // Fixes bug #9237 6531 type = "number"; 6532 } 6533 6534 // Make sure that NaN and null values aren't set. See: #7116 6535 if ( value == null || type === "number" && isNaN( value ) ) { 6536 return; 6537 } 6538 6539 // If a number was passed in, add 'px' to the (except for certain CSS properties) 6540 if ( type === "number" && !jQuery.cssNumber[ origName ] ) { 6541 value += "px"; 6542 } 6543 6544 // If a hook was provided, use that value, otherwise just set the specified value 6545 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
6546 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided 6547 // Fixes bug #5509 6548 try { 6549 style[ name ] = value; 6550 } catch(e) {} 6551 } 6552 6553 } else { 6554 // If a hook was provided get the non-computed value from there 6555 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { 6556 return ret; 6557 } 6558 6559 // Otherwise just get the value from the style object 6560 return style[ name ]; 6561 } 6562 }, 6563 6564 css: function( elem, name, extra ) { 6565 var ret, hooks; 6566 6567 // Make sure that we're working with the right name 6568 name = jQuery.camelCase( name ); 6569 hooks = jQuery.cssHooks[ name ]; 6570 name = jQuery.cssProps[ name ] || name; 6571 6572 // cssFloat needs a special treatment 6573 if ( name === "cssFloat" ) { 6574 name = "float"; 6575 } 6576 6577 // If a hook was provided get the computed value from there 6578 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { 6579 return ret; 6580 6581 // Otherwise, if a way to get the computed value exists, use that 6582 } else if ( curCSS ) { 6583 return curCSS( elem, name ); 6584 } 6585 }, 6586 6587 // A method for quickly swapping in/out CSS properties to get correct calculations 6588 swap: function( elem, options, callback ) { 6589 var old = {}; 6590 6591 // Remember the old values, and insert the new ones 6592 for ( var name in options ) { 6593 old[ name ] = elem.style[ name ]; 6594 elem.style[ name ] = options[ name ]; 6595 } 6596 6597 callback.call( elem ); 6598 6599 // Revert the old values 6600 for ( name in options ) { 6601 elem.style[ name ] = old[ name ]; 6602 } 6603 } 6604}); 6605 6606// DEPRECATED, Use jQuery.css() instead 6607jQuery.curCSS = jQuery.css; 6608 6609jQuery.each(["height", "width"], function( i, name ) { 6610 jQuery.cssHooks[ name ] = { 6611 get: function( elem, computed, extra ) { 6612 var val; 6613 6614 if ( computed ) { 6615 if ( elem.offsetWidth !== 0 ) { 6616 return getWH( elem, name, extra ); 6617 } else { 6618 jQuery.swap( elem, cssShow, function() { 6619 val = getWH( elem, name, extra ); 6620 }); 6621 } 6622 6623 return val; 6624 } 6625 }, 6626 6627 set: function( elem, value ) { 6628 if ( rnumpx.test( value ) ) { 6629 // ignore negative width and height values #1599 6630 value = parseFloat( value ); 6631 6632 if ( value >= 0 ) { 6633 return value + "px"; 6634 } 6635 6636 } else { 6637 return value; 6638 } 6639 } 6640 }; 6641}); 6642 6643if ( !jQuery.support.opacity ) { 6644 jQuery.cssHooks.opacity = { 6645 get: function( elem, computed ) { 6646 // IE uses filters for opacity 6647 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? 6648 ( parseFloat( RegExp.$1 ) / 100 ) + "" : 6649 computed ? "1" : ""; 6650 }, 6651 6652 set: function( elem, value ) { 6653 var style = elem.style, 6654 currentStyle = elem.currentStyle, 6655 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 6656 filter = currentStyle && currentStyle.filter || style.filter || ""; 6657 6658 // IE has trouble with opacity if it does not have layout 6659 // Force it by setting the zoom level 6660 style.zoom = 1; 6661 6662 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 6663 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { 6664 6665 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 6666 // if "filter:" is present at all, clearType is disabled, we want to avoid this 6667 // style.removeAttribute is IE Only, but so apparently is this code path... 6668 style.removeAttribute( "filter" ); 6669 6670 // if there there is no filter style applied in a css rule, we are done 6671 if ( currentStyle && !currentStyle.filter ) { 6672 return; 6673 } 6674 } 6675 6676 // otherwise, set new filter values 6677 style.filter = ralpha.test( filter ) ? 6678 filter.replace( ralpha, opacity ) : 6679 filter + " " + opacity; 6680 } 6681 }; 6682} 6683 6684jQuery(function() { 6685 // This hook cannot be added until DOM ready because the support test 6686 // for it is not run until after DOM ready 6687 if ( !jQuery.support.reliableMarginRight ) { 6688 jQuery.cssHooks.marginRight = { 6689 get: function( elem, computed ) { 6690 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6691 // Work around by temporarily setting element display to inline-block 6692 var ret; 6693 jQuery.swap( elem, { "display": "inline-block" }, function() { 6694 if ( computed ) { 6695 ret = curCSS( elem, "margin-right", "marginRight" ); 6696 } else { 6697 ret = elem.style.marginRight; 6698 } 6699 }); 6700 return ret; 6701 } 6702 }; 6703 } 6704}); 6705 6706if ( document.defaultView && document.defaultView.getComputedStyle ) { 6707 getComputedStyle = function( elem, name ) { 6708 var ret, defaultView, computedStyle; 6709 6710 name = name.replace( rupper, "-$1" ).toLowerCase(); 6711 6712 if ( (defaultView = elem.ownerDocument.defaultView) && 6713 (computedStyle = defaultView.getComputedStyle( elem, null )) ) { 6714 ret = computedStyle.getPropertyValue( name ); 6715 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { 6716 ret = jQuery.style( elem, name ); 6717 } 6718 } 6719 6720 return ret; 6721 }; 6722} 6723 6724if ( document.documentElement.currentStyle ) { 6725 currentStyle = function( elem, name ) { 6726 var left, rsLeft, uncomputed, 6727 ret = elem.currentStyle && elem.currentStyle[ name ], 6728 style = elem.style; 6729 6730 // Avoid setting ret to empty string here 6731 // so we don't default to auto 6732 if ( ret === null && style && (uncomputed = style[ name ]) ) { 6733 ret = uncomputed; 6734 } 6735 6736 // From the awesome hack by Dean Edwards 6737 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6738 6739 // If we're not dealing with a regular pixel number 6740 // but a number that has a weird ending, we need to convert it to pixels 6741 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { 6742 6743 // Remember the original values 6744 left = style.left; 6745 rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; 6746 6747 // Put in the new values to get a computed value out 6748 if ( rsLeft ) { 6749 elem.runtimeStyle.left = elem.currentStyle.left; 6750 } 6751 style.left = name === "fontSize" ? "1em" : ( ret || 0 ); 6752 ret = style.pixelLeft + "px"; 6753 6754 // Revert the changed values 6755 style.left = left; 6756 if ( rsLeft ) { 6757 elem.runtimeStyle.left = rsLeft; 6758 } 6759 } 6760 6761 return ret === "" ? "auto" : ret; 6762 }; 6763} 6764 6765curCSS = getComputedStyle || currentStyle; 6766 6767function getWH( elem, name, extra ) { 6768 6769 // Start with offset property 6770 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6771 which = name === "width" ? cssWidth : cssHeight, 6772 i = 0, 6773 len = which.length; 6774 6775 if ( val > 0 ) { 6776 if ( extra !== "border" ) { 6777 for ( ; i < len; i++ ) { 6778 if ( !extra ) { 6779 val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; 6780 } 6781 if ( extra === "margin" ) { 6782 val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; 6783 } else { 6784 val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; 6785 } 6786 } 6787 } 6788 6789 return val + "px"; 6790 } 6791 6792 // Fall back to computed then uncomputed css if necessary 6793 val = curCSS( elem, name, name ); 6794 if ( val < 0 || val == null ) { 6795 val = elem.style[ name ] || 0; 6796 } 6797 // Normalize "", auto, and prepare for extra 6798 val = parseFloat( val ) || 0; 6799 6800 // Add padding, border, margin 6801 if ( extra ) { 6802 for ( ; i < len; i++ ) { 6803 val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; 6804 if ( extra !== "padding" ) { 6805 val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; 6806 } 6807 if ( extra === "margin" ) { 6808 val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; 6809 } 6810 } 6811 } 6812 6813 return val + "px"; 6814} 6815 6816if ( jQuery.expr && jQuery.expr.filters ) { 6817 jQuery.expr.filters.hidden = function( elem ) { 6818 var width = elem.offsetWidth, 6819 height = elem.offsetHeight; 6820 6821 return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "dis
6821play" )) === "none"); 6822 }; 6823 6824 jQuery.expr.filters.visible = function( elem ) { 6825 return !jQuery.expr.filters.hidden( elem ); 6826 }; 6827} 6828 6829 6830 6831 6832var r20 = /%20/g, 6833 rbracket = /\[\]$/, 6834 rCRLF = /\r?\n/g, 6835 rhash = /#.*$/, 6836 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 6837 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 6838 // #7653, #8125, #8152: local protocol detection 6839 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, 6840 rnoContent = /^(?:GET|HEAD)$/, 6841 rprotocol = /^\/\//, 6842 rquery = /\?/, 6843 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, 6844 rselectTextarea = /^(?:select|textarea)/i, 6845 rspacesAjax = /\s+/, 6846 rts = /([?&])_=[^&]*/, 6847 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, 6848 6849 // Keep a copy of the old load method 6850 _load = jQuery.fn.load, 6851 6852 /* Prefilters 6853 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 6854 * 2) These are called: 6855 * - BEFORE asking for a transport 6856 * - AFTER param serialization (s.data is a string if s.processData is true) 6857 * 3) key is the dataType 6858 * 4) the catchall symbol "*" can be used 6859 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 6860 */ 6861 prefilters = {}, 6862 6863 /* Transports bindings 6864 * 1) key is the dataType 6865 * 2) the catchall symbol "*" can be used 6866 * 3) selection will start with transport dataType and THEN go to "*" if needed 6867 */ 6868 transports = {}, 6869 6870 // Document location 6871 ajaxLocation, 6872 6873 // Document location segments 6874 ajaxLocParts, 6875 6876 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 6877 allTypes = ["*/"] + ["*"]; 6878 6879// #8138, IE may throw an exception when accessing 6880// a field from window.location if document.domain has been set 6881try { 6882 ajaxLocation = location.href; 6883} catch( e ) { 6884 // Use the href attribute of an A element 6885 // since IE will modify it given document.location 6886 ajaxLocation = document.createElement( "a" ); 6887 ajaxLocation.href = ""; 6888 ajaxLocation = ajaxLocation.href; 6889} 6890 6891// Segment location into parts 6892ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 6893 6894// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 6895function addToPrefiltersOrTransports( structure ) { 6896 6897 // dataTypeExpression is optional and defaults to "*" 6898 return function( dataTypeExpression, func ) { 6899 6900 if ( typeof dataTypeExpression !== "string" ) { 6901 func = dataTypeExpression; 6902 dataTypeExpression = "*"; 6903 } 6904 6905 if ( jQuery.isFunction( func ) ) { 6906 var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), 6907 i = 0, 6908 length = dataTypes.length, 6909 dataType, 6910 list, 6911 placeBefore; 6912 6913 // For each dataType in the dataTypeExpression 6914 for ( ; i < length; i++ ) { 6915 dataType = dataTypes[ i ]; 6916 // We control if we're asked to add before 6917 // any existing element 6918 placeBefore = /^\+/.test( dataType ); 6919 if ( placeBefore ) { 6920 dataType = dataType.substr( 1 ) || "*"; 6921 } 6922 list = structure[ dataType ] = structure[ dataType ] || []; 6923 // then we add to the structure accordingly 6924 list[ placeBefore ? "unshift" : "push" ]( func ); 6925 } 6926 } 6927 }; 6928} 6929 6930// Base inspection function for prefilters and transports 6931function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, 6932 dataType /* internal */, inspected /* internal */ ) { 6933 6934 dataType = dataType || options.dataTypes[ 0 ]; 6935 inspected = inspected || {}; 6936 6937 inspected[ dataType ] = true; 6938 6939 var list = structure[ dataType ], 6940 i = 0, 6941 length = list ? list.length : 0, 6942 executeOnly = ( structure === prefilters ), 6943 selection; 6944 6945 for ( ; i < length && ( executeOnly || !selection ); i++ ) { 6946 selection = list[ i ]( options, originalOptions, jqXHR ); 6947 // If we got redirected to another dataType 6948 // we try there if executing only and not done already 6949 if ( typeof selection === "string" ) { 6950 if ( !executeOnly || inspected[ selection ] ) { 6951 selection = undefined; 6952 } else { 6953 options.dataTypes.unshift( selection ); 6954 selection = inspectPrefiltersOrTransports( 6955 structure, options, originalOptions, jqXHR, selection, inspected ); 6956 } 6957 } 6958 } 6959 // If we're only executing or nothing was selected 6960 // we try the catchall dataType if not done already 6961 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { 6962 selection = inspectPrefiltersOrTransports( 6963 structure, options, originalOptions, jqXHR, "*", inspected ); 6964 } 6965 // unnecessary when only executing (prefilters) 6966 // but it'll be ignored by the caller in that case 6967 return selection; 6968} 6969 6970// A special extend for ajax options 6971// that takes "flat" options (not to be deep extended) 6972// Fixes #9887 6973function ajaxExtend( target, src ) { 6974 var key, deep, 6975 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 6976 for ( key in src ) { 6977 if ( src[ key ] !== undefined ) { 6978 ( flatOptions[ key ] ? target : ( deep || ( deep = {}
vendor: 12,773 bytes, lines 6978-7475
6978 ) ) )[ key ] = src[ key ]; 6979 } 6980 } 6981 if ( deep ) { 6982 jQuery.extend( true, target, deep ); 6983 } 6984} 6985 6986jQuery.fn.extend({ 6987 load: function( url, params, callback ) { 6988 if ( typeof url !== "string" && _load ) { 6989 return _load.apply( this, arguments ); 6990 6991 // Don't do a request if no elements are being requested 6992 } else if ( !this.length ) { 6993 return this; 6994 } 6995 6996 var off = url.indexOf( " " ); 6997 if ( off >= 0 ) { 6998 var selector = url.slice( off, url.length ); 6999 url = url.slice( 0, off ); 7000 } 7001 7002 // Default to a GET request 7003 var type = "GET"; 7004 7005 // If the second parameter was provided 7006 if ( params ) { 7007 // If it's a function 7008 if ( jQuery.isFunction( params ) ) { 7009 // We assume that it's the callback 7010 callback = params; 7011 params = undefined; 7012 7013 // Otherwise, build a param string 7014 } else if ( typeof params === "object" ) { 7015 params = jQuery.param( params, jQuery.ajaxSettings.traditional ); 7016 type = "POST"; 7017 } 7018 } 7019 7020 var self = this; 7021 7022 // Request the remote document 7023 jQuery.ajax({ 7024 url: url, 7025 type: type, 7026 dataType: "html", 7027 data: params, 7028 // Complete callback (responseText is used internally) 7029 complete: function( jqXHR, status, responseText ) { 7030 // Store the response as specified by the jqXHR object 7031 responseText = jqXHR.responseText; 7032 // If successful, inject the HTML into all the matched elements 7033 if ( jqXHR.isResolved() ) { 7034 // #4825: Get the actual response in case 7035 // a dataFilter is present in ajaxSettings 7036 jqXHR.done(function( r ) { 7037 responseText = r; 7038 }); 7039 // See if a selector was specified 7040 self.html( selector ? 7041 // Create a dummy div to hold the results 7042 jQuery("<div>") 7043 // inject the contents of the document in, removing the scripts 7044 // to avoid any 'Permission Denied' errors in IE 7045 .append(responseText.replace(rscript, "")) 7046 7047 // Locate the specified elements 7048 .find(selector) : 7049 7050 // If not, just inject the full result 7051 responseText ); 7052 } 7053 7054 if ( callback ) { 7055 self.each( callback, [ responseText, status, jqXHR ] ); 7056 } 7057 } 7058 }); 7059 7060 return this; 7061 }, 7062 7063 serialize: function() { 7064 return jQuery.param( this.serializeArray() ); 7065 }, 7066 7067 serializeArray: function() { 7068 return this.map(function(){ 7069 return this.elements ? jQuery.makeArray( this.elements ) : this; 7070 }) 7071 .filter(function(){ 7072 return this.name && !this.disabled && 7073 ( this.checked || rselectTextarea.test( this.nodeName ) || 7074 rinput.test( this.type ) ); 7075 }) 7076 .map(function( i, elem ){ 7077 var val = jQuery( this ).val(); 7078 7079 return val == null ? 7080 null : 7081 jQuery.isArray( val ) ? 7082 jQuery.map( val, function( val, i ){ 7083 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 7084 }) : 7085 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 7086 }).get(); 7087 } 7088}); 7089 7090// Attach a bunch of functions for handling common AJAX events 7091jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ 7092 jQuery.fn[ o ] = function( f ){ 7093 return this.on( o, f ); 7094 }; 7095}); 7096 7097jQuery.each( [ "get", "post" ], function( i, method ) { 7098 jQuery[ method ] = function( url, data, callback, type ) { 7099 // shift arguments if data argument was omitted 7100 if ( jQuery.isFunction( data ) ) { 7101 type = type || callback; 7102 callback = data; 7103 data = undefined; 7104 } 7105 7106 return jQuery.ajax({ 7107 type: method, 7108 url: url, 7109 data: data, 7110 success: callback, 7111 dataType: type 7112 }); 7113 }; 7114}); 7115 7116jQuery.extend({ 7117 7118 getScript: function( url, callback ) { 7119 return jQuery.get( url, undefined, callback, "script" ); 7120 }, 7121 7122 getJSON: function( url, data, callback ) { 7123 return jQuery.get( url, data, callback, "json" ); 7124 }, 7125 7126 // Creates a full fledged settings object into target 7127 // with both ajaxSettings and settings fields. 7128 // If target is omitted, writes into ajaxSettings. 7129 ajaxSetup: function( target, settings ) { 7130 if ( settings ) { 7131 // Building a settings object 7132 ajaxExtend( target, jQuery.ajaxSettings ); 7133 } else { 7134 // Extending ajaxSettings 7135 settings = target; 7136 target = jQuery.ajaxSettings; 7137 } 7138 ajaxExtend( target, settings ); 7139 return target; 7140 }, 7141 7142 ajaxSettings: { 7143 url: ajaxLocation, 7144 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 7145 global: true, 7146 type: "GET", 7147 contentType: "application/x-www-form-urlencoded", 7148 processData: true, 7149 async: true, 7150 /* 7151 timeout: 0, 7152 data: null, 7153 dataType: null, 7154 username: null, 7155 password: null, 7156 cache: null, 7157 traditional: false, 7158 headers: {}, 7159 */ 7160 7161 accepts: { 7162 xml: "application/xml, text/xml", 7163 html: "text/html", 7164 text: "text/plain", 7165 json: "application/json, text/javascript", 7166 "*": allTypes 7167 }, 7168 7169 contents: { 7170 xml: /xml/, 7171 html: /html/, 7172 json: /json/ 7173 }, 7174 7175 responseFields: { 7176 xml: "responseXML", 7177 text: "responseText" 7178 }, 7179 7180 // List of data converters 7181 // 1) key format is "source_type destination_type" (a single space in-between) 7182 // 2) the catchall symbol "*" can be used for source_type 7183 converters: { 7184 7185 // Convert anything to text 7186 "* text": window.String, 7187 7188 // Text to html (true = no transformation) 7189 "text html": true, 7190 7191 // Evaluate text as a json expression 7192 "text json": jQuery.parseJSON, 7193 7194 // Parse text as xml 7195 "text xml": jQuery.parseXML 7196 }, 7197 7198 // For options that shouldn't be deep extended: 7199 // you can add your own custom options here if 7200 // and when you create one that shouldn't be 7201 // deep extended (see ajaxExtend) 7202 flatOptions: { 7203 context: true, 7204 url: true 7205 } 7206 }, 7207 7208 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 7209 ajaxTransport: addToPrefiltersOrTransports( transports ), 7210 7211 // Main method 7212 ajax: function( url, options ) { 7213 7214 // If url is an object, simulate pre-1.5 signature 7215 if ( typeof url === "object" ) { 7216 options = url; 7217 url = undefined; 7218 } 7219 7220 // Force options to be an object 7221 options = options || {}; 7222 7223 var // Create the final options object 7224 s = jQuery.ajaxSetup( {}, options ), 7225 // Callbacks context 7226 callbackContext = s.context || s, 7227 // Context for global events 7228 // It's the callbackContext if one was provided in the options 7229 // and if it's a DOM node or a jQuery collection 7230 globalEventContext = callbackContext !== s && 7231 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? 7232 jQuery( callbackContext ) : jQuery.event, 7233 // Deferreds 7234 deferred = jQuery.Deferred(), 7235 completeDeferred = jQuery.Callbacks( "once memory" ), 7236 // Status-dependent callbacks 7237 statusCode = s.statusCode || {}, 7238 // ifModified key 7239 ifModifiedKey, 7240 // Headers (they are sent all at once) 7241 requestHeaders = {}, 7242 requestHeadersNames = {}, 7243 // Response headers 7244 responseHeadersString, 7245 responseHeaders, 7246 // transport 7247 transport, 7248 // timeout handle 7249 timeoutTimer, 7250 // Cross-domain detection vars 7251 parts, 7252 // The jqXHR state 7253 state = 0, 7254 // To know if global events are to be dispatched 7255 fireGlobals, 7256 // Loop variable 7257 i, 7258 // Fake xhr 7259 jqXHR = { 7260 7261 readyState: 0, 7262 7263 // Caches the header 7264 setRequestHeader: function( name, value ) { 7265 if ( !state ) { 7266 var lname = name.toLowerCase(); 7267 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 7268 requestHeaders[ name ] = value; 7269 } 7270 return this; 7271 }, 7272 7273 // Raw string 7274 getAllResponseHeaders: function() { 7275 return state === 2 ? responseHeadersString : null; 7276 }, 7277 7278 // Builds headers hashtable if needed 7279 getResponseHeader: function( key ) { 7280 var match; 7281 if ( state === 2 ) { 7282 if ( !responseHeaders ) { 7283 responseHeaders = {}; 7284 while( ( match = rheaders.exec( responseHeadersString ) ) ) { 7285 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 7286 } 7287 } 7288 match = responseHeaders[ key.toLowerCase() ]; 7289 } 7290 return match === undefined ? null : match; 7291 }, 7292 7293 // Overrides response content-type header 7294 overrideMimeType: function( type ) { 7295 if ( !state ) { 7296 s.mimeType = type; 7297 } 7298 return this; 7299 }, 7300 7301 // Cancel the request 7302 abort: function( statusText ) { 7303 statusText = statusText || "abort"; 7304 if ( transport ) { 7305 transport.abort( statusText ); 7306 } 7307 done( 0, statusText ); 7308 return this; 7309 } 7310 }; 7311 7312 // Callback for when everything is done 7313 // It is defined here because jslint complains if it is declared 7314 // at the end of the function (which would be more logical and readable) 7315 function done( status, nativeStatusText, responses, headers ) { 7316 7317 // Called once 7318 if ( state === 2 ) { 7319 return; 7320 } 7321 7322 // State is "done" now 7323 state = 2; 7324 7325 // Clear timeout if it exists 7326 if ( timeoutTimer ) { 7327 clearTimeout( timeoutTimer ); 7328 } 7329 7330 // Dereference transport for early garbage collection 7331 // (no matter how long the jqXHR object will be used) 7332 transport = undefined; 7333 7334 // Cache response headers 7335 responseHeadersString = headers || ""; 7336 7337 // Set readyState 7338 jqXHR.readyState = status > 0 ? 4 : 0; 7339 7340 var isSuccess, 7341 success, 7342 error, 7343 statusText = nativeStatusText, 7344 response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, 7345 lastModified, 7346 etag; 7347 7348 // If successful, handle type chaining 7349 if ( status >= 200 && status < 300 || status === 304 ) { 7350 7351 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7352 if ( s.ifModified ) { 7353 7354 if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { 7355 jQuery.lastModified[ ifModifiedKey ] = lastModified; 7356 } 7357 if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { 7358 jQuery.etag[ ifModifiedKey ] = etag; 7359 } 7360 } 7361 7362 // If not modified 7363 if ( status === 304 ) { 7364 7365 statusText = "notmodified"; 7366 isSuccess = true; 7367 7368 // If we have data 7369 } else { 7370 7371 try { 7372 success = ajaxConvert( s, response ); 7373 statusText = "success"; 7374 isSuccess = true; 7375 } catch(e) { 7376 // We have a parsererror 7377 statusText = "parsererror"; 7378 error = e; 7379 } 7380 } 7381 } else { 7382 // We extract error from statusText 7383 // then normalize statusText and status for non-aborts 7384 error = statusText; 7385 if ( !statusText || status ) { 7386 statusText = "error"; 7387 if ( status < 0 ) { 7388 status = 0; 7389 } 7390 } 7391 } 7392 7393 // Set data for the fake xhr object 7394 jqXHR.status = status; 7395 jqXHR.statusText = "" + ( nativeStatusText || statusText ); 7396 7397 // Success/Error 7398 if ( isSuccess ) { 7399 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 7400 } else { 7401 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 7402 } 7403 7404 // Status-dependent callbacks 7405 jqXHR.statusCode( statusCode ); 7406 statusCode = undefined; 7407 7408 if ( fireGlobals ) { 7409 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), 7410 [ jqXHR, s, isSuccess ? success : error ] ); 7411 } 7412 7413 // Complete 7414 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 7415 7416 if ( fireGlobals ) { 7417 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 7418 // Handle the global AJAX counter 7419 if ( !( --jQuery.active ) ) { 7420 jQuery.event.trigger( "ajaxStop" ); 7421 } 7422 } 7423 } 7424 7425 // Attach deferreds 7426 deferred.promise( jqXHR ); 7427 jqXHR.success = jqXHR.done; 7428 jqXHR.error = jqXHR.fail; 7429 jqXHR.complete = completeDeferred.add; 7430 7431 // Status-dependent callbacks 7432 jqXHR.statusCode = function( map ) { 7433 if ( map ) { 7434 var tmp; 7435 if ( state < 2 ) { 7436 for ( tmp in map ) { 7437 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; 7438 } 7439 } else { 7440 tmp = map[ jqXHR.status ]; 7441 jqXHR.then( tmp, tmp ); 7442 } 7443 } 7444 return this; 7445 }; 7446 7447 // Remove hash character (#7531: and string promotion) 7448 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 7449 // We also use the url parameter if available 7450 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 7451 7452 // Extract dataTypes list 7453 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); 7454 7455 // Determine if a cross-domain request is in order 7456 if ( s.crossDomain == null ) { 7457 parts = rurl.exec( s.url.toLowerCase() ); 7458 s.crossDomain = !!( parts && 7459 ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || 7460 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != 7461 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) 7462 ); 7463 } 7464 7465 // Convert data if not already a string 7466 if ( s.data && s.processData && typeof s.data !== "string" ) { 7467 s.data = jQuery.param( s.data, s.traditional ); 7468 } 7469 7470 // Apply prefilters 7471 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 7472 7473 // If request was aborted inside a prefiler, stop there 7474 if ( state === 2 ) { 7475 return false;
7476 } 7477 7478 // We can fire global events as of now if asked to 7479 fireGlobals = s.global; 7480 7481 // Uppercase the type 7482 s.type = s.type.toUpperCase(); 7483 7484 // Determine if request has content 7485 s.hasContent = !rnoContent.test( s.type ); 7486 7487 // Watch for a new set of requests 7488 if ( fireGlobals && jQuery.active++ === 0 ) { 7489 jQuery.event.trigger( "ajaxStart" ); 7490 } 7491 7492 // More options handling for requests with no content 7493 if ( !s.hasContent ) { 7494 7495 // If data is available, append data to url 7496 if ( s.data ) { 7497 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; 7498 // #9682: remove data so that it's not used in an eventual retry 7499 delete s.data; 7500 } 7501 7502 // Get ifModifiedKey before adding the anti-cache parameter 7503 ifModifiedKey = s.url; 7504 7505 // Add anti-cache in url if needed 7506 if ( s.cache === false ) { 7507 7508 var ts = jQuery.now(), 7509 // try replacing _= if it is there 7510 ret = s.url.replace( rts, "$1_=" + ts ); 7511 7512 // if nothing was replaced, add timestamp to the end 7513 s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); 7514 } 7515 } 7516 7517 // Set the correct header, if data is being sent 7518 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 7519 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 7520 } 7521 7522 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7523 if ( s.ifModified ) { 7524 ifModifiedKey = ifModifiedKey || s.url; 7525 if ( jQuery.lastModified[ ifModifiedKey ] ) { 7526 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); 7527 } 7528 if ( jQuery.etag[ ifModifiedKey ] ) { 7529 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); 7530 } 7531 } 7532 7533 // Set the Accepts header for the server, depending on the dataType 7534 jqXHR.setRequestHeader( 7535 "Accept", 7536 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 7537 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 7538 s.accepts[ "*" ] 7539 ); 7540 7541 // Check for headers option 7542 for ( i in s.headers ) { 7543 jqXHR.setRequestHeader( i, s.headers[ i ] ); 7544 } 7545 7546 // Allow custom headers/mimetypes and early abort 7547 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 7548 // Abort if not done already 7549 jqXHR.abort(); 7550 return false; 7551 7552 } 7553 7554 // Install callbacks on deferreds 7555 for ( i in { success: 1, error: 1, complete: 1 } ) { 7556 jqXHR[ i ]( s[ i ] ); 7557 } 7558 7559 // Get transport 7560 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 7561 7562 // If no transport, we auto-abort 7563 if ( !transport ) { 7564 done( -1, "No Transport" ); 7565 } else { 7566 jqXHR.readyState = 1; 7567 // Send global event 7568 if ( fireGlobals ) { 7569 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 7570 } 7571 // Timeout 7572 if ( s.async && s.timeout > 0 ) { 7573 timeoutTimer = setTimeout( function(){ 7574 jqXHR.abort( "timeout" ); 7575 }, s.timeout ); 7576 } 7577 7578 try { 7579 state = 1; 7580 transport.send( requestHeaders, done ); 7581 } catch (e) { 7582 // Propagate exception as error if not done 7583 if ( state < 2 ) { 7584 done( -1, e ); 7585 // Simply rethrow otherwise 7586 } else { 7587 throw e; 7588 } 7589 } 7590 } 7591 7592 return jqXHR; 7593 }, 7594 7595 // Serialize an array of form elements or a set of 7596 // key/values into a query string 7597 param: function( a, traditional ) { 7598 var s = [], 7599 add = function( key, value ) { 7600 // If value is a function, invoke it and return its value 7601 value = jQuery.isFunction( value ) ? value() : value; 7602 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 7603 }; 7604 7605 // Set traditional to true for jQuery <= 1.3.2 behavior. 7606 if ( traditional === undefined ) { 7607 traditional = jQuery.ajaxSettings.traditional; 7608 } 7609 7610 // If an array was passed in, assume that it is an array of form elements. 7611 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 7612 // Serialize the form elements 7613 jQuery.each( a, function() { 7614 add( this.name, this.value ); 7615 }); 7616 7617 } else { 7618 // If traditional, encode the "old" way (the way 1.3.2 or older 7619 // did it), otherwise encode params recursively. 7620 for ( var prefix in a ) { 7621 buildParams( prefix, a[ prefix ], traditional, add ); 7622 } 7623 } 7624 7625 // Return the resulting serialization 7626 return s.join( "&" ).replace( r20, "+" ); 7627 } 7628}); 7629 7630function buildParams( prefix, obj, traditional, add ) { 7631 if ( jQuery.isArray( obj ) ) { 7632 // Serialize array item. 7633 jQuery.each( obj, function( i, v ) { 7634 if ( traditional || rbracket.test( prefix ) ) { 7635 // Treat each array item as a scalar. 7636 add( prefix, v ); 7637 7638 } else { 7639 // If array item is non-scalar (array or object), encode its 7640 // numeric index to resolve deserialization ambiguity issues. 7641 // Note that rack (as of 1.0.0) can't currently deserialize 7642 // nested arrays properly, and attempting to do so may cause 7643 // a server error. Possible fixes are to modify rack's 7644 // deserialization algorithm or to provide an option or flag 7645 // to force array serialization to be shallow. 7646 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); 7647 } 7648 }); 7649 7650 } else if ( !traditional && obj != null && typeof obj === "object" ) { 7651 // Serialize object item. 7652 for ( var name in obj ) { 7653 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 7654 } 7655 7656 } else { 7657 // Serialize scalar item. 7658 add( prefix, obj ); 7659 } 7660} 7661 7662// This is still on the jQuery object... for now 7663// Want to move this to jQuery.ajax some day 7664jQuery.extend({ 7665 7666 // Counter for holding the number of active queries 7667 active: 0, 7668 7669 // Last-Modified header cache for next request 7670 lastModified: {}, 7671 etag: {} 7672 7673}
7673); 7674 7675/* Handles responses to an ajax request: 7676 * - sets all responseXXX fields accordingly 7677 * - finds the right dataType (mediates between content-type and expected dataType) 7678 * - returns the corresponding response 7679 */ 7680function ajaxHandleResponses( s, jqXHR, responses ) { 7681 7682 var contents = s.contents, 7683 dataTypes = s.dataTypes, 7684 responseFields = s.responseFields, 7685 ct, 7686 type, 7687 finalDataType, 7688 firstDataType; 7689 7690 // Fill responseXXX fields 7691 for ( type in responseFields ) { 7692 if ( type in responses ) { 7693 jqXHR[ responseFields[type] ] = responses[ type ]; 7694 } 7695 } 7696 7697 // Remove auto dataType and get content-type in the process 7698 while( dataTypes[ 0 ] === "*" ) { 7699 dataTypes.shift(); 7700 if ( ct === undefined ) { 7701 ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); 7702 } 7703 } 7704 7705 // Check if we're dealing with a known content-type 7706 if ( ct ) { 7707 for ( type in contents ) { 7708 if ( contents[ type ] && contents[ type ].test( ct ) ) { 7709 dataTypes.unshift( type ); 7710 break; 7711 } 7712 } 7713 } 7714 7715 // Check to see if we have a response for the expected dataType 7716 if ( dataTypes[ 0 ] in responses ) { 7717 finalDataType = dataTypes[ 0 ]; 7718 } else { 7719 // Try convertible dataTypes 7720 for ( type in responses ) { 7721 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 7722 finalDataType = type; 7723 break; 7724 } 7725 if ( !firstDataType ) { 7726 firstDataType = type; 7727 } 7728 } 7729 // Or just use first one 7730 finalDataType = finalDataType || firstDataType; 7731 } 7732 7733 // If we found a dataType 7734 // We add the dataType to the list if needed 7735 // and return the corresponding response 7736 if ( finalDataType ) { 7737 if ( finalDataType !== dataTypes[ 0 ] ) { 7738 dataTypes.unshift( finalDataType ); 7739 } 7740 return responses[ finalDataType ]; 7741 } 7742} 7743 7744// Chain conversions given the request and the original response 7745function ajaxConvert( s, response ) { 7746 7747 // Apply the dataFilter if provided 7748 if ( s.dataFilter ) { 7749 response = s.dataFilter( response, s.dataType ); 7750 } 7751 7752 var dataTypes = s.dataTypes, 7753 converters = {}, 7754 i, 7755 key, 7756 length = dataTypes.length, 7757 tmp, 7758 // Current and previous dataTypes 7759 current = dataTypes[ 0 ], 7760 prev, 7761 // Conversion expression 7762 conversion, 7763 // Conversion function 7764 conv, 7765 // Conversion functions (transitive conversion) 7766 conv1, 7767 conv2; 7768 7769 // For each dataType in the chain 7770 for ( i = 1; i < length; i++ ) { 7771 7772 // Create converters map 7773 // with lowercased keys 7774 if ( i === 1 ) { 7775 for ( key in s.converters ) { 7776 if ( typeof key === "string" ) { 7777 converters[ key.toLowerCase() ] = s.converters[ key ]; 7778 } 7779 } 7780 } 7781 7782 // Get the dataTypes 7783 prev = current; 7784 current = dataTypes[ i ]; 7785 7786 // If current is auto dataType, update it to prev 7787 if ( current === "*" ) { 7788 current = prev; 7789 // If no auto and dataTypes are actually different 7790 } else if ( prev !== "*" && prev !== current ) { 7791 7792 // Get the converter 7793 conversion = prev + " " + current; 7794 conv = converters[ conversion ] || converters[ "* " + current ]; 7795 7796 // If there is no direct converter, search transitively 7797 if ( !conv ) { 7798 conv2 = undefined; 7799 for ( conv1 in converters ) { 7800 tmp = conv1.split( " " ); 7801 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { 7802 conv2 = converters[ tmp[1] + " " + current ]; 7803 if ( conv2 ) { 7804 conv1 = converters[ conv1 ]; 7805 if ( conv1 === true ) { 7806 conv = conv2; 7807 } else if ( conv2 === true ) { 7808 conv = conv1; 7809 } 7810 break; 7811 } 7812 } 7813 } 7814 } 7815 // If we found no converter, dispatch an error 7816 if ( !( conv || conv2 ) ) { 7817 jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); 7818 } 7819 // If found converter is not an equivalence 7820 if ( conv !== true ) { 7821 // Convert with 1 or 2 converters accordingly 7822 response = conv ? conv( response ) : conv2( conv1(response) ); 7823 } 7824 } 7825 } 7826 return response; 7827} 7828 7829 7830 7831 7832var jsc = jQuery.now(), 7833 jsre = /(\=)\?(&|$)|\?\?/i; 7834 7835// Default jsonp settings 7836jQuery.ajaxSetup({ 7837 jsonp: "callback", 7838 jsonpCallback: function() { 7839 return jQuery.expando + "_" + ( jsc++ ); 7840 } 7841}); 7842 7843// Detect, normalize options and install callbacks for jsonp requests 7844jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 7845 7846 var inspectData = s.contentType === "application/x-www-form-urlencoded" && 7847 ( typeof s.data === "string" ); 7848 7849 if ( s.dataTypes[ 0 ] === "jsonp" || 7850 s.jsonp !== false && ( jsre.test( s.url ) || 7851 inspectData && jsre.test( s.data ) ) ) { 7852 7853 var responseContainer, 7854 jsonpCallback = s.jsonpCallback = 7855 jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, 7856 previous = window[ jsonpCallback ], 7857 url = s.url, 7858 data = s.data, 7859 replace = "$1" + jsonpCallback + "$2"; 7860 7861 if ( s.jsonp !== false ) { 7862 url = url.replace( jsre, replace ); 7863 if ( s.url === url ) { 7864 if ( inspectData ) { 7865 data = data.replace( jsre, replace ); 7866 } 7867 if ( s.data === data ) { 7868 // Add callback manually 7869 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; 7870 } 7871 } 7872 } 7873 7874 s.url = url; 7875 s.data = data; 7876 7877 // Install callback 7878 window[ jsonpCallback ] = function( response ) { 7879 responseContainer = [ response ]; 7880 }; 7881 7882 // Clean-up function 7883 jqXHR.always(function() { 7884 // Set callback back to previous value 7885 window[ jsonpCallback ] = previous; 7886 // Call if it was a function and we have a response 7887 if ( responseContainer && jQuery.isFunction( previous ) ) { 7888 window[ jsonpCallback ]( responseContainer[ 0 ] ); 7889 } 7890 }); 7891 7892 // Use data converter to retrieve json after script execution 7893 s.converters["script json"] = function() { 7894 if ( !responseContainer ) { 7895 jQuery.error( jsonpCallback + " was not called" ); 7896 } 7897 return responseContainer[ 0 ]; 7898 }; 7899 7900 // force json dataType 7901 s.dataTypes[ 0 ] = "json"; 7902 7903 // Delegate to script 7904 return "script"; 7905 } 7906}); 7907 7908 7909 7910 7911// Install script dataType 7912jQuery.ajaxSetup({ 7913 accepts: { 7914 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 7915 }, 7916 contents: { 7917 script: /javascript|ecmascript/ 7918 }, 7919 converters: { 7920 "text script": function( text ) { 7921 jQuery.globalEval( text ); 7922 return text; 7923 } 7924 } 7925}); 7926 7927// Handle cache's special case and global 7928jQuery.ajaxPrefilter( "script", function( s ) { 7929 if ( s.cache === undefined ) { 7930 s.cache = false;
vendor: 3,904 bytes, lines 7931-8086
7931 } 7932 if ( s.crossDomain ) { 7933 s.type = "GET"; 7934 s.global = false; 7935 } 7936}); 7937 7938// Bind script tag hack transport 7939jQuery.ajaxTransport( "script", function(s) { 7940 7941 // This transport only deals with cross domain requests 7942 if ( s.crossDomain ) { 7943 7944 var script, 7945 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; 7946 7947 return { 7948 7949 send: function( _, callback ) { 7950 7951 script = document.createElement( "script" ); 7952 7953 script.async = "async"; 7954 7955 if ( s.scriptCharset ) { 7956 script.charset = s.scriptCharset; 7957 } 7958 7959 script.src = s.url; 7960 7961 // Attach handlers for all browsers 7962 script.onload = script.onreadystatechange = function( _, isAbort ) { 7963 7964 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 7965 7966 // Handle memory leak in IE 7967 script.onload = script.onreadystatechange = null; 7968 7969 // Remove the script 7970 if ( head && script.parentNode ) { 7971 head.removeChild( script ); 7972 } 7973 7974 // Dereference the script 7975 script = undefined; 7976 7977 // Callback if not abort 7978 if ( !isAbort ) { 7979 callback( 200, "success" ); 7980 } 7981 } 7982 }; 7983 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 7984 // This arises when a base node is used (#2709 and #4378). 7985 head.insertBefore( script, head.firstChild ); 7986 }, 7987 7988 abort: function() { 7989 if ( script ) { 7990 script.onload( 0, 1 ); 7991 } 7992 } 7993 }; 7994 } 7995}); 7996 7997 7998 7999 8000var // #5280: Internet Explorer will keep connections alive if we don't abort on unload 8001 xhrOnUnloadAbort = window.ActiveXObject ? function() { 8002 // Abort all pending requests 8003 for ( var key in xhrCallbacks ) { 8004 xhrCallbacks[ key ]( 0, 1 ); 8005 } 8006 } : false, 8007 xhrId = 0, 8008 xhrCallbacks; 8009 8010// Functions to create xhrs 8011function createStandardXHR() { 8012 try { 8013 return new window.XMLHttpRequest(); 8014 } catch( e ) {} 8015} 8016 8017function createActiveXHR() { 8018 try { 8019 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 8020 } catch( e ) {} 8021} 8022 8023// Create the request object 8024// (This is still attached to ajaxSettings for backward compatibility) 8025jQuery.ajaxSettings.xhr = window.ActiveXObject ? 8026 /* Microsoft failed to properly 8027 * implement the XMLHttpRequest in IE7 (can't request local files), 8028 * so we use the ActiveXObject when it is available 8029 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so 8030 * we need a fallback. 8031 */ 8032 function() { 8033 return !this.isLocal && createStandardXHR() || createActiveXHR(); 8034 } : 8035 // For all other browsers, use the standard XMLHttpRequest object 8036 createStandardXHR; 8037 8038// Determine support properties 8039(function( xhr ) { 8040 jQuery.extend( jQuery.support, { 8041 ajax: !!xhr, 8042 cors: !!xhr && ( "withCredentials" in xhr ) 8043 }); 8044})( jQuery.ajaxSettings.xhr() ); 8045 8046// Create transport if the browser can provide an xhr 8047if ( jQuery.support.ajax ) { 8048 8049 jQuery.ajaxTransport(function( s ) { 8050 // Cross domain only allowed if supported through XMLHttpRequest 8051 if ( !s.crossDomain || jQuery.support.cors ) { 8052 8053 var callback; 8054 8055 return { 8056 send: function( headers, complete ) { 8057 8058 // Get a new xhr 8059 var xhr = s.xhr(), 8060 handle, 8061 i; 8062 8063 // Open the socket 8064 // Passing null username, generates a login popup on Opera (#2865) 8065 if ( s.username ) { 8066 xhr.open( s.type, s.url, s.async, s.username, s.password ); 8067 } else { 8068 xhr.open( s.type, s.url, s.async ); 8069 } 8070 8071 // Apply custom fields if provided 8072 if ( s.xhrFields ) { 8073 for ( i in s.xhrFields ) { 8074 xhr[ i ] = s.xhrFields[ i ]; 8075 } 8076 } 8077 8078 // Override mime type if needed 8079 if ( s.mimeType && xhr.overrideMimeType ) { 8080 xhr.overrideMimeType( s.mimeType ); 8081 } 8082 8083 // X-Requested-With header 8084 // For cross-domain requests, seeing as conditions for a preflight are 8085 // akin to a jigsaw puzzle, we simply never set it to be sure. 8086 // (it can always be set on a per-request basis or even using ajaxSetup)
8087 // For same-domain requests, won't change header if already provided. 8088 if ( !s.crossDomain && !headers["X-Requested-With"] ) { 8089 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 8090 } 8091 8092 // Need an extra try/catch for cross domain requests in Firefox 3 8093 try { 8094 for ( i in headers ) { 8095 xhr.setRequestHeader( i, headers[ i ] ); 8096 } 8097 } catch( _ ) {} 8098 8099 // Do send the request 8100 // This may raise an exception which is actually 8101 // handled in jQuery.ajax (so no try/catch here) 8102 xhr.send( ( s.hasContent && s.data ) || null ); 8103 8104 // Listener 8105 callback = function( _, isAbort ) { 8106 8107 var status, 8108 statusText, 8109 responseHeaders, 8110 responses, 8111 xml; 8112 8113 // Firefox throws exceptions when accessing properties 8114 // of an xhr when a network error occured 8115 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) 8116 try { 8117 8118 // Was never called and is aborted or complete 8119 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 8120 8121 // Only called once 8122 callback = undefined; 8123 8124 // Do not keep as active anymore 8125 if ( handle ) { 8126 xhr.onreadystatechange = jQuery.noop; 8127 if ( xhrOnUnloadAbort ) { 8128 delete xhrCallbacks[ handle ]; 8129 } 8130 } 8131 8132 // If it's an abort 8133 if ( isAbort ) { 8134 // Abort it manually if needed 8135 if ( xhr.readyState !== 4 ) { 8136 xhr.abort(); 8137 } 8138 } else { 8139 status = xhr.status; 8140 responseHeaders = xhr.getAllResponseHeaders(); 8141 responses = {}; 8142 xml = xhr.responseXML; 8143 8144 // Construct response list 8145 if ( xml && xml.documentElement /* #4958 */ ) { 8146 responses.xml = xml; 8147 } 8148 responses.text = xhr.responseText; 8149 8150 // Firefox throws an exception when accessing 8151 // statusText for faulty cross-domain requests 8152 try { 8153 statusText = xhr.statusText; 8154 } catch( e ) { 8155 // We normalize with Webkit giving an empty statusText 8156 statusText = ""; 8157 } 8158 8159 // Filter status for non standard behaviors 8160 8161 // If the request is local and we have data: assume a success 8162 // (success with no data won't get notified, that's the best we 8163 // can do given current implementations) 8164 if ( !status && s.isLocal && !s.crossDomain ) { 8165 status = responses.text ? 200 : 404; 8166 // IE - #1450: sometimes returns 1223 when it should be 204 8167 } else if ( status === 1223 ) { 8168 status = 204; 8169 } 8170 } 8171 } 8172 } catch( firefoxAccessException ) { 8173 if ( !isAbort ) { 8174 complete( -1, firefoxAccessException ); 8175 } 8176 } 8177 8178 // Call complete if needed 8179 if ( responses ) { 8180 complete( status, statusText, responses, responseHeaders ); 8181 } 8182 }; 8183 8184 // if we're in sync mode or it's in cache 8185 // and has been retrieved directly (IE6 & IE7) 8186 // we need to manually fire the callback 8187 if ( !s.async || xhr.readyState === 4 ) { 8188 callback(); 8189 } else { 8190 handle = ++xhrId; 8191 if ( xhrOnUnloadAbort ) { 8192 // Create the active xhrs callbacks list if needed 8193 // and attach the unload handler 8194 if ( !xhrCallbacks ) { 8195 xhrCallbacks = {}; 8196 jQuery( window ).unload( xhrOnUnloadAbort ); 8197 } 8198 // Add to list of active xhrs callbacks 8199 xhrCallbacks[ handle ] = callback; 8200 } 8201 xhr.onreadystatechange = callback; 8202 } 8203 }, 8204 8205 abort: function() { 8206 if ( callback ) { 8207 callback(0,1); 8208 } 8209 } 8210 }; 8211 } 8212 }); 8213} 8214 8215 8216 8217 8218var elemdisplay = {}, 8219 iframe, iframeDoc, 8220 rfxtypes = /^(?:toggle|show|hide)$/, 8221 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, 8222 timerId, 8223 fxAttrs = [ 8224 // height animations 8225 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], 8226 // width animations 8227 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], 8228 // opacity animations 8229 [ "opacity" ] 8230 ], 8231 fxNow; 8232 8233jQuery.fn.extend({ 8234 show: function( speed, easing, callback ) { 8235 var elem, display; 8236 8237 if ( speed || speed === 0 ) { 8238 return this.animate( genFx("show", 3), speed, easing, callback ); 8239 8240 } else { 8241 for ( var i = 0, j = this.length; i < j; i++ ) { 8242 elem = this[ i ]; 8243 8244 if ( elem.style ) { 8245 display = elem.style.display; 8246 8247 // Reset the inline display of this element to learn if it is 8248 // being hidden by cascaded rules or not 8249 if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { 8250 display = elem.style.display = ""; 8251 } 8252 8253 // Set elements which have been overridden with display: none 8254 // in a stylesheet to whatever the default browser style is 8255 // for such an element
8256 if ( display === "" && jQuery.css(elem, "display") === "none" ) { 8257 jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); 8258 } 8259 } 8260 } 8261 8262 // Set the display of most of the elements in a second loop 8263 // to avoid the constant reflow 8264 for ( i = 0; i < j; i++ ) { 8265 elem = this[ i ]; 8266 8267 if ( elem.style ) { 8268 display = elem.style.display; 8269 8270 if ( display === "" || display === "none" ) { 8271 elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; 8272 } 8273 } 8274 } 8275 8276 return this; 8277 } 8278 }, 8279 8280 hide: function( speed, easing, callback ) { 8281 if ( speed || speed === 0 ) { 8282 return this.animate( genFx("hide", 3), speed, easing, callback); 8283 8284 } else { 8285 var elem, display, 8286 i = 0, 8287 j = this.length; 8288 8289 for ( ; i < j; i++ ) { 8290 elem = this[i]; 8291 if ( elem.style ) { 8292 display = jQuery.css( elem, "display" ); 8293 8294 if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { 8295 jQuery._data( elem, "olddisplay", display ); 8296 } 8297 } 8298 } 8299 8300 // Set the display of the elements in a second loop 8301 // to avoid the constant reflow 8302 for ( i = 0; i < j; i++ ) { 8303 if ( this[i].style ) { 8304 this[i].style.display = "none"; 8305 } 8306 } 8307 8308 return this; 8309 } 8310 }, 8311 8312 // Save the old toggle function 8313 _toggle: jQuery.fn.toggle, 8314 8315 toggle: function( fn, fn2, callback ) { 8316 var bool = typeof fn === "boolean"; 8317 8318 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { 8319 this._toggle.apply( this, arguments ); 8320 8321 } else if ( fn == null || bool ) { 8322 this.each(function() { 8323 var state = bool ? fn : jQuery(this).is(":hidden"); 8324 jQuery(this)[ state ? "show" : "hide" ](); 8325 }); 8326 8327 } else { 8328 this.animate(genFx("toggle", 3), fn, fn2, callback); 8329 } 8330 8331 return this; 8332 }, 8333 8334 fadeTo: function( speed, to, easing, callback ) { 8335 return this.filter(":hidden").css("opacity", 0).show().end() 8336 .animate({opacity: to}, speed, easing, callback); 8337 }, 8338 8339 animate: function( prop, speed, easing, callback ) { 8340 var optall = jQuery.speed( speed, easing, callback ); 8341 8342 if ( jQuery.isEmptyObject( prop ) ) { 8343 return this.each( optall.complete, [ false ] ); 8344 } 8345 8346 // Do not change referenced properties as per-property easing will be lost 8347 prop = jQuery.extend( {}, prop ); 8348 8349 function doAnimation() { 8350 // XXX 'this' does not always have a nodeName when running the 8351 // test suite 8352 8353 if ( optall.queue === false ) { 8354 jQuery._mark( this ); 8355 } 8356 8357 var opt = jQuery.extend( {}, optall ), 8358 isElement = this.nodeType === 1, 8359 hidden = isElement && jQuery(this).is(":hidden"), 8360 name, val, p, e, 8361 parts, start, end, unit, 8362 method; 8363 8364 // will store per property easing and be used to determine when an animation is complete 8365 opt.animatedProperties = {}; 8366 8367 for ( p in prop ) { 8368 8369 // property name normalization 8370 name = jQuery.camelCase( p ); 8371 if ( p !== name ) { 8372 prop[ name ] = prop[ p ]; 8373 delete prop[ p ]; 8374 } 8375 8376 val = prop[ name ]; 8377 8378 // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) 8379 if ( jQuery.isArray( val ) ) { 8380 opt.animatedProperties[ name ] = val[ 1 ]; 8381 val = prop[ name ] = val[ 0 ]; 8382 } else { 8383 opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; 8384 } 8385 8386 if ( val === "hide" && hidden || val === "show" && !hidden ) { 8387 return opt.complete.call( this ); 8388 } 8389 8390 if ( isElement && ( name === "height" || name === "width" ) ) { 8391 // Make sure that nothing sneaks out 8392 // Record all 3 overflow attributes because IE does not 8393 // change the overflow attribute when overflowX and 8394 // overflowY are set to the same value 8395 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; 8396 8397 // Set display property to inline-block for height/width 8398 // animations on inline elements that are having width/height animated 8399 if ( jQuery.css( this, "display" ) === "inline" && 8400 jQuery.css( this, "float" ) === "none" ) { 8401 8402 // inline-level elements accept inline-block; 8403 // block-level elements need to be inline with layout 8404 if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { 8405 this.style.display = "inline-block"; 8406 8407 } else { 8408 this.style.zoom = 1; 8409 } 8410 } 8411 } 8412 } 8413 8414 if ( opt.overflow != null ) { 8415 this.style.overflow = "hidden"; 8416 } 8417 8418 for ( p in prop ) { 8419 e = new jQuery.fx( this, opt, p ); 8420 val = prop[ p ]; 8421 8422 if ( rfxtypes.test( val ) ) { 8423 8424 // Tracks whether to show or hide based on private 8425 // data attached to the element 8426 method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); 8427 if ( method ) { 8428 jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); 8429 e[ method ](); 8430 } else { 8431 e[ val ](); 8432 } 8433 8434 } else { 8435 parts = rfxnum.exec( val ); 8436 start = e.cur(); 8437 8438 if ( parts ) { 8439 end = parseFloat( parts[2] ); 8440 unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); 8441 8442 // We need to compute starting value 8443 if ( unit !== "px" ) {
8444 jQuery.style( this, p, (end || 1) + unit); 8445 start = ( (end || 1) / e.cur() ) * start; 8446 jQuery.style( this, p, start + unit); 8447 } 8448 8449 // If a +=/-= token was provided, we're doing a relative animation 8450 if ( parts[1] ) { 8451 end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; 8452 } 8453 8454 e.custom( start, end, unit ); 8455 8456 } else { 8457 e.custom( start, val, "" ); 8458 } 8459 } 8460 } 8461 8462 // For JS strict compliance 8463 return true; 8464 } 8465 8466 return optall.queue === false ? 8467 this.each( doAnimation ) : 8468 this.queue( optall.queue, doAnimation ); 8469 }, 8470 8471 stop: function( type, clearQueue, gotoEnd ) { 8472 if ( typeof type !== "string" ) { 8473 gotoEnd = clearQueue; 8474 clearQueue = type; 8475 type = undefined; 8476 } 8477 if ( clearQueue && type !== false ) { 8478 this.queue( type || "fx", [] ); 8479 } 8480 8481 return this.each(function() { 8482 var index, 8483 hadTimers = false, 8484 timers = jQuery.timers, 8485 data = jQuery._data( this ); 8486 8487 // clear marker counters if we know they won't be 8488 if ( !gotoEnd ) { 8489 jQuery._unmark( true, this ); 8490 } 8491 8492 function stopQueue( elem, data, index ) { 8493 var hooks = data[ index ]; 8494 jQuery.removeData( elem, index, true ); 8495 hooks.stop( gotoEnd ); 8496 } 8497 8498 if ( type == null ) { 8499 for ( index in data ) { 8500 if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { 8501 stopQueue( this, data, index ); 8502 } 8503 } 8504 } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ 8505 stopQueue( this, data, index ); 8506 } 8507 8508 for ( index = timers.length; index--; ) { 8509 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { 8510 if ( gotoEnd ) { 8511 8512 // force the next step to be the last 8513 timers[ index ]( true ); 8514 } else { 8515 timers[ index ].saveState(); 8516 } 8517 hadTimers = true; 8518 timers.splice( index, 1 ); 8519 } 8520 } 8521 8522 // start the next in the queue if the last step wasn't forced 8523 // timers currently will call their complete callbacks, which will dequeue 8524 // but only if they were gotoEnd 8525 if ( !( gotoEnd && hadTimers ) ) { 8526 jQuery.dequeue( this, type ); 8527 } 8528 }); 8529 } 8530 8531}); 8532 8533// Animations created synchronously will run synchronously 8534function createFxNow() { 8535 setTimeout( clearFxNow, 0 ); 8536 return ( fxNow = jQuery.now() ); 8537} 8538 8539function clearFxNow() { 8540 fxNow = undefined; 8541} 8542 8543// Generate parameters to create a standard animation 8544function genFx( type, num ) { 8545 var obj = {}; 8546 8547 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { 8548 obj[ this ] = type; 8549 }); 8550 8551 return obj; 8552} 8553 8554// Generate shortcuts for custom animations 8555jQuery.each({ 8556 slideDown: genFx( "show", 1 ), 8557 slideUp: genFx( "hide", 1 ), 8558 slideToggle: genFx( "toggle", 1 ), 8559 fadeIn: { opacity: "show" }, 8560 fadeOut: { opacity: "hide" }, 8561 fadeToggle: { opacity: "toggle" } 8562}, function( name, props ) { 8563 jQuery.fn[ name ] = function( speed, easing, callback ) { 8564 return this.animate( props, speed, easing, callback ); 8565 }; 8566}); 8567 8568jQuery.extend({ 8569 speed: function( speed, easing, fn ) { 8570 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 8571 complete: fn || !fn && easing || 8572 jQuery.isFunction( speed ) && speed, 8573 duration: speed, 8574 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 8575 }; 8576 8577 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 8578 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 8579 8580 // normalize opt.queue - true/undefined/null -> "fx" 8581 if ( opt.queue == null || opt.queue === true ) { 8582 opt.queue = "fx"; 8583 } 8584 8585 // Queueing 8586 opt.old = opt.complete; 8587 8588 opt.complete = function( noUnmark ) { 8589 if ( jQuery.isFunction( opt.old ) ) { 8590 opt.old.call( this ); 8591 } 8592 8593 if ( opt.queue ) { 8594 jQuery.dequeue( this, opt.queue ); 8595 } else if ( noUnmark !== false ) { 8596 jQuery._unmark( this ); 8597 } 8598 }; 8599 8600 return opt; 8601 }, 8602 8603 easing: { 8604 linear: function( p, n, firstNum, diff ) { 8605 return firstNum + diff * p; 8606 }, 8607 swing: function( p, n, firstNum, diff ) { 8608 return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum; 8609 } 8610 }, 8611 8612 timers: [], 8613 8614 fx: function( elem, options, prop ) { 8615 this.options = options; 8616 this.elem = elem; 8617 this.prop = prop; 8618 8619 options.orig = options.orig || {}; 8620 } 8621 8622}); 8623 8624jQuery.fx.prototype = { 8625 // Simple function for setting a style value 8626 update: function() { 8627 if ( this.options.step ) { 8628 this.options.step.call( this.elem, this.now, this ); 8629 } 8630 8631 ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); 8632 }, 8633 8634 // Get the current size 8635 cur: function() { 8636 if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { 8637 return this.elem[ this.prop ]; 8638 } 8639 8640 var parsed, 8641 r = jQuery.css( this.elem, this.prop ); 8642 // Empty strings, null, undefined and "auto" are converted to 0, 8643 // complex values such as "rotate(1rad)" are returned as is, 8644 // simple values such as "10px" are parsed to Float. 8645 return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; 8646 }, 8647 8648 // Start an animation from one number to another 8649 custom: function( from, to, unit ) { 8650 var self = this, 8651 fx = jQuery.fx; 8652 8653 this.startTime = fxNow || createFxNow(); 8654 this.end = to; 8655 this.now = this.start = from; 8656 this.pos = this.state = 0; 8657 this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); 8658 8659 function t( gotoEnd ) { 8660 return self.step( gotoEnd ); 8661 } 8662 8663 t.queue = this.options.queue; 8664 t.elem = this.elem;
8665 t.saveState = function() { 8666 if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { 8667 jQuery._data( self.elem, "fxshow" + self.prop, self.start ); 8668 } 8669 }; 8670 8671 if ( t() && jQuery.timers.push(t) && !timerId ) { 8672 timerId = setInterval( fx.tick, fx.interval ); 8673 } 8674 }, 8675 8676 // Simple 'show' function 8677 show: function() { 8678 var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); 8679 8680 // Remember where we started, so that we can go back to it later 8681 this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); 8682 this.options.show = true; 8683 8684 // Begin the animation 8685 // Make sure that we start at a small width/height to avoid any flash of content 8686 if ( dataShow !== undefined ) { 8687 // This show is picking up where a previous hide or show left off 8688 this.custom( this.cur(), dataShow ); 8689 } else { 8690 this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); 8691 } 8692 8693 // Start by showing the element 8694 jQuery( this.elem ).show(); 8695 }, 8696 8697 // Simple 'hide' function 8698 hide: function() { 8699 // Remember where we started, so that we can go back to it later 8700 this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); 8701 this.options.hide = true; 8702 8703 // Begin the animation 8704 this.custom( this.cur(), 0 ); 8705 }, 8706 8707 // Each step of an animation 8708 step: function( gotoEnd ) { 8709 var p, n, complete, 8710 t = fxNow || createFxNow(), 8711 done = true, 8712 elem = this.elem, 8713 options = this.options; 8714 8715 if ( gotoEnd || t >= options.duration + this.startTime ) { 8716 this.now = this.end; 8717 this.pos = this.state = 1; 8718 this.update(); 8719 8720 options.animatedProperties[ this.prop ] = true; 8721 8722 for ( p in options.animatedProperties ) { 8723 if ( options.animatedProperties[ p ] !== true ) { 8724 done = false; 8725 } 8726 } 8727 8728 if ( done ) { 8729 // Reset the overflow 8730 if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { 8731 8732 jQuery.each( [ "", "X", "Y" ], function( index, value ) { 8733 elem.style[ "overflow" + value ] = options.overflow[ index ]; 8734 }); 8735 } 8736 8737 // Hide the element if the "hide" operation was done 8738 if ( options.hide ) { 8739 jQuery( elem ).hide(); 8740 } 8741 8742 // Reset the properties, if the item has been hidden or shown 8743 if ( options.hide || options.show ) { 8744 for ( p in options.animatedProperties ) { 8745 jQuery.style( elem, p, options.orig[ p ] ); 8746 jQuery.removeData( elem, "fxshow" + p, true ); 8747 // Toggle data is no longer needed 8748 jQuery.removeData( elem, "toggle" + p, true ); 8749 } 8750 } 8751 8752 // Execute the complete function 8753 // in the event that the complete function throws an exception 8754 // we must ensure it won't be called twice. #5684 8755 8756 complete = options.complete; 8757 if ( complete ) { 8758 8759 options.complete = false; 8760 complete.call( elem ); 8761 } 8762 } 8763 8764 return false; 8765 8766 } else { 8767 // classical easing cannot be used with an Infinity duration 8768 if ( options.duration == Infinity ) { 8769 this.now = t; 8770 } else { 8771 n = t - this.startTime; 8772 this.state = n / options.duration; 8773 8774 // Perform the easing function, defaults to swing 8775 this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); 8776 this.now = this.start + ( (this.end - this.start) * this.pos ); 8777 } 8778 // Perform the next step of the animation 8779 this.update(); 8780 } 8781 8782 return true; 8783 } 8784}; 8785 8786jQuery.extend( jQuery.fx, { 8787 tick: function() { 8788 var timer, 8789 timers = jQuery.timers, 8790 i = 0; 8791 8792 for ( ; i < timers.length; i++ ) { 8793 timer = timers[ i ]; 8794 // Checks the timer has not already been removed 8795 if ( !timer() && timers[ i ] === timer ) { 8796 timers.splice( i--, 1 ); 8797 } 8798 } 8799 8800 if ( !timers.length ) { 8801 jQuery.fx.stop(); 8802 } 8803 }, 8804 8805 interval: 13, 8806 8807 stop: function() { 8808 clearInterval( timerId ); 8809 timerId = null; 8810 }, 8811 8812 speeds: { 8813 slow: 600, 8814 fast: 200, 8815 // Default speed 8816 _default: 400 8817 }, 8818 8819 step: { 8820 opacity: function( fx ) { 8821 jQuery.style( fx.elem, "opacity", fx.now ); 8822 }, 8823 8824 _default: function( fx ) { 8825 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { 8826 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 8827 } else { 8828 fx.elem[ fx.prop ] = fx.now; 8829 } 8830 } 8831 } 8832}); 8833 8834// Adds width/height step functions 8835// Do not set anything below 0 8836jQuery.each([ "width", "height" ], function( i, prop ) { 8837 jQuery.fx.step[ prop ] = function( fx ) { 8838 jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); 8839 }; 8840}); 8841 8842if ( jQuery.expr && jQuery.expr.filters ) { 8843 jQuery.expr.filters.animated = function( elem ) { 8844 return jQuery.grep(jQuery.timers, function( fn ) { 8845 return elem === fn.elem; 8846 }).length; 8847 }; 8848} 8849 8850// Try to restore the default display value of an element 8851function defaultDisplay( nodeName ) { 8852 8853 if ( !elemdisplay[ nodeName ] ) { 8854 8855 var body = document.body, 8856 elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), 8857 display = elem.css( "display" ); 8858 elem.remove(); 8859 8860 // If the simple way fails, 8861 // get element's real default display by attaching it to a temp iframe 8862 if ( display === "none" || display === "" ) { 8863 // No iframe to use yet, so create it 8864 if ( !iframe ) { 8865 iframe = document.createElement( "iframe" ); 8866 iframe.frameBorder = iframe.width = iframe.height = 0; 8867 } 8868 8869 body.appendChild( iframe ); 8870 8871 // Create a cacheable copy of the iframe document on first call. 8872 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML 8873 // document to it; WebKit & Firefox won't allow reusing the iframe document. 8874 if ( !iframeDoc || !iframe.createElement ) { 8875 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; 8876 iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" ); 8877 iframeDoc.close(); 8878 } 8879 8880 elem = iframeDoc.createElement( nodeName ); 8881 8882 iframeDoc.body.appendChild( elem ); 8883
8884 display = jQuery.css( elem, "display" ); 8885 body.removeChild( iframe ); 8886 } 8887 8888 // Store the correct default display 8889 elemdisplay[ nodeName ] = display; 8890 } 8891 8892 return elemdisplay[ nodeName ]; 8893} 8894 8895 8896 8897 8898var rtable = /^t(?:able|d|h)$/i, 8899 rroot = /^(?:body|html)$/i; 8900 8901if ( "getBoundingClientRect" in document.documentElement ) { 8902 jQuery.fn.offset = function( options ) { 8903 var elem = this[0], box; 8904 8905 if ( options ) { 8906 return this.each(function( i ) { 8907 jQuery.offset.setOffset( this, options, i ); 8908 }); 8909 } 8910 8911 if ( !elem || !elem.ownerDocument ) { 8912 return null; 8913 } 8914 8915 if ( elem === elem.ownerDocument.body ) { 8916 return jQuery.offset.bodyOffset( elem ); 8917 } 8918 8919 try { 8920 box = elem.getBoundingClientRect(); 8921 } catch(e) {} 8922 8923 var doc = elem.ownerDocument, 8924 docElem = doc.documentElement; 8925 8926 // Make sure we're not dealing with a disconnected DOM node 8927 if ( !box || !jQuery.contains( docElem, elem ) ) { 8928 return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; 8929 } 8930 8931 var body = doc.body, 8932 win = getWindow(doc), 8933 clientTop = docElem.clientTop || body.clientTop || 0, 8934 clientLeft = docElem.clientLeft || body.clientLeft || 0, 8935 scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, 8936 scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, 8937 top = box.top + scrollTop - clientTop, 8938 left = box.left + scrollLeft - clientLeft; 8939 8940 return { top: top, left: left }; 8941 }; 8942 8943} else { 8944 jQuery.fn.offset = function( options ) { 8945 var elem = this[0]; 8946 8947 if ( options ) { 8948 return this.each(function( i ) { 8949 jQuery.offset.setOffset( this, options, i ); 8950 }); 8951 } 8952 8953 if ( !elem || !elem.ownerDocument ) { 8954 return null; 8955 } 8956 8957 if ( elem === elem.ownerDocument.body ) { 8958 return jQuery.offset.bodyOffset( elem ); 8959 } 8960 8961 var computedStyle, 8962 offsetParent = elem.offsetParent, 8963 prevOffsetParent = elem, 8964 doc = elem.ownerDocument, 8965 docElem = doc.documentElement, 8966 body = doc.body, 8967 defaultView = doc.defaultView, 8968 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, 8969 top = elem.offsetTop, 8970 left = elem.offsetLeft; 8971 8972 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { 8973 if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { 8974 break; 8975 } 8976 8977 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; 8978 top -= elem.scrollTop; 8979 left -= elem.scrollLeft; 8980 8981 if ( elem === offsetParent ) { 8982 top += elem.offsetTop; 8983 left += elem.offsetLeft; 8984 8985 if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { 8986 top += parseFloat( computedStyle.borderTopWidth ) || 0; 8987 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 8988 } 8989 8990 prevOffsetParent = offsetParent; 8991 offsetParent = elem.offsetParent; 8992 } 8993 8994 if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { 8995 top += parseFloat( computedStyle.borderTopWidth ) || 0; 8996 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 8997 } 8998 8999 prevComputedStyle = computedStyle; 9000 } 9001 9002 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { 9003 top += body.offsetTop; 9004 left += body.offsetLeft; 9005 } 9006 9007 if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { 9008 top += Math.max( docElem.scrollTop, body.scrollTop ); 9009 left += Math.max( docElem.scrollLeft, body.scrollLeft ); 9010 } 9011 9012 return { top: top, left: left }; 9013 }; 9014} 9015 9016jQuery.offset = { 9017 9018 bodyOffset: function( body ) { 9019 var top = body.offsetTop, 9020 left = body.offsetLeft; 9021 9022 if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { 9023 top += parseFloat( jQuery.css(body, "marginTop") ) || 0; 9024 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; 9025 } 9026 9027 return { top: top, left: left }; 9028 }, 9029 9030 setOffset: function( elem, options, i ) { 9031 var position = jQuery.css( elem, "position" ); 9032 9033 // set position first, in-case top/left are set even on static elem 9034 if ( position === "static" ) { 9035 elem.style.position = "relative"; 9036 } 9037 9038 var curElem = jQuery( elem ), 9039 curOffset = curElem.offset(), 9040 curCSSTop = jQuery.css( elem, "top" ), 9041 curCSSLeft = jQuery.css( elem, "left" ), 9042 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, 9043 props = {}, curPosition = {}, curTop, curLeft; 9044 9045 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 9046 if ( calculatePosition ) { 9047 curPosition = curElem.position(); 9048 curTop = curPosition.top; 9049 curLeft = curPosition.left; 9050 } else { 9051 curTop = parseFloat( curCSSTop ) || 0; 9052 curLeft = parseFloat( curCSSLeft ) || 0; 9053 } 9054 9055 if ( jQuery.isFunction( options ) ) { 9056 options = options.call( elem, i, curOffset ); 9057 } 9058 9059 if ( options.top != null ) { 9060 props.top = ( options.top - curOffset.top ) + curTop; 9061 } 9062 if ( options.left != null ) { 9063 props.left = ( options.left - curOffset.left ) + curLeft; 9064 } 9065 9066 if ( "using" in options ) { 9067 options.using.call( elem, props ); 9068 } else { 9069 curElem.css( props ); 9070 } 9071 } 9072}; 9073 9074 9075jQuery.fn.extend({ 9076 9077 position: function() { 9078 if ( !this[0] ) { 9079 return null; 9080 } 9081 9082 var elem = this[0], 9083 9084 // Get *real* offsetParent 9085 offsetParent = this.offsetParent(), 9086 9087 // Get correct offsets 9088 offset = this.offset(), 9089 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); 9090 9091 // Subtract element margins 9092 // note: when an element has margin: auto the offsetLeft and marginLeft 9093 // are the same in Safari causing offset.left to incorrectly be 0 9094 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; 9095 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; 9096 9097 // Add offsetParent borders 9098 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; 9099 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; 9100 9101 // Subtract the two offsets 9102 return { 9103 top: offset.top - parentOffset.top, 9104 left: offset.left - parentOffset.left 9105 }; 9106 }, 9107 9108 offsetParent: function() { 9109 return this.map(function() { 9110 var offsetParent = this.offsetParent || document.body;
9111 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { 9112 offsetParent = offsetParent.offsetParent; 9113 } 9114 return offsetParent; 9115 }); 9116 } 9117}); 9118 9119 9120// Create scrollLeft and scrollTop methods 9121jQuery.each( ["Left", "Top"], function( i, name ) { 9122 var method = "scroll" + name; 9123 9124 jQuery.fn[ method ] = function( val ) { 9125 var elem, win; 9126 9127 if ( val === undefined ) { 9128 elem = this[ 0 ]; 9129 9130 if ( !elem ) { 9131 return null; 9132 } 9133 9134 win = getWindow( elem ); 9135 9136 // Return the scroll offset 9137 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : 9138 jQuery.support.boxModel && win.document.documentElement[ method ] || 9139 win.document.body[ method ] : 9140 elem[ method ]; 9141 } 9142 9143 // Set the scroll offset 9144 return this.each(function() { 9145 win = getWindow( this ); 9146 9147 if ( win ) { 9148 win.scrollTo( 9149 !i ? val : jQuery( win ).scrollLeft(), 9150 i ? val : jQuery( win ).scrollTop() 9151 ); 9152 9153 } else { 9154 this[ method ] = val; 9155 } 9156 }); 9157 }; 9158}); 9159 9160function getWindow( elem ) { 9161 return jQuery.isWindow( elem ) ? 9162 elem : 9163 elem.nodeType === 9 ? 9164 elem.defaultView || elem.parentWindow : 9165 false; 9166} 9167 9168 9169 9170 9171// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods 9172jQuery.each([ "Height", "Width" ], function( i, name ) { 9173 9174 var type = name.toLowerCase(); 9175 9176 // innerHeight and innerWidth 9177 jQuery.fn[ "inner" + name ] = function() { 9178 var elem = this[0]; 9179 return elem ? 9180 elem.style ? 9181 parseFloat( jQuery.css( elem, type, "padding" ) ) : 9182 this[ type ]() : 9183 null; 9184 }; 9185 9186 // outerHeight and outerWidth 9187 jQuery.fn[ "outer" + name ] = function( margin ) { 9188 var elem = this[0]; 9189 return elem ? 9190 elem.style ? 9191 parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : 9192 this[ type ]() : 9193 null; 9194 }; 9195 9196 jQuery.fn[ type ] = function( size ) { 9197 // Get window width or height 9198 var elem = this[0]; 9199 if ( !elem ) { 9200 return size == null ? null : this; 9201 } 9202 9203 if ( jQuery.isFunction( size ) ) { 9204 return this.each(function( i ) { 9205 var self = jQuery( this ); 9206 self[ type ]( size.call( this, i, self[ type ]() ) ); 9207 }); 9208 } 9209 9210 if ( jQuery.isWindow( elem ) ) { 9211 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode 9212 // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat 9213 var docElemProp = elem.document.documentElement[ "client" + name ], 9214 body = elem.document.body; 9215 return elem.document.compatMode === "CSS1Compat" && docElemProp || 9216 body && body[ "client" + name ] || docElemProp; 9217 9218 // Get document width or height 9219 } else if ( elem.nodeType === 9 ) { 9220 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 9221 return Math.max( 9222 elem.documentElement["client" + name], 9223 elem.body["scroll" + name], elem.documentElement["scroll" + name], 9224 elem.body["offset" + name], elem.documentElement["offset" + name] 9225 ); 9226 9227 // Get or set width or height on the element 9228 } else if ( size === undefined ) { 9229 var orig = jQuery.css( elem, type ), 9230 ret = parseFloat( orig ); 9231 9232 return jQuery.isNumeric( ret ) ? ret : orig; 9233 9234 // Set the width or height on the element (default to pixels if value is unitless) 9235 } else { 9236 return this.css( type, typeof size === "string" ? size : size + "px" ); 9237 } 9238 }; 9239 9240}); 9241 9242 9243 9244 9245// Expose jQuery to the global object 9246window.jQuery = window.$ = jQuery; 9247 9248// Expose jQuery as an AMD module, but only for AMD loaders that 9249// understand the issues with loading multiple versions of jQuery 9250// in a page that all might call define(). The loader will indicate 9251// they have special allowances for multiple jQuery versions by 9252// specifying define.amd.jQuery = true. Register as a named module, 9253// since jQuery can be concatenated with other files that may use define, 9254// but not use a proper concatenation script that understands anonymous 9255// AMD modules. A named AMD is safest and most robust way to register. 9256// Lowercase jquery is used because AMD module names are derived from 9257// file names, and jQuery is normally delivered in a lowercase file name. 9258// Do this after creating the global so that if an AMD module wants to call
9259// noConflict to hide this version of jQuery, it will work. 9260if ( typeof define === "function" && define.amd && define.amd.jQuery ) { 9261 define( "jquery", [], function () { return jQuery; } ); 9262} 9263 9264 9265 9266})( window ); 9267(function($, undefined) { 9268 9269/** 9270 * Unobtrusive scripting adapter for jQuery 9271 * 9272 * Requires jQuery 1.6.0 or later. 9273 * https://github.com/rails/jquery-ujs 9274 9275 * Uploading file using rails.js 9276 * ============================= 9277 * 9278 * By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields 9279 * in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means. 9280 * 9281 * The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish. 9282 * 9283 * Ex: 9284 * $('form').live('ajax:aborted:file', function(event, elements){ 9285 * // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`. 9286 * // Returning false in this handler tells rails.js to disallow standard form submission 9287 * return false; 9288 * }); 9289 * 9290 * The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value. 9291 * 9292 * Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use 9293 * techniques like the iframe method to upload the file instead. 9294 * 9295 * Required fields in rails.js 9296 * =========================== 9297 * 9298 * If any blank required inputs (required="required") are detected in the remote form, the whole form submission 9299 * is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission. 9300 * 9301 * The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs. 9302 * 9303 * !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never 9304 * get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior. 9305 * 9306 * Ex: 9307 * $('form').live('ajax:aborted:required', function(event, elements){ 9308 * // Returning false in this handler tells rails.js to submit the form anyway. 9309 * // The blank required inputs are passed to this function in `elements`. 9310 * return ! confirm("Would you like to submit the form with missing info?"); 9311 * }); 9312 */ 9313 9314 // Shorthand to make it a little easier to call public rails functions from within rails.js 9315 var rails; 9316 9317 $.rails = rails = { 9318 // Link elements bound by jquery-ujs 9319 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]', 9320 9321 // Select elements bound by jquery-ujs 9322 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 9323 9324 // Form elements bound by jquery-ujs 9325 formSubmitSelector: 'form', 9326 9327 // Form input elements bound by jquery-ujs 9328 formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not(button[type])', 9329 9330 // Form input elements disabled during form submission 9331 disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]', 9332 9333 // Form input elements re-enabled after form submission 9334 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled', 9335 9336 // Form required input elements 9337 requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])', 9338 9339 // Form file input elements 9340 fileInputSelector: 'input:file', 9341 9342 // Link onClick disable selector with possible reenable after remote submission 9343 linkDisableSelector: 'a[data-disable-with]', 9344 9345 // Make sure that every Ajax request sends the CSRF token 9346 CSRFProtection: function(xhr) { 9347 var token = $('meta[name="csrf-token"]').attr('content'); 9348 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 9349 }, 9350 9351 // Triggers an event on an element and returns false if the event result is false 9352 fire: function(obj, name, data) { 9353 var event = $.Event(name); 9354 obj.trigger(event, data); 9355 return event.result !== false; 9356 }, 9357 9358 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 9359 confirm: function(message) { 9360 return confirm(message); 9361 }, 9362 9363 // Default ajax function, may be overridden with custom function in $.rails.ajax 9364 ajax: function(options) { 9365 return $.ajax(options); 9366 }, 9367 9368 // Submits "remote" forms and links with ajax 9369 handleRemote: function(element) { 9370 var method, url, data, 9371 crossDomain = element.data('cross-domain') || null, 9372 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType), 9373 options; 9374 9375 if (rails.fire(element, 'ajax:before')) { 9376 9377 if (element.is('form')) { 9378 method = element.attr('method'); 9379 url = element.attr('action'); 9380 data = element.serializeArray(); 9381 // memoized value from clicked submit button 9382 var button = element.data('ujs:submit-button'); 9383 if (button) { 9384 data.push(button); 9385 element.data('ujs:submit-button', null); 9386 } 9387 } else if (element.is(rails.inputChangeSelector)) { 9388 method = element.data('method'); 9389 url = element.data('url'); 9390 data = element.serialize(); 9391 if (element.data('params')) data = data + "&" + element.data('params'); 9392 } else { 9393 method = element.data('method'); 9394 url = element.attr('href'); 9395 data = element.data('params') || null; 9396 } 9397 9398 options = { 9399 type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain, 9400 // stopping the "ajax:beforeSend" event will cancel the ajax request 9401 beforeSend: function(xhr, settings) { 9402 if (settings.dataType === undefined) { 9403 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 9404 } 9405 return rails.fire(element, 'ajax:beforeSend', [xhr, settings]); 9406 }, 9407 success: function(data, status, xhr) {
9408 element.trigger('ajax:success', [data, status, xhr]); 9409 }, 9410 complete: function(xhr, status) { 9411 element.trigger('ajax:complete', [xhr, status]); 9412 }, 9413 error: function(xhr, status, error) { 9414 element.trigger('ajax:error', [xhr, status, error]); 9415 } 9416 }; 9417 // Only pass url to `ajax` options if not blank 9418 if (url) { options.url = url; } 9419 9420 return rails.ajax(options); 9421 } else { 9422 return false; 9423 } 9424 }, 9425 9426 // Handles "data-method" on links such as: 9427 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 9428 handleMethod: function(link) { 9429 var href = link.attr('href'), 9430 method = link.data('method'), 9431 target = link.attr('target'), 9432 csrf_token = $('meta[name=csrf-token]').attr('content'), 9433 csrf_param = $('meta[name=csrf-param]').attr('content'), 9434 form = $('<form method="post" action="' + href + '"></form>'), 9435 metadata_input = '<input name="_method" value="' + method + '" type="hidden" />'; 9436 9437 if (csrf_param !== undefined && csrf_token !== undefined) { 9438 metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />'; 9439 } 9440 9441 if (target) { form.attr('target', target); } 9442 9443 form.hide().append(metadata_input).appendTo('body'); 9444 form.submit(); 9445 }, 9446 9447 /* Disables form elements: 9448 - Caches element value in 'ujs:enable-with' data store 9449 - Replaces element text with value of 'data-disable-with' attribute 9450 - Sets disabled property to true 9451 */ 9452 disableFormElements: function(form) { 9453 form.find(rails.disableSelector).each(function() { 9454 var element = $(this), method = element.is('button') ? 'html' : 'val'; 9455 element.data('ujs:enable-with', element[method]()); 9456 element[method](element.data('disable-with')); 9457 element.prop('disabled', true); 9458 }); 9459 }, 9460 9461 /* Re-enables disabled form elements: 9462 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 9463 - Sets disabled property to false 9464 */ 9465 enableFormElements: function(form) { 9466 form.find(rails.enableSelector).each(function() { 9467 var element = $(this), method = element.is('button') ? 'html' : 'val'; 9468 if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with')); 9469 element.prop('disabled', false); 9470 }); 9471 }, 9472 9473 /* For 'data-confirm' attribute: 9474 - Fires `confirm` event 9475 - Shows the confirmation dialog 9476 - Fires the `confirm:complete` event 9477 9478 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 9479 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 9480 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function 9481 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 9482 */ 9483 allowAction: function(element) { 9484 var message = element.data('confirm'), 9485 answer = false, callback; 9486 if (!message) { return true; } 9487 9488 if (rails.fire(element, 'confirm')) { 9489 answer = rails.confirm(message); 9490 callback = rails.fire(element, 'confirm:complete', [answer]); 9491 } 9492 return answer && callback; 9493 }, 9494 9495 // Helper function which checks for blank inputs in a form that match the specified CSS selector 9496 blankInputs: function(form, specifiedSelector, nonBlank) { 9497 var inputs = $(), input, 9498 selector = specifiedSelector || 'input,textarea'; 9499 form.find(selector).each(function() { 9500 input = $(this); 9501 // Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs 9502 if (nonBlank ? input.val() : !input.val()) { 9503 inputs = inputs.add(input); 9504 } 9505 }); 9506 return inputs.length ? inputs : false; 9507 }, 9508 9509 // Helper function which checks for non-blank inputs in a form that match the specified CSS
9509selector 9510 nonBlankInputs: function(form, specifiedSelector) { 9511 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 9512 }, 9513 9514 // Helper function, needed to provide consistent behavior in IE 9515 stopEverything: function(e) { 9516 $(e.target).trigger('ujs:everythingStopped'); 9517 e.stopImmediatePropagation(); 9518 return false; 9519 }, 9520 9521 // find all the submit events directly bound to the form and 9522 // manually invoke them. If anyone returns false then stop the loop 9523 callFormSubmitBindings: function(form, event) { 9524 var events = form.data('events'), continuePropagation = true; 9525 if (events !== undefined && events['submit'] !== undefined) { 9526 $.each(events['submit'], function(i, obj){ 9527 if (typeof obj.handler === 'function') return continuePropagation = obj.handler(event); 9528 }); 9529 } 9530 return continuePropagation; 9531 }, 9532 9533 // replace element's html with the 'data-disable-with' after storing original html 9534 // and prevent clicking on it 9535 disableElement: function(element) { 9536 element.data('ujs:enable-with', element.html()); // store enabled state 9537 element.html(element.data('disable-with')); // set to disabled state 9538 element.bind('click.railsDisable', function(e) { // prevent further clicking 9539 return rails.stopEverything(e) 9540 }); 9541 }, 9542 9543 // restore element to its original state which was disabled by 'disableElement' above 9544 enableElement: function(element) { 9545 if (element.data('ujs:enable-with') !== undefined) { 9546 element.html(element.data('ujs:enable-with')); // set to old enabled state 9547 // this should be element.removeData('ujs:enable-with') 9548 // but, there is currently a bug in jquery which makes hyphenated data attributes not get removed 9549 element.data('ujs:enable-with', false); // clean up cache 9550 } 9551 element.unbind('click.railsDisable'); // enable element 9552 } 9553 9554 }; 9555 9556 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 9557 9558 $(document).delegate(rails.linkDisableSelector, 'ajax:complete', function() { 9559 rails.enableElement($(this)); 9560 }); 9561 9562 $(document).delegate(rails.linkClickSelector, 'click.rails', function(e) { 9563 var link = $(this), method = link.data('method'), data = link.data('params'); 9564 if (!rails.allowAction(link)) return rails.stopEverything(e); 9565 9566 if (link.is(rails.linkDisableSelector)) rails.disableElement(link); 9567 9568 if (link.data('remote') !== undefined) { 9569 if ( (e.metaKey || e.ctrlKey) && (!method || method === 'GET') && !data ) { return true; } 9570 9571 if (rails.handleRemote(link) === false) { rails.enableElement(link); } 9572 return false; 9573 9574 } else if (link.data('method')) { 9575 rails.handleMethod(link); 9576 return false; 9577 } 9578 }); 9579 9580 $(document).delegate(rails.inputChangeSelector, 'change.rails', function(e) { 9581 var link = $(this); 9582 if (!rails.allowAction(link)) return rails.stopEverything(e); 9583 9584 rails.handleRemote(link); 9585 return false; 9586 }); 9587 9588 $(document).delegate(rails.formSubmitSelector, 'submit.rails', function(e) { 9589 var form = $(this), 9590 remote = form.data('remote') !== undefined, 9591 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector), 9592 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 9593 9594 if (!rails.allowAction(form)) return rails.stopEverything(e); 9595 9596 // skip other logic when required values are missing or file upload is present 9597 if (blankRequiredInputs && form.attr("novalidate") == undefined && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 9598 return rails.stopEverything(e); 9599 } 9600 9601 if (remote) { 9602 if (nonBlankFileInputs) { 9603 return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 9604 } 9605 9606 // If browser does not support submit bubbling, then this live-binding will be called before direct 9607 // bindings. Therefore, we should directly call any direct bindings before remotely submitting form. 9608 if (!$.support.submitBubbles && $().jquery < '1.7' && rails.callFormSubmitBindings(form, e) === false) return rails.stopEverything(e); 9609 9610 rails.handleRemote(form); 9611 return false;
9612 9613 } else { 9614 // slight timeout so that the submit button gets properly serialized 9615 setTimeout(function(){ rails.disableFormElements(form); }, 13); 9616 } 9617 }); 9618 9619 $(document).delegate(rails.formInputClickSelector, 'click.rails', function(event) { 9620 var button = $(this); 9621 9622 if (!rails.allowAction(button)) return rails.stopEverything(event); 9623 9624 // register the pressed submit button 9625 var name = button.attr('name'), 9626 data = name ? {name:name, value:button.val()} : null; 9627 9628 button.closest('form').data('ujs:submit-button', data); 9629 }); 9630 9631 $(document).delegate(rails.formSubmitSelector, 'ajax:beforeSend.rails', function(event) { 9632 if (this == event.target) rails.disableFormElements($(this)); 9633 }); 9634 9635 $(document).delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) { 9636 if (this == event.target) rails.enableFormElements($(this)); 9637 }); 9638 9639})( jQuery ); 9640/*! 9641 * jQuery UI 1.8.16 9642 * 9643 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 9644 * Dual licensed under the MIT or GPL Version 2 licenses. 9645 * http://jquery.org/license 9646 * 9647 * http://docs.jquery.com/UI 9648 */ 9649(function( $, undefined ) { 9650 9651// prevent duplicate loading 9652// this is only a problem because we proxy existing functions 9653// and we don't want to double proxy them 9654$.ui = $.ui || {}; 9655if ( $.ui.version ) { 9656 return; 9657} 9658 9659$.extend( $.ui, { 9660 version: "1.8.16", 9661 9662 keyCode: { 9663 ALT: 18, 9664 BACKSPACE: 8, 9665 CAPS_LOCK: 20, 9666 COMMA: 188, 9667 COMMAND: 91, 9668 COMMAND_LEFT: 91, // COMMAND 9669 COMMAND_RIGHT: 93, 9670 CONTROL: 17, 9671 DELETE: 46, 9672 DOWN: 40, 9673 END: 35, 9674 ENTER: 13, 9675 ESCAPE: 27, 9676 HOME: 36, 9677 INSERT: 45, 9678 LEFT: 37, 9679 MENU: 93, // COMMAND_RIGHT 9680 NUMPAD_ADD: 107, 9681 NUMPAD_DECIMAL: 110, 9682 NUMPAD_DIVIDE: 111, 9683 NUMPAD_ENTER: 108, 9684 NUMPAD_MULTIPLY: 106, 9685 NUMPAD_SUBTRACT: 109, 9686 PAGE_DOWN: 34, 9687 PAGE_UP: 33, 9688 PERIOD: 190, 9689 RIGHT: 39, 9690 SHIFT: 16, 9691 SPACE: 32, 9692 TAB: 9, 9693 UP: 38, 9694 WINDOWS: 91 // COMMAND 9695 } 9696}); 9697 9698// plugins 9699$.fn.extend({ 9700 propAttr: $.fn.prop || $.fn.attr, 9701 9702 _focus: $.fn.focus, 9703 focus: function( delay, fn ) { 9704 return typeof delay === "number" ? 9705 this.each(function() { 9706 var elem = this; 9707 setTimeout(function() { 9708 $( elem ).focus(); 9709 if ( fn ) { 9710 fn.call( elem ); 9711 } 9712 }, delay ); 9713 }) : 9714 this._focus.apply( this, arguments ); 9715 }, 9716 9717 scrollParent: function() { 9718 var scrollParent; 9719 if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { 9720 scrollParent = this.parents().filter(function() { 9721 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)); 9722 }).eq(0); 9723 } else { 9724 scrollParent = this.parents().filter(function() { 9725 return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); 9726 }).eq(0); 9727 } 9728 9729 return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; 9730 }, 9731 9732 zIndex: function( zIndex ) { 9733 if ( zIndex !== undefined ) { 9734 return this.css( "zIndex", zIndex ); 9735 } 9736 9737 if ( this.length ) { 9738 var elem = $( this[ 0 ] ), position, value; 9739 while ( elem.length && elem[ 0 ] !== document ) { 9740 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9741 // This makes behavior of this function consistent across browsers 9742 // WebKit always returns auto if the element is positioned 9743 position = elem.css( "position" ); 9744 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 9745 // IE returns 0 when zIndex is not specified 9746 // other browsers return a string 9747 // we ignore the case of nested elements with an explicit value of 0 9748 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9749 value = parseInt( elem.css( "zIndex" ), 10 ); 9750 if ( !isNaN( value ) && value !== 0 ) { 9751 return value; 9752 } 9753 } 9754 elem = elem.parent(); 9755 } 9756 } 9757 9758 return 0; 9759 }, 9760 9761 disableSelection: function() { 9762 return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + 9763 ".ui-disableSelection", function( event ) { 9764 event.preventDefault(); 9765 }); 9766 }, 9767 9768 enableSelection: function() { 9769 return this.unbind( ".ui-disableSelection" ); 9770 } 9771}); 9772 9773$.each( [ "Width", "Height" ], function( i, name ) { 9774 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 9775 type = name.toLowerCase(), 9776 orig = { 9777 innerWidth: $.fn.innerWidth, 9778 innerHeight: $.fn.innerHeight, 9779 outerWidth: $.fn.outerWidth, 9780 outerHeight: $.fn.outerHeight 9781 }; 9782 9783 function reduce( elem, size, border, margin ) { 9784 $.each( side, function() { 9785 size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; 9786 if ( border ) { 9787 size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; 9788 } 9789 if ( margin ) { 9790 size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; 9791 } 9792 }); 9793 return size; 9794 } 9795
9796 $.fn[ "inner" + name ] = function( size ) { 9797 if ( size === undefined ) { 9798 return orig[ "inner" + name ].call( this ); 9799 } 9800 9801 return this.each(function() { 9802 $( this ).css( type, reduce( this, size ) + "px" ); 9803 }); 9804 }; 9805 9806 $.fn[ "outer" + name] = function( size, margin ) { 9807 if ( typeof size !== "number" ) { 9808 return orig[ "outer" + name ].call( this, size ); 9809 } 9810 9811 return this.each(function() { 9812 $( this).css( type, reduce( this, size, true, margin ) + "px" ); 9813 }); 9814 }; 9815}); 9816 9817// selectors 9818function focusable( element, isTabIndexNotNaN ) { 9819 var nodeName = element.nodeName.toLowerCase(); 9820 if ( "area" === nodeName ) { 9821 var map = element.parentNode, 9822 mapName = map.name, 9823 img; 9824 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 9825 return false; 9826 } 9827 img = $( "img[usemap=#" + mapName + "]" )[0]; 9828 return !!img && visible( img ); 9829 } 9830 return ( /input|select|textarea|button|object/.test( nodeName ) 9831 ? !element.disabled 9832 : "a" == nodeName 9833 ? element.href || isTabIndexNotNaN 9834 : isTabIndexNotNaN) 9835 // the element and all of its ancestors must be visible 9836 && visible( element ); 9837} 9838 9839function visible( element ) { 9840 return !$( element ).parents().andSelf().filter(function() { 9841 return $.curCSS( this, "visibility" ) === "hidden" || 9842 $.expr.filters.hidden( this ); 9843 }).length; 9844} 9845 9846$.extend( $.expr[ ":" ], { 9847 data: function( elem, i, match ) { 9848 return !!$.data( elem, match[ 3 ] ); 9849 }, 9850 9851 focusable: function( element ) { 9852 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 9853 }, 9854 9855 tabbable: function( element ) { 9856 var tabIndex = $.attr( element, "tabindex" ), 9857 isTabIndexNaN = isNaN( tabIndex ); 9858 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 9859 } 9860}); 9861 9862// support 9863$(function() { 9864 var body = document.body, 9865 div = body.appendChild( div = document.createElement( "div" ) ); 9866 9867 $.extend( div.style, { 9868 minHeight: "100px", 9869 height: "auto", 9870 padding: 0, 9871 borderWidth: 0 9872 }); 9873 9874 $.support.minHeight = div.offsetHeight === 100; 9875 $.support.selectstart = "onselectstart" in div; 9876 9877 // set display to none to avoid a layout bug in IE 9878 // http://dev.jquery.com/ticket/4014 9879 body.removeChild( div ).style.display = "none"; 9880}); 9881 9882 9883 9884 9885 9886// deprecated 9887$.extend( $.ui, { 9888 // $.ui.plugin is deprecated. Use the proxy pattern instead. 9889 plugin: { 9890 add: function( module, option, set ) { 9891 var proto = $.ui[ module ].prototype; 9892 for ( var i in set ) { 9893 proto.plugins[ i ] = proto.plugins[ i ] || []; 9894 proto.plugins[ i ].push( [ option, set[ i ] ] ); 9895 } 9896 }, 9897 call: function( instance, name, args ) { 9898 var set = instance.plugins[ name ]; 9899 if ( !set || !instance.element[ 0 ].parentNode ) { 9900 return; 9901 } 9902 9903 for ( var i = 0; i < set.length; i++ ) { 9904 if ( instance.options[ set[ i ][ 0 ] ] ) { 9905 set[ i ][ 1 ].apply( instance.element, args ); 9906 } 9907 } 9908 } 9909 }, 9910 9911 // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() 9912 contains: function( a, b ) { 9913 return document.compareDocumentPosition ? 9914 a.compareDocumentPosition( b ) & 16 : 9915 a !== b && a.contains( b ); 9916 }, 9917 9918 // only used by resizable 9919 hasScroll: function( el, a ) { 9920 9921 //If overflow is hidden, the element might have extra content, but the user wants to hide it 9922 if ( $( el ).css( "overflow" ) === "hidden") { 9923 return false; 9924 } 9925 9926 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 9927 has = false; 9928 9929 if ( el[ scroll ] > 0 ) { 9930 return true; 9931 } 9932 9933 // TODO: determine which cases actually cause this to happen 9934 // if the element doesn't have the scroll set, see if it's possible to 9935 // set the scroll 9936 el[ scroll ] = 1; 9937 has = ( el[ scroll ] > 0 ); 9938 el[ scroll ] = 0; 9939 return has; 9940 }, 9941 9942 // these are odd functions, fix the API or move into individual plugins 9943 isOverAxis: function( x, reference, size ) { 9944 //Determines when x coordinate is over "b" element axis 9945 return ( x > reference ) && ( x < ( reference + size ) ); 9946 }, 9947 isOver: function( y, x, top, left, height, width ) { 9948 //Determines when x, y coordinates is over "b" element 9949 return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); 9950 } 9951}); 9952 9953})( jQuery ); 9954/*! 9955 * jQuery UI Widget 1.8.16 9956 * 9957 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 9958 * Dual licensed under the MIT or GPL Version 2 licenses. 9959 * http://jquery.org/license 9960 * 9961 * http://docs.jquery.com/UI/Widget 9962 */ 9963(function( $, undefined ) { 9964 9965// jQuery 1.4+ 9966if ( $.cleanData ) { 9967 var _cleanData = $.cleanData; 9968 $.cleanData = function( elems ) { 9969 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 9970 try { 9971 $( elem ).triggerHandler( "remove" ); 9972 // http://bugs.jquery.com/ticket/8235 9973 } catch( e ) {} 9974 } 9975 _cleanData( elems ); 9976 }; 9977} else { 9978 var _remove = $.fn.remove; 9979 $.fn.remove = function( selector, keepData ) { 9980 return this.each(function() { 9981 if ( !keepData ) { 9982 if ( !selector || $.filter( selector, [ this ] ).length ) { 9983 $( "*", this ).add( [ this ] ).each(function() { 9984 try { 9985 $( this ).triggerHandler( "remove" ); 9986 // http://bugs.jquery.com/ticket/8235 9987 } catch( e ) {} 9988 }); 9989 } 9990 } 9991 return _remove.call( $(this), selector, keepData ); 9992 }); 9993 }; 9994} 9995 9996$.widget = function( name, base, prototype ) { 9997 var namespace = name.split( "." )[ 0 ], 9998 fullName; 9999 name = name.split( "." )[ 1 ]; 10000 fullName = namespace + "-" + name; 10001 10002 if ( !prototype ) { 10003 prototype = base; 10004 base = $.Widget; 10005 } 10006 10007 // create selector for plugin 10008 $.expr[ ":" ][ fullName ] = function( elem ) { 10009 return !!$.data( elem, name ); 10010 }; 10011 10012 $[ namespace ] = $[ namespace ] || {}; 10013 $[ namespace ][ name ] = function( options, element ) { 10014 // allow instantiation without initializing for simple inheritance 10015 if ( arguments.length ) { 10016 this._createWidget( options, element ); 10017 } 10018 }; 10019 10020 var basePrototype = new base(); 10021 // we need to make the options hash a property directly on the new instance 10022 // otherwise we'll modify the options hash on the prototype that we're 10023 // inheriting from 10024// $.each( basePrototype, function( key, val ) { 10025// if ( $.isPlainObject(val) ) { 10026// basePrototype[ key ] = $.extend( {}, val ); 10027// } 10028// }); 10029 basePrototype.options = $.extend( true, {}, basePrototype.options ); 10030 $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { 10031 namespace: namespace, 10032 widgetName: name, 10033 widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, 10034 widgetBaseClass: fullName 10035 }, prototype ); 10036 10037 $.widget.bridge( name, $[ namespace ][ name ] ); 10038}; 10039 10040$.widget.bridge = function( name, object ) { 10041 $.fn[ name ] = function( options ) { 10042 var isMethodCall = typeof options === "string", 10043 args = Array.prototype.slice.call( arguments, 1 ), 10044 returnValue = this; 10045 10046 // allow multiple hashes to be passed on init 10047 options = !isMethodCall && args.length ? 10048 $.extend.apply( null, [ true, options ].concat(args) ) : 10049 options; 10050 10051 // prevent calls to internal methods 10052 if ( isMethodCall && options.charAt( 0 ) === "_" ) { 10053 return returnValue; 10054 } 10055 10056 if ( isMethodCall ) { 10057 this.each(function() { 10058 var instance = $.data( this, name ),
10059 methodValue = instance && $.isFunction( instance[options] ) ? 10060 instance[ options ].apply( instance, args ) : 10061 instance; 10062 // TODO: add this back in 1.9 and use $.error() (see #5972) 10063// if ( !instance ) { 10064// throw "cannot call methods on " + name + " prior to initialization; " + 10065// "attempted to call method '" + options + "'"; 10066// } 10067// if ( !$.isFunction( instance[options] ) ) { 10068// throw "no such method '" + options + "' for " + name + " widget instance"; 10069// } 10070// var methodValue = instance[ options ].apply( instance, args ); 10071 if ( methodValue !== instance && methodValue !== undefined ) { 10072 returnValue = methodValue; 10073 return false; 10074 } 10075 }); 10076 } else { 10077 this.each(function() { 10078 var instance = $.data( this, name ); 10079 if ( instance ) { 10080 instance.option( options || {} )._init(); 10081 } else { 10082 $.data( this, name, new object( options, this ) ); 10083 } 10084 }); 10085 } 10086 10087 return returnValue; 10088 }; 10089}; 10090 10091$.Widget = function( options, element ) { 10092 // allow instantiation without initializing for simple inheritance 10093 if ( arguments.length ) { 10094 this._createWidget( options, element ); 10095 } 10096}; 10097 10098$.Widget.prototype = { 10099 widgetName: "widget", 10100 widgetEventPrefix: "", 10101 options: { 10102 disabled: false 10103 }, 10104 _createWidget: function( options, element ) { 10105 // $.widget.bridge stores the plugin instance, but we do it anyway 10106 // so that it's stored even before the _create function runs 10107 $.data( element, this.widgetName, this ); 10108 this.element = $( element ); 10109 this.options = $.extend( true, {}, 10110 this.options, 10111 this._getCreateOptions(), 10112 options ); 10113 10114 var self = this; 10115 this.element.bind( "remove." + this.widgetName, function() { 10116 self.destroy(); 10117 }); 10118 10119 this._create(); 10120 this._trigger( "create" ); 10121 this._init(); 10122 }, 10123 _getCreateOptions: function() { 10124 return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; 10125 }, 10126 _create: function() {}, 10127 _init: function() {}, 10128 10129 destroy: function() { 10130 this.element 10131 .unbind( "." + this.widgetName ) 10132 .removeData( this.widgetName ); 10133 this.widget() 10134 .unbind( "." + this.widgetName ) 10135 .removeAttr( "aria-disabled" ) 10136 .removeClass( 10137 this.widgetBaseClass + "-disabled " + 10138 "ui-state-disabled" ); 10139 }, 10140 10141 widget: function() { 10142 return this.element; 10143 }, 10144 10145 option: function( key, value ) { 10146 var options = key; 10147 10148 if ( arguments.length === 0 ) { 10149 // don't return a reference to the internal hash 10150 return $.extend( {}, this.options ); 10151 } 10152 10153 if (typeof key === "string" ) { 10154 if ( value === undefined ) { 10155 return this.options[ key ]; 10156 } 10157 options = {}; 10158 options[ key ] = value; 10159 } 10160 10161 this._setOptions( options ); 10162 10163 return this; 10164 }, 10165 _setOptions: function( options ) { 10166 var self = this; 10167 $.each( options, function( key, value ) { 10168 self._setOption( key, value ); 10169 }); 10170 10171 return this; 10172 }, 10173 _setOption: function( key, value ) { 10174 this.options[ key ] = value; 10175 10176 if ( key === "disabled" ) { 10177 this.widget() 10178 [ value ? "addClass" : "removeClass"]( 10179 this.widgetBaseClass + "-disabled" + " " + 10180 "ui-state-disabled" ) 10181 .attr( "aria-disabled", value ); 10182 } 10183 10184 return this; 10185 }, 10186 10187 enable: function() { 10188 return this._setOption( "disabled", false ); 10189 }, 10190 disable: function() { 10191 return this._setOption( "disabled", true ); 10192 }, 10193 10194 _trigger: function( type, event, data ) { 10195 var callback = this.options[ type ]; 10196 10197 event = $.Event( event ); 10198 event.type = ( type === this.widgetEventPrefix ? 10199 type : 10200 this.widgetEventPrefix + type ).toLowerCase(); 10201 data = data || {}; 10202 10203 // copy original event properties over to the new event 10204 // this would happen if we could call $.event.fix instead of $.Event 10205 // but we don't have a way to force an event to be fixed multiple times 10206 if ( event.originalEvent ) { 10207 for ( var i = $.event.props.length, prop; i; ) { 10208 prop = $.event.props[ --i ]; 10209 event[ prop ] = event.originalEvent[ prop ]; 10210 } 10211 } 10212 10213 this.element.trigger( event, data ); 10214 10215 return !( $.isFunction(callback) && 10216 callback.call( this.element[0], event, data ) === false || 10217 event.isDefaultPrevented() ); 10218 } 10219}; 10220 10221})( jQuery ); 10222/*! 10223 * jQuery UI Mouse 1.8.16 10224 * 10225 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 10226 * Dual licensed under the MIT or GPL Version 2 licenses. 10227 * http://jquery.org/license 10228 * 10229 * http://docs.jquery.com/UI/Mouse 10230 * 10231 * Depends: 10232 * jquery.ui.widget.js 10233 */ 10234(function( $, undefined ) { 10235 10236var mouseHandled = false;
10237$( document ).mouseup( function( e ) { 10238 mouseHandled = false; 10239}); 10240 10241$.widget("ui.mouse", { 10242 options: { 10243 cancel: ':input,option', 10244 distance: 1, 10245 delay: 0 10246 }, 10247 _mouseInit: function() { 10248 var self = this; 10249 10250 this.element 10251 .bind('mousedown.'+this.widgetName, function(event) { 10252 return self._mouseDown(event); 10253 }) 10254 .bind('click.'+this.widgetName, function(event) { 10255 if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { 10256 $.removeData(event.target, self.widgetName + '.preventClickEvent'); 10257 event.stopImmediatePropagation(); 10258 return false; 10259 } 10260 }); 10261 10262 this.started = false; 10263 }, 10264 10265 // TODO: make sure destroying one instance of mouse doesn't mess with 10266 // other instances of mouse 10267 _mouseDestroy: function() { 10268 this.element.unbind('.'+this.widgetName); 10269 }, 10270 10271 _mouseDown: function(event) { 10272 // don't let more than one widget handle mouseStart 10273 if( mouseHandled ) { return }; 10274 10275 // we may have missed mouseup (out of window) 10276 (this._mouseStarted && this._mouseUp(event)); 10277 10278 this._mouseDownEvent = event; 10279 10280 var self = this, 10281 btnIsLeft = (event.which == 1), 10282 // event.target.nodeName works around a bug in IE 8 with 10283 // disabled inputs (#7620) 10284 elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); 10285 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 10286 return true; 10287 } 10288 10289 this.mouseDelayMet = !this.options.delay; 10290 if (!this.mouseDelayMet) { 10291 this._mouseDelayTimer = setTimeout(function() { 10292 self.mouseDelayMet = true; 10293 }, this.options.delay); 10294 } 10295 10296 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 10297 this._mouseStarted = (this._mouseStart(event) !== false); 10298 if (!this._mouseStarted) { 10299 event.preventDefault(); 10300 return true; 10301 } 10302 } 10303 10304 // Click event may never have fired (Gecko & Opera) 10305 if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { 10306 $.removeData(event.target, this.widgetName + '.preventClickEvent'); 10307 } 10308 10309 // these delegates are required to keep context 10310 this._mouseMoveDelegate = function(event) {
10311 return self._mouseMove(event); 10312 }; 10313 this._mouseUpDelegate = function(event) { 10314 return self._mouseUp(event); 10315 }; 10316 $(document) 10317 .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 10318 .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); 10319 10320 event.preventDefault(); 10321 10322 mouseHandled = true; 10323 return true; 10324 }, 10325 10326 _mouseMove: function(event) { 10327 // IE mouseup check - mouseup happened when mouse was out of window 10328 if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { 10329 return this._mouseUp(event); 10330 } 10331 10332 if (this._mouseStarted) { 10333 this._mouseDrag(event); 10334 return event.preventDefault(); 10335 } 10336 10337 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 10338 this._mouseStarted = 10339 (this._mouseStart(this._mouseDownEvent, event) !== false); 10340 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 10341 } 10342 10343 return !this._mouseStarted; 10344 }, 10345 10346 _mouseUp: function(event) { 10347 $(document) 10348 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) 10349 .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); 10350 10351 if (this._mouseStarted) { 10352 this._mouseStarted = false; 10353 10354 if (event.target == this._mouseDownEvent.target) { 10355 $.data(event.target, this.widgetName + '.preventClickEvent', true); 10356 } 10357 10358 this._mouseStop(event); 10359 } 10360 10361 return false; 10362 }, 10363 10364 _mouseDistanceMet: function(event) { 10365 return (Math.max( 10366 Math.abs(this._mouseDownEvent.pageX - event.pageX), 10367 Math.abs(this._mouseDownEvent.pageY - event.pageY) 10368 ) >= this.options.distance 10369 ); 10370 }, 10371 10372 _mouseDelayMet: function(event) { 10373 return this.mouseDelayMet; 10374 }, 10375 10376 // These are placeholder methods, to be overriden by extending plugin 10377 _mouseStart: function(event) {}, 10378 _mouseDrag: function(event) {}, 10379 _mouseStop: function(event) {}, 10380 _mouseCapture: function(event) { return true; } 10381}); 10382 10383})(jQuery); 10384/* 10385 * jQuery UI Position 1.8.16 10386 * 10387 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 10388 * Dual licensed under the MIT or GPL Version 2 licenses. 10389 * http://jquery.org/license 10390 * 10391 * http://docs.jquery.com/UI/Position 10392 */ 10393(function( $, undefined ) { 10394 10395$.ui = $.ui || {}; 10396 10397var horizontalPositions = /left|center|right/, 10398 verticalPositions = /top|center|bottom/, 10399 center = "center", 10400 _position = $.fn.position, 10401 _offset = $.fn.offset; 10402 10403$.fn.position = function( options ) { 10404 if ( !options || !options.of ) { 10405 return _position.apply( this, arguments ); 10406 } 10407 10408 // make a copy, we don't want to modify arguments 10409 options = $.extend( {}, options ); 10410 10411 var target = $( options.of ), 10412 targetElem = target[0], 10413 collision = ( options.collision || "flip" ).split( " " ), 10414 offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], 10415 targetWidth, 10416 targetHeight, 10417 basePosition; 10418 10419 if ( targetElem.nodeType === 9 ) { 10420 targetWidth = target.width(); 10421 targetHeight = target.height(); 10422 basePosition = { top: 0, left: 0 }; 10423 // TODO: use $.isWindow() in 1.9 10424 } else if ( targetElem.setTimeout ) { 10425 targetWidth = target.width(); 10426 targetHeight = target.height(); 10427 basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; 10428 } else if ( targetElem.preventDefault ) { 10429 // force left top to allow flipping 10430 options.at = "left top"; 10431 targetWidth = targetHeight = 0; 10432 basePosition = { top: options.of.pageY, left: options.of.pageX }; 10433 } else { 10434 targetWidth = target.outerWidth(); 10435 targetHeight = target.outerHeight(); 10436 basePosition = target.offset(); 10437 } 10438 10439 // force my and at to have valid horizontal and veritcal positions 10440 // if a value is missing or invalid, it will be converted to center 10441 $.each( [ "my", "at" ], function() { 10442 var pos = ( options[this] || "" ).split( " " ); 10443 if ( pos.length === 1) { 10444 pos = horizontalPositions.test( pos[0] ) ? 10445 pos.concat( [center] ) : 10446 verticalPositions.test( pos[0] ) ? 10447 [ center ].concat( pos ) : 10448 [ center, center ]; 10449 } 10450 pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; 10451 pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; 10452 options[ this ] = pos; 10453 }); 10454 10455 // normalize collision option 10456 if ( collision.length === 1 ) { 10457 collision[ 1 ] = collision[ 0 ]; 10458 } 10459 10460 // normalize offset option 10461 offset[ 0 ] = parseInt( offset[0], 10 ) || 0; 10462 if ( offset.length === 1 ) { 10463 offset[ 1 ] = offset[ 0 ]; 10464 } 10465 offset[ 1 ] = parseInt( offset[1], 10 ) || 0; 10466 10467 if ( options.at[0] === "right" ) { 10468 basePosition.left += targetWidth; 10469 } else if ( options.at[0] === center ) { 10470 basePosition.left += targetWidth / 2; 10471 } 10472 10473 if ( options.at[1] === "bottom" ) { 10474 basePosition.top += targetHeight; 10475 } else if ( options.at[1] === center ) { 10476 basePosition.top += targetHeight / 2; 10477 } 10478 10479 basePosition.left += offset[ 0 ]; 10480 basePosition.top += offset[ 1 ]; 10481 10482 return this.each(function() { 10483 var elem = $( this ), 10484 elemWidth = elem.outerWidth(), 10485 elemHeight = elem.outerHeight(), 10486 marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, 10487 marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, 10488 collisionWidth = elemWidth + marginLeft + 10489 ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
10490 collisionHeight = elemHeight + marginTop + 10491 ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), 10492 position = $.extend( {}, basePosition ), 10493 collisionPosition; 10494 10495 if ( options.my[0] === "right" ) { 10496 position.left -= elemWidth; 10497 } else if ( options.my[0] === center ) { 10498 position.left -= elemWidth / 2; 10499 } 10500 10501 if ( options.my[1] === "bottom" ) { 10502 position.top -= elemHeight; 10503 } else if ( options.my[1] === center ) { 10504 position.top -= elemHeight / 2; 10505 } 10506 10507 // prevent fractions (see #5280) 10508 position.left = Math.round( position.left ); 10509 position.top = Math.round( position.top ); 10510 10511 collisionPosition = { 10512 left: position.left - marginLeft, 10513 top: position.top - marginTop 10514 }; 10515 10516 $.each( [ "left", "top" ], function( i, dir ) { 10517 if ( $.ui.position[ collision[i] ] ) { 10518 $.ui.position[ collision[i] ][ dir ]( position, { 10519 targetWidth: targetWidth, 10520 targetHeight: targetHeight, 10521 elemWidth: elemWidth, 10522 elemHeight: elemHeight, 10523 collisionPosition: collisionPosition, 10524 collisionWidth: collisionWidth, 10525 collisionHeight: collisionHeight, 10526 offset: offset, 10527 my: options.my, 10528 at: options.at 10529 }); 10530 } 10531 }); 10532 10533 if ( $.fn.bgiframe ) { 10534 elem.bgiframe(); 10535 } 10536 elem.offset( $.extend( position, { using: options.using } ) ); 10537 }); 10538}; 10539 10540$.ui.position = { 10541 fit: { 10542 left: function( position, data ) { 10543 var win = $( window ), 10544 over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); 10545 position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); 10546 }, 10547 top: function( position, data ) { 10548 var win = $( window ), 10549 over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); 10550 position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); 10551 } 10552 }, 10553 10554 flip: { 10555 left: function( position, data ) { 10556 if ( data.at[0] === center ) { 10557 return; 10558 } 10559 var win = $( window ), 10560 over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), 10561 myOffset = data.my[ 0 ] === "left" ? 10562 -data.elemWidth : 10563 data.my[ 0 ] === "right" ? 10564 data.elemWidth : 10565 0, 10566 atOffset = data.at[ 0 ] === "left" ? 10567 data.targetWidth : 10568 -data.targetWidth, 10569 offset = -2 * data.offset[ 0 ]; 10570 position.left += data.collisionPosition.left < 0 ? 10571 myOffset + atOffset + offset : 10572 over > 0 ? 10573 myOffset + atOffset + offset : 10574 0; 10575 }, 10576 top: function( position, data ) { 10577 if ( data.at[1] === center ) { 10578 return; 10579 } 10580 var win = $( window ), 10581 over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), 10582 myOffset = data.my[ 1 ] === "top" ? 10583 -data.elemHeight : 10584 data.my[ 1 ] === "bottom" ? 10585 data.elemHeight : 10586 0, 10587 atOffset = data.at[ 1 ] === "top" ? 10588 data.targetHeight : 10589 -data.targetHeight, 10590 offset = -2 * data.offset[ 1 ]; 10591 position.top += data.collisionPosition.top < 0 ? 10592 myOffset + atOffset + offset : 10593 over > 0 ? 10594 myOffset + atOffset + offset : 10595 0; 10596 } 10597 } 10598}; 10599 10600// offset setter from jQuery 1.4 10601if ( !$.offset.setOffset ) { 10602 $.offset.setOffset = function( elem, options ) { 10603 // set position first, in-case top/left are set even on static elem 10604 if ( /static/.test( $.curCSS( elem, "position" ) ) ) { 10605 elem.style.position = "relative"; 10606 } 10607 var curElem = $( elem ), 10608 curOffset = curElem.offset(), 10609 curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0, 10610 curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0, 10611 props = { 10612 top: (options.top - curOffset.top) + curTop, 10613 left: (options.left - curOffset.left) + curLeft 10614 }; 10615 10616 if ( 'using' in options ) { 10617 options.using.call( elem, props ); 10618 } else { 10619 curElem.css( props ); 10620 } 10621 }; 10622 10623 $.fn.offset = function( options ) { 10624 var elem = this[ 0 ]; 10625 if ( !elem || !elem.ownerDocument ) { return null; } 10626 if ( options ) { 10627 return this.each(function() { 10628 $.offset.setOffset( this, options ); 10629 }); 10630 } 10631 return _offset.call( this ); 10632 }; 10633} 10634 10635}( jQuery )); 10636/* 10637 * jQuery UI Draggable 1.8.16 10638 * 10639 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 10640 * Dual licensed under the MIT or GPL Version 2 licenses. 10641 * http://jquery.org/license 10642 * 10643 * http://docs.jquery.com/UI/Draggables 10644 * 10645 * Depends: 10646 * jquery.ui.core.js 10647 * jquery.ui.mouse.js 10648 * jquery.ui.widget.js 10649 */ 10650(function( $, undefined ) { 10651 10652$.widget("ui.draggable", $.ui.mouse, { 10653 widgetEventPrefix: "drag", 10654 options: { 10655 addClasses: true, 10656 appendTo: "parent", 10657 axis: false, 10658 connectToSortable: false, 10659 containment: false, 10660 cursor: "auto",
10661 cursorAt: false, 10662 grid: false, 10663 handle: false, 10664 helper: "original", 10665 iframeFix: false, 10666 opacity: false, 10667 refreshPositions: false, 10668 revert: false, 10669 revertDuration: 500, 10670 scope: "default", 10671 scroll: true, 10672 scrollSensitivity: 20, 10673 scrollSpeed: 20, 10674 snap: false, 10675 snapMode: "both", 10676 snapTolerance: 20, 10677 stack: false, 10678 zIndex: false 10679 }, 10680 _create: function() { 10681 10682 if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) 10683 this.element[0].style.position = 'relative'; 10684 10685 (this.options.addClasses && this.element.addClass("ui-draggable")); 10686 (this.options.disabled && this.element.addClass("ui-draggable-disabled")); 10687 10688 this._mouseInit(); 10689 10690 }, 10691 10692 destroy: function() { 10693 if(!this.element.data('draggable')) return; 10694 this.element 10695 .removeData("draggable") 10696 .unbind(".draggable") 10697 .removeClass("ui-draggable" 10698 + " ui-draggable-dragging" 10699 + " ui-draggable-disabled"); 10700 this._mouseDestroy(); 10701 10702 return this; 10703 }, 10704 10705 _mouseCapture: function(event) { 10706 10707 var o = this.options; 10708 10709 // among others, prevent a drag on a resizable-handle 10710 if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) 10711 return false; 10712 10713 //Quit if we're not on a valid handle 10714 this.handle = this._getHandle(event); 10715 if (!this.handle) 10716 return false; 10717 10718 if ( o.iframeFix ) { 10719 $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { 10720 $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') 10721 .css({ 10722 width: this.offsetWidth+"px", height: this.offsetHeight+"px", 10723 position: "absolute", opacity: "0.001", zIndex: 1000 10724 }) 10725 .css($(this).offset()) 10726 .appendTo("body"); 10727 }); 10728 } 10729 10730 return true; 10731 10732 }, 10733 10734 _mouseStart: function(event) { 10735 10736 var o = this.options; 10737 10738 //Create and append the visible helper 10739 this.helper = this._createHelper(event); 10740 10741 //Cache the helper size 10742 this._cacheHelperProportions(); 10743 10744 //If ddmanager is used for droppables, set the global draggable 10745 if($.ui.ddmanager) 10746 $.ui.ddmanager.current = this; 10747 10748 /* 10749 * - Position generation - 10750 * This block generates everything position related - it's the core of draggables. 10751 */ 10752 10753 //Cache the margins of the original element 10754 this._cacheMargins(); 10755 10756 //Store the helper's css position 10757 this.cssPosition = this.helper.css("position"); 10758 this.scrollParent = this.helper.scrollParent(); 10759 10760 //The element's absolute position on the page minus margins 10761 this.offset = this.positionAbs = this.element.offset(); 10762 this.offset = { 10763 top: this.offset.top - this.margins.top, 10764 left: this.offset.left - this.margins.left 10765 }; 10766 10767 $.extend(this.offset, { 10768 click: { //Where the click happened, relative to the element 10769 left: event.pageX - this.offset.left, 10770 top: event.pageY - this.offset.top 10771 }, 10772 parent: this._getParentOffset(), 10773 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 10774 }); 10775 10776 //Generate the original position 10777 this.originalPosition = this.position = this._generatePosition(event); 10778 this.originalPageX = event.pageX; 10779 this.originalPageY = event.pageY; 10780 10781 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied 10782 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 10783 10784 //Set a containment if given in the options 10785 if(o.containment) 10786 this._setContainment(); 10787 10788 //Trigger event + callbacks 10789 if(this._trigger("start", event) === false) { 10790 this._clear(); 10791 return false; 10792 } 10793 10794 //Recache the helper size 10795 this._cacheHelperProportions(); 10796 10797 //Prepare the droppable offsets 10798 if ($.ui.ddmanager && !o.dropBehaviour) 10799 $.ui.ddmanager.prepareOffsets(this, event); 10800 10801 this.helper.addClass("ui-draggable-dragging"); 10802 this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position 10803 10804 //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) 10805 if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); 10806 10807 return true; 10808 }, 10809 10810 _mouseDrag: function(event, noPropagation) { 10811 10812 //Compute the helpers position 10813 this.position = this._generatePosition(event); 10814 this.positionAbs = this._convertPositionTo("absolute"); 10815 10816 //Call plugins and callbacks and use the resulting position if something is returned 10817 if (!noPropagation) { 10818 var ui = this._uiHash(); 10819 if(this._trigger('drag', event, ui) === false) { 10820 this._mouseUp({}); 10821 return false;
10822 } 10823 this.position = ui.position; 10824 } 10825 10826 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; 10827 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; 10828 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); 10829 10830 return false; 10831 }, 10832 10833 _mouseStop: function(event) { 10834 10835 //If we are using droppables, inform the manager about the drop 10836 var dropped = false; 10837 if ($.ui.ddmanager && !this.options.dropBehaviour) 10838 dropped = $.ui.ddmanager.drop(this, event); 10839 10840 //if a drop comes from outside (a sortable) 10841 if(this.dropped) { 10842 dropped = this.dropped; 10843 this.dropped = false; 10844 } 10845 10846 //if the original element is removed, don't bother to continue if helper is set to "original" 10847 if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") 10848 return false; 10849 10850 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))) { 10851 var self = this; 10852 $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { 10853 if(self._trigger("stop", event) !== false) { 10854 self._clear(); 10855 } 10856 }); 10857 } else { 10858 if(this._trigger("stop", event) !== false) { 10859 this._clear(); 10860 } 10861 } 10862 10863 return false; 10864 }, 10865 10866 _mouseUp: function(event) { 10867 if (this.options.iframeFix === true) { 10868 $("div.ui-draggable-iframeFix").each(function() { 10869 this.parentNode.removeChild(this); 10870 }); //Remove frame helpers 10871 } 10872 10873 //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) 10874 if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); 10875 10876 return $.ui.mouse.prototype._mouseUp.call(this, event); 10877 }, 10878 10879 cancel: function() { 10880 10881 if(this.helper.is(".ui-draggable-dragging")) { 10882 this._mouseUp({}); 10883 } else { 10884 this._clear(); 10885 } 10886 10887 return this; 10888 10889 }, 10890 10891 _getHandle: function(event) { 10892 10893 var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; 10894 $(this.options.handle, this.element) 10895 .find("*") 10896 .andSelf() 10897 .each(function() { 10898 if(this == event.target) handle = true; 10899 }); 10900 10901 return handle; 10902 10903 }, 10904 10905 _createHelper: function(event) { 10906 10907 var o = this.options; 10908 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); 10909 10910 if(!helper.parents('body').length) 10911 helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); 10912 10913 if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) 10914 helper.css("position", "absolute"); 10915 10916 return helper; 10917 10918 }, 10919 10920 _adjustOffsetFromHelper: function(obj) { 10921 if (typeof obj == 'string') { 10922 obj = obj.split(' '); 10923 } 10924 if ($.isArray(obj)) { 10925 obj = {left: +obj[0], top: +obj[1] || 0}; 10926 } 10927 if ('left' in obj) { 10928 this.offset.click.left = obj.left + this.margins.left; 10929 } 10930 if ('right' in obj) { 10931 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 10932 } 10933 if ('top' in obj) { 10934 this.offset.click.top = obj.top + this.margins.top; 10935 } 10936 if ('bottom' in obj) { 10937 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 10938 } 10939 }, 10940 10941 _getParentOffset: function() { 10942 10943 //Get the offsetParent and cache its position 10944 this.offsetParent = this.helper.offsetParent(); 10945 var po = this.offsetParent.offset(); 10946 10947 // This is a special case where we need to modify a offset calculated on start, since the following happened: 10948 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 10949 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 10950 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 10951 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { 10952 po.left += this.scrollParent.scrollLeft(); 10953 po.top += this.scrollParent.scrollTop(); 10954 } 10955 10956 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information 10957 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix 10958 po = { top: 0, left: 0 }; 10959 10960 return { 10961 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),
1096110) || 0), 10962 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 10963 }; 10964 10965 }, 10966 10967 _getRelativeOffset: function() { 10968 10969 if(this.cssPosition == "relative") { 10970 var p = this.element.position(); 10971 return { 10972 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 10973 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 10974 }; 10975 } else { 10976 return { top: 0, left: 0 }; 10977 } 10978 10979 }, 10980 10981 _cacheMargins: function() { 10982 this.margins = { 10983 left: (parseInt(this.element.css("marginLeft"),10) || 0), 10984 top: (parseInt(this.element.css("marginTop"),10) || 0), 10985 right: (parseInt(this.element.css("marginRight"),10) || 0), 10986 bottom: (parseInt(this.element.css("marginBottom"),10) || 0) 10987 }; 10988 }, 10989 10990 _cacheHelperProportions: function() { 10991 this.helperProportions = { 10992 width: this.helper.outerWidth(), 10993 height: this.helper.outerHeight() 10994 }; 10995 }, 10996 10997 _setContainment: function() { 10998 10999 var o = this.options; 11000 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 11001 if(o.containment == 'document' || o.containment == 'window') this.containment = [ 11002 o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 11003 o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 11004 (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, 11005 (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 11006 ]; 11007 11008 if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { 11009 var c = $(o.containment); 11010 var ce = c[0]; if(!ce) return; 11011 var co = c.offset(); 11012 var over = ($(ce).css("overflow") != 'hidden'); 11013 11014 this.containment = [ 11015 (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), 11016 (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
11017 (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, 11018 (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 11019 ]; 11020 this.relative_container = c; 11021 11022 } else if(o.containment.constructor == Array) { 11023 this.containment = o.containment; 11024 } 11025 11026 }, 11027 11028 _convertPositionTo: function(d, pos) { 11029 11030 if(!pos) pos = this.position; 11031 var mod = d == "absolute" ? 1 : -1; 11032 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); 11033 11034 return { 11035 top: ( 11036 pos.top // The absolute mouse position 11037 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent 11038 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) 11039 - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 11040 ), 11041 left: ( 11042 pos.left // The absolute mouse position 11043 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent 11044 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) 11045 - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 11046 ) 11047 }; 11048 11049 }, 11050 11051 _generatePosition: function(event) { 11052 11053 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); 11054 var pageX = event.pageX; 11055 var pageY = event.pageY; 11056 11057 /* 11058 * - Position constraining - 11059 * Constrain the position to a mix of grid, containment. 11060 */ 11061 11062 if(this.originalPosition) { //If we are not dragging yet, we won't check for options 11063 var containment; 11064 if(this.containment) { 11065 if (this.relative_container){ 11066 var co = this.relative_container.offset(); 11067 containment = [ this.containment[0] + co.left, 11068 this.containment[1] + co.top, 11069 this.containment[2] + co.left, 11070 this.containment[3] + co.top ]; 11071 } 11072 else { 11073 containment = this.containment; 11074 } 11075 11076 if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; 11077 if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; 11078 if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; 11079 if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; 11080 } 11081 11082 if(o.grid) { 11083 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) 11084 var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 11085 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; 11086 11087 var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; 11088 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; 11089 } 11090 11091 } 11092 11093 return { 11094 top: ( 11095 pageY // The absolute mouse position 11096 - this.offset.click.top // Click offset (relative to the element) 11097 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent 11098 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) 11099 + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 11100 ), 11101 left: ( 11102 pageX // The absolute mouse position 11103 - this.offset.click.left // Click offset (relative to the element) 11104 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent 11105 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) 11106 + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 11107 ) 11108 }; 11109 11110 }, 11111 11112 _clear: function() { 11113 this.helper.removeClass("ui-draggable-dragging"); 11114 if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); 11115 //if($.ui.ddmanager) $.ui.ddmanager.current = null; 11116 this.helper = null; 11117 this.cancelHelperRemoval = false;
11118 }, 11119 11120 // From now on bulk stuff - mainly helpers 11121 11122 _trigger: function(type, event, ui) { 11123 ui = ui || this._uiHash(); 11124 $.ui.plugin.call(this, type, [event, ui]); 11125 if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins 11126 return $.Widget.prototype._trigger.call(this, type, event, ui); 11127 }, 11128 11129 plugins: {}, 11130 11131 _uiHash: function(event) { 11132 return { 11133 helper: this.helper, 11134 position: this.position, 11135 originalPosition: this.originalPosition, 11136 offset: this.positionAbs 11137 }; 11138 } 11139 11140}); 11141 11142$.extend($.ui.draggable, { 11143 version: "1.8.16" 11144}); 11145 11146$.ui.plugin.add("draggable", "connectToSortable", { 11147 start: function(event, ui) { 11148 11149 var inst = $(this).data("draggable"), o = inst.options, 11150 uiSortable = $.extend({}, ui, { item: inst.element }); 11151 inst.sortables = []; 11152 $(o.connectToSortable).each(function() { 11153 var sortable = $.data(this, 'sortable'); 11154 if (sortable && !sortable.options.disabled) { 11155 inst.sortables.push({ 11156 instance: sortable, 11157 shouldRevert: sortable.options.revert 11158 }); 11159 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). 11160 sortable._trigger("activate", event, uiSortable); 11161 } 11162 }); 11163 11164 }, 11165 stop: function(event, ui) { 11166 11167 //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper 11168 var inst = $(this).data("draggable"), 11169 uiSortable = $.extend({}, ui, { item: inst.element }); 11170 11171 $.each(inst.sortables, function() { 11172 if(this.instance.isOver) { 11173 11174 this.instance.isOver = 0; 11175 11176 inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance 11177 this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) 11178 11179 //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' 11180 if(this.shouldRevert) this.instance.options.revert = true; 11181 11182 //Trigger the stop of the sortable 11183 this.instance._mouseStop(event); 11184 11185 this.instance.options.helper = this.instance.options._helper; 11186 11187 //If the helper has been the original item, restore properties in the sortable 11188 if(inst.options.helper == 'original') 11189 this.instance.currentItem.css({ top: 'auto', left: 'auto' }); 11190 11191 } else { 11192 this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance 11193 this.instance._trigger("deactivate", event, uiSortable); 11194 } 11195 11196 }); 11197 11198 }, 11199 drag: function(event, ui) { 11200 11201 var inst = $(this).data("draggable"), self = this; 11202 11203 var checkPos = function(o) { 11204 var dyClick = this.offset.click.top, dxClick = this.offset.click.left; 11205 var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; 11206 var itemHeight = o.height, itemWidth = o.width; 11207 var itemTop = o.top, itemLeft = o.left; 11208 11209 return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); 11210 }; 11211 11212 $.each(inst.sortables, function(i) { 11213 11214 //Copy over some variables to allow calling the sortable's native _intersectsWith 11215 this.instance.positionAbs = inst.positionAbs; 11216 this.instance.helperProportions = inst.helperProportions; 11217 this.instance.offset.click = inst.offset.click; 11218 11219 if(this.instance._intersectsWith(this.instance.containerCache)) { 11220 11221 //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once 11222 if(!this.instance.isOver) { 11223 11224 this.instance.isOver = 1; 11225 //Now we fake the start of dragging for the sortable instance, 11226 //by cloning the list group item, appending it to the sortable and using it as inst.currentItem 11227 //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) 11228 this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); 11229 this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it 11230 this.instance.options.helper = function() { return ui.helper[0]; }; 11231 11232 event.target = this.instance.currentItem[0]; 11233 this.instance._mouseCapture(event, true); 11234 this.instance._mouseStart(event, true, true); 11235
11236 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes 11237 this.instance.offset.click.top = inst.offset.click.top; 11238 this.instance.offset.click.left = inst.offset.click.left; 11239 this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; 11240 this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; 11241 11242 inst._trigger("toSortable", event); 11243 inst.dropped = this.instance.element; //draggable revert needs that 11244 //hack so receive/update callbacks work (mostly) 11245 inst.currentItem = inst.element; 11246 this.instance.fromOutside = inst; 11247 11248 } 11249 11250 //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 11251 if(this.instance.currentItem) this.instance._mouseDrag(event); 11252 11253 } else { 11254 11255 //If it doesn't intersect with the sortable, and it intersected before, 11256 //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval 11257 if(this.instance.isOver) { 11258 11259 this.instance.isOver = 0; 11260 this.instance.cancelHelperRemoval = true; 11261 11262 //Prevent reverting on this forced stop 11263 this.instance.options.revert = false; 11264 11265 // The out event needs to be triggered independently 11266 this.instance._trigger('out', event, this.instance._uiHash(this.instance)); 11267 11268 this.instance._mouseStop(event, true); 11269 this.instance.options.helper = this.instance.options._helper; 11270 11271 //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size 11272 this.instance.currentItem.remove(); 11273 if(this.instance.placeholder) this.instance.placeholder.remove(); 11274 11275 inst._trigger("fromSortable", event); 11276 inst.dropped = false; //draggable revert needs that 11277 } 11278 11279 }; 11280 11281 }); 11282 11283 } 11284}); 11285 11286$.ui.plugin.add("draggable", "cursor", { 11287 start: function(event, ui) { 11288 var t = $('body'), o = $(this).data('draggable').options; 11289 if (t.css("cursor")) o._cursor = t.css("cursor"); 11290 t.css("cursor", o.cursor); 11291 }, 11292 stop: function(event, ui) { 11293 var o = $(this).data('draggable').options; 11294 if (o._cursor) $('body').css("cursor", o._cursor); 11295 } 11296}); 11297 11298$.ui.plugin.add("draggable", "opacity", { 11299 start: function(event, ui) { 11300 var t = $(ui.helper), o = $(this).data('draggable').options; 11301 if(t.css("opacity")) o._opacity = t.css("opacity"); 11302 t.css('opacity', o.opacity); 11303 }, 11304 stop: function(event, ui) { 11305 var o = $(this).data('draggable').options; 11306 if(o._opacity) $(ui.helper).css('opacity', o._opacity); 11307 } 11308}); 11309 11310$.ui.plugin.add("draggable", "scroll", { 11311 start: function(event, ui) { 11312 var i = $(this).data("draggable"); 11313 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); 11314 }, 11315 drag: function(event, ui) { 11316 11317 var i = $(this).data("draggable"), o = i.options, scrolled = false; 11318 11319 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { 11320 11321 if(!o.axis || o.axis != 'x') { 11322 if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) 11323 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; 11324 else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) 11325 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; 11326 } 11327 11328 if(!o.axis || o.axis != 'y') { 11329 if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) 11330 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; 11331 else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) 11332 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; 11333 } 11334 11335 } else { 11336 11337 if(!o.axis || o.axis != 'x') { 11338 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) 11339 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 11340 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) 11341 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 11342 } 11343 11344 if(!o.axis || o.axis != 'y') { 11345 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) 11346 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 11347 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 11348 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 11349 } 11350 11351 } 11352 11353 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 11354 $.ui.ddmanager.prepareOffsets(i, event); 11355 11356 } 11357}); 11358 11359$.ui.plugin.add("draggable", "snap", { 11360 start: function(event, ui) { 11361 11362 var i = $(this).data("draggable"), o = i.options; 11363 i.snapElements = []; 11364 11365 $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { 11366 var $t = $(this); var $o = $t.offset(); 11367 if(this != i.element[0]) i.snapElements.push({ 11368 item: this, 11369 width: $t.outerWidth(), height: $t.outerHeight(), 11370 top: $o.top, left: $o.left 11371 }); 11372 }); 11373 11374 }, 11375 drag: function(event, ui) { 11376 11377 var inst = $(this).data("draggable"), o = inst.options; 11378 var d = o.snapTolerance; 11379 11380 var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 11381 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 11382 11383 for (var i = inst.snapElements.length - 1; i >= 0; i--){ 11384 11385 var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, 11386 t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; 11387 11388 //Yes, I know, this is insane ;) 11389 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))) { 11390 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 }))); 11391 inst.snapElements[i].snapping = false;
11392 continue; 11393 } 11394 11395 if(o.snapMode != 'inner') { 11396 var ts = Math.abs(t - y2) <= d; 11397 var bs = Math.abs(b - y1) <= d; 11398 var ls = Math.abs(l - x2) <= d; 11399 var rs = Math.abs(r - x1) <= d; 11400 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 11401 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; 11402 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; 11403 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; 11404 } 11405 11406 var first = (ts || bs || ls || rs); 11407 11408 if(o.snapMode != 'outer') { 11409 var ts = Math.abs(t - y1) <= d; 11410 var bs = Math.abs(b - y2) <= d; 11411 var ls = Math.abs(l - x1) <= d; 11412 var rs = Math.abs(r - x2) <= d; 11413 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; 11414 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 11415 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; 11416 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; 11417 } 11418 11419 if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) 11420 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 11421 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 11422 11423 }; 11424 11425 } 11426}); 11427 11428$.ui.plugin.add("draggable", "stack", { 11429 start: function(event, ui) { 11430 11431 var o = $(this).data("draggable").options; 11432 11433 var group = $.makeArray($(o.stack)).sort(function(a,b) { 11434 return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); 11435 }); 11436 if (!group.length) { return; } 11437 11438 var min = parseInt(group[0].style.zIndex) || 0; 11439 $(group).each(function(i) { 11440 this.style.zIndex = min + i; 11441 }); 11442 11443 this[0].style.zIndex = min + group.length; 11444 11445 } 11446}); 11447 11448$.ui.plugin.add("draggable", "zIndex", { 11449 start: function(event, ui) { 11450 var t = $(ui.helper), o = $(this).data("draggable").options; 11451 if(t.css("zIndex")) o._zIndex = t.css("zIndex"); 11452 t.css('zIndex', o.zIndex); 11453 }, 11454 stop: function(event, ui) { 11455 var o = $(this).data("draggable").options; 11456 if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); 11457 } 11458}); 11459 11460})(jQuery); 11461/* 11462 * jQuery UI Droppable 1.8.16 11463 * 11464 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 11465 * Dual licensed under the MIT or GPL Version 2 licenses. 11466 * http://jquery.org/license 11467 * 11468 * http://docs.jquery.com/UI/Droppables 11469 * 11470 * Depends: 11471 * jquery.ui.core.js 11472 * jquery.ui.widget.js 11473 * jquery.ui.mouse.js 11474 * jquery.ui.draggable.js 11475 */ 11476(function( $, undefined ) { 11477 11478$.widget("ui.droppable", { 11479 widgetEventPrefix: "drop", 11480 options: { 11481 accept: '*', 11482 activeClass: false, 11483 addClasses: true, 11484 greedy: false, 11485 hoverClass: false, 11486 scope: 'default', 11487 tolerance: 'intersect' 11488 }, 11489 _create: function() { 11490 11491 var o = this.options, accept = o.accept; 11492 this.isover = 0; this.isout = 1; 11493 11494 this.accept = $.isFunction(accept) ? accept : function(d) { 11495 return d.is(accept); 11496 }; 11497 11498 //Store the droppable's proportions 11499 this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; 11500 11501 // Add the reference and positions to the manager 11502 $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; 11503 $.ui.ddmanager.droppables[o.scope].push(this); 11504 11505 (o.addClasses && this.element.addClass("ui-droppable")); 11506 11507 }, 11508 11509 destroy: function() { 11510 var drop = $.ui.ddmanager.droppables[this.options.scope]; 11511 for ( var i = 0; i < drop.length; i++ ) 11512 if ( drop[i] == this ) 11513 drop.splice(i, 1); 11514 11515 this.element 11516 .removeClass("ui-droppable ui-droppable-disabled") 11517 .removeData("droppable") 11518 .unbind(".droppable"); 11519 11520 return this; 11521 }, 11522 11523 _setOption: function(key, value) { 11524 11525 if(key == 'accept') { 11526 this.accept = $.isFunction(value) ? value : function(d) { 11527 return d.is(value); 11528 }; 11529 } 11530 $.Widget.prototype._setOption.apply(this, arguments); 11531 }, 11532 11533 _activate: function(event) { 11534 var draggable = $.ui.ddmanager.current; 11535 if(this.options.activeClass) this.element.addClass(this.options.activeClass); 11536 (draggable && this._trigger('activate', event, this.ui(draggable))); 11537 }, 11538 11539 _deactivate: function(event) { 11540 var draggable = $.ui.ddmanager.current; 11541 if(this.options.activeClass) this.element.removeClass(this.options.activeClass); 11542 (draggable && this._trigger('deactivate', event, this.ui(draggable))); 11543 }, 11544 11545 _over: function(event) { 11546 11547 var draggable = $.ui.ddmanager.current; 11548 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element 11549 11550 if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 11551 if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); 11552 this._trigger('over', event, this.ui(draggable)); 11553 } 11554 11555 }, 11556 11557 _out: function(event) { 11558 11559 var draggable = $.ui.ddmanager.current; 11560 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element 11561 11562 if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 11563 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); 11564 this._trigger('out', event, this.ui(draggable)); 11565 } 11566 11567 }, 11568 11569 _drop: function(event,custom) { 11570 11571 var draggable = custom || $.ui.ddmanager.current; 11572 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element 11573 11574 var childrenIntersection = false;
11575 this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { 11576 var inst = $.data(this, 'droppable'); 11577 if( 11578 inst.options.greedy 11579 && !inst.options.disabled 11580 && inst.options.scope == draggable.options.scope 11581 && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) 11582 && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) 11583 ) { childrenIntersection = true; return false; } 11584 }); 11585 if(childrenIntersection) return false; 11586 11587 if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 11588 if(this.options.activeClass) this.element.removeClass(this.options.activeClass); 11589 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); 11590 this._trigger('drop', event, this.ui(draggable)); 11591 return this.element; 11592 } 11593 11594 return false; 11595 11596 }, 11597 11598 ui: function(c) { 11599 return { 11600 draggable: (c.currentItem || c.element), 11601 helper: c.helper, 11602 position: c.position, 11603 offset: c.positionAbs 11604 }; 11605 } 11606 11607}); 11608 11609$.extend($.ui.droppable, { 11610 version: "1.8.16" 11611}); 11612 11613$.ui.intersect = function(draggable, droppable, toleranceMode) { 11614 11615 if (!droppable.offset) return false; 11616 11617 var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, 11618 y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; 11619 var l = droppable.offset.left, r = l + droppable.proportions.width, 11620 t = droppable.offset.top, b = t + droppable.proportions.height; 11621 11622 switch (toleranceMode) { 11623 case 'fit': 11624 return (l <= x1 && x2 <= r 11625 && t <= y1 && y2 <= b); 11626 break; 11627 case 'intersect': 11628 return (l < x1 + (draggable.helperProportions.width / 2) // Right Half 11629 && x2 - (draggable.helperProportions.width / 2) < r // Left Half 11630 && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half 11631 && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half 11632 break; 11633 case 'pointer': 11634 var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), 11635 draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), 11636 isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); 11637 return isOver; 11638 break; 11639 case 'touch': 11640 return ( 11641 (y1 >= t && y1 <= b) || // Top edge touching 11642 (y2 >= t && y2 <= b) || // Bottom edge touching 11643 (y1 < t && y2 > b) // Surrounded vertically 11644 ) && ( 11645 (x1 >= l && x1 <= r) || // Left edge touching 11646 (x2 >= l && x2 <= r) || // Right edge touching 11647 (x1 < l && x2 > r) // Surrounded horizontally 11648 ); 11649 break; 11650 default: 11651 return false; 11652 break; 11653 } 11654 11655}; 11656 11657/* 11658 This manager tracks offsets of draggables and droppables 11659*/ 11660$.ui.ddmanager = { 11661 current: null, 11662 droppables: { 'default': [] }, 11663 prepareOffsets: function(t, event) { 11664 11665 var m = $.ui.ddmanager.droppables[t.options.scope] || []; 11666 var type = event ? event.type : null; // workaround for #2317 11667 var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); 11668 11669 droppablesLoop: for (var i = 0; i < m.length; i++) { 11670 11671 if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted 11672 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 11673 m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue 11674 11675 if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables 11676 11677 m[i].offset = m[i].element.offset(); 11678 m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; 11679 11680 } 11681 11682 }, 11683 drop: function(draggable, event) { 11684 11685 var dropped = false;
11686 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 11687 11688 if(!this.options) return; 11689 if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) 11690 dropped = dropped || this._drop.call(this, event); 11691 11692 if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 11693 this.isout = 1; this.isover = 0; 11694 this._deactivate.call(this, event); 11695 } 11696 11697 }); 11698 return dropped; 11699 11700 }, 11701 dragStart: function( draggable, event ) { 11702 //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) 11703 draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() { 11704 if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); 11705 }); 11706 }, 11707 drag: function(draggable, event) { 11708 11709 //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. 11710 if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); 11711 11712 //Run through all droppables and check their positions based on specific tolerance options 11713 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 11714 11715 if(this.options.disabled || this.greedyChild || !this.visible) return; 11716 var intersects = $.ui.intersect(draggable, this, this.options.tolerance); 11717 11718 var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); 11719 if(!c) return; 11720 11721 var parentInstance; 11722 if (this.options.greedy) { 11723 var parent = this.element.parents(':data(droppable):eq(0)'); 11724 if (parent.length) { 11725 parentInstance = $.data(parent[0], 'droppable'); 11726 parentInstance.greedyChild = (c == 'isover' ? 1 : 0); 11727 } 11728 } 11729 11730 // we just moved into a greedy child 11731 if (parentInstance && c == 'isover') { 11732 parentInstance['isover'] = 0; 11733 parentInstance['isout'] = 1; 11734 parentInstance._out.call(parentInstance, event); 11735 } 11736 11737 this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; 11738 this[c == "isover" ? "_over" : "_out"].call(this, event); 11739 11740 // we just moved out of a greedy child 11741 if (parentInstance && c == 'isout') { 11742 parentInstance['isout'] = 0; 11743 parentInstance['isover'] = 1; 11744 parentInstance._over.call(parentInstance, event); 11745 } 11746 }); 11747 11748 }, 11749 dragStop: function( draggable, event ) { 11750 draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" ); 11751 //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) 11752 if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); 11753 } 11754}; 11755 11756})(jQuery); 11757/* 11758 * jQuery UI Resizable 1.8.16 11759 * 11760 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 11761 * Dual licensed under the MIT or GPL Version 2 licenses. 11762 * http://jquery.org/license 11763 * 11764 * http://docs.jquery.com/UI/Resizables 11765 * 11766 * Depends: 11767 * jquery.ui.core.js 11768 * jquery.ui.mouse.js 11769 * jquery.ui.widget.js 11770 */ 11771(function( $, undefined ) { 11772 11773$.widget("ui.resizable", $.ui.mouse, { 11774 widgetEventPrefix: "resize", 11775 options: { 11776 alsoResize: false, 11777 animate: false, 11778 animateDuration: "slow", 11779 animateEasing: "swing", 11780 aspectRatio: false, 11781 autoHide: false, 11782 containment: false, 11783 ghost: false, 11784 grid: false, 11785 handles: "e,s,se", 11786 helper: false, 11787 maxHeight: null, 11788 maxWidth: null, 11789 minHeight: 10, 11790 minWidth: 10, 11791 zIndex: 1000 11792 }, 11793 _create: function() { 11794 11795 var self = this, o = this.options; 11796 this.element.addClass("ui-resizable"); 11797 11798 $.extend(this, { 11799 _aspectRatio: !!(o.aspectRatio), 11800 aspectRatio: o.aspectRatio, 11801 originalElement: this.element, 11802 _proportionallyResizeElements: [], 11803 _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null 11804 }); 11805 11806 //Wrap the element if it cannot hold child nodes 11807 if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { 11808 11809 //Opera fix for relative positioning 11810 if (/relative/.test(this.element.css('position')) && $.browser.opera) 11811 this.element.css({ position: 'relative', top: 'auto', left: 'auto' }); 11812 11813 //Create a wrapper element and set the wrapper to the new current internal element 11814 this.element.wrap( 11815 $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ 11816 position: this.element.css('position'), 11817 width: this.element.outerWidth(), 11818 height: this.element.outerHeight(), 11819 top: this.element.css('top'), 11820 left: this.element.css('left') 11821 }) 11822 ); 11823 11824 //Overwrite the original this.element 11825 this.element = this.element.parent().data( 11826 "resizable", this.element.data('resizable') 11827 ); 11828 11829 this.elementIsWrapper = true; 11830 11831 //Move margins to the wrapper 11832 this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); 11833 this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); 11834 11835 //Prevent Safari textarea resize 11836 this.originalResizeStyle = this.originalElement.css('resize'); 11837 this.originalElement.css('resize', 'none'); 11838 11839 //Push the actual element to our proportionallyResize internal array 11840 this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); 11841 11842 // avoid IE jump (hard set the margin) 11843 this.originalElement.css({ margin: this.originalElement.css('margin') }); 11844 11845 // fix handlers offset 11846 this._proportionallyResize(); 11847 11848 } 11849 11850 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' }); 11851 if(this.handles.constructor == String) { 11852 11853 if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; 11854 var n = this.handles.split(","); this.handles = {}; 11855 11856 for(var i = 0; i < n.length; i++) { 11857 11858 var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; 11859 var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); 11860 11861 // increase zIndex of sw, se, ne, nw axis 11862 //TODO : this modifies original option 11863 if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex }); 11864 11865 //TODO : What's going on here? 11866 if ('se' == handle) { 11867 axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); 11868 }; 11869 11870 //Insert into internal handles object and append to element 11871 this.handles[handle] = '.ui-resizable-'+handle; 11872 this.element.append(axis); 11873 } 11874 11875 } 11876 11877 this._renderAxis = function(target) { 11878 11879 target = target || this.element; 11880 11881 for(var i in this.handles) { 11882 11883 if(this.handles[i].constructor == String) 11884 this.handles[i] = $(this.handles[i], this.element).show(); 11885 11886 //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) 11887 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { 11888 11889 var axis = $(this.handles[i], this.element), padWrapper = 0; 11890 11891 //Checking the correct pad and border 11892 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); 11893 11894 //The padding type i have to apply... 11895 var padPos = [ 'padding',
11896 /ne|nw|n/.test(i) ? 'Top' : 11897 /se|sw|s/.test(i) ? 'Bottom' : 11898 /^e$/.test(i) ? 'Right' : 'Left' ].join(""); 11899 11900 target.css(padPos, padWrapper); 11901 11902 this._proportionallyResize(); 11903 11904 } 11905 11906 //TODO: What's that good for? There's not anything to be executed left 11907 if(!$(this.handles[i]).length) 11908 continue; 11909 11910 } 11911 }; 11912 11913 //TODO: make renderAxis a prototype function 11914 this._renderAxis(this.element); 11915 11916 this._handles = $('.ui-resizable-handle', this.element) 11917 .disableSelection(); 11918 11919 //Matching axis name 11920 this._handles.mouseover(function() { 11921 if (!self.resizing) { 11922 if (this.className) 11923 var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 11924 //Axis, default = se 11925 self.axis = axis && axis[1] ? axis[1] : 'se'; 11926 } 11927 }); 11928 11929 //If we want to auto hide the elements 11930 if (o.autoHide) { 11931 this._handles.hide(); 11932 $(this.element) 11933 .addClass("ui-resizable-autohide") 11934 .hover(function() { 11935 if (o.disabled) return; 11936 $(this).removeClass("ui-resizable-autohide"); 11937 self._handles.show(); 11938 }, 11939 function(){ 11940 if (o.disabled) return; 11941 if (!self.resizing) { 11942 $(this).addClass("ui-resizable-autohide"); 11943 self._handles.hide(); 11944 } 11945 }); 11946 } 11947 11948 //Initialize the mouse interaction 11949 this._mouseInit(); 11950 11951 }, 11952 11953 destroy: function() { 11954 11955 this._mouseDestroy(); 11956 11957 var _destroy = function(exp) { 11958 $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") 11959 .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); 11960 }; 11961 11962 //TODO: Unwrap at same DOM position 11963 if (this.elementIsWrapper) { 11964 _destroy(this.element); 11965 var wrapper = this.element; 11966 wrapper.after( 11967 this.originalElement.css({ 11968 position: wrapper.css('position'), 11969 width: wrapper.outerWidth(), 11970 height: wrapper.outerHeight(), 11971 top: wrapper.css('top'), 11972 left: wrapper.css('left') 11973 }) 11974 ).remove(); 11975 } 11976 11977 this.originalElement.css('resize', this.originalResizeStyle); 11978 _destroy(this.originalElement); 11979 11980 return this; 11981 }, 11982 11983 _mouseCapture: function(event) { 11984 var handle = false; 11985 for (var i in this.handles) { 11986 if ($(this.handles[i])[0] == event.target) { 11987 handle = true; 11988 } 11989 } 11990 11991 return !this.options.disabled && handle; 11992 }, 11993 11994 _mouseStart: function(event) { 11995 11996 var o = this.options, iniPos = this.element.position(), el = this.element; 11997 11998 this.resizing = true; 11999 this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; 12000 12001 // bugfix for http://dev.jquery.com/ticket/1749 12002 if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { 12003 el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); 12004 } 12005 12006 //Opera fixing relative position 12007 if ($.browser.opera && (/relative/).test(el.css('position'))) 12008 el.css({ position: 'relative', top: 'auto', left: 'auto' }); 12009 12010 this._renderProxy(); 12011 12012 var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); 12013 12014 if (o.containment) { 12015 curleft += $(o.containment).scrollLeft() || 0; 12016 curtop += $(o.containment).scrollTop() || 0; 12017 } 12018 12019 //Store needed variables 12020 this.offset = this.helper.offset(); 12021 this.position = { left: curleft, top: curtop }; 12022 this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; 12023 this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; 12024 this.originalPosition = { left: curleft, top: curtop }; 12025 this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; 12026 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 12027 12028 //Aspect Ratio 12029 this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); 12030 12031 var cursor = $('.ui-resizable-' + this.axis).css('cursor'); 12032 $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); 12033 12034 el.addClass("ui-resizable-resizing"); 12035 this._propagate("start", event); 12036 return true; 12037 }, 12038 12039 _mouseDrag: function(event) { 12040 12041 //Increase performance, avoid regex 12042 var el = this.helper, o = this.options, props = {}, 12043 self = this, smp = this.originalMousePosition, a = this.axis; 12044 12045 var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; 12046 var trigger = this._change[a]; 12047 if (!trigger) return false;
12048 12049 // Calculate the attrs that will be change 12050 var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; 12051 12052 // Put this in the mouseDrag handler since the user can start pressing shift while resizing 12053 this._updateVirtualBoundaries(event.shiftKey); 12054 if (this._aspectRatio || event.shiftKey) 12055 data = this._updateRatio(data, event); 12056 12057 data = this._respectSize(data, event); 12058 12059 // plugins callbacks need to be called first 12060 this._propagate("resize", event); 12061 12062 el.css({ 12063 top: this.position.top + "px", left: this.position.left + "px", 12064 width: this.size.width + "px", height: this.size.height + "px" 12065 }); 12066 12067 if (!this._helper && this._proportionallyResizeElements.length) 12068 this._proportionallyResize(); 12069 12070 this._updateCache(data); 12071 12072 // calling the user callback at the end 12073 this._trigger('resize', event, this.ui()); 12074 12075 return false; 12076 }, 12077 12078 _mouseStop: function(event) { 12079 12080 this.resizing = false; 12081 var o = this.options, self = this; 12082 12083 if(this._helper) { 12084 var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), 12085 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, 12086 soffsetw = ista ? 0 : self.sizeDiff.width; 12087 12088 var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, 12089 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 12090 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; 12091 12092 if (!o.animate) 12093 this.element.css($.extend(s, { top: top, left: left })); 12094 12095 self.helper.height(self.size.height); 12096 self.helper.width(self.size.width); 12097 12098 if (this._helper && !o.animate) this._proportionallyResize(); 12099 } 12100 12101 $('body').css('cursor', 'auto'); 12102 12103 this.element.removeClass("ui-resizable-resizing"); 12104 12105 this._propagate("stop", event); 12106 12107 if (this._helper) this.helper.remove(); 12108 return false; 12109 12110 }, 12111 12112 _updateVirtualBoundaries: function(forceAspectRatio) { 12113 var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; 12114 12115 b = { 12116 minWidth: isNumber(o.minWidth) ? o.minWidth : 0, 12117 maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, 12118 minHeight: isNumber(o.minHeight) ? o.minHeight : 0, 12119 maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity 12120 }; 12121 12122 if(this._aspectRatio || forceAspectRatio) { 12123 // We want to create an enclosing box whose aspect ration is the requested one 12124 // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension 12125 pMinWidth = b.minHeight * this.aspectRatio; 12126 pMinHeight = b.minWidth / this.aspectRatio; 12127 pMaxWidth = b.maxHeight * this.aspectRatio; 12128 pMaxHeight = b.maxWidth / this.aspectRatio; 12129 12130 if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; 12131 if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; 12132 if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; 12133 if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; 12134 } 12135 this._vBoundaries = b; 12136 }, 12137 12138 _updateCache: function(data) { 12139 var o = this.options; 12140 this.offset = this.helper.offset(); 12141 if (isNumber(data.left)) this.position.left = data.left; 12142 if (isNumber(data.top)) this.position.top = data.top; 12143 if (isNumber(data.height)) this.size.height = data.height; 12144 if (isNumber(data.width)) this.size.width = data.width; 12145 }, 12146 12147 _updateRatio: function(data, event) { 12148 12149 var o = this.options, cpos = this.position, csize = this.size, a = this.axis; 12150 12151 if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); 12152 else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); 12153 12154 if (a == 'sw') { 12155 data.left = cpos.left + (csize.width - data.width); 12156 data.top = null; 12157 } 12158 if (a == 'nw') { 12159 data.top = cpos.top + (csize.height - data.height); 12160 data.left = cpos.left + (csize.width - data.width); 12161 } 12162 12163 return data; 12164 }, 12165 12166 _respectSize: function(data, event) { 12167 12168 var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, 12169 ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 12170 isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); 12171 12172 if (isminw) data.width = o.minWidth; 12173 if (isminh) data.height = o.minHeight; 12174 if (ismaxw) data.width = o.maxWidth; 12175 if (ismaxh) data.height = o.maxHeight; 12176 12177 var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; 12178 var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 12179 12180 if (isminw && cw) data.left = dw - o.minWidth; 12181 if (ismaxw && cw) data.left = dw - o.maxWidth; 12182 if (isminh && ch) data.top = dh - o.minHeight; 12183 if (ismaxh && ch) data.top = dh - o.maxHeight; 12184 12185 // fixing jump error on top/left - bug #2330 12186 var isNotwh = !data.width && !data.height; 12187 if (isNotwh && !data.left && data.top) data.top = null; 12188 else if (isNotwh && !data.top && data.left) data.left = null; 12189 12190 return data; 12191 }, 12192 12193 _proportionallyResize: function() { 12194 12195 var o = this.options; 12196 if (!this._proportionallyResizeElements.length) return; 12197 var element = this.helper || this.element; 12198 12199 for (var i=0; i < this._proportionallyResizeElements.length; i++) { 12200 12201 var prel = this._proportionallyResizeElements[i]; 12202 12203 if (!this.borderDif) { 12204 var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], 12205 p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; 12206 12207 this.borderDif = $.map(b, function(v, i) { 12208 var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; 12209 return border + padding; 12210 }); 12211 } 12212 12213 if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) 12214 continue; 12215 12216 prel.css({ 12217 height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, 12218 width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 12219 }); 12220 12221 }; 12222 12223 }, 12224 12225 _renderProxy: function() { 12226 12227 var el = this.element, o = this.options; 12228 this.elementOffset = el.offset(); 12229 12230 if(this._helper) { 12231 12232 this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); 12233 12234 // fix ie6 offset TODO: This seems broken 12235 var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), 12236 pxyoffset = ( ie6 ? 2 : -1 ); 12237 12238 this.helper.addClass(this._helper).css({ 12239 width: this.element.outerWidth() + pxyoffset, 12240 height: this.element.outerHeight() + pxyoffset, 12241 position: 'absolute', 12242 left: this.elementOffset.left - ie6offset +'px', 12243 top: this.elementOffset.top - ie6offset +'px', 12244 zIndex: ++o.zIndex //TODO: Don't modify option 12245 }); 12246 12247 this.helper 12248 .appendTo("body") 12249 .disableSelection(); 12250 12251 } else { 12252 this.helper = this.element; 12253 } 12254 12255 }, 12256 12257 _change: { 12258 e: function(event, dx, dy) { 12259 return { width: this.originalSize.width + dx }; 12260 }, 12261 w: function(event, dx, dy) { 12262 var o = this.options, cs = this.originalSize, sp = this.originalPosition; 12263 return { left: sp.left + dx, width: cs.width - dx }; 12264 }, 12265 n: function(event, dx, dy) { 12266 var o = this.options, cs = this.originalSize, sp = this.originalPosition; 12267 return { top: sp.top + dy, height: cs.height - dy }; 12268 }, 12269 s: function(event, dx, dy) { 12270 return { height: this.originalSize.height + dy }; 12271 }, 12272 se: function(event, dx, dy) { 12273 return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); 12274 }, 12275 sw: function(event, dx, dy) { 12276 return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); 12277 }, 12278 ne: function(event, dx, dy) { 12279 return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); 12280 }, 12281 nw: function(event, dx, dy) { 12282 return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); 12283 } 12284 }, 12285 12286 _propagate: function(n, event) { 12287 $.ui.plugin.call(this, n, [event, this.ui()]); 12288 (n != "resize" && this._trigger(n, event, this.ui())); 12289 }, 12290 12291 plugins: {}, 12292 12293 ui: function() { 12294 return { 12295 originalElement: this.originalElement, 12296 element: this.element, 12297 helper: this.helper, 12298 position: this.position, 12299 size: this.size, 12300 originalSize: this.originalSize, 12301 originalPosition: this.originalPosition 12302 }; 12303 } 12304 12305}); 12306 12307$.extend($.ui.resizable, { 12308 version: "1.8.16" 12309}); 12310 12311/* 12312 * Resizable Extensions 12313 */ 12314 12315$.ui.plugin.add("resizable", "alsoResize", { 12316 12317 start: function (event, ui) { 12318 var self = $(this).data("resizable"), o = self.options; 12319 12320 var _store = function (exp) { 12321 $(exp).each(function() { 12322 var el = $(this); 12323 el.data("resizable-alsoresize", { 12324 width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), 12325 left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10), 12326 position: el.css('position') // to reset Opera on stop() 12327 }); 12328 }); 12329 }; 12330 12331 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { 12332 if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } 12333 else { $.each(o.alsoResize, function (exp) { _store(exp); }); } 12334 }else{ 12335 _store(o.alsoResize); 12336 } 12337 }, 12338 12339 resize: function (event, ui) { 12340 var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; 12341 12342 var delta = { 12343 height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, 12344 top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 12345 }, 12346 12347 _alsoResize = function (exp, c) { 12348 $(exp).each(function() { 12349 var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, 12350 css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; 12351
12352 $.each(css, function (i, prop) { 12353 var sum = (start[prop]||0) + (delta[prop]||0); 12354 if (sum && sum >= 0) 12355 style[prop] = sum || null; 12356 }); 12357 12358 // Opera fixing relative position 12359 if ($.browser.opera && /relative/.test(el.css('position'))) { 12360 self._revertToRelativePosition = true; 12361 el.css({ position: 'absolute', top: 'auto', left: 'auto' }); 12362 } 12363 12364 el.css(style); 12365 }); 12366 }; 12367 12368 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { 12369 $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); 12370 }else{ 12371 _alsoResize(o.alsoResize); 12372 } 12373 }, 12374 12375 stop: function (event, ui) { 12376 var self = $(this).data("resizable"), o = self.options; 12377 12378 var _reset = function (exp) { 12379 $(exp).each(function() { 12380 var el = $(this); 12381 // reset position for Opera - no need to verify it was changed 12382 el.css({ position: el.data("resizable-alsoresize").position }); 12383 }); 12384 }; 12385 12386 if (self._revertToRelativePosition) { 12387 self._revertToRelativePosition = false; 12388 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { 12389 $.each(o.alsoResize, function (exp) { _reset(exp); }); 12390 }else{ 12391 _reset(o.alsoResize); 12392 } 12393 } 12394 12395 $(this).removeData("resizable-alsoresize"); 12396 } 12397}); 12398 12399$.ui.plugin.add("resizable", "animate", { 12400 12401 stop: function(event, ui) { 12402 var self = $(this).data("resizable"), o = self.options; 12403 12404 var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), 12405 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, 12406 soffsetw = ista ? 0 : self.sizeDiff.width; 12407 12408 var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, 12409 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 12410 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; 12411 12412 self.element.animate( 12413 $.extend(style, top && left ? { top: top, left: left } : {}), { 12414 duration: o.animateDuration, 12415 easing: o.animateEasing, 12416 step: function() { 12417 12418 var data = { 12419 width: parseInt(self.element.css('width'), 10), 12420 height: parseInt(self.element.css('height'), 10), 12421 top: parseInt(self.element.css('top'), 10), 12422 left: parseInt(self.element.css('left'), 10) 12423 }; 12424 12425 if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); 12426 12427 // propagating resize, and updating values for each animation step 12428 self._updateCache(data); 12429 self._propagate("resize", event); 12430 12431 } 12432 } 12433 ); 12434 } 12435 12436}); 12437 12438$.ui.plugin.add("resizable", "containment", { 12439 12440 start: function(event, ui) { 12441 var self = $(this).data("resizable"), o = self.options, el = self.element; 12442 var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; 12443 if (!ce) return; 12444 12445 self.containerElement = $(ce); 12446 12447 if (/document/.test(oc) || oc == document) { 12448 self.containerOffset = { left: 0, top: 0 }; 12449 self.containerPosition = { left: 0, top: 0 }; 12450 12451 self.parentData = { 12452 element: $(document), left: 0, top: 0, 12453 width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight 12454 }; 12455 } 12456 12457 // i'm a node, so compute top, left, right, bottom 12458 else { 12459 var element = $(ce), p = []; 12460 $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); 12461 12462 self.containerOffset = element.offset(); 12463 self.containerPosition = element.position(); 12464 self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; 12465 12466 var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, 12467 width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); 12468 12469 self.parentData = { 12470 element: ce, left: co.left, top: co.top, width: width, height: height 12471 }; 12472 } 12473 }, 12474 12475 resize: function(event, ui) { 12476 var self = $(this).data("resizable"), o = self.options, 12477 ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, 12478 pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left
12478:0 }, ce = self.containerElement; 12479 12480 if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; 12481 12482 if (cp.left < (self._helper ? co.left : 0)) { 12483 self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); 12484 if (pRatio) self.size.height = self.size.width / o.aspectRatio; 12485 self.position.left = o.helper ? co.left : 0; 12486 } 12487 12488 if (cp.top < (self._helper ? co.top : 0)) { 12489 self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); 12490 if (pRatio) self.size.width = self.size.height * o.aspectRatio; 12491 self.position.top = self._helper ? co.top : 0; 12492 } 12493 12494 self.offset.left = self.parentData.left+self.position.left; 12495 self.offset.top = self.parentData.top+self.position.top; 12496 12497 var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), 12498 hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); 12499 12500 var isParent = self.containerElement.get(0) == self.element.parent().get(0), 12501 isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); 12502 12503 if(isParent && isOffsetRelative) woset -= self.parentData.left; 12504 12505 if (woset + self.size.width >= self.parentData.width) { 12506 self.size.width = self.parentData.width - woset; 12507 if (pRatio) self.size.height = self.size.width / self.aspectRatio; 12508 } 12509 12510 if (hoset + self.size.height >= self.parentData.height) { 12511 self.size.height = self.parentData.height - hoset; 12512 if (pRatio) self.size.width = self.size.height * self.aspectRatio; 12513 } 12514 }, 12515 12516 stop: function(event, ui){ 12517 var self = $(this).data("resizable"), o = self.options, cp = self.position, 12518 co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; 12519 12520 var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; 12521 12522 if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) 12523 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); 12524 12525 if (self._helper && !o.animate && (/static/).test(ce.css('position'))) 12526 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); 12527 12528 } 12529}); 12530 12531$.ui.plugin.add("resizable", "ghost", { 12532 12533 start: function(event, ui) { 12534 12535 var self = $(this).data("resizable"), o = self.options, cs = self.size; 12536 12537 self.ghost = self.originalElement.clone(); 12538 self.ghost 12539 .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) 12540 .addClass('ui-resizable-ghost') 12541 .addClass(typeof o.ghost == 'string' ? o.ghost : ''); 12542 12543 self.ghost.appendTo(self.helper); 12544 12545 }, 12546 12547 resize: function(event, ui){ 12548 var self = $(this).data("resizable"), o = self.options; 12549 if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); 12550 }, 12551 12552 stop: function(event, ui){ 12553 var self = $(this).data("resizable"), o = self.options; 12554 if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); 12555 } 12556 12557}); 12558 12559$.ui.plugin.add("resizable", "grid", { 12560 12561 resize: function(event, ui) { 12562 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; 12563 o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; 12564 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); 12565 12566 if (/^(se|s|e)$/.test(a)) { 12567 self.size.width = os.width + ox; 12568 self.size.height = os.height + oy; 12569 } 12570 else if (/^(ne)$/.test(a)) { 12571 self.size.width = os.width + ox; 12572 self.size.height = os.height + oy; 12573 self.position.top = op.top - oy; 12574 } 12575 else if (/^(sw)$/.test(a)) { 12576 self.size.width = os.width + ox; 12577 self.size.height = os.height + oy; 12578 self.position.left = op.left - ox; 12579 } 12580 else { 12581 self.size.width = os.width + ox; 12582 self.size.height = os.height + oy; 12583 self.position.top = op.top - oy; 12584 self.position.left = op.left - ox; 12585 } 12586 } 12587 12588}); 12589 12590var num = function(v) { 12591 return parseInt(v, 10) || 0; 12592}; 12593 12594var isNumber = function(value) { 12595 return !isNaN(parseInt(value, 10)); 12596}; 12597 12598})(jQuery); 12599/* 12600 * jQuery UI Selectable 1.8.16 12601 * 12602 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12603 * Dual licensed under the MIT or GPL Version 2 licenses. 12604 * http://jquery.org/license 12605 * 12606 * http://docs.jquery.com/UI/Selectables 12607 * 12608 * Depends: 12609 * jquery.ui.core.js 12610 * jquery.ui.mouse.js 12611 * jquery.ui.widget.js 12612 */ 12613(function( $, undefined ) { 12614 12615$.widget("ui.selectable", $.ui.mouse, { 12616 options: { 12617 appendTo: 'body', 12618 autoRefresh: true, 12619 distance: 0, 12620 filter: '*', 12621 tolerance: 'touch' 12622 }, 12623 _create: function() { 12624 var self = this; 12625 12626 this.element.addClass("ui-selectable"); 12627 12628 this.dragged = false;
12629 12630 // cache selectee children based on filter 12631 var selectees; 12632 this.refresh = function() { 12633 selectees = $(self.options.filter, self.element[0]); 12634 selectees.each(function() { 12635 var $this = $(this); 12636 var pos = $this.offset(); 12637 $.data(this, "selectable-item", { 12638 element: this, 12639 $element: $this, 12640 left: pos.left, 12641 top: pos.top, 12642 right: pos.left + $this.outerWidth(), 12643 bottom: pos.top + $this.outerHeight(), 12644 startselected: false, 12645 selected: $this.hasClass('ui-selected'), 12646 selecting: $this.hasClass('ui-selecting'), 12647 unselecting: $this.hasClass('ui-unselecting') 12648 }); 12649 }); 12650 }; 12651 this.refresh(); 12652 12653 this.selectees = selectees.addClass("ui-selectee"); 12654 12655 this._mouseInit(); 12656 12657 this.helper = $("<div class='ui-selectable-helper'></div>"); 12658 }, 12659 12660 destroy: function() { 12661 this.selectees 12662 .removeClass("ui-selectee") 12663 .removeData("selectable-item"); 12664 this.element 12665 .removeClass("ui-selectable ui-selectable-disabled") 12666 .removeData("selectable") 12667 .unbind(".selectable"); 12668 this._mouseDestroy(); 12669 12670 return this; 12671 }, 12672 12673 _mouseStart: function(event) { 12674 var self = this; 12675 12676 this.opos = [event.pageX, event.pageY]; 12677 12678 if (this.options.disabled) 12679 return; 12680 12681 var options = this.options; 12682 12683 this.selectees = $(options.filter, this.element[0]); 12684 12685 this._trigger("start", event); 12686 12687 $(options.appendTo).append(this.helper); 12688 // position helper (lasso) 12689 this.helper.css({ 12690 "left": event.clientX, 12691 "top": event.clientY, 12692 "width": 0, 12693 "height": 0 12694 }); 12695 12696 if (options.autoRefresh) { 12697 this.refresh(); 12698 } 12699 12700 this.selectees.filter('.ui-selected').each(function() { 12701 var selectee = $.data(this, "selectable-item"); 12702 selectee.startselected = true; 12703 if (!event.metaKey) { 12704 selectee.$element.removeClass('ui-selected'); 12705 selectee.selected = false; 12706 selectee.$element.addClass('ui-unselecting'); 12707 selectee.unselecting = true; 12708 // selectable UNSELECTING callback 12709 self._trigger("unselecting", event, { 12710 unselecting: selectee.element 12711 }); 12712 } 12713 }); 12714 12715 $(event.target).parents().andSelf().each(function() { 12716 var selectee = $.data(this, "selectable-item"); 12717 if (selectee) { 12718 var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected'); 12719 selectee.$element 12720 .removeClass(doSelect ? "ui-unselecting" : "ui-selected") 12721 .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); 12722 selectee.unselecting = !doSelect; 12723 selectee.selecting = doSelect; 12724 selectee.selected = doSelect; 12725 // selectable (UN)SELECTING callback 12726 if (doSelect) { 12727 self._trigger("selecting", event, { 12728 selecting: selectee.element 12729 }); 12730 } else { 12731 self._trigger("unselecting", event, { 12732 unselecting: selectee.element 12733 }); 12734 } 12735 return false; 12736 } 12737 }); 12738 12739 }, 12740 12741 _mouseDrag: function(event) { 12742 var self = this; 12743 this.dragged = true; 12744 12745 if (this.options.disabled) 12746 return; 12747 12748 var options = this.options; 12749 12750 var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; 12751 if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } 12752 if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } 12753 this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); 12754 12755 this.selectees.each(function() { 12756 var selectee = $.data(this, "selectable-item"); 12757 //prevent helper from being selected if appendTo: selectable 12758 if (!selectee || selectee.element == self.element[0]) 12759 return; 12760 var hit = false; 12761 if (options.tolerance == 'touch') { 12762 hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); 12763 } else if (options.tolerance == 'fit') { 12764 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); 12765 } 12766 12767 if (hit) { 12768 // SELECT 12769 if (selectee.selected) { 12770 selectee.$element.removeClass('ui-selected'); 12771 selectee.selected = false; 12772 } 12773 if (selectee.unselecting) { 12774 selectee.$element.removeClass('ui-unselecting'); 12775 selectee.unselecting = false; 12776 } 12777 if (!selectee.selecting) { 12778 selectee.$element.addClass('ui-selecting'); 12779 selectee.selecting = true; 12780 // selectable SELECTING callback 12781 self._trigger("selecting", event, { 12782 selecting: selectee.element 12783 }); 12784 } 12785 } else { 12786 // UNSELECT 12787 if (selectee.selecting) { 12788 if (event.metaKey && selectee.startselected) { 12789 selectee.$element.removeClass('ui-selecting'); 12790 selectee.selecting = false;
12791 selectee.$element.addClass('ui-selected'); 12792 selectee.selected = true; 12793 } else { 12794 selectee.$element.removeClass('ui-selecting'); 12795 selectee.selecting = false; 12796 if (selectee.startselected) { 12797 selectee.$element.addClass('ui-unselecting'); 12798 selectee.unselecting = true; 12799 } 12800 // selectable UNSELECTING callback 12801 self._trigger("unselecting", event, { 12802 unselecting: selectee.element 12803 }); 12804 } 12805 } 12806 if (selectee.selected) { 12807 if (!event.metaKey && !selectee.startselected) { 12808 selectee.$element.removeClass('ui-selected'); 12809 selectee.selected = false; 12810 12811 selectee.$element.addClass('ui-unselecting'); 12812 selectee.unselecting = true; 12813 // selectable UNSELECTING callback 12814 self._trigger("unselecting", event, { 12815 unselecting: selectee.element 12816 }); 12817 } 12818 } 12819 } 12820 }); 12821 12822 return false; 12823 }, 12824 12825 _mouseStop: function(event) { 12826 var self = this; 12827 12828 this.dragged = false; 12829 12830 var options = this.options; 12831 12832 $('.ui-unselecting', this.element[0]).each(function() { 12833 var selectee = $.data(this, "selectable-item"); 12834 selectee.$element.removeClass('ui-unselecting'); 12835 selectee.unselecting = false; 12836 selectee.startselected = false; 12837 self._trigger("unselected", event, { 12838 unselected: selectee.element 12839 }); 12840 }); 12841 $('.ui-selecting', this.element[0]).each(function() { 12842 var selectee = $.data(this, "selectable-item"); 12843 selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); 12844 selectee.selecting = false; 12845 selectee.selected = true; 12846 selectee.startselected = true; 12847 self._trigger("selected", event, { 12848 selected: selectee.element 12849 }); 12850 }); 12851 this._trigger("stop", event); 12852 12853 this.helper.remove(); 12854 12855 return false; 12856 } 12857 12858}); 12859 12860$.extend($.ui.selectable, { 12861 version: "1.8.16" 12862}); 12863 12864})(jQuery); 12865/* 12866 * jQuery UI Sortable 1.8.16 12867 * 12868 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12869 * Dual licensed under the MIT or GPL Version 2 licenses. 12870 * http://jquery.org/license 12871 * 12872 * http://docs.jquery.com/UI/Sortables 12873 * 12874 * Depends: 12875 * jquery.ui.core.js 12876 * jquery.ui.mouse.js 12877 * jquery.ui.widget.js 12878 */ 12879(function( $, undefined ) { 12880 12881$.widget("ui.sortable", $.ui.mouse, { 12882 widgetEventPrefix: "sort", 12883 options: { 12884 appendTo: "parent", 12885 axis: false, 12886 connectWith: false, 12887 containment: false, 12888 cursor: 'auto', 12889 cursorAt: false, 12890 dropOnEmpty: true, 12891 forcePlaceholderSize: false, 12892 forceHelperSize: false, 12893 grid: false, 12894 handle: false, 12895 helper: "original", 12896 items: '> *', 12897 opacity: false, 12898 placeholder: false, 12899 revert: false, 12900 scroll: true, 12901 scrollSensitivity: 20, 12902 scrollSpeed: 20, 12903 scope: "default", 12904 tolerance: "intersect", 12905 zIndex: 1000 12906 }, 12907 _create: function() { 12908 12909 var o = this.options; 12910 this.containerCache = {}; 12911 this.element.addClass("ui-sortable"); 12912 12913 //Get the items 12914 this.refresh(); 12915 12916 //Let's determine if the items are being displayed horizontally 12917 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; 12918 12919 //Let's determine the parent's offset 12920 this.offset = this.element.offset(); 12921 12922 //Initialize mouse events for interaction 12923 this._mouseInit(); 12924 12925 }, 12926 12927 destroy: function() { 12928 this.element 12929 .removeClass("ui-sortable ui-sortable-disabled") 12930 .removeData("sortable") 12931 .unbind(".sortable"); 12932 this._mouseDestroy(); 12933 12934 for ( var i = this.items.length - 1; i >= 0; i-- ) 12935 this.items[i].item.removeData("sortable-item"); 12936 12937 return this; 12938 }, 12939 12940 _setOption: function(key, value){ 12941 if ( key === "disabled" ) { 12942 this.options[ key ] = value; 12943 12944 this.widget() 12945 [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" ); 12946 } else { 12947 // Don't call widget base _setOption for disable as it adds ui-state-disabled class 12948 $.Widget.prototype._setOption.apply(this, arguments); 12949 } 12950 }, 12951 12952 _mouseCapture: function(event, overrideHandle) { 12953 12954 if (this.reverting) { 12955 return false; 12956 } 12957 12958 if(this.options.disabled || this.options.type == 'static') return false; 12959 12960 //We have to refresh the items data once first 12961 this._refreshItems(event); 12962 12963 //Find out if the clicked node (or one of its parents) is a actual item in this.items 12964 var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { 12965 if($.data(this, 'sortable-item') == self) { 12966 currentItem = $(this); 12967 return false;
12968 } 12969 }); 12970 if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target); 12971 12972 if(!currentItem) return false; 12973 if(this.options.handle && !overrideHandle) { 12974 var validHandle = false; 12975 12976 $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); 12977 if(!validHandle) return false; 12978 } 12979 12980 this.currentItem = currentItem; 12981 this._removeCurrentsFromItems(); 12982 return true; 12983 12984 }, 12985 12986 _mouseStart: function(event, overrideHandle, noActivation) { 12987 12988 var o = this.options, self = this; 12989 this.currentContainer = this; 12990 12991 //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture 12992 this.refreshPositions(); 12993 12994 //Create and append the visible helper 12995 this.helper = this._createHelper(event); 12996 12997 //Cache the helper size 12998 this._cacheHelperProportions(); 12999 13000 /* 13001 * - Position generation - 13002 * This block generates everything position related - it's the core of draggables. 13003 */ 13004 13005 //Cache the margins of the original element 13006 this._cacheMargins(); 13007 13008 //Get the next scrolling parent 13009 this.scrollParent = this.helper.scrollParent(); 13010 13011 //The element's absolute position on the page minus margins 13012 this.offset = this.currentItem.offset(); 13013 this.offset = { 13014 top: this.offset.top - this.margins.top, 13015 left: this.offset.left - this.margins.left 13016 }; 13017 13018 // Only after we got the offset, we can change the helper's position to absolute 13019 // TODO: Still need to figure out a way to make relative sorting possible 13020 this.helper.css("position", "absolute"); 13021 this.cssPosition = this.helper.css("position"); 13022 13023 $.extend(this.offset, { 13024 click: { //Where the click happened, relative to the element 13025 left: event.pageX - this.offset.left, 13026 top: event.pageY - this.offset.top 13027 }, 13028 parent: this._getParentOffset(), 13029 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 13030 }); 13031 13032 //Generate the original position 13033 this.originalPosition = this._generatePosition(event); 13034 this.originalPageX = event.pageX; 13035 this.originalPageY = event.pageY; 13036 13037 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied 13038 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 13039 13040 //Cache the former DOM position 13041 this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; 13042 13043 //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 13044 if(this.helper[0] != this.currentItem[0]) { 13045 this.currentItem.hide(); 13046 } 13047 13048 //Create the placeholder 13049 this._createPlaceholder(); 13050 13051 //Set a containment if given in the options 13052 if(o.containment) 13053 this._setContainment(); 13054 13055 if(o.cursor) { // cursor option 13056 if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); 13057 $('body').css("cursor", o.cursor); 13058 } 13059 13060 if(o.opacity) { // opacity option 13061 if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); 13062 this.helper.css("opacity", o.opacity); 13063 } 13064 13065 if(o.zIndex) { // zIndex option 13066 if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); 13067 this.helper.css("zIndex", o.zIndex); 13068 } 13069 13070 //Prepare scrolling 13071 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') 13072 this.overflowOffset = this.scrollParent.offset(); 13073 13074 //Call callbacks 13075 this._trigger("start", event, this._uiHash()); 13076 13077 //Recache the helper size 13078 if(!this._preserveHelperProportions) 13079 this._cacheHelperProportions(); 13080 13081 13082 //Post 'activate' events to possible containers 13083 if(!noActivation) { 13084 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); } 13085 } 13086 13087 //Prepare possible droppables 13088 if($.ui.ddmanager) 13089 $.ui.ddmanager.current = this; 13090 13091 if ($.ui.ddmanager && !o.dropBehaviour) 13092 $.ui.ddmanager.prepareOffsets(this, event); 13093 13094 this.dragging = true; 13095 13096 this.helper.addClass("ui-sortable-helper"); 13097 this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position 13098 return true; 13099 13100 }, 13101 13102 _mouseDrag: function(event) { 13103 13104 //Compute the helpers position 13105 this.position = this._generatePosition(event); 13106 this.positionAbs = this._convertPositionTo("absolute"); 13107 13108 if (!this.lastPositionAbs) { 13109 this.lastPositionAbs = this.positionAbs; 13110 } 13111 13112 //Do scrolling 13113 if(this.options.scroll) { 13114 var o = this.options, scrolled = false;
13115 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { 13116 13117 if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) 13118 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 13119 else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) 13120 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 13121 13122 if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) 13123 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; 13124 else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) 13125 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; 13126 13127 } else { 13128 13129 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) 13130 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 13131 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) 13132 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 13133 13134 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) 13135 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 13136 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 13137 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 13138 13139 } 13140 13141 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 13142 $.ui.ddmanager.prepareOffsets(this, event); 13143 } 13144 13145 //Regenerate the absolute position used for position checks 13146 this.positionAbs = this._convertPositionTo("absolute"); 13147 13148 //Set the helper position 13149 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; 13150 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; 13151 13152 //Rearrange 13153 for (var i = this.items.length - 1; i >= 0; i--) { 13154 13155 //Cache variables and intersection, continue if no intersection 13156 var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); 13157 if (!intersection) continue; 13158 13159 if(itemElement != this.currentItem[0] //cannot intersect with itself 13160 && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before 13161 && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked 13162 && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) 13163 //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container 13164 ) { 13165 13166 this.direction = intersection == 1 ? "down" : "up"; 13167 13168 if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { 13169 this._rearrange(event, item); 13170 } else { 13171 break; 13172 } 13173 13174 this._trigger("change", event, this._uiHash()); 13175 break; 13176 } 13177 } 13178 13179 //Post events to containers 13180 this._contactContainers(event); 13181 13182 //Interconnect with droppables 13183 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); 13184 13185 //Call callbacks 13186 this._trigger('sort', event, this._uiHash()); 13187 13188 this.lastPositionAbs = this.positionAbs; 13189 return false; 13190 13191 }, 13192 13193 _mouseStop: function(event, noPropagation) { 13194 13195 if(!event) return; 13196 13197 //If we are using droppables, inform the manager about the drop 13198 if ($.ui.ddmanager && !this.options.dropBehaviour) 13199 $.ui.ddmanager.drop(this, event); 13200 13201 if(this.options.revert) { 13202 var self = this; 13203 var cur = self.placeholder.offset(); 13204 13205 self.reverting = true; 13206 13207 $(this.helper).animate({ 13208 left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), 13209 top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) 13210 }, parseInt(this.options.revert, 10) || 500, function() { 13211 self._clear(event); 13212 }); 13213 } else { 13214 this._clear(event, noPropagation); 13215 } 13216 13217 return false;
13218 13219 }, 13220 13221 cancel: function() { 13222 13223 var self = this; 13224 13225 if(this.dragging) { 13226 13227 this._mouseUp({ target: null }); 13228 13229 if(this.options.helper == "original") 13230 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 13231 else 13232 this.currentItem.show(); 13233 13234 //Post deactivating events to containers 13235 for (var i = this.containers.length - 1; i >= 0; i--){ 13236 this.containers[i]._trigger("deactivate", null, self._uiHash(this)); 13237 if(this.containers[i].containerCache.over) { 13238 this.containers[i]._trigger("out", null, self._uiHash(this)); 13239 this.containers[i].containerCache.over = 0; 13240 } 13241 } 13242 13243 } 13244 13245 if (this.placeholder) { 13246 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 13247 if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 13248 if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); 13249 13250 $.extend(this, { 13251 helper: null, 13252 dragging: false, 13253 reverting: false, 13254 _noFinalSort: null 13255 }); 13256 13257 if(this.domPosition.prev) { 13258 $(this.domPosition.prev).after(this.currentItem); 13259 } else { 13260 $(this.domPosition.parent).prepend(this.currentItem); 13261 } 13262 } 13263 13264 return this; 13265 13266 }, 13267 13268 serialize: function(o) { 13269 13270 var items = this._getItemsAsjQuery(o && o.connected); 13271 var str = []; o = o || {}; 13272 13273 $(items).each(function() { 13274 var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); 13275 if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); 13276 }); 13277 13278 if(!str.length && o.key) { 13279 str.push(o.key + '='); 13280 } 13281 13282 return str.join('&'); 13283 13284 }, 13285 13286 toArray: function(o) { 13287 13288 var items = this._getItemsAsjQuery(o && o.connected); 13289 var ret = []; o = o || {}; 13290 13291 items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); 13292 return ret; 13293 13294 }, 13295 13296 /* Be careful with the following core functions */ 13297 _intersectsWith: function(item) { 13298 13299 var x1 = this.positionAbs.left, 13300 x2 = x1 + this.helperProportions.width, 13301 y1 = this.positionAbs.top, 13302 y2 = y1 + this.helperProportions.height; 13303 13304 var l = item.left, 13305 r = l + item.width, 13306 t = item.top, 13307 b = t + item.height; 13308 13309 var dyClick = this.offset.click.top, 13310 dxClick = this.offset.click.left; 13311 13312 var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; 13313 13314 if( this.options.tolerance == "pointer" 13315 || this.options.forcePointerForContainers 13316 || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) 13317 ) { 13318 return isOverElement; 13319 } else { 13320 13321 return (l < x1 + (this.helperProportions.width / 2) // Right Half 13322 && x2 - (this.helperProportions.width / 2) < r // Left Half 13323 && t < y1 + (this.helperProportions.height / 2) // Bottom Half 13324 && y2 - (this.helperProportions.height / 2) < b ); // Top Half 13325 13326 } 13327 }, 13328 13329 _intersectsWithPointer: function(item) { 13330 13331 var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), 13332 isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), 13333 isOverElement = isOverElementHeight && isOverElementWidth, 13334 verticalDirection = this._getDragVerticalDirection(), 13335 horizontalDirection = this._getDragHorizontalDirection(); 13336 13337 if (!isOverElement) 13338 return false; 13339 13340 return this.floating ? 13341 ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) 13342 : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); 13343 13344 }, 13345 13346 _intersectsWithSides: function(item) { 13347 13348 var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), 13349 isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), 13350 verticalDirection = this._getDragVerticalDirection(), 13351 horizontalDirection = this._getDragHorizontalDirection(); 13352 13353 if (this.floating && horizontalDirection) { 13354 return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); 13355 } else { 13356 return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); 13357 } 13358 13359 }, 13360 13361 _getDragVerticalDirection: function() { 13362 var delta = this.positionAbs.top - this.lastPositionAbs.top; 13363 return delta != 0 && (delta > 0 ? "down" : "up"); 13364 }, 13365 13366 _getDragHorizontalDirection: function() { 13367 var delta = this.positionAbs.left - this.lastPositionAbs.left; 13368 return delta != 0 && (delta > 0 ? "right" : "left"); 13369 }, 13370 13371 refresh: function(event) { 13372 this._refreshItems(event); 13373 this.refreshPositions(); 13374 return this; 13375 }, 13376 13377 _connectWith: function() { 13378 var options = this.options; 13379 return options.connectWith.constructor == String
13380 ? [options.connectWith] 13381 : options.connectWith; 13382 }, 13383 13384 _getItemsAsjQuery: function(connected) { 13385 13386 var self = this; 13387 var items = []; 13388 var queries = []; 13389 var connectWith = this._connectWith(); 13390 13391 if(connectWith && connected) { 13392 for (var i = connectWith.length - 1; i >= 0; i--){ 13393 var cur = $(connectWith[i]); 13394 for (var j = cur.length - 1; j >= 0; j--){ 13395 var inst = $.data(cur[j], 'sortable'); 13396 if(inst && inst != this && !inst.options.disabled) { 13397 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]); 13398 } 13399 }; 13400 }; 13401 } 13402 13403 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]); 13404 13405 for (var i = queries.length - 1; i >= 0; i--){ 13406 queries[i][0].each(function() { 13407 items.push(this); 13408 }); 13409 }; 13410 13411 return $(items); 13412 13413 }, 13414 13415 _removeCurrentsFromItems: function() { 13416 13417 var list = this.currentItem.find(":data(sortable-item)"); 13418 13419 for (var i=0; i < this.items.length; i++) { 13420 13421 for (var j=0; j < list.length; j++) { 13422 if(list[j] == this.items[i].item[0]) 13423 this.items.splice(i,1); 13424 }; 13425 13426 }; 13427 13428 }, 13429 13430 _refreshItems: function(event) { 13431 13432 this.items = []; 13433 this.containers = [this]; 13434 var items = this.items; 13435 var self = this; 13436 var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; 13437 var connectWith = this._connectWith(); 13438 13439 if(connectWith) { 13440 for (var i = connectWith.length - 1; i >= 0; i--){ 13441 var cur = $(connectWith[i]); 13442 for (var j = cur.length - 1; j >= 0; j--){ 13443 var inst = $.data(cur[j], 'sortable'); 13444 if(inst && inst != this && !inst.options.disabled) { 13445 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); 13446 this.containers.push(inst); 13447 } 13448 }; 13449 }; 13450 } 13451 13452 for (var i = queries.length - 1; i >= 0; i--) { 13453 var targetData = queries[i][1]; 13454 var _queries = queries[i][0]; 13455 13456 for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { 13457 var item = $(_queries[j]); 13458 13459 item.data('sortable-item', targetData); // Data for target checking (mouse manager) 13460 13461 items.push({ 13462 item: item, 13463 instance: targetData, 13464 width: 0, height: 0, 13465 left: 0, top: 0 13466 }); 13467 }; 13468 }; 13469 13470 }, 13471 13472 refreshPositions: function(fast) { 13473 13474 //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change 13475 if(this.offsetParent && this.helper) { 13476 this.offset.parent = this._getParentOffset(); 13477 } 13478 13479 for (var i = this.items.length - 1; i >= 0; i--){ 13480 var item = this.items[i]; 13481 13482 //We ignore calculating positions of all connected containers when we're not over them 13483 if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) 13484 continue; 13485 13486 var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; 13487 13488 if (!fast) { 13489 item.width = t.outerWidth(); 13490 item.height = t.outerHeight(); 13491 } 13492 13493 var p = t.offset(); 13494 item.left = p.left; 13495 item.top = p.top; 13496 }; 13497 13498 if(this.options.custom && this.options.custom.refreshContainers
13498) { 13499 this.options.custom.refreshContainers.call(this); 13500 } else { 13501 for (var i = this.containers.length - 1; i >= 0; i--){ 13502 var p = this.containers[i].element.offset(); 13503 this.containers[i].containerCache.left = p.left; 13504 this.containers[i].containerCache.top = p.top; 13505 this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); 13506 this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 13507 }; 13508 } 13509 13510 return this; 13511 }, 13512 13513 _createPlaceholder: function(that) { 13514 13515 var self = that || this, o = self.options; 13516 13517 if(!o.placeholder || o.placeholder.constructor == String) { 13518 var className = o.placeholder; 13519 o.placeholder = { 13520 element: function() { 13521 13522 var el = $(document.createElement(self.currentItem[0].nodeName)) 13523 .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") 13524 .removeClass("ui-sortable-helper")[0]; 13525 13526 if(!className) 13527 el.style.visibility = "hidden"; 13528 13529 return el; 13530 }, 13531 update: function(container, p) { 13532 13533 // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that 13534 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified 13535 if(className && !o.forcePlaceholderSize) return; 13536 13537 //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
13538 if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; 13539 if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; 13540 } 13541 }; 13542 } 13543 13544 //Create the placeholder 13545 self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); 13546 13547 //Append it after the actual current item 13548 self.currentItem.after(self.placeholder); 13549 13550 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 13551 o.placeholder.update(self, self.placeholder); 13552 13553 }, 13554 13555 _contactContainers: function(event) { 13556 13557 // get innermost container that intersects with item 13558 var innermostContainer = null, innermostIndex = null; 13559 13560 13561 for (var i = this.containers.length - 1; i >= 0; i--){ 13562 13563 // never consider a container that's located within the item itself 13564 if($.ui.contains(this.currentItem[0], this.containers[i].element[0])) 13565 continue; 13566 13567 if(this._intersectsWith(this.containers[i].containerCache)) { 13568 13569 // if we've already found a container and it's more "inner" than this, then continue 13570 if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0])) 13571 continue; 13572 13573 innermostContainer = this.containers[i]; 13574 innermostIndex = i; 13575 13576 } else { 13577 // container doesn't intersect. trigger "out" event if necessary 13578 if(this.containers[i].containerCache.over) { 13579 this.containers[i]._trigger("out", event, this._uiHash(this)); 13580 this.containers[i].containerCache.over = 0; 13581 } 13582 } 13583 13584 } 13585 13586 // if no intersecting containers found, return 13587 if(!innermostContainer) return; 13588 13589 // move the item into the container if it's not there already 13590 if(this.containers.length === 1) { 13591 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 13592 this.containers[innermostIndex].containerCache.over = 1; 13593 } else if(this.currentContainer != this.containers[innermostIndex]) { 13594 13595 //When entering a new container, we will find the item with the least distance and append our item near it 13596 var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; 13597 for (var j = this.items.length - 1; j >= 0; j--) { 13598 if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; 13599 var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; 13600 if(Math.abs(cur - base) < dist) { 13601 dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; 13602 } 13603 } 13604 13605 if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 13606 return; 13607 13608 this.currentContainer = this.containers[innermostIndex]; 13609 itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 13610 this._trigger("change", event, this._uiHash()); 13611 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 13612 13613 //Update the placeholder 13614 this.options.placeholder.update(this.currentContainer, this.placeholder); 13615 13616 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 13617 this.containers[innermostIndex].containerCache.over = 1; 13618 } 13619 13620 13621 }, 13622 13623 _createHelper: function(event) { 13624 13625 var o = this.options; 13626 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); 13627 13628 if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already 13629 $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); 13630 13631 if(helper[0] == this.currentItem[0]) 13632 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
13632: this.currentItem.css("left") }; 13633 13634 if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); 13635 if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); 13636 13637 return helper; 13638 13639 }, 13640 13641 _adjustOffsetFromHelper: function(obj) { 13642 if (typeof obj == 'string') { 13643 obj = obj.split(' '); 13644 } 13645 if ($.isArray(obj)) { 13646 obj = {left: +obj[0], top: +obj[1] || 0}; 13647 } 13648 if ('left' in obj) { 13649 this.offset.click.left = obj.left + this.margins.left; 13650 } 13651 if ('right' in obj) { 13652 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 13653 } 13654 if ('top' in obj) { 13655 this.offset.click.top = obj.top + this.margins.top; 13656 } 13657 if ('bottom' in obj) { 13658 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 13659 } 13660 }, 13661 13662 _getParentOffset: function() { 13663 13664 13665 //Get the offsetParent and cache its position 13666 this.offsetParent = this.helper.offsetParent(); 13667 var po = this.offsetParent.offset(); 13668 13669 // This is a special case where we need to modify a offset calculated on start, since the following happened: 13670 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 13671 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 13672 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 13673 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { 13674 po.left += this.scrollParent.scrollLeft(); 13675 po.top += this.scrollParent.scrollTop(); 13676 } 13677 13678 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information 13679 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix 13680 po = { top: 0, left: 0 }; 13681 13682 return { 13683 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), 13684 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 13685 }; 13686 13687 }, 13688 13689 _getRelativeOffset: function() { 13690 13691 if(this.cssPosition == "relative") { 13692 var p = this.currentItem.position(); 13693 return { 13694 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 13695 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 13696 }; 13697 } else { 13698 return { top: 0, left: 0 }; 13699 } 13700 13701 }, 13702 13703 _cacheMargins: function() { 13704 this.margins = { 13705 left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), 13706 top: (parseInt(this.currentItem.css("marginTop"),10) || 0) 13707 }; 13708 }, 13709 13710 _cacheHelperProportions: function() { 13711 this.helperProportions = { 13712 width: this.helper.outerWidth(), 13713 height: this.helper.outerHeight() 13714 }; 13715 }, 13716 13717 _setContainment: function() { 13718 13719 var o = this.options; 13720 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 13721 if(o.containment == 'document' || o.containment == 'window') this.containment = [ 13722 0 - this.offset.relative.left - this.offset.parent.left, 13723 0 - this.offset.relative.top - this.offset.parent.top, 13724 $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, 13725 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 13726 ]; 13727 13728 if(!(/^(document|window|parent)$/).test(o.containment)) { 13729 var ce = $(o.containment)[0]; 13730 var co = $(o.containment).offset(); 13731 var over = ($(ce).css("overflow") != 'hidden'); 13732 13733 this.containment = [ 13734 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, 13735 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, 13736 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, 13737 co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),
1373710) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top 13738 ]; 13739 } 13740 13741 }, 13742 13743 _convertPositionTo: function(d, pos) { 13744 13745 if(!pos) pos = this.position; 13746 var mod = d == "absolute" ? 1 : -1; 13747 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); 13748 13749 return { 13750 top: ( 13751 pos.top // The absolute mouse position 13752 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent 13753 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) 13754 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 13755 ), 13756 left: ( 13757 pos.left // The absolute mouse position 13758 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent 13759 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) 13760 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 13761 ) 13762 }; 13763 13764 }, 13765 13766 _generatePosition: function(event) { 13767 13768 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); 13769 13770 // This is another very weird special case that only happens for relative elements: 13771 // 1. If the css position is relative 13772 // 2. and the scroll parent is the document or similar to the offset parent 13773 // we have to refresh the relative offset during the scroll so there are no jumps 13774 if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { 13775 this.offset.relative = this._getRelativeOffset(); 13776 } 13777 13778 var pageX = event.pageX; 13779 var pageY = event.pageY; 13780 13781 /* 13782 * - Position constraining - 13783 * Constrain the position to a mix of grid, containment. 13784 */ 13785 13786 if(this.originalPosition) { //If we are not dragging yet, we won't check for options 13787 13788 if(this.containment) { 13789 if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; 13790 if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; 13791 if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; 13792 if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; 13793 } 13794 13795 if(o.grid) { 13796 var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 13797 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; 13798 13799 var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 13800 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; 13801 } 13802 13803 } 13804 13805 return { 13806 top: ( 13807 pageY // The absolute mouse position 13808 - this.offset.click.top // Click offset (relative to the element) 13809 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent 13810 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) 13811 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 13812 ), 13813 left: ( 13814 pageX // The absolute mouse position 13815 - this.offset.click.left // Click offset (relative to the element) 13816 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent 13817 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) 13818 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 13819 ) 13820 }; 13821 13822 }, 13823 13824 _rearrange: function(event, i, a, hardRefresh) { 13825 13826 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)); 13827 13828 //Various things done here to improve the performance: 13829 // 1. we create a setTimeout, that calls refreshPositions 13830 // 2. on the instance, we have a counter variable, that get's higher after every append 13831 // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same 13832 // 4. this lets only the last addition to the timeout stack through 13833 this.counter = this.counter ? ++this.counter : 1;
13834 var self = this, counter = this.counter; 13835 13836 window.setTimeout(function() { 13837 if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 13838 },0); 13839 13840 }, 13841 13842 _clear: function(event, noPropagation) { 13843 13844 this.reverting = false; 13845 // We delay all events that have to be triggered to after the point where the placeholder has been removed and 13846 // everything else normalized again 13847 var delayedTriggers = [], self = this; 13848 13849 // We first have to update the dom position of the actual currentItem 13850 // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) 13851 if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); 13852 this._noFinalSort = null; 13853 13854 if(this.helper[0] == this.currentItem[0]) { 13855 for(var i in this._storedCSS) { 13856 if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; 13857 } 13858 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); 13859 } else { 13860 this.currentItem.show(); 13861 } 13862 13863 if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); 13864 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 13865 if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element 13866 if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); 13867 for (var i = this.containers.length - 1; i >= 0; i--){ 13868 if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { 13869 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 13870 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 13871 } 13872 }; 13873 }; 13874 13875 //Post events to containers 13876 for (var i = this.containers.length - 1; i >= 0; i--){ 13877 if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 13878 if(this.containers[i].containerCache.over) { 13879 delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); 13880 this.containers[i].containerCache.over = 0; 13881 } 13882 } 13883 13884 //Do what was originally in plugins 13885 if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor 13886 if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity 13887 if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index 13888 13889 this.dragging = false; 13890 if(this.cancelHelperRemoval) { 13891 if(!noPropagation) { 13892 this._trigger("beforeStop", event, this._uiHash()); 13893 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 13894 this._trigger("stop", event, this._uiHash()); 13895 } 13896 return false; 13897 } 13898 13899 if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); 13900 13901 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! 13902 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 13903 13904 if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; 13905 13906 if(!noPropagation) { 13907 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events 13908 this._trigger("stop", event, this._uiHash()); 13909 } 13910 13911 this.fromOutside = false;
13912 return true; 13913 13914 }, 13915 13916 _trigger: function() { 13917 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 13918 this.cancel(); 13919 } 13920 }, 13921 13922 _uiHash: function(inst) { 13923 var self = inst || this; 13924 return { 13925 helper: self.helper, 13926 placeholder: self.placeholder || $([]), 13927 position: self.position, 13928 originalPosition: self.originalPosition, 13929 offset: self.positionAbs, 13930 item: self.currentItem, 13931 sender: inst ? inst.element : null 13932 }; 13933 } 13934 13935}); 13936 13937$.extend($.ui.sortable, { 13938 version: "1.8.16" 13939}); 13940 13941})(jQuery); 13942/* 13943 * jQuery UI Accordion 1.8.16 13944 * 13945 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 13946 * Dual licensed under the MIT or GPL Version 2 licenses. 13947 * http://jquery.org/license 13948 * 13949 * http://docs.jquery.com/UI/Accordion 13950 * 13951 * Depends: 13952 * jquery.ui.core.js 13953 * jquery.ui.widget.js 13954 */ 13955(function( $, undefined ) { 13956 13957$.widget( "ui.accordion", { 13958 options: { 13959 active: 0, 13960 animated: "slide", 13961 autoHeight: true, 13962 clearStyle: false, 13963 collapsible: false, 13964 event: "click", 13965 fillSpace: false, 13966 header: "> li > :first-child,> :not(li):even", 13967 icons: { 13968 header: "ui-icon-triangle-1-e", 13969 headerSelected: "ui-icon-triangle-1-s" 13970 }, 13971 navigation: false, 13972 navigationFilter: function() { 13973 return this.href.toLowerCase() === location.href.toLowerCase(); 13974 } 13975 }, 13976 13977 _create: function() { 13978 var self = this, 13979 options = self.options; 13980 13981 self.running = 0; 13982 13983 self.element 13984 .addClass( "ui-accordion ui-widget ui-helper-reset" ) 13985 // in lack of child-selectors in CSS 13986 // we need to mark top-LIs in a UL-accordion for some IE-fix 13987 .children( "li" ) 13988 .addClass( "ui-accordion-li-fix" ); 13989 13990 self.headers = self.element.find( options.header ) 13991 .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) 13992 .bind( "mouseenter.accordion", function() { 13993 if ( options.disabled ) { 13994 return; 13995 } 13996 $( this ).addClass( "ui-state-hover" ); 13997 }) 13998 .bind( "mouseleave.accordion", function() { 13999 if ( options.disabled ) { 14000 return; 14001 } 14002 $( this ).removeClass( "ui-state-hover" ); 14003 }) 14004 .bind( "focus.accordion", function() { 14005 if ( options.disabled ) { 14006 return; 14007 } 14008 $( this ).addClass( "ui-state-focus" ); 14009 }) 14010 .bind( "blur.accordion", function() { 14011 if ( options.disabled ) { 14012 return; 14013 } 14014 $( this ).removeClass( "ui-state-focus" ); 14015 }); 14016 14017 self.headers.next() 14018 .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); 14019 14020 if ( options.navigation ) { 14021 var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); 14022 if ( current.length ) { 14023 var header = current.closest( ".ui-accordion-header" ); 14024 if ( header.length ) { 14025 // anchor within header 14026 self.active = header; 14027 } else { 14028 // anchor within content 14029 self.active = current.closest( ".ui-accordion-content" ).prev(); 14030 } 14031 } 14032 } 14033 14034 self.active = self._findActive( self.active || options.active ) 14035 .addClass( "ui-state-default ui-state-active" ) 14036 .toggleClass( "ui-corner-all" ) 14037 .toggleClass( "ui-corner-top" ); 14038 self.active.next().addClass( "ui-accordion-content-active" ); 14039 14040 self._createIcons(); 14041 self.resize(); 14042 14043 // ARIA 14044 self.element.attr( "role", "tablist" ); 14045 14046 self.headers 14047 .attr( "role", "tab" ) 14048 .bind( "keydown.accordion", function( event ) { 14049 return self._keydown( event ); 14050 }) 14051 .next() 14052 .attr( "role", "tabpanel" ); 14053 14054 self.headers 14055 .not( self.active || "" ) 14056 .attr({ 14057 "aria-expanded": "false", 14058 "aria-selected": "false", 14059 tabIndex: -1 14060 }) 14061 .next() 14062 .hide(); 14063 14064 // make sure at least one header is in the tab order 14065 if ( !self.active.length ) { 14066 self.headers.eq( 0 ).attr( "tabIndex", 0 ); 14067 } else { 14068 self.active 14069 .attr({ 14070 "aria-expanded": "true", 14071 "aria-selected": "true", 14072 tabIndex: 0 14073 }); 14074 } 14075 14076 // only need links in tab order for Safari 14077 if ( !$.browser.safari ) { 14078 self.headers.find( "a" ).attr( "tabIndex", -1 ); 14079 } 14080 14081 if ( options.event ) { 14082 self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { 14083 self._clickHandler.call( self, event, this ); 14084 event.preventDefault(); 14085 }); 14086 } 14087 }, 14088 14089 _createIcons: function() { 14090 var options = this.options; 14091 if ( options.icons ) { 14092 $( "<span></span>" ) 14093 .addClass( "ui-icon " + options.icons.header ) 14094 .prependTo( this.headers ); 14095 this.active.children( ".ui-icon" ) 14096 .toggleClass(options.icons.header) 14097 .toggleClass(options.icons.headerSelected); 14098 this.element.addClass( "ui-accordion-icons" ); 14099 } 14100 }, 14101 14102 _destroyIcons: function() { 14103 this.headers.children( ".ui-icon" ).remove(); 14104 this.element.removeClass( "ui-accordion-icons" ); 14105 }, 14106 14107 destroy: function() { 14108 var options = this.options; 14109 14110 this.element 14111 .removeClass( "ui-accordion ui-widget ui-helper-reset" ) 14112 .removeAttr( "role" ); 14113 14114 this.headers 14115 .unbind( ".accordion" ) 14116 .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" ) 14117 .removeAttr( "role" ) 14118 .removeAttr( "aria-expanded" ) 14119 .removeAttr( "aria-selected" ) 14120 .removeAttr( "tabIndex" ); 14121 14122 this.headers.find( "a" ).removeAttr( "tabIndex" ); 14123 this._destroyIcons(); 14124 var contents = this.headers.next() 14125 .css( "display", "" ) 14126 .removeAttr( "role" ) 14127 .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); 14128 if ( options.autoHeight || options.fillHeight ) { 14129 contents.css( "height", "" ); 14130 } 14131 14132 return $.Widget.prototype.destroy.call( this ); 14133 }, 14134 14135 _setOption: function( key, value ) { 14136 $.Widget.prototype._setOption.apply( this, arguments ); 14137 14138 if ( key == "active" ) { 14139 this.activate( value ); 14140 } 14141 if ( key == "icons" ) { 14142 this._destroyIcons(); 14143 if ( value ) { 14144 this._createIcons(); 14145 } 14146 } 14147 // #5332 - opacity doesn't cascade to positioned elements in IE 14148 // so we need to add the disabled class to the headers and panels 14149 if ( key == "disabled" ) { 14150 this.headers.add(this.headers.next()) 14151 [ value ? "addClass" : "removeClass" ]( 14152 "ui-accordion-disabled ui-state-disabled" ); 14153 } 14154 }, 14155 14156 _keydown: function( event ) { 14157 if ( this.options.disabled || event.altKey || event.ctrlKey ) { 14158 return; 14159 } 14160 14161 var keyCode = $.ui.keyCode, 14162 length = this.headers.length, 14163 currentIndex = this.headers.index( event.target ), 14164 toFocus = false;
14165 14166 switch ( event.keyCode ) { 14167 case keyCode.RIGHT: 14168 case keyCode.DOWN: 14169 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 14170 break; 14171 case keyCode.LEFT: 14172 case keyCode.UP: 14173 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 14174 break; 14175 case keyCode.SPACE: 14176 case keyCode.ENTER: 14177 this._clickHandler( { target: event.target }, event.target ); 14178 event.preventDefault(); 14179 } 14180 14181 if ( toFocus ) { 14182 $( event.target ).attr( "tabIndex", -1 ); 14183 $( toFocus ).attr( "tabIndex", 0 ); 14184 toFocus.focus(); 14185 return false; 14186 } 14187 14188 return true; 14189 }, 14190 14191 resize: function() { 14192 var options = this.options, 14193 maxHeight; 14194 14195 if ( options.fillSpace ) { 14196 if ( $.browser.msie ) { 14197 var defOverflow = this.element.parent().css( "overflow" ); 14198 this.element.parent().css( "overflow", "hidden"); 14199 } 14200 maxHeight = this.element.parent().height(); 14201 if ($.browser.msie) { 14202 this.element.parent().css( "overflow", defOverflow ); 14203 } 14204 14205 this.headers.each(function() { 14206 maxHeight -= $( this ).outerHeight( true ); 14207 }); 14208 14209 this.headers.next() 14210 .each(function() { 14211 $( this ).height( Math.max( 0, maxHeight - 14212 $( this ).innerHeight() + $( this ).height() ) ); 14213 }) 14214 .css( "overflow", "auto" ); 14215 } else if ( options.autoHeight ) { 14216 maxHeight = 0; 14217 this.headers.next() 14218 .each(function() { 14219 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 14220 }) 14221 .height( maxHeight ); 14222 } 14223 14224 return this; 14225 }, 14226 14227 activate: function( index ) { 14228 // TODO this gets called on init, changing the option without an explicit call for that 14229 this.options.active = index; 14230 // call clickHandler with custom event 14231 var active = this._findActive( index )[ 0 ]; 14232 this._clickHandler( { target: active }, active ); 14233 14234 return this; 14235 }, 14236 14237 _findActive: function( selector ) { 14238 return selector 14239 ? typeof selector === "number" 14240 ? this.headers.filter( ":eq(" + selector + ")" ) 14241 : this.headers.not( this.headers.not( selector ) ) 14242 : selector === false 14243 ? $( [] ) 14244 : this.headers.filter( ":eq(0)" ); 14245 }, 14246 14247 // TODO isn't event.target enough? why the separate target argument? 14248 _clickHandler: function( event, target ) { 14249 var options = this.options; 14250 if ( options.disabled ) { 14251 return; 14252 } 14253 14254 // called only when using activate(false) to close all parts programmatically 14255 if ( !event.target ) { 14256 if ( !options.collapsible ) { 14257 return; 14258 } 14259 this.active 14260 .removeClass( "ui-state-active ui-corner-top" ) 14261 .addClass( "ui-state-default ui-corner-all" ) 14262 .children( ".ui-icon" ) 14263 .removeClass( options.icons.headerSelected ) 14264 .addClass( options.icons.header ); 14265 this.active.next().addClass( "ui-accordion-content-active" ); 14266 var toHide = this.active.next(), 14267 data = { 14268 options: options, 14269 newHeader: $( [] ), 14270 oldHeader: options.active, 14271 newContent: $( [] ), 14272 oldContent: toHide 14273 }, 14274 toShow = ( this.active = $( [] ) ); 14275 this._toggle( toShow, toHide, data ); 14276 return; 14277 } 14278 14279 // get the click target 14280 var clicked = $( event.currentTarget || target ), 14281 clickedIsActive = clicked[0] === this.active[0]; 14282 14283 // TODO the option is changed, is that correct? 14284 // TODO if it is correct, shouldn't that happen after determining that the click is valid? 14285 options.active = options.collapsible && clickedIsActive ? 14286 false : 14287 this.headers.index( clicked ); 14288 14289 // if animations are still active, or the active header is the target, ignore click 14290 if ( this.running || ( !options.collapsible && clickedIsActive ) ) { 14291 return; 14292 } 14293 14294 // find elements to show and hide 14295 var active = this.active, 14296 toShow = clicked.next(), 14297 toHide = this.active.next(), 14298 data = { 14299 options: options, 14300 newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, 14301 oldHeader: this.active, 14302 newContent: clickedIsActive && options.collapsible ? $([]) : toShow, 14303 oldContent: toHide 14304 }, 14305 down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); 14306 14307 // when the call to ._toggle() comes after the class changes 14308 // it causes a very odd bug in IE 8 (see #6720) 14309 this.active = clickedIsActive ? $([]) : clicked; 14310 this._toggle( toShow, toHide, data, clickedIsActive, down ); 14311 14312 // switch classes 14313 active 14314 .removeClass( "ui-state-active ui-corner-top" ) 14315 .addClass( "ui-state-default ui-corner-all" ) 14316 .children( ".ui-icon" ) 14317 .removeClass( options.icons.headerSelected )
14318 .addClass( options.icons.header ); 14319 if ( !clickedIsActive ) { 14320 clicked 14321 .removeClass( "ui-state-default ui-corner-all" ) 14322 .addClass( "ui-state-active ui-corner-top" ) 14323 .children( ".ui-icon" ) 14324 .removeClass( options.icons.header ) 14325 .addClass( options.icons.headerSelected ); 14326 clicked 14327 .next() 14328 .addClass( "ui-accordion-content-active" ); 14329 } 14330 14331 return; 14332 }, 14333 14334 _toggle: function( toShow, toHide, data, clickedIsActive, down ) { 14335 var self = this, 14336 options = self.options; 14337 14338 self.toShow = toShow; 14339 self.toHide = toHide; 14340 self.data = data; 14341 14342 var complete = function() { 14343 if ( !self ) { 14344 return; 14345 } 14346 return self._completed.apply( self, arguments ); 14347 }; 14348 14349 // trigger changestart event 14350 self._trigger( "changestart", null, self.data ); 14351 14352 // count elements to animate 14353 self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); 14354 14355 if ( options.animated ) { 14356 var animOptions = {}; 14357 14358 if ( options.collapsible && clickedIsActive ) { 14359 animOptions = { 14360 toShow: $( [] ), 14361 toHide: toHide, 14362 complete: complete, 14363 down: down, 14364 autoHeight: options.autoHeight || options.fillSpace 14365 }; 14366 } else { 14367 animOptions = { 14368 toShow: toShow, 14369 toHide: toHide, 14370 complete: complete, 14371 down: down, 14372 autoHeight: options.autoHeight || options.fillSpace 14373 }; 14374 } 14375 14376 if ( !options.proxied ) { 14377 options.proxied = options.animated; 14378 } 14379 14380 if ( !options.proxiedDuration ) { 14381 options.proxiedDuration = options.duration; 14382 } 14383 14384 options.animated = $.isFunction( options.proxied ) ? 14385 options.proxied( animOptions ) : 14386 options.proxied; 14387 14388 options.duration = $.isFunction( options.proxiedDuration ) ? 14389 options.proxiedDuration( animOptions ) : 14390 options.proxiedDuration; 14391 14392 var animations = $.ui.accordion.animations, 14393 duration = options.duration, 14394 easing = options.animated; 14395 14396 if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { 14397 easing = "slide"; 14398 } 14399 if ( !animations[ easing ] ) { 14400 animations[ easing ] = function( options ) { 14401 this.slide( options, { 14402 easing: easing, 14403 duration: duration || 700 14404 }); 14405 }; 14406 } 14407 14408 animations[ easing ]( animOptions ); 14409 } else { 14410 if ( options.collapsible && clickedIsActive ) { 14411 toShow.toggle(); 14412 } else { 14413 toHide.hide(); 14414 toShow.show(); 14415 } 14416 14417 complete( true ); 14418 } 14419 14420 // TODO assert that the blur and focus triggers are really necessary, remove otherwise 14421 toHide.prev() 14422 .attr({ 14423 "aria-expanded": "false", 14424 "aria-selected": "false", 14425 tabIndex: -1 14426 }) 14427 .blur(); 14428 toShow.prev() 14429 .attr({ 14430 "aria-expanded": "true", 14431 "aria-selected": "true", 14432 tabIndex: 0 14433 }) 14434 .focus(); 14435 }, 14436 14437 _completed: function( cancel ) { 14438 this.running = cancel ? 0 : --this.running; 14439 if ( this.running ) { 14440 return; 14441 } 14442 14443 if ( this.options.clearStyle ) { 14444 this.toShow.add( this.toHide ).css({ 14445 height: "", 14446 overflow: "" 14447 }); 14448 } 14449 14450 // other classes are removed before the animation; this one needs to stay until completed 14451 this.toHide.removeClass( "ui-accordion-content-active" ); 14452 // Work around for rendering bug in IE (#5421) 14453 if ( this.toHide.length ) { 14454 this.toHide.parent()[0].className = this.toHide.parent()[0].className; 14455 } 14456 14457 this._trigger( "change", null, this.data ); 14458 } 14459}); 14460 14461$.extend( $.ui.accordion, { 14462 version: "1.8.16", 14463 animations: { 14464 slide: function( options, additions ) { 14465 options = $.extend({ 14466 easing: "swing", 14467 duration: 300 14468 }, options, additions ); 14469 if ( !options.toHide.size() ) { 14470 options.toShow.animate({ 14471 height: "show", 14472 paddingTop: "show", 14473 paddingBottom: "show" 14474 }, options ); 14475 return; 14476 } 14477 if ( !options.toShow.size() ) { 14478 options.toHide.animate({ 14479 height: "hide", 14480 paddingTop: "hide", 14481 paddingBottom: "hide" 14482 }, options ); 14483 return; 14484 } 14485 var overflow = options.toShow.css( "overflow" ), 14486 percentDone = 0, 14487 showProps = {}, 14488 hideProps = {}, 14489 fxAttrs = [ "height", "paddingTop", "paddingBottom" ], 14490 originalWidth; 14491 // fix width before calculating height of hidden element 14492 var s = options.toShow; 14493 originalWidth = s[0].style.width; 14494 s.width( parseInt( s.parent().width(), 10 ) 14495 - parseInt( s.css( "paddingLeft" ), 10 ) 14496 - parseInt( s.css( "paddingRight" ), 10 ) 14497 - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) 14498 - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) ); 14499 14500 $.each( fxAttrs, function( i, prop ) { 14501 hideProps[ prop ] = "hide"; 14502 14503 var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); 14504 showProps[ prop ] = { 14505 value: parts[ 1 ], 14506 unit: parts[ 2 ] || "px" 14507 }; 14508 }); 14509 options.toShow.css({ height: 0, overflow: "hidden" }).show(); 14510 options.toHide 14511 .filter( ":hidden" ) 14512 .each( options.complete ) 14513 .end() 14514 .filter( ":visible" ) 14515 .animate( hideProps, { 14516 step: function( now, settings ) { 14517 // only calculate the percent when animating height 14518 // IE gets very inconsistent results when animating elements 14519 // with small values, which is common for padding 14520 if ( settings.prop == "height" ) { 14521 percentDone = ( settings.end - settings.start === 0 ) ? 0 : 14522 ( settings.now - settings.start ) / ( settings.end - settings.start ); 14523 } 14524 14525 options.toShow[ 0 ].style[ settings.prop ] = 14526 ( percentDone * showProps[ settings.prop ].value ) 14527 + showProps[ settings.prop ].unit; 14528 }, 14529 duration: options.duration, 14530 easing: options.easing, 14531 complete: function() { 14532 if ( !options.autoHeight ) { 14533 options.toShow.css( "height", "" ); 14534 } 14535 options.toShow.css({ 14536 width: originalWidth, 14537 overflow: overflow 14538 }); 14539 options.complete(); 14540 } 14541 }); 14542 }, 14543 bounceslide: function( options ) { 14544 this.slide( options, { 14545 easing: options.down ? "easeOutBounce" : "swing", 14546 duration: options.down ? 1000 : 200 14547 }); 14548 } 14549 } 14550}); 14551 14552})( jQuery ); 14553/* 14554 * jQuery UI Autocomplete 1.8.16 14555 * 14556 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 14557 * Dual licensed under the MIT or GPL Version 2 licenses. 14558 * http://jquery.org/license 14559 * 14560 * http://docs.jquery.com/UI/Autocomplete 14561 * 14562 * Depends: 14563 * jquery.ui.core.js 14564 * jquery.ui.widget.js 14565 * jquery.ui.position.js 14566 */ 14567(function( $, undefined ) { 14568 14569// used to prevent race conditions with remote data sources 14570var requestIndex = 0; 14571 14572$.widget( "ui.autocomplete", { 14573 options: { 14574 appendTo: "body", 14575 autoFocus: false, 14576 delay: 300, 14577 minLength: 1, 14578 position: { 14579 my: "left top", 14580 at: "left bottom", 14581 collision: "none" 14582 }, 14583 source: null 14584 }, 14585 14586 pending: 0, 14587 14588 _create: function() { 14589 var self = this, 14590 doc = this.element[ 0 ].ownerDocument, 14591 suppressKeyPress; 14592 14593 this.element 14594 .addClass( "ui-autocomplete-input" ) 14595 .attr( "autocomplete", "off" ) 14596 // TODO verify these actually work as intended 14597 .attr({ 14598 role: "textbox", 14599 "aria-autocomplete": "list", 14600 "aria-haspopup": "true" 14601 }) 14602 .bind( "keydown.autocomplete", function( event ) { 14603 if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) { 14604 return; 14605 } 14606 14607 suppressKeyPress = false;
14608 var keyCode = $.ui.keyCode; 14609 switch( event.keyCode ) { 14610 case keyCode.PAGE_UP: 14611 self._move( "previousPage", event ); 14612 break; 14613 case keyCode.PAGE_DOWN: 14614 self._move( "nextPage", event ); 14615 break; 14616 case keyCode.UP: 14617 self._move( "previous", event ); 14618 // prevent moving cursor to beginning of text field in some browsers 14619 event.preventDefault(); 14620 break; 14621 case keyCode.DOWN: 14622 self._move( "next", event ); 14623 // prevent moving cursor to end of text field in some browsers 14624 event.preventDefault(); 14625 break; 14626 case keyCode.ENTER: 14627 case keyCode.NUMPAD_ENTER: 14628 // when menu is open and has focus 14629 if ( self.menu.active ) { 14630 // #6055 - Opera still allows the keypress to occur 14631 // which causes forms to submit 14632 suppressKeyPress = true; 14633 event.preventDefault(); 14634 } 14635 //passthrough - ENTER and TAB both select the current element 14636 case keyCode.TAB: 14637 if ( !self.menu.active ) { 14638 return; 14639 } 14640 self.menu.select( event ); 14641 break; 14642 case keyCode.ESCAPE: 14643 self.element.val( self.term ); 14644 self.close( event ); 14645 break; 14646 default: 14647 // keypress is triggered before the input value is changed 14648 clearTimeout( self.searching ); 14649 self.searching = setTimeout(function() { 14650 // only search if the value has changed 14651 if ( self.term != self.element.val() ) { 14652 self.selectedItem = null; 14653 self.search( null, event ); 14654 } 14655 }, self.options.delay ); 14656 break; 14657 } 14658 }) 14659 .bind( "keypress.autocomplete", function( event ) { 14660 if ( suppressKeyPress ) { 14661 suppressKeyPress = false; 14662 event.preventDefault(); 14663 } 14664 }) 14665 .bind( "focus.autocomplete", function() { 14666 if ( self.options.disabled ) { 14667 return; 14668 } 14669 14670 self.selectedItem = null; 14671 self.previous = self.element.val(); 14672 }) 14673 .bind( "blur.autocomplete", function( event ) { 14674 if ( self.options.disabled ) { 14675 return; 14676 } 14677 14678 clearTimeout( self.searching ); 14679 // clicks on the menu (or a button to trigger a search) will cause a blur event 14680 self.closing = setTimeout(function() { 14681 self.close( event ); 14682 self._change( event ); 14683 }, 150 ); 14684 }); 14685 this._initSource(); 14686 this.response = function() { 14687 return self._response.apply( self, arguments ); 14688 }; 14689 this.menu = $( "<ul></ul>" ) 14690 .addClass( "ui-autocomplete" ) 14691 .appendTo( $( this.options.appendTo || "body", doc )[0] ) 14692 // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) 14693 .mousedown(function( event ) { 14694 // clicking on the scrollbar causes focus to shift to the body 14695 // but we can't detect a mouseup or a click immediately afterward 14696 // so we have to track the next mousedown and close the menu if 14697 // the user clicks somewhere outside of the autocomplete 14698 var menuElement = self.menu.element[ 0 ]; 14699 if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { 14700 setTimeout(function() { 14701 $( document ).one( 'mousedown', function( event ) { 14702 if ( event.target !== self.element[ 0 ] && 14703 event.target !== menuElement && 14704 !$.ui.contains( menuElement, event.target ) ) { 14705 self.close(); 14706 } 14707 }); 14708 }, 1 ); 14709 } 14710 14711 // use another timeout to make sure the blur-event-handler on the input was already triggered 14712 setTimeout(function() { 14713 clearTimeout( self.closing ); 14714 }, 13); 14715 }) 14716 .menu({ 14717 focus: function( event, ui ) { 14718 var item = ui.item.data( "item.autocomplete" ); 14719 if ( false !== self._trigger( "focus", event, { item: item } ) ) { 14720 // use value to match what will end up in the input, if it was a key event 14721 if ( /^key/.test(event.originalEvent.type) ) { 14722 self.element.val( item.value ); 14723 } 14724 } 14725 }, 14726 selected: function( event, ui ) { 14727 var item = ui.item.data( "item.autocomplete" ), 14728 previous = self.previous; 14729 14730 // only trigger when focus was lost (click on menu) 14731 if ( self.element[0] !== doc.activeElement ) { 14732 self.element.focus(); 14733 self.previous = previous; 14734 // #6109 - IE triggers two focus events and the second 14735 // is asynchronous, so we need to reset the previous 14736 // term synchronously and asynchronously :-( 14737 setTimeout(function() { 14738 self.previous = previous; 14739 self.selectedItem = item; 14740 }, 1); 14741 } 14742 14743 if ( false !== self._trigger( "select", event, { item: item } ) ) { 14744 self.element.val( item.value ); 14745 } 14746 // reset the term after the select event 14747 // this allows custom select handling to work properly 14748 self.term = self.element.val(); 14749 14750 self.close( event ); 14751 self.selectedItem = item; 14752 }, 14753 blur: function( event, ui ) { 14754 // don't set the value of the text field if it's already correct 14755 // this prevents moving the cursor unnecessarily 14756 if ( self.menu.element.is(":visible") && 14757 ( self.element.val() !== self.term ) ) { 14758 self.element.val( self.term ); 14759 } 14760 } 14761 }) 14762 .zIndex( this.element.zIndex() + 1 ) 14763 // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 14764 .css({ top: 0, left: 0 }) 14765 .hide() 14766 .data( "menu" ); 14767 if ( $.fn.bgiframe ) { 14768 this.menu.element.bgiframe(); 14769 } 14770 }, 14771 14772 destroy: function() { 14773 this.element 14774 .removeClass( "ui-autocomplete-input" ) 14775 .removeAttr( "autocomplete" ) 14776 .removeAttr( "role" ) 14777 .removeAttr( "aria-autocomplete" ) 14778 .removeAttr( "aria-haspopup" ); 14779 this.menu.element.remove(); 14780 $.Widget.prototype.destroy.call( this ); 14781 }, 14782 14783 _setOption: function( key, value ) { 14784 $.Widget.prototype._setOption.apply( this, arguments ); 14785 if ( key === "source" ) { 14786 this._initSource(); 14787 } 14788 if ( key === "appendTo" ) { 14789 this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) 14790 } 14791 if ( key === "disabled" && value && this.xhr ) { 14792 this.xhr.abort(); 14793 } 14794 }, 14795 14796 _initSource: function() { 14797 var self = this, 14798 array, 14799 url; 14800 if ( $.isArray(this.options.source) ) { 14801 array = this.options.source; 14802 this.source = function( request, response ) { 14803 response( $.ui.autocomplete.filter(array, request.term) ); 14804 }; 14805 } else if ( typeof this.options.source === "string" ) { 14806 url = this.options.source; 14807 this.source = function( request, response ) { 14808 if ( self.xhr ) { 14809 self.xhr.abort(); 14810 } 14811 self.xhr = $.ajax({ 14812 url: url, 14813 data: request, 14814 dataType: "json", 14815 autocompleteRequest: ++requestIndex, 14816 success: function( data, status ) { 14817 if ( this.autocompleteRequest === requestIndex ) { 14818 response( data ); 14819 } 14820 }, 14821 error: function() { 14822 if ( this.autocompleteRequest === requestIndex ) { 14823 response( [] ); 14824 } 14825 } 14826 }); 14827 }; 14828 } else { 14829 this.source = this.options.source; 14830 } 14831 }, 14832 14833 search: function( value, event ) { 14834 value = value != null ? value : this.element.val(); 14835 14836 // always save the actual value, not the one passed as an argument 14837 this.term = this.element.val(); 14838 14839 if ( value.length < this.options.minLength ) { 14840 return this.close( event ); 14841 } 14842 14843 clearTimeout( this.closing ); 14844 if ( this._trigger( "search", event ) === false ) { 14845 return; 14846 } 14847 14848 return this._search( value ); 14849 }, 14850 14851 _search: function( value ) { 14852 this.pending++; 14853 this.element.addClass( "ui-autocomplete-loading" ); 14854 14855 this.source( { term: value }, this.response ); 14856 }, 14857 14858 _response: function( content ) { 14859 if ( !this.options.disabled && content && content.length ) { 14860 content = this._normalize( content ); 14861 this._suggest( content ); 14862 this._trigger( "open" ); 14863 } else { 14864 this.close(); 14865 } 14866 this.pending--; 14867 if ( !this.pending ) { 14868 this.element.removeClass( "ui-autocomplete-loading" ); 14869 } 14870 }, 14871 14872 close: function( event ) { 14873 clearTimeout( this.closing ); 14874 if ( this.menu.element.is(":visible") ) { 14875 this.menu.element.hide(); 14876 this.menu.deactivate(); 14877 this._trigger( "close", event ); 14878 } 14879 }, 14880 14881 _change: function( event ) { 14882 if ( this.previous !== this.element.val() ) { 14883 this._trigger( "change", event, { item: this.selectedItem } ); 14884 } 14885 }, 14886 14887 _normalize: function( items ) { 14888 // assume all items have the right format when the first item is complete 14889 if ( items.length && items[0].label && items[0].value ) { 14890 return items; 14891 } 14892 return $.map( items, function(item) { 14893 if ( typeof item === "string" ) { 14894 return { 14895 label: item, 14896 value: item 14897 }; 14898 } 14899 return $.extend({ 14900 label: item.label || item.value, 14901 value: item.value || item.label 14902 }, item ); 14903 }); 14904 }, 14905 14906 _suggest: function( items ) { 14907 var ul = this.menu.element 14908 .empty() 14909 .zIndex( this.element.zIndex() + 1 ); 14910 this._renderMenu( ul, items ); 14911 // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate 14912 this.menu.deactivate(); 14913 this.menu.refresh(); 14914 14915 // size and position menu 14916 ul.show(); 14917 this._resizeMenu(); 14918 ul.position( $.extend({ 14919 of: this.element 14920 }, this.options.position )); 14921 14922 if ( this.options.autoFocus ) { 14923 this.menu.next( new $.Event("mouseover") ); 14924 } 14925 }, 14926 14927 _resizeMenu: function() { 14928 var ul = this.menu.element; 14929 ul.outerWidth( Math.max( 14930 ul.width( "" ).outerWidth(), 14931 this.element.outerWidth() 14932 ) ); 14933 }, 14934 14935 _renderMenu: function( ul, items ) { 14936 var self = this; 14937 $.each( items, function( index, item ) { 14938 self._renderItem( ul, item ); 14939 }); 14940 }, 14941 14942 _renderItem: function( ul, item) { 14943 return $( "<li></li>" ) 14944 .data( "item.autocomplete", item ) 14945 .append( $( "<a></a>" ).text( item.label ) ) 14946 .appendTo( ul ); 14947 }, 14948 14949 _move: function( direction, event ) { 14950 if ( !this.menu.element.is(":visible") ) { 14951 this.search( null, event ); 14952 return; 14953 } 14954 if ( this.menu.first() && /^previous/.test(direction) || 14955 this.menu.last() && /^next/.test(direction) ) { 14956 this.element.val( this.term ); 14957 this.menu.deactivate(); 14958 return; 14959 } 14960 this.menu[ direction ]( event ); 14961 }, 14962 14963 widget: function() { 14964 return this.menu.element; 14965 } 14966}); 14967 14968$.extend( $.ui.autocomplete, { 14969 escapeRegex: function( value ) { 14970 return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 14971 }, 14972 filter: function(array, term) { 14973 var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); 14974 return $.grep( array, function(value) { 14975 return matcher.test( value.label || value.value || value ); 14976 }); 14977 } 14978}); 14979 14980}( jQuery )); 14981 14982/* 14983 * jQuery UI Menu (not officially released) 14984 * 14985 * This widget isn't yet finished and the API is subject to change. We plan to finish 14986 * it for the next release. You're welcome to give it a try anyway and give us feedback,
14987 * as long as you're okay with migrating your code later on. We can help with that, too. 14988 * 14989 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 14990 * Dual licensed under the MIT or GPL Version 2 licenses. 14991 * http://jquery.org/license 14992 * 14993 * http://docs.jquery.com/UI/Menu 14994 * 14995 * Depends: 14996 * jquery.ui.core.js 14997 * jquery.ui.widget.js 14998 */ 14999(function($) { 15000 15001$.widget("ui.menu", { 15002 _create: function() { 15003 var self = this; 15004 this.element 15005 .addClass("ui-menu ui-widget ui-widget-content ui-corner-all") 15006 .attr({ 15007 role: "listbox", 15008 "aria-activedescendant": "ui-active-menuitem" 15009 }) 15010 .click(function( event ) { 15011 if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) { 15012 return; 15013 } 15014 // temporary 15015 event.preventDefault(); 15016 self.select( event ); 15017 }); 15018 this.refresh(); 15019 }, 15020 15021 refresh: function() { 15022 var self = this; 15023 15024 // don't refresh list items that are already adapted 15025 var items = this.element.children("li:not(.ui-menu-item):has(a)") 15026 .addClass("ui-menu-item") 15027 .attr("role", "menuitem"); 15028 15029 items.children("a") 15030 .addClass("ui-corner-all") 15031 .attr("tabindex", -1) 15032 // mouseenter doesn't work with event delegation 15033 .mouseenter(function( event ) { 15034 self.activate( event, $(this).parent() ); 15035 }) 15036 .mouseleave(function() { 15037 self.deactivate(); 15038 }); 15039 }, 15040 15041 activate: function( event, item ) { 15042 this.deactivate(); 15043 if (this.hasScroll()) { 15044 var offset = item.offset().top - this.element.offset().top, 15045 scroll = this.element.scrollTop(), 15046 elementHeight = this.element.height(); 15047 if (offset < 0) { 15048 this.element.scrollTop( scroll + offset); 15049 } else if (offset >= elementHeight) { 15050 this.element.scrollTop( scroll + offset - elementHeight + item.height()); 15051 } 15052 } 15053 this.active = item.eq(0) 15054 .children("a") 15055 .addClass("ui-state-hover") 15056 .attr("id", "ui-active-menuitem") 15057 .end(); 15058 this._trigger("focus", event, { item: item }); 15059 }, 15060 15061 deactivate: function() { 15062 if (!this.active) { return; } 15063 15064 this.active.children("a") 15065 .removeClass("ui-state-hover") 15066 .removeAttr("id"); 15067 this._trigger("blur"); 15068 this.active = null; 15069 }, 15070 15071 next: function(event) { 15072 this.move("next", ".ui-menu-item:first", event); 15073 }, 15074 15075 previous: function(event) { 15076 this.move("prev", ".ui-menu-item:last", event); 15077 }, 15078 15079 first: function() { 15080 return this.active && !this.active.prevAll(".ui-menu-item").length; 15081 }, 15082 15083 last: function() { 15084 return this.active && !this.active.nextAll(".ui-menu-item").length; 15085 }, 15086 15087 move: function(direction, edge, event) { 15088 if (!this.active) { 15089 this.activate(event, this.element.children(edge)); 15090 return; 15091 } 15092 var next = this.active[direction + "All"](".ui-menu-item").eq(0); 15093 if (next.length) { 15094 this.activate(event, next); 15095 } else { 15096 this.activate(event, this.element.children(edge)); 15097 } 15098 }, 15099 15100 // TODO merge with previousPage 15101 nextPage: function(event) { 15102 if (this.hasScroll()) { 15103 // TODO merge with no-scroll-else 15104 if (!this.active || this.last()) { 15105 this.activate(event, this.element.children(".ui-menu-item:first")); 15106 return; 15107 } 15108 var base = this.active.offset().top, 15109 height = this.element.height(), 15110 result = this.element.children(".ui-menu-item").filter(function() { 15111 var close = $(this).offset().top - base - height + $(this).height(); 15112 // TODO improve approximation 15113 return close < 10 && close > -10; 15114 }); 15115 15116 // TODO try to catch this earlier when scrollTop indicates the last page anyway 15117 if (!result.length) { 15118 result = this.element.children(".ui-menu-item:last"); 15119 } 15120 this.activate(event, result); 15121 } else { 15122 this.activate(event, this.element.children(".ui-menu-item") 15123 .filter(!this.active || this.last() ? ":first" : ":last")); 15124 } 15125 }, 15126 15127 // TODO merge with nextPage 15128 previousPage: function(event) { 15129 if (this.hasScroll()) { 15130 // TODO merge with no-scroll-else 15131 if (!this.active || this.first()) { 15132 this.activate(event, this.element.children(".ui-menu-item:last")); 15133 return; 15134 } 15135 15136 var base = this.active.offset().top, 15137 height = this.element.height(); 15138 result = this.element.children(".ui-menu-item").filter(function() { 15139 var close = $(this).offset().top - base + height - $(this).height(); 15140 // TODO improve approximation 15141 return close < 10 && close > -10; 15142 }); 15143 15144 // TODO try to catch this earlier when scrollTop indicates the last page anyway 15145 if (!result.length) { 15146 result = this.element.children(".ui-menu-item:first"); 15147 } 15148 this.activate(event, result); 15149 } else { 15150 this.activate(event, this.element.children(".ui-menu-item") 15151 .filter(!this.active || this.first() ? ":last" : ":first")); 15152 } 15153 }, 15154 15155 hasScroll: function() { 15156 return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight"); 15157 }, 15158 15159 select: function( event ) { 15160 this._trigger("selected", event, { item: this.active }); 15161 } 15162}); 15163 15164}(jQuery)); 15165/* 15166 * jQuery UI Button 1.8.16 15167 * 15168 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 15169 * Dual licensed under the MIT or GPL Version 2 licenses. 15170 * http://jquery.org/license 15171 * 15172 * http://docs.jquery.com/UI/Button 15173 * 15174 * Depends: 15175 * jquery.ui.core.js 15176 * jquery.ui.widget.js 15177 */ 15178(function( $, undefined ) { 15179 15180var lastActive, startXPos, startYPos, clickDragged, 15181 baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", 15182 stateClasses = "ui-state-hover ui-state-active ", 15183 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", 15184 formResetHandler = function() { 15185 var buttons = $( this ).find( ":ui-button" ); 15186 setTimeout(function() { 15187 buttons.button( "refresh" ); 15188 }, 1 ); 15189 }, 15190 radioGroup = function( radio ) { 15191 var name = radio.name, 15192 form = radio.form, 15193 radios = $( [] ); 15194 if ( name ) { 15195 if ( form ) { 15196 radios = $( form ).find( "[name='" + name + "']" ); 15197 } else { 15198 radios = $( "[name='" + name + "']", radio.ownerDocument ) 15199 .filter(function() { 15200 return !this.form; 15201 }); 15202 } 15203 } 15204 return radios; 15205 }; 15206 15207$.widget( "ui.button", { 15208 options: { 15209 disabled: null, 15210 text: true, 15211 label: null, 15212 icons: { 15213 primary: null, 15214 secondary: null 15215 } 15216 }, 15217 _create: function() { 15218 this.element.closest( "form" ) 15219 .unbind( "reset.button" ) 15220 .bind( "reset.button", formResetHandler ); 15221 15222 if ( typeof this.options.disabled !== "boolean" ) { 15223 this.options.disabled = this.element.propAttr( "disabled" ); 15224 } 15225 15226 this._determineButtonType(); 15227 this.hasTitle = !!this.buttonElement.attr( "title" ); 15228 15229 var self = this, 15230 options = this.options, 15231 toggleButton = this.type === "checkbox" || this.type === "radio", 15232 hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), 15233 focusClass = "ui-state-focus"; 15234 15235 if ( options.label === null ) { 15236 options.label = this.buttonElement.html(); 15237 } 15238 15239 if ( this.element.is( ":disabled" ) ) { 15240 options.disabled = true; 15241 } 15242 15243 this.buttonElement 15244 .addClass( baseClasses ) 15245 .attr( "role", "button" ) 15246 .bind( "mouseenter.button", function() { 15247 if ( options.disabled ) { 15248 return; 15249 } 15250 $( this ).addClass( "ui-state-hover" ); 15251 if ( this === lastActive ) { 15252 $( this ).addClass( "ui-state-active" ); 15253 } 15254 }) 15255 .bind( "mouseleave.button", function() { 15256 if ( options.disabled ) { 15257 return; 15258 } 15259 $( this ).removeClass( hoverClass ); 15260 }) 15261 .bind( "click.button", function( event ) { 15262 if ( options.disabled ) { 15263 event.preventDefault(); 15264 event.stopImmediatePropagation(); 15265 } 15266 }); 15267 15268 this.element 15269 .bind( "focus.button", function() { 15270 // no need to check disabled, focus won't be triggered anyway 15271 self.buttonElement.addClass( focusClass ); 15272 }) 15273 .bind( "blur.button", function() { 15274 self.buttonElement.removeClass( focusClass ); 15275 }); 15276 15277 if ( toggleButton ) { 15278 this.element.bind( "change.button", function() { 15279 if ( clickDragged ) { 15280 return; 15281 } 15282 self.refresh(); 15283 }); 15284 // if mouse moves between mousedown and mouseup (drag) set clickDragged flag 15285 // prevents issue where button state changes but checkbox/radio checked state 15286 // does not in Firefox (see ticket #6970) 15287 this.buttonElement 15288 .bind( "mousedown.button", function( event ) { 15289 if ( options.disabled ) { 15290 return; 15291 } 15292 clickDragged = false;
15293 startXPos = event.pageX; 15294 startYPos = event.pageY; 15295 }) 15296 .bind( "mouseup.button", function( event ) { 15297 if ( options.disabled ) { 15298 return; 15299 } 15300 if ( startXPos !== event.pageX || startYPos !== event.pageY ) { 15301 clickDragged = true; 15302 } 15303 }); 15304 } 15305 15306 if ( this.type === "checkbox" ) { 15307 this.buttonElement.bind( "click.button", function() { 15308 if ( options.disabled || clickDragged ) { 15309 return false; 15310 } 15311 $( this ).toggleClass( "ui-state-active" ); 15312 self.buttonElement.attr( "aria-pressed", self.element[0].checked ); 15313 }); 15314 } else if ( this.type === "radio" ) { 15315 this.buttonElement.bind( "click.button", function() { 15316 if ( options.disabled || clickDragged ) { 15317 return false; 15318 } 15319 $( this ).addClass( "ui-state-active" ); 15320 self.buttonElement.attr( "aria-pressed", "true" ); 15321 15322 var radio = self.element[ 0 ]; 15323 radioGroup( radio ) 15324 .not( radio ) 15325 .map(function() { 15326 return $( this ).button( "widget" )[ 0 ]; 15327 }) 15328 .removeClass( "ui-state-active" ) 15329 .attr( "aria-pressed", "false" ); 15330 }); 15331 } else { 15332 this.buttonElement 15333 .bind( "mousedown.button", function() { 15334 if ( options.disabled ) { 15335 return false; 15336 } 15337 $( this ).addClass( "ui-state-active" ); 15338 lastActive = this; 15339 $( document ).one( "mouseup", function() { 15340 lastActive = null; 15341 }); 15342 }) 15343 .bind( "mouseup.button", function() { 15344 if ( options.disabled ) { 15345 return false; 15346 } 15347 $( this ).removeClass( "ui-state-active" ); 15348 }) 15349 .bind( "keydown.button", function(event) { 15350 if ( options.disabled ) { 15351 return false; 15352 } 15353 if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { 15354 $( this ).addClass( "ui-state-active" ); 15355 } 15356 }) 15357 .bind( "keyup.button", function() { 15358 $( this ).removeClass( "ui-state-active" ); 15359 }); 15360 15361 if ( this.buttonElement.is("a") ) { 15362 this.buttonElement.keyup(function(event) { 15363 if ( event.keyCode === $.ui.keyCode.SPACE ) { 15364 // TODO pass through original event correctly (just as 2nd argument doesn't work) 15365 $( this ).click(); 15366 } 15367 }); 15368 } 15369 } 15370 15371 // TODO: pull out $.Widget's handling for the disabled option into 15372 // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can 15373 // be overridden by individual plugins 15374 this._setOption( "disabled", options.disabled ); 15375 this._resetButton(); 15376 }, 15377 15378 _determineButtonType: function() { 15379 15380 if ( this.element.is(":checkbox") ) { 15381 this.type = "checkbox"; 15382 } else if ( this.element.is(":radio") ) { 15383 this.type = "radio"; 15384 } else if ( this.element.is("input") ) { 15385 this.type = "input"; 15386 } else { 15387 this.type = "button"; 15388 } 15389 15390 if ( this.type === "checkbox" || this.type === "radio" ) { 15391 // we don't search against the document in case the element 15392 // is disconnected from the DOM 15393 var ancestor = this.element.parents().filter(":last"), 15394 labelSelector = "label[for='" + this.element.attr("id") + "']"; 15395 this.buttonElement = ancestor.find( labelSelector ); 15396 if ( !this.buttonElement.length ) { 15397 ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); 15398 this.buttonElement = ancestor.filter( labelSelector ); 15399 if ( !this.buttonElement.length ) { 15400 this.buttonElement = ancestor.find( labelSelector ); 15401 } 15402 } 15403 this.element.addClass( "ui-helper-hidden-accessible" ); 15404 15405 var checked = this.element.is( ":checked" ); 15406 if ( checked ) { 15407 this.buttonElement.addClass( "ui-state-active" ); 15408 } 15409 this.buttonElement.attr( "aria-pressed", checked ); 15410 } else { 15411 this.buttonElement = this.element; 15412 } 15413 }, 15414 15415 widget: function() { 15416 return this.buttonElement; 15417 }, 15418 15419 destroy: function() { 15420 this.element 15421 .removeClass( "ui-helper-hidden-accessible" ); 15422 this.buttonElement 15423 .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) 15424 .removeAttr( "role" ) 15425 .removeAttr( "aria-pressed" ) 15426 .html( this.buttonElement.find(".ui-button-text").html() ); 15427 15428 if ( !this.hasTitle ) { 15429 this.buttonElement.removeAttr( "title" ); 15430 } 15431 15432 $.Widget.prototype.destroy.call( this ); 15433 }, 15434 15435 _setOption: function( key, value ) { 15436 $.Widget.prototype._setOption.apply( this, arguments ); 15437 if ( key === "disabled" ) { 15438 if ( value ) { 15439 this.element.propAttr( "disabled", true ); 15440 } else { 15441 this.element.propAttr( "disabled", false ); 15442 } 15443 return; 15444 } 15445 this._resetButton(); 15446 }, 15447 15448 refresh: function() { 15449 var isDisabled = this.element.is( ":disabled" ); 15450 if ( isDisabled !== this.options.disabled ) { 15451 this._setOption( "disabled", isDisabled ); 15452 } 15453 if ( this.type === "radio" ) { 15454 radioGroup( this.element[0] ).each(function() { 15455 if ( $( this ).is( ":checked" ) ) { 15456 $( this ).button( "widget" ) 15457 .addClass( "ui-state-active" ) 15458 .attr( "aria-pressed", "true" ); 15459 } else { 15460 $( this ).button( "widget" ) 15461 .removeClass( "ui-state-active" ) 15462 .attr( "aria-pressed", "false" ); 15463 } 15464 }); 15465 } else if ( this.type === "checkbox" ) { 15466 if ( this.element.is( ":checked" ) ) { 15467 this.buttonElement 15468 .addClass( "ui-state-active" ) 15469 .attr( "aria-pressed", "true" ); 15470 } else { 15471 this.buttonElement 15472 .removeClass( "ui-state-active" ) 15473 .attr( "aria-pressed", "false" ); 15474 } 15475 } 15476 }, 15477 15478 _resetButton: function() { 15479 if ( this.type === "input" ) { 15480 if ( this.options.label ) { 15481 this.element.val( this.options.label ); 15482 } 15483 return; 15484 } 15485 var buttonElement = this.buttonElement.removeClass( typeClasses ), 15486 buttonText = $( "<span></span>" ) 15487 .addClass( "ui-button-text" ) 15488 .html( this.options.label ) 15489 .appendTo( buttonElement.empty() ) 15490 .text(), 15491 icons = this.options.icons, 15492 multipleIcons = icons.primary && icons.secondary,
15493 buttonClasses = []; 15494 15495 if ( icons.primary || icons.secondary ) { 15496 if ( this.options.text ) { 15497 buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); 15498 } 15499 15500 if ( icons.primary ) { 15501 buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); 15502 } 15503 15504 if ( icons.secondary ) { 15505 buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); 15506 } 15507 15508 if ( !this.options.text ) { 15509 buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); 15510 15511 if ( !this.hasTitle ) { 15512 buttonElement.attr( "title", buttonText ); 15513 } 15514 } 15515 } else { 15516 buttonClasses.push( "ui-button-text-only" ); 15517 } 15518 buttonElement.addClass( buttonClasses.join( " " ) ); 15519 } 15520}); 15521 15522$.widget( "ui.buttonset", { 15523 options: { 15524 items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" 15525 }, 15526 15527 _create: function() { 15528 this.element.addClass( "ui-buttonset" ); 15529 }, 15530 15531 _init: function() { 15532 this.refresh(); 15533 }, 15534 15535 _setOption: function( key, value ) { 15536 if ( key === "disabled" ) { 15537 this.buttons.button( "option", key, value ); 15538 } 15539 15540 $.Widget.prototype._setOption.apply( this, arguments ); 15541 }, 15542 15543 refresh: function() { 15544 var ltr = this.element.css( "direction" ) === "ltr"; 15545 15546 this.buttons = this.element.find( this.options.items ) 15547 .filter( ":ui-button" ) 15548 .button( "refresh" ) 15549 .end() 15550 .not( ":ui-button" ) 15551 .button() 15552 .end() 15553 .map(function() { 15554 return $( this ).button( "widget" )[ 0 ]; 15555 }) 15556 .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) 15557 .filter( ":first" ) 15558 .addClass( ltr ? "ui-corner-left" : "ui-corner-right" ) 15559 .end() 15560 .filter( ":last" ) 15561 .addClass( ltr ? "ui-corner-right" : "ui-corner-left" ) 15562 .end() 15563 .end(); 15564 }, 15565 15566 destroy: function() { 15567 this.element.removeClass( "ui-buttonset" ); 15568 this.buttons 15569 .map(function() { 15570 return $( this ).button( "widget" )[ 0 ]; 15571 }) 15572 .removeClass( "ui-corner-left ui-corner-right" ) 15573 .end() 15574 .button( "destroy" ); 15575 15576 $.Widget.prototype.destroy.call( this ); 15577 } 15578}); 15579 15580}( jQuery ) ); 15581/* 15582 * jQuery UI Dialog 1.8.16 15583 * 15584 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 15585 * Dual licensed under the MIT or GPL Version 2 licenses. 15586 * http://jquery.org/license 15587 * 15588 * http://docs.jquery.com/UI/Dialog 15589 * 15590 * Depends: 15591 * jquery.ui.core.js 15592 * jquery.ui.widget.js 15593 * jquery.ui.button.js 15594 * jquery.ui.draggable.js 15595 * jquery.ui.mouse.js 15596 * jquery.ui.position.js 15597 * jquery.ui.resizable.js 15598 */ 15599(function( $, undefined ) { 15600 15601var uiDialogClasses = 15602 'ui-dialog ' + 15603 'ui-widget ' + 15604 'ui-widget-content ' + 15605 'ui-corner-all ', 15606 sizeRelatedOptions = { 15607 buttons: true, 15608 height: true, 15609 maxHeight: true, 15610 maxWidth: true, 15611 minHeight: true, 15612 minWidth: true, 15613 width: true 15614 }, 15615 resizableRelatedOptions = { 15616 maxHeight: true, 15617 maxWidth: true, 15618 minHeight: true, 15619 minWidth: true 15620 }, 15621 // support for jQuery 1.3.2 - handle common attrFn methods for dialog 15622 attrFn = $.attrFn || { 15623 val: true, 15624 css: true, 15625 html: true, 15626 text: true, 15627 data: true, 15628 width: true, 15629 height: true, 15630 offset: true, 15631 click: true 15632 }; 15633 15634$.widget("ui.dialog", { 15635 options: { 15636 autoOpen: true, 15637 buttons: {}, 15638 closeOnEscape: true, 15639 closeText: 'close', 15640 dialogClass: '', 15641 draggable: true, 15642 hide: null, 15643 height: 'auto', 15644 maxHeight: false, 15645 maxWidth: false, 15646 minHeight: 150, 15647 minWidth: 150, 15648 modal: false, 15649 position: { 15650 my: 'center', 15651 at: 'center', 15652 collision: 'fit', 15653 // ensure that the titlebar is never outside the document 15654 using: function(pos) { 15655 var topOffset = $(this).css(pos).offset().top; 15656 if (topOffset < 0) { 15657 $(this).css('top', pos.top - topOffset); 15658 } 15659 } 15660 }, 15661 resizable: true, 15662 show: null, 15663 stack: true, 15664 title: '', 15665 width: 300, 15666 zIndex: 1000 15667 }, 15668 15669 _create: function() { 15670 this.originalTitle = this.element.attr('title'); 15671 // #5742 - .attr() might return a DOMElement 15672 if ( typeof this.originalTitle !== "string" ) { 15673 this.originalTitle = ""; 15674 } 15675 15676 this.options.title = this.options.title || this.originalTitle; 15677 var self = this, 15678 options = self.options, 15679 15680 title = options.title || ' ', 15681 titleId = $.ui.dialog.getTitleId(self.element), 15682 15683 uiDialog = (self.uiDialog = $('<div></div>')) 15684 .appendTo(document.body) 15685 .hide() 15686 .addClass(uiDialogClasses + options.dialogClass) 15687 .css({ 15688 zIndex: options.zIndex 15689 }) 15690 // setting tabIndex makes the div focusable 15691 // setting outline to 0 prevents a border on focus in Mozilla 15692 .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { 15693 if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 15694 event.keyCode === $.ui.keyCode.ESCAPE) { 15695 15696 self.close(event); 15697 event.preventDefault(); 15698 } 15699 }) 15700 .attr({ 15701 role: 'dialog', 15702 'aria-labelledby': titleId 15703 }) 15704 .mousedown(function(event) { 15705 self.moveToTop(false, event); 15706 }), 15707 15708 uiDialogContent = self.element 15709 .show() 15710 .removeAttr('title') 15711 .addClass( 15712 'ui-dialog-content ' + 15713 'ui-widget-content') 15714 .appendTo(uiDialog), 15715 15716 uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>')) 15717 .addClass( 15718 'ui-dialog-titlebar ' + 15719 'ui-widget-header ' + 15720 'ui-corner-all ' + 15721 'ui-helper-clearfix' 15722 ) 15723 .prependTo(uiDialog), 15724 15725 uiDialogTitlebarClose = $('<a href="#"></a>') 15726 .addClass( 15727 'ui-dialog-titlebar-close ' + 15728 'ui-corner-all' 15729 ) 15730 .attr('role', 'button') 15731 .hover( 15732 function() { 15733 uiDialogTitlebarClose.addClass('ui-state-hover'); 15734 }, 15735 function() { 15736 uiDialogTitlebarClose.removeClass('ui-state-hover'); 15737 } 15738 ) 15739 .focus(function() { 15740 uiDialogTitlebarClose.addClass('ui-state-focus'); 15741 }) 15742 .blur(function() { 15743 uiDialogTitlebarClose.removeClass('ui-state-focus'); 15744 }) 15745 .click(function(event) { 15746 self.close(event); 15747 return false;
15748 }) 15749 .appendTo(uiDialogTitlebar), 15750 15751 uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>')) 15752 .addClass( 15753 'ui-icon ' + 15754 'ui-icon-closethick' 15755 ) 15756 .text(options.closeText) 15757 .appendTo(uiDialogTitlebarClose), 15758 15759 uiDialogTitle = $('<span></span>') 15760 .addClass('ui-dialog-title') 15761 .attr('id', titleId) 15762 .html(title) 15763 .prependTo(uiDialogTitlebar); 15764 15765 //handling of deprecated beforeclose (vs beforeClose) option 15766 //Ticket #4669 http://dev.jqueryui.com/ticket/4669 15767 //TODO: remove in 1.9pre 15768 if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { 15769 options.beforeClose = options.beforeclose; 15770 } 15771 15772 uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); 15773 15774 if (options.draggable && $.fn.draggable) { 15775 self._makeDraggable(); 15776 } 15777 if (options.resizable && $.fn.resizable) { 15778 self._makeResizable(); 15779 } 15780 15781 self._createButtons(options.buttons); 15782 self._isOpen = false; 15783 15784 if ($.fn.bgiframe) { 15785 uiDialog.bgiframe(); 15786 } 15787 }, 15788 15789 _init: function() { 15790 if ( this.options.autoOpen ) { 15791 this.open(); 15792 } 15793 }, 15794 15795 destroy: function() { 15796 var self = this; 15797 15798 if (self.overlay) { 15799 self.overlay.destroy(); 15800 } 15801 self.uiDialog.hide(); 15802 self.element 15803 .unbind('.dialog') 15804 .removeData('dialog') 15805 .removeClass('ui-dialog-content ui-widget-content') 15806 .hide().appendTo('body'); 15807 self.uiDialog.remove(); 15808 15809 if (self.originalTitle) { 15810 self.element.attr('title', self.originalTitle); 15811 } 15812 15813 return self; 15814 }, 15815 15816 widget: function() { 15817 return this.uiDialog; 15818 }, 15819 15820 close: function(event) { 15821 var self = this, 15822 maxZ, thisZ; 15823 15824 if (false === self._trigger('beforeClose', event)) { 15825 return; 15826 } 15827 15828 if (self.overlay) { 15829 self.overlay.destroy(); 15830 } 15831 self.uiDialog.unbind('keypress.ui-dialog'); 15832 15833 self._isOpen = false; 15834 15835 if (self.options.hide) { 15836 self.uiDialog.hide(self.options.hide, function() { 15837 self._trigger('close', event); 15838 }); 15839 } else { 15840 self.uiDialog.hide(); 15841 self._trigger('close', event); 15842 } 15843 15844 $.ui.dialog.overlay.resize(); 15845 15846 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 15847 if (self.options.modal) { 15848 maxZ = 0; 15849 $('.ui-dialog').each(function() { 15850 if (this !== self.uiDialog[0]) { 15851 thisZ = $(this).css('z-index'); 15852 if(!isNaN(thisZ)) { 15853 maxZ = Math.max(maxZ, thisZ); 15854 } 15855 } 15856 }); 15857 $.ui.dialog.maxZ = maxZ; 15858 } 15859 15860 return self; 15861 }, 15862 15863 isOpen: function() { 15864 return this._isOpen; 15865 }, 15866 15867 // the force parameter allows us to move modal dialogs to their correct 15868 // position on open 15869 moveToTop: function(force, event) { 15870 var self = this, 15871 options = self.options, 15872 saveScroll; 15873 15874 if ((options.modal && !force) || 15875 (!options.stack && !options.modal)) { 15876 return self._trigger('focus', event); 15877 } 15878 15879 if (options.zIndex > $.ui.dialog.maxZ) { 15880 $.ui.dialog.maxZ = options.zIndex; 15881 } 15882 if (self.overlay) { 15883 $.ui.dialog.maxZ += 1; 15884 self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); 15885 } 15886 15887 //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. 15888 // http://ui.jquery.com/bugs/ticket/3193 15889 saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() }; 15890 $.ui.dialog.maxZ += 1; 15891 self.uiDialog.css('z-index', $.ui.dialog.maxZ); 15892 self.element.attr(saveScroll); 15893 self._trigger('focus', event); 15894 15895 return self; 15896 }, 15897 15898 open: function() { 15899 if (this._isOpen) { return; } 15900 15901 var self = this, 15902 options = self.options, 15903 uiDialog = self.uiDialog; 15904 15905 self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; 15906 self._size(); 15907 self._position(options.position); 15908 uiDialog.show(options.show); 15909 self.moveToTop(true); 15910 15911 // prevent tabbing out of modal dialogs 15912 if (options.modal) { 15913 uiDialog.bind('keypress.ui-dialog', function(event) { 15914 if (event.keyCode !== $.ui.keyCode.TAB) { 15915 return; 15916 } 15917 15918 var tabbables = $(':tabbable', this), 15919 first = tabbables.filter(':first'), 15920 last = tabbables.filter(':last'); 15921 15922 if (event.target === last[0] && !event.shiftKey) { 15923 first.focus(1); 15924 return false;
15925 } else if (event.target === first[0] && event.shiftKey) { 15926 last.focus(1); 15927 return false; 15928 } 15929 }); 15930 } 15931 15932 // set focus to the first tabbable element in the content area or the first button 15933 // if there are no tabbable elements, set focus on the dialog itself 15934 $(self.element.find(':tabbable').get().concat( 15935 uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( 15936 uiDialog.get()))).eq(0).focus(); 15937 15938 self._isOpen = true; 15939 self._trigger('open'); 15940 15941 return self; 15942 }, 15943 15944 _createButtons: function(buttons) { 15945 var self = this, 15946 hasButtons = false, 15947 uiDialogButtonPane = $('<div></div>') 15948 .addClass( 15949 'ui-dialog-buttonpane ' + 15950 'ui-widget-content ' + 15951 'ui-helper-clearfix' 15952 ), 15953 uiButtonSet = $( "<div></div>" ) 15954 .addClass( "ui-dialog-buttonset" ) 15955 .appendTo( uiDialogButtonPane ); 15956 15957 // if we already have a button pane, remove it 15958 self.uiDialog.find('.ui-dialog-buttonpane').remove(); 15959 15960 if (typeof buttons === 'object' && buttons !== null) { 15961 $.each(buttons, function() { 15962 return !(hasButtons = true); 15963 }); 15964 } 15965 if (hasButtons) { 15966 $.each(buttons, function(name, props) { 15967 props = $.isFunction( props ) ? 15968 { click: props, text: name } : 15969 props; 15970 var button = $('<button type="button"></button>') 15971 .click(function() { 15972 props.click.apply(self.element[0], arguments); 15973 }) 15974 .appendTo(uiButtonSet); 15975 // can't use .attr( props, true ) with jQuery 1.3.2. 15976 $.each( props, function( key, value ) { 15977 if ( key === "click" ) { 15978 return; 15979 } 15980 if ( key in attrFn ) { 15981 button[ key ]( value ); 15982 } else { 15983 button.attr( key, value ); 15984 } 15985 }); 15986 if ($.fn.button) { 15987 button.button(); 15988 } 15989 }); 15990 uiDialogButtonPane.appendTo(self.uiDialog); 15991 } 15992 }, 15993 15994 _makeDraggable: function() { 15995 var self = this, 15996 options = self.options, 15997 doc = $(document), 15998 heightBeforeDrag; 15999 16000 function filteredUi(ui) { 16001 return { 16002 position: ui.position, 16003 offset: ui.offset 16004 }; 16005 } 16006 16007 self.uiDialog.draggable({ 16008 cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', 16009 handle: '.ui-dialog-titlebar', 16010 containment: 'document', 16011 start: function(event, ui) { 16012 heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); 16013 $(this).height($(this).height()).addClass("ui-dialog-dragging"); 16014 self._trigger('dragStart', event, filteredUi(ui)); 16015 }, 16016 drag: function(event, ui) { 16017 self._trigger('drag', event, filteredUi(ui)); 16018 }, 16019 stop: function(event, ui) { 16020 options.position = [ui.position.left - doc.scrollLeft(), 16021 ui.position.top - doc.scrollTop()]; 16022 $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); 16023 self._trigger('dragStop', event, filteredUi(ui)); 16024 $.ui.dialog.overlay.resize(); 16025 } 16026 }); 16027 }, 16028 16029 _makeResizable: function(handles) { 16030 handles = (handles === undefined ? this.options.resizable : handles); 16031 var self = this, 16032 options = self.options, 16033 // .ui-resizable has position: relative defined in the stylesheet 16034 // but dialogs have to use absolute or fixed positioning 16035 position = self.uiDialog.css('position'), 16036 resizeHandles = (typeof handles === 'string' ? 16037 handles : 16038 'n,e,s,w,se,sw,ne,nw' 16039 ); 16040 16041 function filteredUi(ui) { 16042 return { 16043 originalPosition: ui.originalPosition, 16044 originalSize: ui.originalSize, 16045 position: ui.position, 16046 size: ui.size 16047 }; 16048 } 16049 16050 self.uiDialog.resizable({ 16051 cancel: '.ui-dialog-content', 16052 containment: 'document', 16053 alsoResize: self.element, 16054 maxWidth: options.maxWidth, 16055 maxHeight: options.maxHeight, 16056 minWidth: options.minWidth, 16057 minHeight: self._minHeight(), 16058 handles: resizeHandles, 16059 start: function(event, ui) { 16060 $(this).addClass("ui-dialog-resizing"); 16061 self._trigger('resizeStart', event, filteredUi(ui)); 16062 }, 16063 resize: function(event, ui) { 16064 self._trigger('resize', event, filteredUi(ui)); 16065 }, 16066 stop: function(event, ui) { 16067 $(this).removeClass("ui-dialog-resizing"); 16068 options.height = $(this).height(); 16069 options.width = $(this).width(); 16070 self._trigger('resizeStop', event, filteredUi(ui)); 16071 $.ui.dialog.overlay.resize(); 16072 } 16073 }) 16074 .css('position', position) 16075 .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); 16076 }, 16077 16078 _minHeight: function() { 16079 var options = this.options; 16080 16081 if (options.height === 'auto') { 16082 return options.minHeight; 16083 } else { 16084 return Math.min(options.minHeight, options.height); 16085 } 16086 }, 16087 16088 _position: function(position) { 16089 var myAt = [], 16090 offset = [0, 0], 16091 isVisible; 16092 16093 if (position) { 16094 // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( 16095 // if (typeof position == 'string' || $.isArray(position)) { 16096 // myAt = $.isArray(position) ? position : position.split(' '); 16097 16098 if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { 16099 myAt = position.split ? position.split(' ') : [position[0], position[1]]; 16100 if (myAt.length === 1) { 16101 myAt[1] = myAt[0]; 16102 } 16103 16104 $.each(['left', 'top'], function(i, offsetPosition) { 16105 if (+myAt[i] === myAt[i]) { 16106 offset[i] = myAt[i]; 16107 myAt[i] = offsetPosition; 16108 } 16109 }); 16110 16111 position = { 16112 my: myAt.join(" "), 16113 at: myAt.join(" "),
16114 offset: offset.join(" ") 16115 }; 16116 } 16117 16118 position = $.extend({}, $.ui.dialog.prototype.options.position, position); 16119 } else { 16120 position = $.ui.dialog.prototype.options.position; 16121 } 16122 16123 // need to show the dialog to get the actual offset in the position plugin 16124 isVisible = this.uiDialog.is(':visible'); 16125 if (!isVisible) { 16126 this.uiDialog.show(); 16127 } 16128 this.uiDialog 16129 // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 16130 .css({ top: 0, left: 0 }) 16131 .position($.extend({ of: window }, position)); 16132 if (!isVisible) { 16133 this.uiDialog.hide(); 16134 } 16135 }, 16136 16137 _setOptions: function( options ) { 16138 var self = this, 16139 resizableOptions = {}, 16140 resize = false; 16141 16142 $.each( options, function( key, value ) { 16143 self._setOption( key, value ); 16144 16145 if ( key in sizeRelatedOptions ) { 16146 resize = true; 16147 } 16148 if ( key in resizableRelatedOptions ) { 16149 resizableOptions[ key ] = value; 16150 } 16151 }); 16152 16153 if ( resize ) { 16154 this._size(); 16155 } 16156 if ( this.uiDialog.is( ":data(resizable)" ) ) { 16157 this.uiDialog.resizable( "option", resizableOptions ); 16158 } 16159 }, 16160 16161 _setOption: function(key, value){ 16162 var self = this, 16163 uiDialog = self.uiDialog; 16164 16165 switch (key) { 16166 //handling of deprecated beforeclose (vs beforeClose) option 16167 //Ticket #4669 http://dev.jqueryui.com/ticket/4669 16168 //TODO: remove in 1.9pre 16169 case "beforeclose": 16170 key = "beforeClose"; 16171 break; 16172 case "buttons": 16173 self._createButtons(value); 16174 break; 16175 case "closeText": 16176 // ensure that we always pass a string 16177 self.uiDialogTitlebarCloseText.text("" + value); 16178 break; 16179 case "dialogClass": 16180 uiDialog 16181 .removeClass(self.options.dialogClass) 16182 .addClass(uiDialogClasses + value); 16183 break; 16184 case "disabled": 16185 if (value) { 16186 uiDialog.addClass('ui-dialog-disabled'); 16187 } else { 16188 uiDialog.removeClass('ui-dialog-disabled'); 16189 } 16190 break; 16191 case "draggable": 16192 var isDraggable = uiDialog.is( ":data(draggable)" ); 16193 if ( isDraggable && !value ) { 16194 uiDialog.draggable( "destroy" ); 16195 } 16196 16197 if ( !isDraggable && value ) { 16198 self._makeDraggable(); 16199 } 16200 break; 16201 case "position": 16202 self._position(value); 16203 break; 16204 case "resizable": 16205 // currently resizable, becoming non-resizable 16206 var isResizable = uiDialog.is( ":data(resizable)" ); 16207 if (isResizable && !value) { 16208 uiDialog.resizable('destroy'); 16209 } 16210 16211 // currently resizable, changing handles 16212 if (isResizable && typeof value === 'string') { 16213 uiDialog.resizable('option', 'handles', value); 16214 } 16215 16216 // currently non-resizable, becoming resizable 16217 if (!isResizable && value !== false) { 16218 self._makeResizable(value); 16219 } 16220 break; 16221 case "title": 16222 // convert whatever was passed in o a string, for html() to not throw up 16223 $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); 16224 break; 16225 } 16226 16227 $.Widget.prototype._setOption.apply(self, arguments); 16228 }, 16229 16230 _size: function() { 16231 /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 16232 * divs will both have width and height set, so we need to reset them 16233 */ 16234 var options = this.options, 16235 nonContentHeight, 16236 minContentHeight, 16237 isVisible = this.uiDialog.is( ":visible" ); 16238 16239 // reset content sizing 16240 this.element.show().css({ 16241 width: 'auto', 16242 minHeight: 0, 16243 height: 0 16244 }); 16245 16246 if (options.minWidth > options.width) { 16247 options.width = options.minWidth; 16248 } 16249 16250 // reset wrapper sizing 16251 // determine the height of all the non-content elements 16252 nonContentHeight = this.uiDialog.css({ 16253 height: 'auto', 16254 width: options.width 16255 }) 16256 .height(); 16257 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 16258 16259 if ( options.height === "auto" ) { 16260 // only needed for IE6 support 16261 if ( $.support.minHeight ) { 16262 this.element.css({ 16263 minHeight: minContentHeight, 16264 height: "auto" 16265 }); 16266 } else { 16267 this.uiDialog.show(); 16268 var autoHeight = this.element.css( "height", "auto" ).height(); 16269 if ( !isVisible ) { 16270 this.uiDialog.hide(); 16271 } 16272 this.element.height( Math.max( autoHeight, minContentHeight ) ); 16273 } 16274 } else { 16275 this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); 16276 } 16277 16278 if (this.uiDialog.is(':data(resizable)')) { 16279 this.uiDialog.resizable('option', 'minHeight', this._minHeight()); 16280 } 16281 } 16282}); 16283 16284$.extend($.ui.dialog, { 16285 version: "1.8.16", 16286 16287 uuid: 0, 16288 maxZ: 0, 16289 16290 getTitleId: function($el) { 16291 var id = $el.attr('id'); 16292 if (!id) { 16293 this.uuid += 1; 16294 id = this.uuid; 16295 } 16296 return 'ui-dialog-title-' + id; 16297 }, 16298 16299 overlay: function(dialog) { 16300 this.$el = $.ui.dialog.overlay.create(dialog); 16301 } 16302}); 16303 16304$.extend($.ui.dialog.overlay, { 16305 instances: [], 16306 // reuse old instances due to IE memory leak with alpha transparency (see #5185) 16307 oldInstances: [], 16308 maxZ: 0, 16309 events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), 16310 function(event) { return event + '.dialog-overlay'; }).join(' '), 16311 create: function(dialog) { 16312 if (this.instances.length === 0) { 16313 // prevent use of anchors and inputs 16314 // we use a setTimeout in case the overlay is created from an 16315 // event that we're going to be cancelling (see #2804) 16316 setTimeout(function() { 16317 // handle $(el).dialog().dialog('close') (see #4065) 16318 if ($.ui.dialog.overlay.instances.length) { 16319 $(document).bind($.ui.dialog.overlay.events, function(event) { 16320 // stop events if the z-index of the target is < the z-index of the overlay 16321 // we cannot return true when we don't want to cancel the event (#3523) 16322 if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { 16323 return false;
16324 } 16325 }); 16326 } 16327 }, 1); 16328 16329 // allow closing by pressing the escape key 16330 $(document).bind('keydown.dialog-overlay', function(event) { 16331 if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 16332 event.keyCode === $.ui.keyCode.ESCAPE) { 16333 16334 dialog.close(event); 16335 event.preventDefault(); 16336 } 16337 }); 16338 16339 // handle window resize 16340 $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); 16341 } 16342 16343 var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay')) 16344 .appendTo(document.body) 16345 .css({ 16346 width: this.width(), 16347 height: this.height() 16348 }); 16349 16350 if ($.fn.bgiframe) { 16351 $el.bgiframe(); 16352 } 16353 16354 this.instances.push($el); 16355 return $el; 16356 }, 16357 16358 destroy: function($el) { 16359 var indexOf = $.inArray($el, this.instances); 16360 if (indexOf != -1){ 16361 this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); 16362 } 16363 16364 if (this.instances.length === 0) { 16365 $([document, window]).unbind('.dialog-overlay'); 16366 } 16367 16368 $el.remove(); 16369 16370 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 16371 var maxZ = 0; 16372 $.each(this.instances, function() { 16373 maxZ = Math.max(maxZ, this.css('z-index')); 16374 }); 16375 this.maxZ = maxZ; 16376 }, 16377 16378 height: function() { 16379 var scrollHeight, 16380 offsetHeight; 16381 // handle IE 6 16382 if ($.browser.msie && $.browser.version < 7) { 16383 scrollHeight = Math.max( 16384 document.documentElement.scrollHeight, 16385 document.body.scrollHeight 16386 ); 16387 offsetHeight = Math.max( 16388 document.documentElement.offsetHeight, 16389 document.body.offsetHeight 16390 ); 16391 16392 if (scrollHeight < offsetHeight) { 16393 return $(window).height() + 'px'; 16394 } else { 16395 return scrollHeight + 'px'; 16396 } 16397 // handle "good" browsers 16398 } else { 16399 return $(document).height() + 'px'; 16400 } 16401 }, 16402 16403 width: function() { 16404 var scrollWidth, 16405 offsetWidth; 16406 // handle IE 16407 if ( $.browser.msie ) { 16408 scrollWidth = Math.max( 16409 document.documentElement.scrollWidth, 16410 document.body.scrollWidth 16411 ); 16412 offsetWidth = Math.max( 16413 document.documentElement.offsetWidth, 16414 document.body.offsetWidth 16415 ); 16416 16417 if (scrollWidth < offsetWidth) { 16418 return $(window).width() + 'px'; 16419 } else { 16420 return scrollWidth + 'px'; 16421 } 16422 // handle "good" browsers 16423 } else { 16424 return $(document).width() + 'px'; 16425 } 16426 }, 16427 16428 resize: function() { 16429 /* If the dialog is draggable and the user drags it past the 16430 * right edge of the window, the document becomes wider so we 16431 * need to stretch the overlay. If the user then drags the 16432 * dialog back to the left, the document will become narrower, 16433 * so we need to shrink the overlay to the appropriate size. 16434 * This is handled by shrinking the overlay before setting it 16435 * to the full document size. 16436 */ 16437 var $overlays = $([]); 16438 $.each($.ui.dialog.overlay.instances, function() { 16439 $overlays = $overlays.add(this); 16440 }); 16441 16442 $overlays.css({ 16443 width: 0, 16444 height: 0 16445 }).css({ 16446 width: $.ui.dialog.overlay.width(), 16447 height: $.ui.dialog.overlay.height() 16448 }); 16449 } 16450}); 16451 16452$.extend($.ui.dialog.overlay.prototype, { 16453 destroy: function() { 16454 $.ui.dialog.overlay.destroy(this.$el); 16455 } 16456}); 16457 16458}(jQuery)); 16459/* 16460 * jQuery UI Slider 1.8.16 16461 * 16462 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 16463 * Dual licensed under the MIT or GPL Version 2 licenses. 16464 * http://jquery.org/license 16465 * 16466 * http://docs.jquery.com/UI/Slider 16467 * 16468 * Depends: 16469 * jquery.ui.core.js 16470 * jquery.ui.mouse.js 16471 * jquery.ui.widget.js 16472 */ 16473(function( $, undefined ) { 16474 16475// number of pages in a slider 16476// (how many times can you page up/down to go through the whole range) 16477var numPages = 5; 16478 16479$.widget( "ui.slider", $.ui.mouse, { 16480 16481 widgetEventPrefix: "slide", 16482 16483 options: { 16484 animate: false, 16485 distance: 0, 16486 max: 100, 16487 min: 0, 16488 orientation: "horizontal", 16489 range: false, 16490 step: 1, 16491 value: 0, 16492 values: null 16493 }, 16494 16495 _create: function() { 16496 var self = this, 16497 o = this.options, 16498 existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), 16499 handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", 16500 handleCount = ( o.values && o.values.length ) || 1, 16501 handles = []; 16502 16503 this._keySliding = false;
16504 this._mouseSliding = false; 16505 this._animateOff = true; 16506 this._handleIndex = null; 16507 this._detectOrientation(); 16508 this._mouseInit(); 16509 16510 this.element 16511 .addClass( "ui-slider" + 16512 " ui-slider-" + this.orientation + 16513 " ui-widget" + 16514 " ui-widget-content" + 16515 " ui-corner-all" + 16516 ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); 16517 16518 this.range = $([]); 16519 16520 if ( o.range ) { 16521 if ( o.range === true ) { 16522 if ( !o.values ) { 16523 o.values = [ this._valueMin(), this._valueMin() ]; 16524 } 16525 if ( o.values.length && o.values.length !== 2 ) { 16526 o.values = [ o.values[0], o.values[0] ]; 16527 } 16528 } 16529 16530 this.range = $( "<div></div>" ) 16531 .appendTo( this.element ) 16532 .addClass( "ui-slider-range" + 16533 // note: this isn't the most fittingly semantic framework class for this element, 16534 // but worked best visually with a variety of themes 16535 " ui-widget-header" + 16536 ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); 16537 } 16538 16539 for ( var i = existingHandles.length; i < handleCount; i += 1 ) { 16540 handles.push( handle ); 16541 } 16542 16543 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) ); 16544 16545 this.handle = this.handles.eq( 0 ); 16546 16547 this.handles.add( this.range ).filter( "a" ) 16548 .click(function( event ) { 16549 event.preventDefault(); 16550 }) 16551 .hover(function() { 16552 if ( !o.disabled ) { 16553 $( this ).addClass( "ui-state-hover" ); 16554 } 16555 }, function() { 16556 $( this ).removeClass( "ui-state-hover" ); 16557 }) 16558 .focus(function() { 16559 if ( !o.disabled ) { 16560 $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); 16561 $( this ).addClass( "ui-state-focus" ); 16562 } else { 16563 $( this ).blur(); 16564 } 16565 }) 16566 .blur(function() { 16567 $( this ).removeClass( "ui-state-focus" ); 16568 }); 16569 16570 this.handles.each(function( i ) { 16571 $( this ).data( "index.ui-slider-handle", i ); 16572 }); 16573 16574 this.handles 16575 .keydown(function( event ) { 16576 var ret = true, 16577 index = $( this ).data( "index.ui-slider-handle" ), 16578 allowed, 16579 curVal, 16580 newVal, 16581 step; 16582 16583 if ( self.options.disabled ) { 16584 return; 16585 } 16586 16587 switch ( event.keyCode ) { 16588 case $.ui.keyCode.HOME: 16589 case $.ui.keyCode.END: 16590 case $.ui.keyCode.PAGE_UP: 16591 case $.ui.keyCode.PAGE_DOWN: 16592 case $.ui.keyCode.UP: 16593 case $.ui.keyCode.RIGHT: 16594 case $.ui.keyCode.DOWN: 16595 case $.ui.keyCode.LEFT: 16596 ret = false;
16597 if ( !self._keySliding ) { 16598 self._keySliding = true; 16599 $( this ).addClass( "ui-state-active" ); 16600 allowed = self._start( event, index ); 16601 if ( allowed === false ) { 16602 return; 16603 } 16604 } 16605 break; 16606 } 16607 16608 step = self.options.step; 16609 if ( self.options.values && self.options.values.length ) { 16610 curVal = newVal = self.values( index ); 16611 } else { 16612 curVal = newVal = self.value(); 16613 } 16614 16615 switch ( event.keyCode ) { 16616 case $.ui.keyCode.HOME: 16617 newVal = self._valueMin(); 16618 break; 16619 case $.ui.keyCode.END: 16620 newVal = self._valueMax(); 16621 break; 16622 case $.ui.keyCode.PAGE_UP: 16623 newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) ); 16624 break; 16625 case $.ui.keyCode.PAGE_DOWN: 16626 newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) ); 16627 break; 16628 case $.ui.keyCode.UP: 16629 case $.ui.keyCode.RIGHT: 16630 if ( curVal === self._valueMax() ) { 16631 return; 16632 } 16633 newVal = self._trimAlignValue( curVal + step ); 16634 break; 16635 case $.ui.keyCode.DOWN: 16636 case $.ui.keyCode.LEFT: 16637 if ( curVal === self._valueMin() ) { 16638 return; 16639 } 16640 newVal = self._trimAlignValue( curVal - step ); 16641 break; 16642 } 16643 16644 self._slide( event, index, newVal ); 16645 16646 return ret; 16647 16648 }) 16649 .keyup(function( event ) { 16650 var index = $( this ).data( "index.ui-slider-handle" ); 16651 16652 if ( self._keySliding ) { 16653 self._keySliding = false; 16654 self._stop( event, index ); 16655 self._change( event, index ); 16656 $( this ).removeClass( "ui-state-active" ); 16657 } 16658 16659 }); 16660 16661 this._refreshValue(); 16662 16663 this._animateOff = false; 16664 }, 16665 16666 destroy: function() { 16667 this.handles.remove(); 16668 this.range.remove(); 16669 16670 this.element 16671 .removeClass( "ui-slider" + 16672 " ui-slider-horizontal" + 16673 " ui-slider-vertical" + 16674 " ui-slider-disabled" + 16675 " ui-widget" + 16676 " ui-widget-content" + 16677 " ui-corner-all" ) 16678 .removeData( "slider" ) 16679 .unbind( ".slider" ); 16680 16681 this._mouseDestroy(); 16682 16683 return this; 16684 }, 16685 16686 _mouseCapture: function( event ) { 16687 var o = this.options, 16688 position, 16689 normValue, 16690 distance, 16691 closestHandle, 16692 self, 16693 index, 16694 allowed, 16695 offset, 16696 mouseOverHandle; 16697 16698 if ( o.disabled ) { 16699 return false; 16700 } 16701 16702 this.elementSize = { 16703 width: this.element.outerWidth(), 16704 height: this.element.outerHeight() 16705 }; 16706 this.elementOffset = this.element.offset(); 16707 16708 position = { x: event.pageX, y: event.pageY }; 16709 normValue = this._normValueFromMouse( position ); 16710 distance = this._valueMax() - this._valueMin() + 1; 16711 self = this; 16712 this.handles.each(function( i ) { 16713 var thisDistance = Math.abs( normValue - self.values(i) ); 16714 if ( distance > thisDistance ) { 16715 distance = thisDistance; 16716 closestHandle = $( this ); 16717 index = i; 16718 } 16719 }); 16720 16721 // workaround for bug #3736 (if both handles of a range are at 0, 16722 // the first is always used as the one with least distance, 16723 // and moving it is obviously prevented by preventing negative ranges) 16724 if( o.range === true && this.values(1) === o.min ) { 16725 index += 1; 16726 closestHandle = $( this.handles[index] ); 16727 } 16728 16729 allowed = this._start( event, index ); 16730 if ( allowed === false ) { 16731 return false; 16732 } 16733 this._mouseSliding = true; 16734 16735 self._handleIndex = index; 16736 16737 closestHandle 16738 .addClass( "ui-state-active" ) 16739 .focus(); 16740 16741 offset = closestHandle.offset(); 16742 mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); 16743 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 16744 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 16745 top: event.pageY - offset.top - 16746 ( closestHandle.height() / 2 ) - 16747 ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - 16748 ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + 16749 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) 16750 }; 16751 16752 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 16753 this._slide( event, index, normValue ); 16754 } 16755 this._animateOff = true; 16756 return true; 16757 }, 16758 16759 _mouseStart: function( event ) { 16760 return true; 16761 }, 16762 16763 _mouseDrag: function( event ) { 16764 var position = { x: event.pageX, y: event.pageY }, 16765 normValue = this._normValueFromMouse( position ); 16766 16767 this._slide( event, this._handleIndex, normValue ); 16768 16769 return false;
vendor: 10,250 bytes, lines 16770-17150
16770 }, 16771 16772 _mouseStop: function( event ) { 16773 this.handles.removeClass( "ui-state-active" ); 16774 this._mouseSliding = false; 16775 16776 this._stop( event, this._handleIndex ); 16777 this._change( event, this._handleIndex ); 16778 16779 this._handleIndex = null; 16780 this._clickOffset = null; 16781 this._animateOff = false; 16782 16783 return false; 16784 }, 16785 16786 _detectOrientation: function() { 16787 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 16788 }, 16789 16790 _normValueFromMouse: function( position ) { 16791 var pixelTotal, 16792 pixelMouse, 16793 percentMouse, 16794 valueTotal, 16795 valueMouse; 16796 16797 if ( this.orientation === "horizontal" ) { 16798 pixelTotal = this.elementSize.width; 16799 pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); 16800 } else { 16801 pixelTotal = this.elementSize.height; 16802 pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); 16803 } 16804 16805 percentMouse = ( pixelMouse / pixelTotal ); 16806 if ( percentMouse > 1 ) { 16807 percentMouse = 1; 16808 } 16809 if ( percentMouse < 0 ) { 16810 percentMouse = 0; 16811 } 16812 if ( this.orientation === "vertical" ) { 16813 percentMouse = 1 - percentMouse; 16814 } 16815 16816 valueTotal = this._valueMax() - this._valueMin(); 16817 valueMouse = this._valueMin() + percentMouse * valueTotal; 16818 16819 return this._trimAlignValue( valueMouse ); 16820 }, 16821 16822 _start: function( event, index ) { 16823 var uiHash = { 16824 handle: this.handles[ index ], 16825 value: this.value() 16826 }; 16827 if ( this.options.values && this.options.values.length ) { 16828 uiHash.value = this.values( index ); 16829 uiHash.values = this.values(); 16830 } 16831 return this._trigger( "start", event, uiHash ); 16832 }, 16833 16834 _slide: function( event, index, newVal ) { 16835 var otherVal, 16836 newValues, 16837 allowed; 16838 16839 if ( this.options.values && this.options.values.length ) { 16840 otherVal = this.values( index ? 0 : 1 ); 16841 16842 if ( ( this.options.values.length === 2 && this.options.range === true ) && 16843 ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) 16844 ) { 16845 newVal = otherVal; 16846 } 16847 16848 if ( newVal !== this.values( index ) ) { 16849 newValues = this.values(); 16850 newValues[ index ] = newVal; 16851 // A slide can be canceled by returning false from the slide callback 16852 allowed = this._trigger( "slide", event, { 16853 handle: this.handles[ index ], 16854 value: newVal, 16855 values: newValues 16856 } ); 16857 otherVal = this.values( index ? 0 : 1 ); 16858 if ( allowed !== false ) { 16859 this.values( index, newVal, true ); 16860 } 16861 } 16862 } else { 16863 if ( newVal !== this.value() ) { 16864 // A slide can be canceled by returning false from the slide callback 16865 allowed = this._trigger( "slide", event, { 16866 handle: this.handles[ index ], 16867 value: newVal 16868 } ); 16869 if ( allowed !== false ) { 16870 this.value( newVal ); 16871 } 16872 } 16873 } 16874 }, 16875 16876 _stop: function( event, index ) { 16877 var uiHash = { 16878 handle: this.handles[ index ], 16879 value: this.value() 16880 }; 16881 if ( this.options.values && this.options.values.length ) { 16882 uiHash.value = this.values( index ); 16883 uiHash.values = this.values(); 16884 } 16885 16886 this._trigger( "stop", event, uiHash ); 16887 }, 16888 16889 _change: function( event, index ) { 16890 if ( !this._keySliding && !this._mouseSliding ) { 16891 var uiHash = { 16892 handle: this.handles[ index ], 16893 value: this.value() 16894 }; 16895 if ( this.options.values && this.options.values.length ) { 16896 uiHash.value = this.values( index ); 16897 uiHash.values = this.values(); 16898 } 16899 16900 this._trigger( "change", event, uiHash ); 16901 } 16902 }, 16903 16904 value: function( newValue ) { 16905 if ( arguments.length ) { 16906 this.options.value = this._trimAlignValue( newValue ); 16907 this._refreshValue(); 16908 this._change( null, 0 ); 16909 return; 16910 } 16911 16912 return this._value(); 16913 }, 16914 16915 values: function( index, newValue ) { 16916 var vals, 16917 newValues, 16918 i; 16919 16920 if ( arguments.length > 1 ) { 16921 this.options.values[ index ] = this._trimAlignValue( newValue ); 16922 this._refreshValue(); 16923 this._change( null, index ); 16924 return; 16925 } 16926 16927 if ( arguments.length ) { 16928 if ( $.isArray( arguments[ 0 ] ) ) { 16929 vals = this.options.values; 16930 newValues = arguments[ 0 ]; 16931 for ( i = 0; i < vals.length; i += 1 ) { 16932 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 16933 this._change( null, i ); 16934 } 16935 this._refreshValue(); 16936 } else { 16937 if ( this.options.values && this.options.values.length ) { 16938 return this._values( index ); 16939 } else { 16940 return this.value(); 16941 } 16942 } 16943 } else { 16944 return this._values(); 16945 } 16946 }, 16947 16948 _setOption: function( key, value ) { 16949 var i, 16950 valsLength = 0; 16951 16952 if ( $.isArray( this.options.values ) ) { 16953 valsLength = this.options.values.length; 16954 } 16955 16956 $.Widget.prototype._setOption.apply( this, arguments ); 16957 16958 switch ( key ) { 16959 case "disabled": 16960 if ( value ) { 16961 this.handles.filter( ".ui-state-focus" ).blur(); 16962 this.handles.removeClass( "ui-state-hover" ); 16963 this.handles.propAttr( "disabled", true ); 16964 this.element.addClass( "ui-disabled" ); 16965 } else { 16966 this.handles.propAttr( "disabled", false ); 16967 this.element.removeClass( "ui-disabled" ); 16968 } 16969 break; 16970 case "orientation": 16971 this._detectOrientation(); 16972 this.element 16973 .removeClass( "ui-slider-horizontal ui-slider-vertical" ) 16974 .addClass( "ui-slider-" + this.orientation ); 16975 this._refreshValue(); 16976 break; 16977 case "value": 16978 this._animateOff = true; 16979 this._refreshValue(); 16980 this._change( null, 0 ); 16981 this._animateOff = false; 16982 break; 16983 case "values": 16984 this._animateOff = true; 16985 this._refreshValue(); 16986 for ( i = 0; i < valsLength; i += 1 ) { 16987 this._change( null, i ); 16988 } 16989 this._animateOff = false; 16990 break; 16991 } 16992 }, 16993 16994 //internal value getter 16995 // _value() returns value trimmed by min and max, aligned by step 16996 _value: function() { 16997 var val = this.options.value; 16998 val = this._trimAlignValue( val ); 16999 17000 return val; 17001 }, 17002 17003 //internal values getter 17004 // _values() returns array of values trimmed by min and max, aligned by step 17005 // _values( index ) returns single value trimmed by min and max, aligned by step 17006 _values: function( index ) { 17007 var val, 17008 vals, 17009 i; 17010 17011 if ( arguments.length ) { 17012 val = this.options.values[ index ]; 17013 val = this._trimAlignValue( val ); 17014 17015 return val; 17016 } else { 17017 // .slice() creates a copy of the array 17018 // this copy gets trimmed by min and max and then returned 17019 vals = this.options.values.slice(); 17020 for ( i = 0; i < vals.length; i+= 1) { 17021 vals[ i ] = this._trimAlignValue( vals[ i ] ); 17022 } 17023 17024 return vals; 17025 } 17026 }, 17027 17028 // returns the step-aligned value that val is closest to, between (inclusive) min and max 17029 _trimAlignValue: function( val ) { 17030 if ( val <= this._valueMin() ) { 17031 return this._valueMin(); 17032 } 17033 if ( val >= this._valueMax() ) { 17034 return this._valueMax(); 17035 } 17036 var step = ( this.options.step > 0 ) ? this.options.step : 1, 17037 valModStep = (val - this._valueMin()) % step, 17038 alignValue = val - valModStep; 17039 17040 if ( Math.abs(valModStep) * 2 >= step ) { 17041 alignValue += ( valModStep > 0 ) ? step : ( -step ); 17042 } 17043 17044 // Since JavaScript has problems with large floats, round 17045 // the final value to 5 digits after the decimal point (see #4124) 17046 return parseFloat( alignValue.toFixed(5) ); 17047 }, 17048 17049 _valueMin: function() { 17050 return this.options.min; 17051 }, 17052 17053 _valueMax: function() { 17054 return this.options.max; 17055 }, 17056 17057 _refreshValue: function() { 17058 var oRange = this.options.range, 17059 o = this.options, 17060 self = this, 17061 animate = ( !this._animateOff ) ? o.animate : false, 17062 valPercent, 17063 _set = {}, 17064 lastValPercent, 17065 value, 17066 valueMin, 17067 valueMax; 17068 17069 if ( this.options.values && this.options.values.length ) { 17070 this.handles.each(function( i, j ) { 17071 valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; 17072 _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 17073 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 17074 if ( self.options.range === true ) { 17075 if ( self.orientation === "horizontal" ) { 17076 if ( i === 0 ) { 17077 self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); 17078 } 17079 if ( i === 1 ) { 17080 self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 17081 } 17082 } else { 17083 if ( i === 0 ) { 17084 self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); 17085 } 17086 if ( i === 1 ) { 17087 self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); 17088 } 17089 } 17090 } 17091 lastValPercent = valPercent; 17092 }); 17093 } else { 17094 value = this.value(); 17095 valueMin = this._valueMin(); 17096 valueMax = this._valueMax(); 17097 valPercent = ( valueMax !== valueMin ) ? 17098 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 17099 0; 17100 _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 17101 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 17102 17103 if ( oRange === "min" && this.orientation === "horizontal" ) { 17104 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); 17105 } 17106 if ( oRange === "max" && this.orientation === "horizontal" ) { 17107 this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 17108 } 17109 if ( oRange === "min" && this.orientation === "vertical" ) { 17110 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); 17111 } 17112 if ( oRange === "max" && this.orientation === "vertical" ) { 17113 this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); 17114 } 17115 } 17116 } 17117 17118}); 17119 17120$.extend( $.ui.slider, { 17121 version: "1.8.16" 17122}); 17123 17124}(jQuery)); 17125/* 17126 * jQuery UI Tabs 1.8.16 17127 * 17128 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 17129 * Dual licensed under the MIT or GPL Version 2 licenses. 17130 * http://jquery.org/license 17131 * 17132 * http://docs.jquery.com/UI/Tabs 17133 * 17134 * Depends: 17135 * jquery.ui.core.js 17136 * jquery.ui.widget.js 17137 */ 17138(function( $, undefined ) { 17139 17140var tabId = 0, 17141 listId = 0; 17142 17143function getNextTabId() { 17144 return ++tabId; 17145} 17146 17147function getNextListId() { 17148 return ++listId; 17149} 17150
17151$.widget( "ui.tabs", { 17152 options: { 17153 add: null, 17154 ajaxOptions: null, 17155 cache: false, 17156 cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } 17157 collapsible: false, 17158 disable: null, 17159 disabled: [], 17160 enable: null, 17161 event: "click", 17162 fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } 17163 idPrefix: "ui-tabs-", 17164 load: null, 17165 panelTemplate: "<div></div>", 17166 remove: null, 17167 select: null, 17168 show: null, 17169 spinner: "<em>Loading…</em>", 17170 tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>" 17171 }, 17172 17173 _create: function() { 17174 this._tabify( true ); 17175 }, 17176 17177 _setOption: function( key, value ) { 17178 if ( key == "selected" ) { 17179 if (this.options.collapsible && value == this.options.selected ) { 17180 return; 17181 } 17182 this.select( value ); 17183 } else { 17184 this.options[ key ] = value; 17185 this._tabify(); 17186 } 17187 }, 17188 17189 _tabId: function( a ) { 17190 return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || 17191 this.options.idPrefix + getNextTabId(); 17192 }, 17193 17194 _sanitizeSelector: function( hash ) { 17195 // we need this because an id may contain a ":" 17196 return hash.replace( /:/g, "\\:" ); 17197 }, 17198 17199 _cookie: function() { 17200 var cookie = this.cookie || 17201 ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); 17202 return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); 17203 }, 17204 17205 _ui: function( tab, panel ) { 17206 return { 17207 tab: tab, 17208 panel: panel, 17209 index: this.anchors.index( tab ) 17210 }; 17211 }, 17212 17213 _cleanup: function() { 17214 // restore all former loading tabs labels 17215 this.lis.filter( ".ui-state-processing" ) 17216 .removeClass( "ui-state-processing" ) 17217 .find( "span:data(label.tabs)" ) 17218 .each(function() { 17219 var el = $( this ); 17220 el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); 17221 }); 17222 }, 17223 17224 _tabify: function( init ) { 17225 var self = this, 17226 o = this.options, 17227 fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash 17228 17229 this.list = this.element.find( "ol,ul" ).eq( 0 ); 17230 this.lis = $( " > li:has(a[href])", this.list ); 17231 this.anchors = this.lis.map(function() { 17232 return $( "a", this )[ 0 ]; 17233 }); 17234 this.panels = $( [] ); 17235 17236 this.anchors.each(function( i, a ) { 17237 var href = $( a ).attr( "href" ); 17238 // For dynamically created HTML that contains a hash as href IE < 8 expands 17239 // such href to the full page url with hash and then misinterprets tab as ajax. 17240 // Same consideration applies for an added tab with a fragment identifier 17241 // since a[href=#fragment-identifier] does unexpectedly not match. 17242 // Thus normalize href attribute... 17243 var hrefBase = href.split( "#" )[ 0 ], 17244 baseEl; 17245 if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || 17246 ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { 17247 href = a.hash; 17248 a.href = href; 17249 } 17250 17251 // inline tab 17252 if ( fragmentId.test( href ) ) { 17253 self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); 17254 // remote tab 17255 // prevent loading the page itself if href is just "#" 17256 } else if ( href && href !== "#" ) {
17257 // required for restore on destroy 17258 $.data( a, "href.tabs", href ); 17259 17260 // TODO until #3808 is fixed strip fragment identifier from url 17261 // (IE fails to load from such url) 17262 $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); 17263 17264 var id = self._tabId( a ); 17265 a.href = "#" + id; 17266 var $panel = self.element.find( "#" + id ); 17267 if ( !$panel.length ) { 17268 $panel = $( o.panelTemplate ) 17269 .attr( "id", id ) 17270 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 17271 .insertAfter( self.panels[ i - 1 ] || self.list ); 17272 $panel.data( "destroy.tabs", true ); 17273 } 17274 self.panels = self.panels.add( $panel ); 17275 // invalid tab href 17276 } else { 17277 o.disabled.push( i ); 17278 } 17279 }); 17280 17281 // initialization from scratch 17282 if ( init ) { 17283 // attach necessary classes for styling 17284 this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); 17285 this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); 17286 this.lis.addClass( "ui-state-default ui-corner-top" ); 17287 this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); 17288 17289 // Selected tab 17290 // use "selected" option or try to retrieve: 17291 // 1. from fragment identifier in url 17292 // 2. from cookie 17293 // 3. from selected class attribute on <li> 17294 if ( o.selected === undefined ) { 17295 if ( location.hash ) { 17296 this.anchors.each(function( i, a ) { 17297 if ( a.hash == location.hash ) { 17298 o.selected = i; 17299 return false; 17300 } 17301 }); 17302 } 17303 if ( typeof o.selected !== "number" && o.cookie ) { 17304 o.selected = parseInt( self._cookie(), 10 ); 17305 } 17306 if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { 17307 o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); 17308 } 17309 o.selected = o.selected || ( this.lis.length ? 0 : -1 ); 17310 } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release 17311 o.selected = -1; 17312 } 17313 17314 // sanity check - default to first tab... 17315 o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) 17316 ? o.selected 17317 : 0; 17318 17319 // Take disabling tabs via class attribute from HTML 17320 // into account and update option properly. 17321 // A selected tab cannot become disabled. 17322 o.disabled = $.unique( o.disabled.concat( 17323 $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { 17324 return self.lis.index( n ); 17325 }) 17326 ) ).sort(); 17327 17328 if ( $.inArray( o.selected, o.disabled ) != -1 ) { 17329 o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); 17330 } 17331 17332 // highlight selected tab 17333 this.panels.addClass( "ui-tabs-hide" ); 17334 this.lis.removeClass( "ui-tabs-selected ui-state-active" ); 17335 // check for length avoids error when initializing empty list 17336 if ( o.selected >= 0 && this.anchors.length ) { 17337 self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); 17338 this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); 17339 17340 // seems to be expected behavior that the show callback is fired 17341 self.element.queue( "tabs", function() { 17342 self._trigger( "show", null, 17343 self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); 17344 }); 17345 17346 this.load( o.selected ); 17347 } 17348 17349 // clean up to avoid memory leaks in certain versions of IE 6 17350 // TODO: namespace this event 17351 $( window ).bind( "unload", function() { 17352 self.lis.add( self.anchors ).unbind( ".tabs" ); 17353 self.lis = self.anchors = self.panels = null; 17354 }); 17355 // update selected after add/remove 17356 } else { 17357 o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); 17358 } 17359 17360 // update collapsible 17361 // TODO: use .toggleClass() 17362 this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); 17363 17364 // set or update cookie after init and add/remove respectively 17365 if ( o.cookie ) { 17366 this._cookie( o.selected, o.cookie ); 17367 } 17368 17369 // disable tabs 17370 for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { 17371 $( li )[ $.inArray( i, o.disabled ) != -1 && 17372 // TODO: use .toggleClass() 17373 !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); 17374 } 17375 17376 // reset cache if switching from cached to not cached 17377 if ( o.cache === false ) { 17378 this.anchors.removeData( "cache.tabs" ); 17379 } 17380 17381 // remove all handlers before, tabify may run on existing tabs after add or option change 17382 this.lis.add( this.anchors ).unbind( ".tabs" ); 17383 17384 if ( o.event !== "mouseover" ) { 17385 var addState = function( state, el ) { 17386 if ( el.is( ":not(.ui-state-disabled)" ) ) { 17387 el.addClass( "ui-state-" + state ); 17388 } 17389 }; 17390 var removeState = function( state, el ) { 17391 el.removeClass( "ui-state-" + state ); 17392 }; 17393 this.lis.bind( "mouseover.tabs" , function() { 17394 addState( "hover", $( this ) ); 17395 }); 17396 this.lis.bind( "mouseout.tabs", function() { 17397 removeState( "hover", $( this ) ); 17398 }); 17399 this.anchors.bind( "focus.tabs", function() { 17400 addState( "focus", $( this ).closest( "li" ) ); 17401 }); 17402 this.anchors.bind( "blur.tabs", function() { 17403 removeState( "focus", $( this ).closest( "li" ) ); 17404 }); 17405 } 17406 17407 // set up animations 17408 var hideFx, showFx; 17409 if ( o.fx ) { 17410 if ( $.isArray( o.fx ) ) { 17411 hideFx = o.fx[ 0 ]; 17412 showFx = o.fx[ 1 ]; 17413 } else { 17414 hideFx = showFx = o.fx; 17415 } 17416 } 17417 17418 // Reset certain styles left over from animation 17419 // and prevent IE's ClearType bug... 17420 function resetStyle( $el, fx ) { 17421 $el.css( "display", "" ); 17422 if ( !$.support.opacity && fx.opacity ) { 17423 $el[ 0 ].style.removeAttribute( "filter" ); 17424 } 17425 } 17426 17427 // Show a tab... 17428 var showTab = showFx 17429 ? function( clicked, $show ) { 17430 $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); 17431 $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way 17432 .animate( showFx, showFx.duration || "normal", function() { 17433 resetStyle( $show, showFx ); 17434 self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); 17435 }); 17436 } 17437 : function( clicked, $show ) { 17438 $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); 17439 $show.removeClass( "ui-tabs-hide" ); 17440 self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); 17441 }; 17442 17443 // Hide a tab, $show is optional... 17444 var hideTab = hideFx 17445 ? function( clicked, $hide ) { 17446 $hide.animate( hideFx, hideFx.duration || "normal", function() { 17447 self.lis.removeClass( "ui-tabs-selected ui-state-active" ); 17448 $hide.addClass( "ui-tabs-hide" ); 17449 resetStyle( $hide, hideFx ); 17450 self.element.dequeue( "tabs" ); 17451 }); 17452 } 17453 : function( clicked, $hide, $show ) { 17454 self.lis.removeClass( "ui-tabs-selected ui-state-active" ); 17455 $hide.addClass( "ui-tabs-hide" ); 17456 self.element.dequeue( "tabs" ); 17457 }; 17458 17459 // attach tab event handler, unbind to avoid duplicates from former tabifying... 17460 this.anchors.bind( o.event + ".tabs", function() { 17461 var el = this, 17462 $li = $(el).closest( "li" ), 17463 $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), 17464 $show = self.element.find( self._sanitizeSelector( el.hash ) ); 17465 17466 // If tab is already selected and not collapsible or tab disabled or 17467 // or is already loading or click callback returns false stop here. 17468 // Check if click handler returns false last so that it is not executed 17469 // for a disabled or loading tab! 17470 if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || 17471 $li.hasClass( "ui-state-disabled" ) || 17472 $li.hasClass( "ui-state-processing" ) || 17473 self.panels.filter( ":animated" ).length || 17474 self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { 17475 this.blur(); 17476 return false;
17477 } 17478 17479 o.selected = self.anchors.index( this ); 17480 17481 self.abort(); 17482 17483 // if tab may be closed 17484 if ( o.collapsible ) { 17485 if ( $li.hasClass( "ui-tabs-selected" ) ) { 17486 o.selected = -1; 17487 17488 if ( o.cookie ) { 17489 self._cookie( o.selected, o.cookie ); 17490 } 17491 17492 self.element.queue( "tabs", function() { 17493 hideTab( el, $hide ); 17494 }).dequeue( "tabs" ); 17495 17496 this.blur(); 17497 return false; 17498 } else if ( !$hide.length ) { 17499 if ( o.cookie ) { 17500 self._cookie( o.selected, o.cookie ); 17501 } 17502 17503 self.element.queue( "tabs", function() { 17504 showTab( el, $show ); 17505 }); 17506 17507 // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 17508 self.load( self.anchors.index( this ) ); 17509 17510 this.blur(); 17511 return false; 17512 } 17513 } 17514 17515 if ( o.cookie ) { 17516 self._cookie( o.selected, o.cookie ); 17517 } 17518 17519 // show new tab 17520 if ( $show.length ) { 17521 if ( $hide.length ) { 17522 self.element.queue( "tabs", function() { 17523 hideTab( el, $hide ); 17524 }); 17525 } 17526 self.element.queue( "tabs", function() { 17527 showTab( el, $show ); 17528 }); 17529 17530 self.load( self.anchors.index( this ) ); 17531 } else { 17532 throw "jQuery UI Tabs: Mismatching fragment identifier."; 17533 } 17534 17535 // Prevent IE from keeping other link focussed when using the back button 17536 // and remove dotted border from clicked link. This is controlled via CSS 17537 // in modern browsers; blur() removes focus from address bar in Firefox 17538 // which can become a usability and annoying problem with tabs('rotate'). 17539 if ( $.browser.msie ) { 17540 this.blur(); 17541 } 17542 }); 17543 17544 // disable click in any case 17545 this.anchors.bind( "click.tabs", function(){ 17546 return false; 17547 }); 17548 }, 17549 17550 _getIndex: function( index ) { 17551 // meta-function to give users option to provide a href string instead of a numerical index. 17552 // also sanitizes numerical indexes to valid values. 17553 if ( typeof index == "string" ) { 17554 index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); 17555 } 17556 17557 return index; 17558 }, 17559 17560 destroy: function() { 17561 var o = this.options; 17562 17563 this.abort(); 17564 17565 this.element 17566 .unbind( ".tabs" ) 17567 .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) 17568 .removeData( "tabs" ); 17569 17570 this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); 17571 17572 this.anchors.each(function() { 17573 var href = $.data( this, "href.tabs" ); 17574 if ( href ) { 17575 this.href = href; 17576 } 17577 var $this = $( this ).unbind( ".tabs" ); 17578 $.each( [ "href", "load", "cache" ], function( i, prefix ) { 17579 $this.removeData( prefix + ".tabs" ); 17580 }); 17581 }); 17582 17583 this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { 17584 if ( $.data( this, "destroy.tabs" ) ) { 17585 $( this ).remove(); 17586 } else { 17587 $( this ).removeClass([ 17588 "ui-state-default", 17589 "ui-corner-top", 17590 "ui-tabs-selected", 17591 "ui-state-active", 17592 "ui-state-hover", 17593 "ui-state-focus", 17594 "ui-state-disabled", 17595 "ui-tabs-panel", 17596 "ui-widget-content", 17597 "ui-corner-bottom", 17598 "ui-tabs-hide" 17599 ].join( " " ) ); 17600 } 17601 }); 17602 17603 if ( o.cookie ) { 17604 this._cookie( null, o.cookie ); 17605 } 17606 17607 return this; 17608 }, 17609 17610 add: function( url, label, index ) { 17611 if ( index === undefined ) { 17612 index = this.anchors.length; 17613 } 17614 17615 var self = this, 17616 o = this.options, 17617 $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), 17618 id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); 17619 17620 $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); 17621 17622 // try to find an existing element before creating a new one 17623 var $panel = self.element.find( "#" + id ); 17624 if ( !$panel.length ) { 17625 $panel = $( o.panelTemplate ) 17626 .attr( "id", id ) 17627 .data( "destroy.tabs", true ); 17628 } 17629 $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); 17630 17631 if ( index >= this.lis.length ) { 17632 $li.appendTo( this.list ); 17633 $panel.appendTo( this.list[ 0 ].parentNode ); 17634 } else { 17635 $li.insertBefore( this.lis[ index ] ); 17636 $panel.insertBefore( this.panels[ index ] ); 17637 } 17638 17639 o.disabled = $.map( o.disabled, function( n, i ) { 17640 return n >= index ? ++n : n; 17641 }); 17642 17643 this._tabify(); 17644 17645 if ( this.anchors.length == 1 ) { 17646 o.selected = 0; 17647 $li.addClass( "ui-tabs-selected ui-state-active" ); 17648 $panel.removeClass( "ui-tabs-hide" ); 17649 this.element.queue( "tabs", function() { 17650 self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); 17651 }); 17652 17653 this.load( 0 ); 17654 } 17655 17656 this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 17657 return this; 17658 }, 17659 17660 remove: function( index ) { 17661 index = this._getIndex( index ); 17662 var o = this.options, 17663 $li = this.lis.eq( index ).remove(), 17664 $panel = this.panels.eq( index ).remove(); 17665 17666 // If selected tab was removed focus tab to the right or 17667 // in case the last tab was removed the tab to the left. 17668 if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { 17669 this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); 17670 } 17671 17672 o.disabled = $.map( 17673 $.grep( o.disabled, function(n, i) {
17674 return n != index; 17675 }), 17676 function( n, i ) { 17677 return n >= index ? --n : n; 17678 }); 17679 17680 this._tabify(); 17681 17682 this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); 17683 return this; 17684 }, 17685 17686 enable: function( index ) { 17687 index = this._getIndex( index ); 17688 var o = this.options; 17689 if ( $.inArray( index, o.disabled ) == -1 ) { 17690 return; 17691 } 17692 17693 this.lis.eq( index ).removeClass( "ui-state-disabled" ); 17694 o.disabled = $.grep( o.disabled, function( n, i ) { 17695 return n != index; 17696 }); 17697 17698 this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 17699 return this; 17700 }, 17701 17702 disable: function( index ) { 17703 index = this._getIndex( index ); 17704 var self = this, o = this.options; 17705 // cannot disable already selected tab 17706 if ( index != o.selected ) { 17707 this.lis.eq( index ).addClass( "ui-state-disabled" ); 17708 17709 o.disabled.push( index ); 17710 o.disabled.sort(); 17711 17712 this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); 17713 } 17714 17715 return this; 17716 }, 17717 17718 select: function( index ) { 17719 index = this._getIndex( index ); 17720 if ( index == -1 ) { 17721 if ( this.options.collapsible && this.options.selected != -1 ) { 17722 index = this.options.selected; 17723 } else { 17724 return this; 17725 } 17726 } 17727 this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); 17728 return this; 17729 }, 17730 17731 load: function( index ) { 17732 index = this._getIndex( index ); 17733 var self = this, 17734 o = this.options, 17735 a = this.anchors.eq( index )[ 0 ], 17736 url = $.data( a, "load.tabs" ); 17737 17738 this.abort(); 17739 17740 // not remote or from cache 17741 if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { 17742 this.element.dequeue( "tabs" ); 17743 return; 17744 } 17745 17746 // load remote from here on 17747 this.lis.eq( index ).addClass( "ui-state-processing" ); 17748 17749 if ( o.spinner ) { 17750 var span = $( "span", a ); 17751 span.data( "label.tabs", span.html() ).html( o.spinner ); 17752 } 17753 17754 this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { 17755 url: url, 17756 success: function( r, s ) { 17757 self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); 17758 17759 // take care of tab labels 17760 self._cleanup(); 17761 17762 if ( o.cache ) { 17763 $.data( a, "cache.tabs", true ); 17764 } 17765 17766 self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); 17767 try { 17768 o.ajaxOptions.success( r, s ); 17769 } 17770 catch ( e ) {} 17771 }, 17772 error: function( xhr, s, e ) { 17773 // take care of tab labels 17774 self._cleanup(); 17775 17776 self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); 17777 try { 17778 // Passing index avoid a race condition when this method is 17779 // called after the user has selected another tab. 17780 // Pass the anchor that initiated this request allows 17781 // loadError to manipulate the tab content panel via $(a.hash) 17782 o.ajaxOptions.error( xhr, s, index, a ); 17783 } 17784 catch ( e ) {} 17785 } 17786 } ) ); 17787 17788 // last, so that load event is fired before show... 17789 self.element.dequeue( "tabs" ); 17790 17791 return this; 17792 }, 17793 17794 abort: function() { 17795 // stop possibly running animations 17796 this.element.queue( [] ); 17797 this.panels.stop( false, true ); 17798 17799 // "tabs" queue must not contain more than two elements, 17800 // which are the callbacks for the latest clicked tab... 17801 this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); 17802 17803 // terminate pending requests from other tabs 17804 if ( this.xhr ) { 17805 this.xhr.abort(); 17806 delete this.xhr; 17807 } 17808 17809 // take care of tab labels 17810 this._cleanup(); 17811 return this; 17812 }, 17813 17814 url: function( index, url ) { 17815 this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); 17816 return this; 17817 }, 17818 17819 length: function() { 17820 return this.anchors.length; 17821 } 17822}); 17823 17824$.extend( $.ui.tabs, { 17825 version: "1.8.16" 17826}); 17827 17828/* 17829 * Tabs Extensions 17830 */ 17831 17832/* 17833 * Rotate 17834 */ 17835$.extend( $.ui.tabs.prototype, { 17836 rotation: null, 17837 rotate: function( ms, continuing ) { 17838 var self = this, 17839 o = this.options; 17840 17841 var rotate = self._rotate || ( self._rotate = function( e ) { 17842 clearTimeout( self.rotation ); 17843 self.rotation = setTimeout(function() { 17844 var t = o.selected; 17845 self.select( ++t < self.anchors.length ? t : 0 ); 17846 }, ms ); 17847 17848 if ( e ) { 17849 e.stopPropagation(); 17850 } 17851 }); 17852 17853 var stop = self._unrotate || ( self._unrotate = !continuing 17854 ? function(e) { 17855 if (e.clientX) { // in case of a true click 17856 self.rotate(null); 17857 } 17858 } 17859 : function( e ) { 17860 t = o.selected; 17861 rotate(); 17862 }); 17863 17864 // start rotation 17865 if ( ms ) {
17866 this.element.bind( "tabsshow", rotate ); 17867 this.anchors.bind( o.event + ".tabs", stop ); 17868 rotate(); 17869 // stop rotation 17870 } else { 17871 clearTimeout( self.rotation ); 17872 this.element.unbind( "tabsshow", rotate ); 17873 this.anchors.unbind( o.event + ".tabs", stop ); 17874 delete this._rotate; 17875 delete this._unrotate; 17876 } 17877 17878 return this; 17879 } 17880}); 17881 17882})( jQuery ); 17883/* 17884 * jQuery UI Datepicker 1.8.16 17885 * 17886 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 17887 * Dual licensed under the MIT or GPL Version 2 licenses. 17888 * http://jquery.org/license 17889 * 17890 * http://docs.jquery.com/UI/Datepicker 17891 * 17892 * Depends: 17893 * jquery.ui.core.js 17894 */ 17895(function( $, undefined ) { 17896 17897$.extend($.ui, { datepicker: { version: "1.8.16" } }); 17898 17899var PROP_NAME = 'datepicker'; 17900var dpuuid = new Date().getTime(); 17901var instActive; 17902 17903/* Date picker manager. 17904 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 17905 Settings for (groups of) date pickers are maintained in an instance object, 17906 allowing multiple different settings on the same page. */ 17907 17908function Datepicker() { 17909 this.debug = false; // Change this to true to start debugging 17910 this._curInst = null; // The current instance in use 17911 this._keyEvent = false; // If the last event was a key event 17912 this._disabledInputs = []; // List of date picker inputs that have been disabled 17913 this._datepickerShowing = false; // True if the popup picker is showing , false if not 17914 this._inDialog = false; // True if showing within a "dialog", false if not 17915 this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division 17916 this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class 17917 this._appendClass = 'ui-datepicker-append'; // The name of the append marker class 17918 this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class 17919 this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class 17920 this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class 17921 this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class 17922 this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class 17923 this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class 17924 this.regional = []; // Available regional settings, indexed by language code 17925 this.regional[''] = { // Default regional settings 17926 closeText: 'Done', // Display text for close link 17927 prevText: 'Prev', // Display text for previous month link 17928 nextText: 'Next', // Display text for next month link 17929 currentText: 'Today', // Display text for current month link 17930 monthNames: ['January','February','March','April','May','June', 17931 'July','August','September','October','November','December'], // Names of months for drop-down and formatting 17932 monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting 17933 dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting 17934 dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting 17935 dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday 17936 weekHeader: 'Wk', // Column header for week of the year 17937 dateFormat: 'mm/dd/yy', // See format options on parseDate 17938 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 17939 isRTL: false, // True if right-to-left language, false if left-to-right 17940 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 17941 yearSuffix: '' // Additional text to append to the year in the month headers 17942 }; 17943 this._defaults = { // Global defaults for all the date picker instances 17944 showOn: 'focus', // 'focus' for popup on focus, 17945 // 'button' for trigger button, or 'both' for either 17946 showAnim: 'fadeIn', // Name of jQuery animation for popup 17947 showOptions: {}, // Options for enhanced animations 17948 defaultDate: null, // Used when field is blank: actual date, 17949 // +/-number for offset from today, null for today 17950 appendText: '', // Display text following the input box, e.g. showing the format 17951 buttonText: '...', // Text for trigger button
17952 buttonImage: '', // URL for trigger button image 17953 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 17954 hideIfNoPrevNext: false, // True to hide next/previous month links 17955 // if not applicable, false to just disable them 17956 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 17957 gotoCurrent: false, // True if today link goes back to current selection instead 17958 changeMonth: false, // True if month can be selected directly, false if only prev/next 17959 changeYear: false, // True if year can be selected directly, false if only prev/next 17960 yearRange: 'c-10:c+10', // Range of years to display in drop-down, 17961 // either relative to today's year (-nn:+nn), relative to currently displayed year 17962 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 17963 showOtherMonths: false, // True to show dates in other months, false to leave blank 17964 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 17965 showWeek: false, // True to show week of the year, false to not show it 17966 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 17967 // takes a Date and returns the number of the week for it 17968 shortYearCutoff: '+10', // Short year values < this are in the current century, 17969 // > this are in the previous century, 17970 // string value starting with '+' for current year + value 17971 minDate: null, // The earliest selectable date, or null for no limit 17972 maxDate: null, // The latest selectable date, or null for no limit 17973 duration: 'fast', // Duration of display/closure 17974 beforeShowDay: null, // Function that takes a date and returns an array with 17975 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', 17976 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 17977 beforeShow: null, // Function that takes an input field and 17978 // returns a set of custom settings for the date picker 17979 onSelect: null, // Define a callback function when a date is selected 17980 onChangeMonthYear: null, // Define a callback function when the month or year is changed 17981 onClose: null, // Define a callback function when the datepicker is closed 17982 numberOfMonths: 1, // Number of months to show at a time 17983 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 17984 stepMonths: 1, // Number of months to step back/forward 17985 stepBigMonths: 12, // Number of months to step back/forward for the big links 17986 altField: '', // Selector for an alternate field to store selected dates into 17987 altFormat: '', // The date format to use for the alternate field 17988 constrainInput: true, // The input is constrained by the current date format 17989 showButtonPanel: false, // True to show button panel, false to not show it 17990 autoSize: false, // True to size the input for the date format, false to leave as is 17991 disabled: false // The initial disabled state 17992 }; 17993 $.extend(this._defaults, this.regional['']); 17994 this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')); 17995} 17996 17997$.extend(Datepicker.prototype, { 17998 /* Class name added to elements to indicate already configured with a date picker. */ 17999 markerClassName: 'hasDatepicker', 18000 18001 //Keep track of the maximum number of rows displayed (see #7043) 18002 maxRows: 4, 18003 18004 /* Debug logging (if enabled). */ 18005 log: function () { 18006 if (this.debug) 18007 console.log.apply('', arguments); 18008 }, 18009 18010 // TODO rename to "widget" when switching to widget factory 18011 _widgetDatepicker: function() { 18012 return this.dpDiv; 18013 }, 18014 18015 /* Override the default settings for all instances of the date picker. 18016 @param settings object - the new settings to use as defaults (anonymous object) 18017 @return the manager object */ 18018 setDefaults: function(settings) { 18019 extendRemove(this._defaults, settings || {}); 18020 return this; 18021 }, 18022 18023 /* Attach the date picker to a jQuery selection. 18024 @param target element - the target input field or division or span 18025 @param settings object - the new settings to use for this date picker instance (anonymous) */ 18026 _attachDatepicker: function(target, settings) { 18027 // check for settings on the control itself - in namespace 'date:' 18028 var inlineSettings = null; 18029 for (var attrName in this._defaults) { 18030 var attrValue = target.getAttribute('date:' + attrName); 18031 if (attrValue) { 18032 inlineSettings = inlineSettings || {};
18033 try { 18034 inlineSettings[attrName] = eval(attrValue); 18035 } catch (err) { 18036 inlineSettings[attrName] = attrValue; 18037 } 18038 } 18039 } 18040 var nodeName = target.nodeName.toLowerCase(); 18041 var inline = (nodeName == 'div' || nodeName == 'span'); 18042 if (!target.id) { 18043 this.uuid += 1; 18044 target.id = 'dp' + this.uuid; 18045 } 18046 var inst = this._newInst($(target), inline); 18047 inst.settings = $.extend({}, settings || {}, inlineSettings || {}); 18048 if (nodeName == 'input') { 18049 this._connectDatepicker(target, inst); 18050 } else if (inline) { 18051 this._inlineDatepicker(target, inst); 18052 } 18053 }, 18054 18055 /* Create a new instance object. */ 18056 _newInst: function(target, inline) { 18057 var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars 18058 return {id: id, input: target, // associated target 18059 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 18060 drawMonth: 0, drawYear: 0, // month being drawn 18061 inline: inline, // is datepicker inline or not 18062 dpDiv: (!inline ? this.dpDiv : // presentation div 18063 bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}; 18064 }, 18065 18066 /* Attach the date picker to an input field. */ 18067 _connectDatepicker: function(target, inst) { 18068 var input = $(target); 18069 inst.append = $([]); 18070 inst.trigger = $([]); 18071 if (input.hasClass(this.markerClassName)) 18072 return; 18073 this._attachments(input, inst); 18074 input.addClass(this.markerClassName).keydown(this._doKeyDown). 18075 keypress(this._doKeyPress).keyup(this._doKeyUp). 18076 bind("setData.datepicker", function(event, key, value) { 18077 inst.settings[key] = value; 18078 }).bind("getData.datepicker", function(event, key) { 18079 return this._get(inst, key); 18080 }); 18081 this._autoSize(inst); 18082 $.data(target, PROP_NAME, inst); 18083 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 18084 if( inst.settings.disabled ) { 18085 this._disableDatepicker( target ); 18086 } 18087 }, 18088 18089 /* Make attachments based on settings. */ 18090 _attachments: function(input, inst) { 18091 var appendText = this._get(inst, 'appendText'); 18092 var isRTL = this._get(inst, 'isRTL'); 18093 if (inst.append) 18094 inst.append.remove(); 18095 if (appendText) { 18096 inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); 18097 input[isRTL ? 'before' : 'after'](inst.append); 18098 } 18099 input.unbind('focus', this._showDatepicker); 18100 if (inst.trigger) 18101 inst.trigger.remove(); 18102 var showOn = this._get(inst, 'showOn'); 18103 if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field 18104 input.focus(this._showDatepicker); 18105 if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked 18106 var buttonText = this._get(inst, 'buttonText'); 18107 var buttonImage = this._get(inst, 'buttonImage'); 18108 inst.trigger = $(this._get(inst, 'buttonImageOnly') ? 18109 $('<img/>').addClass(this._triggerClass). 18110 attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 18111 $('<button type="button"></button>').addClass(this._triggerClass). 18112 html(buttonImage == '' ? buttonText : $('<img/>').attr( 18113 { src:buttonImage, alt:buttonText, title:buttonText }))); 18114 input[isRTL ? 'before' : 'after'](inst.trigger); 18115 inst.trigger.click(function() { 18116 if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) 18117 $.datepicker._hideDatepicker(); 18118 else 18119 $.datepicker._showDatepicker(input[0]); 18120 return false; 18121 }); 18122 } 18123 }, 18124 18125 /* Apply the maximum length for the date format. */ 18126 _autoSize: function(inst) { 18127 if (this._get(inst, 'autoSize') && !inst.inline) { 18128 var date = new Date(2009, 12 - 1, 20); // Ensure double digits 18129 var dateFormat = this._get(inst, 'dateFormat'); 18130 if (dateFormat.match(/[DM]/)) { 18131 var findMax = function(names) { 18132 var max = 0; 18133 var maxI = 0; 18134 for (var i = 0; i < names.length; i++) { 18135 if (names[i].length > max) { 18136 max = names[i].length; 18137 maxI = i; 18138 } 18139 } 18140 return maxI; 18141 }; 18142 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 18143 'monthNames' : 'monthNamesShort')))); 18144 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 18145 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); 18146 } 18147 inst.input.attr('size', this._formatDate(inst, date).length); 18148 } 18149 }, 18150 18151 /* Attach an inline date picker to a div. */ 18152 _inlineDatepicker: function(target, inst) { 18153 var divSpan = $(target); 18154 if (divSpan.hasClass(this.markerClassName)) 18155 return; 18156 divSpan.addClass(this.markerClassName).append(inst.dpDiv). 18157 bind("setData.datepicker", function(event, key, value){ 18158 inst.settings[key] = value; 18159 }).bind("getData.datepicker", function(event, key){ 18160 return this._get(inst, key); 18161 }); 18162 $.data(target, PROP_NAME, inst); 18163 this._setDate(inst, this._getDefaultDate(inst), true); 18164 this._updateDatepicker(inst); 18165 this._updateAlternate(inst); 18166 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 18167 if( inst.settings.disabled ) { 18168 this._disableDatepicker( target ); 18169 }
18170 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 18171 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 18172 inst.dpDiv.css( "display", "block" ); 18173 }, 18174 18175 /* Pop-up the date picker in a "dialog" box. 18176 @param input element - ignored 18177 @param date string or Date - the initial date to display 18178 @param onSelect function - the function to call when a date is selected 18179 @param settings object - update the dialog date picker instance's settings (anonymous object) 18180 @param pos int[2] - coordinates for the dialog's position within the screen or 18181 event - with x/y coordinates or 18182 leave empty for default (screen centre) 18183 @return the manager object */ 18184 _dialogDatepicker: function(input, date, onSelect, settings, pos) { 18185 var inst = this._dialogInst; // internal instance 18186 if (!inst) { 18187 this.uuid += 1; 18188 var id = 'dp' + this.uuid; 18189 this._dialogInput = $('<input type="text" id="' + id + 18190 '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'); 18191 this._dialogInput.keydown(this._doKeyDown); 18192 $('body').append(this._dialogInput); 18193 inst = this._dialogInst = this._newInst(this._dialogInput, false); 18194 inst.settings = {}; 18195 $.data(this._dialogInput[0], PROP_NAME, inst); 18196 } 18197 extendRemove(inst.settings, settings || {}); 18198 date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); 18199 this._dialogInput.val(date); 18200 18201 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 18202 if (!this._pos) { 18203 var browserWidth = document.documentElement.clientWidth; 18204 var browserHeight = document.documentElement.clientHeight; 18205 var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 18206 var scrollY = document.documentElement.scrollTop || document.body.scrollTop; 18207 this._pos = // should use actual width/height below 18208 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 18209 } 18210 18211 // move input on screen for focus, but hidden behind dialog 18212 this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); 18213 inst.settings.onSelect = onSelect; 18214 this._inDialog = true; 18215 this.dpDiv.addClass(this._dialogClass); 18216 this._showDatepicker(this._dialogInput[0]); 18217 if ($.blockUI) 18218 $.blockUI(this.dpDiv); 18219 $.data(this._dialogInput[0], PROP_NAME, inst); 18220 return this; 18221 }, 18222 18223 /* Detach a datepicker from its control. 18224 @param target element - the target input field or division or span */ 18225 _destroyDatepicker: function(target) { 18226 var $target = $(target); 18227 var inst = $.data(target, PROP_NAME); 18228 if (!$target.hasClass(this.markerClassName)) { 18229 return; 18230 } 18231 var nodeName = target.nodeName.toLowerCase(); 18232 $.removeData(target, PROP_NAME); 18233 if (nodeName == 'input') { 18234 inst.append.remove(); 18235 inst.trigger.remove(); 18236 $target.removeClass(this.markerClassName). 18237 unbind('focus', this._showDatepicker). 18238 unbind('keydown', this._doKeyDown). 18239 unbind('keypress', this._doKeyPress). 18240 unbind('keyup', this._doKeyUp); 18241 } else if (nodeName == 'div' || nodeName == 'span') 18242 $target.removeClass(this.markerClassName).empty(); 18243 }, 18244 18245 /* Enable the date picker to a jQuery selection. 18246 @param target element - the target input field or division or span */ 18247 _enableDatepicker: function(target) { 18248 var $target = $(target); 18249 var inst = $.data(target, PROP_NAME); 18250 if (!$target.hasClass(this.markerClassName)) { 18251 return; 18252 } 18253 var nodeName = target.nodeName.toLowerCase(); 18254 if (nodeName == 'input') { 18255 target.disabled = false; 18256 inst.trigger.filter('button'). 18257 each(function() { this.disabled = false; }).end(). 18258 filter('img').css({opacity: '1.0', cursor: ''}); 18259 } 18260 else if (nodeName == 'div' || nodeName == 'span') { 18261 var inline = $target.children('.' + this._inlineClass); 18262 inline.children().removeClass('ui-state-disabled'); 18263 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 18264 removeAttr("disabled"); 18265 } 18266 this._disabledInputs = $.map(this._disabledInputs, 18267 function(value) { return (value == target ? null : value); }); // delete entry 18268 },
18269 18270 /* Disable the date picker to a jQuery selection. 18271 @param target element - the target input field or division or span */ 18272 _disableDatepicker: function(target) { 18273 var $target = $(target); 18274 var inst = $.data(target, PROP_NAME); 18275 if (!$target.hasClass(this.markerClassName)) { 18276 return; 18277 } 18278 var nodeName = target.nodeName.toLowerCase(); 18279 if (nodeName == 'input') { 18280 target.disabled = true; 18281 inst.trigger.filter('button'). 18282 each(function() { this.disabled = true; }).end(). 18283 filter('img').css({opacity: '0.5', cursor: 'default'}); 18284 } 18285 else if (nodeName == 'div' || nodeName == 'span') { 18286 var inline = $target.children('.' + this._inlineClass); 18287 inline.children().addClass('ui-state-disabled'); 18288 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 18289 attr("disabled", "disabled"); 18290 } 18291 this._disabledInputs = $.map(this._disabledInputs, 18292 function(value) { return (value == target ? null : value); }); // delete entry 18293 this._disabledInputs[this._disabledInputs.length] = target; 18294 }, 18295 18296 /* Is the first field in a jQuery collection disabled as a datepicker? 18297 @param target element - the target input field or division or span 18298 @return boolean - true if disabled, false if enabled */ 18299 _isDisabledDatepicker: function(target) { 18300 if (!target) { 18301 return false; 18302 } 18303 for (var i = 0; i < this._disabledInputs.length; i++) { 18304 if (this._disabledInputs[i] == target) 18305 return true; 18306 } 18307 return false; 18308 }, 18309 18310 /* Retrieve the instance data for the target control. 18311 @param target element - the target input field or division or span 18312 @return object - the associated instance data 18313 @throws error if a jQuery problem getting data */ 18314 _getInst: function(target) { 18315 try { 18316 return $.data(target, PROP_NAME); 18317 } 18318 catch (err) { 18319 throw 'Missing instance data for this datepicker'; 18320 } 18321 }, 18322 18323 /* Update or retrieve the settings for a date picker attached to an input field or division. 18324 @param target element - the target input field or division or span 18325 @param name object - the new settings to update or 18326 string - the name of the setting to change or retrieve, 18327 when retrieving also 'all' for all instance settings or 18328 'defaults' for all global defaults 18329 @param value any - the new value for the setting 18330 (omit if above is an object or to retrieve a value) */ 18331 _optionDatepicker: function(target, name, value) { 18332 var inst = this._getInst(target); 18333 if (arguments.length == 2 && typeof name == 'string') { 18334 return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : 18335 (inst ? (name == 'all' ? $.extend({}, inst.settings) : 18336 this._get(inst, name)) : null)); 18337 } 18338 var settings = name || {}; 18339 if (typeof name == 'string') { 18340 settings = {}; 18341 settings[name] = value; 18342 } 18343 if (inst) { 18344 if (this._curInst == inst) { 18345 this._hideDatepicker(); 18346 } 18347 var date = this._getDateDatepicker(target, true); 18348 var minDate = this._getMinMaxDate(inst, 'min'); 18349 var maxDate = this._getMinMaxDate(inst, 'max'); 18350 extendRemove(inst.settings, settings); 18351 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 18352 if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) 18353 inst.settings.minDate = this._formatDate(inst, minDate); 18354 if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) 18355 inst.settings.maxDate = this._formatDate(inst, maxDate); 18356 this._attachments($(target), inst); 18357 this._autoSize(inst); 18358 this._setDate(inst, date); 18359 this._updateAlternate(inst); 18360 this._updateDatepicker(inst); 18361 } 18362 }, 18363 18364 // change method deprecated 18365 _changeDatepicker: function(target, name, value) { 18366 this._optionDatepicker(target, name, value); 18367 }, 18368 18369 /* Redraw the date picker attached to an input field or division. 18370 @param target element - the target input field or division or span */ 18371 _refreshDatepicker: function(target) { 18372 var inst = this._getInst(target); 18373 if (inst) { 18374 this._updateDatepicker(inst); 18375 } 18376 }, 18377 18378 /* Set the dates for a jQuery selection. 18379 @param target element - the target input field or division or span 18380 @param date Date - the new date */ 18381 _setDateDatepicker: function(target, date) { 18382 var inst = this._getInst(target); 18383 if (inst) { 18384 this._setDate(inst, date); 18385 this._updateDatepicker(inst); 18386 this._updateAlternate(inst); 18387 } 18388 }, 18389 18390 /* Get the date(s) for the first entry in a jQuery selection. 18391 @param target element - the target input field or division or span 18392 @param noDefault boolean - true if no default date is to be used 18393 @return Date - the current date */ 18394 _getDateDatepicker: function(target, noDefault) { 18395 var inst = this._getInst(target); 18396 if (inst && !inst.inline) 18397 this._setDateFromField(inst, noDefault); 18398 return (inst ? this._getDate(inst) : null); 18399 }, 18400 18401 /* Handle keystrokes. */ 18402 _doKeyDown: function(event) { 18403 var inst = $.datepicker._getInst(event.target); 18404 var handled = true; 18405 var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); 18406 inst._keyEvent = true; 18407 if ($.datepicker._datepickerShowing) 18408 switch (event.keyCode) { 18409 case 9: $.datepicker._hideDatepicker(); 18410 handled = false;
18411 break; // hide on tab out 18412 case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + 18413 $.datepicker._currentClass + ')', inst.dpDiv); 18414 if (sel[0]) 18415 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 18416 var onSelect = $.datepicker._get(inst, 'onSelect'); 18417 if (onSelect) { 18418 var dateStr = $.datepicker._formatDate(inst); 18419 18420 // trigger custom callback 18421 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 18422 } 18423 else 18424 $.datepicker._hideDatepicker(); 18425 return false; // don't submit the form 18426 break; // select the value on enter 18427 case 27: $.datepicker._hideDatepicker(); 18428 break; // hide on escape 18429 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 18430 -$.datepicker._get(inst, 'stepBigMonths') : 18431 -$.datepicker._get(inst, 'stepMonths')), 'M'); 18432 break; // previous month/year on page up/+ ctrl 18433 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 18434 +$.datepicker._get(inst, 'stepBigMonths') : 18435 +$.datepicker._get(inst, 'stepMonths')), 'M'); 18436 break; // next month/year on page down/+ ctrl 18437 case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); 18438 handled = event.ctrlKey || event.metaKey; 18439 break; // clear on ctrl or command +end 18440 case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); 18441 handled = event.ctrlKey || event.metaKey; 18442 break; // current on ctrl or command +home 18443 case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); 18444 handled = event.ctrlKey || event.metaKey; 18445 // -1 day on ctrl or command +left 18446 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? 18447 -$.datepicker._get(inst, 'stepBigMonths') : 18448 -$.datepicker._get(inst, 'stepMonths')), 'M'); 18449 // next month/year on alt +left on Mac 18450 break; 18451 case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); 18452 handled = event.ctrlKey || event.metaKey; 18453 break; // -1 week on ctrl or command +up 18454 case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); 18455 handled = event.ctrlKey || event.metaKey; 18456 // +1 day on ctrl or command +right 18457 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? 18458 +$.datepicker._get(inst, 'stepBigMonths') : 18459 +$.datepicker._get(inst, 'stepMonths')), 'M'); 18460 // next month/year on alt +right 18461 break; 18462 case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); 18463 handled = event.ctrlKey || event.metaKey; 18464 break; // +1 week on ctrl or command +down 18465 default: handled = false; 18466 } 18467 else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home 18468 $.datepicker._showDatepicker(this); 18469 else { 18470 handled = false; 18471 } 18472 if (handled) { 18473 event.preventDefault(); 18474 event.stopPropagation(); 18475 } 18476 }, 18477 18478 /* Filter entered characters - based on date format. */ 18479 _doKeyPress: function(event) { 18480 var inst = $.datepicker._getInst(event.target); 18481 if ($.datepicker._get(inst, 'constrainInput')) { 18482 var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); 18483 var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); 18484 return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); 18485 } 18486 }, 18487 18488 /* Synchronise manual entry and field/alternate field. */ 18489 _doKeyUp: function(event) { 18490 var inst = $.datepicker._getInst(event.target);
vendor: 4,172 bytes, lines 18491-18595
18491 if (inst.input.val() != inst.lastVal) { 18492 try { 18493 var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), 18494 (inst.input ? inst.input.val() : null), 18495 $.datepicker._getFormatConfig(inst)); 18496 if (date) { // only if valid 18497 $.datepicker._setDateFromField(inst); 18498 $.datepicker._updateAlternate(inst); 18499 $.datepicker._updateDatepicker(inst); 18500 } 18501 } 18502 catch (event) { 18503 $.datepicker.log(event); 18504 } 18505 } 18506 return true; 18507 }, 18508 18509 /* Pop-up the date picker for a given input field. 18510 If false returned from beforeShow event handler do not show. 18511 @param input element - the input field attached to the date picker or 18512 event - if triggered by focus */ 18513 _showDatepicker: function(input) { 18514 input = input.target || input; 18515 if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger 18516 input = $('input', input.parentNode)[0]; 18517 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here 18518 return; 18519 var inst = $.datepicker._getInst(input); 18520 if ($.datepicker._curInst && $.datepicker._curInst != inst) { 18521 if ( $.datepicker._datepickerShowing ) { 18522 $.datepicker._triggerOnClose($.datepicker._curInst); 18523 } 18524 $.datepicker._curInst.dpDiv.stop(true, true); 18525 } 18526 var beforeShow = $.datepicker._get(inst, 'beforeShow'); 18527 var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 18528 if(beforeShowSettings === false){ 18529 //false 18530 return; 18531 } 18532 extendRemove(inst.settings, beforeShowSettings); 18533 inst.lastVal = null; 18534 $.datepicker._lastInput = input; 18535 $.datepicker._setDateFromField(inst); 18536 if ($.datepicker._inDialog) // hide cursor 18537 input.value = ''; 18538 if (!$.datepicker._pos) { // position below input 18539 $.datepicker._pos = $.datepicker._findPos(input); 18540 $.datepicker._pos[1] += input.offsetHeight; // add the height 18541 } 18542 var isFixed = false; 18543 $(input).parents().each(function() { 18544 isFixed |= $(this).css('position') == 'fixed'; 18545 return !isFixed; 18546 }); 18547 if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled 18548 $.datepicker._pos[0] -= document.documentElement.scrollLeft; 18549 $.datepicker._pos[1] -= document.documentElement.scrollTop; 18550 } 18551 var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; 18552 $.datepicker._pos = null; 18553 //to avoid flashes on Firefox 18554 inst.dpDiv.empty(); 18555 // determine sizing offscreen 18556 inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); 18557 $.datepicker._updateDatepicker(inst); 18558 // fix width for dynamic number of date pickers 18559 // and adjust position before showing 18560 offset = $.datepicker._checkOffset(inst, offset, isFixed); 18561 inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? 18562 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', 18563 left: offset.left + 'px', top: offset.top + 'px'}); 18564 if (!inst.inline) { 18565 var showAnim = $.datepicker._get(inst, 'showAnim'); 18566 var duration = $.datepicker._get(inst, 'duration'); 18567 var postProcess = function() { 18568 var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only 18569 if( !! cover.length ){ 18570 var borders = $.datepicker._getBorders(inst.dpDiv); 18571 cover.css({left: -borders[0], top: -borders[1], 18572 width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); 18573 } 18574 }; 18575 inst.dpDiv.zIndex($(input).zIndex()+1); 18576 $.datepicker._datepickerShowing = true; 18577 if ($.effects && $.effects[showAnim]) 18578 inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); 18579 else 18580 inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); 18581 if (!showAnim || !duration) 18582 postProcess(); 18583 if (inst.input.is(':visible') && !inst.input.is(':disabled')) 18584 inst.input.focus(); 18585 $.datepicker._curInst = inst; 18586 } 18587 }, 18588 18589 /* Generate the date picker content. */ 18590 _updateDatepicker: function(inst) { 18591 var self = this; 18592 self.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 18593 var borders = $.datepicker._getBorders(inst.dpDiv); 18594 instActive = inst; // for delegate hover events 18595 inst.dpDiv.empty().append(this._generateHTML(inst));
18596 var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only 18597 if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 18598 cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) 18599 } 18600 inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); 18601 var numMonths = this._getNumberOfMonths(inst); 18602 var cols = numMonths[1]; 18603 var width = 17; 18604 inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); 18605 if (cols > 1) 18606 inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); 18607 inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + 18608 'Class']('ui-datepicker-multi'); 18609 inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 18610 'Class']('ui-datepicker-rtl'); 18611 if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && 18612 // #6694 - don't focus the input if it's already focused 18613 // this breaks the change event in IE 18614 inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) 18615 inst.input.focus(); 18616 // deffered render of the years select (to avoid flashes on Firefox) 18617 if( inst.yearshtml ){ 18618 var origyearshtml = inst.yearshtml; 18619 setTimeout(function(){ 18620 //assure that inst.yearshtml didn't change. 18621 if( origyearshtml === inst.yearshtml && inst.yearshtml ){ 18622 inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); 18623 } 18624 origyearshtml = inst.yearshtml = null; 18625 }, 0); 18626 } 18627 }, 18628 18629 /* Retrieve the size of left and top borders for an element. 18630 @param elem (jQuery object) the element of interest 18631 @return (number[2]) the left and top borders */ 18632 _getBorders: function(elem) { 18633 var convert = function(value) { 18634 return {thin: 1, medium: 2, thick: 3}[value] || value; 18635 }; 18636 return [parseFloat(convert(elem.css('border-left-width'))), 18637 parseFloat(convert(elem.css('border-top-width')))]; 18638 }, 18639 18640 /* Check positioning to remain on screen. */ 18641 _checkOffset: function(inst, offset, isFixed) { 18642 var dpWidth = inst.dpDiv.outerWidth(); 18643 var dpHeight = inst.dpDiv.outerHeight(); 18644 var inputWidth = inst.input ? inst.input.outerWidth() : 0; 18645 var inputHeight = inst.input ? inst.input.outerHeight() : 0; 18646 var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); 18647 var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); 18648 18649 offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); 18650 offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; 18651 offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 18652 18653 // now check if datepicker is showing outside window viewport - move to a better place if so. 18654 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 18655 Math.abs(offset.left + dpWidth - viewWidth) : 0); 18656 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 18657 Math.abs(dpHeight + inputHeight) : 0); 18658 18659 return offset; 18660 }, 18661 18662 /* Find an object's position on the screen. */ 18663 _findPos: function(obj) { 18664 var inst = this._getInst(obj); 18665 var isRTL = this._get(inst, 'isRTL'); 18666 while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { 18667 obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; 18668 } 18669 var position = $(obj).offset(); 18670 return [position.left, position.top]; 18671 }, 18672 18673 /* Trigger custom callback of onClose. */ 18674 _triggerOnClose: function(inst) { 18675 var onClose = this._get(inst, 'onClose'); 18676 if (onClose) 18677 onClose.apply((inst.input ? inst.input[0] : null), 18678 [(inst.input ? inst.input.val() : ''), inst]); 18679 }, 18680 18681 /* Hide the date picker from view. 18682 @param input element - the input field attached to the date picker */ 18683 _hideDatepicker: function(input) { 18684 var inst = this._curInst; 18685 if (!inst || (input && inst != $.data(input, PROP_NAME))) 18686 return; 18687 if (this._datepickerShowing) { 18688 var showAnim = this._get(inst, 'showAnim'); 18689 var duration = this._get(inst, 'duration'); 18690 var postProcess = function() { 18691 $.datepicker._tidyDialog(inst); 18692 this._curInst = null; 18693 }; 18694 if ($.effects && $.effects[showAnim]) 18695 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); 18696 else 18697 inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : 18698 (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); 18699 if (!showAnim) 18700 postProcess(); 18701 $.datepicker._triggerOnClose(inst); 18702 this._datepickerShowing = false;
18703 this._lastInput = null; 18704 if (this._inDialog) { 18705 this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); 18706 if ($.blockUI) { 18707 $.unblockUI(); 18708 $('body').append(this.dpDiv); 18709 } 18710 } 18711 this._inDialog = false; 18712 } 18713 }, 18714 18715 /* Tidy up after a dialog display. */ 18716 _tidyDialog: function(inst) { 18717 inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); 18718 }, 18719 18720 /* Close date picker if clicked elsewhere. */ 18721 _checkExternalClick: function(event) { 18722 if (!$.datepicker._curInst) 18723 return; 18724 var $target = $(event.target); 18725 if ($target[0].id != $.datepicker._mainDivId && 18726 $target.parents('#' + $.datepicker._mainDivId).length == 0 && 18727 !$target.hasClass($.datepicker.markerClassName) && 18728 !$target.hasClass($.datepicker._triggerClass) && 18729 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) 18730 $.datepicker._hideDatepicker(); 18731 }, 18732 18733 /* Adjust one of the date sub-fields. */ 18734 _adjustDate: function(id, offset, period) { 18735 var target = $(id); 18736 var inst = this._getInst(target[0]); 18737 if (this._isDisabledDatepicker(target[0])) { 18738 return; 18739 } 18740 this._adjustInstDate(inst, offset + 18741 (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning 18742 period); 18743 this._updateDatepicker(inst); 18744 }, 18745 18746 /* Action for current link. */ 18747 _gotoToday: function(id) { 18748 var target = $(id); 18749 var inst = this._getInst(target[0]); 18750 if (this._get(inst, 'gotoCurrent') && inst.currentDay) { 18751 inst.selectedDay = inst.currentDay; 18752 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 18753 inst.drawYear = inst.selectedYear = inst.currentYear; 18754 } 18755 else { 18756 var date = new Date(); 18757 inst.selectedDay = date.getDate(); 18758 inst.drawMonth = inst.selectedMonth = date.getMonth(); 18759 inst.drawYear = inst.selectedYear = date.getFullYear(); 18760 } 18761 this._notifyChange(inst); 18762 this._adjustDate(target); 18763 }, 18764 18765 /* Action for selecting a new month/year. */ 18766 _selectMonthYear: function(id, select, period) { 18767 var target = $(id); 18768 var inst = this._getInst(target[0]); 18769 inst['selected' + (period == 'M' ? 'Month' : 'Year')] = 18770 inst['draw' + (period == 'M' ? 'Month' : 'Year')] = 18771 parseInt(select.options[select.selectedIndex].value,10); 18772 this._notifyChange(inst); 18773 this._adjustDate(target); 18774 }, 18775 18776 /* Action for selecting a day. */ 18777 _selectDay: function(id, month, year, td) { 18778 var target = $(id); 18779 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 18780 return; 18781 } 18782 var inst = this._getInst(target[0]); 18783 inst.selectedDay = inst.currentDay = $('a', td).html(); 18784 inst.selectedMonth = inst.currentMonth = month; 18785 inst.selectedYear = inst.currentYear = year; 18786 this._selectDate(id, this._formatDate(inst, 18787 inst.currentDay, inst.currentMonth, inst.currentYear)); 18788 }, 18789 18790 /* Erase the input field and hide the date picker. */ 18791 _clearDate: function(id) { 18792 var target = $(id); 18793 var inst = this._getInst(target[0]); 18794 this._selectDate(target, ''); 18795 }, 18796 18797 /* Update the input field with the selected date. */ 18798 _selectDate: function(id, dateStr) { 18799 var target = $(id); 18800 var inst = this._getInst(target[0]); 18801 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 18802 if (inst.input) 18803 inst.input.val(dateStr); 18804 this._updateAlternate(inst); 18805 var onSelect = this._get(inst, 'onSelect'); 18806 if (onSelect) 18807 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 18808 else if (inst.input) 18809 inst.input.trigger('change'); // fire the change event 18810 if (inst.inline) 18811 this._updateDatepicker(inst); 18812 else { 18813 this._hideDatepicker(); 18814 this._lastInput = inst.input[0]; 18815 if (typeof(inst.input[0]) != 'object') 18816 inst.input.focus(); // restore focus 18817 this._lastInput = null; 18818 } 18819 }, 18820 18821 /* Update any alternate field to synchronise with the main field. */ 18822 _updateAlternate: function(inst) { 18823 var altField = this._get(inst, 'altField'); 18824 if (altField) { // update alternate field too 18825 var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); 18826 var date = this._getDate(inst); 18827 var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 18828 $(altField).each(function() { $(this).val(dateStr); }); 18829 } 18830 }, 18831 18832 /* Set as beforeShowDay function to prevent selection of weekends. 18833 @param date Date - the date to customise 18834 @return [boolean, string] - is this date selectable?, what is its CSS class? */ 18835 noWeekends: function(date) { 18836 var day = date.getDay(); 18837 return [(day > 0 && day < 6), '']; 18838 }, 18839 18840 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 18841 @param date Date - the date to get the week for 18842 @return number - the number of the week within the year that contains this date */ 18843 iso8601Week: function(date) { 18844 var checkDate = new Date(date.getTime()); 18845 // Find Thursday of this week starting on Monday 18846 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 18847 var time = checkDate.getTime(); 18848 checkDate.setMonth(0); // Compare with Jan 1 18849 checkDate.setDate(1); 18850 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 18851 }, 18852 18853 /* Parse a string value into a date object. 18854 See formatDate below for the possible formats. 18855
18856 @param format string - the expected format of the date 18857 @param value string - the date in the above format 18858 @param settings Object - attributes include: 18859 shortYearCutoff number - the cutoff year for determining the century (optional) 18860 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 18861 dayNames string[7] - names of the days from Sunday (optional) 18862 monthNamesShort string[12] - abbreviated names of the months (optional) 18863 monthNames string[12] - names of the months (optional) 18864 @return Date - the extracted date value or null if value is blank */ 18865 parseDate: function (format, value, settings) { 18866 if (format == null || value == null) 18867 throw 'Invalid arguments'; 18868 value = (typeof value == 'object' ? value.toString() : value + ''); 18869 if (value == '') 18870 return null; 18871 var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; 18872 shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : 18873 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 18874 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; 18875 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; 18876 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; 18877 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; 18878 var year = -1; 18879 var month = -1; 18880 var day = -1; 18881 var doy = -1; 18882 var literal = false; 18883 // Check whether a format character is doubled 18884 var lookAhead = function(match) { 18885 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 18886 if (matches) 18887 iFormat++; 18888 return matches; 18889 }; 18890 // Extract a number from the string value 18891 var getNumber = function(match) { 18892 var isDoubled = lookAhead(match); 18893 var size = (match == '@' ? 14 : (match == '!' ? 20 : 18894 (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); 18895 var digits = new RegExp('^\\d{1,' + size + '}'); 18896 var num = value.substring(iValue).match(digits); 18897 if (!num) 18898 throw 'Missing number at position ' + iValue; 18899 iValue += num[0].length; 18900 return parseInt(num[0], 10); 18901 }; 18902 // Extract a name from the string value and convert to an index 18903 var getName = function(match, shortNames, longNames) { 18904 var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 18905 return [ [k, v] ]; 18906 }).sort(function (a, b) { 18907 return -(a[1].length - b[1].length); 18908 }); 18909 var index = -1; 18910 $.each(names, function (i, pair) { 18911 var name = pair[1]; 18912 if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) { 18913 index = pair[0]; 18914 iValue += name.length; 18915 return false; 18916 } 18917 }); 18918 if (index != -1) 18919 return index + 1; 18920 else 18921 throw 'Unknown name at position ' + iValue; 18922 }; 18923 // Confirm that a literal character matches the string value 18924 var checkLiteral = function() { 18925 if (value.charAt(iValue) != format.charAt(iFormat)) 18926 throw 'Unexpected literal at position ' + iValue; 18927 iValue++; 18928 }; 18929 var iValue = 0; 18930 for (var iFormat = 0; iFormat < format.length; iFormat++) { 18931 if (literal) 18932 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 18933 literal = false; 18934 else 18935 checkLiteral(); 18936 else 18937 switch (format.charAt(iFormat)) { 18938 case 'd': 18939 day = getNumber('d'); 18940 break; 18941 case 'D': 18942 getName('D', dayNamesShort, dayNames); 18943 break; 18944 case 'o': 18945 doy = getNumber('o'); 18946 break; 18947 case 'm': 18948 month = getNumber('m'); 18949 break; 18950 case 'M': 18951 month = getName('M', monthNamesShort, monthNames); 18952 break; 18953 case 'y': 18954 year = getNumber('y'); 18955 break; 18956 case '@': 18957 var date = new Date(getNumber('@')); 18958 year = date.getFullYear(); 18959 month = date.getMonth() + 1; 18960 day = date.getDate(); 18961 break; 18962 case '!': 18963 var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); 18964 year = date.getFullYear();
18965 month = date.getMonth() + 1; 18966 day = date.getDate(); 18967 break; 18968 case "'": 18969 if (lookAhead("'")) 18970 checkLiteral(); 18971 else 18972 literal = true; 18973 break; 18974 default: 18975 checkLiteral(); 18976 } 18977 } 18978 if (iValue < value.length){ 18979 throw "Extra/unparsed characters found in date: " + value.substring(iValue); 18980 } 18981 if (year == -1) 18982 year = new Date().getFullYear(); 18983 else if (year < 100) 18984 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 18985 (year <= shortYearCutoff ? 0 : -100); 18986 if (doy > -1) { 18987 month = 1; 18988 day = doy; 18989 do { 18990 var dim = this._getDaysInMonth(year, month - 1); 18991 if (day <= dim) 18992 break; 18993 month++; 18994 day -= dim; 18995 } while (true); 18996 } 18997 var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 18998 if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) 18999 throw 'Invalid date'; // E.g. 31/02/00 19000 return date; 19001 }, 19002 19003 /* Standard date formats. */ 19004 ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) 19005 COOKIE: 'D, dd M yy', 19006 ISO_8601: 'yy-mm-dd', 19007 RFC_822: 'D, d M y', 19008 RFC_850: 'DD, dd-M-y', 19009 RFC_1036: 'D, d M y', 19010 RFC_1123: 'D, d M yy', 19011 RFC_2822: 'D, d M yy', 19012 RSS: 'D, d M y', // RFC 822 19013 TICKS: '!', 19014 TIMESTAMP: '@', 19015 W3C: 'yy-mm-dd', // ISO 8601 19016 19017 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 19018 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 19019 19020 /* Format a date object into a string value. 19021 The format can be combinations of the following: 19022 d - day of month (no leading zero) 19023 dd - day of month (two digit) 19024 o - day of year (no leading zeros) 19025 oo - day of year (three digit) 19026 D - day name short 19027 DD - day name long 19028 m - month of year (no leading zero) 19029 mm - month of year (two digit) 19030 M - month name short 19031 MM - month name long 19032 y - year (two digit) 19033 yy - year (four digit) 19034 @ - Unix timestamp (ms since 01/01/1970) 19035 ! - Windows ticks (100ns since 01/01/0001) 19036 '...' - literal text 19037 '' - single quote 19038 19039 @param format string - the desired format of the date 19040 @param date Date - the date value to format 19041 @param settings Object - attributes include: 19042 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 19043 dayNames string[7] - names of the days from Sunday (optional) 19044 monthNamesShort string[12] - abbreviated names of the months (optional) 19045 monthNames string[12] - names of the months (optional) 19046 @return string - the date in the above format */ 19047 formatDate: function (format, date, settings) { 19048 if (!date) 19049 return ''; 19050 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; 19051 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; 19052 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; 19053 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; 19054 // Check whether a format character is doubled 19055 var lookAhead = function(match) { 19056 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 19057 if (matches) 19058 iFormat++; 19059 return matches; 19060 }; 19061 // Format a number, with leading zero if necessary 19062 var formatNumber = function(match, value, len) { 19063 var num = '' + value; 19064 if (lookAhead(match)) 19065 while (num.length < len) 19066 num = '0' + num; 19067 return num; 19068 }; 19069 // Format a name, short or long as requested 19070 var formatName = function(match, value, shortNames, longNames) { 19071 return (lookAhead(match) ? longNames[value] : shortNames[value]); 19072 }; 19073 var output = ''; 19074 var literal = false; 19075 if (date) 19076 for (var iFormat = 0; iFormat < format.length; iFormat++) { 19077 if (literal) 19078 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 19079 literal = false; 19080 else 19081 output += format.charAt(iFormat); 19082 else 19083 switch (format.charAt(iFormat)) { 19084 case 'd': 19085 output += formatNumber('d', date.getDate(), 2); 19086 break; 19087 case 'D': 19088 output += formatName('D', date.getDay(), dayNamesShort, dayNames); 19089 break; 19090 case 'o': 19091 output += formatNumber('o', 19092 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 19093 break; 19094 case 'm': 19095 output += formatNumber('m', date.getMonth() + 1, 2); 19096 break; 19097 case 'M': 19098 output += formatName('M', date.getMonth(), monthNamesShort, monthNames); 19099 break; 19100 case 'y': 19101 output += (lookAhead('y') ? date.getFullYear() : 19102 (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); 19103 break; 19104 case '@': 19105 output += date.getTime(); 19106 break; 19107 case '!': 19108 output += date.getTime() * 10000 + this._ticksTo1970; 19109 break;
19110 case "'": 19111 if (lookAhead("'")) 19112 output += "'"; 19113 else 19114 literal = true; 19115 break; 19116 default: 19117 output += format.charAt(iFormat); 19118 } 19119 } 19120 return output; 19121 }, 19122 19123 /* Extract all possible characters from the date format. */ 19124 _possibleChars: function (format) { 19125 var chars = ''; 19126 var literal = false; 19127 // Check whether a format character is doubled 19128 var lookAhead = function(match) { 19129 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); 19130 if (matches) 19131 iFormat++; 19132 return matches; 19133 }; 19134 for (var iFormat = 0; iFormat < format.length; iFormat++) 19135 if (literal) 19136 if (format.charAt(iFormat) == "'" && !lookAhead("'")) 19137 literal = false; 19138 else 19139 chars += format.charAt(iFormat); 19140 else 19141 switch (format.charAt(iFormat)) { 19142 case 'd': case 'm': case 'y': case '@': 19143 chars += '0123456789'; 19144 break; 19145 case 'D': case 'M': 19146 return null; // Accept anything 19147 case "'": 19148 if (lookAhead("'")) 19149 chars += "'"; 19150 else 19151 literal = true; 19152 break; 19153 default: 19154 chars += format.charAt(iFormat); 19155 } 19156 return chars; 19157 }, 19158 19159 /* Get a setting value, defaulting if necessary. */ 19160 _get: function(inst, name) { 19161 return inst.settings[name] !== undefined ? 19162 inst.settings[name] : this._defaults[name]; 19163 }, 19164 19165 /* Parse existing date and initialise date picker. */ 19166 _setDateFromField: function(inst, noDefault) { 19167 if (inst.input.val() == inst.lastVal) { 19168 return; 19169 } 19170 var dateFormat = this._get(inst, 'dateFormat'); 19171 var dates = inst.lastVal = inst.input ? inst.input.val() : null; 19172 var date, defaultDate; 19173 date = defaultDate = this._getDefaultDate(inst); 19174 var settings = this._getFormatConfig(inst); 19175 try { 19176 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 19177 } catch (event) { 19178 this.log(event); 19179 dates = (noDefault ? '' : dates); 19180 } 19181 inst.selectedDay = date.getDate(); 19182 inst.drawMonth = inst.selectedMonth = date.getMonth(); 19183 inst.drawYear = inst.selectedYear = date.getFullYear(); 19184 inst.currentDay = (dates ? date.getDate() : 0); 19185 inst.currentMonth = (dates ? date.getMonth() : 0); 19186 inst.currentYear = (dates ? date.getFullYear() : 0); 19187 this._adjustInstDate(inst); 19188 }, 19189 19190 /* Retrieve the default date shown on opening. */ 19191 _getDefaultDate: function(inst) { 19192 return this._restrictMinMax(inst, 19193 this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); 19194 }, 19195 19196 /* A date may be specified as an exact value or a relative one. */ 19197 _determineDate: function(inst, date, defaultDate) { 19198 var offsetNumeric = function(offset) { 19199 var date = new Date(); 19200 date.setDate(date.getDate() + offset); 19201 return date; 19202 }; 19203 var offsetString = function(offset) { 19204 try { 19205 return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), 19206 offset, $.datepicker._getFormatConfig(inst)); 19207 } 19208 catch (e) { 19209 // Ignore 19210 } 19211 var date = (offset.toLowerCase().match(/^c/) ? 19212 $.datepicker._getDate(inst) : null) || new Date(); 19213 var year = date.getFullYear(); 19214 var month = date.getMonth(); 19215 var day = date.getDate(); 19216 var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; 19217 var matches = pattern.exec(offset); 19218 while (matches) { 19219 switch (matches[2] || 'd') { 19220 case 'd' : case 'D' : 19221 day += parseInt(matches[1],10); break; 19222 case 'w' : case 'W' : 19223 day += parseInt(matches[1],10) * 7; break; 19224 case 'm' : case 'M' : 19225 month += parseInt(matches[1],10); 19226 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 19227 break; 19228 case 'y': case 'Y' : 19229 year += parseInt(matches[1],10); 19230 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 19231 break; 19232 } 19233 matches = pattern.exec(offset); 19234 } 19235 return new Date(year, month, day); 19236 }; 19237 var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : 19238 (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 19239 newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); 19240 if (newDate) { 19241 newDate.setHours(0); 19242 newDate.setMinutes(0); 19243 newDate.setSeconds(0); 19244 newDate.setMilliseconds(0); 19245 } 19246 return this._daylightSavingAdjust(newDate); 19247 }, 19248 19249 /* Handle switch to/from daylight saving. 19250 Hours may be non-zero on daylight saving cut-over: 19251 > 12 when midnight changeover, but then cannot generate 19252 midnight datetime, so jump to 1AM, otherwise reset. 19253 @param date (Date) the date to check 19254 @return (Date) the corrected date */ 19255 _daylightSavingAdjust: function(date) { 19256 if (!date) return null; 19257 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 19258 return date; 19259 }, 19260 19261 /* Set the date(s) directly. */ 19262 _setDate: function(inst, date, noChange) { 19263 var clear = !date; 19264 var origMonth = inst.selectedMonth; 19265 var origYear = inst.selectedYear; 19266 var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 19267 inst.selectedDay = inst.currentDay = newDate.getDate(); 19268 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 19269 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 19270 if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) 19271 this._notifyChange(inst); 19272 this._adjustInstDate(inst); 19273 if (inst.input) { 19274 inst.input.val(clear ? '' : this._formatDate(inst)); 19275 } 19276 }, 19277 19278 /* Retrieve the date(s) directly. */ 19279 _getDate: function(inst) { 19280 var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : 19281 this._daylightSavingAdjust(new Date( 19282 inst.currentYear, inst.currentMonth, inst.currentDay))); 19283 return startDate; 19284 }, 19285 19286 /* Generate the HTML for the current state of the date picker. */ 19287 _generateHTML: function(inst) { 19288 var today = new Date(); 19289 today = this._daylightSavingAdjust( 19290 new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time 19291 var isRTL = this._get(inst, 'isRTL'); 19292 var showButtonPanel = this._get(inst, 'showButtonPanel'); 19293 var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); 19294 var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); 19295 var numMonths = this._getNumberOfMonths(inst); 19296 var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); 19297 var stepMonths = this._get(inst, 'stepMonths'); 19298 var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); 19299 var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 19300 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 19301 var minDate = this._getMinMaxDate(inst, 'min'); 19302 var maxDate = this._getMinMaxDate(inst, 'max'); 19303 var drawMonth = inst.drawMonth - showCurrentAtPos; 19304 var drawYear = inst.drawYear; 19305 if (drawMonth < 0) { 19306 drawMonth += 12; 19307 drawYear--; 19308 } 19309 if (maxDate) { 19310 var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 19311 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 19312 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 19313 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 19314 drawMonth--; 19315 if (drawMonth < 0) { 19316 drawMonth = 11; 19317 drawYear--; 19318 } 19319 } 19320 } 19321 inst.drawMonth = drawMonth; 19322 inst.drawYear = drawYear; 19323 var prevText = this._get(inst, 'prevText'); 19324 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 19325 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 19326 this._getFormatConfig(inst))); 19327 var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 19328 '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid + 19329 '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + 19330 ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : 19331 (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>')); 19332 var nextText = this._get(inst, 'nextText'); 19333 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 19334 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 19335 this._getFormatConfig(inst))); 19336 var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 19337 '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid + 19338 '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' + 19339 ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : 19340 (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>')); 19341 var currentText = this._get(inst, 'currentText'); 19342 var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); 19343 currentText = (!navigationAsDateFormat ? currentText : 19344 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 19345 var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid + 19346 '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : ''); 19347 var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + 19348 (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid + 19349 '.datepicker._gotoToday(\'#' + inst.id + '\');"' + 19350 '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; 19351 var firstDay = parseInt(this._get(inst, 'firstDay'),10); 19352 firstDay = (isNaN(firstDay) ? 0 : firstDay); 19353 var showWeek = this._get(inst, 'showWeek'); 19354 var dayNames = this._get(inst, 'dayNames'); 19355 var dayNamesShort = this._get(inst, 'dayNamesShort'); 19356 var dayNamesMin = this._get(inst, 'dayNamesMin'); 19357 var monthNames = this._get(inst, 'monthNames'); 19358 var monthNamesShort = this._get(inst, 'monthNamesShort'); 19359 var beforeShowDay = this._get(inst, 'beforeShowDay'); 19360 var showOtherMonths = this._get(inst, 'showOtherMonths'); 19361 var selectOtherMonths = this._get(inst, 'selectOtherMonths'); 19362 var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; 19363 var defaultDate = this._getDefaultDate(inst); 19364 var html = ''; 19365 for (var row = 0; row < numMonths[0]; row++) { 19366 var group = ''; 19367 this.maxRows = 4; 19368 for (var col = 0; col < numMonths[1]; col++) { 19369 var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 19370 var cornerClass = ' ui-corner-all'; 19371 var calender = ''; 19372 if (isMultiMonth) { 19373 calender += '<div class="ui-datepicker-group'; 19374 if (numMonths[1] > 1) 19375 switch (col) { 19376 case 0: calender += ' ui-datepicker-group-first'; 19377 cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; 19378 case numMonths[1]-1: calender += ' ui-datepicker-group-last'; 19379 cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; 19380 default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break; 19381 } 19382 calender += '">'; 19383 } 19384 calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + 19385 (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + 19386 (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + 19387 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 19388 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 19389 '</div><table class="ui-datepicker-calendar"><thead>' + 19390 '<tr>'; 19391 var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); 19392 for (var dow = 0; dow < 7; dow++) { // days of the week 19393 var day = (dow + firstDay) % 7; 19394 thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>
19394' + 19395 '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; 19396 } 19397 calender += thead + '</tr></thead><tbody>'; 19398 var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 19399 if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) 19400 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 19401 var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 19402 var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 19403 var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 19404 this.maxRows = numRows; 19405 var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 19406 for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows 19407 calender += '<tr>'; 19408 var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + 19409 this._get(inst, 'calculateWeek')(printDate) + '</td>'); 19410 for (var dow = 0; dow < 7; dow++) { // create date picker days 19411 var daySettings = (beforeShowDay ? 19412 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); 19413 var otherMonth = (printDate.getMonth() != drawMonth); 19414 var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 19415 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 19416 tbody += '<td class="' + 19417 ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends 19418 (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months 19419 ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key 19420 (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? 19421 // or defaultDate is current printedDate and defaultDate is selectedDate 19422 ' ' + this._dayOverClass : '') + // highlight selected day 19423 (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days 19424 (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates 19425 (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day 19426 (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) 19427 ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title 19428 (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + 19429 inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions 19430 (otherMonth && !showOtherMonths ? ' ' : // display for other months 19431 (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + 19432 (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + 19433 (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day 19434 (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months 19435 '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date 19436 printDate.setDate(printDate.getDate() + 1); 19437 printDate = this._daylightSavingAdjust(printDate); 19438 } 19439 calender += tbody + '</tr>'; 19440 } 19441 drawMonth++; 19442 if (drawMonth > 11) { 19443 drawMonth = 0; 19444 drawYear++; 19445 } 19446 calender += '</tbody></table>' + (isMultiMonth ? '</div>' + 19447 ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); 19448 group += calender; 19449 } 19450 html += group; 19451 } 19452 html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? 19453 '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); 19454 inst._keyEvent = false;
19455 return html; 19456 }, 19457 19458 /* Generate the month and year header. */ 19459 _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, 19460 secondary, monthNames, monthNamesShort) { 19461 var changeMonth = this._get(inst, 'changeMonth'); 19462 var changeYear = this._get(inst, 'changeYear'); 19463 var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); 19464 var html = '<div class="ui-datepicker-title">'; 19465 var monthHtml = ''; 19466 // month selection 19467 if (secondary || !changeMonth) 19468 monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>'; 19469 else { 19470 var inMinYear = (minDate && minDate.getFullYear() == drawYear); 19471 var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); 19472 monthHtml += '<select class="ui-datepicker-month" ' + 19473 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' + 19474 '>'; 19475 for (var month = 0; month < 12; month++) { 19476 if ((!inMinYear || month >= minDate.getMonth()) && 19477 (!inMaxYear || month <= maxDate.getMonth())) 19478 monthHtml += '<option value="' + month + '"' + 19479 (month == drawMonth ? ' selected="selected"' : '') + 19480 '>' + monthNamesShort[month] + '</option>'; 19481 } 19482 monthHtml += '</select>'; 19483 } 19484 if (!showMonthAfterYear) 19485 html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); 19486 // year selection 19487 if ( !inst.yearshtml ) { 19488 inst.yearshtml = ''; 19489 if (secondary || !changeYear) 19490 html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; 19491 else { 19492 // determine range of years to display 19493 var years = this._get(inst, 'yearRange').split(':'); 19494 var thisYear = new Date().getFullYear(); 19495 var determineYear = function(value) { 19496 var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : 19497 (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : 19498 parseInt(value, 10))); 19499 return (isNaN(year) ? thisYear : year); 19500 }; 19501 var year = determineYear(years[0]); 19502 var endYear = Math.max(year, determineYear(years[1] || '')); 19503 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 19504 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 19505 inst.yearshtml += '<select class="ui-datepicker-year" ' + 19506 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + 19507 '>'; 19508 for (; year <= endYear; year++) { 19509 inst.yearshtml += '<option value="' + year + '"' + 19510 (year == drawYear ? ' selected="selected"' : '') + 19511 '>' + year + '</option>'; 19512 } 19513 inst.yearshtml += '</select>'; 19514 19515 html += inst.yearshtml; 19516 inst.yearshtml = null; 19517 } 19518 } 19519 html += this._get(inst, 'yearSuffix'); 19520 if (showMonthAfterYear) 19521 html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; 19522 html += '</div>'; // Close datepicker_header 19523 return html; 19524 }, 19525 19526 /* Adjust one of the date sub-fields. */ 19527 _adjustInstDate: function(inst, offset, period) { 19528 var year = inst.drawYear + (period == 'Y' ? offset : 0); 19529 var month = inst.drawMonth + (period == 'M' ? offset : 0); 19530 var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + 19531 (period == 'D' ? offset : 0); 19532 var date = this._restrictMinMax(inst, 19533 this._daylightSavingAdjust(new Date(year, month, day))); 19534 inst.selectedDay = date.getDate(); 19535 inst.drawMonth = inst.selectedMonth = date.getMonth(); 19536 inst.drawYear = inst.selectedYear = date.getFullYear(); 19537 if (period == 'M' || period == 'Y') 19538 this._notifyChange(inst); 19539 }, 19540 19541 /* Ensure a date is within any min/max bounds. */ 19542 _restrictMinMax: function(inst, date) { 19543 var minDate = this._getMinMaxDate(inst, 'min'); 19544 var maxDate = this._getMinMaxDate(inst, 'max'); 19545 var newDate = (minDate && date < minDate ? minDate : date); 19546 newDate = (maxDate && newDate > maxDate ? maxDate : newDate); 19547 return newDate; 19548 }, 19549 19550 /* Notify change of month/year. */ 19551 _notifyChange: function(inst) { 19552 var onChange = this._get(inst, 'onChangeMonthYear'); 19553 if (onChange) 19554 onChange.apply((inst.input ? inst.input[0] : null), 19555 [inst.selectedYear, inst.selectedMonth + 1, inst]); 19556 }, 19557 19558 /* Determine the number of months to show. */ 19559 _getNumberOfMonths: function(inst) { 19560 var numMonths = this._get(inst, 'numberOfMonths'); 19561 return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); 19562 }, 19563 19564 /* Determine the current maximum date - ensure no time components are set. */ 19565 _getMinMaxDate: function(inst, minMax) { 19566 return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); 19567 }, 19568 19569 /* Find the number of days in a given month. */ 19570 _getDaysInMonth: function(year, month) { 19571 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 19572 }, 19573 19574 /* Find the day of the week of the first of a month. */ 19575 _getFirstDayOfMonth: function(year, month) { 19576 return new Date(year, month, 1).getDay(); 19577 }, 19578 19579 /* Determines if we should allow a "next/prev" month display change. */ 19580 _canAdjustMonth: function(inst, offset, curYear, curMonth) { 19581 var numMonths = this._getNumberOfMonths(inst); 19582 var date = this._daylightSavingAdjust(new Date(curYear, 19583 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 19584 if (offset < 0) 19585 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 19586 return this._isInRange(inst, date); 19587 }, 19588 19589 /* Is the given date in the accepted range? */ 19590 _isInRange: function(inst, date) { 19591 var minDate = this._getMinMaxDate(inst, 'min'); 19592 var maxDate = this._getMinMaxDate(inst, 'max'); 19593 return ((!minDate || date.getTime() >= minDate.getTime()) && 19594 (!maxDate || date.getTime() <= maxDate.getTime())); 19595 }, 19596 19597 /* Provide the configuration settings for formatting/parsing. */ 19598 _getFormatConfig: function(inst) { 19599 var shortYearCutoff = this._get(inst, 'shortYearCutoff'); 19600 shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : 19601 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 19602 return {shortYearCutoff: shortYearCutoff, 19603 dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), 19604 monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; 19605 }, 19606 19607 /* Format the given date for display. */ 19608 _formatDate: function(inst, day, month, year) { 19609 if (!day) { 19610 inst.currentDay = inst.selectedDay; 19611 inst.currentMonth = inst.selectedMonth; 19612 inst.currentYear = inst.selectedYear; 19613 } 19614 var date = (day ? (typeof day == 'object' ? day : 19615 this._daylightSavingAdjust(new Date(year, month, day))) : 19616 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 19617 return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); 19618 } 19619}); 19620 19621/* 19622 * Bind hover events for datepicker elements. 19623 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 19624 * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 19625 */ 19626function bindHover(dpDiv) { 19627 var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; 19628 return dpDiv.bind('mouseout', function(event) { 19629 var elem = $( event.target ).closest( selector ); 19630 if ( !elem.length ) { 19631 return; 19632 } 19633 elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); 19634 }) 19635 .bind('mouseover', function(event) { 19636 var elem = $( event.target ).closest( selector ); 19637 if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || 19638 !elem.length ) { 19639 return; 19640 } 19641 elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); 19642 elem.addClass('ui-state-hover'); 19643 if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); 19644 if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); 19645 }); 19646} 19647 19648/* jQuery extend now ignores nulls! */ 19649function extendRemove(target, props) { 19650 $.extend(target, props); 19651 for (var name in props) 19652 if (props[name] == null || props[name] == undefined) 19653 target[name] = props[name]; 19654 return target; 19655}; 19656 19657/* Determine whether an object is an array. */ 19658function isArray(a) { 19659 return (a && (($.browser.safari && typeof a == 'object' && a.length) || 19660 (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); 19661}; 19662 19663/* Invoke the datepicker functionality. 19664 @param options string - a command, optionally followed by additional parameters or 19665 Object - settings for attaching new datepicker functionality 19666 @return jQuery object */ 19667$.fn.datepicker = function(options){ 19668 19669 /* Verify an empty collection wasn't passed - Fixes #6976 */ 19670 if ( !this.length ) { 19671 return this; 19672 } 19673 19674 /* Initialise the date picker. */ 19675 if (!$.datepicker.initialized) { 19676 $(document).mousedown($.datepicker._checkExternalClick). 19677 find('body').append($.datepicker.dpDiv); 19678 $.datepicker.initialized = true; 19679 } 19680 19681 var otherArgs = Array.prototype.slice.call(arguments, 1); 19682 if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) 19683 return $.datepicker['_' + options + 'Datepicker']. 19684 apply($.datepicker, [this[0]].concat(otherArgs)); 19685 if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') 19686 return $.datepicker['_' + options + 'Datepicker']. 19687 apply($.datepicker, [this[0]].concat(otherArgs)); 19688 return this.each(function() { 19689 typeof options == 'string' ? 19690 $.datepicker['_' + options + 'Datepicker']. 19691 apply($.datepicker, [this].concat(otherArgs)) : 19692 $.datepicker._attachDatepicker(this, options); 19693 }); 19694}; 19695 19696$.datepicker = new Datepicker(); // singleton instance 19697$.datepicker.initialized = false;
19698$.datepicker.uuid = new Date().getTime(); 19699$.datepicker.version = "1.8.16"; 19700 19701// Workaround for #4055 19702// Add another global to avoid noConflict issues with inline event handlers 19703window['DP_jQuery_' + dpuuid] = $; 19704 19705})(jQuery); 19706/* 19707 * jQuery UI Progressbar 1.8.16 19708 * 19709 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 19710 * Dual licensed under the MIT or GPL Version 2 licenses. 19711 * http://jquery.org/license 19712 * 19713 * http://docs.jquery.com/UI/Progressbar 19714 * 19715 * Depends: 19716 * jquery.ui.core.js 19717 * jquery.ui.widget.js 19718 */ 19719(function( $, undefined ) { 19720 19721$.widget( "ui.progressbar", { 19722 options: { 19723 value: 0, 19724 max: 100 19725 }, 19726 19727 min: 0, 19728 19729 _create: function() { 19730 this.element 19731 .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) 19732 .attr({ 19733 role: "progressbar", 19734 "aria-valuemin": this.min, 19735 "aria-valuemax": this.options.max, 19736 "aria-valuenow": this._value() 19737 }); 19738 19739 this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) 19740 .appendTo( this.element ); 19741 19742 this.oldValue = this._value(); 19743 this._refreshValue(); 19744 }, 19745 19746 destroy: function() { 19747 this.element 19748 .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) 19749 .removeAttr( "role" ) 19750 .removeAttr( "aria-valuemin" ) 19751 .removeAttr( "aria-valuemax" ) 19752 .removeAttr( "aria-valuenow" ); 19753 19754 this.valueDiv.remove(); 19755 19756 $.Widget.prototype.destroy.apply( this, arguments ); 19757 }, 19758 19759 value: function( newValue ) { 19760 if ( newValue === undefined ) { 19761 return this._value(); 19762 } 19763 19764 this._setOption( "value", newValue ); 19765 return this; 19766 }, 19767 19768 _setOption: function( key, value ) { 19769 if ( key === "value" ) { 19770 this.options.value = value; 19771 this._refreshValue(); 19772 if ( this._value() === this.options.max ) { 19773 this._trigger( "complete" ); 19774 } 19775 } 19776 19777 $.Widget.prototype._setOption.apply( this, arguments ); 19778 }, 19779 19780 _value: function() { 19781 var val = this.options.value; 19782 // normalize invalid value 19783 if ( typeof val !== "number" ) { 19784 val = 0; 19785 } 19786 return Math.min( this.options.max, Math.max( this.min, val ) ); 19787 }, 19788 19789 _percentage: function() { 19790 return 100 * this._value() / this.options.max; 19791 }, 19792 19793 _refreshValue: function() { 19794 var value = this.value(); 19795 var percentage = this._percentage(); 19796 19797 if ( this.oldValue !== value ) { 19798 this.oldValue = value; 19799 this._trigger( "change" ); 19800 } 19801 19802 this.valueDiv 19803 .toggle( value > this.min ) 19804 .toggleClass( "ui-corner-right", value === this.options.max ) 19805 .width( percentage.toFixed(0) + "%" ); 19806 this.element.attr( "aria-valuenow", value ); 19807 } 19808}); 19809 19810$.extend( $.ui.progressbar, { 19811 version: "1.8.16" 19812}); 19813 19814})( jQuery ); 19815/* 19816 * jQuery UI Effects 1.8.16 19817 * 19818 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 19819 * Dual licensed under the MIT or GPL Version 2 licenses. 19820 * http://jquery.org/license 19821 * 19822 * http://docs.jquery.com/UI/Effects/ 19823 */ 19824;jQuery.effects || (function($, undefined) { 19825 19826$.effects = {}; 19827 19828 19829 19830/******************************************************************************/ 19831/****************************** COLOR ANIMATIONS ******************************/ 19832/******************************************************************************/ 19833 19834// override the animation for color styles 19835$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 19836 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'], 19837function(i, attr) { 19838 $.fx.step[attr] = function(fx) { 19839 if (!fx.colorInit) { 19840 fx.start = getColor(fx.elem, attr); 19841 fx.end = getRGB(fx.end); 19842 fx.colorInit = true; 19843 } 19844 19845 fx.elem.style[attr] = 'rgb(' + 19846 Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' + 19847 Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' + 19848 Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')'; 19849 }; 19850}); 19851 19852// Color Conversion functions from highlightFade 19853// By Blair Mitchelmore 19854// http://jquery.offput.ca/highlightFade/ 19855 19856// Parse strings looking for color tuples [255,255,255] 19857function getRGB(color) { 19858 var result; 19859 19860 // Check if we're already dealing with an array of colors 19861 if ( color && color.constructor == Array && color.length == 3 ) 19862 return color; 19863 19864 // Look for rgb(num,num,num) 19865 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 19866 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; 19867 19868 // Look for rgb(num%,num%,num%) 19869 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 19870 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 19871 19872 // Look for #a0b1c2 19873 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 19874 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 19875 19876 // Look for #fff 19877 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 19878 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 19879 19880 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 19881 if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) 19882 return colors['transparent']; 19883 19884 // Otherwise, we're most likely dealing with a named color 19885 return colors[$.trim(color).toLowerCase()]; 19886} 19887 19888function getColor(elem, attr) { 19889 var color; 19890 19891 do { 19892 color = $.curCSS(elem, attr); 19893 19894 // Keep going until we find an element that has color, or we hit the body 19895 if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) 19896 break; 19897 19898 attr = "backgroundColor";
19899 } while ( elem = elem.parentNode ); 19900 19901 return getRGB(color); 19902}; 19903 19904// Some named colors to work with 19905// From Interface by Stefan Petre 19906// http://interface.eyecon.ro/ 19907 19908var colors = { 19909 aqua:[0,255,255], 19910 azure:[240,255,255], 19911 beige:[245,245,220], 19912 black:[0,0,0], 19913 blue:[0,0,255], 19914 brown:[165,42,42], 19915 cyan:[0,255,255], 19916 darkblue:[0,0,139], 19917 darkcyan:[0,139,139], 19918 darkgrey:[169,169,169], 19919 darkgreen:[0,100,0], 19920 darkkhaki:[189,183,107], 19921 darkmagenta:[139,0,139], 19922 darkolivegreen:[85,107,47], 19923 darkorange:[255,140,0], 19924 darkorchid:[153,50,204], 19925 darkred:[139,0,0], 19926 darksalmon:[233,150,122], 19927 darkviolet:[148,0,211], 19928 fuchsia:[255,0,255], 19929 gold:[255,215,0], 19930 green:[0,128,0], 19931 indigo:[75,0,130], 19932 khaki:[240,230,140], 19933 lightblue:[173,216,230], 19934 lightcyan:[224,255,255], 19935 lightgreen:[144,238,144], 19936 lightgrey:[211,211,211], 19937 lightpink:[255,182,193], 19938 lightyellow:[255,255,224], 19939 lime:[0,255,0], 19940 magenta:[255,0,255], 19941 maroon:[128,0,0], 19942 navy:[0,0,128], 19943 olive:[128,128,0], 19944 orange:[255,165,0], 19945 pink:[255,192,203], 19946 purple:[128,0,128], 19947 violet:[128,0,128], 19948 red:[255,0,0], 19949 silver:[192,192,192], 19950 white:[255,255,255], 19951 yellow:[255,255,0], 19952 transparent: [255,255,255] 19953}; 19954 19955 19956 19957/******************************************************************************/ 19958/****************************** CLASS ANIMATIONS ******************************/ 19959/******************************************************************************/ 19960 19961var classAnimationActions = ['add', 'remove', 'toggle'], 19962 shorthandStyles = { 19963 border: 1, 19964 borderBottom: 1, 19965 borderColor: 1, 19966 borderLeft: 1, 19967 borderRight: 1, 19968 borderTop: 1, 19969 borderWidth: 1, 19970 margin: 1, 19971 padding: 1 19972 }; 19973 19974function getElementStyles() { 19975 var style = document.defaultView 19976 ? document.defaultView.getComputedStyle(this, null) 19977 : this.currentStyle, 19978 newStyle = {}, 19979 key, 19980 camelCase; 19981 19982 // webkit enumerates style porperties 19983 if (style && style.length && style[0] && style[style[0]]) { 19984 var len = style.length; 19985 while (len--) { 19986 key = style[len]; 19987 if (typeof style[key] == 'string') { 19988 camelCase = key.replace(/\-(\w)/g, function(all, letter){ 19989 return letter.toUpperCase(); 19990 }); 19991 newStyle[camelCase] = style[key]; 19992 } 19993 } 19994 } else { 19995 for (key in style) { 19996 if (typeof style[key] === 'string') { 19997 newStyle[key] = style[key]; 19998 } 19999 } 20000 } 20001 20002 return newStyle; 20003} 20004 20005function filterStyles(styles) { 20006 var name, value; 20007 for (name in styles) { 20008 value = styles[name]; 20009 if ( 20010 // ignore null and undefined values 20011 value == null || 20012 // ignore functions (when does this occur?) 20013 $.isFunction(value) || 20014 // shorthand styles that need to be expanded 20015 name in shorthandStyles || 20016 // ignore scrollbars (break in IE) 20017 (/scrollbar/).test(name) || 20018 20019 // only colors or values that can be converted to numbers 20020 (!(/color/i).test(name) && isNaN(parseFloat(value))) 20021 ) { 20022 delete styles[name]; 20023 } 20024 } 20025 20026 return styles; 20027} 20028 20029function styleDifference(oldStyle, newStyle) { 20030 var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459 20031 name; 20032 20033 for (name in newStyle) { 20034 if (oldStyle[name] != newStyle[name]) { 20035 diff[name] = newStyle[name]; 20036 } 20037 } 20038 20039 return diff; 20040} 20041 20042$.effects.animateClass = function(value, duration, easing, callback) { 20043 if ($.isFunction(easing)) { 20044 callback = easing; 20045 easing = null; 20046 } 20047 20048 return this.queue(function() { 20049 var that = $(this), 20050 originalStyleAttr = that.attr('style') || ' ', 20051 originalStyle = filterStyles(getElementStyles.call(this)), 20052 newStyle, 20053 className = that.attr('class'); 20054 20055 $.each(classAnimationActions, function(i, action) { 20056 if (value[action]) { 20057 that[action + 'Class'](value[action]); 20058 } 20059 }); 20060 newStyle = filterStyles(getElementStyles.call(this)); 20061 that.attr('class', className); 20062 20063 that.animate(styleDifference(originalStyle, newStyle), { 20064 queue: false, 20065 duration: duration, 20066 easing: easing, 20067 complete: function() { 20068 $.each(classAnimationActions, function(i, action) { 20069 if (value[action]) { that[action + 'Class'](value[action]); } 20070 }); 20071 // work around bug in IE by clearing the cssText before setting it 20072 if (typeof that.attr('style') == 'object') { 20073 that.attr('style').cssText = ''; 20074 that.attr('style').cssText = originalStyleAttr; 20075 } else { 20076 that.attr('style', originalStyleAttr); 20077 } 20078 if (callback) { callback.apply(this, arguments); } 20079 $.dequeue( this ); 20080 } 20081 }); 20082 }); 20083}; 20084 20085$.fn.extend({ 20086 _addClass: $.fn.addClass, 20087 addClass: function(classNames, speed, easing, callback) { 20088 return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); 20089 }, 20090 20091 _removeClass: $.fn.removeClass, 20092 removeClass: function(classNames,speed,easing,callback) { 20093 return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); 20094 }, 20095 20096 _toggleClass: $.fn.toggleClass, 20097 toggleClass: function(classNames, force, speed, easing, callback) { 20098 if ( typeof force == "boolean" || force === undefined ) { 20099 if ( !speed ) { 20100 // without speed parameter; 20101 return this._toggleClass(classNames, force); 20102 } else { 20103 return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); 20104 } 20105 } else { 20106 // without switch parameter; 20107 return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); 20108 } 20109 }, 20110 20111 switchClass: function(remove,add,speed,easing,callback) { 20112 return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); 20113 } 20114}); 20115 20116 20117 20118/******************************************************************************/ 20119/*********************************** EFFECTS **********************************/ 20120/******************************************************************************/ 20121 20122$.extend($.effects, { 20123 version: "1.8.16", 20124 20125 // Saves a set of properties in a data storage 20126 save: function(element, set) { 20127 for(var i=0; i < set.length; i++) { 20128 if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); 20129 } 20130 }, 20131 20132 // Restores a set of previously saved properties from a data storage 20133 restore: function(element, set) { 20134 for(var i=0; i < set.length; i++) { 20135 if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); 20136 } 20137 }, 20138 20139 setMode: function(el, mode) { 20140 if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle 20141 return mode; 20142 }, 20143 20144 getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value 20145 // this should be a little more flexible in the future to handle a string & hash 20146 var y, x; 20147 switch (origin[0]) { 20148 case 'top': y = 0; break; 20149 case 'middle': y = 0.5; break; 20150 case 'bottom': y = 1; break; 20151 default: y = origin[0] / original.height; 20152 }; 20153 switch (origin[1]) { 20154 case 'left': x = 0; break; 20155 case 'center': x = 0.5; break; 20156 case 'right': x = 1; break; 20157 default: x = origin[1] / original.width; 20158 }; 20159 return {x: x, y: y}; 20160 }, 20161
20162 // Wraps the element around a wrapper that copies position properties 20163 createWrapper: function(element) { 20164 20165 // if the element is already wrapped, return it 20166 if (element.parent().is('.ui-effects-wrapper')) { 20167 return element.parent(); 20168 } 20169 20170 // wrap the element 20171 var props = { 20172 width: element.outerWidth(true), 20173 height: element.outerHeight(true), 20174 'float': element.css('float') 20175 }, 20176 wrapper = $('<div></div>') 20177 .addClass('ui-effects-wrapper') 20178 .css({ 20179 fontSize: '100%', 20180 background: 'transparent', 20181 border: 'none', 20182 margin: 0, 20183 padding: 0 20184 }), 20185 active = document.activeElement; 20186 20187 element.wrap(wrapper); 20188 20189 // Fixes #7595 - Elements lose focus when wrapped. 20190 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 20191 $( active ).focus(); 20192 } 20193 20194 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element 20195 20196 // transfer positioning properties to the wrapper 20197 if (element.css('position') == 'static') { 20198 wrapper.css({ position: 'relative' }); 20199 element.css({ position: 'relative' }); 20200 } else { 20201 $.extend(props, { 20202 position: element.css('position'), 20203 zIndex: element.css('z-index') 20204 }); 20205 $.each(['top', 'left', 'bottom', 'right'], function(i, pos) { 20206 props[pos] = element.css(pos); 20207 if (isNaN(parseInt(props[pos], 10))) { 20208 props[pos] = 'auto'; 20209 } 20210 }); 20211 element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' }); 20212 } 20213 20214 return wrapper.css(props).show(); 20215 }, 20216 20217 removeWrapper: function(element) { 20218 var parent, 20219 active = document.activeElement; 20220 20221 if (element.parent().is('.ui-effects-wrapper')) { 20222 parent = element.parent().replaceWith(element); 20223 // Fixes #7595 - Elements lose focus when wrapped. 20224 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 20225 $( active ).focus(); 20226 } 20227 return parent; 20228 } 20229 20230 return element; 20231 }, 20232 20233 setTransition: function(element, list, factor, value) { 20234 value = value || {}; 20235 $.each(list, function(i, x){ 20236 unit = element.cssUnit(x); 20237 if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; 20238 }); 20239 return value; 20240 } 20241}); 20242 20243 20244function _normalizeArguments(effect, options, speed, callback) { 20245 // shift params for method overloading 20246 if (typeof effect == 'object') { 20247 callback = options; 20248 speed = null; 20249 options = effect; 20250 effect = options.effect; 20251 } 20252 if ($.isFunction(options)) { 20253 callback = options; 20254 speed = null; 20255 options = {}; 20256 } 20257 if (typeof options == 'number' || $.fx.speeds[options]) { 20258 callback = speed; 20259 speed = options; 20260 options = {}; 20261 } 20262 if ($.isFunction(speed)) { 20263 callback = speed; 20264 speed = null; 20265 } 20266 20267 options = options || {}; 20268 20269 speed = speed || options.duration; 20270 speed = $.fx.off ? 0 : typeof speed == 'number' 20271 ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default; 20272 20273 callback = callback || options.complete; 20274 20275 return [effect, options, speed, callback]; 20276} 20277 20278function standardSpeed( speed ) { 20279 // valid standard speeds 20280 if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { 20281 return true; 20282 } 20283 20284 // invalid strings - treat as "normal" speed 20285 if ( typeof speed === "string" && !$.effects[ speed ] ) { 20286 return true; 20287 } 20288 20289 return false; 20290} 20291 20292$.fn.extend({ 20293 effect: function(effect, options, speed, callback) { 20294 var args = _normalizeArguments.apply(this, arguments), 20295 // TODO: make effects take actual parameters instead of a hash 20296 args2 = { 20297 options: args[1], 20298 duration: args[2], 20299 callback: args[3] 20300 }, 20301 mode = args2.options.mode, 20302 effectMethod = $.effects[effect]; 20303 20304 if ( $.fx.off || !effectMethod ) { 20305 // delegate to the original method (e.g., .show()) if possible 20306 if ( mode ) { 20307 return this[ mode ]( args2.duration, args2.callback ); 20308 } else { 20309 return this.each(function() { 20310 if ( args2.callback ) { 20311 args2.callback.call( this ); 20312 } 20313 }); 20314 } 20315 } 20316 20317 return effectMethod.call(this, args2); 20318 }, 20319 20320 _show: $.fn.show, 20321 show: function(speed) { 20322 if ( standardSpeed( speed ) ) { 20323 return this._show.apply(this, arguments); 20324 } else { 20325 var args = _normalizeArguments.apply(this, arguments); 20326 args[1].mode = 'show'; 20327 return this.effect.apply(this, args); 20328 } 20329 }, 20330 20331 _hide: $.fn.hide, 20332 hide: function(speed) { 20333 if ( standardSpeed( speed ) ) { 20334 return this._hide.apply(this, arguments); 20335 } else { 20336 var args = _normalizeArguments.apply(this, arguments); 20337 args[1].mode = 'hide'; 20338 return this.effect.apply(this, args); 20339 } 20340 }, 20341 20342 // jQuery core overloads toggle and creates _toggle 20343 __toggle: $.fn.toggle, 20344 toggle: function(speed) { 20345 if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { 20346 return this.__toggle.apply(this, arguments); 20347 } else { 20348 var args = _normalizeArguments.apply(this, arguments); 20349 args[1].mode = 'toggle'; 20350 return this.effect.apply(this, args); 20351 } 20352 }, 20353 20354 // helper functions 20355 cssUnit: function(key) { 20356 var style = this.css(key), val = []; 20357 $.each( ['em','px','%','pt'], function(i, unit){ 20358 if(style.indexOf(unit) > 0) 20359 val = [parseFloat(style), unit]; 20360 }); 20361 return val; 20362 } 20363}); 20364 20365 20366 20367/******************************************************************************/ 20368/*********************************** EASING ***********************************/ 20369/******************************************************************************/ 20370 20371/* 20372 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 20373 * 20374 * Uses the built in easing capabilities added In jQuery 1.1 20375 * to offer multiple easing options 20376 * 20377 * TERMS OF USE - jQuery Easing 20378 * 20379 * Open source under the BSD License. 20380 * 20381 * Copyright 2008 George McGinley Smith 20382 * All rights reserved. 20383 * 20384 * Redistribution and use in source and binary forms, with or without modification, 20385 * are permitted provided that the following conditions are met: 20386 * 20387 * Redistributions of source code must retain the above copyright notice, this list of 20388 * conditions and the following disclaimer. 20389 * Redistributions in binary form must reproduce the above copyright notice, this list 20390 * of conditions and the following disclaimer in the documentation and/or other materials 20391 * provided with the distribution. 20392 * 20393 * Neither the name of the author nor the names of contributors may be used to endorse 20394 * or promote products derived from this software without specific prior written permission. 20395 * 20396 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20397 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20398 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20399 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,027 bytes, lines 20400-20545
20400 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 20401 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20402 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20403 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 20404 * OF THE POSSIBILITY OF SUCH DAMAGE. 20405 * 20406*/ 20407 20408// t: current time, b: begInnIng value, c: change In value, d: duration 20409$.easing.jswing = $.easing.swing; 20410 20411$.extend($.easing, 20412{ 20413 def: 'easeOutQuad', 20414 swing: function (x, t, b, c, d) { 20415 //alert($.easing.default); 20416 return $.easing[$.easing.def](x, t, b, c, d); 20417 }, 20418 easeInQuad: function (x, t, b, c, d) { 20419 return c*(t/=d)*t + b; 20420 }, 20421 easeOutQuad: function (x, t, b, c, d) { 20422 return -c *(t/=d)*(t-2) + b; 20423 }, 20424 easeInOutQuad: function (x, t, b, c, d) { 20425 if ((t/=d/2) < 1) return c/2*t*t + b; 20426 return -c/2 * ((--t)*(t-2) - 1) + b; 20427 }, 20428 easeInCubic: function (x, t, b, c, d) { 20429 return c*(t/=d)*t*t + b; 20430 }, 20431 easeOutCubic: function (x, t, b, c, d) { 20432 return c*((t=t/d-1)*t*t + 1) + b; 20433 }, 20434 easeInOutCubic: function (x, t, b, c, d) { 20435 if ((t/=d/2) < 1) return c/2*t*t*t + b; 20436 return c/2*((t-=2)*t*t + 2) + b; 20437 }, 20438 easeInQuart: function (x, t, b, c, d) { 20439 return c*(t/=d)*t*t*t + b; 20440 }, 20441 easeOutQuart: function (x, t, b, c, d) { 20442 return -c * ((t=t/d-1)*t*t*t - 1) + b; 20443 }, 20444 easeInOutQuart: function (x, t, b, c, d) { 20445 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 20446 return -c/2 * ((t-=2)*t*t*t - 2) + b; 20447 }, 20448 easeInQuint: function (x, t, b, c, d) { 20449 return c*(t/=d)*t*t*t*t + b; 20450 }, 20451 easeOutQuint: function (x, t, b, c, d) { 20452 return c*((t=t/d-1)*t*t*t*t + 1) + b; 20453 }, 20454 easeInOutQuint: function (x, t, b, c, d) { 20455 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 20456 return c/2*((t-=2)*t*t*t*t + 2) + b; 20457 }, 20458 easeInSine: function (x, t, b, c, d) { 20459 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 20460 }, 20461 easeOutSine: function (x, t, b, c, d) { 20462 return c * Math.sin(t/d * (Math.PI/2)) + b; 20463 }, 20464 easeInOutSine: function (x, t, b, c, d) { 20465 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 20466 }, 20467 easeInExpo: function (x, t, b, c, d) { 20468 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 20469 }, 20470 easeOutExpo: function (x, t, b, c, d) { 20471 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 20472 }, 20473 easeInOutExpo: function (x, t, b, c, d) { 20474 if (t==0) return b; 20475 if (t==d) return b+c; 20476 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 20477 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 20478 }, 20479 easeInCirc: function (x, t, b, c, d) { 20480 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 20481 }, 20482 easeOutCirc: function (x, t, b, c, d) { 20483 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 20484 }, 20485 easeInOutCirc: function (x, t, b, c, d) { 20486 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 20487 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 20488 }, 20489 easeInElastic: function (x, t, b, c, d) { 20490 var s=1.70158;var p=0;var a=c; 20491 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 20492 if (a < Math.abs(c)) { a=c; var s=p/4; } 20493 else var s = p/(2*Math.PI) * Math.asin (c/a); 20494 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 20495 }, 20496 easeOutElastic: function (x, t, b, c, d) { 20497 var s=1.70158;var p=0;var a=c; 20498 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 20499 if (a < Math.abs(c)) { a=c; var s=p/4; } 20500 else var s = p/(2*Math.PI) * Math.asin (c/a); 20501 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 20502 }, 20503 easeInOutElastic: function (x, t, b, c, d) { 20504 var s=1.70158;var p=0;var a=c; 20505 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 20506 if (a < Math.abs(c)) { a=c; var s=p/4; } 20507 else var s = p/(2*Math.PI) * Math.asin (c/a); 20508 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 20509 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 20510 }, 20511 easeInBack: function (x, t, b, c, d, s) { 20512 if (s == undefined) s = 1.70158; 20513 return c*(t/=d)*t*((s+1)*t - s) + b; 20514 }, 20515 easeOutBack: function (x, t, b, c, d, s) { 20516 if (s == undefined) s = 1.70158; 20517 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 20518 }, 20519 easeInOutBack: function (x, t, b, c, d, s) { 20520 if (s == undefined) s = 1.70158; 20521 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 20522 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 20523 }, 20524 easeInBounce: function (x, t, b, c, d) { 20525 return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; 20526 }, 20527 easeOutBounce: function (x, t, b, c, d) { 20528 if ((t/=d) < (1/2.75)) { 20529 return c*(7.5625*t*t) + b; 20530 } else if (t < (2/2.75)) { 20531 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 20532 } else if (t < (2.5/2.75)) { 20533 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 20534 } else { 20535 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 20536 } 20537 }, 20538 easeInOutBounce: function (x, t, b, c, d) { 20539 if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 20540 return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 20541 } 20542}); 20543 20544/* 20545 *
20546 * TERMS OF USE - EASING EQUATIONS 20547 * 20548 * Open source under the BSD License. 20549 * 20550 * Copyright 2001 Robert Penner 20551 * All rights reserved. 20552 * 20553 * Redistribution and use in source and binary forms, with or without modification, 20554 * are permitted provided that the following conditions are met: 20555 * 20556 * Redistributions of source code must retain the above copyright notice, this list of 20557 * conditions and the following disclaimer. 20558 * Redistributions in binary form must reproduce the above copyright notice, this list 20559 * of conditions and the following disclaimer in the documentation and/or other materials 20560 * provided with the distribution. 20561 * 20562 * Neither the name of the author nor the names of contributors may be used to endorse 20563 * or promote products derived from this software without specific prior written permission. 20564 * 20565 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20566 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20567 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20568 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20569 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 20570 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 20571 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20572 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 20573 * OF THE POSSIBILITY OF SUCH DAMAGE. 20574 * 20575 */ 20576 20577})(jQuery); 20578/* 20579 * jQuery UI Effects Blind 1.8.16 20580 * 20581 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20582 * Dual licensed under the MIT or GPL Version 2 licenses. 20583 * http://jquery.org/license 20584 * 20585 * http://docs.jquery.com/UI/Effects/Blind 20586 * 20587 * Depends: 20588 * jquery.effects.core.js 20589 */ 20590(function( $, undefined ) { 20591 20592$.effects.blind = function(o) { 20593 20594 return this.queue(function() { 20595 20596 // Create element 20597 var el = $(this), props = ['position','top','bottom','left','right']; 20598 20599 // Set options 20600 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 20601 var direction = o.options.direction || 'vertical'; // Default direction 20602 20603 // Adjust 20604 $.effects.save(el, props); el.show(); // Save & Show 20605 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 20606 var ref = (direction == 'vertical') ? 'height' : 'width'; 20607 var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); 20608 if(mode == 'show') wrapper.css(ref, 0); // Shift 20609 20610 // Animation 20611 var animation = {}; 20612 animation[ref] = mode == 'show' ? distance : 0; 20613 20614 // Animate 20615 wrapper.animate(animation, o.duration, o.options.easing, function() { 20616 if(mode == 'hide') el.hide(); // Hide 20617 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20618 if(o.callback) o.callback.apply(el[0], arguments); // Callback 20619 el.dequeue(); 20620 }); 20621 20622 }); 20623 20624}; 20625 20626})(jQuery); 20627/* 20628 * jQuery UI Effects Bounce 1.8.16 20629 * 20630 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20631 * Dual licensed under the MIT or GPL Version 2 licenses. 20632 * http://jquery.org/license 20633 * 20634 * http://docs.jquery.com/UI/Effects/Bounce 20635 * 20636 * Depends: 20637 * jquery.effects.core.js 20638 */ 20639(function( $, undefined ) { 20640 20641$.effects.bounce = function(o) { 20642 20643 return this.queue(function() { 20644 20645 // Create element 20646 var el = $(this), props = ['position','top','bottom','left','right']; 20647 20648 // Set options 20649 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 20650 var direction = o.options.direction || 'up'; // Default direction 20651 var distance = o.options.distance || 20; // Default distance 20652 var times = o.options.times || 5; // Default # of times 20653 var speed = o.duration || 250; // Default speed per bounce 20654 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE 20655 20656 // Adjust 20657 $.effects.save(el, props); el.show(); // Save & Show 20658 $.effects.createWrapper(el); // Create Wrapper 20659 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 20660 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
20661 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); 20662 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 20663 if (mode == 'hide') distance = distance / (times * 2); 20664 if (mode != 'hide') times--; 20665 20666 // Animate 20667 if (mode == 'show') { // Show Bounce 20668 var animation = {opacity: 1}; 20669 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 20670 el.animate(animation, speed / 2, o.options.easing); 20671 distance = distance / 2; 20672 times--; 20673 }; 20674 for (var i = 0; i < times; i++) { // Bounces 20675 var animation1 = {}, animation2 = {}; 20676 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 20677 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 20678 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); 20679 distance = (mode == 'hide') ? distance * 2 : distance / 2; 20680 }; 20681 if (mode == 'hide') { // Last Bounce 20682 var animation = {opacity: 0}; 20683 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 20684 el.animate(animation, speed / 2, o.options.easing, function(){ 20685 el.hide(); // Hide 20686 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20687 if(o.callback) o.callback.apply(this, arguments); // Callback 20688 }); 20689 } else { 20690 var animation1 = {}, animation2 = {}; 20691 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 20692 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; 20693 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ 20694 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20695 if(o.callback) o.callback.apply(this, arguments); // Callback 20696 }); 20697 }; 20698 el.queue('fx', function() { el.dequeue(); }); 20699 el.dequeue(); 20700 }); 20701 20702}; 20703 20704})(jQuery); 20705/* 20706 * jQuery UI Effects Clip 1.8.16 20707 * 20708 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20709 * Dual licensed under the MIT or GPL Version 2 licenses. 20710 * http://jquery.org/license 20711 * 20712 * http://docs.jquery.com/UI/Effects/Clip 20713 * 20714 * Depends: 20715 * jquery.effects.core.js 20716 */ 20717(function( $, undefined ) { 20718 20719$.effects.clip = function(o) { 20720 20721 return this.queue(function() { 20722 20723 // Create element 20724 var el = $(this), props = ['position','top','bottom','left','right','height','width']; 20725 20726 // Set options 20727 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 20728 var direction = o.options.direction || 'vertical'; // Default direction 20729 20730 // Adjust 20731 $.effects.save(el, props); el.show(); // Save & Show 20732 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 20733 var animate = el[0].tagName == 'IMG' ? wrapper : el; 20734 var ref = { 20735 size: (direction == 'vertical') ? 'height' : 'width', 20736 position: (direction == 'vertical') ? 'top' : 'left' 20737 }; 20738 var distance = (direction == 'vertical') ? animate.height() : animate.width(); 20739 if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift 20740 20741 // Animation 20742 var animation = {}; 20743 animation[ref.size] = mode == 'show' ? distance : 0; 20744 animation[ref.position] = mode == 'show' ? 0 : distance / 2; 20745 20746 // Animate 20747 animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 20748 if(mode == 'hide') el.hide(); // Hide 20749 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20750 if(o.callback) o.callback.apply(el[0], arguments); // Callback 20751 el.dequeue(); 20752 }}); 20753 20754 }); 20755 20756}; 20757 20758})(jQuery); 20759/* 20760 * jQuery UI Effects Drop 1.8.16 20761 * 20762 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20763 * Dual licensed under the MIT or GPL Version 2 licenses. 20764 * http://jquery.org/license 20765 * 20766 * http://docs.jquery.com/UI/Effects/Drop 20767 * 20768 * Depends: 20769 * jquery.effects.core.js 20770 */ 20771(function( $, undefined ) { 20772 20773$.effects.drop = function(o) { 20774 20775 return this.queue(function() { 20776 20777 // Create element 20778 var el = $(this), props = ['position','top','bottom','left','right','opacity']; 20779 20780 // Set options 20781 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 20782 var direction = o.options.direction || 'left'; // Default Direction 20783 20784 // Adjust 20785 $.effects.save(el, props); el.show(); // Save & Show 20786 $.effects.createWrapper(el); // Create Wrapper 20787 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 20788 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
20789 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); 20790 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift 20791 20792 // Animation 20793 var animation = {opacity: mode == 'show' ? 1 : 0}; 20794 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; 20795 20796 // Animate 20797 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 20798 if(mode == 'hide') el.hide(); // Hide 20799 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20800 if(o.callback) o.callback.apply(this, arguments); // Callback 20801 el.dequeue(); 20802 }}); 20803 20804 }); 20805 20806}; 20807 20808})(jQuery); 20809/* 20810 * jQuery UI Effects Explode 1.8.16 20811 * 20812 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20813 * Dual licensed under the MIT or GPL Version 2 licenses. 20814 * http://jquery.org/license 20815 * 20816 * http://docs.jquery.com/UI/Effects/Explode 20817 * 20818 * Depends: 20819 * jquery.effects.core.js 20820 */ 20821(function( $, undefined ) { 20822 20823$.effects.explode = function(o) { 20824 20825 return this.queue(function() { 20826 20827 var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; 20828 var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; 20829 20830 o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; 20831 var el = $(this).show().css('visibility', 'hidden'); 20832 var offset = el.offset(); 20833 20834 //Substract the margins - not fixing the problem yet. 20835 offset.top -= parseInt(el.css("marginTop"),10) || 0; 20836 offset.left -= parseInt(el.css("marginLeft"),10) || 0; 20837 20838 var width = el.outerWidth(true); 20839 var height = el.outerHeight(true); 20840 20841 for(var i=0;i<rows;i++) { // = 20842 for(var j=0;j<cells;j++) { // || 20843 el 20844 .clone() 20845 .appendTo('body') 20846 .wrap('<div></div>') 20847 .css({ 20848 position: 'absolute', 20849 visibility: 'visible', 20850 left: -j*(width/cells), 20851 top: -i*(height/rows) 20852 }) 20853 .parent() 20854 .addClass('ui-effects-explode') 20855 .css({ 20856 position: 'absolute', 20857 overflow: 'hidden', 20858 width: width/cells, 20859 height: height/rows, 20860 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), 20861 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), 20862 opacity: o.options.mode == 'show' ? 0 : 1 20863 }).animate({ 20864 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), 20865 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), 20866 opacity: o.options.mode == 'show' ? 1 : 0 20867 }, o.duration || 500); 20868 } 20869 } 20870 20871 // Set a timeout, to call the callback approx. when the other animations have finished 20872 setTimeout(function() { 20873 20874 o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); 20875 if(o.callback) o.callback.apply(el[0]); // Callback 20876 el.dequeue(); 20877 20878 $('div.ui-effects-explode').remove(); 20879 20880 }, o.duration || 500); 20881 20882 20883 }); 20884 20885}; 20886 20887})(jQuery); 20888/* 20889 * jQuery UI Effects Fade 1.8.16 20890 * 20891 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20892 * Dual licensed under the MIT or GPL Version 2 licenses. 20893 * http://jquery.org/license 20894 * 20895 * http://docs.jquery.com/UI/Effects/Fade 20896 * 20897 * Depends: 20898 * jquery.effects.core.js 20899 */ 20900(function( $, undefined ) { 20901 20902$.effects.fade = function(o) { 20903 return this.queue(function() { 20904 var elem = $(this), 20905 mode = $.effects.setMode(elem, o.options.mode || 'hide'); 20906 20907 elem.animate({ opacity: mode }, { 20908 queue: false, 20909 duration: o.duration, 20910 easing: o.options.easing, 20911 complete: function() {
20912 (o.callback && o.callback.apply(this, arguments)); 20913 elem.dequeue(); 20914 } 20915 }); 20916 }); 20917}; 20918 20919})(jQuery); 20920/* 20921 * jQuery UI Effects Fold 1.8.16 20922 * 20923 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20924 * Dual licensed under the MIT or GPL Version 2 licenses. 20925 * http://jquery.org/license 20926 * 20927 * http://docs.jquery.com/UI/Effects/Fold 20928 * 20929 * Depends: 20930 * jquery.effects.core.js 20931 */ 20932(function( $, undefined ) { 20933 20934$.effects.fold = function(o) { 20935 20936 return this.queue(function() { 20937 20938 // Create element 20939 var el = $(this), props = ['position','top','bottom','left','right']; 20940 20941 // Set options 20942 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 20943 var size = o.options.size || 15; // Default fold size 20944 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value 20945 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; 20946 20947 // Adjust 20948 $.effects.save(el, props); el.show(); // Save & Show 20949 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 20950 var widthFirst = ((mode == 'show') != horizFirst); 20951 var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; 20952 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; 20953 var percent = /([0-9]+)%/.exec(size); 20954 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; 20955 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift 20956 20957 // Animation 20958 var animation1 = {}, animation2 = {}; 20959 animation1[ref[0]] = mode == 'show' ? distance[0] : size; 20960 animation2[ref[1]] = mode == 'show' ? distance[1] : 0; 20961 20962 // Animate 20963 wrapper.animate(animation1, duration, o.options.easing) 20964 .animate(animation2, duration, o.options.easing, function() { 20965 if(mode == 'hide') el.hide(); // Hide 20966 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 20967 if(o.callback) o.callback.apply(el[0], arguments); // Callback 20968 el.dequeue(); 20969 }); 20970 20971 }); 20972 20973}; 20974 20975})(jQuery); 20976/* 20977 * jQuery UI Effects Highlight 1.8.16 20978 * 20979 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 20980 * Dual licensed under the MIT or GPL Version 2 licenses. 20981 * http://jquery.org/license 20982 * 20983 * http://docs.jquery.com/UI/Effects/Highlight 20984 * 20985 * Depends: 20986 * jquery.effects.core.js 20987 */ 20988(function( $, undefined ) { 20989 20990$.effects.highlight = function(o) { 20991 return this.queue(function() { 20992 var elem = $(this), 20993 props = ['backgroundImage', 'backgroundColor', 'opacity'], 20994 mode = $.effects.setMode(elem, o.options.mode || 'show'), 20995 animation = { 20996 backgroundColor: elem.css('backgroundColor') 20997 }; 20998 20999 if (mode == 'hide') { 21000 animation.opacity = 0; 21001 } 21002 21003 $.effects.save(elem, props); 21004 elem 21005 .show() 21006 .css({ 21007 backgroundImage: 'none', 21008 backgroundColor: o.options.color || '#ffff99' 21009 }) 21010 .animate(animation, { 21011 queue: false, 21012 duration: o.duration, 21013 easing: o.options.easing, 21014 complete: function() { 21015 (mode == 'hide' && elem.hide()); 21016 $.effects.restore(elem, props); 21017 (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter')); 21018 (o.callback && o.callback.apply(this, arguments)); 21019 elem.dequeue(); 21020 } 21021 }); 21022 }); 21023}; 21024 21025})(jQuery); 21026/* 21027 * jQuery UI Effects Pulsate 1.8.16 21028 * 21029 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 21030 * Dual licensed under the MIT or GPL Version 2 licenses. 21031 * http://jquery.org/license 21032 * 21033 * http://docs.jquery.com/UI/Effects/Pulsate 21034 * 21035 * Depends: 21036 * jquery.effects.core.js 21037 */ 21038(function( $, undefined ) { 21039 21040$.effects.pulsate = function(o) { 21041 return this.queue(function() { 21042 var elem = $(this), 21043 mode = $.effects.setMode(elem, o.options.mode || 'show'); 21044 times = ((o.options.times || 5) * 2) - 1; 21045 duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2, 21046 isVisible = elem.is(':visible'), 21047 animateTo = 0; 21048 21049 if (!isVisible) { 21050 elem.css('opacity', 0).show(); 21051 animateTo = 1; 21052 } 21053 21054 if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { 21055 times--; 21056 } 21057 21058 for (var i = 0; i < times; i++) { 21059 elem.animate({ opacity: animateTo }, duration, o.options.easing); 21060 animateTo = (animateTo + 1) % 2; 21061 } 21062 21063 elem.animate({ opacity: animateTo }, duration, o.options.easing, function() { 21064 if (animateTo == 0) { 21065 elem.hide(); 21066 } 21067 (o.callback && o.callback.apply(this, arguments)); 21068 }); 21069 21070 elem 21071 .queue('fx', function() { elem.dequeue(); }) 21072 .dequeue(); 21073 }); 21074}; 21075 21076})(jQuery); 21077/* 21078 * jQuery UI Effects Scale 1.8.16 21079 * 21080 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 21081 * Dual licensed under the MIT or GPL Version 2 licenses. 21082 * http://jquery.org/license 21083 * 21084 * http://docs.jquery.com/UI/Effects/Scale 21085 * 21086 * Depends:
21087 * jquery.effects.core.js 21088 */ 21089(function( $, undefined ) { 21090 21091$.effects.puff = function(o) { 21092 return this.queue(function() { 21093 var elem = $(this), 21094 mode = $.effects.setMode(elem, o.options.mode || 'hide'), 21095 percent = parseInt(o.options.percent, 10) || 150, 21096 factor = percent / 100, 21097 original = { height: elem.height(), width: elem.width() }; 21098 21099 $.extend(o.options, { 21100 fade: true, 21101 mode: mode, 21102 percent: mode == 'hide' ? percent : 100, 21103 from: mode == 'hide' 21104 ? original 21105 : { 21106 height: original.height * factor, 21107 width: original.width * factor 21108 } 21109 }); 21110 21111 elem.effect('scale', o.options, o.duration, o.callback); 21112 elem.dequeue(); 21113 }); 21114}; 21115 21116$.effects.scale = function(o) { 21117 21118 return this.queue(function() { 21119 21120 // Create element 21121 var el = $(this); 21122 21123 // Set options 21124 var options = $.extend(true, {}, o.options); 21125 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 21126 var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent 21127 var direction = o.options.direction || 'both'; // Set default axis 21128 var origin = o.options.origin; // The origin of the scaling 21129 if (mode != 'effect') { // Set default origin and restore for show/hide 21130 options.origin = origin || ['middle','center']; 21131 options.restore = true; 21132 } 21133 var original = {height: el.height(), width: el.width()}; // Save original 21134 el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state 21135 21136 // Adjust 21137 var factor = { // Set scaling factor 21138 y: direction != 'horizontal' ? (percent / 100) : 1, 21139 x: direction != 'vertical' ? (percent / 100) : 1 21140 }; 21141 el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state 21142 21143 if (o.options.fade) { // Fade option to support puff 21144 if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; 21145 if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; 21146 }; 21147 21148 // Animation 21149 options.from = el.from; options.to = el.to; options.mode = mode; 21150 21151 // Animate 21152 el.effect('size', options, o.duration, o.callback); 21153 el.dequeue(); 21154 }); 21155 21156}; 21157 21158$.effects.size = function(o) { 21159 21160 return this.queue(function() { 21161 21162 // Create element 21163 var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity']; 21164 var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore 21165 var props2 = ['width','height','overflow']; // Copy for children 21166 var cProps = ['fontSize']; 21167 var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; 21168 var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; 21169 21170 // Set options 21171 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 21172 var restore = o.options.restore || false; // Default restore 21173 var scale = o.options.scale || 'both'; // Default scale mode 21174 var origin = o.options.origin; // The origin of the sizing 21175 var original = {height: el.height(), width: el.width()}; // Save original 21176 el.from = o.options.from || original; // Default from state 21177 el.to = o.options.to || original; // Default to state 21178 // Adjust 21179 if (origin) { // Calculate baseline shifts 21180 var baseline = $.effects.getBaseline(origin, original); 21181 el.from.top = (original.height - el.from.height) * baseline.y; 21182 el.from.left = (original.width - el.from.width) * baseline.x; 21183 el.to.top = (original.height - el.to.height) * baseline.y; 21184 el.to.left = (original.width - el.to.width) * baseline.x; 21185 }; 21186 var factor = { // Set scaling factor 21187 from: {y: el.from.height / original.height, x: el.from.width / original.width}, 21188 to: {y: el.to.height / original.height, x: el.to.width / original.width} 21189 }; 21190 if (scale == 'box' || scale == 'both') { // Scale the css box 21191 if (factor.from.y != factor.to.y) { // Vertical props scaling 21192 props = props.concat(vProps); 21193 el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); 21194 el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); 21195 }; 21196 if (factor.from.x != factor.to.x) { // Horizontal props scaling 21197 props = props.concat(hProps); 21198 el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); 21199 el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); 21200 }; 21201 }; 21202 if (scale == 'content' || scale == 'both') { // Scale the content 21203 if (factor.from.y != factor.to.y) { // Vertical props scaling 21204 props = props.concat(cProps); 21205 el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); 21206 el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); 21207 }; 21208 }; 21209 $.effects.save(el, restore ? props : props1); el.show(); // Save & Show 21210 $.effects.createWrapper(el); // Create Wrapper 21211 el.css('overflow','hidden').css(el.from); // Shift 21212 21213 // Animate 21214 if (scale == 'content' || scale == 'both') { // Scale the children 21215 vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size 21216 hProps = hProps.concat(['marginLeft','marginRight']); // Add margins 21217 props2 = props.concat(vProps).concat(hProps); // Concat 21218 el.find("*[width]").each(function(){ 21219 child = $(this); 21220 if (restore) $.effects.save(child, props2); 21221 var c_original = {height: child.height(), width: child.width()}; // Save original 21222 child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; 21223 child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; 21224 if (factor.from.y != factor.to.y) { // Vertical props scaling 21225 child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); 21226 child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); 21227 }; 21228 if (factor.from.x != factor.to.x) { // Horizontal props scaling 21229 child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); 21230 child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); 21231 }; 21232 child.css(child.from); // Shift children
21233 child.animate(child.to, o.duration, o.options.easing, function(){ 21234 if (restore) $.effects.restore(child, props2); // Restore children 21235 }); // Animate children 21236 }); 21237 }; 21238 21239 // Animate 21240 el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 21241 if (el.to.opacity === 0) { 21242 el.css('opacity', el.from.opacity); 21243 } 21244 if(mode == 'hide') el.hide(); // Hide 21245 $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore 21246 if(o.callback) o.callback.apply(this, arguments); // Callback 21247 el.dequeue(); 21248 }}); 21249 21250 }); 21251 21252}; 21253 21254})(jQuery); 21255/* 21256 * jQuery UI Effects Shake 1.8.16 21257 * 21258 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 21259 * Dual licensed under the MIT or GPL Version 2 licenses. 21260 * http://jquery.org/license 21261 * 21262 * http://docs.jquery.com/UI/Effects/Shake 21263 * 21264 * Depends: 21265 * jquery.effects.core.js 21266 */ 21267(function( $, undefined ) { 21268 21269$.effects.shake = function(o) { 21270 21271 return this.queue(function() { 21272 21273 // Create element 21274 var el = $(this), props = ['position','top','bottom','left','right']; 21275 21276 // Set options 21277 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode 21278 var direction = o.options.direction || 'left'; // Default direction 21279 var distance = o.options.distance || 20; // Default distance 21280 var times = o.options.times || 3; // Default # of times 21281 var speed = o.duration || o.options.duration || 140; // Default speed per shake 21282 21283 // Adjust 21284 $.effects.save(el, props); el.show(); // Save & Show 21285 $.effects.createWrapper(el); // Create Wrapper 21286 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 21287 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 21288 21289 // Animation 21290 var animation = {}, animation1 = {}, animation2 = {}; 21291 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; 21292 animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; 21293 animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; 21294 21295 // Animate 21296 el.animate(animation, speed, o.options.easing); 21297 for (var i = 1; i < times; i++) { // Shakes 21298 el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); 21299 }; 21300 el.animate(animation1, speed, o.options.easing). 21301 animate(animation, speed / 2, o.options.easing, function(){ // Last shake 21302 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 21303 if(o.callback) o.callback.apply(this, arguments); // Callback 21304 }); 21305 el.queue('fx', function() { el.dequeue(); }); 21306 el.dequeue(); 21307 }); 21308 21309}; 21310 21311})(jQuery); 21312/* 21313 * jQuery UI Effects Slide 1.8.16 21314 * 21315 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 21316 * Dual licensed under the MIT or GPL Version 2 licenses. 21317 * http://jquery.org/license 21318 * 21319 * http://docs.jquery.com/UI/Effects/Slide 21320 * 21321 * Depends: 21322 * jquery.effects.core.js 21323 */ 21324(function( $, undefined ) { 21325 21326$.effects.slide = function(o) { 21327 21328 return this.queue(function() { 21329 21330 // Create element 21331 var el = $(this), props = ['position','top','bottom','left','right']; 21332 21333 // Set options 21334 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode 21335 var direction = o.options.direction || 'left'; // Default Direction 21336 21337 // Adjust 21338 $.effects.save(el, props); el.show(); // Save & Show 21339 $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 21340 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 21341 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 21342 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); 21343 if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift 21344 21345 // Animation 21346 var animation = {}; 21347 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; 21348 21349 // Animate 21350 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 21351 if(mode == 'hide') el.hide(); // Hide 21352 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 21353 if(o.callback) o.callback.apply(this, arguments); // Callback 21354 el.dequeue(); 21355 }}); 21356 21357 }); 21358 21359}; 21360 21361})(jQuery); 21362/* 21363 * jQuery UI Effects Transfer 1.8.16 21364 * 21365 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 21366 * Dual licensed under the MIT or GPL Version 2 licenses. 21367 * http://jquery.org/license 21368 * 21369 * http://docs.jquery.com/UI/Effects/Transfer 21370 * 21371 * Depends:
21372 * jquery.effects.core.js 21373 */ 21374(function( $, undefined ) { 21375 21376$.effects.transfer = function(o) { 21377 return this.queue(function() { 21378 var elem = $(this), 21379 target = $(o.options.to), 21380 endPosition = target.offset(), 21381 animation = { 21382 top: endPosition.top, 21383 left: endPosition.left, 21384 height: target.innerHeight(), 21385 width: target.innerWidth() 21386 }, 21387 startPosition = elem.offset(), 21388 transfer = $('<div class="ui-effects-transfer"></div>') 21389 .appendTo(document.body) 21390 .addClass(o.options.className) 21391 .css({ 21392 top: startPosition.top, 21393 left: startPosition.left, 21394 height: elem.innerHeight(), 21395 width: elem.innerWidth(), 21396 position: 'absolute' 21397 }) 21398 .animate(animation, o.duration, o.options.easing, function() { 21399 transfer.remove(); 21400 (o.callback && o.callback.apply(elem[0], arguments)); 21401 elem.dequeue(); 21402 }); 21403 }); 21404}; 21405 21406})(jQuery); 21407// This is a manifest file that'll be compiled into including all the files listed below. 21408// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 21409// be included in the compiled file accessible from http://example.com/assets/application.js 21410// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 21411// the compiled file. 21412 21413 21414 21415 21416 21417 21418 21419 21420; 21421// ColorBox v1.3.19 - jQuery lightbox plugin 21422// (c) 2011 Jack Moore - jacklmoore.com 21423// License: http://www.opensource.org/licenses/mit-license.php 21424(function(a,b,c){function Z(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function $(a){var b=y.length,c=(Q+a)%b;return c<0?b+c:c}function _(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function ba(a){return K.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(a)}function bb(){var b;K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.slice(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function bc(b,c){a.event.trigger(b),c&&c.call(P)}function bd(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(K.loop||y[Q+1])a=setTimeout(W.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function be(b){U||(P=b,bb(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1)),S||(S=T=!0,r.show(),K.returnFocus&&a(P).blur().one(l,function(){a(this).focus()}),q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=_(K.initialWidth,"x"),K.h=_(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),bc(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()),W.load(!0))}function bf(){!r&&b.body&&(Y=!1,z=a(c),r=Z(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}).hide(),q=Z(X,"Overlay",o?"position:absolute":"").hide(),s=Z(X,"Wrapper"),t=Z(X,"Content").append(A=Z(X,"LoadedContent","width:0; height:0; overflow:hidden"),C=Z(X,"LoadingOverlay").add(Z(X,"LoadingGraphic")),D=Z(X,"Title"),E=Z(X,"Current"),G=Z(X,"Next"),H=Z(X,"Previous"),F=Z(X,"Slideshow").bind(h,bd),I=Z(X,"Close")),s.append(Z(X).append(Z(X,"TopLeft"),u=Z(X,"TopCenter"),Z(X,"TopRight")),Z(X,!1,"clear:left").append(v=Z(X,"MiddleLeft"),t,w=Z(X,"MiddleRight")),Z(X,!1,"clear:left").append(Z(X,"BottomLeft"),x=Z(X,"BottomCenter"),Z(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Z(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),J=G.add(H).add(E).add(F),a(b.body).append(q,r.append(s,B)))}function bg(){return r?(Y||(Y=!0,L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))}),a("."+g,b).live("click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),be(this))})),!0):!1}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHe
21424ight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=!a.support.opacity&&!a.support.style,o=n&&!c.XMLHttpRequest,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X="div",Y;if(a.colorbox)return;a(bf),W=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{},bf();if(bg()){if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b))}).addClass(g),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&be(f[0])}return f},W.position=function(a,b){function i(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c=0,d=0,e=r.offset(),g=z.scrollTop(),h=z.scrollLeft();z.unbind("resize."+f),r.css({top:-9e4,left:-9e4}),K.fixed&&!o?(e.top-=g,e.left-=h,r.css({position:"fixed"})):(c=g,d=h,r.css({position:"absolute"})),K.right!==!1?d+=Math.max(z.width()-K.w-O-M-_(K.right,"x"),0):K.left!==!1?d+=_(K.left,"x"):d+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?c+=Math.max(z.height()-K.h-N-L-_(K.bottom,"y"),0):K.top!==!1?c+=_(K.top,"y"):c+=Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:e.top,left:e.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:c,left:d},{duration:a,complete:function(){i(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",K.reposition&&setTimeout(function(){z.bind("resize."+f,W.position)},1),b&&b()},step:function(){i(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=_(a.width,"x")-O-M),a.innerWidth&&(K.w=_(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=_(a.height,"y")-N-L),a.innerHeight&&(K.h=_(a.innerHeight,"y")),!a.innerHeight&&!a.height&&(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position(K.transition==="none"?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(!S)return;var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Z(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function q(){n&&r[0].style.removeAttribute("filter")}var b,c,g=y.length,h,i="frameBorder",k="allowTransparency",l,o,p;if(!S)return;l=function(){clearTimeout(V),C.hide(),bc(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show();if(g>1){typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||Q<g-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show();if(K.preloading){b=[$(-1),$(1)];while(c=y[b.pop()])o=a.data(c,e).href||c.href,a.isFunction(o)&&(o=o.call(c)),ba(o)&&(p=new Image,p.src=o)}}else J.hide();K.iframe?(h=Z("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),h.name=f+ +(new Date),K.fastIframe?l():a(h).one("load",l),h.src=K.href,K.scrolling||(h.scrolling="no"),a(h).addClass(f+"Iframe").appendTo(A).one(m,function(){h.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,q):q()},K.transition==="fade"?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)},W.load=function(b){var c,d,e=W.prep;
21424T=!0,R=!1,P=y[Q],b||bb(),bc(m),bc(i,K.onLoad),K.h=K.height?_(K.height,"y")-N-L:K.innerHeight&&_(K.innerHeight,"y"),K.w=K.width?_(K.width,"x")-O-M:K.innerWidth&&_(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=_(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=_(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show()},100),K.inline?(Z(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):ba(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Z(X,"Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(K.loop||y[Q+1])&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Z(X,"Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!T&&y[1]&&(K.loop||y[Q+1])&&(Q=$(1),W.load())},W.prev=function(){!T&&y[1]&&(K.loop||Q)&&(Q=$(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,bc(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),bc(m),A.remove(),setTimeout(function(){U=!1,bc(l,K.onClosed)},1)}))},W.remove=function(){a([]).add(r).add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g).die()},W.element=function(){return a(P)},W.settings=d})(jQuery,document,this); 21425/** 21426 * jQuery Cookie plugin 21427 * 21428 * Copyright (c) 2010 Klaus Hartl (stilbuero.de) 21429 * Dual licensed under the MIT and GPL licenses: 21430 * http://www.opensource.org/licenses/mit-license.php 21431 * http://www.gnu.org/licenses/gpl.html 21432 * 21433 */ 21434jQuery.cookie = function (key, value, options) { 21435 21436 // key and at least value given, set cookie... 21437 if (arguments.length > 1 && String(value) !== "[object Object]") { 21438 options = jQuery.extend({}, options); 21439 21440 if (value === null || value === undefined) { 21441 options.expires = -1; 21442 } 21443 21444 if (typeof options.expires === 'number') { 21445 var days = options.expires, t = options.expires = new Date(); 21446 t.setDate(t.getDate() + days); 21447 } 21448 21449 value = String(value); 21450 21451 return (document.cookie = [ 21452 encodeURIComponent(key), '=', 21453 options.raw ? value : encodeURIComponent(value), 21454 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 21455 options.path ? '; path=' + options.path : '', 21456 options.domain ? '; domain=' + options.domain : '', 21457 options.secure ? '; secure' : '' 21458 ].join('')); 21459 } 21460 21461 // key and possibly options given, get cookie... 21462 options = value || {}; 21463 var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; 21464 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 21465}; 21466/* 21467 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 21468 * 21469 * Uses the built in easing capabilities added In jQuery 1.1 21470 * to offer multiple easing options 21471 * 21472 * TERMS OF USE - jQuery Easing 21473 * 21474 * Open source under the BSD License. 21475 * 21476 * Copyright © 2008 George McGinley Smith 21477 * All rights reserved. 21478 * 21479 * Redistribution and use in source and binary forms, with or without modification, 21480 * are permitted provided that the following conditions are met: 21481 * 21482 * Redistributions of source code must retain the above copyright notice, this list of 21483 * conditions and the following disclaimer. 21484 * Redistributions in binary form must reproduce the above copyright notice, this list 21485 * of conditions and the following disclaimer in the documentation and/or other materials 21486 * provided with the distribution. 21487 * 21488 * Neither the name of the author nor the names of contributors may be used to endorse 21489 * or promote products derived from this software without specific prior written permission. 21490 * 21491 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 21492 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21493 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21494 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 21495-21640
21495 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21496 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 21497 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21498 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 21499 * OF THE POSSIBILITY OF SUCH DAMAGE. 21500 * 21501*/ 21502 21503// t: current time, b: begInnIng value, c: change In value, d: duration 21504jQuery.easing['jswing'] = jQuery.easing['swing']; 21505 21506jQuery.extend( jQuery.easing, 21507{ 21508 def: 'easeOutQuad', 21509 swing: function (x, t, b, c, d) { 21510 //alert(jQuery.easing.default); 21511 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 21512 }, 21513 easeInQuad: function (x, t, b, c, d) { 21514 return c*(t/=d)*t + b; 21515 }, 21516 easeOutQuad: function (x, t, b, c, d) { 21517 return -c *(t/=d)*(t-2) + b; 21518 }, 21519 easeInOutQuad: function (x, t, b, c, d) { 21520 if ((t/=d/2) < 1) return c/2*t*t + b; 21521 return -c/2 * ((--t)*(t-2) - 1) + b; 21522 }, 21523 easeInCubic: function (x, t, b, c, d) { 21524 return c*(t/=d)*t*t + b; 21525 }, 21526 easeOutCubic: function (x, t, b, c, d) { 21527 return c*((t=t/d-1)*t*t + 1) + b; 21528 }, 21529 easeInOutCubic: function (x, t, b, c, d) { 21530 if ((t/=d/2) < 1) return c/2*t*t*t + b; 21531 return c/2*((t-=2)*t*t + 2) + b; 21532 }, 21533 easeInQuart: function (x, t, b, c, d) { 21534 return c*(t/=d)*t*t*t + b; 21535 }, 21536 easeOutQuart: function (x, t, b, c, d) { 21537 return -c * ((t=t/d-1)*t*t*t - 1) + b; 21538 }, 21539 easeInOutQuart: function (x, t, b, c, d) { 21540 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 21541 return -c/2 * ((t-=2)*t*t*t - 2) + b; 21542 }, 21543 easeInQuint: function (x, t, b, c, d) { 21544 return c*(t/=d)*t*t*t*t + b; 21545 }, 21546 easeOutQuint: function (x, t, b, c, d) { 21547 return c*((t=t/d-1)*t*t*t*t + 1) + b; 21548 }, 21549 easeInOutQuint: function (x, t, b, c, d) { 21550 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 21551 return c/2*((t-=2)*t*t*t*t + 2) + b; 21552 }, 21553 easeInSine: function (x, t, b, c, d) { 21554 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 21555 }, 21556 easeOutSine: function (x, t, b, c, d) { 21557 return c * Math.sin(t/d * (Math.PI/2)) + b; 21558 }, 21559 easeInOutSine: function (x, t, b, c, d) { 21560 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 21561 }, 21562 easeInExpo: function (x, t, b, c, d) { 21563 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 21564 }, 21565 easeOutExpo: function (x, t, b, c, d) { 21566 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 21567 }, 21568 easeInOutExpo: function (x, t, b, c, d) { 21569 if (t==0) return b; 21570 if (t==d) return b+c; 21571 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 21572 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 21573 }, 21574 easeInCirc: function (x, t, b, c, d) { 21575 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 21576 }, 21577 easeOutCirc: function (x, t, b, c, d) { 21578 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 21579 }, 21580 easeInOutCirc: function (x, t, b, c, d) { 21581 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 21582 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 21583 }, 21584 easeInElastic: function (x, t, b, c, d) { 21585 var s=1.70158;var p=0;var a=c; 21586 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 21587 if (a < Math.abs(c)) { a=c; var s=p/4; } 21588 else var s = p/(2*Math.PI) * Math.asin (c/a); 21589 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 21590 }, 21591 easeOutElastic: function (x, t, b, c, d) { 21592 var s=1.70158;var p=0;var a=c; 21593 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 21594 if (a < Math.abs(c)) { a=c; var s=p/4; } 21595 else var s = p/(2*Math.PI) * Math.asin (c/a); 21596 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 21597 }, 21598 easeInOutElastic: function (x, t, b, c, d) { 21599 var s=1.70158;var p=0;var a=c; 21600 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 21601 if (a < Math.abs(c)) { a=c; var s=p/4; } 21602 else var s = p/(2*Math.PI) * Math.asin (c/a); 21603 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 21604 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 21605 }, 21606 easeInBack: function (x, t, b, c, d, s) { 21607 if (s == undefined) s = 1.70158; 21608 return c*(t/=d)*t*((s+1)*t - s) + b; 21609 }, 21610 easeOutBack: function (x, t, b, c, d, s) { 21611 if (s == undefined) s = 1.70158; 21612 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 21613 }, 21614 easeInOutBack: function (x, t, b, c, d, s) { 21615 if (s == undefined) s = 1.70158; 21616 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 21617 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 21618 }, 21619 easeInBounce: function (x, t, b, c, d) { 21620 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 21621 }, 21622 easeOutBounce: function (x, t, b, c, d) { 21623 if ((t/=d) < (1/2.75)) { 21624 return c*(7.5625*t*t) + b; 21625 } else if (t < (2/2.75)) { 21626 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 21627 } else if (t < (2.5/2.75)) { 21628 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 21629 } else { 21630 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 21631 } 21632 }, 21633 easeInOutBounce: function (x, t, b, c, d) { 21634 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 21635 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 21636 } 21637}); 21638 21639/* 21640 *
21641 * TERMS OF USE - EASING EQUATIONS 21642 * 21643 * Open source under the BSD License. 21644 * 21645 * Copyright © 2001 Robert Penner 21646 * All rights reserved. 21647 * 21648 * Redistribution and use in source and binary forms, with or without modification, 21649 * are permitted provided that the following conditions are met: 21650 * 21651 * Redistributions of source code must retain the above copyright notice, this list of 21652 * conditions and the following disclaimer. 21653 * Redistributions in binary form must reproduce the above copyright notice, this list 21654 * of conditions and the following disclaimer in the documentation and/or other materials 21655 * provided with the distribution. 21656 * 21657 * Neither the name of the author nor the names of contributors may be used to endorse 21658 * or promote products derived from this software without specific prior written permission. 21659 * 21660 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 21661 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21662 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21663 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21664 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21665 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 21666 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21667 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 21668 * OF THE POSSIBILITY OF SUCH DAMAGE. 21669 * 21670 */; 21671/** 21672 * Isotope v1.5.04 21673 * An exquisite jQuery plugin for magical layouts 21674 * http://isotope.metafizzy.co 21675 * 21676 * Commercial use requires one-time license fee 21677 * http://metafizzy.co/#licenses 21678 * 21679 * Copyright 2011 David DeSandro / Metafizzy 21680 */ 21681/*jshint curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, undef: true */ 21682/*global Modernizr: true, jQuery: true */ 21683 21684if (!Array.prototype.indexOf) { 21685 Array.prototype.indexOf = function(target) { 21686 for (var i = 0; i < this.length; i++) { 21687 if (this[i] === target) { 21688 return i; 21689 } 21690 } 21691 return -1; 21692 }; 21693} 21694 21695(function( window, $, undefined ){ 21696 21697 'use strict'; 21698 21699 // helper function 21700 var capitalize = function( str ) { 21701 return str.charAt(0).toUpperCase() + str.slice(1); 21702 }; 21703 21704 // ========================= getStyleProperty by kangax =============================== 21705 // http://perfectionkills.com/feature-testing-css-properties/ 21706 21707 var prefixes = 'Moz Webkit Khtml O Ms'.split(' '); 21708 21709 var getStyleProperty = function( propName ) { 21710 var style = document.documentElement.style, 21711 prefixed; 21712 21713 // test standard property first 21714 if ( typeof style[propName] === 'string' ) { 21715 return propName; 21716 } 21717 21718 // capitalize 21719 propName = capitalize( propName ); 21720 21721 // test vendor specific properties 21722 for ( var i=0, len = prefixes.length; i < len; i++ ) { 21723 prefixed = prefixes[i] + propName; 21724 if ( typeof style[ prefixed ] === 'string' ) { 21725 return prefixed; 21726 } 21727 } 21728 }; 21729 21730 var transformProp = getStyleProperty('transform'), 21731 transitionProp = getStyleProperty('transitionProperty'); 21732 21733 21734 // ========================= miniModernizr =============================== 21735 // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting 21736 21737 /*! 21738 * Modernizr v1.6ish: miniModernizr for Isotope 21739 * http://www.modernizr.com 21740 * 21741 * Developed by: 21742 * - Faruk Ates http://farukat.es/ 21743 * - Paul Irish http://paulirish.com/ 21744 * 21745 * Copyright (c) 2009-2010 21746 * Dual-licensed under the BSD or MIT licenses. 21747 * http://www.modernizr.com/license/ 21748 */ 21749 21750 /* 21751 * This version whittles down the script just to check support for 21752 * CSS transitions, transforms, and 3D transforms. 21753 */ 21754 21755 var tests = { 21756 csstransforms: function() { 21757 return !!transformProp; 21758 }, 21759 21760 csstransforms3d: function() { 21761 var test = !!getStyleProperty('perspective'); 21762 // double check for Chrome's false positive 21763 if ( test ) { 21764 var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), 21765 mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)', 21766 $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>') 21767 .appendTo('head'),
21768 $div = $('<div id="modernizr" />').appendTo('html'); 21769 21770 test = $div.height() === 3; 21771 21772 $div.remove(); 21773 $style.remove(); 21774 } 21775 return test; 21776 }, 21777 21778 csstransitions: function() { 21779 return !!transitionProp; 21780 } 21781 }; 21782 21783 if ( window.Modernizr ) { 21784 // if there's a previous Modernzir, check if there are necessary tests 21785 for ( var testName in tests) { 21786 if ( !Modernizr.hasOwnProperty( testName ) ) { 21787 // if test hasn't been run, use addTest to run it 21788 Modernizr.addTest( testName, tests[ testName ] ); 21789 } 21790 } 21791 } else { 21792 // or create new mini Modernizr that just has the 3 tests 21793 window.Modernizr = (function(){ 21794 21795 var miniModernizr = { 21796 _version : '1.6ish: miniModernizr for Isotope' 21797 }, 21798 classes = ' ', 21799 result, testName; 21800 21801 // Run through tests 21802 for ( testName in tests) { 21803 result = tests[ testName ](); 21804 miniModernizr[ testName ] = result; 21805 classes += ' ' + ( result ? '' : 'no-' ) + testName; 21806 } 21807 21808 // Add the new classes to the <html> element. 21809 $('html').addClass( classes ); 21810 21811 return miniModernizr; 21812 })(); 21813 } 21814 21815 21816 21817 // ========================= isoTransform =============================== 21818 21819 /** 21820 * provides hooks for .css({ scale: value, translate: [x, y] }) 21821 * Progressively enhanced CSS transforms 21822 * Uses hardware accelerated 3D transforms for Safari 21823 * or falls back to 2D transforms. 21824 */ 21825 21826 if ( Modernizr.csstransforms ) { 21827 21828 // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)' 21829 var transformFnNotations = Modernizr.csstransforms3d ? 21830 { // 3D transform functions 21831 translate : function ( position ) { 21832 return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) '; 21833 }, 21834 scale : function ( scale ) { 21835 return 'scale3d(' + scale + ', ' + scale + ', 1) '; 21836 } 21837 } : 21838 { // 2D transform functions 21839 translate : function ( position ) { 21840 return 'translate(' + position[0] + 'px, ' + position[1] + 'px) '; 21841 }, 21842 scale : function ( scale ) { 21843 return 'scale(' + scale + ') '; 21844 } 21845 } 21846 ; 21847 21848 var setIsoTransform = function ( elem, name, value ) { 21849 // unpack current transform data 21850 var data = $.data( elem, 'isoTransform' ) || {}, 21851 newData = {}, 21852 fnName, 21853 transformObj = {}, 21854 transformValue; 21855 21856 // i.e. newData.scale = 0.5 21857 newData[ name ] = value; 21858 21859 // extend new value over current data 21860 $.extend( data, newData ); 21861 21862 for ( fnName in data ) { 21863 transformValue = data[ fnName ]; 21864 transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue ); 21865 } 21866 21867 // get proper order 21868 // ideally, we could loop through this give an array, but since we only have 21869 // a couple transforms we're keeping track of, we'll do it like so 21870 var translateFn = transformObj.translate || '', 21871 scaleFn = transformObj.scale || '', 21872 // sorting so translate always comes first 21873 valueFns = translateFn + scaleFn; 21874 21875 // set data back in elem 21876 $.data( elem, 'isoTransform', data ); 21877 21878 // set name to vendor specific property 21879 elem.style[ transformProp ] = valueFns; 21880 }; 21881 21882 // ==================== scale =================== 21883 21884 $.cssNumber.scale = true; 21885 21886 $.cssHooks.scale = { 21887 set: function( elem, value ) { 21888 21889 // uncomment this bit if you want to properly parse strings 21890 // if ( typeof value === 'string' ) { 21891 // value = parseFloat( value ); 21892 // } 21893 setIsoTransform( elem, 'scale', value ); 21894 }, 21895 get: function( elem, computed ) { 21896 var transform = $.data( elem, 'isoTransform' ); 21897 return transform && transform.scale ? transform.scale : 1; 21898 } 21899 }; 21900 21901 $.fx.step.scale = function( fx ) { 21902 $.cssHooks.scale.set( fx.elem, fx.now+fx.unit ); 21903 }; 21904 21905 21906 // ==================== translate =================== 21907 21908 $.cssNumber.translate = true; 21909 21910 $.cssHooks.translate = { 21911 set: function( elem, value ) { 21912 setIsoTransform( elem, 'translate', value ); 21913 }, 21914 21915 get: function( elem, computed ) { 21916 var transform = $.data( elem, 'isoTransform' ); 21917 return transform && transform.translate ? transform.translate : [ 0, 0 ]; 21918 } 21919 }; 21920 21921 } 21922 21923 // ========================= get transition-end event =============================== 21924 var transitionEndEvent, transitionDurProp; 21925 21926 if ( Modernizr.csstransitions ) { 21927 transitionEndEvent = { 21928 WebkitTransitionProperty: 'webkitTransitionEnd', // webkit 21929 MozTransitionProperty: 'transitionend', 21930 OTransitionProperty: 'oTransitionEnd', 21931 transitionProperty: 'transitionEnd' 21932 }[ transitionProp ]; 21933 21934 transitionDurProp = getStyleProperty('transitionDuration'); 21935 } 21936 21937 // ========================= smartresize =============================== 21938 21939 /* 21940 * smartresize: debounced resize event for jQuery 21941 * 21942 * latest version and complete README available on Github: 21943 * https://github.com/louisremi/jquery.smartresize.js 21944 * 21945 * Copyright 2011 @louis_remi 21946 * Licensed under the MIT license. 21947 */ 21948 21949 var $event = $.event, 21950 resizeTimeout; 21951 21952 $event.special.smartresize = { 21953 setup: function() { 21954 $(this).bind( "resize", $event.special.smartresize.handler ); 21955 }, 21956 teardown: function() { 21957 $(this).unbind( "resize", $event.special.smartresize.handler ); 21958 }, 21959 handler: function( event, execAsap ) { 21960 // Save the context 21961 var context = this, 21962 args = arguments; 21963 21964 // set correct event type 21965 event.type = "smartresize"; 21966 21967 if ( resizeTimeout ) { clearTimeout( resizeTimeout ); } 21968 resizeTimeout = setTimeout(function() { 21969 jQuery.event.handle.apply( context, args ); 21970 }, execAsap === "execAsap"? 0 : 100 ); 21971 } 21972 }; 21973 21974 $.fn.smartresize = function( fn ) { 21975 return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); 21976 }; 21977 21978 21979 21980// ========================= Isotope =============================== 21981 21982
21983 // our "Widget" object constructor 21984 $.Isotope = function( options, element, callback ){ 21985 this.element = $( element ); 21986 this._create( options ); 21987 this._init( callback ); 21988 }; 21989 21990 // styles of container element we want to keep track of 21991 var isoContainerStyles = [ 'overflow', 'position', 'width', 'height' ]; 21992 21993 $.Isotope.settings = { 21994 resizable: true, 21995 layoutMode : 'masonry', 21996 stagger: 100, 21997 containerClass : 'isotope', 21998 itemClass : 'isotope-item', 21999 hiddenClass : 'isotope-hidden', 22000 hiddenStyle: { scale: 0.01, opacity: 0 }, 22001 visibleStyle: { scale: 1, opacity: 1 }, 22002 animationEngine: 'jquery', 22003 animationOptions: { 22004 queue: false, 22005 duration: 1000 22006 }, 22007 sortBy : 'original-order', 22008 sortAscending : true, 22009 resizesContainer : true, 22010 transformsEnabled: !$.browser.opera, // disable transforms in Opera, 22011 itemPositionDataEnabled: false 22012 }; 22013 22014 $.Isotope.prototype = { 22015 22016 // sets up widget 22017 _create : function( options ) { 22018 22019 this.options = $.extend( {}, $.Isotope.settings, options ); 22020 22021 this.styleQueue = []; 22022 this.elemCount = 0; 22023 22024 // get original styles in case we re-apply them in .destroy() 22025 var elemStyle = this.element[0].style; 22026 this.originalStyle = {}; 22027 for ( var i=0, len = isoContainerStyles.length; i < len; i++ ) { 22028 var prop = isoContainerStyles[i]; 22029 this.originalStyle[ prop ] = elemStyle[ prop ] || ''; 22030 } 22031 22032 22033 this.element.css({ 22034 overflow : 'hidden', 22035 position : 'relative' 22036 }); 22037 22038 this._updateAnimationEngine(); 22039 this._updateUsingTransforms(); 22040 22041 // sorting 22042 var originalOrderSorter = { 22043 'original-order' : function( $elem, instance ) { 22044 instance.elemCount ++; 22045 return instance.elemCount; 22046 }, 22047 random : function() { 22048 return Math.random(); 22049 } 22050 }; 22051 this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter ); 22052 22053 // need to get atoms 22054 this.reloadItems(); 22055 22056 // get top left position of where the bricks should be 22057 var $cursor = $( document.createElement('div') ).prependTo( this.element ); 22058 this.offset = $cursor.position(); 22059 $cursor.remove(); 22060 22061 // add isotope class first time around 22062 var instance = this; 22063 setTimeout( function() { 22064 instance.element.addClass( instance.options.containerClass ); 22065 }, 0 ); 22066 22067 22068 // bind resize method 22069 if ( this.options.resizable ) { 22070 $(window).bind( 'smartresize.isotope', function() { 22071 instance.resize(); 22072 }); 22073 } 22074 22075 // dismiss all click events from hidden events 22076 this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){ 22077 return false; 22078 }); 22079 }, 22080 22081 _getAtoms : function( $elems ) { 22082 var selector = this.options.itemSelector, 22083 // filter & find 22084 $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems, 22085 // base style for atoms 22086 atomStyle = { position: 'absolute' }; 22087 22088 if ( this.usingTransforms ) { 22089 atomStyle.left = 0; 22090 atomStyle.top = 0; 22091 } 22092 22093 $atoms.css( atomStyle ).addClass( this.options.itemClass ); 22094 22095 this.updateSortData( $atoms, true ); 22096 22097 return $atoms; 22098 }, 22099 22100 // _init fires when your instance is first created 22101 // (from the constructor above), and when you 22102 // attempt to initialize the widget again (by the bridge) 22103 // after it has already been initialized. 22104 _init : function( callback ) { 22105 this.$filteredAtoms = this._filter( this.$allAtoms ); 22106 this._sort(); 22107 this._secondFilter(); 22108 this.reLayout( callback ); 22109 }, 22110 22111 option : function( opts ){ 22112 // change options AFTER initialization: 22113 // signature: $('#foo').bar({ cool:false }); 22114 if ( $.isPlainObject( opts ) ){ 22115 this.options = $.extend( true, this.options, opts ); 22116 22117 // trigger _updateOptionName if it exists 22118 var updateOptionFn; 22119 for ( var optionName in opts ) { 22120 updateOptionFn = '_update' + capitalize( optionName ); 22121 if ( this[ updateOptionFn ] ) { 22122 this[ updateOptionFn ](); 22123 } 22124 } 22125 } 22126 }, 22127 22128 // ====================== updaters ====================== // 22129 // kind of like setters 22130 22131 _updateAnimationEngine : function() { 22132 var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, ''); 22133 // set applyStyleFnName 22134 switch ( animationEngine ) { 22135 case 'css' : 22136 case 'none' : 22137 this.isUsingJQueryAnimation = false;
22138 break; 22139 case 'jquery' : 22140 this.isUsingJQueryAnimation = true; 22141 break; 22142 default : // best available 22143 this.isUsingJQueryAnimation = !Modernizr.csstransitions; 22144 } 22145 22146 this._updateUsingTransforms(); 22147 }, 22148 22149 _updateTransformsEnabled : function() { 22150 this._updateUsingTransforms(); 22151 }, 22152 22153 _updateUsingTransforms : function() { 22154 var usingTransforms = this.usingTransforms = this.options.transformsEnabled && 22155 Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation; 22156 22157 // prevent scales when transforms are disabled 22158 if ( !usingTransforms ) { 22159 delete this.options.hiddenStyle.scale; 22160 delete this.options.visibleStyle.scale; 22161 } 22162 22163 this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs; 22164 }, 22165 22166 22167 // ====================== Filtering ====================== 22168 22169 _filter : function( $atoms ) { 22170 var that = this; 22171 var filter = this.options.filter === '' ? '*' : this.options.filter; 22172 if ( !filter ) { 22173 return $atoms; 22174 } 22175 22176 var hiddenClass = this.options.hiddenClass, 22177 hiddenSelector = '.' + hiddenClass, 22178 $hiddenAtoms = $atoms.filter( hiddenSelector ), 22179 $atomsToShow; 22180 22181 var $filtered = $atoms.filter(filter); 22182 if ( filter !== '*' ) { 22183 $atomsToShow = $hiddenAtoms.filter( filter ); 22184 //ä»è¡¨ç¤ºããã¦ãã¦ãæ¬¡ã«æ®ããªããã®ã®ã¿ãé ã 22185 var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ); 22186 $atomsToHide.addClass( hiddenClass ); 22187 //é ãã ããªãã¬ã¤ã¢ã¦ã調æ´ã¯ãããªãã®ã§ããããã¥ã¼ã«å ¥ãã 22188 this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle }); 22189 } else { 22190 $atomsToShow = $hiddenAtoms; 22191 } 22192 this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle }); 22193 $atomsToShow.removeClass( hiddenClass ); 22194 22195 // console.log($atoms.siblings('.activity').not($atomsToHide).length); 22196 // ãã¹ã¦ã®ã¢ã¯ãã£ããã£ããã£ã«ã¿ãããã empty ããã¯ã¹ã表示ãã 22197 if ($atoms.siblings('.activity').not(hiddenSelector).length < 1) { 22198 this.styleQueue.push({ $el: $atoms.siblings('.empty'), style: this.options.visibleStyle }); 22199 // console.log($filtered); 22200 $filtered = $filtered.add($atoms.siblings('.empty')); 22201 $('.empty').addClass('emptyview'); 22202 /* 22203 * 22204 var filtered = $filtered.add($atoms.siblings('.empty')); 22205 console.log("filtered here"); 22206 console.log(filtered); 22207 22208 var filtered = $.makeArray($filtered.add($atoms.siblings('.empty'))) 22209 , logo = filtered.shift() 22210 , empty = filtered.pop(); 22211 filtered.unshift(empty); 22212 filtered.unshift(logo); 22213 $filtered = $(filtered); 22214 console.log(filtered); 22215 console.log("$filtered here"); 22216 console.log($filtered); 22217 */ 22218 } else { 22219 this.styleQueue.push({ $el: $atoms.siblings('.empty'), style: this.options.hiddenStyle }); 22220 $('.empty').removeClass('emptyview'); 22221 } 22222 22223 return $filtered; 22224 }, 22225 22226 _secondFilter: function() { 22227 var $activities = this.$filteredAtoms.filter('.activity'); 22228 if ($activities.length > 0) { 22229 var $last = $activities[$activities.length - 1]; 22230 } else { 22231 var $last = this.$filteredAtoms.filter('.empty'); 22232 } 22233 var $atomsToHide = this.$filteredAtoms.slice(this.$filteredAtoms.index($last) + 2).addClass(this.options.hiddenClass); 22234 this.$filteredAtoms = this.$filteredAtoms.slice(0, this.$filteredAtoms.index($last) + 2); 22235 this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle }); 22236 }, 22237 22238 // ====================== Sorting ====================== 22239 22240 updateSortData : function( $atoms, isIncrementingElemCount ) { 22241 var instance = this, 22242 getSortData = this.options.getSortData, 22243 $this, sortData; 22244 $atoms.each(function(){ 22245 $this = $(this); 22246 sortData = {}; 22247 // get value for sort data based on fn( $elem ) passed in 22248 for ( var key in getSortData ) { 22249 if ( !isIncrementingElemCount && key === 'original-order' ) { 22250 // keep original order original 22251 sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ]; 22252 } else { 22253 sortData[ key ] = getSortData[ key ]( $this, instance ); 22254 } 22255 } 22256 // apply sort data to element 22257 $.data( this, 'isotope-sort-data', sortData ); 22258 }); 22259 }, 22260 22261 // used on all the filtered atoms 22262 _sort : function() { 22263 /* 22264 var sortBy = this.options.sortBy, 22265 getSorter = this._getSorter, 22266 sortDir = this.options.sortAscending ? 1 : -1, 22267 sortFn = function( alpha, beta ) { 22268 var a = getSorter( alpha, sortBy ), 22269 b = getSorter( beta, sortBy ); 22270 // fall back to original order if data matches 22271 if ( a === b && sortBy !== 'original-order') { 22272 a = getSorter( alpha, 'original-order' ); 22273 b = getSorter( beta, 'original-order' ); 22274 } 22275 return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir; 22276 }; 22277 22278 this.$filteredAtoms.sort( sortFn ); 22279*/ 22280 var that = this; 22281 var activities = $.makeArray(this.$filteredAtoms.filter('.activity')).c
22281oncat($.makeArray(this.$filteredAtoms.filter('.empty'))); 22282 var fix = $.makeArray(this.$filteredAtoms.filter('.fix')); 22283 var i = 0; 22284 var res = []; 22285 while (activities.length > 0 ) { 22286 i++; 22287 // console.log(that._getSorter(fix[0], 'original-order')); 22288 if (fix.length > 0 && i === that._getSorter(fix[0], 'original-order')) { 22289 res.push(fix.shift()); 22290 } else { 22291 res.push(activities.shift()); 22292 } 22293 } 22294 // console.log(fix); 22295 Array.prototype.push.apply(res, fix); 22296 // console.log(res); 22297 this.$filteredAtoms.sort(function(a, b) { 22298 return res.indexOf(a) < res.indexOf(b) ? -1 : 1; 22299 }); 22300 }, 22301 22302 _getSorter : function( elem, sortBy ) { 22303 return $.data( elem, 'isotope-sort-data' )[ sortBy ]; 22304 }, 22305 22306 // ====================== Layout Helpers ====================== 22307 22308 _translate : function( x, y ) { 22309 return { translate : [ x, y ] }; 22310 }, 22311 22312 _positionAbs : function( x, y ) { 22313 return { left: x, top: y }; 22314 }, 22315 22316 _pushPosition : function( $elem, x, y ) { 22317 x += this.offset.left; 22318 y += this.offset.top; 22319 var position = this.getPositionStyles( x, y ); 22320 this.styleQueue.push({ $el: $elem, style: position }); 22321 if ( this.options.itemPositionDataEnabled ) { 22322 $elem.data('isotope-item-position', {x: x, y: y} ); 22323 } 22324 }, 22325 22326 // ====================== General Layout ====================== 22327 22328 // used on collection of atoms (should be filtered, and sorted before ) 22329 // accepts atoms-to-be-laid-out to start with 22330 layout : function( $elems, callback ) { 22331 var layoutMode = this.options.layoutMode; 22332 // layout logic 22333 this[ '_' + layoutMode + 'Layout' ]( $elems ); 22334 // set the size of the container 22335 if ( this.options.resizesContainer ) { 22336 var containerStyle = this[ '_' + layoutMode + 'GetContainerSize' ](); 22337 this.styleQueue.push({ $el: this.element, style: containerStyle }); 22338 } 22339 this._processStyleQueue( $elems, callback ); 22340 this.isLaidOut = true; 22341 }, 22342 _processStyleQueue : function( $elems, callback ) { 22343 22344 // are we animating the layout arrangement? 22345 // use plugin-ish syntax for css or animate 22346 var styleFn = !this.isLaidOut ? 'css' : ( 22347 this.isUsingJQueryAnimation ? 'animate' : 'css' 22348 ), 22349 animOpts = this.options.animationOptions, 22350 objStyleFn, processor, 22351 triggerCallbackNow, callbackFn; 22352 22353 // default styleQueue processor, may be overwritten down below 22354 processor = function( i, obj ) { 22355 obj.$el[ styleFn ]( obj.style, animOpts ); 22356 }; 22357 22358 if ( this._isInserting && this.isUsingJQueryAnimation ) { 22359 // if using styleQueue to insert items 22360 processor = function( i, obj ) { 22361 22362 // only animate if it not being inserted 22363 objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn; 22364 obj.$el[ objStyleFn ]( obj.style, animOpts ); 22365 }; 22366 22367 } else if ( callback ) { 22368 22369 // has callback 22370 var isCallbackTriggered = false, 22371 instance = this; 22372 triggerCallbackNow = true; 22373 // trigger callback only once 22374 callbackFn = function() { 22375 if ( isCallbackTriggered ) { 22376 return; 22377 } 22378 callback.call( instance.element, $elems ); 22379 isCallbackTriggered = true; 22380 }; 22381 22382 if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) { 22383 // add callback to animation options 22384 animOpts.complete = callbackFn; 22385 triggerCallbackNow = false; 22386 22387 } else if ( Modernizr.csstransitions ) { 22388 // detect if first item has transition 22389 var i = 0, 22390 testElem = this.styleQueue[0].$el, 22391 styleObj; 22392 // get first non-empty jQ object 22393 while ( !testElem.length ) { 22394 styleObj = this.styleQueue[ i++ ]; 22395 22396 // HACK: sometimes styleQueue[i] is undefined 22397 if ( !styleObj ) { 22398 return; 22399 } 22400 testElem = styleObj.$el; 22401 } 22402 // get transition duration of the first element in that object 22403 // yeah, this is inexact 22404 var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] ); 22405 if ( duration > 0 ) { 22406 22407 processor = function( i, obj ) { 22408 obj.$el[ styleFn ]( obj.style, animOpts ) 22409 // trigger callback at transition end 22410 .one( transitionEndEvent, callbackFn ); 22411 }; 22412 triggerCallbackNow = false;
22413 } 22414 } 22415 } 22416 22417 22418 22419 // process styleQueue 22420 $.each( this.styleQueue, processor ); 22421 22422 if ( triggerCallbackNow ) { 22423 callbackFn(); 22424 } 22425 22426 // clear out queue for next time 22427 this.styleQueue = []; 22428 }, 22429 22430 22431 resize : function() { 22432 if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) { 22433 this.reLayout(); 22434 } 22435 }, 22436 22437 22438 reLayout : function( callback ) { 22439 22440 this[ '_' + this.options.layoutMode + 'Reset' ](); 22441 this.layout( this.$filteredAtoms, callback ); 22442 22443 }, 22444 22445 // ====================== Convenience methods ====================== 22446 22447 // ====================== Adding items ====================== 22448 22449 // adds a jQuery object of items to a isotope container 22450 addItems : function( $content, callback ) { 22451 var $newAtoms = this._getAtoms( $content ); 22452 // add new atoms to atoms pools 22453 this.$allAtoms = this.$allAtoms.add( $newAtoms ); 22454 22455 if ( callback ) { 22456 callback( $newAtoms ); 22457 } 22458 }, 22459 22460 // convienence method for adding elements properly to any layout 22461 // positions items, hides them, then animates them back in <--- very sezzy 22462 insert : function( $content, callback ) { 22463 // position items 22464 this.element.append( $content ); 22465 var instance = this; 22466 this.addItems( $content, function( $newAtoms ) { 22467 var $newFilteredAtoms = instance._filter( $newAtoms, true ); 22468 instance._addHideAppended( $newFilteredAtoms ); 22469 instance._sort(); 22470 instance.reLayout(); 22471 instance._revealAppended( $newFilteredAtoms, callback ); 22472 }); 22473 22474 }, 22475 22476 // convienence method for working with Infinite Scroll 22477 appended : function( $content, callback ) { 22478 var instance = this; 22479 this.addItems( $content, function( $newAtoms ) { 22480 instance._addHideAppended( $newAtoms ); 22481 instance.layout( $newAtoms ); 22482 instance._revealAppended( $newAtoms, callback ); 22483 }); 22484 }, 22485 22486 // adds new atoms, then hides them before positioning 22487 _addHideAppended : function( $newAtoms ) { 22488 this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms ); 22489 $newAtoms.addClass('no-transition'); 22490 22491 this._isInserting = true; 22492 22493 // apply hidden styles 22494 this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle }); 22495 }, 22496 22497 // sets visible style on new atoms 22498 _revealAppended : function( $newAtoms, callback ) { 22499 var instance = this; 22500 // apply visible style after a sec 22501 setTimeout( function() { 22502 // enable animation 22503 $newAtoms.removeClass('no-transition'); 22504 // reveal newly inserted filtered elements 22505 instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle }); 22506 instance._isInserting = false; 22507 instance._processStyleQueue( $newAtoms, callback ); 22508 }, 10 ); 22509 }, 22510 22511 // gathers all atoms 22512 reloadItems : function() { 22513 this.$allAtoms = this._getAtoms( this.element.children() ); 22514 }, 22515 22516 // removes elements from Isotope widget 22517 remove : function( $content ) { 22518 22519 this.$allAtoms = this.$allAtoms.not( $content ); 22520 this.$filteredAtoms = this.$filteredAtoms.not( $content ); 22521 22522 $content.remove(); 22523 22524 }, 22525 22526 shuffle : function( callback ) { 22527 this.updateSortData( this.$allAtoms ); 22528 this.options.sortBy = 'random'; 22529 this._sort(); 22530 this.reLayout( callback ); 22531 }, 22532 22533 // destroys widget, returns elements and container back (close) to original style 22534 destroy : function() { 22535 22536 var usingTransforms = this.usingTransforms; 22537 22538 this.$allAtoms 22539 .removeClass( this.options.hiddenClass + ' ' + this.options.itemClass ) 22540 .each(function(){ 22541 this.style.position = ''; 22542 this.style.top = ''; 22543 this.style.left = ''; 22544 this.style.opacity = ''; 22545 if ( usingTransforms ) { 22546 this.style[ transformProp ] = ''; 22547 } 22548 }); 22549 22550 // re-apply saved container styles 22551 var elemStyle = this.element[0].style; 22552 for ( var i=0, len = isoContainerStyles.length; i < len; i++ ) { 22553 var prop = isoContainerStyles[i]; 22554 elemStyle[ prop ] = this.originalStyle[ prop ]; 22555 } 22556 22557 this.element 22558 .unbind('.isotope') 22559 .undelegate( '.' + this.options.hiddenClass, 'click' ) 22560 .removeClass( this.options.containerClass ) 22561 .removeData('isotope'); 22562 22563 $(window).unbind('.isotope'); 22564 22565 }, 22566 22567 22568 // ====================== LAYOUTS ====================== 22569
22570 // calculates number of rows or columns 22571 // requires columnWidth or rowHeight to be set on namespaced object 22572 // i.e. this.masonry.columnWidth = 200 22573 _getSegments : function( isRows ) { 22574 var namespace = this.options.layoutMode, 22575 measure = isRows ? 'rowHeight' : 'columnWidth', 22576 size = isRows ? 'height' : 'width', 22577 segmentsName = isRows ? 'rows' : 'cols', 22578 containerSize = this.element[ size ](), 22579 segments, 22580 // i.e. options.masonry && options.masonry.columnWidth 22581 segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] || 22582 // or use the size of the first item, i.e. outerWidth 22583 this.$filteredAtoms[ 'outer' + capitalize(size) ](true) || 22584 // if there's no items, use size of container 22585 containerSize; 22586 22587 segments = Math.floor( containerSize / segmentSize ); 22588 segments = Math.max( segments, 1 ); 22589 22590 // i.e. this.masonry.cols = .... 22591 this[ namespace ][ segmentsName ] = segments; 22592 // i.e. this.masonry.columnWidth = ... 22593 this[ namespace ][ measure ] = segmentSize; 22594 22595 }, 22596 22597 _checkIfSegmentsChanged : function( isRows ) { 22598 var namespace = this.options.layoutMode, 22599 segmentsName = isRows ? 'rows' : 'cols', 22600 prevSegments = this[ namespace ][ segmentsName ]; 22601 // update cols/rows 22602 this._getSegments( isRows ); 22603 // return if updated cols/rows is not equal to previous 22604 return ( this[ namespace ][ segmentsName ] !== prevSegments ); 22605 }, 22606 22607 // ====================== Masonry ====================== 22608 22609 _masonryReset : function() { 22610 // layout-specific props 22611 this.masonry = {}; 22612 // FIXME shouldn't have to call this again 22613 this._getSegments(); 22614 var i = this.masonry.cols; 22615 this.masonry.colYs = []; 22616 while (i--) { 22617 this.masonry.colYs.push( 0 ); 22618 } 22619 }, 22620 22621 _masonryLayout : function( $elems ) { 22622 var instance = this, 22623 props = instance.masonry; 22624 // console.log($elems); 22625 $elems.each(function(i){ 22626 var $this = $(this); 22627 var colSpan; 22628 var tmp = [2, 9, 14, 18, 26, 32, 38, 47, 52, 56, 63]; 22629 // if ($.inArray(i, tmp) > -1) { 22630 // colSpan = 2; 22631 // $this.find('.large').fadeIn('fast'); 22632 // } else { 22633 colSpan = 1; 22634 $this.find('.large').fadeOut('fast'); 22635 // } 22636 //how many columns does this brick span 22637 //colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth ); 22638 //colSpan = Math.ceil(i === 1 ? 2 : ($this.outerWidth(true) / props.columnWidth)); 22639 colSpan = Math.min( colSpan, props.cols ); 22640 if ( colSpan === 1 ) { 22641 // if brick spans only one column, just like singleMode 22642 instance._masonryPlaceBrick( $this, props.colYs ); 22643 } else { 22644 // brick spans more than one column 22645 // how many different places could this brick fit horizontally 22646 var groupCount = props.cols + 1 - colSpan, 22647 groupY = [], 22648 groupColY, 22649 i; 22650 22651 // for each group potential horizontal position 22652 for ( i=0; i < groupCount; i++ ) { 22653 // make an array of colY values for that one group 22654 groupColY = props.colYs.slice( i, i+colSpan ); 22655 // and get the max value of the array 22656 groupY[i] = Math.max.apply( Math, groupColY ); 22657 } 22658 22659 22660 instance._masonryPlaceBrick( $this, groupY ); 22661 } 22662 }); 22663 }, 22664 22665 // worker method that places brick in the columnSet 22666 // with the the minY 22667 _masonryPlaceBrick : function( $brick, setY ) { 22668 // get the minimum Y value from the columns 22669 var minimumY = Math.min.apply( Math, setY ), 22670 shortCol = 0; 22671 22672 // Find index of short column, the first from the left 22673 for (var i=0, len = setY.length; i < len; i++) { 22674 if ( setY[i] === minimumY ) { 22675 shortCol = i; 22676 break; 22677 } 22678 } 22679 22680 // position the brick 22681 var x = this.masonry.columnWidth * shortCol, 22682 y = minimumY; 22683 this._pushPosition( $brick, x, y ); 22684 22685 // apply setHeight to necessary columns 22686 var setHeight = minimumY + $brick.outerHeight(true), 22687 setSpan = this.masonry.cols + 1 - len; 22688 for ( i=0; i < setSpan; i++ ) { 22689 this.masonry.colYs[ shortCol + i ] = setHeight; 22690 } 22691 22692 }, 22693 22694 _masonryGetContainerSize : function() { 22695 var containerHeight = Math.max.apply( Math, this.masonry.colYs ); 22696 return { height: containerHeight }; 22697 }, 22698 22699 _masonryResizeChanged : function() { 22700 return this._checkIfSegmentsChanged(); 22701 } 22702 }; 22703 22704 22705 // ======================= imagesLoaded Plugin =============================== 22706 /*! 22707 * jQuery imagesLoaded plugin v1.0.3 22708 * http://github.com/desandro/imagesloaded 22709 * 22710 * MIT License. by Paul Irish et al. 22711 */ 22712 22713 22714 // $('#my-container').imagesLoaded(myFunction) 22715 // or 22716 // $('img').imagesLoaded(myFunction) 22717 22718 // execute a callback when all images have loaded. 22719 // needed because .load() doesn't work on cached images 22720 22721 // callback function gets image collection as argument 22722 // `this` is the container 22723 22724 $.fn.imagesLoaded = function( callback ) { 22725 var $this = this, 22726 $images = $this.find('img').add( $this.filter('img') ), 22727 len = $images.length, 22728 blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; 22729 22730 function triggerCallback() { 22731 callback.call( $this, $images ); 22732 } 22733 22734 function imgLoaded( event ) { 22735 if ( --len <= 0 && event.target.src !== blank ){ 22736 setTimeout( triggerCallback ); 22737 $images.unbind( 'load error', imgLoaded ); 22738 } 22739 } 22740 22741 if ( !len ) { 22742 triggerCallback(); 22743 } 22744 22745 $images.bind( 'load error', imgLoaded ).each( function() { 22746 // cached images don't fire load sometimes, so we reset src. 22747 if (this.complete || this.complete === undefined){ 22748 var src = this.src; 22749 // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f 22750 // data uri bypasses webkit log warning (thx doug jones) 22751 this.src = blank; 22752 this.src = src; 22753 } 22754 }); 22755 22756 return $this; 22757 }; 22758 22759 22760 // helper function for logging errors 22761 // $.error breaks jQuery chaining 22762 var logError = function( message ) { 22763 if ( window.console ) { 22764 window.console.error( message ); 22765 } 22766 }; 22767 22768 // ======================= Plugin bridge =============================== 22769 // leverages data method to either create or return $.Isotope constructor 22770 // A bit from jQuery UI 22771 // https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js 22772 // A bit from jcarousel 22773 // https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarou
22773sel.js 22774 22775 $.fn.isotope = function( options, callback ) { 22776 if ( typeof options === 'string' ) { 22777 // call method 22778 var args = Array.prototype.slice.call( arguments, 1 ); 22779 22780 this.each(function(){ 22781 var instance = $.data( this, 'isotope' ); 22782 if ( !instance ) { 22783 logError( "cannot call methods on isotope prior to initialization; " + 22784 "attempted to call method '" + options + "'" ); 22785 return; 22786 } 22787 if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { 22788 logError( "no such method '" + options + "' for isotope instance" ); 22789 return; 22790 } 22791 // apply method 22792 instance[ options ].apply( instance, args ); 22793 }); 22794 } else { 22795 this.each(function() { 22796 var instance = $.data( this, 'isotope' ); 22797 if ( instance ) { 22798 // apply options & init 22799 instance.option( options ); 22800 instance._init( callback ); 22801 } else { 22802 // initialize new instance 22803 $.data( this, 'isotope', new $.Isotope( options, this, callback ) ); 22804 } 22805 }); 22806 } 22807 // return jQuery object 22808 // so plugin methods do not have to 22809 return this; 22810 }; 22811 22812})( window, jQuery ); 22813/* 22814 * jScrollPane - v2.0.0beta11 - 2011-07-04 22815 * http://jscrollpane.kelvinluck.com/ 22816 * 22817 * Copyright (c) 2010 Kelvin Luck 22818 * Dual licensed under the MIT and GPL licenses. 22819 */ 22820(function(b,a,c){b.fn.jScrollPane=function(e){function d(D,O){var az,Q=this,Y,ak,v,am,T,Z,y,q,aA,aF,av,i,I,h,j,aa,U,aq,X,t,A,ar,af,an,G,l,au,ay,x,aw,aI,f,L,aj=true,P=true,aH=false,k=false,ap=D.clone(false,false).empty(),ac=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aI=D.css("paddingTop")+" "+D.css("paddingRight")+" "+D.css("paddingBottom")+" "+D.css("paddingLeft");f=(parseInt(D.css("paddingLeft"),10)||0)+(parseInt(D.css("paddingRight"),10)||0);function at(aR){var aM,aO,aN,aK,aJ,aQ,aP=false,aL=false;az=aR;if(Y===c){aJ=D.scrollTop();aQ=D.scrollLeft();D.css({overflow:"hidden",padding:0});ak=D.innerWidth()+f;v=D.innerHeight();D.width(ak);Y=b('<div class="jspPane" />').css("padding",aI).append(D.children());am=b('<div class="jspContainer" />').css({width:ak+"px",height:v+"px"}).append(Y).appendTo(D)}else{D.css("width","");aP=az.stickToBottom&&K();aL=az.stickToRight&&B();aK=D.innerWidth()+f!=ak||D.outerHeight()!=v;if(aK){ak=D.innerWidth()+f;v=D.innerHeight();am.css({width:ak+"px",height:v+"px"})}if(!aK&&L==T&&Y.outerHeight()==Z){D.width(ak);return}L=T;Y.css("width","");D.width(ak);am.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Y.css("overflow","auto");if(aR.contentWidth){T=aR.contentWidth}else{T=Y[0].scrollWidth}Z=Y[0].scrollHeight;Y.css("overflow","");y=T/ak;q=Z/v;aA=q>1;aF=y>1;if(!(aF||aA)){D.removeClass("jspScrollable");Y.css({top:0,width:am.width()-f});n();E();R();w();ai()}else{D.addClass("jspScrollable");aM=az.maintainPosition&&(I||aa);if(aM){aO=aD();aN=aB()}aG();z();F();if(aM){N(aL?(T-ak):aO,false);M(aP?(Z-v):aN,false)}J();ag();ao();if(az.enableKeyboardNavigation){S()}if(az.clickOnTrack){p()}C();if(az.hijackInternalLinks){m()}}if(az.autoReinitialise&&!aw){aw=setInterval(function(){at(az)},az.autoReinitialiseDelay)}else{if(!az.autoReinitialise&&aw){clearInterval(aw)}}aJ&&D.scrollTop(0)&&M(aJ,false);aQ&&D.scrollLeft(0)&&N(aQ,false);D.trigger("jsp-initialised",[aF||aA])}function aG(){if(aA){am.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));U=am.find(">.jspVerticalBar");aq=U.find(">.jspTrack");av=aq.find(">.jspDrag");if(az.showArrows){ar=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aE(0,-1)).bind("click.jsp",aC);af=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aE(0,1)).bind("click.jsp",aC);if(az.arrowScrollOnHover){ar.bind("mouseover.jsp",aE(0,-1,ar));af.bind("mouseover.jsp",aE(0,1,af))}al(aq,az.verticalArrowPositions,ar,af)}t=v;am.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){t-=b(this).outerHeight()});av.hover(function(){av.addClass("jspHover")},function(){av.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);av.addClass("jspActive");var s=aJ.pageY-av.position().top;b("html").bind("mousemove.jsp",function(aK){V(aK.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});o()}}function o(){aq.height(t+"px");I=0;X=az.verticalGutter+aq.outerWidth();Y.width(ak-X-f);try{if(U.position().left===0){Y.css("margin-left",X+"px")}}catch(s){}}function z(){if(aF){am.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));an=am.find(">.jspHorizontalBar");G=an.find(">.jspTrack");h=G.find(">.jspDrag");
22820if(az.showArrows){ay=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aE(-1,0)).bind("click.jsp",aC);x=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aE(1,0)).bind("click.jsp",aC); 22821if(az.arrowScrollOnHover){ay.bind("mouseover.jsp",aE(-1,0,ay));x.bind("mouseover.jsp",aE(1,0,x))}al(G,az.horizontalArrowPositions,ay,x)}h.hover(function(){h.addClass("jspHover")},function(){h.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);h.addClass("jspActive");var s=aJ.pageX-h.position().left;b("html").bind("mousemove.jsp",function(aK){W(aK.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});l=am.innerWidth();ah()}}function ah(){am.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){l-=b(this).outerWidth()});G.width(l+"px");aa=0}function F(){if(aF&&aA){var aJ=G.outerHeight(),s=aq.outerWidth();t-=aJ;b(an).find(">.jspCap:visible,>.jspArrow").each(function(){l+=b(this).outerWidth()});l-=s;v-=s;ak-=aJ;G.parent().append(b('<div class="jspCorner" />').css("width",aJ+"px"));o();ah()}if(aF){Y.width((am.outerWidth()-f)+"px")}Z=Y.outerHeight();q=Z/v;if(aF){au=Math.ceil(1/y*l);if(au>az.horizontalDragMaxWidth){au=az.horizontalDragMaxWidth}else{if(au<az.horizontalDragMinWidth){au=az.horizontalDragMinWidth}}h.width(au+"px");j=l-au;ae(aa)}if(aA){A=Math.ceil(1/q*t);if(A>az.verticalDragMaxHeight){A=az.verticalDragMaxHeight}else{if(A<az.verticalDragMinHeight){A=az.verticalDragMinHeight}}av.height(A+"px");i=t-A;ad(I)}}function al(aK,aM,aJ,s){var aO="before",aL="after",aN;if(aM=="os"){aM=/Mac/.test(navigator.platform)?"after":"split"}if(aM==aO){aL=aM}else{if(aM==aL){aO=aM;aN=aJ;aJ=s;s=aN}}aK[aO](aJ)[aL](s)}function aE(aJ,s,aK){return function(){H(aJ,s,this,aK);this.blur();return false}}function H(aM,aL,aP,aO){aP=b(aP).addClass("jspActive");var aN,aK,aJ=true,s=function(){if(aM!==0){Q.scrollByX(aM*az.arrowButtonSpeed)}if(aL!==0){Q.scrollByY(aL*az.arrowButtonSpeed)}aK=setTimeout(s,aJ?az.initialDelay:az.arrowRepeatFreq);aJ=false};s();aN=aO?"mouseout.jsp":"mouseup.jsp";aO=aO||b("html");aO.bind(aN,function(){aP.removeClass("jspActive");aK&&clearTimeout(aK);aK=null;aO.unbind(aN)})}function p(){w();if(aA){aq.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageY-aP.top-I,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageY-aS.top-A/2,aQ=v*az.scrollPagePercent,aR=i*aQ/(Z-v);if(aN<0){if(I-aR>aT){Q.scrollByY(-aQ)}else{V(aT)}}else{if(aN>0){if(I+aR<aT){Q.scrollByY(aQ)}else{V(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}if(aF){G.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageX-aP.left-aa,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageX-aS.left-au/2,aQ=ak*az.scrollPagePercent,aR=j*aQ/(T-ak);if(aN<0){if(aa-aR>aT){Q.scrollByX(-aQ)}else{W(aT)}}else{if(aN>0){if(aa+aR<aT){Q.scrollByX(aQ)}else{W(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}}function w(){if(G){G.unbind("mousedown.jsp")}if(aq){aq.unbind("mousedown.jsp")}}function ax(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(av){av.removeClass("jspActive")}if(h){h.removeClass("jspActive")}}function V(s,aJ){if(!aA){return}if(s<0){s=0}else{if(s>i){s=i}}if(aJ===c){aJ=az.animateScroll}if(aJ){Q.animate(av,"top",s,ad)}else{av.css("top",s);ad(s)}}function ad(aJ){if(aJ===c){aJ=av.position().top}am.scrollTop(0);I=aJ;var aM=I===0,aK=I==i,aL=aJ/i,s=-aL*(Z-v);if(aj!=aM||aH!=aK){aj=aM;aH=aK;D.trigger("jsp-arrow-change",[aj,aH,P,k])}u(aM,aK);Y.css("top",s);D.trigger("jsp-scroll-y",[-s,aM,aK]).trigger("scroll")}function W(aJ,s){if(!aF){return}if(aJ<0){aJ=0}else{if(aJ>j){aJ=j}}if(s===c){s=az.animateScroll}if(s){Q.animate(h,"left",aJ,ae) 22822}else{h.css("left",aJ);ae(aJ)}}function ae(aJ){if(aJ===c){aJ=h.position().left}am.scrollTop(0);aa=aJ;var aM=aa===0,aL=aa==j,aK=aJ/j,s=-aK*(T-ak);if(P!=aM||k!=aL){P=aM;k=aL;D.trigger("jsp-arrow-change",[aj,aH,P,k])}r(aM,aL);Y.css("left",s);D.trigger("jsp-scroll-x",[-s,aM,aL]).trigger("scroll")}function u(aJ,s){if(az.showArrows){ar[aJ?"addClass":"removeClass"]("jspDisabled");af[s?"addClass":"removeClass"]("jspDisabled")}}function r(aJ,s){if(az.showArrows){ay[aJ?"addClass":"removeClass"]("jspDisabled");x[s?"addClass":"removeClass"]("jspDisabled")}}function M(s,aJ){var aK=s/(Z-v);V(aK*i,aJ)}function N(aJ,s){var aK=aJ/(T-ak);W(aK*j,s)}function ab(aW,aR,aK){var aO,aL,aM,s=0,aV=0,aJ,aQ,aP,aT,aS,aU;try{aO=b(aW)}catch(aN){return}aL=aO.outerHeight();aM=aO.outerWidth();am.scrollTop(0);am.scrollLeft(0);while(!aO.is(".jspPane")){s+=aO.position().top;aV+=aO.position().left;aO=aO.offsetParent();if(/^body|html$/i.test(aO[0].nodeName)){return}}aJ=aB();aP=aJ+v;if(s<aJ||aR){aS=s-az.verticalGutter}else{if(s+aL>aP){aS=s-v+aL+az.verticalGutter}}if(aS){M(aS,aK)}aQ=aD();aT=aQ+ak;if(aV<aQ||aR){aU=aV-az.horizontalGutter}else{if(aV+aM>aT){aU=aV-ak+aM+az.horizontalGutter}}if(aU){N(aU,aK)}}function aD(){return -Y.position().left}function aB(){return -Y.position().top}function K(){var s=Z-v;return(s>
2282220)&&(s-aB()<10)}function B(){var s=T-ak;return(s>20)&&(s-aD()<10)}function ag(){am.unbind(ac).bind(ac,function(aM,aN,aL,aJ){var aK=aa,s=I;Q.scrollBy(aL*az.mouseWheelSpeed,-aJ*az.mouseWheelSpeed,false);return aK==aa&&s==I})}function n(){am.unbind(ac)}function aC(){return false}function J(){Y.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ab(s.target,false)})}function E(){Y.find(":input,a").unbind("focus.jsp")}function S(){var s,aJ,aL=[];aF&&aL.push(an[0]);aA&&aL.push(U[0]);Y.focus(function(){D.focus()});D.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aO){if(aO.target!==this&&!(aL.length&&b(aO.target).closest(aL).length)){return}var aN=aa,aM=I;switch(aO.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aO.keyCode;aK();break;case 35:M(Z-v);s=null;break;case 36:M(0);s=null;break}aJ=aO.keyCode==s&&aN!=aa||aM!=I;return !aJ}).bind("keypress.jsp",function(aM){if(aM.keyCode==s){aK()}return !aJ});if(az.hideFocus){D.css("outline","none");if("hideFocus" in am[0]){D.attr("hideFocus",true)}}else{D.css("outline","");if("hideFocus" in am[0]){D.attr("hideFocus",false)}}function aK(){var aN=aa,aM=I;switch(s){case 40:Q.scrollByY(az.keyboardSpeed,false);break;case 38:Q.scrollByY(-az.keyboardSpeed,false);break;case 34:case 32:Q.scrollByY(v*az.scrollPagePercent,false);break;case 33:Q.scrollByY(-v*az.scrollPagePercent,false);break;case 39:Q.scrollByX(az.keyboardSpeed,false);break;case 37:Q.scrollByX(-az.keyboardSpeed,false);break}aJ=aN!=aa||aM!=I;return aJ}}function R(){D.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function C(){if(location.hash&&location.hash.length>1){var aL,aJ,aK=escape(location.hash);try{aL=b(aK)}catch(s){return}if(aL.length&&Y.find(aK)){if(am.scrollTop()===0){aJ=setInterval(function(){if(am.scrollTop()>0){ab(aK,true);b(document).scrollTop(am.position().top);clearInterval(aJ)}},50)}else{ab(aK,true);b(document).scrollTop(am.position().top)}}}}function ai(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function m(){ai();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aJ;if(s.length>1){aJ=s[1];if(aJ.length>0&&Y.find("#"+aJ).length>0){ab("#"+aJ,true);return false}}})}function ao(){var aK,aJ,aM,aL,aN,s=false;am.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aO){var aP=aO.originalEvent.touches[0];aK=aD();aJ=aB();aM=aP.pageX;aL=aP.pageY;aN=false;s=true}).bind("touchmove.jsp",function(aR){if(!s){return}var aQ=aR.originalEvent.touches[0],aP=aa,aO=I;Q.scrollTo(aK+aM-aQ.pageX,aJ+aL-aQ.pageY);aN=aN||Math.abs(aM-aQ.pageX)>5||Math.abs(aL-aQ.pageY)>5; 22823return aP==aa&&aO==I}).bind("touchend.jsp",function(aO){s=false}).bind("click.jsp-touchclick",function(aO){if(aN){aN=false;return false}})}function g(){var s=aB(),aJ=aD();D.removeClass("jspScrollable").unbind(".jsp");D.replaceWith(ap.append(Y.children()));ap.scrollTop(s);ap.scrollLeft(aJ)}b.extend(Q,{reinitialise:function(aJ){aJ=b.extend({},az,aJ);at(aJ)},scrollToElement:function(aK,aJ,s){ab(aK,aJ,s)},scrollTo:function(aK,s,aJ){N(aK,aJ);M(s,aJ)},scrollToX:function(aJ,s){N(aJ,s)},scrollToY:function(s,aJ){M(s,aJ)},scrollToPercentX:function(aJ,s){N(aJ*(T-ak),s)},scrollToPercentY:function(aJ,s){M(aJ*(Z-v),s)},scrollBy:function(aJ,s,aK){Q.scrollByX(aJ,aK);Q.scrollByY(s,aK)},scrollByX:function(s,aK){var aJ=aD()+Math[s<0?"floor":"ceil"](s),aL=aJ/(T-ak);W(aL*j,aK)},scrollByY:function(s,aK){var aJ=aB()+Math[s<0?"floor":"ceil"](s),aL=aJ/(Z-v);V(aL*i,aK)},positionDragX:function(s,aJ){W(s,aJ)},positionDragY:function(aJ,s){V(aJ,s)},animate:function(aJ,aM,s,aL){var aK={};aK[aM]=s;aJ.animate(aK,{duration:az.animateDuration,easing:az.animateEase,queue:false,step:aL})},getContentPositionX:function(){return aD()},getContentPositionY:function(){return aB()},getContentWidth:function(){return T},getContentHeight:function(){return Z},getPercentScrolledX:function(){return aD()/(T-ak)},getPercentScrolledY:function(){return aB()/(Z-v)},getIsScrollableH:function(){return aF},getIsScrollableV:function(){return aA},getContentPane:function(){return Y},scrollToBottom:function(s){V(i,s)},hijackInternalLinks:function(){m()},destroy:function(){g()}});at(O)}e=b.extend({},b.fn.jScrollPane.defaults,e);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){e[this]=e[this]||e.speed});return this.each(function(){var f=b(this),g=f.data("jsp");if(g){g.reinitialise(e)}else{g=new d(f,e);f.data("jsp",g)}})};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this); 22824/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) 22825 * Licensed under the MIT License (LICENSE.txt). 22826 * 22827 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 22828 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 22829 * Thanks to: Seamus Leahy for adding deltaX and deltaY 22830 * 22831 * Version: 3.0.4 22832 * 22833 * Requires: 1.2.2+ 22834 */ 22835 22836(function($) { 22837 22838var types = ['DOMMouseScroll', 'mousewheel']; 22839 22840$.event.special.mousewheel = { 22841 setup: function() { 22842 if ( this.addEventListener ) { 22843 for ( var i=types.length; i; ) { 22844 this.addEventListener( types[--i], handler, false ); 22845 } 22846 } else { 22847 this.onmousewheel = handler; 22848 } 22849 }, 22850 22851 teardown: function() { 22852 if ( this.removeEventListener ) { 22853 for ( var i=types.length; i; ) { 22854 this.removeEventListener( types[--i], handler, false ); 22855 } 22856 } else { 22857 this.onmousewheel = null; 22858 } 22859 } 22860}; 22861 22862$.fn.extend({ 22863 mousewheel: function(fn) { 22864 return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 22865 }, 22866 22867 unmousewheel: function(fn) { 22868 return this.unbind("mousewheel", fn); 22869 } 22870}); 22871 22872 22873function handler(event) { 22874 var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; 22875 event = $.event.fix(orgEvent); 22876 event.type = "mousewheel"; 22877 22878 // Old school scrollwheel delta 22879 if ( event.wheelDelta ) { delta = event.wheelDelta/120; } 22880 if ( event.detail ) { delta = -event.detail/3; } 22881 22882 // New school multidimensional scroll (touchpads) deltas 22883 deltaY = delta; 22884 22885 // Gecko 22886 if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 22887 deltaY = 0; 22888 deltaX = -1*delta; 22889 } 22890 22891 // Webkit 22892 if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } 22893 if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } 22894 22895 // Add event and delta to the front of the arguments 22896 args.unshift(event, delta, deltaX, deltaY); 22897 22898 return $.event.handle.apply(this, args); 22899} 22900 22901})(jQuery); 22902!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).LazyLoad=t()}(this,(function(){"use strict";function n(){return n=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},n.apply(this,arguments)}var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),o=t&&"IntersectionObserver"in window,i=t&&"classList"in document.createElement("p"),a=t&&window.devicePixelRatio>1,r={elements_selector:".lazy",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},c=function(t){return n({},r,t)},u=function(n,t){var e,o="LazyLoad::Initialized",i=new n(t);try{e=new CustomEvent(o,{detail:{instance:i}})}catch(n){(e=document.createEvent("CustomEvent")).initCustomEvent(o,!1,!1,{instance:i})}window.dispatchEvent(e)},l="src",s="srcset",f="sizes",d="poster",_="llOriginalAttrs",g="data",v="loading",b="loaded",p="applied",h="error",m="native",E="data-",I="ll-status",y=function(n,t){return n.getAttribute(E+t)},A=function(n){return y(n,I)},k=function(n,t){return function(n,t,e){var o="data-ll-status";null!==e?n.setAttribute(o,e):n.removeAttribute(o)}(n,0,t)},L=function(n){return k(n,null)},w=function(n){return null===A(n)},O=function(n){return A(n)===m}
vendor: 6,158 bytes, line 22902
22902,x=[v,b,p,h],C=function(n,t,e,o){n&&(void 0===o?void 0===e?n(t):n(t,e):n(t,e,o))},N=function(n,t){i?n.classList.add(t):n.className+=(n.className?" ":"")+t},M=function(n,t){i?n.classList.remove(t):n.className=n.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},z=function(n){return n.llTempImage},T=function(n,t){if(t){var e=t._observer;e&&e.unobserve(n)}},R=function(n,t){n&&(n.loadingCount+=t)},G=function(n,t){n&&(n.toLoadCount=t)},D=function(n){for(var t,e=[],o=0;t=n.children[o];o+=1)"SOURCE"===t.tagName&&e.push(t);return e},V=function(n,t){var e=n.parentNode;e&&"PICTURE"===e.tagName&&D(e).forEach(t)},F=function(n,t){D(n).forEach(t)},j=[l],B=[l,d],J=[l,s,f],P=[g],S=function(n){return!!n[_]},U=function(n){return n[_]},$=function(n){return delete n[_]},q=function(n,t){if(!S(n)){var e={};t.forEach((function(t){e[t]=n.getAttribute(t)})),n[_]=e}},H=function(n,t){if(S(n)){var e=U(n);t.forEach((function(t){!function(n,t,e){e?n.setAttribute(t,e):n.removeAttribute(t)}(n,t,e[t])}))}},K=function(n,t,e){N(n,t.class_loading),k(n,v),e&&(R(e,1),C(t.callback_loading,n,e))},Q=function(n,t,e){e&&n.setAttribute(t,e)},W=function(n,t){Q(n,f,y(n,t.data_sizes)),Q(n,s,y(n,t.data_srcset)),Q(n,l,y(n,t.data_src))},X={IMG:function(n,t){V(n,(function(n){q(n,J),W(n,t)})),q(n,J),W(n,t)},IFRAME:function(n,t){q(n,j),Q(n,l,y(n,t.data_src))},VIDEO:function(n,t){F(n,(function(n){q(n,j),Q(n,l,y(n,t.data_src))})),q(n,B),Q(n,d,y(n,t.data_poster)),Q(n,l,y(n,t.data_src)),n.load()},OBJECT:function(n,t){q(n,P),Q(n,g,y(n,t.data_src))}},Y=["IMG","IFRAME","VIDEO","OBJECT"],Z=function(n,t){!t||function(n){return n.loadingCount>0}(t)||function(n){return n.toLoadCount>0}(t)||C(n.callback_finish,t)},nn=function(n,t,e){n.addEventListener(t,e),n.llEvLisnrs[t]=e},tn=function(n,t,e){n.removeEventListener(t,e)},en=function(n){return!!n.llEvLisnrs},on=function(n){if(en(n)){var t=n.llEvLisnrs;for(var e in t){var o=t[e];tn(n,e,o)}delete n.llEvLisnrs}},an=function(n,t,e){!function(n){delete n.llTempImage}(n),R(e,-1),function(n){n&&(n.toLoadCount-=1)}(e),M(n,t.class_loading),t.unobserve_completed&&T(n,e)},rn=function(n,t,e){var o=z(n)||n;en(o)||function(n,t,e){en(n)||(n.llEvLisnrs={});var o="VIDEO"===n.tagName?"loadeddata":"load";nn(n,o,t),nn(n,"error",e)}(o,(function(i){!function(n,t,e,o){var i=O(t);an(t,e,o),N(t,e.class_loaded),k(t,b),C(e.callback_loaded,t,o),i||Z(e,o)}(0,n,t,e),on(o)}),(function(i){!function(n,t,e,o){var i=O(t);an(t,e,o),N(t,e.class_error),k(t,h),C(e.callback_error,t,o),e.restore_on_error&&H(t,J),i||Z(e,o)}(0,n,t,e),on(o)}))},cn=function(n,t,e){!function(n){n.llTempImage=document.createElement("IMG")}(n),rn(n,t,e),function(n){S(n)||(n[_]={backgroundImage:n.style.backgroundImage})}(n),function(n,t,e){var o=y(n,t.data_bg),i=y(n,t.data_bg_hidpi),r=a&&i?i:o;r&&(n.style.backgroundImage='url("'.concat(r,'")'),z(n).setAttribute(l,r),K(n,t,e))}(n,t,e),function(n,t,e){var o=y(n,t.data_bg_multi),i=y(n,t.data_bg_multi_hidpi),r=a&&i?i:o;r&&(n.style.backgroundImage=r,function(n,t,e){N(n,t.class_applied),k(n,p),e&&(t.unobserve_completed&&T(n,t),C(t.callback_applied,n,e))}(n,t,e))}(n,t,e)},un=function(n,t,e){!function(n){return Y.indexOf(n.tagName)>-1}(n)?cn(n,t,e):function(n,t,e){rn(n,t,e),function(n,t,e){var o=X[n.tagName];o&&(o(n,t),K(n,t,e))}(n,t,e)}(n,t,e)},ln=function(n){n.removeAttribute(l),n.removeAttribute(s),n.removeAttribute(f)},sn=function(n){V(n,(function(n){H(n,J)})),H(n,J)},fn={IMG:sn,IFRAME:function(n){H(n,j)},VIDEO:function(n){F(n,(function(n){H(n,j)})),H(n,B),n.load()},OBJECT:function(n){H(n,P)}},dn=function(n,t){(function(n){var t=fn[n.tagName];t?t(n):function(n){if(S(n)){var t=U(n);n.style.backgroundImage=t.backgroundImage}}(n)})(n),function(n,t){w(n)||O(n)||(M(n,t.class_entered),M(n,t.class_exited),M(n,t.class_applied),M(n,t.class_loading),M(n,t.class_loaded),M(n,t.class_error))}(n,t),L(n),$(n)},_n=["IMG","IFRAME","VIDEO"],gn=function(n){return n.use_native&&"loading"in HTMLImageElement.prototype},vn=function(n,t,e){n.forEach((function(n){return function(n){return n.isIntersecting||n.intersectionRatio>0}(n)?function(n,t,e,o){var i=function(n){return x.indexOf(A(n))>=0}(n);k(n,"entered"),N(n,e.class_entered),M(n,e.class_exited),function(n,t,e){t.unobserve_entered&&T(n,e)}(n,e,o),C(e.callback_enter,n,t,o),i||un(n,e,o)}(n.target,n,t,e):function(n,t,e,o){w(n)||(N(n,e.class_exited),function(n,t,e,o){e.cancel_on_exit&&function(n){return A(n)===v}(n)&&"IMG"===n.tagName&&(on(n),function(n){V(n,(function(n){ln(n)})),ln(n)}(n),sn(n),M(n,e.class_loading),R(o,-1),L(n),C(e.callback_cancel,n,t,o))}(n,t,e,o),C(e.callback_exit,n,t,o))}(n.target,n,t,e)}))},bn=function(n){return Array.prototype.slice.call(n)},pn=function(n){return n.container.querySelectorAll(n.elements_selector)},hn=function(n){return function(n){return A(n)===h}(n)},mn=function(n,t){return function(n){return bn(n).filter(w)}(n||pn(t))},En=function(n,e){var i=c(n);this._settings=i,this.loadingCount=0,function(n,t){o&&!gn(n)&&(t._observer=new IntersectionObserver((function(e){vn(e,n,t)}),function(n){return{root:n.container===document?null:n.container,rootMargin:n.thresholds||n.threshold+"px"}}(n)))}(i,this),function(n,e){t&&window.addEventListener("online",(function(){!function(n,t){var e;(e=pn(n),bn(e).filter(hn)).forEach((function(t){M(t,n.class_error),L(t)})),t.update()}(n,e)}))}(i,this),this.update(e)};return En.prototype={update:function(n){var t,i,a=this._settings,r=mn(n,a);G(this,r.length),!e&&o?gn(a)?function(n,t,e){n.forEach((function(n){-1!==_n.indexOf(n.tagName)&&function(n,t,e){n.setAttribute("loading","lazy"),rn(n,t,e),function(n,t){var e=X[n.tagName];e&&e(n,t)}(n,t),k(n,m)}(n,t,e)})),G(e,0)}(r,a,this):(i=r,function(n){n.disconnect()}(t=this._observer),function(n,t){t.forEach((function(t){n.observe(t)}))}(t,i)):this.loadAll(r)},destroy:function(){this._observer&&this._observer.disconnect(),pn(this._settings).forEach((function(n){$(n)})),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(n){var t=this,e=this._settings;mn(n,e).forEach((function(n){T(n,t),un(n,e,t)}))},restoreAll:function(){var n=this._settings;
22902pn(n).forEach((function(t){dn(t,n)}))}},En.load=function(n,t){var e=c(t);un(n,e)},En.resetStatus=function(n){L(n)},t&&function(n,t){if(t)if(t.length)for(var e,o=0;e=t[o];o+=1)u(n,e);else u(n,t)}(En,window.lazyLoadOptions),En})); 22903/** 22904 * @author trixta 22905 * @version 1.2 22906 */ 22907(function($){ 22908 22909var mwheelI = { 22910 pos: [-260, -260] 22911 }, 22912 minDif = 3, 22913 doc = document, 22914 root = doc.documentElement, 22915 body = doc.body, 22916 longDelay, shortDelay 22917; 22918 22919function unsetPos(){ 22920 if(this === mwheelI.elem){ 22921 mwheelI.pos = [-260, -260]; 22922 mwheelI.elem = false; 22923 minDif = 3; 22924 } 22925} 22926 22927$.event.special.mwheelIntent = { 22928 setup: function(){ 22929 var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler); 22930 if( this !== doc && this !== root && this !== body ){ 22931 jElm.bind('mouseleave', unsetPos); 22932 } 22933 jElm = null; 22934 return true; 22935 }, 22936 teardown: function(){ 22937 $(this) 22938 .unbind('mousewheel', $.event.special.mwheelIntent.handler) 22939 .unbind('mouseleave', unsetPos) 22940 ; 22941 return true; 22942 }, 22943 handler: function(e, d){ 22944 var pos = [e.clientX, e.clientY]; 22945 if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif ){ 22946 mwheelI.elem = this; 22947 mwheelI.pos = pos; 22948 minDif = 250; 22949 22950 clearTimeout(shortDelay); 22951 shortDelay = setTimeout(function(){ 22952 minDif = 10; 22953 }, 200); 22954 clearTimeout(longDelay); 22955 longDelay = setTimeout(function(){ 22956 minDif = 3; 22957 }, 1500); 22958 e = $.extend({}, e, {type: 'mwheelIntent'}); 22959 return $.event.handle.apply(this, arguments); 22960 } 22961 } 22962}; 22963$.fn.extend({ 22964 mwheelIntent: function(fn) { 22965 return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent"); 22966 }, 22967 22968 unmwheelIntent: function(fn) { 22969 return this.unbind("mwheelIntent", fn); 22970 } 22971}); 22972 22973$(function(){ 22974 body = doc.body; 22975 //assume that document is always scrollable, doesn't hurt if not 22976 $(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop); 22977}); 22978})(jQuery); 22979 22980// -- START SiteCensus Click Measurement -- 22981 22982function sc(contentsID){ 22983 22984 var check; 22985 check = new Function('return !!(window.s_sc_cd)'); 22986 if (check()) { 22987 s_sc_cd.tl(this,'o','ex-' + contentsID); 22988 } 22989 22990} 22991 22992// -- END SiteCensus Click Measurement --; 22993/* ------------------------------------------------------ 22994 æ´æ°å±¥æ´ 22995------------------------------------------------------ */ 22996/* 2009/11/09 22997 ã»æ°è¦ä½æ 22998------------------------------------------------------ */ 22999 23000 23001//ãã¼ã³ã³åºå 23002 23003function SCoutput_bc(){ 23004 23005 //s_code.jsã®èªã¿è¾¼ã¿ 23006 var catalystStr = ""; 23007 catalystStr += '<script language="JavaScript" type="text/javascript">'; 23008 catalystStr += ' var SCaccount="toyotamotortoyotajpprd"'; 23009 catalystStr += '</script>'; 23010 if(window.ignoreAdobeTagManager!==true){ 23011 if(location.protocol.indexOf('https') == -1){ 23012 catalystStr += '<script language="JavaScript" src="http://toyota.jp/include/js/s_code_v2.js"></script>'; 23013 }else { 23014 catalystStr += '<script language="JavaScript" src="https://toyota.jp/include/js/s_code_v2.js"></script>'; 23015 } 23016 } 23017 document.write(catalystStr); 23018}; 23019// 1度ã§ãfilterãclickããããã®å¤å® 23020var filterClicked = false; 23021 23022 23023/** 23024 * åã¢ã¤ãã ã®æ¼åº 23025 */ 23026jQuery(function($) { 23027 function delayScrollAnime() { 23028 var time = 0.2;//é å»¶æéãå¢ããç§æ°ã®å¤ 23029 var value = time; 23030 $('#content').each(function () { 23031 var parent = this; //親è¦ç´ ãåå¾ 23032 var elemPos = $(this).offset().top;//è¦ç´ ã®ä½ç½®ã¾ã§æ¥ãã 23033 var scroll = $(window).scrollTop();//ã¹ã¯ãã¼ã«å¤ãåå¾ 23034 var windowHeight = $(window).height();//ç»é¢ã®é«ããåå¾ 23035 var windowWidth = $(window).width(); 23036 var childs = $(this).children(); //åè¦ç´ ãåå¾ 23037 23038 if (windowWidth <= 960) { 23039 scroll = $('#container').scrollTop(); 23040 } 23041 23042 if (scroll >= elemPos - windowHeight && !$(parent).hasClass("play")) {//æå®é åå ã«ã¹ã¯ãã¼ã«ãå ¥ã£ããã¾ã親è¦ç´ ã«ã¯ã©ã¹playããªããã° 23043 $(childs).each(function () { 23044 if (!$(this).hasClass("fadeUp")) {//ã¢ãã¡ã¼ã·ã§ã³ã®ã¯ã©ã¹åãæå®ããã¦ãããã©ããããã§ã㯠23045 $(parent).addClass("play"); //親è¦ç´ ã«ã¯ã©ã¹åplayã追å 23046 if (filterClicked) { 23047 $(this).css("transition-delay", "0s"); 23048 } else { 23049 $(this).css("transition-delay", value + "s");//ã¢ãã¡ã¼ã·ã§ã³é å»¶ã®CSS animation-delayã追å ã 23050 $(this).addClass("fadeUp");//ã¢ãã¡ã¼ã·ã§ã³ã®ã¯ã©ã¹åã追å 23051 } 23052 23053 value = value + time;//delayæéãå¢å ããã 23054 23055 //å ¨ã¦ã®å¦çãçµãã£ããplayãå¤ã 23056 var index = $(childs).index(this); 23057 if((childs.length-1) == index){ 23058 $(parent).removeClass("play"); 23059 } 23060 } 23061 }) 23062 }else { 23063 $(childs).removeClass("fadeUp");//ã¢ãã¡ã¼ã·ã§ã³ã®ã¯ã©ã¹åãåé¤ 23064 value = time;//delayåæå¤ã®æ°å¤ã«æ»ã 23065 } 23066 }) 23067 } 23068 $('#projects-index').removeClass('visited'); 23069 window.addEventListener('pageshow',()=>{ 23070 //ã¢ã³ã«ã¼ãªã³ã¯ãããå ´åã¯ã¹ã¯ãã¼ã«ããªã 23071 if(location.hash) return false;
23072 var flg = window.performance.navigation.type; 23073 var prevUrl = document.referrer; 23074 23075 if(flg == '2') { 23076 // console.log('visited'); 23077 $('.post').addClass('fadeUp'); 23078 $('#projects-index').addClass('visited'); 23079 } else { 23080 $("html, #container").animate({ scrollTop: 0 }, 1000, "easeOutExpo"); 23081 return false; 23082 } 23083 }); 23084 23085 var ref = document.referrer; 23086 if(ref.indexOf('report') != -1){ //åã®ãã¼ã¸ã®urlã«maenopageãå ¥ã£ã¦ããã 23087 $('#projects-index').addClass('visited'); 23088 $('.post').addClass('fadeUp'); 23089 23090 }else if(ref.indexOf('reports') != -1) { 23091 $('#projects-index').addClass('visited'); 23092 $('.post').addClass('fadeUp'); 23093 23094 }else if(ref.indexOf('projects') != -1) { 23095 $('#projects-index').addClass('visited'); 23096 $('.post').addClass('fadeUp'); 23097 23098 }else if(ref.indexOf('map') != -1) { 23099 $('#projects-index').addClass('visited'); 23100 $('.post').addClass('fadeUp'); 23101 23102 } 23103 setTimeout(function(){ 23104 delayScrollAnime(); 23105 },3500); 23106}); 23107 23108/** 23109 * ã¡ãã¥ã¼çµãè¾¼ã¿ã®ã¯ã©ã¹å¶å¾¡ 23110 */ 23111jQuery(function($) { 23112 $(".nav li a, .filter li a").click(function() { 23113 $(this) 23114 .parent("li") 23115 .addClass("active"); 23116 $(this) 23117 .parent("li") 23118 .siblings(".active") 23119 .removeClass("active"); 23120 }); 23121}); 23122 23123/** 23124 * SPã¡ãã¥ã¼ã®ãã°ã« 23125 */ 23126jQuery(function($) { 23127 $(".btn_toggle a").click(function() { 23128 $("#headerWrapper").toggleClass("active"); 23129 }); 23130}); 23131 23132/** 23133 * çµã込㿠23134 */ 23135jQuery(function($) { 23136 var $element = $("#projects-index #content"), 23137 filters = {}; 23138 23139 $("#content-filter a").click(function() { 23140 $('.post').css("transition-delay", "").css("transition","none"); 23141 filterClicked = true; 23142 23143 $('.isotope').stop(false,true); 23144 $('.isotope-item').stop(false,true); 23145 var $this = $(this); 23146 var $optionSet = $this.parents(".option-set"); 23147 var group = $optionSet.attr("data-filter-group"); 23148 filters[group] = $this.attr("data-filter"); 23149 var isoFilters = []; 23150 for (var prop in filters) { 23151 isoFilters.push(filters[prop]); 23152 } 23153 var selectors = isoFilters.join(""); 23154 23155 $element.isotope({ filter: selectors }); 23156 23157 $(".lazy").trigger("appear"); 23158 return false; 23159 }); 23160 23161 if ($.fn.isotope) { 23162 $element.isotope({ filter: ".post, .fix" }); 23163 } 23164 var lazyLoadInstance = new LazyLoad({}); 23165}); 23166 23167/** 23168 * ã¢ã¼ãã«ã¦ã£ã³ãã¦ã®å¶å¾¡ 23169 */ 23170jQuery(function($) { 23171 if ($("a.modal").length > 0) { 23172 $("a.modal").colorbox({ 23173 opacity: 0.25, 23174 inline: true, 23175 width: "960px", 23176 height: "640px", 23177 onLoad: function() { 23178 $("html").css({ overflow: "hidden" }); 23179 }, 23180 onClosed: function() { 23181 $("html").css({ overflow: "visible" }); 23182 } 23183 }); 23184 } 23185}); 23186 23187/** 23188 * YouTube ã¢ã¼ãã«ï¼EVENT POINT ç¨ï¼ 23189 */ 23190jQuery(function($) { 23191 if (window.__tsfYoutubePopupBound) return; 23192 window.__tsfYoutubePopupBound = true; 23193 23194 var $popup = null; 23195 var $iframe = null; 23196 23197 function closeYoutubePopup() { 23198 if (!$popup) return; 23199 23200 $popup.removeClass("is-open").attr("aria-hidden", "true"); 23201 if ($iframe) { 23202 $iframe.attr("src", ""); 23203 } 23204 $("html").css({ overflow: "visible" }); 23205 } 23206 23207 function openYoutubePopup(url) { 23208 if (!$popup) { 23209 $popup = $( 23210 "<div class=\"youtube-popup\" aria-hidden=\"true\" role=\"dialog\" aria-modal=\"true\" aria-label=\"YouTubeåç»\">" + 23211 "<button type=\"button\" class=\"youtube-popup__close\" aria-label=\"éãã\">X</button>" + 23212 "<div class=\"youtube-popup__player\">" + 23213 "<iframe class=\"youtube-popup__iframe\" frameborder=\"0\" allow=\"autoplay; encrypted-media; picture-in-picture; fullscreen\" allowfullscreen></iframe>" + 23214 "</div>" + 23215 "</div>" 23216 ); 23217 23218 $("body").append($popup); 23219 $iframe = $popup.find(".youtube-popup__iframe"); 23220 23221 $popup.on("click", ".youtube-popup__close", function() { 23222 closeYoutubePopup(); 23223 }); 23224 } 23225 23226 $iframe.attr("src", url); 23227 $popup.addClass("is-open").attr("aria-hidden", "false"); 23228 $("html").css({ overflow: "hidden" }); 23229 } 23230 23231 $(document).on("click", "a.js-youtube-modal", function(e) { 23232 var url = $(this).attr("href"); 23233 if (!url) return; 23234 23235 e.preventDefault(); 23236 openYoutubePopup(url); 23237 }); 23238 23239 $(document).on("keydown", function(e) { 23240 if (e.key === "Escape") { 23241 closeYoutubePopup(); 23242 } 23243 }); 23244}); 23245 23246/** 23247 * ãããã¢ããã¦ã£ã³ã㦠23248 */ 23249/** 23250 * SP: åååå è ã®å£°ã¢ã³ã¼ãã£ãªã³ 23251 */ 23252jQuery(function($) { 23253 if (window.__tsfActivityVoicesAccordionBound) return; 23254 window.__tsfActivityVoicesAccordionBound = true; 23255 23256 var BREAKPOINT = 960; 23257 23258 $(".js-activity-voices").each(function(index) { 23259 var $section = $(this); 23260 var $toggle = $section.find(".js-activity-voices-toggle").first(); 23261 var $list = $section.find(".js-activity-voices-list").first(); 23262 23263 if ($toggle.length === 0 || $list.length === 0) return; 23264 23265 var listId = $list.attr("id"); 23266 if (!listId) { 23267 listId = "activity-voices-list-" + index; 23268 $list.attr("id", listId); 23269 } 23270 $toggle.attr("aria-controls", listId); 23271 23272 function isSp() { 23273 return $(window).width() <= BREAKPOINT; 23274 } 23275 23276 function syncState() { 23277 if (isSp()) { 23278 var isOpen = $section.hasClass("is-open"); 23279 $toggle.attr("aria-expanded", isOpen ? "true" : "false"); 23280 $list.attr("aria-hidden", isOpen ? "false" : "true"); 23281 23282 if (isOpen) { 23283 $list.show(); 23284 } else { 23285 $list.hide(); 23286 } 23287 } else { 23288 $section.removeClass("is-open"); 23289 $toggle.attr("aria-expanded", "false"); 23290 $list.attr("aria-hidden", "false"); 23291 $list.show(); 23292 } 23293 } 23294 23295 syncState(); 23296 23297 $toggle.on("click", function() { 23298 if (!isSp()) return; 23299 23300 var willOpen = !$section.hasClass("is-open"); 23301 $section.toggleClass("is-open", willOpen); 23302 $toggle.attr("aria-expanded", willOpen ? "true" : "false"); 23303 $list.attr("aria-hidden", willOpen ? "false" : "true"); 23304 23305 if (willOpen) { 23306 $list.stop(true, true).slideDown(200); 23307 } else {
23308 $list.stop(true, true).slideUp(200); 23309 } 23310 }); 23311 23312 $(window).on("resize", function() { 23313 syncState(); 23314 }); 23315 }); 23316}); 23317 23318jQuery(function($) { 23319 if (window.__tsfAboutFadeBound) return; 23320 window.__tsfAboutFadeBound = true; 23321 23322 if ($("body#static-about").length === 0) return; 23323 23324 var $about = $("#about").first(); 23325 var $targets = $about.find(".js-about-fade-in"); 23326 var REVEAL_BASE_DELAY = 80; 23327 var REVEAL_STAGGER_DELAY = 180; 23328 23329 if ($about.length === 0 || $targets.length === 0) return; 23330 23331 function reveal($elements, baseDelay) { 23332 $elements.each(function(index) { 23333 this.style.setProperty("--about-fade-delay", baseDelay + index * REVEAL_STAGGER_DELAY + "ms"); 23334 $(this).addClass("is-visible"); 23335 }); 23336 } 23337 23338 function isInViewport(element) { 23339 var rect = element.getBoundingClientRect(); 23340 var viewportHeight = window.innerHeight || document.documentElement.clientHeight; 23341 23342 return rect.top <= viewportHeight * 0.92 && rect.bottom >= 0; 23343 } 23344 23345 function sortByViewportTop($elements) { 23346 return $($elements.get().sort(function(a, b) { 23347 return a.getBoundingClientRect().top - b.getBoundingClientRect().top; 23348 })); 23349 } 23350 23351 function onNextFrame(callback) { 23352 if (window.requestAnimationFrame) { 23353 window.requestAnimationFrame(callback); 23354 return; 23355 } 23356 23357 setTimeout(callback, 0); 23358 } 23359 23360 if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) { 23361 reveal($targets, 0); 23362 return; 23363 } 23364 23365 if (!("IntersectionObserver" in window)) { 23366 onNextFrame(function() { 23367 reveal($targets, REVEAL_BASE_DELAY); 23368 }); 23369 return; 23370 } 23371 23372 var observer = new IntersectionObserver( 23373 function(entries, io) { 23374 var revealTargets = entries 23375 .filter(function(entry) { 23376 return entry.isIntersecting; 23377 }) 23378 .map(function(entry) { 23379 io.unobserve(entry.target); 23380 return entry.target; 23381 }); 23382 23383 if (revealTargets.length === 0) return; 23384 23385 reveal(sortByViewportTop($(revealTargets)), REVEAL_BASE_DELAY); 23386 }, 23387 { 23388 rootMargin: "0px 0px -8% 0px", 23389 threshold: 0.12 23390 } 23391 ); 23392 23393 onNextFrame(function() { 23394 var visibleTargets = []; 23395 23396 $targets.each(function() { 23397 if (isInViewport(this)) { 23398 visibleTargets.push(this); 23399 return; 23400 } 23401 23402 observer.observe(this); 23403 }); 23404 23405 if (visibleTargets.length > 0) { 23406 reveal(sortByViewportTop($(visibleTargets)), REVEAL_BASE_DELAY); 23407 } 23408 }); 23409}); 23410 23411function winOpen(url, w, h) { 23412 var name = "", 23413 H = screen.width / 2 - w / 2, 23414 V = 100, 23415 maxWin = window.open( 23416 url, 23417 name, 23418 "width=" + 23419 w + 23420 ",height=" + 23421 h + 23422 ",scrollbars=1,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,left=" + 23423 H + 23424 ",top=" + 23425 V + 23426 "" 23427 ); 23428} 23429 23430/** 23431 * ã¢ã³ã«ã¼ãªã³ã¯ã®å¶å¾¡ 23432 */ 23433jQuery(function($) { 23434 var HEADER_OFFSET = 44; 23435 var SP_HEADER_OFFSET = 60; 23436 var BP_WIDTH = 1000; 23437 23438 function getHeaderOffset() { 23439 return $(window).width() <= BP_WIDTH ? SP_HEADER_OFFSET : HEADER_OFFSET; 23440 } 23441 23442 $(".anchor a").click(function() { 23443 var $target = $(this.hash); 23444 var offset = $target.offset().top; 23445 $("html, body") 23446 .stop() 23447 .animate({ scrollTop: offset }, 1000, "easeOutExpo"); 23448 return false; 23449 }); 23450 $('a[rel*="anchor"]').click(function() { 23451 var $target = $(this.hash); 23452 var offset = $target.offset().top; 23453 $("html, body") 23454 .stop() 23455 .animate({ scrollTop: offset - getHeaderOffset() }, 1000, "easeOutExpo"); 23456 return false; 23457 }); 23458 23459}); 23460 23461/** 23462 * ã¬ãã¼ããã 23463 */ 23464jQuery(function($) { 23465 var $hash = window.location.hash; 23466 var $articleFlex = $(".articleFlex"); 23467 var $articles = $articleFlex.find(".article"); 23468 var $length = $articles.length; 23469 23470 var $prev = $(".reportNav .prev"); 23471 var $next = $(".reportNav .next"); 23472 23473 function showORHidePrev(articleIndex) { 23474 if (articleIndex <= 0) { 23475 $prev.css({ display: "none" }); 23476 } else { 23477 $prev.css({ display: "block" }); 23478 } 23479 } 23480 23481 function showORHideNext(articleIndex) { 23482 var lastIndex = $articles.length - 1; 23483 if (articleIndex >= lastIndex) { 23484 $next.css({ display: "none" }); 23485 } else { 23486 $next.css({ display: "block" }); 23487 } 23488 } 23489 23490 if (!$hash) { 23491 $hash = "#" + $articleFlex.find(".article:first-child").attr("id"); 23492 } 23493 23494 $articleFlex.addClass("state_wrap"); 23495 $articleFlex.find($hash).addClass("state_show"); 23496 23497 var currentIndex = $articles.index($($hash)); 23498 showORHidePrev(currentIndex); 23499 showORHideNext(currentIndex); 23500 23501 $(".sideBar dl a").click(function() { 23502 $hash = $(this.hash); 23503 $articles.removeClass("state_show"); 23504 $articleFlex.find($hash).addClass("state_show"); 23505 }); 23506 23507 $prev.click(function() { 23508 var currentHash = window.location.hash; 23509 if (!currentHash) { 23510 currentHash = 23511 "#" + $articleFlex.find(".article:first-child").attr("id"); 23512 } 23513 var currentIndex = $articles.index($(currentHash)); 23514 var prevIndex = currentIndex - 1; 23515 23516 $articles.removeClass("state_show"); 23517 if (prevIndex < 0) { 23518 // ãã®ã±ã¼ã¹ã¯çºçããªãã¯ã 23519 showORHidePrev(currentIndex); 23520 showORHideNext(currentIndex); 23521 } else { 23522 showORHidePrev(prevIndex); 23523 showORHideNext(prevIndex); 23524 var prevHash = "#" + $($articles[prevIndex]).attr("id"); 23525 $articleFlex.find(prevHash).addClass("state_show"); 23526 window.location = 23527 window.location.origin + window.location.pathname + prevHash; 23528 } 23529 23530 $("html, body") 23531 .stop() 23532 .animate({ scrollTop: 0 }, 1000, "easeOutExpo"); 23533 return false;
23534 }); 23535 23536 $next.click(function() { 23537 var currentHash = window.location.hash; 23538 if (!currentHash) { 23539 currentHash = 23540 "#" + $articleFlex.find(".article:first-child").attr("id"); 23541 } 23542 var currentIndex = $articles.index($(currentHash)); 23543 var nextIndex = currentIndex + 1; 23544 23545 showORHidePrev(nextIndex); 23546 showORHideNext(nextIndex); 23547 23548 $articles.removeClass("state_show"); 23549 var lastIndex = $articles.length - 1; 23550 if (nextIndex > lastIndex) { 23551 } else { 23552 var nextHash = "#" + $($articles[nextIndex]).attr("id"); 23553 $articleFlex.find(nextHash).addClass("state_show"); 23554 window.location = 23555 window.location.origin + window.location.pathname + nextHash; 23556 } 23557 23558 $("html, body") 23559 .stop() 23560 .animate({ scrollTop: 0 }, 1000, "easeOutExpo"); 23561 return false; 23562 }); 23563}); 23564 23565/** 23566 * èæ¯ 23567 */ 23568jQuery(function ($) { 23569 $('.btn_back a').click(function() { 23570 $("html, #container").animate({ scrollTop: 0 }, 1000, "easeOutExpo"); 23571 return false; 23572 }); 23573 23574 // sp-bgã®é«ã 23575 var spBg = $('#sp-bg'); 23576 var spBgHeight = spBg.height(); 23577 var footerWrapper = $('#footerWrapper'); 23578 var footerWrapperHeight = footerWrapper.height(); 23579 23580 // scrollå¯è½ï¼ï¼ãã¼ãæã¯ä¸å¯è½ï¼ 23581 var scrollReady = false; 23582 23583 // iPhoneã®å ´åã®ãã¼ãéä¸ã§å´©ããåé¡ 23584 var iphoneFix = 80; 23585 23586 var onScroll = function() { 23587 if (!scrollReady) return; 23588 // TOP以å¤ã§ã¯scrollå¦çç¡å¹ 23589 if (!location.href.includes("/top")) return; 23590 if ($('#projects-index').hasClass('visited')) return; 23591 23592 var winW = $(window).width(); 23593 var winH = $(window).height(); 23594 var isMobile = winW < 961; 23595 var scrollTop = $(document).scrollTop(); 23596 23597 // console.log(scrollTop, spBgHeight); 23598 23599 if (isMobile) { 23600 // ã¢ãã¤ã«ã®å ´å 23601 var speed = 0.1; // ã©ããããã®ã¹ãã¼ãã§ãã©ã©ãã¯ã¹ããããï¼1ã ã¨ã¹ã¯ãã¼ã«ã¨é£åï¼ 23602 var changes = scrollTop * speed; 23603 if (changes > spBgHeight - winH - iphoneFix) { 23604 changes = spBgHeight - winH - iphoneFix; 23605 } 23606 23607 var documentHeight = $(document).height(); 23608 // console.log(documentHeight, scrollTop,winH ,footerWrapperHeight, changes, documentHeight - scrollTop - winH) 23609 if (documentHeight - scrollTop - winH - iphoneFix < footerWrapperHeight) { 23610 changes -= documentHeight - scrollTop - winH - iphoneFix - footerWrapperHeight; 23611 } 23612 23613 23614 spBg.css('top','-' + changes + 'px'); 23615 } else { 23616 // PCã®å ´å 23617 var speed = 0.12; // ã©ããããã®ã¹ãã¼ãã§ãã©ã©ãã¯ã¹ããããï¼1ã ã¨ã¹ã¯ãã¼ã«ã¨é£åï¼ 23618 var changes = scrollTop * speed; 23619 if (changes > spBgHeight - winH) { 23620 changes = spBgHeight - winH; 23621 } 23622 23623 spBg.css('top','-' + changes + 'px'); 23624 } 23625 23626 } 23627 var onResize = function() { 23628 var winW = $(window).width(); 23629 var winH = $(window).height(); 23630 var spBgWidth = winW; 23631 23632 if (winW > 1920) { 23633 spBg.css('left', (winW - 1920) / 2); 23634 spBgWidth = 1920; 23635 } else { 23636 spBg.css('left', ''); 23637 } 23638 23639 if (winW < 961) { 23640 // ã¢ãã¤ã«ã®å ´å 23641 spBgHeight = winW * 1.97; // åºå®é· SPã®ç»åã®ç¸¦å¹ 23642 if (spBgHeight < winH * 1.1) { 23643 spBgHeight = winH * 1.1; 23644 } 23645 } else { 23646 // ãã¹ã¯ãããã®å ´å 23647 spBgHeight = spBgWidth / 1920 * 1877; // å¹ ããè¨ç® 23648 if(spBgHeight < winH * 1.2) { // æä½ã®é«ãã1.2vhã«åº
23648å® 23649 spBgHeight = winH * 1.2; 23650 } 23651 } 23652 23653 spBg.css('height', spBgHeight); 23654 footerWrapperHeight = footerWrapper.height(); 23655 onScroll(); 23656 } 23657 23658 $(document).on("scroll",onScroll); 23659 $('#container').on("scroll",onScroll); 23660 $(window).on("resize", onResize); 23661 onResize(); 23662 23663 (function() { 23664 // TOP以å¤ã§ã¯ã¢ãã¡ã¼ã·ã§ã³å¦çç¡å¹ 23665 if (!location.href.includes("/top")) return; 23666 if ($('#projects-index').hasClass('visited')) return; 23667 23668 // å表示ã®å ´åã¯ã¢ãã¡ã¼ã·ã§ã³å¦çç¡å¹ 23669 if (window.performance.navigation.type == '2') return; 23670 23671 var ref = document.referrer; 23672 if(ref.indexOf('report') != -1 || ref.indexOf('reports') != -1 || ref.indexOf('projects') != -1) { 23673 return; 23674 } 23675 23676 var winW = $(window).width(); 23677 var winH = $(window).height(); 23678 var startTop = (1400-winH) * (-1) 23679 if (startTop > 0 || winW < 691) startTop = 0; 23680 23681 if (startTop < 0 && spBgHeight + startTop < winH) { 23682 startTop = winH - spBgHeight; 23683 } 23684 23685 spBg.css({top: startTop}).animate({opacity: 1}); 23686 $('#sp-bg').delay(300).animate({'top':0}, 2000); 23687 })(); 23688 23689 23690 window.setTimeout(function() { 23691 scrollReady = true; 23692 onScroll(); 23693 }, 2300); 23694}); 23695 23696/*ã¡ãã¥ã¼ä»¥å¤ã®ãã¼ã«ãªã¼ãã¼*/ 23697jQuery(function($) { 23698 initRollover($); 23699}); 23700 23701var initRollover = function($) { 23702 $(document).on('mouseover', '.rollover', 23703 function(event) { 23704 var $this = $(this), 23705 opacity = $this.data('opacity') || 0.8, 23706 duration = $this.data('duration') || 200, 23707 easing = $this.data('easing') || 'linear'; 23708 $this.animate({ opacity: opacity }, { duration: duration, easing: easing, queue: false }); 23709 } 23710 ); 23711 $(document).on('mouseout', '.rollover', 23712 function(event) { 23713 var $this = $(this); 23714 $this.animate({ opacity: 1 }, { duration: 200, easing: 'linear', queue: false }); 23715 } 23716 ); 23717}; 23718/*ã¡ãã¥ã¼ã®ã¹ã¯ãã¼ã«æfixed*/ 23719jQuery(function($) { 23720 initFixednav($); 23721}); 23722 23723var initFixednav = function($) { 23724 23725 var $nav = $('#content-filter'); 23726 23727 if (!$nav .length) { 23728 return; 23729 } 23730 23731 var $threshold = $nav.offset().top; 23732 $(window).scroll(function(event) { 23733 var $offset = $(window).scrollTop(); 23734 23735 if($threshold <= $offset) { 23736 $nav.addClass('nav-fixed'); 23737 } else { 23738 $nav.removeClass('nav-fixed'); 23739 } 23740 }); 23741}; 23742/*newsã®ã¹ã¯ãã¼ã«*/ 23743function scrollAppearance() { 23744 $('.scroll').jScrollPane(); 23745} 23746 23747jQuery(function($) { 23748 scrollAppearance(); 23749}); 23750 23751jQuery(function($) { 23752 $(window).resize(function() { 23753 scrollAppearance(); 23754 }) 23755}); 23756function sc(contentsID){ 23757 window.dataLayer = window.dataLayer||[]; 23758 window.dataLayer.push({ 23759 "event": "SCcustomlink", 23760 "SCcustomlink": "ex-"+contentsID 23761 }); 23762 };
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.