/src/MsdnWeb/Scripts/jquery-ui-1.8.11.js

# · JavaScript · 11700 lines · 8678 code · 1609 blank · 1413 comment · 2413 complexity · 6c225a6b87e0619fc81082709456c8a9 MD5 · raw file

  1. /*!
  2. * Note: While Microsoft is not the author of this file, Microsoft is
  3. * offering you a license subject to the terms of the Microsoft Software
  4. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5. * Microsoft reserves all other rights. The notices below are provided
  6. * for informational purposes only and are not the license terms under
  7. * which Microsoft distributed this file.
  8. *
  9. * jQuery UI 1.8.11
  10. *
  11. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  12. *
  13. * http://docs.jquery.com/UI
  14. */
  15. (function( $, undefined ) {
  16. // prevent duplicate loading
  17. // this is only a problem because we proxy existing functions
  18. // and we don't want to double proxy them
  19. $.ui = $.ui || {};
  20. if ( $.ui.version ) {
  21. return;
  22. }
  23. $.extend( $.ui, {
  24. version: "1.8.11",
  25. keyCode: {
  26. ALT: 18,
  27. BACKSPACE: 8,
  28. CAPS_LOCK: 20,
  29. COMMA: 188,
  30. COMMAND: 91,
  31. COMMAND_LEFT: 91, // COMMAND
  32. COMMAND_RIGHT: 93,
  33. CONTROL: 17,
  34. DELETE: 46,
  35. DOWN: 40,
  36. END: 35,
  37. ENTER: 13,
  38. ESCAPE: 27,
  39. HOME: 36,
  40. INSERT: 45,
  41. LEFT: 37,
  42. MENU: 93, // COMMAND_RIGHT
  43. NUMPAD_ADD: 107,
  44. NUMPAD_DECIMAL: 110,
  45. NUMPAD_DIVIDE: 111,
  46. NUMPAD_ENTER: 108,
  47. NUMPAD_MULTIPLY: 106,
  48. NUMPAD_SUBTRACT: 109,
  49. PAGE_DOWN: 34,
  50. PAGE_UP: 33,
  51. PERIOD: 190,
  52. RIGHT: 39,
  53. SHIFT: 16,
  54. SPACE: 32,
  55. TAB: 9,
  56. UP: 38,
  57. WINDOWS: 91 // COMMAND
  58. }
  59. });
  60. // plugins
  61. $.fn.extend({
  62. _focus: $.fn.focus,
  63. focus: function( delay, fn ) {
  64. return typeof delay === "number" ?
  65. this.each(function() {
  66. var elem = this;
  67. setTimeout(function() {
  68. $( elem ).focus();
  69. if ( fn ) {
  70. fn.call( elem );
  71. }
  72. }, delay );
  73. }) :
  74. this._focus.apply( this, arguments );
  75. },
  76. scrollParent: function() {
  77. var scrollParent;
  78. if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  79. scrollParent = this.parents().filter(function() {
  80. 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));
  81. }).eq(0);
  82. } else {
  83. scrollParent = this.parents().filter(function() {
  84. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  85. }).eq(0);
  86. }
  87. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  88. },
  89. zIndex: function( zIndex ) {
  90. if ( zIndex !== undefined ) {
  91. return this.css( "zIndex", zIndex );
  92. }
  93. if ( this.length ) {
  94. var elem = $( this[ 0 ] ), position, value;
  95. while ( elem.length && elem[ 0 ] !== document ) {
  96. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  97. // This makes behavior of this function consistent across browsers
  98. // WebKit always returns auto if the element is positioned
  99. position = elem.css( "position" );
  100. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  101. // IE returns 0 when zIndex is not specified
  102. // other browsers return a string
  103. // we ignore the case of nested elements with an explicit value of 0
  104. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  105. value = parseInt( elem.css( "zIndex" ), 10 );
  106. if ( !isNaN( value ) && value !== 0 ) {
  107. return value;
  108. }
  109. }
  110. elem = elem.parent();
  111. }
  112. }
  113. return 0;
  114. },
  115. disableSelection: function() {
  116. return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
  117. ".ui-disableSelection", function( event ) {
  118. event.preventDefault();
  119. });
  120. },
  121. enableSelection: function() {
  122. return this.unbind( ".ui-disableSelection" );
  123. }
  124. });
  125. $.each( [ "Width", "Height" ], function( i, name ) {
  126. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  127. type = name.toLowerCase(),
  128. orig = {
  129. innerWidth: $.fn.innerWidth,
  130. innerHeight: $.fn.innerHeight,
  131. outerWidth: $.fn.outerWidth,
  132. outerHeight: $.fn.outerHeight
  133. };
  134. function reduce( elem, size, border, margin ) {
  135. $.each( side, function() {
  136. size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
  137. if ( border ) {
  138. size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
  139. }
  140. if ( margin ) {
  141. size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
  142. }
  143. });
  144. return size;
  145. }
  146. $.fn[ "inner" + name ] = function( size ) {
  147. if ( size === undefined ) {
  148. return orig[ "inner" + name ].call( this );
  149. }
  150. return this.each(function() {
  151. $( this ).css( type, reduce( this, size ) + "px" );
  152. });
  153. };
  154. $.fn[ "outer" + name] = function( size, margin ) {
  155. if ( typeof size !== "number" ) {
  156. return orig[ "outer" + name ].call( this, size );
  157. }
  158. return this.each(function() {
  159. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  160. });
  161. };
  162. });
  163. // selectors
  164. function visible( element ) {
  165. return !$( element ).parents().andSelf().filter(function() {
  166. return $.curCSS( this, "visibility" ) === "hidden" ||
  167. $.expr.filters.hidden( this );
  168. }).length;
  169. }
  170. $.extend( $.expr[ ":" ], {
  171. data: function( elem, i, match ) {
  172. return !!$.data( elem, match[ 3 ] );
  173. },
  174. focusable: function( element ) {
  175. var nodeName = element.nodeName.toLowerCase(),
  176. tabIndex = $.attr( element, "tabindex" );
  177. if ( "area" === nodeName ) {
  178. var map = element.parentNode,
  179. mapName = map.name,
  180. img;
  181. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  182. return false;
  183. }
  184. img = $( "img[usemap=#" + mapName + "]" )[0];
  185. return !!img && visible( img );
  186. }
  187. return ( /input|select|textarea|button|object/.test( nodeName )
  188. ? !element.disabled
  189. : "a" == nodeName
  190. ? element.href || !isNaN( tabIndex )
  191. : !isNaN( tabIndex ))
  192. // the element and all of its ancestors must be visible
  193. && visible( element );
  194. },
  195. tabbable: function( element ) {
  196. var tabIndex = $.attr( element, "tabindex" );
  197. return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
  198. }
  199. });
  200. // support
  201. $(function() {
  202. var body = document.body,
  203. div = body.appendChild( div = document.createElement( "div" ) );
  204. $.extend( div.style, {
  205. minHeight: "100px",
  206. height: "auto",
  207. padding: 0,
  208. borderWidth: 0
  209. });
  210. $.support.minHeight = div.offsetHeight === 100;
  211. $.support.selectstart = "onselectstart" in div;
  212. // set display to none to avoid a layout bug in IE
  213. // http://dev.jquery.com/ticket/4014
  214. body.removeChild( div ).style.display = "none";
  215. });
  216. // deprecated
  217. $.extend( $.ui, {
  218. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  219. plugin: {
  220. add: function( module, option, set ) {
  221. var proto = $.ui[ module ].prototype;
  222. for ( var i in set ) {
  223. proto.plugins[ i ] = proto.plugins[ i ] || [];
  224. proto.plugins[ i ].push( [ option, set[ i ] ] );
  225. }
  226. },
  227. call: function( instance, name, args ) {
  228. var set = instance.plugins[ name ];
  229. if ( !set || !instance.element[ 0 ].parentNode ) {
  230. return;
  231. }
  232. for ( var i = 0; i < set.length; i++ ) {
  233. if ( instance.options[ set[ i ][ 0 ] ] ) {
  234. set[ i ][ 1 ].apply( instance.element, args );
  235. }
  236. }
  237. }
  238. },
  239. // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
  240. contains: function( a, b ) {
  241. return document.compareDocumentPosition ?
  242. a.compareDocumentPosition( b ) & 16 :
  243. a !== b && a.contains( b );
  244. },
  245. // only used by resizable
  246. hasScroll: function( el, a ) {
  247. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  248. if ( $( el ).css( "overflow" ) === "hidden") {
  249. return false;
  250. }
  251. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  252. has = false;
  253. if ( el[ scroll ] > 0 ) {
  254. return true;
  255. }
  256. // TODO: determine which cases actually cause this to happen
  257. // if the element doesn't have the scroll set, see if it's possible to
  258. // set the scroll
  259. el[ scroll ] = 1;
  260. has = ( el[ scroll ] > 0 );
  261. el[ scroll ] = 0;
  262. return has;
  263. },
  264. // these are odd functions, fix the API or move into individual plugins
  265. isOverAxis: function( x, reference, size ) {
  266. //Determines when x coordinate is over "b" element axis
  267. return ( x > reference ) && ( x < ( reference + size ) );
  268. },
  269. isOver: function( y, x, top, left, height, width ) {
  270. //Determines when x, y coordinates is over "b" element
  271. return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
  272. }
  273. });
  274. })( jQuery );
  275. /*!
  276. * Note: While Microsoft is not the author of this file, Microsoft is
  277. * offering you a license subject to the terms of the Microsoft Software
  278. * License Terms for Microsoft ASP.NET Model View Controller 3.
  279. * Microsoft reserves all other rights. The notices below are provided
  280. * for informational purposes only and are not the license terms under
  281. * which Microsoft distributed this file.
  282. *
  283. * jQuery UI Widget 1.8.11
  284. *
  285. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  286. *
  287. * http://docs.jquery.com/UI/Widget
  288. */
  289. (function( $, undefined ) {
  290. // jQuery 1.4+
  291. if ( $.cleanData ) {
  292. var _cleanData = $.cleanData;
  293. $.cleanData = function( elems ) {
  294. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  295. $( elem ).triggerHandler( "remove" );
  296. }
  297. _cleanData( elems );
  298. };
  299. } else {
  300. var _remove = $.fn.remove;
  301. $.fn.remove = function( selector, keepData ) {
  302. return this.each(function() {
  303. if ( !keepData ) {
  304. if ( !selector || $.filter( selector, [ this ] ).length ) {
  305. $( "*", this ).add( [ this ] ).each(function() {
  306. $( this ).triggerHandler( "remove" );
  307. });
  308. }
  309. }
  310. return _remove.call( $(this), selector, keepData );
  311. });
  312. };
  313. }
  314. $.widget = function( name, base, prototype ) {
  315. var namespace = name.split( "." )[ 0 ],
  316. fullName;
  317. name = name.split( "." )[ 1 ];
  318. fullName = namespace + "-" + name;
  319. if ( !prototype ) {
  320. prototype = base;
  321. base = $.Widget;
  322. }
  323. // create selector for plugin
  324. $.expr[ ":" ][ fullName ] = function( elem ) {
  325. return !!$.data( elem, name );
  326. };
  327. $[ namespace ] = $[ namespace ] || {};
  328. $[ namespace ][ name ] = function( options, element ) {
  329. // allow instantiation without initializing for simple inheritance
  330. if ( arguments.length ) {
  331. this._createWidget( options, element );
  332. }
  333. };
  334. var basePrototype = new base();
  335. // we need to make the options hash a property directly on the new instance
  336. // otherwise we'll modify the options hash on the prototype that we're
  337. // inheriting from
  338. // $.each( basePrototype, function( key, val ) {
  339. // if ( $.isPlainObject(val) ) {
  340. // basePrototype[ key ] = $.extend( {}, val );
  341. // }
  342. // });
  343. basePrototype.options = $.extend( true, {}, basePrototype.options );
  344. $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
  345. namespace: namespace,
  346. widgetName: name,
  347. widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
  348. widgetBaseClass: fullName
  349. }, prototype );
  350. $.widget.bridge( name, $[ namespace ][ name ] );
  351. };
  352. $.widget.bridge = function( name, object ) {
  353. $.fn[ name ] = function( options ) {
  354. var isMethodCall = typeof options === "string",
  355. args = Array.prototype.slice.call( arguments, 1 ),
  356. returnValue = this;
  357. // allow multiple hashes to be passed on init
  358. options = !isMethodCall && args.length ?
  359. $.extend.apply( null, [ true, options ].concat(args) ) :
  360. options;
  361. // prevent calls to internal methods
  362. if ( isMethodCall && options.charAt( 0 ) === "_" ) {
  363. return returnValue;
  364. }
  365. if ( isMethodCall ) {
  366. this.each(function() {
  367. var instance = $.data( this, name ),
  368. methodValue = instance && $.isFunction( instance[options] ) ?
  369. instance[ options ].apply( instance, args ) :
  370. instance;
  371. // TODO: add this back in 1.9 and use $.error() (see #5972)
  372. // if ( !instance ) {
  373. // throw "cannot call methods on " + name + " prior to initialization; " +
  374. // "attempted to call method '" + options + "'";
  375. // }
  376. // if ( !$.isFunction( instance[options] ) ) {
  377. // throw "no such method '" + options + "' for " + name + " widget instance";
  378. // }
  379. // var methodValue = instance[ options ].apply( instance, args );
  380. if ( methodValue !== instance && methodValue !== undefined ) {
  381. returnValue = methodValue;
  382. return false;
  383. }
  384. });
  385. } else {
  386. this.each(function() {
  387. var instance = $.data( this, name );
  388. if ( instance ) {
  389. instance.option( options || {} )._init();
  390. } else {
  391. $.data( this, name, new object( options, this ) );
  392. }
  393. });
  394. }
  395. return returnValue;
  396. };
  397. };
  398. $.Widget = function( options, element ) {
  399. // allow instantiation without initializing for simple inheritance
  400. if ( arguments.length ) {
  401. this._createWidget( options, element );
  402. }
  403. };
  404. $.Widget.prototype = {
  405. widgetName: "widget",
  406. widgetEventPrefix: "",
  407. options: {
  408. disabled: false
  409. },
  410. _createWidget: function( options, element ) {
  411. // $.widget.bridge stores the plugin instance, but we do it anyway
  412. // so that it's stored even before the _create function runs
  413. $.data( element, this.widgetName, this );
  414. this.element = $( element );
  415. this.options = $.extend( true, {},
  416. this.options,
  417. this._getCreateOptions(),
  418. options );
  419. var self = this;
  420. this.element.bind( "remove." + this.widgetName, function() {
  421. self.destroy();
  422. });
  423. this._create();
  424. this._trigger( "create" );
  425. this._init();
  426. },
  427. _getCreateOptions: function() {
  428. return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
  429. },
  430. _create: function() {},
  431. _init: function() {},
  432. destroy: function() {
  433. this.element
  434. .unbind( "." + this.widgetName )
  435. .removeData( this.widgetName );
  436. this.widget()
  437. .unbind( "." + this.widgetName )
  438. .removeAttr( "aria-disabled" )
  439. .removeClass(
  440. this.widgetBaseClass + "-disabled " +
  441. "ui-state-disabled" );
  442. },
  443. widget: function() {
  444. return this.element;
  445. },
  446. option: function( key, value ) {
  447. var options = key;
  448. if ( arguments.length === 0 ) {
  449. // don't return a reference to the internal hash
  450. return $.extend( {}, this.options );
  451. }
  452. if (typeof key === "string" ) {
  453. if ( value === undefined ) {
  454. return this.options[ key ];
  455. }
  456. options = {};
  457. options[ key ] = value;
  458. }
  459. this._setOptions( options );
  460. return this;
  461. },
  462. _setOptions: function( options ) {
  463. var self = this;
  464. $.each( options, function( key, value ) {
  465. self._setOption( key, value );
  466. });
  467. return this;
  468. },
  469. _setOption: function( key, value ) {
  470. this.options[ key ] = value;
  471. if ( key === "disabled" ) {
  472. this.widget()
  473. [ value ? "addClass" : "removeClass"](
  474. this.widgetBaseClass + "-disabled" + " " +
  475. "ui-state-disabled" )
  476. .attr( "aria-disabled", value );
  477. }
  478. return this;
  479. },
  480. enable: function() {
  481. return this._setOption( "disabled", false );
  482. },
  483. disable: function() {
  484. return this._setOption( "disabled", true );
  485. },
  486. _trigger: function( type, event, data ) {
  487. var callback = this.options[ type ];
  488. event = $.Event( event );
  489. event.type = ( type === this.widgetEventPrefix ?
  490. type :
  491. this.widgetEventPrefix + type ).toLowerCase();
  492. data = data || {};
  493. // copy original event properties over to the new event
  494. // this would happen if we could call $.event.fix instead of $.Event
  495. // but we don't have a way to force an event to be fixed multiple times
  496. if ( event.originalEvent ) {
  497. for ( var i = $.event.props.length, prop; i; ) {
  498. prop = $.event.props[ --i ];
  499. event[ prop ] = event.originalEvent[ prop ];
  500. }
  501. }
  502. this.element.trigger( event, data );
  503. return !( $.isFunction(callback) &&
  504. callback.call( this.element[0], event, data ) === false ||
  505. event.isDefaultPrevented() );
  506. }
  507. };
  508. })( jQuery );
  509. /*!
  510. * Note: While Microsoft is not the author of this file, Microsoft is
  511. * offering you a license subject to the terms of the Microsoft Software
  512. * License Terms for Microsoft ASP.NET Model View Controller 3.
  513. * Microsoft reserves all other rights. The notices below are provided
  514. * for informational purposes only and are not the license terms under
  515. * which Microsoft distributed this file.
  516. *
  517. * jQuery UI Mouse 1.8.11
  518. *
  519. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  520. *
  521. * http://docs.jquery.com/UI/Mouse
  522. *
  523. * Depends:
  524. * jquery.ui.widget.js
  525. */
  526. (function( $, undefined ) {
  527. $.widget("ui.mouse", {
  528. options: {
  529. cancel: ':input,option',
  530. distance: 1,
  531. delay: 0
  532. },
  533. _mouseInit: function() {
  534. var self = this;
  535. this.element
  536. .bind('mousedown.'+this.widgetName, function(event) {
  537. return self._mouseDown(event);
  538. })
  539. .bind('click.'+this.widgetName, function(event) {
  540. if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
  541. $.removeData(event.target, self.widgetName + '.preventClickEvent');
  542. event.stopImmediatePropagation();
  543. return false;
  544. }
  545. });
  546. this.started = false;
  547. },
  548. // TODO: make sure destroying one instance of mouse doesn't mess with
  549. // other instances of mouse
  550. _mouseDestroy: function() {
  551. this.element.unbind('.'+this.widgetName);
  552. },
  553. _mouseDown: function(event) {
  554. // don't let more than one widget handle mouseStart
  555. // TODO: figure out why we have to use originalEvent
  556. event.originalEvent = event.originalEvent || {};
  557. if (event.originalEvent.mouseHandled) { return; }
  558. // we may have missed mouseup (out of window)
  559. (this._mouseStarted && this._mouseUp(event));
  560. this._mouseDownEvent = event;
  561. var self = this,
  562. btnIsLeft = (event.which == 1),
  563. elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
  564. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  565. return true;
  566. }
  567. this.mouseDelayMet = !this.options.delay;
  568. if (!this.mouseDelayMet) {
  569. this._mouseDelayTimer = setTimeout(function() {
  570. self.mouseDelayMet = true;
  571. }, this.options.delay);
  572. }
  573. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  574. this._mouseStarted = (this._mouseStart(event) !== false);
  575. if (!this._mouseStarted) {
  576. event.preventDefault();
  577. return true;
  578. }
  579. }
  580. // Click event may never have fired (Gecko & Opera)
  581. if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
  582. $.removeData(event.target, this.widgetName + '.preventClickEvent');
  583. }
  584. // these delegates are required to keep context
  585. this._mouseMoveDelegate = function(event) {
  586. return self._mouseMove(event);
  587. };
  588. this._mouseUpDelegate = function(event) {
  589. return self._mouseUp(event);
  590. };
  591. $(document)
  592. .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  593. .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  594. event.preventDefault();
  595. event.originalEvent.mouseHandled = true;
  596. return true;
  597. },
  598. _mouseMove: function(event) {
  599. // IE mouseup check - mouseup happened when mouse was out of window
  600. if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
  601. return this._mouseUp(event);
  602. }
  603. if (this._mouseStarted) {
  604. this._mouseDrag(event);
  605. return event.preventDefault();
  606. }
  607. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  608. this._mouseStarted =
  609. (this._mouseStart(this._mouseDownEvent, event) !== false);
  610. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  611. }
  612. return !this._mouseStarted;
  613. },
  614. _mouseUp: function(event) {
  615. $(document)
  616. .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  617. .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  618. if (this._mouseStarted) {
  619. this._mouseStarted = false;
  620. if (event.target == this._mouseDownEvent.target) {
  621. $.data(event.target, this.widgetName + '.preventClickEvent', true);
  622. }
  623. this._mouseStop(event);
  624. }
  625. return false;
  626. },
  627. _mouseDistanceMet: function(event) {
  628. return (Math.max(
  629. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  630. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  631. ) >= this.options.distance
  632. );
  633. },
  634. _mouseDelayMet: function(event) {
  635. return this.mouseDelayMet;
  636. },
  637. // These are placeholder methods, to be overriden by extending plugin
  638. _mouseStart: function(event) {},
  639. _mouseDrag: function(event) {},
  640. _mouseStop: function(event) {},
  641. _mouseCapture: function(event) { return true; }
  642. });
  643. })(jQuery);
  644. /*
  645. * Note: While Microsoft is not the author of this file, Microsoft is
  646. * offering you a license subject to the terms of the Microsoft Software
  647. * License Terms for Microsoft ASP.NET Model View Controller 3.
  648. * Microsoft reserves all other rights. The notices below are provided
  649. * for informational purposes only and are not the license terms under
  650. * which Microsoft distributed this file.
  651. *
  652. * jQuery UI Position 1.8.11
  653. *
  654. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  655. *
  656. * http://docs.jquery.com/UI/Position
  657. */
  658. (function( $, undefined ) {
  659. $.ui = $.ui || {};
  660. var horizontalPositions = /left|center|right/,
  661. verticalPositions = /top|center|bottom/,
  662. center = "center",
  663. _position = $.fn.position,
  664. _offset = $.fn.offset;
  665. $.fn.position = function( options ) {
  666. if ( !options || !options.of ) {
  667. return _position.apply( this, arguments );
  668. }
  669. // make a copy, we don't want to modify arguments
  670. options = $.extend( {}, options );
  671. var target = $( options.of ),
  672. targetElem = target[0],
  673. collision = ( options.collision || "flip" ).split( " " ),
  674. offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
  675. targetWidth,
  676. targetHeight,
  677. basePosition;
  678. if ( targetElem.nodeType === 9 ) {
  679. targetWidth = target.width();
  680. targetHeight = target.height();
  681. basePosition = { top: 0, left: 0 };
  682. // TODO: use $.isWindow() in 1.9
  683. } else if ( targetElem.setTimeout ) {
  684. targetWidth = target.width();
  685. targetHeight = target.height();
  686. basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
  687. } else if ( targetElem.preventDefault ) {
  688. // force left top to allow flipping
  689. options.at = "left top";
  690. targetWidth = targetHeight = 0;
  691. basePosition = { top: options.of.pageY, left: options.of.pageX };
  692. } else {
  693. targetWidth = target.outerWidth();
  694. targetHeight = target.outerHeight();
  695. basePosition = target.offset();
  696. }
  697. // force my and at to have valid horizontal and veritcal positions
  698. // if a value is missing or invalid, it will be converted to center
  699. $.each( [ "my", "at" ], function() {
  700. var pos = ( options[this] || "" ).split( " " );
  701. if ( pos.length === 1) {
  702. pos = horizontalPositions.test( pos[0] ) ?
  703. pos.concat( [center] ) :
  704. verticalPositions.test( pos[0] ) ?
  705. [ center ].concat( pos ) :
  706. [ center, center ];
  707. }
  708. pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
  709. pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
  710. options[ this ] = pos;
  711. });
  712. // normalize collision option
  713. if ( collision.length === 1 ) {
  714. collision[ 1 ] = collision[ 0 ];
  715. }
  716. // normalize offset option
  717. offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
  718. if ( offset.length === 1 ) {
  719. offset[ 1 ] = offset[ 0 ];
  720. }
  721. offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
  722. if ( options.at[0] === "right" ) {
  723. basePosition.left += targetWidth;
  724. } else if ( options.at[0] === center ) {
  725. basePosition.left += targetWidth / 2;
  726. }
  727. if ( options.at[1] === "bottom" ) {
  728. basePosition.top += targetHeight;
  729. } else if ( options.at[1] === center ) {
  730. basePosition.top += targetHeight / 2;
  731. }
  732. basePosition.left += offset[ 0 ];
  733. basePosition.top += offset[ 1 ];
  734. return this.each(function() {
  735. var elem = $( this ),
  736. elemWidth = elem.outerWidth(),
  737. elemHeight = elem.outerHeight(),
  738. marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
  739. marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
  740. collisionWidth = elemWidth + marginLeft +
  741. ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
  742. collisionHeight = elemHeight + marginTop +
  743. ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
  744. position = $.extend( {}, basePosition ),
  745. collisionPosition;
  746. if ( options.my[0] === "right" ) {
  747. position.left -= elemWidth;
  748. } else if ( options.my[0] === center ) {
  749. position.left -= elemWidth / 2;
  750. }
  751. if ( options.my[1] === "bottom" ) {
  752. position.top -= elemHeight;
  753. } else if ( options.my[1] === center ) {
  754. position.top -= elemHeight / 2;
  755. }
  756. // prevent fractions (see #5280)
  757. position.left = Math.round( position.left );
  758. position.top = Math.round( position.top );
  759. collisionPosition = {
  760. left: position.left - marginLeft,
  761. top: position.top - marginTop
  762. };
  763. $.each( [ "left", "top" ], function( i, dir ) {
  764. if ( $.ui.position[ collision[i] ] ) {
  765. $.ui.position[ collision[i] ][ dir ]( position, {
  766. targetWidth: targetWidth,
  767. targetHeight: targetHeight,
  768. elemWidth: elemWidth,
  769. elemHeight: elemHeight,
  770. collisionPosition: collisionPosition,
  771. collisionWidth: collisionWidth,
  772. collisionHeight: collisionHeight,
  773. offset: offset,
  774. my: options.my,
  775. at: options.at
  776. });
  777. }
  778. });
  779. if ( $.fn.bgiframe ) {
  780. elem.bgiframe();
  781. }
  782. elem.offset( $.extend( position, { using: options.using } ) );
  783. });
  784. };
  785. $.ui.position = {
  786. fit: {
  787. left: function( position, data ) {
  788. var win = $( window ),
  789. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
  790. position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
  791. },
  792. top: function( position, data ) {
  793. var win = $( window ),
  794. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
  795. position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
  796. }
  797. },
  798. flip: {
  799. left: function( position, data ) {
  800. if ( data.at[0] === center ) {
  801. return;
  802. }
  803. var win = $( window ),
  804. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
  805. myOffset = data.my[ 0 ] === "left" ?
  806. -data.elemWidth :
  807. data.my[ 0 ] === "right" ?
  808. data.elemWidth :
  809. 0,
  810. atOffset = data.at[ 0 ] === "left" ?
  811. data.targetWidth :
  812. -data.targetWidth,
  813. offset = -2 * data.offset[ 0 ];
  814. position.left += data.collisionPosition.left < 0 ?
  815. myOffset + atOffset + offset :
  816. over > 0 ?
  817. myOffset + atOffset + offset :
  818. 0;
  819. },
  820. top: function( position, data ) {
  821. if ( data.at[1] === center ) {
  822. return;
  823. }
  824. var win = $( window ),
  825. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
  826. myOffset = data.my[ 1 ] === "top" ?
  827. -data.elemHeight :
  828. data.my[ 1 ] === "bottom" ?
  829. data.elemHeight :
  830. 0,
  831. atOffset = data.at[ 1 ] === "top" ?
  832. data.targetHeight :
  833. -data.targetHeight,
  834. offset = -2 * data.offset[ 1 ];
  835. position.top += data.collisionPosition.top < 0 ?
  836. myOffset + atOffset + offset :
  837. over > 0 ?
  838. myOffset + atOffset + offset :
  839. 0;
  840. }
  841. }
  842. };
  843. // offset setter from jQuery 1.4
  844. if ( !$.offset.setOffset ) {
  845. $.offset.setOffset = function( elem, options ) {
  846. // set position first, in-case top/left are set even on static elem
  847. if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
  848. elem.style.position = "relative";
  849. }
  850. var curElem = $( elem ),
  851. curOffset = curElem.offset(),
  852. curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
  853. curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
  854. props = {
  855. top: (options.top - curOffset.top) + curTop,
  856. left: (options.left - curOffset.left) + curLeft
  857. };
  858. if ( 'using' in options ) {
  859. options.using.call( elem, props );
  860. } else {
  861. curElem.css( props );
  862. }
  863. };
  864. $.fn.offset = function( options ) {
  865. var elem = this[ 0 ];
  866. if ( !elem || !elem.ownerDocument ) { return null; }
  867. if ( options ) {
  868. return this.each(function() {
  869. $.offset.setOffset( this, options );
  870. });
  871. }
  872. return _offset.call( this );
  873. };
  874. }
  875. }( jQuery ));
  876. /*
  877. * Note: While Microsoft is not the author of this file, Microsoft is
  878. * offering you a license subject to the terms of the Microsoft Software
  879. * License Terms for Microsoft ASP.NET Model View Controller 3.
  880. * Microsoft reserves all other rights. The notices below are provided
  881. * for informational purposes only and are not the license terms under
  882. * which Microsoft distributed this file.
  883. *
  884. * jQuery UI Draggable 1.8.11
  885. *
  886. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  887. *
  888. * http://docs.jquery.com/UI/Draggables
  889. *
  890. * Depends:
  891. * jquery.ui.core.js
  892. * jquery.ui.mouse.js
  893. * jquery.ui.widget.js
  894. */
  895. (function( $, undefined ) {
  896. $.widget("ui.draggable", $.ui.mouse, {
  897. widgetEventPrefix: "drag",
  898. options: {
  899. addClasses: true,
  900. appendTo: "parent",
  901. axis: false,
  902. connectToSortable: false,
  903. containment: false,
  904. cursor: "auto",
  905. cursorAt: false,
  906. grid: false,
  907. handle: false,
  908. helper: "original",
  909. iframeFix: false,
  910. opacity: false,
  911. refreshPositions: false,
  912. revert: false,
  913. revertDuration: 500,
  914. scope: "default",
  915. scroll: true,
  916. scrollSensitivity: 20,
  917. scrollSpeed: 20,
  918. snap: false,
  919. snapMode: "both",
  920. snapTolerance: 20,
  921. stack: false,
  922. zIndex: false
  923. },
  924. _create: function() {
  925. if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
  926. this.element[0].style.position = 'relative';
  927. (this.options.addClasses && this.element.addClass("ui-draggable"));
  928. (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
  929. this._mouseInit();
  930. },
  931. destroy: function() {
  932. if(!this.element.data('draggable')) return;
  933. this.element
  934. .removeData("draggable")
  935. .unbind(".draggable")
  936. .removeClass("ui-draggable"
  937. + " ui-draggable-dragging"
  938. + " ui-draggable-disabled");
  939. this._mouseDestroy();
  940. return this;
  941. },
  942. _mouseCapture: function(event) {
  943. var o = this.options;
  944. // among others, prevent a drag on a resizable-handle
  945. if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
  946. return false;
  947. //Quit if we're not on a valid handle
  948. this.handle = this._getHandle(event);
  949. if (!this.handle)
  950. return false;
  951. return true;
  952. },
  953. _mouseStart: function(event) {
  954. var o = this.options;
  955. //Create and append the visible helper
  956. this.helper = this._createHelper(event);
  957. //Cache the helper size
  958. this._cacheHelperProportions();
  959. //If ddmanager is used for droppables, set the global draggable
  960. if($.ui.ddmanager)
  961. $.ui.ddmanager.current = this;
  962. /*
  963. * - Position generation -
  964. * This block generates everything position related - it's the core of draggables.
  965. */
  966. //Cache the margins of the original element
  967. this._cacheMargins();
  968. //Store the helper's css position
  969. this.cssPosition = this.helper.css("position");
  970. this.scrollParent = this.helper.scrollParent();
  971. //The element's absolute position on the page minus margins
  972. this.offset = this.positionAbs = this.element.offset();
  973. this.offset = {
  974. top: this.offset.top - this.margins.top,
  975. left: this.offset.left - this.margins.left
  976. };
  977. $.extend(this.offset, {
  978. click: { //Where the click happened, relative to the element
  979. left: event.pageX - this.offset.left,
  980. top: event.pageY - this.offset.top
  981. },
  982. parent: this._getParentOffset(),
  983. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  984. });
  985. //Generate the original position
  986. this.originalPosition = this.position = this._generatePosition(event);
  987. this.originalPageX = event.pageX;
  988. this.originalPageY = event.pageY;
  989. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  990. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  991. //Set a containment if given in the options
  992. if(o.containment)
  993. this._setContainment();
  994. //Trigger event + callbacks
  995. if(this._trigger("start", event) === false) {
  996. this._clear();
  997. return false;
  998. }
  999. //Recache the helper size
  1000. this._cacheHelperProportions();
  1001. //Prepare the droppable offsets
  1002. if ($.ui.ddmanager && !o.dropBehaviour)
  1003. $.ui.ddmanager.prepareOffsets(this, event);
  1004. this.helper.addClass("ui-draggable-dragging");
  1005. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  1006. return true;
  1007. },
  1008. _mouseDrag: function(event, noPropagation) {
  1009. //Compute the helpers position
  1010. this.position = this._generatePosition(event);
  1011. this.positionAbs = this._convertPositionTo("absolute");
  1012. //Call plugins and callbacks and use the resulting position if something is returned
  1013. if (!noPropagation) {
  1014. var ui = this._uiHash();
  1015. if(this._trigger('drag', event, ui) === false) {
  1016. this._mouseUp({});
  1017. return false;
  1018. }
  1019. this.position = ui.position;
  1020. }
  1021. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  1022. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  1023. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  1024. return false;
  1025. },
  1026. _mouseStop: function(event) {
  1027. //If we are using droppables, inform the manager about the drop
  1028. var dropped = false;
  1029. if ($.ui.ddmanager && !this.options.dropBehaviour)
  1030. dropped = $.ui.ddmanager.drop(this, event);
  1031. //if a drop comes from outside (a sortable)
  1032. if(this.dropped) {
  1033. dropped = this.dropped;
  1034. this.dropped = false;
  1035. }
  1036. //if the original element is removed, don't bother to continue if helper is set to "original"
  1037. if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
  1038. return false;
  1039. 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))) {
  1040. var self = this;
  1041. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  1042. if(self._trigger("stop", event) !== false) {
  1043. self._clear();
  1044. }
  1045. });
  1046. } else {
  1047. if(this._trigger("stop", event) !== false) {
  1048. this._clear();
  1049. }
  1050. }
  1051. return false;
  1052. },
  1053. cancel: function() {
  1054. if(this.helper.is(".ui-draggable-dragging")) {
  1055. this._mouseUp({});
  1056. } else {
  1057. this._clear();
  1058. }
  1059. return this;
  1060. },
  1061. _getHandle: function(event) {
  1062. var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
  1063. $(this.options.handle, this.element)
  1064. .find("*")
  1065. .andSelf()
  1066. .each(function() {
  1067. if(this == event.target) handle = true;
  1068. });
  1069. return handle;
  1070. },
  1071. _createHelper: function(event) {
  1072. var o = this.options;
  1073. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
  1074. if(!helper.parents('body').length)
  1075. helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
  1076. if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
  1077. helper.css("position", "absolute");
  1078. return helper;
  1079. },
  1080. _adjustOffsetFromHelper: function(obj) {
  1081. if (typeof obj == 'string') {
  1082. obj = obj.split(' ');
  1083. }
  1084. if ($.isArray(obj)) {
  1085. obj = {left: +obj[0], top: +obj[1] || 0};
  1086. }
  1087. if ('left' in obj) {
  1088. this.offset.click.left = obj.left + this.margins.left;
  1089. }
  1090. if ('right' in obj) {
  1091. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  1092. }
  1093. if ('top' in obj) {
  1094. this.offset.click.top = obj.top + this.margins.top;
  1095. }
  1096. if ('bottom' in obj) {
  1097. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  1098. }
  1099. },
  1100. _getParentOffset: function() {
  1101. //Get the offsetParent and cache its position
  1102. this.offsetParent = this.helper.offsetParent();
  1103. var po = this.offsetParent.offset();
  1104. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  1105. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  1106. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  1107. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  1108. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  1109. po.left += this.scrollParent.scrollLeft();
  1110. po.top += this.scrollParent.scrollTop();
  1111. }
  1112. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  1113. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  1114. po = { top: 0, left: 0 };
  1115. return {
  1116. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  1117. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  1118. };
  1119. },
  1120. _getRelativeOffset: function() {
  1121. if(this.cssPosition == "relative") {
  1122. var p = this.element.position();
  1123. return {
  1124. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  1125. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  1126. };
  1127. } else {
  1128. return { top: 0, left: 0 };
  1129. }
  1130. },
  1131. _cacheMargins: function() {
  1132. this.margins = {
  1133. left: (parseInt(this.element.css("marginLeft"),10) || 0),
  1134. top: (parseInt(this.element.css("marginTop"),10) || 0),
  1135. right: (parseInt(this.element.css("marginRight"),10) || 0),
  1136. bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
  1137. };
  1138. },
  1139. _cacheHelperProportions: function() {
  1140. this.helperProportions = {
  1141. width: this.helper.outerWidth(),
  1142. height: this.helper.outerHeight()
  1143. };
  1144. },
  1145. _setContainment: function() {
  1146. var o = this.options;
  1147. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  1148. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  1149. (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
  1150. (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
  1151. (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  1152. (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  1153. ];
  1154. if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
  1155. var ce = $(o.containment)[0]; if(!ce) return;
  1156. var co = $(o.containment).offset();
  1157. var over = ($(ce).css("overflow") != 'hidden');
  1158. this.containment = [
  1159. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
  1160. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
  1161. 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 - this.margins.right,
  1162. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
  1163. ];
  1164. } else if(o.containment.constructor == Array) {
  1165. this.containment = o.containment;
  1166. }
  1167. },
  1168. _convertPositionTo: function(d, pos) {
  1169. if(!pos) pos = this.position;
  1170. var mod = d == "absolute" ? 1 : -1;
  1171. 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);
  1172. return {
  1173. top: (
  1174. pos.top // The absolute mouse position
  1175. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1176. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  1177. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  1178. ),
  1179. left: (
  1180. pos.left // The absolute mouse position
  1181. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1182. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  1183. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  1184. )
  1185. };
  1186. },
  1187. _generatePosition: function(event) {
  1188. 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);
  1189. var pageX = event.pageX;
  1190. var pageY = event.pageY;
  1191. /*
  1192. * - Position constraining -
  1193. * Constrain the position to a mix of grid, containment.
  1194. */
  1195. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  1196. if(this.containment) {
  1197. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  1198. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  1199. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  1200. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  1201. }
  1202. if(o.grid) {
  1203. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  1204. 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;
  1205. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  1206. 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;
  1207. }
  1208. }
  1209. return {
  1210. top: (
  1211. pageY // The absolute mouse position
  1212. - this.offset.click.top // Click offset (relative to the element)
  1213. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  1214. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  1215. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  1216. ),
  1217. left: (
  1218. pageX // The absolute mouse position
  1219. - this.offset.click.left // Click offset (relative to the element)
  1220. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  1221. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  1222. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  1223. )
  1224. };
  1225. },
  1226. _clear: function() {
  1227. this.helper.removeClass("ui-draggable-dragging");
  1228. if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
  1229. //if($.ui.ddmanager) $.ui.ddmanager.current = null;
  1230. this.helper = null;
  1231. this.cancelHelperRemoval = false;
  1232. },
  1233. // From now on bulk stuff - mainly helpers
  1234. _trigger: function(type, event, ui) {
  1235. ui = ui || this._uiHash();
  1236. $.ui.plugin.call(this, type, [event, ui]);
  1237. if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
  1238. return $.Widget.prototype._trigger.call(this, type, event, ui);
  1239. },
  1240. plugins: {},
  1241. _uiHash: function(event) {
  1242. return {
  1243. helper: this.helper,
  1244. position: this.position,
  1245. originalPosition: this.originalPosition,
  1246. offset: this.positionAbs
  1247. };
  1248. }
  1249. });
  1250. $.extend($.ui.draggable, {
  1251. version: "1.8.11"
  1252. });
  1253. $.ui.plugin.add("draggable", "connectToSortable", {
  1254. start: function(event, ui) {
  1255. var inst = $(this).data("draggable"), o = inst.options,
  1256. uiSortable = $.extend({}, ui, { item: inst.element });
  1257. inst.sortables = [];
  1258. $(o.connectToSortable).each(function() {
  1259. var sortable = $.data(this, 'sortable');
  1260. if (sortable && !sortable.options.disabled) {
  1261. inst.sortables.push({
  1262. instance: sortable,
  1263. shouldRevert: sortable.options.revert
  1264. });
  1265. 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).
  1266. sortable._trigger("activate", event, uiSortable);
  1267. }
  1268. });
  1269. },
  1270. stop: function(event, ui) {
  1271. //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
  1272. var inst = $(this).data("draggable"),
  1273. uiSortable = $.extend({}, ui, { item: inst.element });
  1274. $.each(inst.sortables, function() {
  1275. if(this.instance.isOver) {
  1276. this.instance.isOver = 0;
  1277. inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
  1278. this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
  1279. //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
  1280. if(this.shouldRevert) this.instance.options.revert = true;
  1281. //Trigger the stop of the sortable
  1282. this.instance._mouseStop(event);
  1283. this.instance.options.helper = this.instance.options._helper;
  1284. //If the helper has been the original item, restore properties in the sortable
  1285. if(inst.options.helper == 'original')
  1286. this.instance.currentItem.css({ top: 'auto', left: 'auto' });
  1287. } else {
  1288. this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
  1289. this.instance._trigger("deactivate", event, uiSortable);
  1290. }
  1291. });
  1292. },
  1293. drag: function(event, ui) {
  1294. var inst = $(this).data("draggable"), self = this;
  1295. var checkPos = function(o) {
  1296. var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
  1297. var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
  1298. var itemHeight = o.height, itemWidth = o.width;
  1299. var itemTop = o.top, itemLeft = o.left;
  1300. return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
  1301. };
  1302. $.each(inst.sortables, function(i) {
  1303. //Copy over some variables to allow calling the sortable's native _intersectsWith
  1304. this.instance.positionAbs = inst.positionAbs;
  1305. this.instance.helperProportions = inst.helperProportions;
  1306. this.instance.offset.click = inst.offset.click;
  1307. if(this.instance._intersectsWith(this.instance.containerCache)) {
  1308. //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
  1309. if(!this.instance.isOver) {
  1310. this.instance.isOver = 1;
  1311. //Now we fake the start of dragging for the sortable instance,
  1312. //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
  1313. //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)
  1314. this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
  1315. this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
  1316. this.instance.options.helper = function() { return ui.helper[0]; };
  1317. event.target = this.instance.currentItem[0];
  1318. this.instance._mouseCapture(event, true);
  1319. this.instance._mouseStart(event, true, true);
  1320. //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
  1321. this.instance.offset.click.top = inst.offset.click.top;
  1322. this.instance.offset.click.left = inst.offset.click.left;
  1323. this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
  1324. this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
  1325. inst._trigger("toSortable", event);
  1326. inst.dropped = this.instance.element; //draggable revert needs that
  1327. //hack so receive/update callbacks work (mostly)
  1328. inst.currentItem = inst.element;
  1329. this.instance.fromOutside = inst;
  1330. }
  1331. //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
  1332. if(this.instance.currentItem) this.instance._mouseDrag(event);
  1333. } else {
  1334. //If it doesn't intersect with the sortable, and it intersected before,
  1335. //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
  1336. if(this.instance.isOver) {
  1337. this.instance.isOver = 0;
  1338. this.instance.cancelHelperRemoval = true;
  1339. //Prevent reverting on this forced stop
  1340. this.instance.options.revert = false;
  1341. // The out event needs to be triggered independently
  1342. this.instance._trigger('out', event, this.instance._uiHash(this.instance));
  1343. this.instance._mouseStop(event, true);
  1344. this.instance.options.helper = this.instance.options._helper;
  1345. //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
  1346. this.instance.currentItem.remove();
  1347. if(this.instance.placeholder) this.instance.placeholder.remove();
  1348. inst._trigger("fromSortable", event);
  1349. inst.dropped = false; //draggable revert needs that
  1350. }
  1351. };
  1352. });
  1353. }
  1354. });
  1355. $.ui.plugin.add("draggable", "cursor", {
  1356. start: function(event, ui) {
  1357. var t = $('body'), o = $(this).data('draggable').options;
  1358. if (t.css("cursor")) o._cursor = t.css("cursor");
  1359. t.css("cursor", o.cursor);
  1360. },
  1361. stop: function(event, ui) {
  1362. var o = $(this).data('draggable').options;
  1363. if (o._cursor) $('body').css("cursor", o._cursor);
  1364. }
  1365. });
  1366. $.ui.plugin.add("draggable", "iframeFix", {
  1367. start: function(event, ui) {
  1368. var o = $(this).data('draggable').options;
  1369. $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
  1370. $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
  1371. .css({
  1372. width: this.offsetWidth+"px", height: this.offsetHeight+"px",
  1373. position: "absolute", opacity: "0.001", zIndex: 1000
  1374. })
  1375. .css($(this).offset())
  1376. .appendTo("body");
  1377. });
  1378. },
  1379. stop: function(event, ui) {
  1380. $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
  1381. }
  1382. });
  1383. $.ui.plugin.add("draggable", "opacity", {
  1384. start: function(event, ui) {
  1385. var t = $(ui.helper), o = $(this).data('draggable').options;
  1386. if(t.css("opacity")) o._opacity = t.css("opacity");
  1387. t.css('opacity', o.opacity);
  1388. },
  1389. stop: function(event, ui) {
  1390. var o = $(this).data('draggable').options;
  1391. if(o._opacity) $(ui.helper).css('opacity', o._opacity);
  1392. }
  1393. });
  1394. $.ui.plugin.add("draggable", "scroll", {
  1395. start: function(event, ui) {
  1396. var i = $(this).data("draggable");
  1397. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
  1398. },
  1399. drag: function(event, ui) {
  1400. var i = $(this).data("draggable"), o = i.options, scrolled = false;
  1401. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
  1402. if(!o.axis || o.axis != 'x') {
  1403. if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  1404. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
  1405. else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
  1406. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
  1407. }
  1408. if(!o.axis || o.axis != 'y') {
  1409. if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  1410. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
  1411. else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
  1412. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
  1413. }
  1414. } else {
  1415. if(!o.axis || o.axis != 'x') {
  1416. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  1417. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  1418. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  1419. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  1420. }
  1421. if(!o.axis || o.axis != 'y') {
  1422. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  1423. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  1424. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  1425. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  1426. }
  1427. }
  1428. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  1429. $.ui.ddmanager.prepareOffsets(i, event);
  1430. }
  1431. });
  1432. $.ui.plugin.add("draggable", "snap", {
  1433. start: function(event, ui) {
  1434. var i = $(this).data("draggable"), o = i.options;
  1435. i.snapElements = [];
  1436. $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
  1437. var $t = $(this); var $o = $t.offset();
  1438. if(this != i.element[0]) i.snapElements.push({
  1439. item: this,
  1440. width: $t.outerWidth(), height: $t.outerHeight(),
  1441. top: $o.top, left: $o.left
  1442. });
  1443. });
  1444. },
  1445. drag: function(event, ui) {
  1446. var inst = $(this).data("draggable"), o = inst.options;
  1447. var d = o.snapTolerance;
  1448. var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  1449. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  1450. for (var i = inst.snapElements.length - 1; i >= 0; i--){
  1451. var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
  1452. t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
  1453. //Yes, I know, this is insane ;)
  1454. 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))) {
  1455. 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 })));
  1456. inst.snapElements[i].snapping = false;
  1457. continue;
  1458. }
  1459. if(o.snapMode != 'inner') {
  1460. var ts = Math.abs(t - y2) <= d;
  1461. var bs = Math.abs(b - y1) <= d;
  1462. var ls = Math.abs(l - x2) <= d;
  1463. var rs = Math.abs(r - x1) <= d;
  1464. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1465. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
  1466. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
  1467. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
  1468. }
  1469. var first = (ts || bs || ls || rs);
  1470. if(o.snapMode != 'outer') {
  1471. var ts = Math.abs(t - y1) <= d;
  1472. var bs = Math.abs(b - y2) <= d;
  1473. var ls = Math.abs(l - x1) <= d;
  1474. var rs = Math.abs(r - x2) <= d;
  1475. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
  1476. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1477. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
  1478. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
  1479. }
  1480. if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
  1481. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1482. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  1483. };
  1484. }
  1485. });
  1486. $.ui.plugin.add("draggable", "stack", {
  1487. start: function(event, ui) {
  1488. var o = $(this).data("draggable").options;
  1489. var group = $.makeArray($(o.stack)).sort(function(a,b) {
  1490. return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
  1491. });
  1492. if (!group.length) { return; }
  1493. var min = parseInt(group[0].style.zIndex) || 0;
  1494. $(group).each(function(i) {
  1495. this.style.zIndex = min + i;
  1496. });
  1497. this[0].style.zIndex = min + group.length;
  1498. }
  1499. });
  1500. $.ui.plugin.add("draggable", "zIndex", {
  1501. start: function(event, ui) {
  1502. var t = $(ui.helper), o = $(this).data("draggable").options;
  1503. if(t.css("zIndex")) o._zIndex = t.css("zIndex");
  1504. t.css('zIndex', o.zIndex);
  1505. },
  1506. stop: function(event, ui) {
  1507. var o = $(this).data("draggable").options;
  1508. if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
  1509. }
  1510. });
  1511. })(jQuery);
  1512. /*
  1513. * Note: While Microsoft is not the author of this file, Microsoft is
  1514. * offering you a license subject to the terms of the Microsoft Software
  1515. * License Terms for Microsoft ASP.NET Model View Controller 3.
  1516. * Microsoft reserves all other rights. The notices below are provided
  1517. * for informational purposes only and are not the license terms under
  1518. * which Microsoft distributed this file.
  1519. *
  1520. * jQuery UI Droppable 1.8.11
  1521. *
  1522. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  1523. *
  1524. * http://docs.jquery.com/UI/Droppables
  1525. *
  1526. * Depends:
  1527. * jquery.ui.core.js
  1528. * jquery.ui.widget.js
  1529. * jquery.ui.mouse.js
  1530. * jquery.ui.draggable.js
  1531. */
  1532. (function( $, undefined ) {
  1533. $.widget("ui.droppable", {
  1534. widgetEventPrefix: "drop",
  1535. options: {
  1536. accept: '*',
  1537. activeClass: false,
  1538. addClasses: true,
  1539. greedy: false,
  1540. hoverClass: false,
  1541. scope: 'default',
  1542. tolerance: 'intersect'
  1543. },
  1544. _create: function() {
  1545. var o = this.options, accept = o.accept;
  1546. this.isover = 0; this.isout = 1;
  1547. this.accept = $.isFunction(accept) ? accept : function(d) {
  1548. return d.is(accept);
  1549. };
  1550. //Store the droppable's proportions
  1551. this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
  1552. // Add the reference and positions to the manager
  1553. $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
  1554. $.ui.ddmanager.droppables[o.scope].push(this);
  1555. (o.addClasses && this.element.addClass("ui-droppable"));
  1556. },
  1557. destroy: function() {
  1558. var drop = $.ui.ddmanager.droppables[this.options.scope];
  1559. for ( var i = 0; i < drop.length; i++ )
  1560. if ( drop[i] == this )
  1561. drop.splice(i, 1);
  1562. this.element
  1563. .removeClass("ui-droppable ui-droppable-disabled")
  1564. .removeData("droppable")
  1565. .unbind(".droppable");
  1566. return this;
  1567. },
  1568. _setOption: function(key, value) {
  1569. if(key == 'accept') {
  1570. this.accept = $.isFunction(value) ? value : function(d) {
  1571. return d.is(value);
  1572. };
  1573. }
  1574. $.Widget.prototype._setOption.apply(this, arguments);
  1575. },
  1576. _activate: function(event) {
  1577. var draggable = $.ui.ddmanager.current;
  1578. if(this.options.activeClass) this.element.addClass(this.options.activeClass);
  1579. (draggable && this._trigger('activate', event, this.ui(draggable)));
  1580. },
  1581. _deactivate: function(event) {
  1582. var draggable = $.ui.ddmanager.current;
  1583. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1584. (draggable && this._trigger('deactivate', event, this.ui(draggable)));
  1585. },
  1586. _over: function(event) {
  1587. var draggable = $.ui.ddmanager.current;
  1588. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1589. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1590. if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
  1591. this._trigger('over', event, this.ui(draggable));
  1592. }
  1593. },
  1594. _out: function(event) {
  1595. var draggable = $.ui.ddmanager.current;
  1596. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1597. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1598. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1599. this._trigger('out', event, this.ui(draggable));
  1600. }
  1601. },
  1602. _drop: function(event,custom) {
  1603. var draggable = custom || $.ui.ddmanager.current;
  1604. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
  1605. var childrenIntersection = false;
  1606. this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
  1607. var inst = $.data(this, 'droppable');
  1608. if(
  1609. inst.options.greedy
  1610. && !inst.options.disabled
  1611. && inst.options.scope == draggable.options.scope
  1612. && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
  1613. && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
  1614. ) { childrenIntersection = true; return false; }
  1615. });
  1616. if(childrenIntersection) return false;
  1617. if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1618. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1619. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1620. this._trigger('drop', event, this.ui(draggable));
  1621. return this.element;
  1622. }
  1623. return false;
  1624. },
  1625. ui: function(c) {
  1626. return {
  1627. draggable: (c.currentItem || c.element),
  1628. helper: c.helper,
  1629. position: c.position,
  1630. offset: c.positionAbs
  1631. };
  1632. }
  1633. });
  1634. $.extend($.ui.droppable, {
  1635. version: "1.8.11"
  1636. });
  1637. $.ui.intersect = function(draggable, droppable, toleranceMode) {
  1638. if (!droppable.offset) return false;
  1639. var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
  1640. y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
  1641. var l = droppable.offset.left, r = l + droppable.proportions.width,
  1642. t = droppable.offset.top, b = t + droppable.proportions.height;
  1643. switch (toleranceMode) {
  1644. case 'fit':
  1645. return (l <= x1 && x2 <= r
  1646. && t <= y1 && y2 <= b);
  1647. break;
  1648. case 'intersect':
  1649. return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
  1650. && x2 - (draggable.helperProportions.width / 2) < r // Left Half
  1651. && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
  1652. && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
  1653. break;
  1654. case 'pointer':
  1655. var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
  1656. draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
  1657. isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
  1658. return isOver;
  1659. break;
  1660. case 'touch':
  1661. return (
  1662. (y1 >= t && y1 <= b) || // Top edge touching
  1663. (y2 >= t && y2 <= b) || // Bottom edge touching
  1664. (y1 < t && y2 > b) // Surrounded vertically
  1665. ) && (
  1666. (x1 >= l && x1 <= r) || // Left edge touching
  1667. (x2 >= l && x2 <= r) || // Right edge touching
  1668. (x1 < l && x2 > r) // Surrounded horizontally
  1669. );
  1670. break;
  1671. default:
  1672. return false;
  1673. break;
  1674. }
  1675. };
  1676. /*
  1677. This manager tracks offsets of draggables and droppables
  1678. */
  1679. $.ui.ddmanager = {
  1680. current: null,
  1681. droppables: { 'default': [] },
  1682. prepareOffsets: function(t, event) {
  1683. var m = $.ui.ddmanager.droppables[t.options.scope] || [];
  1684. var type = event ? event.type : null; // workaround for #2317
  1685. var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
  1686. droppablesLoop: for (var i = 0; i < m.length; i++) {
  1687. if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
  1688. 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
  1689. m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
  1690. if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
  1691. m[i].offset = m[i].element.offset();
  1692. m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
  1693. }
  1694. },
  1695. drop: function(draggable, event) {
  1696. var dropped = false;
  1697. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1698. if(!this.options) return;
  1699. if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
  1700. dropped = dropped || this._drop.call(this, event);
  1701. if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1702. this.isout = 1; this.isover = 0;
  1703. this._deactivate.call(this, event);
  1704. }
  1705. });
  1706. return dropped;
  1707. },
  1708. drag: function(draggable, event) {
  1709. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  1710. if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
  1711. //Run through all droppables and check their positions based on specific tolerance options
  1712. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1713. if(this.options.disabled || this.greedyChild || !this.visible) return;
  1714. var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
  1715. var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
  1716. if(!c) return;
  1717. var parentInstance;
  1718. if (this.options.greedy) {
  1719. var parent = this.element.parents(':data(droppable):eq(0)');
  1720. if (parent.length) {
  1721. parentInstance = $.data(parent[0], 'droppable');
  1722. parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
  1723. }
  1724. }
  1725. // we just moved into a greedy child
  1726. if (parentInstance && c == 'isover') {
  1727. parentInstance['isover'] = 0;
  1728. parentInstance['isout'] = 1;
  1729. parentInstance._out.call(parentInstance, event);
  1730. }
  1731. this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
  1732. this[c == "isover" ? "_over" : "_out"].call(this, event);
  1733. // we just moved out of a greedy child
  1734. if (parentInstance && c == 'isout') {
  1735. parentInstance['isout'] = 0;
  1736. parentInstance['isover'] = 1;
  1737. parentInstance._over.call(parentInstance, event);
  1738. }
  1739. });
  1740. }
  1741. };
  1742. })(jQuery);
  1743. /*
  1744. * Note: While Microsoft is not the author of this file, Microsoft is
  1745. * offering you a license subject to the terms of the Microsoft Software
  1746. * License Terms for Microsoft ASP.NET Model View Controller 3.
  1747. * Microsoft reserves all other rights. The notices below are provided
  1748. * for informational purposes only and are not the license terms under
  1749. * which Microsoft distributed this file.
  1750. *
  1751. * jQuery UI Resizable 1.8.11
  1752. *
  1753. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  1754. *
  1755. * http://docs.jquery.com/UI/Resizables
  1756. *
  1757. * Depends:
  1758. * jquery.ui.core.js
  1759. * jquery.ui.mouse.js
  1760. * jquery.ui.widget.js
  1761. */
  1762. (function( $, undefined ) {
  1763. $.widget("ui.resizable", $.ui.mouse, {
  1764. widgetEventPrefix: "resize",
  1765. options: {
  1766. alsoResize: false,
  1767. animate: false,
  1768. animateDuration: "slow",
  1769. animateEasing: "swing",
  1770. aspectRatio: false,
  1771. autoHide: false,
  1772. containment: false,
  1773. ghost: false,
  1774. grid: false,
  1775. handles: "e,s,se",
  1776. helper: false,
  1777. maxHeight: null,
  1778. maxWidth: null,
  1779. minHeight: 10,
  1780. minWidth: 10,
  1781. zIndex: 1000
  1782. },
  1783. _create: function() {
  1784. var self = this, o = this.options;
  1785. this.element.addClass("ui-resizable");
  1786. $.extend(this, {
  1787. _aspectRatio: !!(o.aspectRatio),
  1788. aspectRatio: o.aspectRatio,
  1789. originalElement: this.element,
  1790. _proportionallyResizeElements: [],
  1791. _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
  1792. });
  1793. //Wrap the element if it cannot hold child nodes
  1794. if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
  1795. //Opera fix for relative positioning
  1796. if (/relative/.test(this.element.css('position')) && $.browser.opera)
  1797. this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
  1798. //Create a wrapper element and set the wrapper to the new current internal element
  1799. this.element.wrap(
  1800. $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
  1801. position: this.element.css('position'),
  1802. width: this.element.outerWidth(),
  1803. height: this.element.outerHeight(),
  1804. top: this.element.css('top'),
  1805. left: this.element.css('left')
  1806. })
  1807. );
  1808. //Overwrite the original this.element
  1809. this.element = this.element.parent().data(
  1810. "resizable", this.element.data('resizable')
  1811. );
  1812. this.elementIsWrapper = true;
  1813. //Move margins to the wrapper
  1814. this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
  1815. this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
  1816. //Prevent Safari textarea resize
  1817. this.originalResizeStyle = this.originalElement.css('resize');
  1818. this.originalElement.css('resize', 'none');
  1819. //Push the actual element to our proportionallyResize internal array
  1820. this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
  1821. // avoid IE jump (hard set the margin)
  1822. this.originalElement.css({ margin: this.originalElement.css('margin') });
  1823. // fix handlers offset
  1824. this._proportionallyResize();
  1825. }
  1826. 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' });
  1827. if(this.handles.constructor == String) {
  1828. if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
  1829. var n = this.handles.split(","); this.handles = {};
  1830. for(var i = 0; i < n.length; i++) {
  1831. var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
  1832. var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
  1833. // increase zIndex of sw, se, ne, nw axis
  1834. //TODO : this modifies original option
  1835. if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
  1836. //TODO : What's going on here?
  1837. if ('se' == handle) {
  1838. axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
  1839. };
  1840. //Insert into internal handles object and append to element
  1841. this.handles[handle] = '.ui-resizable-'+handle;
  1842. this.element.append(axis);
  1843. }
  1844. }
  1845. this._renderAxis = function(target) {
  1846. target = target || this.element;
  1847. for(var i in this.handles) {
  1848. if(this.handles[i].constructor == String)
  1849. this.handles[i] = $(this.handles[i], this.element).show();
  1850. //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
  1851. if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
  1852. var axis = $(this.handles[i], this.element), padWrapper = 0;
  1853. //Checking the correct pad and border
  1854. padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  1855. //The padding type i have to apply...
  1856. var padPos = [ 'padding',
  1857. /ne|nw|n/.test(i) ? 'Top' :
  1858. /se|sw|s/.test(i) ? 'Bottom' :
  1859. /^e$/.test(i) ? 'Right' : 'Left' ].join("");
  1860. target.css(padPos, padWrapper);
  1861. this._proportionallyResize();
  1862. }
  1863. //TODO: What's that good for? There's not anything to be executed left
  1864. if(!$(this.handles[i]).length)
  1865. continue;
  1866. }
  1867. };
  1868. //TODO: make renderAxis a prototype function
  1869. this._renderAxis(this.element);
  1870. this._handles = $('.ui-resizable-handle', this.element)
  1871. .disableSelection();
  1872. //Matching axis name
  1873. this._handles.mouseover(function() {
  1874. if (!self.resizing) {
  1875. if (this.className)
  1876. var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  1877. //Axis, default = se
  1878. self.axis = axis && axis[1] ? axis[1] : 'se';
  1879. }
  1880. });
  1881. //If we want to auto hide the elements
  1882. if (o.autoHide) {
  1883. this._handles.hide();
  1884. $(this.element)
  1885. .addClass("ui-resizable-autohide")
  1886. .hover(function() {
  1887. $(this).removeClass("ui-resizable-autohide");
  1888. self._handles.show();
  1889. },
  1890. function(){
  1891. if (!self.resizing) {
  1892. $(this).addClass("ui-resizable-autohide");
  1893. self._handles.hide();
  1894. }
  1895. });
  1896. }
  1897. //Initialize the mouse interaction
  1898. this._mouseInit();
  1899. },
  1900. destroy: function() {
  1901. this._mouseDestroy();
  1902. var _destroy = function(exp) {
  1903. $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  1904. .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
  1905. };
  1906. //TODO: Unwrap at same DOM position
  1907. if (this.elementIsWrapper) {
  1908. _destroy(this.element);
  1909. var wrapper = this.element;
  1910. wrapper.after(
  1911. this.originalElement.css({
  1912. position: wrapper.css('position'),
  1913. width: wrapper.outerWidth(),
  1914. height: wrapper.outerHeight(),
  1915. top: wrapper.css('top'),
  1916. left: wrapper.css('left')
  1917. })
  1918. ).remove();
  1919. }
  1920. this.originalElement.css('resize', this.originalResizeStyle);
  1921. _destroy(this.originalElement);
  1922. return this;
  1923. },
  1924. _mouseCapture: function(event) {
  1925. var handle = false;
  1926. for (var i in this.handles) {
  1927. if ($(this.handles[i])[0] == event.target) {
  1928. handle = true;
  1929. }
  1930. }
  1931. return !this.options.disabled && handle;
  1932. },
  1933. _mouseStart: function(event) {
  1934. var o = this.options, iniPos = this.element.position(), el = this.element;
  1935. this.resizing = true;
  1936. this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
  1937. // bugfix for http://dev.jquery.com/ticket/1749
  1938. if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
  1939. el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
  1940. }
  1941. //Opera fixing relative position
  1942. if ($.browser.opera && (/relative/).test(el.css('position')))
  1943. el.css({ position: 'relative', top: 'auto', left: 'auto' });
  1944. this._renderProxy();
  1945. var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
  1946. if (o.containment) {
  1947. curleft += $(o.containment).scrollLeft() || 0;
  1948. curtop += $(o.containment).scrollTop() || 0;
  1949. }
  1950. //Store needed variables
  1951. this.offset = this.helper.offset();
  1952. this.position = { left: curleft, top: curtop };
  1953. this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1954. this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1955. this.originalPosition = { left: curleft, top: curtop };
  1956. this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
  1957. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  1958. //Aspect Ratio
  1959. this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
  1960. var cursor = $('.ui-resizable-' + this.axis).css('cursor');
  1961. $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
  1962. el.addClass("ui-resizable-resizing");
  1963. this._propagate("start", event);
  1964. return true;
  1965. },
  1966. _mouseDrag: function(event) {
  1967. //Increase performance, avoid regex
  1968. var el = this.helper, o = this.options, props = {},
  1969. self = this, smp = this.originalMousePosition, a = this.axis;
  1970. var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
  1971. var trigger = this._change[a];
  1972. if (!trigger) return false;
  1973. // Calculate the attrs that will be change
  1974. var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
  1975. if (this._aspectRatio || event.shiftKey)
  1976. data = this._updateRatio(data, event);
  1977. data = this._respectSize(data, event);
  1978. // plugins callbacks need to be called first
  1979. this._propagate("resize", event);
  1980. el.css({
  1981. top: this.position.top + "px", left: this.position.left + "px",
  1982. width: this.size.width + "px", height: this.size.height + "px"
  1983. });
  1984. if (!this._helper && this._proportionallyResizeElements.length)
  1985. this._proportionallyResize();
  1986. this._updateCache(data);
  1987. // calling the user callback at the end
  1988. this._trigger('resize', event, this.ui());
  1989. return false;
  1990. },
  1991. _mouseStop: function(event) {
  1992. this.resizing = false;
  1993. var o = this.options, self = this;
  1994. if(this._helper) {
  1995. var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1996. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1997. soffsetw = ista ? 0 : self.sizeDiff.width;
  1998. var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
  1999. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  2000. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  2001. if (!o.animate)
  2002. this.element.css($.extend(s, { top: top, left: left }));
  2003. self.helper.height(self.size.height);
  2004. self.helper.width(self.size.width);
  2005. if (this._helper && !o.animate) this._proportionallyResize();
  2006. }
  2007. $('body').css('cursor', 'auto');
  2008. this.element.removeClass("ui-resizable-resizing");
  2009. this._propagate("stop", event);
  2010. if (this._helper) this.helper.remove();
  2011. return false;
  2012. },
  2013. _updateCache: function(data) {
  2014. var o = this.options;
  2015. this.offset = this.helper.offset();
  2016. if (isNumber(data.left)) this.position.left = data.left;
  2017. if (isNumber(data.top)) this.position.top = data.top;
  2018. if (isNumber(data.height)) this.size.height = data.height;
  2019. if (isNumber(data.width)) this.size.width = data.width;
  2020. },
  2021. _updateRatio: function(data, event) {
  2022. var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
  2023. if (data.height) data.width = (csize.height * this.aspectRatio);
  2024. else if (data.width) data.height = (csize.width / this.aspectRatio);
  2025. if (a == 'sw') {
  2026. data.left = cpos.left + (csize.width - data.width);
  2027. data.top = null;
  2028. }
  2029. if (a == 'nw') {
  2030. data.top = cpos.top + (csize.height - data.height);
  2031. data.left = cpos.left + (csize.width - data.width);
  2032. }
  2033. return data;
  2034. },
  2035. _respectSize: function(data, event) {
  2036. var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
  2037. ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  2038. isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
  2039. if (isminw) data.width = o.minWidth;
  2040. if (isminh) data.height = o.minHeight;
  2041. if (ismaxw) data.width = o.maxWidth;
  2042. if (ismaxh) data.height = o.maxHeight;
  2043. var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
  2044. var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  2045. if (isminw && cw) data.left = dw - o.minWidth;
  2046. if (ismaxw && cw) data.left = dw - o.maxWidth;
  2047. if (isminh && ch) data.top = dh - o.minHeight;
  2048. if (ismaxh && ch) data.top = dh - o.maxHeight;
  2049. // fixing jump error on top/left - bug #2330
  2050. var isNotwh = !data.width && !data.height;
  2051. if (isNotwh && !data.left && data.top) data.top = null;
  2052. else if (isNotwh && !data.top && data.left) data.left = null;
  2053. return data;
  2054. },
  2055. _proportionallyResize: function() {
  2056. var o = this.options;
  2057. if (!this._proportionallyResizeElements.length) return;
  2058. var element = this.helper || this.element;
  2059. for (var i=0; i < this._proportionallyResizeElements.length; i++) {
  2060. var prel = this._proportionallyResizeElements[i];
  2061. if (!this.borderDif) {
  2062. var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
  2063. p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
  2064. this.borderDif = $.map(b, function(v, i) {
  2065. var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
  2066. return border + padding;
  2067. });
  2068. }
  2069. if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
  2070. continue;
  2071. prel.css({
  2072. height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
  2073. width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
  2074. });
  2075. };
  2076. },
  2077. _renderProxy: function() {
  2078. var el = this.element, o = this.options;
  2079. this.elementOffset = el.offset();
  2080. if(this._helper) {
  2081. this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
  2082. // fix ie6 offset TODO: This seems broken
  2083. var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
  2084. pxyoffset = ( ie6 ? 2 : -1 );
  2085. this.helper.addClass(this._helper).css({
  2086. width: this.element.outerWidth() + pxyoffset,
  2087. height: this.element.outerHeight() + pxyoffset,
  2088. position: 'absolute',
  2089. left: this.elementOffset.left - ie6offset +'px',
  2090. top: this.elementOffset.top - ie6offset +'px',
  2091. zIndex: ++o.zIndex //TODO: Don't modify option
  2092. });
  2093. this.helper
  2094. .appendTo("body")
  2095. .disableSelection();
  2096. } else {
  2097. this.helper = this.element;
  2098. }
  2099. },
  2100. _change: {
  2101. e: function(event, dx, dy) {
  2102. return { width: this.originalSize.width + dx };
  2103. },
  2104. w: function(event, dx, dy) {
  2105. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  2106. return { left: sp.left + dx, width: cs.width - dx };
  2107. },
  2108. n: function(event, dx, dy) {
  2109. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  2110. return { top: sp.top + dy, height: cs.height - dy };
  2111. },
  2112. s: function(event, dx, dy) {
  2113. return { height: this.originalSize.height + dy };
  2114. },
  2115. se: function(event, dx, dy) {
  2116. return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  2117. },
  2118. sw: function(event, dx, dy) {
  2119. return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  2120. },
  2121. ne: function(event, dx, dy) {
  2122. return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  2123. },
  2124. nw: function(event, dx, dy) {
  2125. return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  2126. }
  2127. },
  2128. _propagate: function(n, event) {
  2129. $.ui.plugin.call(this, n, [event, this.ui()]);
  2130. (n != "resize" && this._trigger(n, event, this.ui()));
  2131. },
  2132. plugins: {},
  2133. ui: function() {
  2134. return {
  2135. originalElement: this.originalElement,
  2136. element: this.element,
  2137. helper: this.helper,
  2138. position: this.position,
  2139. size: this.size,
  2140. originalSize: this.originalSize,
  2141. originalPosition: this.originalPosition
  2142. };
  2143. }
  2144. });
  2145. $.extend($.ui.resizable, {
  2146. version: "1.8.11"
  2147. });
  2148. /*
  2149. * Resizable Extensions
  2150. */
  2151. $.ui.plugin.add("resizable", "alsoResize", {
  2152. start: function (event, ui) {
  2153. var self = $(this).data("resizable"), o = self.options;
  2154. var _store = function (exp) {
  2155. $(exp).each(function() {
  2156. var el = $(this);
  2157. el.data("resizable-alsoresize", {
  2158. width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
  2159. left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
  2160. position: el.css('position') // to reset Opera on stop()
  2161. });
  2162. });
  2163. };
  2164. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
  2165. if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
  2166. else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
  2167. }else{
  2168. _store(o.alsoResize);
  2169. }
  2170. },
  2171. resize: function (event, ui) {
  2172. var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
  2173. var delta = {
  2174. height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
  2175. top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
  2176. },
  2177. _alsoResize = function (exp, c) {
  2178. $(exp).each(function() {
  2179. var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
  2180. css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
  2181. $.each(css, function (i, prop) {
  2182. var sum = (start[prop]||0) + (delta[prop]||0);
  2183. if (sum && sum >= 0)
  2184. style[prop] = sum || null;
  2185. });
  2186. // Opera fixing relative position
  2187. if ($.browser.opera && /relative/.test(el.css('position'))) {
  2188. self._revertToRelativePosition = true;
  2189. el.css({ position: 'absolute', top: 'auto', left: 'auto' });
  2190. }
  2191. el.css(style);
  2192. });
  2193. };
  2194. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  2195. $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
  2196. }else{
  2197. _alsoResize(o.alsoResize);
  2198. }
  2199. },
  2200. stop: function (event, ui) {
  2201. var self = $(this).data("resizable"), o = self.options;
  2202. var _reset = function (exp) {
  2203. $(exp).each(function() {
  2204. var el = $(this);
  2205. // reset position for Opera - no need to verify it was changed
  2206. el.css({ position: el.data("resizable-alsoresize").position });
  2207. });
  2208. };
  2209. if (self._revertToRelativePosition) {
  2210. self._revertToRelativePosition = false;
  2211. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  2212. $.each(o.alsoResize, function (exp) { _reset(exp); });
  2213. }else{
  2214. _reset(o.alsoResize);
  2215. }
  2216. }
  2217. $(this).removeData("resizable-alsoresize");
  2218. }
  2219. });
  2220. $.ui.plugin.add("resizable", "animate", {
  2221. stop: function(event, ui) {
  2222. var self = $(this).data("resizable"), o = self.options;
  2223. var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  2224. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  2225. soffsetw = ista ? 0 : self.sizeDiff.width;
  2226. var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  2227. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  2228. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  2229. self.element.animate(
  2230. $.extend(style, top && left ? { top: top, left: left } : {}), {
  2231. duration: o.animateDuration,
  2232. easing: o.animateEasing,
  2233. step: function() {
  2234. var data = {
  2235. width: parseInt(self.element.css('width'), 10),
  2236. height: parseInt(self.element.css('height'), 10),
  2237. top: parseInt(self.element.css('top'), 10),
  2238. left: parseInt(self.element.css('left'), 10)
  2239. };
  2240. if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
  2241. // propagating resize, and updating values for each animation step
  2242. self._updateCache(data);
  2243. self._propagate("resize", event);
  2244. }
  2245. }
  2246. );
  2247. }
  2248. });
  2249. $.ui.plugin.add("resizable", "containment", {
  2250. start: function(event, ui) {
  2251. var self = $(this).data("resizable"), o = self.options, el = self.element;
  2252. var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
  2253. if (!ce) return;
  2254. self.containerElement = $(ce);
  2255. if (/document/.test(oc) || oc == document) {
  2256. self.containerOffset = { left: 0, top: 0 };
  2257. self.containerPosition = { left: 0, top: 0 };
  2258. self.parentData = {
  2259. element: $(document), left: 0, top: 0,
  2260. width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
  2261. };
  2262. }
  2263. // i'm a node, so compute top, left, right, bottom
  2264. else {
  2265. var element = $(ce), p = [];
  2266. $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
  2267. self.containerOffset = element.offset();
  2268. self.containerPosition = element.position();
  2269. self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
  2270. var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
  2271. width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
  2272. self.parentData = {
  2273. element: ce, left: co.left, top: co.top, width: width, height: height
  2274. };
  2275. }
  2276. },
  2277. resize: function(event, ui) {
  2278. var self = $(this).data("resizable"), o = self.options,
  2279. ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
  2280. pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
  2281. if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
  2282. if (cp.left < (self._helper ? co.left : 0)) {
  2283. self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
  2284. if (pRatio) self.size.height = self.size.width / o.aspectRatio;
  2285. self.position.left = o.helper ? co.left : 0;
  2286. }
  2287. if (cp.top < (self._helper ? co.top : 0)) {
  2288. self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
  2289. if (pRatio) self.size.width = self.size.height * o.aspectRatio;
  2290. self.position.top = self._helper ? co.top : 0;
  2291. }
  2292. self.offset.left = self.parentData.left+self.position.left;
  2293. self.offset.top = self.parentData.top+self.position.top;
  2294. var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
  2295. hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
  2296. var isParent = self.containerElement.get(0) == self.element.parent().get(0),
  2297. isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
  2298. if(isParent && isOffsetRelative) woset -= self.parentData.left;
  2299. if (woset + self.size.width >= self.parentData.width) {
  2300. self.size.width = self.parentData.width - woset;
  2301. if (pRatio) self.size.height = self.size.width / self.aspectRatio;
  2302. }
  2303. if (hoset + self.size.height >= self.parentData.height) {
  2304. self.size.height = self.parentData.height - hoset;
  2305. if (pRatio) self.size.width = self.size.height * self.aspectRatio;
  2306. }
  2307. },
  2308. stop: function(event, ui){
  2309. var self = $(this).data("resizable"), o = self.options, cp = self.position,
  2310. co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
  2311. var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
  2312. if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
  2313. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2314. if (self._helper && !o.animate && (/static/).test(ce.css('position')))
  2315. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2316. }
  2317. });
  2318. $.ui.plugin.add("resizable", "ghost", {
  2319. start: function(event, ui) {
  2320. var self = $(this).data("resizable"), o = self.options, cs = self.size;
  2321. self.ghost = self.originalElement.clone();
  2322. self.ghost
  2323. .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
  2324. .addClass('ui-resizable-ghost')
  2325. .addClass(typeof o.ghost == 'string' ? o.ghost : '');
  2326. self.ghost.appendTo(self.helper);
  2327. },
  2328. resize: function(event, ui){
  2329. var self = $(this).data("resizable"), o = self.options;
  2330. if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
  2331. },
  2332. stop: function(event, ui){
  2333. var self = $(this).data("resizable"), o = self.options;
  2334. if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
  2335. }
  2336. });
  2337. $.ui.plugin.add("resizable", "grid", {
  2338. resize: function(event, ui) {
  2339. 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;
  2340. o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
  2341. 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);
  2342. if (/^(se|s|e)$/.test(a)) {
  2343. self.size.width = os.width + ox;
  2344. self.size.height = os.height + oy;
  2345. }
  2346. else if (/^(ne)$/.test(a)) {
  2347. self.size.width = os.width + ox;
  2348. self.size.height = os.height + oy;
  2349. self.position.top = op.top - oy;
  2350. }
  2351. else if (/^(sw)$/.test(a)) {
  2352. self.size.width = os.width + ox;
  2353. self.size.height = os.height + oy;
  2354. self.position.left = op.left - ox;
  2355. }
  2356. else {
  2357. self.size.width = os.width + ox;
  2358. self.size.height = os.height + oy;
  2359. self.position.top = op.top - oy;
  2360. self.position.left = op.left - ox;
  2361. }
  2362. }
  2363. });
  2364. var num = function(v) {
  2365. return parseInt(v, 10) || 0;
  2366. };
  2367. var isNumber = function(value) {
  2368. return !isNaN(parseInt(value, 10));
  2369. };
  2370. })(jQuery);
  2371. /*
  2372. * Note: While Microsoft is not the author of this file, Microsoft is
  2373. * offering you a license subject to the terms of the Microsoft Software
  2374. * License Terms for Microsoft ASP.NET Model View Controller 3.
  2375. * Microsoft reserves all other rights. The notices below are provided
  2376. * for informational purposes only and are not the license terms under
  2377. * which Microsoft distributed this file.
  2378. *
  2379. * jQuery UI Selectable 1.8.11
  2380. *
  2381. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  2382. *
  2383. * http://docs.jquery.com/UI/Selectables
  2384. *
  2385. * Depends:
  2386. * jquery.ui.core.js
  2387. * jquery.ui.mouse.js
  2388. * jquery.ui.widget.js
  2389. */
  2390. (function( $, undefined ) {
  2391. $.widget("ui.selectable", $.ui.mouse, {
  2392. options: {
  2393. appendTo: 'body',
  2394. autoRefresh: true,
  2395. distance: 0,
  2396. filter: '*',
  2397. tolerance: 'touch'
  2398. },
  2399. _create: function() {
  2400. var self = this;
  2401. this.element.addClass("ui-selectable");
  2402. this.dragged = false;
  2403. // cache selectee children based on filter
  2404. var selectees;
  2405. this.refresh = function() {
  2406. selectees = $(self.options.filter, self.element[0]);
  2407. selectees.each(function() {
  2408. var $this = $(this);
  2409. var pos = $this.offset();
  2410. $.data(this, "selectable-item", {
  2411. element: this,
  2412. $element: $this,
  2413. left: pos.left,
  2414. top: pos.top,
  2415. right: pos.left + $this.outerWidth(),
  2416. bottom: pos.top + $this.outerHeight(),
  2417. startselected: false,
  2418. selected: $this.hasClass('ui-selected'),
  2419. selecting: $this.hasClass('ui-selecting'),
  2420. unselecting: $this.hasClass('ui-unselecting')
  2421. });
  2422. });
  2423. };
  2424. this.refresh();
  2425. this.selectees = selectees.addClass("ui-selectee");
  2426. this._mouseInit();
  2427. this.helper = $("<div class='ui-selectable-helper'></div>");
  2428. },
  2429. destroy: function() {
  2430. this.selectees
  2431. .removeClass("ui-selectee")
  2432. .removeData("selectable-item");
  2433. this.element
  2434. .removeClass("ui-selectable ui-selectable-disabled")
  2435. .removeData("selectable")
  2436. .unbind(".selectable");
  2437. this._mouseDestroy();
  2438. return this;
  2439. },
  2440. _mouseStart: function(event) {
  2441. var self = this;
  2442. this.opos = [event.pageX, event.pageY];
  2443. if (this.options.disabled)
  2444. return;
  2445. var options = this.options;
  2446. this.selectees = $(options.filter, this.element[0]);
  2447. this._trigger("start", event);
  2448. $(options.appendTo).append(this.helper);
  2449. // position helper (lasso)
  2450. this.helper.css({
  2451. "left": event.clientX,
  2452. "top": event.clientY,
  2453. "width": 0,
  2454. "height": 0
  2455. });
  2456. if (options.autoRefresh) {
  2457. this.refresh();
  2458. }
  2459. this.selectees.filter('.ui-selected').each(function() {
  2460. var selectee = $.data(this, "selectable-item");
  2461. selectee.startselected = true;
  2462. if (!event.metaKey) {
  2463. selectee.$element.removeClass('ui-selected');
  2464. selectee.selected = false;
  2465. selectee.$element.addClass('ui-unselecting');
  2466. selectee.unselecting = true;
  2467. // selectable UNSELECTING callback
  2468. self._trigger("unselecting", event, {
  2469. unselecting: selectee.element
  2470. });
  2471. }
  2472. });
  2473. $(event.target).parents().andSelf().each(function() {
  2474. var selectee = $.data(this, "selectable-item");
  2475. if (selectee) {
  2476. var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
  2477. selectee.$element
  2478. .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
  2479. .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
  2480. selectee.unselecting = !doSelect;
  2481. selectee.selecting = doSelect;
  2482. selectee.selected = doSelect;
  2483. // selectable (UN)SELECTING callback
  2484. if (doSelect) {
  2485. self._trigger("selecting", event, {
  2486. selecting: selectee.element
  2487. });
  2488. } else {
  2489. self._trigger("unselecting", event, {
  2490. unselecting: selectee.element
  2491. });
  2492. }
  2493. return false;
  2494. }
  2495. });
  2496. },
  2497. _mouseDrag: function(event) {
  2498. var self = this;
  2499. this.dragged = true;
  2500. if (this.options.disabled)
  2501. return;
  2502. var options = this.options;
  2503. var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
  2504. if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
  2505. if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
  2506. this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
  2507. this.selectees.each(function() {
  2508. var selectee = $.data(this, "selectable-item");
  2509. //prevent helper from being selected if appendTo: selectable
  2510. if (!selectee || selectee.element == self.element[0])
  2511. return;
  2512. var hit = false;
  2513. if (options.tolerance == 'touch') {
  2514. hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  2515. } else if (options.tolerance == 'fit') {
  2516. hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  2517. }
  2518. if (hit) {
  2519. // SELECT
  2520. if (selectee.selected) {
  2521. selectee.$element.removeClass('ui-selected');
  2522. selectee.selected = false;
  2523. }
  2524. if (selectee.unselecting) {
  2525. selectee.$element.removeClass('ui-unselecting');
  2526. selectee.unselecting = false;
  2527. }
  2528. if (!selectee.selecting) {
  2529. selectee.$element.addClass('ui-selecting');
  2530. selectee.selecting = true;
  2531. // selectable SELECTING callback
  2532. self._trigger("selecting", event, {
  2533. selecting: selectee.element
  2534. });
  2535. }
  2536. } else {
  2537. // UNSELECT
  2538. if (selectee.selecting) {
  2539. if (event.metaKey && selectee.startselected) {
  2540. selectee.$element.removeClass('ui-selecting');
  2541. selectee.selecting = false;
  2542. selectee.$element.addClass('ui-selected');
  2543. selectee.selected = true;
  2544. } else {
  2545. selectee.$element.removeClass('ui-selecting');
  2546. selectee.selecting = false;
  2547. if (selectee.startselected) {
  2548. selectee.$element.addClass('ui-unselecting');
  2549. selectee.unselecting = true;
  2550. }
  2551. // selectable UNSELECTING callback
  2552. self._trigger("unselecting", event, {
  2553. unselecting: selectee.element
  2554. });
  2555. }
  2556. }
  2557. if (selectee.selected) {
  2558. if (!event.metaKey && !selectee.startselected) {
  2559. selectee.$element.removeClass('ui-selected');
  2560. selectee.selected = false;
  2561. selectee.$element.addClass('ui-unselecting');
  2562. selectee.unselecting = true;
  2563. // selectable UNSELECTING callback
  2564. self._trigger("unselecting", event, {
  2565. unselecting: selectee.element
  2566. });
  2567. }
  2568. }
  2569. }
  2570. });
  2571. return false;
  2572. },
  2573. _mouseStop: function(event) {
  2574. var self = this;
  2575. this.dragged = false;
  2576. var options = this.options;
  2577. $('.ui-unselecting', this.element[0]).each(function() {
  2578. var selectee = $.data(this, "selectable-item");
  2579. selectee.$element.removeClass('ui-unselecting');
  2580. selectee.unselecting = false;
  2581. selectee.startselected = false;
  2582. self._trigger("unselected", event, {
  2583. unselected: selectee.element
  2584. });
  2585. });
  2586. $('.ui-selecting', this.element[0]).each(function() {
  2587. var selectee = $.data(this, "selectable-item");
  2588. selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
  2589. selectee.selecting = false;
  2590. selectee.selected = true;
  2591. selectee.startselected = true;
  2592. self._trigger("selected", event, {
  2593. selected: selectee.element
  2594. });
  2595. });
  2596. this._trigger("stop", event);
  2597. this.helper.remove();
  2598. return false;
  2599. }
  2600. });
  2601. $.extend($.ui.selectable, {
  2602. version: "1.8.11"
  2603. });
  2604. })(jQuery);
  2605. /*
  2606. * Note: While Microsoft is not the author of this file, Microsoft is
  2607. * offering you a license subject to the terms of the Microsoft Software
  2608. * License Terms for Microsoft ASP.NET Model View Controller 3.
  2609. * Microsoft reserves all other rights. The notices below are provided
  2610. * for informational purposes only and are not the license terms under
  2611. * which Microsoft distributed this file.
  2612. *
  2613. * jQuery UI Sortable 1.8.11
  2614. *
  2615. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  2616. *
  2617. * http://docs.jquery.com/UI/Sortables
  2618. *
  2619. * Depends:
  2620. * jquery.ui.core.js
  2621. * jquery.ui.mouse.js
  2622. * jquery.ui.widget.js
  2623. */
  2624. (function( $, undefined ) {
  2625. $.widget("ui.sortable", $.ui.mouse, {
  2626. widgetEventPrefix: "sort",
  2627. options: {
  2628. appendTo: "parent",
  2629. axis: false,
  2630. connectWith: false,
  2631. containment: false,
  2632. cursor: 'auto',
  2633. cursorAt: false,
  2634. dropOnEmpty: true,
  2635. forcePlaceholderSize: false,
  2636. forceHelperSize: false,
  2637. grid: false,
  2638. handle: false,
  2639. helper: "original",
  2640. items: '> *',
  2641. opacity: false,
  2642. placeholder: false,
  2643. revert: false,
  2644. scroll: true,
  2645. scrollSensitivity: 20,
  2646. scrollSpeed: 20,
  2647. scope: "default",
  2648. tolerance: "intersect",
  2649. zIndex: 1000
  2650. },
  2651. _create: function() {
  2652. var o = this.options;
  2653. this.containerCache = {};
  2654. this.element.addClass("ui-sortable");
  2655. //Get the items
  2656. this.refresh();
  2657. //Let's determine if the items are being displayed horizontally
  2658. this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
  2659. //Let's determine the parent's offset
  2660. this.offset = this.element.offset();
  2661. //Initialize mouse events for interaction
  2662. this._mouseInit();
  2663. },
  2664. destroy: function() {
  2665. this.element
  2666. .removeClass("ui-sortable ui-sortable-disabled")
  2667. .removeData("sortable")
  2668. .unbind(".sortable");
  2669. this._mouseDestroy();
  2670. for ( var i = this.items.length - 1; i >= 0; i-- )
  2671. this.items[i].item.removeData("sortable-item");
  2672. return this;
  2673. },
  2674. _setOption: function(key, value){
  2675. if ( key === "disabled" ) {
  2676. this.options[ key ] = value;
  2677. this.widget()
  2678. [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
  2679. } else {
  2680. // Don't call widget base _setOption for disable as it adds ui-state-disabled class
  2681. $.Widget.prototype._setOption.apply(this, arguments);
  2682. }
  2683. },
  2684. _mouseCapture: function(event, overrideHandle) {
  2685. if (this.reverting) {
  2686. return false;
  2687. }
  2688. if(this.options.disabled || this.options.type == 'static') return false;
  2689. //We have to refresh the items data once first
  2690. this._refreshItems(event);
  2691. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  2692. var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
  2693. if($.data(this, 'sortable-item') == self) {
  2694. currentItem = $(this);
  2695. return false;
  2696. }
  2697. });
  2698. if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
  2699. if(!currentItem) return false;
  2700. if(this.options.handle && !overrideHandle) {
  2701. var validHandle = false;
  2702. $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
  2703. if(!validHandle) return false;
  2704. }
  2705. this.currentItem = currentItem;
  2706. this._removeCurrentsFromItems();
  2707. return true;
  2708. },
  2709. _mouseStart: function(event, overrideHandle, noActivation) {
  2710. var o = this.options, self = this;
  2711. this.currentContainer = this;
  2712. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  2713. this.refreshPositions();
  2714. //Create and append the visible helper
  2715. this.helper = this._createHelper(event);
  2716. //Cache the helper size
  2717. this._cacheHelperProportions();
  2718. /*
  2719. * - Position generation -
  2720. * This block generates everything position related - it's the core of draggables.
  2721. */
  2722. //Cache the margins of the original element
  2723. this._cacheMargins();
  2724. //Get the next scrolling parent
  2725. this.scrollParent = this.helper.scrollParent();
  2726. //The element's absolute position on the page minus margins
  2727. this.offset = this.currentItem.offset();
  2728. this.offset = {
  2729. top: this.offset.top - this.margins.top,
  2730. left: this.offset.left - this.margins.left
  2731. };
  2732. // Only after we got the offset, we can change the helper's position to absolute
  2733. // TODO: Still need to figure out a way to make relative sorting possible
  2734. this.helper.css("position", "absolute");
  2735. this.cssPosition = this.helper.css("position");
  2736. $.extend(this.offset, {
  2737. click: { //Where the click happened, relative to the element
  2738. left: event.pageX - this.offset.left,
  2739. top: event.pageY - this.offset.top
  2740. },
  2741. parent: this._getParentOffset(),
  2742. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  2743. });
  2744. //Generate the original position
  2745. this.originalPosition = this._generatePosition(event);
  2746. this.originalPageX = event.pageX;
  2747. this.originalPageY = event.pageY;
  2748. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  2749. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  2750. //Cache the former DOM position
  2751. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  2752. //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
  2753. if(this.helper[0] != this.currentItem[0]) {
  2754. this.currentItem.hide();
  2755. }
  2756. //Create the placeholder
  2757. this._createPlaceholder();
  2758. //Set a containment if given in the options
  2759. if(o.containment)
  2760. this._setContainment();
  2761. if(o.cursor) { // cursor option
  2762. if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
  2763. $('body').css("cursor", o.cursor);
  2764. }
  2765. if(o.opacity) { // opacity option
  2766. if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
  2767. this.helper.css("opacity", o.opacity);
  2768. }
  2769. if(o.zIndex) { // zIndex option
  2770. if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
  2771. this.helper.css("zIndex", o.zIndex);
  2772. }
  2773. //Prepare scrolling
  2774. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
  2775. this.overflowOffset = this.scrollParent.offset();
  2776. //Call callbacks
  2777. this._trigger("start", event, this._uiHash());
  2778. //Recache the helper size
  2779. if(!this._preserveHelperProportions)
  2780. this._cacheHelperProportions();
  2781. //Post 'activate' events to possible containers
  2782. if(!noActivation) {
  2783. for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
  2784. }
  2785. //Prepare possible droppables
  2786. if($.ui.ddmanager)
  2787. $.ui.ddmanager.current = this;
  2788. if ($.ui.ddmanager && !o.dropBehaviour)
  2789. $.ui.ddmanager.prepareOffsets(this, event);
  2790. this.dragging = true;
  2791. this.helper.addClass("ui-sortable-helper");
  2792. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2793. return true;
  2794. },
  2795. _mouseDrag: function(event) {
  2796. //Compute the helpers position
  2797. this.position = this._generatePosition(event);
  2798. this.positionAbs = this._convertPositionTo("absolute");
  2799. if (!this.lastPositionAbs) {
  2800. this.lastPositionAbs = this.positionAbs;
  2801. }
  2802. //Do scrolling
  2803. if(this.options.scroll) {
  2804. var o = this.options, scrolled = false;
  2805. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
  2806. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  2807. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  2808. else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
  2809. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  2810. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  2811. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  2812. else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
  2813. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  2814. } else {
  2815. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  2816. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2817. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  2818. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2819. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  2820. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2821. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  2822. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2823. }
  2824. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  2825. $.ui.ddmanager.prepareOffsets(this, event);
  2826. }
  2827. //Regenerate the absolute position used for position checks
  2828. this.positionAbs = this._convertPositionTo("absolute");
  2829. //Set the helper position
  2830. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  2831. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  2832. //Rearrange
  2833. for (var i = this.items.length - 1; i >= 0; i--) {
  2834. //Cache variables and intersection, continue if no intersection
  2835. var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
  2836. if (!intersection) continue;
  2837. if(itemElement != this.currentItem[0] //cannot intersect with itself
  2838. && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
  2839. && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
  2840. && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
  2841. //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
  2842. ) {
  2843. this.direction = intersection == 1 ? "down" : "up";
  2844. if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
  2845. this._rearrange(event, item);
  2846. } else {
  2847. break;
  2848. }
  2849. this._trigger("change", event, this._uiHash());
  2850. break;
  2851. }
  2852. }
  2853. //Post events to containers
  2854. this._contactContainers(event);
  2855. //Interconnect with droppables
  2856. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  2857. //Call callbacks
  2858. this._trigger('sort', event, this._uiHash());
  2859. this.lastPositionAbs = this.positionAbs;
  2860. return false;
  2861. },
  2862. _mouseStop: function(event, noPropagation) {
  2863. if(!event) return;
  2864. //If we are using droppables, inform the manager about the drop
  2865. if ($.ui.ddmanager && !this.options.dropBehaviour)
  2866. $.ui.ddmanager.drop(this, event);
  2867. if(this.options.revert) {
  2868. var self = this;
  2869. var cur = self.placeholder.offset();
  2870. self.reverting = true;
  2871. $(this.helper).animate({
  2872. left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
  2873. top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
  2874. }, parseInt(this.options.revert, 10) || 500, function() {
  2875. self._clear(event);
  2876. });
  2877. } else {
  2878. this._clear(event, noPropagation);
  2879. }
  2880. return false;
  2881. },
  2882. cancel: function() {
  2883. var self = this;
  2884. if(this.dragging) {
  2885. this._mouseUp({ target: null });
  2886. if(this.options.helper == "original")
  2887. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  2888. else
  2889. this.currentItem.show();
  2890. //Post deactivating events to containers
  2891. for (var i = this.containers.length - 1; i >= 0; i--){
  2892. this.containers[i]._trigger("deactivate", null, self._uiHash(this));
  2893. if(this.containers[i].containerCache.over) {
  2894. this.containers[i]._trigger("out", null, self._uiHash(this));
  2895. this.containers[i].containerCache.over = 0;
  2896. }
  2897. }
  2898. }
  2899. if (this.placeholder) {
  2900. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  2901. if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  2902. if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
  2903. $.extend(this, {
  2904. helper: null,
  2905. dragging: false,
  2906. reverting: false,
  2907. _noFinalSort: null
  2908. });
  2909. if(this.domPosition.prev) {
  2910. $(this.domPosition.prev).after(this.currentItem);
  2911. } else {
  2912. $(this.domPosition.parent).prepend(this.currentItem);
  2913. }
  2914. }
  2915. return this;
  2916. },
  2917. serialize: function(o) {
  2918. var items = this._getItemsAsjQuery(o && o.connected);
  2919. var str = []; o = o || {};
  2920. $(items).each(function() {
  2921. var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
  2922. if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
  2923. });
  2924. if(!str.length && o.key) {
  2925. str.push(o.key + '=');
  2926. }
  2927. return str.join('&');
  2928. },
  2929. toArray: function(o) {
  2930. var items = this._getItemsAsjQuery(o && o.connected);
  2931. var ret = []; o = o || {};
  2932. items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
  2933. return ret;
  2934. },
  2935. /* Be careful with the following core functions */
  2936. _intersectsWith: function(item) {
  2937. var x1 = this.positionAbs.left,
  2938. x2 = x1 + this.helperProportions.width,
  2939. y1 = this.positionAbs.top,
  2940. y2 = y1 + this.helperProportions.height;
  2941. var l = item.left,
  2942. r = l + item.width,
  2943. t = item.top,
  2944. b = t + item.height;
  2945. var dyClick = this.offset.click.top,
  2946. dxClick = this.offset.click.left;
  2947. var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
  2948. if( this.options.tolerance == "pointer"
  2949. || this.options.forcePointerForContainers
  2950. || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
  2951. ) {
  2952. return isOverElement;
  2953. } else {
  2954. return (l < x1 + (this.helperProportions.width / 2) // Right Half
  2955. && x2 - (this.helperProportions.width / 2) < r // Left Half
  2956. && t < y1 + (this.helperProportions.height / 2) // Bottom Half
  2957. && y2 - (this.helperProportions.height / 2) < b ); // Top Half
  2958. }
  2959. },
  2960. _intersectsWithPointer: function(item) {
  2961. var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  2962. isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  2963. isOverElement = isOverElementHeight && isOverElementWidth,
  2964. verticalDirection = this._getDragVerticalDirection(),
  2965. horizontalDirection = this._getDragHorizontalDirection();
  2966. if (!isOverElement)
  2967. return false;
  2968. return this.floating ?
  2969. ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
  2970. : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
  2971. },
  2972. _intersectsWithSides: function(item) {
  2973. var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  2974. isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  2975. verticalDirection = this._getDragVerticalDirection(),
  2976. horizontalDirection = this._getDragHorizontalDirection();
  2977. if (this.floating && horizontalDirection) {
  2978. return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
  2979. } else {
  2980. return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
  2981. }
  2982. },
  2983. _getDragVerticalDirection: function() {
  2984. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  2985. return delta != 0 && (delta > 0 ? "down" : "up");
  2986. },
  2987. _getDragHorizontalDirection: function() {
  2988. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  2989. return delta != 0 && (delta > 0 ? "right" : "left");
  2990. },
  2991. refresh: function(event) {
  2992. this._refreshItems(event);
  2993. this.refreshPositions();
  2994. return this;
  2995. },
  2996. _connectWith: function() {
  2997. var options = this.options;
  2998. return options.connectWith.constructor == String
  2999. ? [options.connectWith]
  3000. : options.connectWith;
  3001. },
  3002. _getItemsAsjQuery: function(connected) {
  3003. var self = this;
  3004. var items = [];
  3005. var queries = [];
  3006. var connectWith = this._connectWith();
  3007. if(connectWith && connected) {
  3008. for (var i = connectWith.length - 1; i >= 0; i--){
  3009. var cur = $(connectWith[i]);
  3010. for (var j = cur.length - 1; j >= 0; j--){
  3011. var inst = $.data(cur[j], 'sortable');
  3012. if(inst && inst != this && !inst.options.disabled) {
  3013. 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]);
  3014. }
  3015. };
  3016. };
  3017. }
  3018. 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]);
  3019. for (var i = queries.length - 1; i >= 0; i--){
  3020. queries[i][0].each(function() {
  3021. items.push(this);
  3022. });
  3023. };
  3024. return $(items);
  3025. },
  3026. _removeCurrentsFromItems: function() {
  3027. var list = this.currentItem.find(":data(sortable-item)");
  3028. for (var i=0; i < this.items.length; i++) {
  3029. for (var j=0; j < list.length; j++) {
  3030. if(list[j] == this.items[i].item[0])
  3031. this.items.splice(i,1);
  3032. };
  3033. };
  3034. },
  3035. _refreshItems: function(event) {
  3036. this.items = [];
  3037. this.containers = [this];
  3038. var items = this.items;
  3039. var self = this;
  3040. var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
  3041. var connectWith = this._connectWith();
  3042. if(connectWith) {
  3043. for (var i = connectWith.length - 1; i >= 0; i--){
  3044. var cur = $(connectWith[i]);
  3045. for (var j = cur.length - 1; j >= 0; j--){
  3046. var inst = $.data(cur[j], 'sortable');
  3047. if(inst && inst != this && !inst.options.disabled) {
  3048. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  3049. this.containers.push(inst);
  3050. }
  3051. };
  3052. };
  3053. }
  3054. for (var i = queries.length - 1; i >= 0; i--) {
  3055. var targetData = queries[i][1];
  3056. var _queries = queries[i][0];
  3057. for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  3058. var item = $(_queries[j]);
  3059. item.data('sortable-item', targetData); // Data for target checking (mouse manager)
  3060. items.push({
  3061. item: item,
  3062. instance: targetData,
  3063. width: 0, height: 0,
  3064. left: 0, top: 0
  3065. });
  3066. };
  3067. };
  3068. },
  3069. refreshPositions: function(fast) {
  3070. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  3071. if(this.offsetParent && this.helper) {
  3072. this.offset.parent = this._getParentOffset();
  3073. }
  3074. for (var i = this.items.length - 1; i >= 0; i--){
  3075. var item = this.items[i];
  3076. var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  3077. if (!fast) {
  3078. item.width = t.outerWidth();
  3079. item.height = t.outerHeight();
  3080. }
  3081. var p = t.offset();
  3082. item.left = p.left;
  3083. item.top = p.top;
  3084. };
  3085. if(this.options.custom && this.options.custom.refreshContainers) {
  3086. this.options.custom.refreshContainers.call(this);
  3087. } else {
  3088. for (var i = this.containers.length - 1; i >= 0; i--){
  3089. var p = this.containers[i].element.offset();
  3090. this.containers[i].containerCache.left = p.left;
  3091. this.containers[i].containerCache.top = p.top;
  3092. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  3093. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  3094. };
  3095. }
  3096. return this;
  3097. },
  3098. _createPlaceholder: function(that) {
  3099. var self = that || this, o = self.options;
  3100. if(!o.placeholder || o.placeholder.constructor == String) {
  3101. var className = o.placeholder;
  3102. o.placeholder = {
  3103. element: function() {
  3104. var el = $(document.createElement(self.currentItem[0].nodeName))
  3105. .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
  3106. .removeClass("ui-sortable-helper")[0];
  3107. if(!className)
  3108. el.style.visibility = "hidden";
  3109. return el;
  3110. },
  3111. update: function(container, p) {
  3112. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  3113. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  3114. if(className && !o.forcePlaceholderSize) return;
  3115. //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
  3116. if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
  3117. if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
  3118. }
  3119. };
  3120. }
  3121. //Create the placeholder
  3122. self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
  3123. //Append it after the actual current item
  3124. self.currentItem.after(self.placeholder);
  3125. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  3126. o.placeholder.update(self, self.placeholder);
  3127. },
  3128. _contactContainers: function(event) {
  3129. // get innermost container that intersects with item
  3130. var innermostContainer = null, innermostIndex = null;
  3131. for (var i = this.containers.length - 1; i >= 0; i--){
  3132. // never consider a container that's located within the item itself
  3133. if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
  3134. continue;
  3135. if(this._intersectsWith(this.containers[i].containerCache)) {
  3136. // if we've already found a container and it's more "inner" than this, then continue
  3137. if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
  3138. continue;
  3139. innermostContainer = this.containers[i];
  3140. innermostIndex = i;
  3141. } else {
  3142. // container doesn't intersect. trigger "out" event if necessary
  3143. if(this.containers[i].containerCache.over) {
  3144. this.containers[i]._trigger("out", event, this._uiHash(this));
  3145. this.containers[i].containerCache.over = 0;
  3146. }
  3147. }
  3148. }
  3149. // if no intersecting containers found, return
  3150. if(!innermostContainer) return;
  3151. // move the item into the container if it's not there already
  3152. if(this.containers.length === 1) {
  3153. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  3154. this.containers[innermostIndex].containerCache.over = 1;
  3155. } else if(this.currentContainer != this.containers[innermostIndex]) {
  3156. //When entering a new container, we will find the item with the least distance and append our item near it
  3157. var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
  3158. for (var j = this.items.length - 1; j >= 0; j--) {
  3159. if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
  3160. var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
  3161. if(Math.abs(cur - base) < dist) {
  3162. dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
  3163. }
  3164. }
  3165. if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
  3166. return;
  3167. this.currentContainer = this.containers[innermostIndex];
  3168. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  3169. this._trigger("change", event, this._uiHash());
  3170. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  3171. //Update the placeholder
  3172. this.options.placeholder.update(this.currentContainer, this.placeholder);
  3173. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  3174. this.containers[innermostIndex].containerCache.over = 1;
  3175. }
  3176. },
  3177. _createHelper: function(event) {
  3178. var o = this.options;
  3179. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
  3180. if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
  3181. $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  3182. if(helper[0] == this.currentItem[0])
  3183. this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
  3184. if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
  3185. if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
  3186. return helper;
  3187. },
  3188. _adjustOffsetFromHelper: function(obj) {
  3189. if (typeof obj == 'string') {
  3190. obj = obj.split(' ');
  3191. }
  3192. if ($.isArray(obj)) {
  3193. obj = {left: +obj[0], top: +obj[1] || 0};
  3194. }
  3195. if ('left' in obj) {
  3196. this.offset.click.left = obj.left + this.margins.left;
  3197. }
  3198. if ('right' in obj) {
  3199. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  3200. }
  3201. if ('top' in obj) {
  3202. this.offset.click.top = obj.top + this.margins.top;
  3203. }
  3204. if ('bottom' in obj) {
  3205. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  3206. }
  3207. },
  3208. _getParentOffset: function() {
  3209. //Get the offsetParent and cache its position
  3210. this.offsetParent = this.helper.offsetParent();
  3211. var po = this.offsetParent.offset();
  3212. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  3213. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  3214. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  3215. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  3216. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  3217. po.left += this.scrollParent.scrollLeft();
  3218. po.top += this.scrollParent.scrollTop();
  3219. }
  3220. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  3221. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  3222. po = { top: 0, left: 0 };
  3223. return {
  3224. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  3225. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  3226. };
  3227. },
  3228. _getRelativeOffset: function() {
  3229. if(this.cssPosition == "relative") {
  3230. var p = this.currentItem.position();
  3231. return {
  3232. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  3233. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  3234. };
  3235. } else {
  3236. return { top: 0, left: 0 };
  3237. }
  3238. },
  3239. _cacheMargins: function() {
  3240. this.margins = {
  3241. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  3242. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  3243. };
  3244. },
  3245. _cacheHelperProportions: function() {
  3246. this.helperProportions = {
  3247. width: this.helper.outerWidth(),
  3248. height: this.helper.outerHeight()
  3249. };
  3250. },
  3251. _setContainment: function() {
  3252. var o = this.options;
  3253. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  3254. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  3255. 0 - this.offset.relative.left - this.offset.parent.left,
  3256. 0 - this.offset.relative.top - this.offset.parent.top,
  3257. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  3258. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  3259. ];
  3260. if(!(/^(document|window|parent)$/).test(o.containment)) {
  3261. var ce = $(o.containment)[0];
  3262. var co = $(o.containment).offset();
  3263. var over = ($(ce).css("overflow") != 'hidden');
  3264. this.containment = [
  3265. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  3266. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  3267. 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,
  3268. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  3269. ];
  3270. }
  3271. },
  3272. _convertPositionTo: function(d, pos) {
  3273. if(!pos) pos = this.position;
  3274. var mod = d == "absolute" ? 1 : -1;
  3275. 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);
  3276. return {
  3277. top: (
  3278. pos.top // The absolute mouse position
  3279. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3280. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  3281. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  3282. ),
  3283. left: (
  3284. pos.left // The absolute mouse position
  3285. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3286. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  3287. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  3288. )
  3289. };
  3290. },
  3291. _generatePosition: function(event) {
  3292. 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);
  3293. // This is another very weird special case that only happens for relative elements:
  3294. // 1. If the css position is relative
  3295. // 2. and the scroll parent is the document or similar to the offset parent
  3296. // we have to refresh the relative offset during the scroll so there are no jumps
  3297. if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
  3298. this.offset.relative = this._getRelativeOffset();
  3299. }
  3300. var pageX = event.pageX;
  3301. var pageY = event.pageY;
  3302. /*
  3303. * - Position constraining -
  3304. * Constrain the position to a mix of grid, containment.
  3305. */
  3306. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  3307. if(this.containment) {
  3308. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  3309. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  3310. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  3311. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  3312. }
  3313. if(o.grid) {
  3314. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  3315. 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;
  3316. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  3317. 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;
  3318. }
  3319. }
  3320. return {
  3321. top: (
  3322. pageY // The absolute mouse position
  3323. - this.offset.click.top // Click offset (relative to the element)
  3324. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  3325. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  3326. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  3327. ),
  3328. left: (
  3329. pageX // The absolute mouse position
  3330. - this.offset.click.left // Click offset (relative to the element)
  3331. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  3332. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  3333. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  3334. )
  3335. };
  3336. },
  3337. _rearrange: function(event, i, a, hardRefresh) {
  3338. 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));
  3339. //Various things done here to improve the performance:
  3340. // 1. we create a setTimeout, that calls refreshPositions
  3341. // 2. on the instance, we have a counter variable, that get's higher after every append
  3342. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  3343. // 4. this lets only the last addition to the timeout stack through
  3344. this.counter = this.counter ? ++this.counter : 1;
  3345. var self = this, counter = this.counter;
  3346. window.setTimeout(function() {
  3347. if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  3348. },0);
  3349. },
  3350. _clear: function(event, noPropagation) {
  3351. this.reverting = false;
  3352. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  3353. // everything else normalized again
  3354. var delayedTriggers = [], self = this;
  3355. // We first have to update the dom position of the actual currentItem
  3356. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  3357. if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
  3358. this._noFinalSort = null;
  3359. if(this.helper[0] == this.currentItem[0]) {
  3360. for(var i in this._storedCSS) {
  3361. if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
  3362. }
  3363. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  3364. } else {
  3365. this.currentItem.show();
  3366. }
  3367. if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  3368. 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
  3369. if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
  3370. if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  3371. for (var i = this.containers.length - 1; i >= 0; i--){
  3372. if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
  3373. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3374. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3375. }
  3376. };
  3377. };
  3378. //Post events to containers
  3379. for (var i = this.containers.length - 1; i >= 0; i--){
  3380. if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3381. if(this.containers[i].containerCache.over) {
  3382. delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3383. this.containers[i].containerCache.over = 0;
  3384. }
  3385. }
  3386. //Do what was originally in plugins
  3387. if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
  3388. if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
  3389. if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
  3390. this.dragging = false;
  3391. if(this.cancelHelperRemoval) {
  3392. if(!noPropagation) {
  3393. this._trigger("beforeStop", event, this._uiHash());
  3394. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3395. this._trigger("stop", event, this._uiHash());
  3396. }
  3397. return false;
  3398. }
  3399. if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
  3400. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  3401. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  3402. if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
  3403. if(!noPropagation) {
  3404. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3405. this._trigger("stop", event, this._uiHash());
  3406. }
  3407. this.fromOutside = false;
  3408. return true;
  3409. },
  3410. _trigger: function() {
  3411. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  3412. this.cancel();
  3413. }
  3414. },
  3415. _uiHash: function(inst) {
  3416. var self = inst || this;
  3417. return {
  3418. helper: self.helper,
  3419. placeholder: self.placeholder || $([]),
  3420. position: self.position,
  3421. originalPosition: self.originalPosition,
  3422. offset: self.positionAbs,
  3423. item: self.currentItem,
  3424. sender: inst ? inst.element : null
  3425. };
  3426. }
  3427. });
  3428. $.extend($.ui.sortable, {
  3429. version: "1.8.11"
  3430. });
  3431. })(jQuery);
  3432. /*
  3433. * Note: While Microsoft is not the author of this file, Microsoft is
  3434. * offering you a license subject to the terms of the Microsoft Software
  3435. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3436. * Microsoft reserves all other rights. The notices below are provided
  3437. * for informational purposes only and are not the license terms under
  3438. * which Microsoft distributed this file.
  3439. *
  3440. * jQuery UI Accordion 1.8.11
  3441. *
  3442. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  3443. *
  3444. * http://docs.jquery.com/UI/Accordion
  3445. *
  3446. * Depends:
  3447. * jquery.ui.core.js
  3448. * jquery.ui.widget.js
  3449. */
  3450. (function( $, undefined ) {
  3451. $.widget( "ui.accordion", {
  3452. options: {
  3453. active: 0,
  3454. animated: "slide",
  3455. autoHeight: true,
  3456. clearStyle: false,
  3457. collapsible: false,
  3458. event: "click",
  3459. fillSpace: false,
  3460. header: "> li > :first-child,> :not(li):even",
  3461. icons: {
  3462. header: "ui-icon-triangle-1-e",
  3463. headerSelected: "ui-icon-triangle-1-s"
  3464. },
  3465. navigation: false,
  3466. navigationFilter: function() {
  3467. return this.href.toLowerCase() === location.href.toLowerCase();
  3468. }
  3469. },
  3470. _create: function() {
  3471. var self = this,
  3472. options = self.options;
  3473. self.running = 0;
  3474. self.element
  3475. .addClass( "ui-accordion ui-widget ui-helper-reset" )
  3476. // in lack of child-selectors in CSS
  3477. // we need to mark top-LIs in a UL-accordion for some IE-fix
  3478. .children( "li" )
  3479. .addClass( "ui-accordion-li-fix" );
  3480. self.headers = self.element.find( options.header )
  3481. .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
  3482. .bind( "mouseenter.accordion", function() {
  3483. if ( options.disabled ) {
  3484. return;
  3485. }
  3486. $( this ).addClass( "ui-state-hover" );
  3487. })
  3488. .bind( "mouseleave.accordion", function() {
  3489. if ( options.disabled ) {
  3490. return;
  3491. }
  3492. $( this ).removeClass( "ui-state-hover" );
  3493. })
  3494. .bind( "focus.accordion", function() {
  3495. if ( options.disabled ) {
  3496. return;
  3497. }
  3498. $( this ).addClass( "ui-state-focus" );
  3499. })
  3500. .bind( "blur.accordion", function() {
  3501. if ( options.disabled ) {
  3502. return;
  3503. }
  3504. $( this ).removeClass( "ui-state-focus" );
  3505. });
  3506. self.headers.next()
  3507. .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
  3508. if ( options.navigation ) {
  3509. var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
  3510. if ( current.length ) {
  3511. var header = current.closest( ".ui-accordion-header" );
  3512. if ( header.length ) {
  3513. // anchor within header
  3514. self.active = header;
  3515. } else {
  3516. // anchor within content
  3517. self.active = current.closest( ".ui-accordion-content" ).prev();
  3518. }
  3519. }
  3520. }
  3521. self.active = self._findActive( self.active || options.active )
  3522. .addClass( "ui-state-default ui-state-active" )
  3523. .toggleClass( "ui-corner-all" )
  3524. .toggleClass( "ui-corner-top" );
  3525. self.active.next().addClass( "ui-accordion-content-active" );
  3526. self._createIcons();
  3527. self.resize();
  3528. // ARIA
  3529. self.element.attr( "role", "tablist" );
  3530. self.headers
  3531. .attr( "role", "tab" )
  3532. .bind( "keydown.accordion", function( event ) {
  3533. return self._keydown( event );
  3534. })
  3535. .next()
  3536. .attr( "role", "tabpanel" );
  3537. self.headers
  3538. .not( self.active || "" )
  3539. .attr({
  3540. "aria-expanded": "false",
  3541. "aria-selected": "false",
  3542. tabIndex: -1
  3543. })
  3544. .next()
  3545. .hide();
  3546. // make sure at least one header is in the tab order
  3547. if ( !self.active.length ) {
  3548. self.headers.eq( 0 ).attr( "tabIndex", 0 );
  3549. } else {
  3550. self.active
  3551. .attr({
  3552. "aria-expanded": "true",
  3553. "aria-selected": "true",
  3554. tabIndex: 0
  3555. });
  3556. }
  3557. // only need links in tab order for Safari
  3558. if ( !$.browser.safari ) {
  3559. self.headers.find( "a" ).attr( "tabIndex", -1 );
  3560. }
  3561. if ( options.event ) {
  3562. self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
  3563. self._clickHandler.call( self, event, this );
  3564. event.preventDefault();
  3565. });
  3566. }
  3567. },
  3568. _createIcons: function() {
  3569. var options = this.options;
  3570. if ( options.icons ) {
  3571. $( "<span></span>" )
  3572. .addClass( "ui-icon " + options.icons.header )
  3573. .prependTo( this.headers );
  3574. this.active.children( ".ui-icon" )
  3575. .toggleClass(options.icons.header)
  3576. .toggleClass(options.icons.headerSelected);
  3577. this.element.addClass( "ui-accordion-icons" );
  3578. }
  3579. },
  3580. _destroyIcons: function() {
  3581. this.headers.children( ".ui-icon" ).remove();
  3582. this.element.removeClass( "ui-accordion-icons" );
  3583. },
  3584. destroy: function() {
  3585. var options = this.options;
  3586. this.element
  3587. .removeClass( "ui-accordion ui-widget ui-helper-reset" )
  3588. .removeAttr( "role" );
  3589. this.headers
  3590. .unbind( ".accordion" )
  3591. .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" )
  3592. .removeAttr( "role" )
  3593. .removeAttr( "aria-expanded" )
  3594. .removeAttr( "aria-selected" )
  3595. .removeAttr( "tabIndex" );
  3596. this.headers.find( "a" ).removeAttr( "tabIndex" );
  3597. this._destroyIcons();
  3598. var contents = this.headers.next()
  3599. .css( "display", "" )
  3600. .removeAttr( "role" )
  3601. .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
  3602. if ( options.autoHeight || options.fillHeight ) {
  3603. contents.css( "height", "" );
  3604. }
  3605. return $.Widget.prototype.destroy.call( this );
  3606. },
  3607. _setOption: function( key, value ) {
  3608. $.Widget.prototype._setOption.apply( this, arguments );
  3609. if ( key == "active" ) {
  3610. this.activate( value );
  3611. }
  3612. if ( key == "icons" ) {
  3613. this._destroyIcons();
  3614. if ( value ) {
  3615. this._createIcons();
  3616. }
  3617. }
  3618. // #5332 - opacity doesn't cascade to positioned elements in IE
  3619. // so we need to add the disabled class to the headers and panels
  3620. if ( key == "disabled" ) {
  3621. this.headers.add(this.headers.next())
  3622. [ value ? "addClass" : "removeClass" ](
  3623. "ui-accordion-disabled ui-state-disabled" );
  3624. }
  3625. },
  3626. _keydown: function( event ) {
  3627. if ( this.options.disabled || event.altKey || event.ctrlKey ) {
  3628. return;
  3629. }
  3630. var keyCode = $.ui.keyCode,
  3631. length = this.headers.length,
  3632. currentIndex = this.headers.index( event.target ),
  3633. toFocus = false;
  3634. switch ( event.keyCode ) {
  3635. case keyCode.RIGHT:
  3636. case keyCode.DOWN:
  3637. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  3638. break;
  3639. case keyCode.LEFT:
  3640. case keyCode.UP:
  3641. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  3642. break;
  3643. case keyCode.SPACE:
  3644. case keyCode.ENTER:
  3645. this._clickHandler( { target: event.target }, event.target );
  3646. event.preventDefault();
  3647. }
  3648. if ( toFocus ) {
  3649. $( event.target ).attr( "tabIndex", -1 );
  3650. $( toFocus ).attr( "tabIndex", 0 );
  3651. toFocus.focus();
  3652. return false;
  3653. }
  3654. return true;
  3655. },
  3656. resize: function() {
  3657. var options = this.options,
  3658. maxHeight;
  3659. if ( options.fillSpace ) {
  3660. if ( $.browser.msie ) {
  3661. var defOverflow = this.element.parent().css( "overflow" );
  3662. this.element.parent().css( "overflow", "hidden");
  3663. }
  3664. maxHeight = this.element.parent().height();
  3665. if ($.browser.msie) {
  3666. this.element.parent().css( "overflow", defOverflow );
  3667. }
  3668. this.headers.each(function() {
  3669. maxHeight -= $( this ).outerHeight( true );
  3670. });
  3671. this.headers.next()
  3672. .each(function() {
  3673. $( this ).height( Math.max( 0, maxHeight -
  3674. $( this ).innerHeight() + $( this ).height() ) );
  3675. })
  3676. .css( "overflow", "auto" );
  3677. } else if ( options.autoHeight ) {
  3678. maxHeight = 0;
  3679. this.headers.next()
  3680. .each(function() {
  3681. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  3682. })
  3683. .height( maxHeight );
  3684. }
  3685. return this;
  3686. },
  3687. activate: function( index ) {
  3688. // TODO this gets called on init, changing the option without an explicit call for that
  3689. this.options.active = index;
  3690. // call clickHandler with custom event
  3691. var active = this._findActive( index )[ 0 ];
  3692. this._clickHandler( { target: active }, active );
  3693. return this;
  3694. },
  3695. _findActive: function( selector ) {
  3696. return selector
  3697. ? typeof selector === "number"
  3698. ? this.headers.filter( ":eq(" + selector + ")" )
  3699. : this.headers.not( this.headers.not( selector ) )
  3700. : selector === false
  3701. ? $( [] )
  3702. : this.headers.filter( ":eq(0)" );
  3703. },
  3704. // TODO isn't event.target enough? why the separate target argument?
  3705. _clickHandler: function( event, target ) {
  3706. var options = this.options;
  3707. if ( options.disabled ) {
  3708. return;
  3709. }
  3710. // called only when using activate(false) to close all parts programmatically
  3711. if ( !event.target ) {
  3712. if ( !options.collapsible ) {
  3713. return;
  3714. }
  3715. this.active
  3716. .removeClass( "ui-state-active ui-corner-top" )
  3717. .addClass( "ui-state-default ui-corner-all" )
  3718. .children( ".ui-icon" )
  3719. .removeClass( options.icons.headerSelected )
  3720. .addClass( options.icons.header );
  3721. this.active.next().addClass( "ui-accordion-content-active" );
  3722. var toHide = this.active.next(),
  3723. data = {
  3724. options: options,
  3725. newHeader: $( [] ),
  3726. oldHeader: options.active,
  3727. newContent: $( [] ),
  3728. oldContent: toHide
  3729. },
  3730. toShow = ( this.active = $( [] ) );
  3731. this._toggle( toShow, toHide, data );
  3732. return;
  3733. }
  3734. // get the click target
  3735. var clicked = $( event.currentTarget || target ),
  3736. clickedIsActive = clicked[0] === this.active[0];
  3737. // TODO the option is changed, is that correct?
  3738. // TODO if it is correct, shouldn't that happen after determining that the click is valid?
  3739. options.active = options.collapsible && clickedIsActive ?
  3740. false :
  3741. this.headers.index( clicked );
  3742. // if animations are still active, or the active header is the target, ignore click
  3743. if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
  3744. return;
  3745. }
  3746. // find elements to show and hide
  3747. var active = this.active,
  3748. toShow = clicked.next(),
  3749. toHide = this.active.next(),
  3750. data = {
  3751. options: options,
  3752. newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
  3753. oldHeader: this.active,
  3754. newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
  3755. oldContent: toHide
  3756. },
  3757. down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
  3758. // when the call to ._toggle() comes after the class changes
  3759. // it causes a very odd bug in IE 8 (see #6720)
  3760. this.active = clickedIsActive ? $([]) : clicked;
  3761. this._toggle( toShow, toHide, data, clickedIsActive, down );
  3762. // switch classes
  3763. active
  3764. .removeClass( "ui-state-active ui-corner-top" )
  3765. .addClass( "ui-state-default ui-corner-all" )
  3766. .children( ".ui-icon" )
  3767. .removeClass( options.icons.headerSelected )
  3768. .addClass( options.icons.header );
  3769. if ( !clickedIsActive ) {
  3770. clicked
  3771. .removeClass( "ui-state-default ui-corner-all" )
  3772. .addClass( "ui-state-active ui-corner-top" )
  3773. .children( ".ui-icon" )
  3774. .removeClass( options.icons.header )
  3775. .addClass( options.icons.headerSelected );
  3776. clicked
  3777. .next()
  3778. .addClass( "ui-accordion-content-active" );
  3779. }
  3780. return;
  3781. },
  3782. _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
  3783. var self = this,
  3784. options = self.options;
  3785. self.toShow = toShow;
  3786. self.toHide = toHide;
  3787. self.data = data;
  3788. var complete = function() {
  3789. if ( !self ) {
  3790. return;
  3791. }
  3792. return self._completed.apply( self, arguments );
  3793. };
  3794. // trigger changestart event
  3795. self._trigger( "changestart", null, self.data );
  3796. // count elements to animate
  3797. self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
  3798. if ( options.animated ) {
  3799. var animOptions = {};
  3800. if ( options.collapsible && clickedIsActive ) {
  3801. animOptions = {
  3802. toShow: $( [] ),
  3803. toHide: toHide,
  3804. complete: complete,
  3805. down: down,
  3806. autoHeight: options.autoHeight || options.fillSpace
  3807. };
  3808. } else {
  3809. animOptions = {
  3810. toShow: toShow,
  3811. toHide: toHide,
  3812. complete: complete,
  3813. down: down,
  3814. autoHeight: options.autoHeight || options.fillSpace
  3815. };
  3816. }
  3817. if ( !options.proxied ) {
  3818. options.proxied = options.animated;
  3819. }
  3820. if ( !options.proxiedDuration ) {
  3821. options.proxiedDuration = options.duration;
  3822. }
  3823. options.animated = $.isFunction( options.proxied ) ?
  3824. options.proxied( animOptions ) :
  3825. options.proxied;
  3826. options.duration = $.isFunction( options.proxiedDuration ) ?
  3827. options.proxiedDuration( animOptions ) :
  3828. options.proxiedDuration;
  3829. var animations = $.ui.accordion.animations,
  3830. duration = options.duration,
  3831. easing = options.animated;
  3832. if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
  3833. easing = "slide";
  3834. }
  3835. if ( !animations[ easing ] ) {
  3836. animations[ easing ] = function( options ) {
  3837. this.slide( options, {
  3838. easing: easing,
  3839. duration: duration || 700
  3840. });
  3841. };
  3842. }
  3843. animations[ easing ]( animOptions );
  3844. } else {
  3845. if ( options.collapsible && clickedIsActive ) {
  3846. toShow.toggle();
  3847. } else {
  3848. toHide.hide();
  3849. toShow.show();
  3850. }
  3851. complete( true );
  3852. }
  3853. // TODO assert that the blur and focus triggers are really necessary, remove otherwise
  3854. toHide.prev()
  3855. .attr({
  3856. "aria-expanded": "false",
  3857. "aria-selected": "false",
  3858. tabIndex: -1
  3859. })
  3860. .blur();
  3861. toShow.prev()
  3862. .attr({
  3863. "aria-expanded": "true",
  3864. "aria-selected": "true",
  3865. tabIndex: 0
  3866. })
  3867. .focus();
  3868. },
  3869. _completed: function( cancel ) {
  3870. this.running = cancel ? 0 : --this.running;
  3871. if ( this.running ) {
  3872. return;
  3873. }
  3874. if ( this.options.clearStyle ) {
  3875. this.toShow.add( this.toHide ).css({
  3876. height: "",
  3877. overflow: ""
  3878. });
  3879. }
  3880. // other classes are removed before the animation; this one needs to stay until completed
  3881. this.toHide.removeClass( "ui-accordion-content-active" );
  3882. // Work around for rendering bug in IE (#5421)
  3883. if ( this.toHide.length ) {
  3884. this.toHide.parent()[0].className = this.toHide.parent()[0].className;
  3885. }
  3886. this._trigger( "change", null, this.data );
  3887. }
  3888. });
  3889. $.extend( $.ui.accordion, {
  3890. version: "1.8.11",
  3891. animations: {
  3892. slide: function( options, additions ) {
  3893. options = $.extend({
  3894. easing: "swing",
  3895. duration: 300
  3896. }, options, additions );
  3897. if ( !options.toHide.size() ) {
  3898. options.toShow.animate({
  3899. height: "show",
  3900. paddingTop: "show",
  3901. paddingBottom: "show"
  3902. }, options );
  3903. return;
  3904. }
  3905. if ( !options.toShow.size() ) {
  3906. options.toHide.animate({
  3907. height: "hide",
  3908. paddingTop: "hide",
  3909. paddingBottom: "hide"
  3910. }, options );
  3911. return;
  3912. }
  3913. var overflow = options.toShow.css( "overflow" ),
  3914. percentDone = 0,
  3915. showProps = {},
  3916. hideProps = {},
  3917. fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
  3918. originalWidth;
  3919. // fix width before calculating height of hidden element
  3920. var s = options.toShow;
  3921. originalWidth = s[0].style.width;
  3922. s.width( parseInt( s.parent().width(), 10 )
  3923. - parseInt( s.css( "paddingLeft" ), 10 )
  3924. - parseInt( s.css( "paddingRight" ), 10 )
  3925. - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
  3926. - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
  3927. $.each( fxAttrs, function( i, prop ) {
  3928. hideProps[ prop ] = "hide";
  3929. var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
  3930. showProps[ prop ] = {
  3931. value: parts[ 1 ],
  3932. unit: parts[ 2 ] || "px"
  3933. };
  3934. });
  3935. options.toShow.css({ height: 0, overflow: "hidden" }).show();
  3936. options.toHide
  3937. .filter( ":hidden" )
  3938. .each( options.complete )
  3939. .end()
  3940. .filter( ":visible" )
  3941. .animate( hideProps, {
  3942. step: function( now, settings ) {
  3943. // only calculate the percent when animating height
  3944. // IE gets very inconsistent results when animating elements
  3945. // with small values, which is common for padding
  3946. if ( settings.prop == "height" ) {
  3947. percentDone = ( settings.end - settings.start === 0 ) ? 0 :
  3948. ( settings.now - settings.start ) / ( settings.end - settings.start );
  3949. }
  3950. options.toShow[ 0 ].style[ settings.prop ] =
  3951. ( percentDone * showProps[ settings.prop ].value )
  3952. + showProps[ settings.prop ].unit;
  3953. },
  3954. duration: options.duration,
  3955. easing: options.easing,
  3956. complete: function() {
  3957. if ( !options.autoHeight ) {
  3958. options.toShow.css( "height", "" );
  3959. }
  3960. options.toShow.css({
  3961. width: originalWidth,
  3962. overflow: overflow
  3963. });
  3964. options.complete();
  3965. }
  3966. });
  3967. },
  3968. bounceslide: function( options ) {
  3969. this.slide( options, {
  3970. easing: options.down ? "easeOutBounce" : "swing",
  3971. duration: options.down ? 1000 : 200
  3972. });
  3973. }
  3974. }
  3975. });
  3976. })( jQuery );
  3977. /*
  3978. * Note: While Microsoft is not the author of this file, Microsoft is
  3979. * offering you a license subject to the terms of the Microsoft Software
  3980. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3981. * Microsoft reserves all other rights. The notices below are provided
  3982. * for informational purposes only and are not the license terms under
  3983. * which Microsoft distributed this file.
  3984. *
  3985. * jQuery UI Autocomplete 1.8.11
  3986. *
  3987. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  3988. *
  3989. * http://docs.jquery.com/UI/Autocomplete
  3990. *
  3991. * Depends:
  3992. * jquery.ui.core.js
  3993. * jquery.ui.widget.js
  3994. * jquery.ui.position.js
  3995. */
  3996. (function( $, undefined ) {
  3997. // used to prevent race conditions with remote data sources
  3998. var requestIndex = 0;
  3999. $.widget( "ui.autocomplete", {
  4000. options: {
  4001. appendTo: "body",
  4002. autoFocus: false,
  4003. delay: 300,
  4004. minLength: 1,
  4005. position: {
  4006. my: "left top",
  4007. at: "left bottom",
  4008. collision: "none"
  4009. },
  4010. source: null
  4011. },
  4012. pending: 0,
  4013. _create: function() {
  4014. var self = this,
  4015. doc = this.element[ 0 ].ownerDocument,
  4016. suppressKeyPress;
  4017. this.element
  4018. .addClass( "ui-autocomplete-input" )
  4019. .attr( "autocomplete", "off" )
  4020. // TODO verify these actually work as intended
  4021. .attr({
  4022. role: "textbox",
  4023. "aria-autocomplete": "list",
  4024. "aria-haspopup": "true"
  4025. })
  4026. .bind( "keydown.autocomplete", function( event ) {
  4027. if ( self.options.disabled || self.element.attr( "readonly" ) ) {
  4028. return;
  4029. }
  4030. suppressKeyPress = false;
  4031. var keyCode = $.ui.keyCode;
  4032. switch( event.keyCode ) {
  4033. case keyCode.PAGE_UP:
  4034. self._move( "previousPage", event );
  4035. break;
  4036. case keyCode.PAGE_DOWN:
  4037. self._move( "nextPage", event );
  4038. break;
  4039. case keyCode.UP:
  4040. self._move( "previous", event );
  4041. // prevent moving cursor to beginning of text field in some browsers
  4042. event.preventDefault();
  4043. break;
  4044. case keyCode.DOWN:
  4045. self._move( "next", event );
  4046. // prevent moving cursor to end of text field in some browsers
  4047. event.preventDefault();
  4048. break;
  4049. case keyCode.ENTER:
  4050. case keyCode.NUMPAD_ENTER:
  4051. // when menu is open and has focus
  4052. if ( self.menu.active ) {
  4053. // #6055 - Opera still allows the keypress to occur
  4054. // which causes forms to submit
  4055. suppressKeyPress = true;
  4056. event.preventDefault();
  4057. }
  4058. //passthrough - ENTER and TAB both select the current element
  4059. case keyCode.TAB:
  4060. if ( !self.menu.active ) {
  4061. return;
  4062. }
  4063. self.menu.select( event );
  4064. break;
  4065. case keyCode.ESCAPE:
  4066. self.element.val( self.term );
  4067. self.close( event );
  4068. break;
  4069. default:
  4070. // keypress is triggered before the input value is changed
  4071. clearTimeout( self.searching );
  4072. self.searching = setTimeout(function() {
  4073. // only search if the value has changed
  4074. if ( self.term != self.element.val() ) {
  4075. self.selectedItem = null;
  4076. self.search( null, event );
  4077. }
  4078. }, self.options.delay );
  4079. break;
  4080. }
  4081. })
  4082. .bind( "keypress.autocomplete", function( event ) {
  4083. if ( suppressKeyPress ) {
  4084. suppressKeyPress = false;
  4085. event.preventDefault();
  4086. }
  4087. })
  4088. .bind( "focus.autocomplete", function() {
  4089. if ( self.options.disabled ) {
  4090. return;
  4091. }
  4092. self.selectedItem = null;
  4093. self.previous = self.element.val();
  4094. })
  4095. .bind( "blur.autocomplete", function( event ) {
  4096. if ( self.options.disabled ) {
  4097. return;
  4098. }
  4099. clearTimeout( self.searching );
  4100. // clicks on the menu (or a button to trigger a search) will cause a blur event
  4101. self.closing = setTimeout(function() {
  4102. self.close( event );
  4103. self._change( event );
  4104. }, 150 );
  4105. });
  4106. this._initSource();
  4107. this.response = function() {
  4108. return self._response.apply( self, arguments );
  4109. };
  4110. this.menu = $( "<ul></ul>" )
  4111. .addClass( "ui-autocomplete" )
  4112. .appendTo( $( this.options.appendTo || "body", doc )[0] )
  4113. // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
  4114. .mousedown(function( event ) {
  4115. // clicking on the scrollbar causes focus to shift to the body
  4116. // but we can't detect a mouseup or a click immediately afterward
  4117. // so we have to track the next mousedown and close the menu if
  4118. // the user clicks somewhere outside of the autocomplete
  4119. var menuElement = self.menu.element[ 0 ];
  4120. if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  4121. setTimeout(function() {
  4122. $( document ).one( 'mousedown', function( event ) {
  4123. if ( event.target !== self.element[ 0 ] &&
  4124. event.target !== menuElement &&
  4125. !$.ui.contains( menuElement, event.target ) ) {
  4126. self.close();
  4127. }
  4128. });
  4129. }, 1 );
  4130. }
  4131. // use another timeout to make sure the blur-event-handler on the input was already triggered
  4132. setTimeout(function() {
  4133. clearTimeout( self.closing );
  4134. }, 13);
  4135. })
  4136. .menu({
  4137. focus: function( event, ui ) {
  4138. var item = ui.item.data( "item.autocomplete" );
  4139. if ( false !== self._trigger( "focus", event, { item: item } ) ) {
  4140. // use value to match what will end up in the input, if it was a key event
  4141. if ( /^key/.test(event.originalEvent.type) ) {
  4142. self.element.val( item.value );
  4143. }
  4144. }
  4145. },
  4146. selected: function( event, ui ) {
  4147. var item = ui.item.data( "item.autocomplete" ),
  4148. previous = self.previous;
  4149. // only trigger when focus was lost (click on menu)
  4150. if ( self.element[0] !== doc.activeElement ) {
  4151. self.element.focus();
  4152. self.previous = previous;
  4153. // #6109 - IE triggers two focus events and the second
  4154. // is asynchronous, so we need to reset the previous
  4155. // term synchronously and asynchronously :-(
  4156. setTimeout(function() {
  4157. self.previous = previous;
  4158. self.selectedItem = item;
  4159. }, 1);
  4160. }
  4161. if ( false !== self._trigger( "select", event, { item: item } ) ) {
  4162. self.element.val( item.value );
  4163. }
  4164. // reset the term after the select event
  4165. // this allows custom select handling to work properly
  4166. self.term = self.element.val();
  4167. self.close( event );
  4168. self.selectedItem = item;
  4169. },
  4170. blur: function( event, ui ) {
  4171. // don't set the value of the text field if it's already correct
  4172. // this prevents moving the cursor unnecessarily
  4173. if ( self.menu.element.is(":visible") &&
  4174. ( self.element.val() !== self.term ) ) {
  4175. self.element.val( self.term );
  4176. }
  4177. }
  4178. })
  4179. .zIndex( this.element.zIndex() + 1 )
  4180. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  4181. .css({ top: 0, left: 0 })
  4182. .hide()
  4183. .data( "menu" );
  4184. if ( $.fn.bgiframe ) {
  4185. this.menu.element.bgiframe();
  4186. }
  4187. },
  4188. destroy: function() {
  4189. this.element
  4190. .removeClass( "ui-autocomplete-input" )
  4191. .removeAttr( "autocomplete" )
  4192. .removeAttr( "role" )
  4193. .removeAttr( "aria-autocomplete" )
  4194. .removeAttr( "aria-haspopup" );
  4195. this.menu.element.remove();
  4196. $.Widget.prototype.destroy.call( this );
  4197. },
  4198. _setOption: function( key, value ) {
  4199. $.Widget.prototype._setOption.apply( this, arguments );
  4200. if ( key === "source" ) {
  4201. this._initSource();
  4202. }
  4203. if ( key === "appendTo" ) {
  4204. this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
  4205. }
  4206. if ( key === "disabled" && value && this.xhr ) {
  4207. this.xhr.abort();
  4208. }
  4209. },
  4210. _initSource: function() {
  4211. var self = this,
  4212. array,
  4213. url;
  4214. if ( $.isArray(this.options.source) ) {
  4215. array = this.options.source;
  4216. this.source = function( request, response ) {
  4217. response( $.ui.autocomplete.filter(array, request.term) );
  4218. };
  4219. } else if ( typeof this.options.source === "string" ) {
  4220. url = this.options.source;
  4221. this.source = function( request, response ) {
  4222. if ( self.xhr ) {
  4223. self.xhr.abort();
  4224. }
  4225. self.xhr = $.ajax({
  4226. url: url,
  4227. data: request,
  4228. dataType: "json",
  4229. autocompleteRequest: ++requestIndex,
  4230. success: function( data, status ) {
  4231. if ( this.autocompleteRequest === requestIndex ) {
  4232. response( data );
  4233. }
  4234. },
  4235. error: function() {
  4236. if ( this.autocompleteRequest === requestIndex ) {
  4237. response( [] );
  4238. }
  4239. }
  4240. });
  4241. };
  4242. } else {
  4243. this.source = this.options.source;
  4244. }
  4245. },
  4246. search: function( value, event ) {
  4247. value = value != null ? value : this.element.val();
  4248. // always save the actual value, not the one passed as an argument
  4249. this.term = this.element.val();
  4250. if ( value.length < this.options.minLength ) {
  4251. return this.close( event );
  4252. }
  4253. clearTimeout( this.closing );
  4254. if ( this._trigger( "search", event ) === false ) {
  4255. return;
  4256. }
  4257. return this._search( value );
  4258. },
  4259. _search: function( value ) {
  4260. this.pending++;
  4261. this.element.addClass( "ui-autocomplete-loading" );
  4262. this.source( { term: value }, this.response );
  4263. },
  4264. _response: function( content ) {
  4265. if ( !this.options.disabled && content && content.length ) {
  4266. content = this._normalize( content );
  4267. this._suggest( content );
  4268. this._trigger( "open" );
  4269. } else {
  4270. this.close();
  4271. }
  4272. this.pending--;
  4273. if ( !this.pending ) {
  4274. this.element.removeClass( "ui-autocomplete-loading" );
  4275. }
  4276. },
  4277. close: function( event ) {
  4278. clearTimeout( this.closing );
  4279. if ( this.menu.element.is(":visible") ) {
  4280. this.menu.element.hide();
  4281. this.menu.deactivate();
  4282. this._trigger( "close", event );
  4283. }
  4284. },
  4285. _change: function( event ) {
  4286. if ( this.previous !== this.element.val() ) {
  4287. this._trigger( "change", event, { item: this.selectedItem } );
  4288. }
  4289. },
  4290. _normalize: function( items ) {
  4291. // assume all items have the right format when the first item is complete
  4292. if ( items.length && items[0].label && items[0].value ) {
  4293. return items;
  4294. }
  4295. return $.map( items, function(item) {
  4296. if ( typeof item === "string" ) {
  4297. return {
  4298. label: item,
  4299. value: item
  4300. };
  4301. }
  4302. return $.extend({
  4303. label: item.label || item.value,
  4304. value: item.value || item.label
  4305. }, item );
  4306. });
  4307. },
  4308. _suggest: function( items ) {
  4309. var ul = this.menu.element
  4310. .empty()
  4311. .zIndex( this.element.zIndex() + 1 );
  4312. this._renderMenu( ul, items );
  4313. // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
  4314. this.menu.deactivate();
  4315. this.menu.refresh();
  4316. // size and position menu
  4317. ul.show();
  4318. this._resizeMenu();
  4319. ul.position( $.extend({
  4320. of: this.element
  4321. }, this.options.position ));
  4322. if ( this.options.autoFocus ) {
  4323. this.menu.next( new $.Event("mouseover") );
  4324. }
  4325. },
  4326. _resizeMenu: function() {
  4327. var ul = this.menu.element;
  4328. ul.outerWidth( Math.max(
  4329. ul.width( "" ).outerWidth(),
  4330. this.element.outerWidth()
  4331. ) );
  4332. },
  4333. _renderMenu: function( ul, items ) {
  4334. var self = this;
  4335. $.each( items, function( index, item ) {
  4336. self._renderItem( ul, item );
  4337. });
  4338. },
  4339. _renderItem: function( ul, item) {
  4340. return $( "<li></li>" )
  4341. .data( "item.autocomplete", item )
  4342. .append( $( "<a></a>" ).text( item.label ) )
  4343. .appendTo( ul );
  4344. },
  4345. _move: function( direction, event ) {
  4346. if ( !this.menu.element.is(":visible") ) {
  4347. this.search( null, event );
  4348. return;
  4349. }
  4350. if ( this.menu.first() && /^previous/.test(direction) ||
  4351. this.menu.last() && /^next/.test(direction) ) {
  4352. this.element.val( this.term );
  4353. this.menu.deactivate();
  4354. return;
  4355. }
  4356. this.menu[ direction ]( event );
  4357. },
  4358. widget: function() {
  4359. return this.menu.element;
  4360. }
  4361. });
  4362. $.extend( $.ui.autocomplete, {
  4363. escapeRegex: function( value ) {
  4364. return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  4365. },
  4366. filter: function(array, term) {
  4367. var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
  4368. return $.grep( array, function(value) {
  4369. return matcher.test( value.label || value.value || value );
  4370. });
  4371. }
  4372. });
  4373. }( jQuery ));
  4374. /*
  4375. * Note: While Microsoft is not the author of this file, Microsoft is
  4376. * offering you a license subject to the terms of the Microsoft Software
  4377. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4378. * Microsoft reserves all other rights. The notices below are provided
  4379. * for informational purposes only and are not the license terms under
  4380. * which Microsoft distributed this file.
  4381. *
  4382. * jQuery UI Menu (not officially released)
  4383. *
  4384. * This widget isn't yet finished and the API is subject to change. We plan to finish
  4385. * it for the next release. You're welcome to give it a try anyway and give us feedback,
  4386. * as long as you're okay with migrating your code later on. We can help with that, too.
  4387. *
  4388. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4389. *
  4390. * http://docs.jquery.com/UI/Menu
  4391. *
  4392. * Depends:
  4393. * jquery.ui.core.js
  4394. * jquery.ui.widget.js
  4395. */
  4396. (function($) {
  4397. $.widget("ui.menu", {
  4398. _create: function() {
  4399. var self = this;
  4400. this.element
  4401. .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
  4402. .attr({
  4403. role: "listbox",
  4404. "aria-activedescendant": "ui-active-menuitem"
  4405. })
  4406. .click(function( event ) {
  4407. if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
  4408. return;
  4409. }
  4410. // temporary
  4411. event.preventDefault();
  4412. self.select( event );
  4413. });
  4414. this.refresh();
  4415. },
  4416. refresh: function() {
  4417. var self = this;
  4418. // don't refresh list items that are already adapted
  4419. var items = this.element.children("li:not(.ui-menu-item):has(a)")
  4420. .addClass("ui-menu-item")
  4421. .attr("role", "menuitem");
  4422. items.children("a")
  4423. .addClass("ui-corner-all")
  4424. .attr("tabindex", -1)
  4425. // mouseenter doesn't work with event delegation
  4426. .mouseenter(function( event ) {
  4427. self.activate( event, $(this).parent() );
  4428. })
  4429. .mouseleave(function() {
  4430. self.deactivate();
  4431. });
  4432. },
  4433. activate: function( event, item ) {
  4434. this.deactivate();
  4435. if (this.hasScroll()) {
  4436. var offset = item.offset().top - this.element.offset().top,
  4437. scroll = this.element.attr("scrollTop"),
  4438. elementHeight = this.element.height();
  4439. if (offset < 0) {
  4440. this.element.attr("scrollTop", scroll + offset);
  4441. } else if (offset >= elementHeight) {
  4442. this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
  4443. }
  4444. }
  4445. this.active = item.eq(0)
  4446. .children("a")
  4447. .addClass("ui-state-hover")
  4448. .attr("id", "ui-active-menuitem")
  4449. .end();
  4450. this._trigger("focus", event, { item: item });
  4451. },
  4452. deactivate: function() {
  4453. if (!this.active) { return; }
  4454. this.active.children("a")
  4455. .removeClass("ui-state-hover")
  4456. .removeAttr("id");
  4457. this._trigger("blur");
  4458. this.active = null;
  4459. },
  4460. next: function(event) {
  4461. this.move("next", ".ui-menu-item:first", event);
  4462. },
  4463. previous: function(event) {
  4464. this.move("prev", ".ui-menu-item:last", event);
  4465. },
  4466. first: function() {
  4467. return this.active && !this.active.prevAll(".ui-menu-item").length;
  4468. },
  4469. last: function() {
  4470. return this.active && !this.active.nextAll(".ui-menu-item").length;
  4471. },
  4472. move: function(direction, edge, event) {
  4473. if (!this.active) {
  4474. this.activate(event, this.element.children(edge));
  4475. return;
  4476. }
  4477. var next = this.active[direction + "All"](".ui-menu-item").eq(0);
  4478. if (next.length) {
  4479. this.activate(event, next);
  4480. } else {
  4481. this.activate(event, this.element.children(edge));
  4482. }
  4483. },
  4484. // TODO merge with previousPage
  4485. nextPage: function(event) {
  4486. if (this.hasScroll()) {
  4487. // TODO merge with no-scroll-else
  4488. if (!this.active || this.last()) {
  4489. this.activate(event, this.element.children(".ui-menu-item:first"));
  4490. return;
  4491. }
  4492. var base = this.active.offset().top,
  4493. height = this.element.height(),
  4494. result = this.element.children(".ui-menu-item").filter(function() {
  4495. var close = $(this).offset().top - base - height + $(this).height();
  4496. // TODO improve approximation
  4497. return close < 10 && close > -10;
  4498. });
  4499. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  4500. if (!result.length) {
  4501. result = this.element.children(".ui-menu-item:last");
  4502. }
  4503. this.activate(event, result);
  4504. } else {
  4505. this.activate(event, this.element.children(".ui-menu-item")
  4506. .filter(!this.active || this.last() ? ":first" : ":last"));
  4507. }
  4508. },
  4509. // TODO merge with nextPage
  4510. previousPage: function(event) {
  4511. if (this.hasScroll()) {
  4512. // TODO merge with no-scroll-else
  4513. if (!this.active || this.first()) {
  4514. this.activate(event, this.element.children(".ui-menu-item:last"));
  4515. return;
  4516. }
  4517. var base = this.active.offset().top,
  4518. height = this.element.height();
  4519. result = this.element.children(".ui-menu-item").filter(function() {
  4520. var close = $(this).offset().top - base + height - $(this).height();
  4521. // TODO improve approximation
  4522. return close < 10 && close > -10;
  4523. });
  4524. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  4525. if (!result.length) {
  4526. result = this.element.children(".ui-menu-item:first");
  4527. }
  4528. this.activate(event, result);
  4529. } else {
  4530. this.activate(event, this.element.children(".ui-menu-item")
  4531. .filter(!this.active || this.first() ? ":last" : ":first"));
  4532. }
  4533. },
  4534. hasScroll: function() {
  4535. return this.element.height() < this.element.attr("scrollHeight");
  4536. },
  4537. select: function( event ) {
  4538. this._trigger("selected", event, { item: this.active });
  4539. }
  4540. });
  4541. }(jQuery));
  4542. /*
  4543. * Note: While Microsoft is not the author of this file, Microsoft is
  4544. * offering you a license subject to the terms of the Microsoft Software
  4545. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4546. * Microsoft reserves all other rights. The notices below are provided
  4547. * for informational purposes only and are not the license terms under
  4548. * which Microsoft distributed this file.
  4549. *
  4550. * jQuery UI Button 1.8.11
  4551. *
  4552. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  4553. *
  4554. * http://docs.jquery.com/UI/Button
  4555. *
  4556. * Depends:
  4557. * jquery.ui.core.js
  4558. * jquery.ui.widget.js
  4559. */
  4560. (function( $, undefined ) {
  4561. var lastActive,
  4562. baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  4563. stateClasses = "ui-state-hover ui-state-active ",
  4564. 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",
  4565. formResetHandler = function( event ) {
  4566. $( ":ui-button", event.target.form ).each(function() {
  4567. var inst = $( this ).data( "button" );
  4568. setTimeout(function() {
  4569. inst.refresh();
  4570. }, 1 );
  4571. });
  4572. },
  4573. radioGroup = function( radio ) {
  4574. var name = radio.name,
  4575. form = radio.form,
  4576. radios = $( [] );
  4577. if ( name ) {
  4578. if ( form ) {
  4579. radios = $( form ).find( "[name='" + name + "']" );
  4580. } else {
  4581. radios = $( "[name='" + name + "']", radio.ownerDocument )
  4582. .filter(function() {
  4583. return !this.form;
  4584. });
  4585. }
  4586. }
  4587. return radios;
  4588. };
  4589. $.widget( "ui.button", {
  4590. options: {
  4591. disabled: null,
  4592. text: true,
  4593. label: null,
  4594. icons: {
  4595. primary: null,
  4596. secondary: null
  4597. }
  4598. },
  4599. _create: function() {
  4600. this.element.closest( "form" )
  4601. .unbind( "reset.button" )
  4602. .bind( "reset.button", formResetHandler );
  4603. if ( typeof this.options.disabled !== "boolean" ) {
  4604. this.options.disabled = this.element.attr( "disabled" );
  4605. }
  4606. this._determineButtonType();
  4607. this.hasTitle = !!this.buttonElement.attr( "title" );
  4608. var self = this,
  4609. options = this.options,
  4610. toggleButton = this.type === "checkbox" || this.type === "radio",
  4611. hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
  4612. focusClass = "ui-state-focus";
  4613. if ( options.label === null ) {
  4614. options.label = this.buttonElement.html();
  4615. }
  4616. if ( this.element.is( ":disabled" ) ) {
  4617. options.disabled = true;
  4618. }
  4619. this.buttonElement
  4620. .addClass( baseClasses )
  4621. .attr( "role", "button" )
  4622. .bind( "mouseenter.button", function() {
  4623. if ( options.disabled ) {
  4624. return;
  4625. }
  4626. $( this ).addClass( "ui-state-hover" );
  4627. if ( this === lastActive ) {
  4628. $( this ).addClass( "ui-state-active" );
  4629. }
  4630. })
  4631. .bind( "mouseleave.button", function() {
  4632. if ( options.disabled ) {
  4633. return;
  4634. }
  4635. $( this ).removeClass( hoverClass );
  4636. })
  4637. .bind( "focus.button", function() {
  4638. // no need to check disabled, focus won't be triggered anyway
  4639. $( this ).addClass( focusClass );
  4640. })
  4641. .bind( "blur.button", function() {
  4642. $( this ).removeClass( focusClass );
  4643. });
  4644. if ( toggleButton ) {
  4645. this.element.bind( "change.button", function() {
  4646. self.refresh();
  4647. });
  4648. }
  4649. if ( this.type === "checkbox" ) {
  4650. this.buttonElement.bind( "click.button", function() {
  4651. if ( options.disabled ) {
  4652. return false;
  4653. }
  4654. $( this ).toggleClass( "ui-state-active" );
  4655. self.buttonElement.attr( "aria-pressed", self.element[0].checked );
  4656. });
  4657. } else if ( this.type === "radio" ) {
  4658. this.buttonElement.bind( "click.button", function() {
  4659. if ( options.disabled ) {
  4660. return false;
  4661. }
  4662. $( this ).addClass( "ui-state-active" );
  4663. self.buttonElement.attr( "aria-pressed", true );
  4664. var radio = self.element[ 0 ];
  4665. radioGroup( radio )
  4666. .not( radio )
  4667. .map(function() {
  4668. return $( this ).button( "widget" )[ 0 ];
  4669. })
  4670. .removeClass( "ui-state-active" )
  4671. .attr( "aria-pressed", false );
  4672. });
  4673. } else {
  4674. this.buttonElement
  4675. .bind( "mousedown.button", function() {
  4676. if ( options.disabled ) {
  4677. return false;
  4678. }
  4679. $( this ).addClass( "ui-state-active" );
  4680. lastActive = this;
  4681. $( document ).one( "mouseup", function() {
  4682. lastActive = null;
  4683. });
  4684. })
  4685. .bind( "mouseup.button", function() {
  4686. if ( options.disabled ) {
  4687. return false;
  4688. }
  4689. $( this ).removeClass( "ui-state-active" );
  4690. })
  4691. .bind( "keydown.button", function(event) {
  4692. if ( options.disabled ) {
  4693. return false;
  4694. }
  4695. if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
  4696. $( this ).addClass( "ui-state-active" );
  4697. }
  4698. })
  4699. .bind( "keyup.button", function() {
  4700. $( this ).removeClass( "ui-state-active" );
  4701. });
  4702. if ( this.buttonElement.is("a") ) {
  4703. this.buttonElement.keyup(function(event) {
  4704. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  4705. // TODO pass through original event correctly (just as 2nd argument doesn't work)
  4706. $( this ).click();
  4707. }
  4708. });
  4709. }
  4710. }
  4711. // TODO: pull out $.Widget's handling for the disabled option into
  4712. // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
  4713. // be overridden by individual plugins
  4714. this._setOption( "disabled", options.disabled );
  4715. },
  4716. _determineButtonType: function() {
  4717. if ( this.element.is(":checkbox") ) {
  4718. this.type = "checkbox";
  4719. } else {
  4720. if ( this.element.is(":radio") ) {
  4721. this.type = "radio";
  4722. } else {
  4723. if ( this.element.is("input") ) {
  4724. this.type = "input";
  4725. } else {
  4726. this.type = "button";
  4727. }
  4728. }
  4729. }
  4730. if ( this.type === "checkbox" || this.type === "radio" ) {
  4731. // we don't search against the document in case the element
  4732. // is disconnected from the DOM
  4733. var ancestor = this.element.parents().filter(":last"),
  4734. labelSelector = "label[for=" + this.element.attr("id") + "]";
  4735. this.buttonElement = ancestor.find( labelSelector );
  4736. if ( !this.buttonElement.length ) {
  4737. ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
  4738. this.buttonElement = ancestor.filter( labelSelector );
  4739. if ( !this.buttonElement.length ) {
  4740. this.buttonElement = ancestor.find( labelSelector );
  4741. }
  4742. }
  4743. this.element.addClass( "ui-helper-hidden-accessible" );
  4744. var checked = this.element.is( ":checked" );
  4745. if ( checked ) {
  4746. this.buttonElement.addClass( "ui-state-active" );
  4747. }
  4748. this.buttonElement.attr( "aria-pressed", checked );
  4749. } else {
  4750. this.buttonElement = this.element;
  4751. }
  4752. },
  4753. widget: function() {
  4754. return this.buttonElement;
  4755. },
  4756. destroy: function() {
  4757. this.element
  4758. .removeClass( "ui-helper-hidden-accessible" );
  4759. this.buttonElement
  4760. .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
  4761. .removeAttr( "role" )
  4762. .removeAttr( "aria-pressed" )
  4763. .html( this.buttonElement.find(".ui-button-text").html() );
  4764. if ( !this.hasTitle ) {
  4765. this.buttonElement.removeAttr( "title" );
  4766. }
  4767. $.Widget.prototype.destroy.call( this );
  4768. },
  4769. _setOption: function( key, value ) {
  4770. $.Widget.prototype._setOption.apply( this, arguments );
  4771. if ( key === "disabled" ) {
  4772. if ( value ) {
  4773. this.element.attr( "disabled", true );
  4774. } else {
  4775. this.element.removeAttr( "disabled" );
  4776. }
  4777. }
  4778. this._resetButton();
  4779. },
  4780. refresh: function() {
  4781. var isDisabled = this.element.is( ":disabled" );
  4782. if ( isDisabled !== this.options.disabled ) {
  4783. this._setOption( "disabled", isDisabled );
  4784. }
  4785. if ( this.type === "radio" ) {
  4786. radioGroup( this.element[0] ).each(function() {
  4787. if ( $( this ).is( ":checked" ) ) {
  4788. $( this ).button( "widget" )
  4789. .addClass( "ui-state-active" )
  4790. .attr( "aria-pressed", true );
  4791. } else {
  4792. $( this ).button( "widget" )
  4793. .removeClass( "ui-state-active" )
  4794. .attr( "aria-pressed", false );
  4795. }
  4796. });
  4797. } else if ( this.type === "checkbox" ) {
  4798. if ( this.element.is( ":checked" ) ) {
  4799. this.buttonElement
  4800. .addClass( "ui-state-active" )
  4801. .attr( "aria-pressed", true );
  4802. } else {
  4803. this.buttonElement
  4804. .removeClass( "ui-state-active" )
  4805. .attr( "aria-pressed", false );
  4806. }
  4807. }
  4808. },
  4809. _resetButton: function() {
  4810. if ( this.type === "input" ) {
  4811. if ( this.options.label ) {
  4812. this.element.val( this.options.label );
  4813. }
  4814. return;
  4815. }
  4816. var buttonElement = this.buttonElement.removeClass( typeClasses ),
  4817. buttonText = $( "<span></span>" )
  4818. .addClass( "ui-button-text" )
  4819. .html( this.options.label )
  4820. .appendTo( buttonElement.empty() )
  4821. .text(),
  4822. icons = this.options.icons,
  4823. multipleIcons = icons.primary && icons.secondary,
  4824. buttonClasses = [];
  4825. if ( icons.primary || icons.secondary ) {
  4826. if ( this.options.text ) {
  4827. buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
  4828. }
  4829. if ( icons.primary ) {
  4830. buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
  4831. }
  4832. if ( icons.secondary ) {
  4833. buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
  4834. }
  4835. if ( !this.options.text ) {
  4836. buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
  4837. if ( !this.hasTitle ) {
  4838. buttonElement.attr( "title", buttonText );
  4839. }
  4840. }
  4841. } else {
  4842. buttonClasses.push( "ui-button-text-only" );
  4843. }
  4844. buttonElement.addClass( buttonClasses.join( " " ) );
  4845. }
  4846. });
  4847. $.widget( "ui.buttonset", {
  4848. options: {
  4849. items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
  4850. },
  4851. _create: function() {
  4852. this.element.addClass( "ui-buttonset" );
  4853. },
  4854. _init: function() {
  4855. this.refresh();
  4856. },
  4857. _setOption: function( key, value ) {
  4858. if ( key === "disabled" ) {
  4859. this.buttons.button( "option", key, value );
  4860. }
  4861. $.Widget.prototype._setOption.apply( this, arguments );
  4862. },
  4863. refresh: function() {
  4864. this.buttons = this.element.find( this.options.items )
  4865. .filter( ":ui-button" )
  4866. .button( "refresh" )
  4867. .end()
  4868. .not( ":ui-button" )
  4869. .button()
  4870. .end()
  4871. .map(function() {
  4872. return $( this ).button( "widget" )[ 0 ];
  4873. })
  4874. .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  4875. .filter( ":first" )
  4876. .addClass( "ui-corner-left" )
  4877. .end()
  4878. .filter( ":last" )
  4879. .addClass( "ui-corner-right" )
  4880. .end()
  4881. .end();
  4882. },
  4883. destroy: function() {
  4884. this.element.removeClass( "ui-buttonset" );
  4885. this.buttons
  4886. .map(function() {
  4887. return $( this ).button( "widget" )[ 0 ];
  4888. })
  4889. .removeClass( "ui-corner-left ui-corner-right" )
  4890. .end()
  4891. .button( "destroy" );
  4892. $.Widget.prototype.destroy.call( this );
  4893. }
  4894. });
  4895. }( jQuery ) );
  4896. /*
  4897. * Note: While Microsoft is not the author of this file, Microsoft is
  4898. * offering you a license subject to the terms of the Microsoft Software
  4899. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4900. * Microsoft reserves all other rights. The notices below are provided
  4901. * for informational purposes only and are not the license terms under
  4902. * which Microsoft distributed this file.
  4903. *
  4904. * jQuery UI Dialog 1.8.11
  4905. *
  4906. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  4907. *
  4908. * http://docs.jquery.com/UI/Dialog
  4909. *
  4910. * Depends:
  4911. * jquery.ui.core.js
  4912. * jquery.ui.widget.js
  4913. * jquery.ui.button.js
  4914. * jquery.ui.draggable.js
  4915. * jquery.ui.mouse.js
  4916. * jquery.ui.position.js
  4917. * jquery.ui.resizable.js
  4918. */
  4919. (function( $, undefined ) {
  4920. var uiDialogClasses =
  4921. 'ui-dialog ' +
  4922. 'ui-widget ' +
  4923. 'ui-widget-content ' +
  4924. 'ui-corner-all ',
  4925. sizeRelatedOptions = {
  4926. buttons: true,
  4927. height: true,
  4928. maxHeight: true,
  4929. maxWidth: true,
  4930. minHeight: true,
  4931. minWidth: true,
  4932. width: true
  4933. },
  4934. resizableRelatedOptions = {
  4935. maxHeight: true,
  4936. maxWidth: true,
  4937. minHeight: true,
  4938. minWidth: true
  4939. };
  4940. $.widget("ui.dialog", {
  4941. options: {
  4942. autoOpen: true,
  4943. buttons: {},
  4944. closeOnEscape: true,
  4945. closeText: 'close',
  4946. dialogClass: '',
  4947. draggable: true,
  4948. hide: null,
  4949. height: 'auto',
  4950. maxHeight: false,
  4951. maxWidth: false,
  4952. minHeight: 150,
  4953. minWidth: 150,
  4954. modal: false,
  4955. position: {
  4956. my: 'center',
  4957. at: 'center',
  4958. collision: 'fit',
  4959. // ensure that the titlebar is never outside the document
  4960. using: function(pos) {
  4961. var topOffset = $(this).css(pos).offset().top;
  4962. if (topOffset < 0) {
  4963. $(this).css('top', pos.top - topOffset);
  4964. }
  4965. }
  4966. },
  4967. resizable: true,
  4968. show: null,
  4969. stack: true,
  4970. title: '',
  4971. width: 300,
  4972. zIndex: 1000
  4973. },
  4974. _create: function() {
  4975. this.originalTitle = this.element.attr('title');
  4976. // #5742 - .attr() might return a DOMElement
  4977. if ( typeof this.originalTitle !== "string" ) {
  4978. this.originalTitle = "";
  4979. }
  4980. this.options.title = this.options.title || this.originalTitle;
  4981. var self = this,
  4982. options = self.options,
  4983. title = options.title || '&#160;',
  4984. titleId = $.ui.dialog.getTitleId(self.element),
  4985. uiDialog = (self.uiDialog = $('<div></div>'))
  4986. .appendTo(document.body)
  4987. .hide()
  4988. .addClass(uiDialogClasses + options.dialogClass)
  4989. .css({
  4990. zIndex: options.zIndex
  4991. })
  4992. // setting tabIndex makes the div focusable
  4993. // setting outline to 0 prevents a border on focus in Mozilla
  4994. .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
  4995. if (options.closeOnEscape && event.keyCode &&
  4996. event.keyCode === $.ui.keyCode.ESCAPE) {
  4997. self.close(event);
  4998. event.preventDefault();
  4999. }
  5000. })
  5001. .attr({
  5002. role: 'dialog',
  5003. 'aria-labelledby': titleId
  5004. })
  5005. .mousedown(function(event) {
  5006. self.moveToTop(false, event);
  5007. }),
  5008. uiDialogContent = self.element
  5009. .show()
  5010. .removeAttr('title')
  5011. .addClass(
  5012. 'ui-dialog-content ' +
  5013. 'ui-widget-content')
  5014. .appendTo(uiDialog),
  5015. uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
  5016. .addClass(
  5017. 'ui-dialog-titlebar ' +
  5018. 'ui-widget-header ' +
  5019. 'ui-corner-all ' +
  5020. 'ui-helper-clearfix'
  5021. )
  5022. .prependTo(uiDialog),
  5023. uiDialogTitlebarClose = $('<a href="#"></a>')
  5024. .addClass(
  5025. 'ui-dialog-titlebar-close ' +
  5026. 'ui-corner-all'
  5027. )
  5028. .attr('role', 'button')
  5029. .hover(
  5030. function() {
  5031. uiDialogTitlebarClose.addClass('ui-state-hover');
  5032. },
  5033. function() {
  5034. uiDialogTitlebarClose.removeClass('ui-state-hover');
  5035. }
  5036. )
  5037. .focus(function() {
  5038. uiDialogTitlebarClose.addClass('ui-state-focus');
  5039. })
  5040. .blur(function() {
  5041. uiDialogTitlebarClose.removeClass('ui-state-focus');
  5042. })
  5043. .click(function(event) {
  5044. self.close(event);
  5045. return false;
  5046. })
  5047. .appendTo(uiDialogTitlebar),
  5048. uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
  5049. .addClass(
  5050. 'ui-icon ' +
  5051. 'ui-icon-closethick'
  5052. )
  5053. .text(options.closeText)
  5054. .appendTo(uiDialogTitlebarClose),
  5055. uiDialogTitle = $('<span></span>')
  5056. .addClass('ui-dialog-title')
  5057. .attr('id', titleId)
  5058. .html(title)
  5059. .prependTo(uiDialogTitlebar);
  5060. //handling of deprecated beforeclose (vs beforeClose) option
  5061. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  5062. //TODO: remove in 1.9pre
  5063. if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
  5064. options.beforeClose = options.beforeclose;
  5065. }
  5066. uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
  5067. if (options.draggable && $.fn.draggable) {
  5068. self._makeDraggable();
  5069. }
  5070. if (options.resizable && $.fn.resizable) {
  5071. self._makeResizable();
  5072. }
  5073. self._createButtons(options.buttons);
  5074. self._isOpen = false;
  5075. if ($.fn.bgiframe) {
  5076. uiDialog.bgiframe();
  5077. }
  5078. },
  5079. _init: function() {
  5080. if ( this.options.autoOpen ) {
  5081. this.open();
  5082. }
  5083. },
  5084. destroy: function() {
  5085. var self = this;
  5086. if (self.overlay) {
  5087. self.overlay.destroy();
  5088. }
  5089. self.uiDialog.hide();
  5090. self.element
  5091. .unbind('.dialog')
  5092. .removeData('dialog')
  5093. .removeClass('ui-dialog-content ui-widget-content')
  5094. .hide().appendTo('body');
  5095. self.uiDialog.remove();
  5096. if (self.originalTitle) {
  5097. self.element.attr('title', self.originalTitle);
  5098. }
  5099. return self;
  5100. },
  5101. widget: function() {
  5102. return this.uiDialog;
  5103. },
  5104. close: function(event) {
  5105. var self = this,
  5106. maxZ, thisZ;
  5107. if (false === self._trigger('beforeClose', event)) {
  5108. return;
  5109. }
  5110. if (self.overlay) {
  5111. self.overlay.destroy();
  5112. }
  5113. self.uiDialog.unbind('keypress.ui-dialog');
  5114. self._isOpen = false;
  5115. if (self.options.hide) {
  5116. self.uiDialog.hide(self.options.hide, function() {
  5117. self._trigger('close', event);
  5118. });
  5119. } else {
  5120. self.uiDialog.hide();
  5121. self._trigger('close', event);
  5122. }
  5123. $.ui.dialog.overlay.resize();
  5124. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  5125. if (self.options.modal) {
  5126. maxZ = 0;
  5127. $('.ui-dialog').each(function() {
  5128. if (this !== self.uiDialog[0]) {
  5129. thisZ = $(this).css('z-index');
  5130. if(!isNaN(thisZ)) {
  5131. maxZ = Math.max(maxZ, thisZ);
  5132. }
  5133. }
  5134. });
  5135. $.ui.dialog.maxZ = maxZ;
  5136. }
  5137. return self;
  5138. },
  5139. isOpen: function() {
  5140. return this._isOpen;
  5141. },
  5142. // the force parameter allows us to move modal dialogs to their correct
  5143. // position on open
  5144. moveToTop: function(force, event) {
  5145. var self = this,
  5146. options = self.options,
  5147. saveScroll;
  5148. if ((options.modal && !force) ||
  5149. (!options.stack && !options.modal)) {
  5150. return self._trigger('focus', event);
  5151. }
  5152. if (options.zIndex > $.ui.dialog.maxZ) {
  5153. $.ui.dialog.maxZ = options.zIndex;
  5154. }
  5155. if (self.overlay) {
  5156. $.ui.dialog.maxZ += 1;
  5157. self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
  5158. }
  5159. //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
  5160. // http://ui.jquery.com/bugs/ticket/3193
  5161. saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
  5162. $.ui.dialog.maxZ += 1;
  5163. self.uiDialog.css('z-index', $.ui.dialog.maxZ);
  5164. self.element.attr(saveScroll);
  5165. self._trigger('focus', event);
  5166. return self;
  5167. },
  5168. open: function() {
  5169. if (this._isOpen) { return; }
  5170. var self = this,
  5171. options = self.options,
  5172. uiDialog = self.uiDialog;
  5173. self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
  5174. self._size();
  5175. self._position(options.position);
  5176. uiDialog.show(options.show);
  5177. self.moveToTop(true);
  5178. // prevent tabbing out of modal dialogs
  5179. if (options.modal) {
  5180. uiDialog.bind('keypress.ui-dialog', function(event) {
  5181. if (event.keyCode !== $.ui.keyCode.TAB) {
  5182. return;
  5183. }
  5184. var tabbables = $(':tabbable', this),
  5185. first = tabbables.filter(':first'),
  5186. last = tabbables.filter(':last');
  5187. if (event.target === last[0] && !event.shiftKey) {
  5188. first.focus(1);
  5189. return false;
  5190. } else if (event.target === first[0] && event.shiftKey) {
  5191. last.focus(1);
  5192. return false;
  5193. }
  5194. });
  5195. }
  5196. // set focus to the first tabbable element in the content area or the first button
  5197. // if there are no tabbable elements, set focus on the dialog itself
  5198. $(self.element.find(':tabbable').get().concat(
  5199. uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
  5200. uiDialog.get()))).eq(0).focus();
  5201. self._isOpen = true;
  5202. self._trigger('open');
  5203. return self;
  5204. },
  5205. _createButtons: function(buttons) {
  5206. var self = this,
  5207. hasButtons = false,
  5208. uiDialogButtonPane = $('<div></div>')
  5209. .addClass(
  5210. 'ui-dialog-buttonpane ' +
  5211. 'ui-widget-content ' +
  5212. 'ui-helper-clearfix'
  5213. ),
  5214. uiButtonSet = $( "<div></div>" )
  5215. .addClass( "ui-dialog-buttonset" )
  5216. .appendTo( uiDialogButtonPane );
  5217. // if we already have a button pane, remove it
  5218. self.uiDialog.find('.ui-dialog-buttonpane').remove();
  5219. if (typeof buttons === 'object' && buttons !== null) {
  5220. $.each(buttons, function() {
  5221. return !(hasButtons = true);
  5222. });
  5223. }
  5224. if (hasButtons) {
  5225. $.each(buttons, function(name, props) {
  5226. props = $.isFunction( props ) ?
  5227. { click: props, text: name } :
  5228. props;
  5229. var button = $('<button type="button"></button>')
  5230. .attr( props, true )
  5231. .unbind('click')
  5232. .click(function() {
  5233. props.click.apply(self.element[0], arguments);
  5234. })
  5235. .appendTo(uiButtonSet);
  5236. if ($.fn.button) {
  5237. button.button();
  5238. }
  5239. });
  5240. uiDialogButtonPane.appendTo(self.uiDialog);
  5241. }
  5242. },
  5243. _makeDraggable: function() {
  5244. var self = this,
  5245. options = self.options,
  5246. doc = $(document),
  5247. heightBeforeDrag;
  5248. function filteredUi(ui) {
  5249. return {
  5250. position: ui.position,
  5251. offset: ui.offset
  5252. };
  5253. }
  5254. self.uiDialog.draggable({
  5255. cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
  5256. handle: '.ui-dialog-titlebar',
  5257. containment: 'document',
  5258. start: function(event, ui) {
  5259. heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
  5260. $(this).height($(this).height()).addClass("ui-dialog-dragging");
  5261. self._trigger('dragStart', event, filteredUi(ui));
  5262. },
  5263. drag: function(event, ui) {
  5264. self._trigger('drag', event, filteredUi(ui));
  5265. },
  5266. stop: function(event, ui) {
  5267. options.position = [ui.position.left - doc.scrollLeft(),
  5268. ui.position.top - doc.scrollTop()];
  5269. $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
  5270. self._trigger('dragStop', event, filteredUi(ui));
  5271. $.ui.dialog.overlay.resize();
  5272. }
  5273. });
  5274. },
  5275. _makeResizable: function(handles) {
  5276. handles = (handles === undefined ? this.options.resizable : handles);
  5277. var self = this,
  5278. options = self.options,
  5279. // .ui-resizable has position: relative defined in the stylesheet
  5280. // but dialogs have to use absolute or fixed positioning
  5281. position = self.uiDialog.css('position'),
  5282. resizeHandles = (typeof handles === 'string' ?
  5283. handles :
  5284. 'n,e,s,w,se,sw,ne,nw'
  5285. );
  5286. function filteredUi(ui) {
  5287. return {
  5288. originalPosition: ui.originalPosition,
  5289. originalSize: ui.originalSize,
  5290. position: ui.position,
  5291. size: ui.size
  5292. };
  5293. }
  5294. self.uiDialog.resizable({
  5295. cancel: '.ui-dialog-content',
  5296. containment: 'document',
  5297. alsoResize: self.element,
  5298. maxWidth: options.maxWidth,
  5299. maxHeight: options.maxHeight,
  5300. minWidth: options.minWidth,
  5301. minHeight: self._minHeight(),
  5302. handles: resizeHandles,
  5303. start: function(event, ui) {
  5304. $(this).addClass("ui-dialog-resizing");
  5305. self._trigger('resizeStart', event, filteredUi(ui));
  5306. },
  5307. resize: function(event, ui) {
  5308. self._trigger('resize', event, filteredUi(ui));
  5309. },
  5310. stop: function(event, ui) {
  5311. $(this).removeClass("ui-dialog-resizing");
  5312. options.height = $(this).height();
  5313. options.width = $(this).width();
  5314. self._trigger('resizeStop', event, filteredUi(ui));
  5315. $.ui.dialog.overlay.resize();
  5316. }
  5317. })
  5318. .css('position', position)
  5319. .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
  5320. },
  5321. _minHeight: function() {
  5322. var options = this.options;
  5323. if (options.height === 'auto') {
  5324. return options.minHeight;
  5325. } else {
  5326. return Math.min(options.minHeight, options.height);
  5327. }
  5328. },
  5329. _position: function(position) {
  5330. var myAt = [],
  5331. offset = [0, 0],
  5332. isVisible;
  5333. if (position) {
  5334. // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
  5335. // if (typeof position == 'string' || $.isArray(position)) {
  5336. // myAt = $.isArray(position) ? position : position.split(' ');
  5337. if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
  5338. myAt = position.split ? position.split(' ') : [position[0], position[1]];
  5339. if (myAt.length === 1) {
  5340. myAt[1] = myAt[0];
  5341. }
  5342. $.each(['left', 'top'], function(i, offsetPosition) {
  5343. if (+myAt[i] === myAt[i]) {
  5344. offset[i] = myAt[i];
  5345. myAt[i] = offsetPosition;
  5346. }
  5347. });
  5348. position = {
  5349. my: myAt.join(" "),
  5350. at: myAt.join(" "),
  5351. offset: offset.join(" ")
  5352. };
  5353. }
  5354. position = $.extend({}, $.ui.dialog.prototype.options.position, position);
  5355. } else {
  5356. position = $.ui.dialog.prototype.options.position;
  5357. }
  5358. // need to show the dialog to get the actual offset in the position plugin
  5359. isVisible = this.uiDialog.is(':visible');
  5360. if (!isVisible) {
  5361. this.uiDialog.show();
  5362. }
  5363. this.uiDialog
  5364. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  5365. .css({ top: 0, left: 0 })
  5366. .position($.extend({ of: window }, position));
  5367. if (!isVisible) {
  5368. this.uiDialog.hide();
  5369. }
  5370. },
  5371. _setOptions: function( options ) {
  5372. var self = this,
  5373. resizableOptions = {},
  5374. resize = false;
  5375. $.each( options, function( key, value ) {
  5376. self._setOption( key, value );
  5377. if ( key in sizeRelatedOptions ) {
  5378. resize = true;
  5379. }
  5380. if ( key in resizableRelatedOptions ) {
  5381. resizableOptions[ key ] = value;
  5382. }
  5383. });
  5384. if ( resize ) {
  5385. this._size();
  5386. }
  5387. if ( this.uiDialog.is( ":data(resizable)" ) ) {
  5388. this.uiDialog.resizable( "option", resizableOptions );
  5389. }
  5390. },
  5391. _setOption: function(key, value){
  5392. var self = this,
  5393. uiDialog = self.uiDialog;
  5394. switch (key) {
  5395. //handling of deprecated beforeclose (vs beforeClose) option
  5396. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  5397. //TODO: remove in 1.9pre
  5398. case "beforeclose":
  5399. key = "beforeClose";
  5400. break;
  5401. case "buttons":
  5402. self._createButtons(value);
  5403. break;
  5404. case "closeText":
  5405. // ensure that we always pass a string
  5406. self.uiDialogTitlebarCloseText.text("" + value);
  5407. break;
  5408. case "dialogClass":
  5409. uiDialog
  5410. .removeClass(self.options.dialogClass)
  5411. .addClass(uiDialogClasses + value);
  5412. break;
  5413. case "disabled":
  5414. if (value) {
  5415. uiDialog.addClass('ui-dialog-disabled');
  5416. } else {
  5417. uiDialog.removeClass('ui-dialog-disabled');
  5418. }
  5419. break;
  5420. case "draggable":
  5421. var isDraggable = uiDialog.is( ":data(draggable)" );
  5422. if ( isDraggable && !value ) {
  5423. uiDialog.draggable( "destroy" );
  5424. }
  5425. if ( !isDraggable && value ) {
  5426. self._makeDraggable();
  5427. }
  5428. break;
  5429. case "position":
  5430. self._position(value);
  5431. break;
  5432. case "resizable":
  5433. // currently resizable, becoming non-resizable
  5434. var isResizable = uiDialog.is( ":data(resizable)" );
  5435. if (isResizable && !value) {
  5436. uiDialog.resizable('destroy');
  5437. }
  5438. // currently resizable, changing handles
  5439. if (isResizable && typeof value === 'string') {
  5440. uiDialog.resizable('option', 'handles', value);
  5441. }
  5442. // currently non-resizable, becoming resizable
  5443. if (!isResizable && value !== false) {
  5444. self._makeResizable(value);
  5445. }
  5446. break;
  5447. case "title":
  5448. // convert whatever was passed in o a string, for html() to not throw up
  5449. $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
  5450. break;
  5451. }
  5452. $.Widget.prototype._setOption.apply(self, arguments);
  5453. },
  5454. _size: function() {
  5455. /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  5456. * divs will both have width and height set, so we need to reset them
  5457. */
  5458. var options = this.options,
  5459. nonContentHeight,
  5460. minContentHeight,
  5461. isVisible = this.uiDialog.is( ":visible" );
  5462. // reset content sizing
  5463. this.element.show().css({
  5464. width: 'auto',
  5465. minHeight: 0,
  5466. height: 0
  5467. });
  5468. if (options.minWidth > options.width) {
  5469. options.width = options.minWidth;
  5470. }
  5471. // reset wrapper sizing
  5472. // determine the height of all the non-content elements
  5473. nonContentHeight = this.uiDialog.css({
  5474. height: 'auto',
  5475. width: options.width
  5476. })
  5477. .height();
  5478. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  5479. if ( options.height === "auto" ) {
  5480. // only needed for IE6 support
  5481. if ( $.support.minHeight ) {
  5482. this.element.css({
  5483. minHeight: minContentHeight,
  5484. height: "auto"
  5485. });
  5486. } else {
  5487. this.uiDialog.show();
  5488. var autoHeight = this.element.css( "height", "auto" ).height();
  5489. if ( !isVisible ) {
  5490. this.uiDialog.hide();
  5491. }
  5492. this.element.height( Math.max( autoHeight, minContentHeight ) );
  5493. }
  5494. } else {
  5495. this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
  5496. }
  5497. if (this.uiDialog.is(':data(resizable)')) {
  5498. this.uiDialog.resizable('option', 'minHeight', this._minHeight());
  5499. }
  5500. }
  5501. });
  5502. $.extend($.ui.dialog, {
  5503. version: "1.8.11",
  5504. uuid: 0,
  5505. maxZ: 0,
  5506. getTitleId: function($el) {
  5507. var id = $el.attr('id');
  5508. if (!id) {
  5509. this.uuid += 1;
  5510. id = this.uuid;
  5511. }
  5512. return 'ui-dialog-title-' + id;
  5513. },
  5514. overlay: function(dialog) {
  5515. this.$el = $.ui.dialog.overlay.create(dialog);
  5516. }
  5517. });
  5518. $.extend($.ui.dialog.overlay, {
  5519. instances: [],
  5520. // reuse old instances due to IE memory leak with alpha transparency (see #5185)
  5521. oldInstances: [],
  5522. maxZ: 0,
  5523. events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
  5524. function(event) { return event + '.dialog-overlay'; }).join(' '),
  5525. create: function(dialog) {
  5526. if (this.instances.length === 0) {
  5527. // prevent use of anchors and inputs
  5528. // we use a setTimeout in case the overlay is created from an
  5529. // event that we're going to be cancelling (see #2804)
  5530. setTimeout(function() {
  5531. // handle $(el).dialog().dialog('close') (see #4065)
  5532. if ($.ui.dialog.overlay.instances.length) {
  5533. $(document).bind($.ui.dialog.overlay.events, function(event) {
  5534. // stop events if the z-index of the target is < the z-index of the overlay
  5535. // we cannot return true when we don't want to cancel the event (#3523)
  5536. if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
  5537. return false;
  5538. }
  5539. });
  5540. }
  5541. }, 1);
  5542. // allow closing by pressing the escape key
  5543. $(document).bind('keydown.dialog-overlay', function(event) {
  5544. if (dialog.options.closeOnEscape && event.keyCode &&
  5545. event.keyCode === $.ui.keyCode.ESCAPE) {
  5546. dialog.close(event);
  5547. event.preventDefault();
  5548. }
  5549. });
  5550. // handle window resize
  5551. $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
  5552. }
  5553. var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
  5554. .appendTo(document.body)
  5555. .css({
  5556. width: this.width(),
  5557. height: this.height()
  5558. });
  5559. if ($.fn.bgiframe) {
  5560. $el.bgiframe();
  5561. }
  5562. this.instances.push($el);
  5563. return $el;
  5564. },
  5565. destroy: function($el) {
  5566. var indexOf = $.inArray($el, this.instances);
  5567. if (indexOf != -1){
  5568. this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
  5569. }
  5570. if (this.instances.length === 0) {
  5571. $([document, window]).unbind('.dialog-overlay');
  5572. }
  5573. $el.remove();
  5574. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  5575. var maxZ = 0;
  5576. $.each(this.instances, function() {
  5577. maxZ = Math.max(maxZ, this.css('z-index'));
  5578. });
  5579. this.maxZ = maxZ;
  5580. },
  5581. height: function() {
  5582. var scrollHeight,
  5583. offsetHeight;
  5584. // handle IE 6
  5585. if ($.browser.msie && $.browser.version < 7) {
  5586. scrollHeight = Math.max(
  5587. document.documentElement.scrollHeight,
  5588. document.body.scrollHeight
  5589. );
  5590. offsetHeight = Math.max(
  5591. document.documentElement.offsetHeight,
  5592. document.body.offsetHeight
  5593. );
  5594. if (scrollHeight < offsetHeight) {
  5595. return $(window).height() + 'px';
  5596. } else {
  5597. return scrollHeight + 'px';
  5598. }
  5599. // handle "good" browsers
  5600. } else {
  5601. return $(document).height() + 'px';
  5602. }
  5603. },
  5604. width: function() {
  5605. var scrollWidth,
  5606. offsetWidth;
  5607. // handle IE 6
  5608. if ($.browser.msie && $.browser.version < 7) {
  5609. scrollWidth = Math.max(
  5610. document.documentElement.scrollWidth,
  5611. document.body.scrollWidth
  5612. );
  5613. offsetWidth = Math.max(
  5614. document.documentElement.offsetWidth,
  5615. document.body.offsetWidth
  5616. );
  5617. if (scrollWidth < offsetWidth) {
  5618. return $(window).width() + 'px';
  5619. } else {
  5620. return scrollWidth + 'px';
  5621. }
  5622. // handle "good" browsers
  5623. } else {
  5624. return $(document).width() + 'px';
  5625. }
  5626. },
  5627. resize: function() {
  5628. /* If the dialog is draggable and the user drags it past the
  5629. * right edge of the window, the document becomes wider so we
  5630. * need to stretch the overlay. If the user then drags the
  5631. * dialog back to the left, the document will become narrower,
  5632. * so we need to shrink the overlay to the appropriate size.
  5633. * This is handled by shrinking the overlay before setting it
  5634. * to the full document size.
  5635. */
  5636. var $overlays = $([]);
  5637. $.each($.ui.dialog.overlay.instances, function() {
  5638. $overlays = $overlays.add(this);
  5639. });
  5640. $overlays.css({
  5641. width: 0,
  5642. height: 0
  5643. }).css({
  5644. width: $.ui.dialog.overlay.width(),
  5645. height: $.ui.dialog.overlay.height()
  5646. });
  5647. }
  5648. });
  5649. $.extend($.ui.dialog.overlay.prototype, {
  5650. destroy: function() {
  5651. $.ui.dialog.overlay.destroy(this.$el);
  5652. }
  5653. });
  5654. }(jQuery));
  5655. /*
  5656. * Note: While Microsoft is not the author of this file, Microsoft is
  5657. * offering you a license subject to the terms of the Microsoft Software
  5658. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5659. * Microsoft reserves all other rights. The notices below are provided
  5660. * for informational purposes only and are not the license terms under
  5661. * which Microsoft distributed this file.
  5662. *
  5663. * jQuery UI Slider 1.8.11
  5664. *
  5665. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)\
  5666. *
  5667. * http://docs.jquery.com/UI/Slider
  5668. *
  5669. * Depends:
  5670. * jquery.ui.core.js
  5671. * jquery.ui.mouse.js
  5672. * jquery.ui.widget.js
  5673. */
  5674. (function( $, undefined ) {
  5675. // number of pages in a slider
  5676. // (how many times can you page up/down to go through the whole range)
  5677. var numPages = 5;
  5678. $.widget( "ui.slider", $.ui.mouse, {
  5679. widgetEventPrefix: "slide",
  5680. options: {
  5681. animate: false,
  5682. distance: 0,
  5683. max: 100,
  5684. min: 0,
  5685. orientation: "horizontal",
  5686. range: false,
  5687. step: 1,
  5688. value: 0,
  5689. values: null
  5690. },
  5691. _create: function() {
  5692. var self = this,
  5693. o = this.options;
  5694. this._keySliding = false;
  5695. this._mouseSliding = false;
  5696. this._animateOff = true;
  5697. this._handleIndex = null;
  5698. this._detectOrientation();
  5699. this._mouseInit();
  5700. this.element
  5701. .addClass( "ui-slider" +
  5702. " ui-slider-" + this.orientation +
  5703. " ui-widget" +
  5704. " ui-widget-content" +
  5705. " ui-corner-all" );
  5706. if ( o.disabled ) {
  5707. this.element.addClass( "ui-slider-disabled ui-disabled" );
  5708. }
  5709. this.range = $([]);
  5710. if ( o.range ) {
  5711. if ( o.range === true ) {
  5712. this.range = $( "<div></div>" );
  5713. if ( !o.values ) {
  5714. o.values = [ this._valueMin(), this._valueMin() ];
  5715. }
  5716. if ( o.values.length && o.values.length !== 2 ) {
  5717. o.values = [ o.values[0], o.values[0] ];
  5718. }
  5719. } else {
  5720. this.range = $( "<div></div>" );
  5721. }
  5722. this.range
  5723. .appendTo( this.element )
  5724. .addClass( "ui-slider-range" );
  5725. if ( o.range === "min" || o.range === "max" ) {
  5726. this.range.addClass( "ui-slider-range-" + o.range );
  5727. }
  5728. // note: this isn't the most fittingly semantic framework class for this element,
  5729. // but worked best visually with a variety of themes
  5730. this.range.addClass( "ui-widget-header" );
  5731. }
  5732. if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
  5733. $( "<a href='#'></a>" )
  5734. .appendTo( this.element )
  5735. .addClass( "ui-slider-handle" );
  5736. }
  5737. if ( o.values && o.values.length ) {
  5738. while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
  5739. $( "<a href='#'></a>" )
  5740. .appendTo( this.element )
  5741. .addClass( "ui-slider-handle" );
  5742. }
  5743. }
  5744. this.handles = $( ".ui-slider-handle", this.element )
  5745. .addClass( "ui-state-default" +
  5746. " ui-corner-all" );
  5747. this.handle = this.handles.eq( 0 );
  5748. this.handles.add( this.range ).filter( "a" )
  5749. .click(function( event ) {
  5750. event.preventDefault();
  5751. })
  5752. .hover(function() {
  5753. if ( !o.disabled ) {
  5754. $( this ).addClass( "ui-state-hover" );
  5755. }
  5756. }, function() {
  5757. $( this ).removeClass( "ui-state-hover" );
  5758. })
  5759. .focus(function() {
  5760. if ( !o.disabled ) {
  5761. $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
  5762. $( this ).addClass( "ui-state-focus" );
  5763. } else {
  5764. $( this ).blur();
  5765. }
  5766. })
  5767. .blur(function() {
  5768. $( this ).removeClass( "ui-state-focus" );
  5769. });
  5770. this.handles.each(function( i ) {
  5771. $( this ).data( "index.ui-slider-handle", i );
  5772. });
  5773. this.handles
  5774. .keydown(function( event ) {
  5775. var ret = true,
  5776. index = $( this ).data( "index.ui-slider-handle" ),
  5777. allowed,
  5778. curVal,
  5779. newVal,
  5780. step;
  5781. if ( self.options.disabled ) {
  5782. return;
  5783. }
  5784. switch ( event.keyCode ) {
  5785. case $.ui.keyCode.HOME:
  5786. case $.ui.keyCode.END:
  5787. case $.ui.keyCode.PAGE_UP:
  5788. case $.ui.keyCode.PAGE_DOWN:
  5789. case $.ui.keyCode.UP:
  5790. case $.ui.keyCode.RIGHT:
  5791. case $.ui.keyCode.DOWN:
  5792. case $.ui.keyCode.LEFT:
  5793. ret = false;
  5794. if ( !self._keySliding ) {
  5795. self._keySliding = true;
  5796. $( this ).addClass( "ui-state-active" );
  5797. allowed = self._start( event, index );
  5798. if ( allowed === false ) {
  5799. return;
  5800. }
  5801. }
  5802. break;
  5803. }
  5804. step = self.options.step;
  5805. if ( self.options.values && self.options.values.length ) {
  5806. curVal = newVal = self.values( index );
  5807. } else {
  5808. curVal = newVal = self.value();
  5809. }
  5810. switch ( event.keyCode ) {
  5811. case $.ui.keyCode.HOME:
  5812. newVal = self._valueMin();
  5813. break;
  5814. case $.ui.keyCode.END:
  5815. newVal = self._valueMax();
  5816. break;
  5817. case $.ui.keyCode.PAGE_UP:
  5818. newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
  5819. break;
  5820. case $.ui.keyCode.PAGE_DOWN:
  5821. newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
  5822. break;
  5823. case $.ui.keyCode.UP:
  5824. case $.ui.keyCode.RIGHT:
  5825. if ( curVal === self._valueMax() ) {
  5826. return;
  5827. }
  5828. newVal = self._trimAlignValue( curVal + step );
  5829. break;
  5830. case $.ui.keyCode.DOWN:
  5831. case $.ui.keyCode.LEFT:
  5832. if ( curVal === self._valueMin() ) {
  5833. return;
  5834. }
  5835. newVal = self._trimAlignValue( curVal - step );
  5836. break;
  5837. }
  5838. self._slide( event, index, newVal );
  5839. return ret;
  5840. })
  5841. .keyup(function( event ) {
  5842. var index = $( this ).data( "index.ui-slider-handle" );
  5843. if ( self._keySliding ) {
  5844. self._keySliding = false;
  5845. self._stop( event, index );
  5846. self._change( event, index );
  5847. $( this ).removeClass( "ui-state-active" );
  5848. }
  5849. });
  5850. this._refreshValue();
  5851. this._animateOff = false;
  5852. },
  5853. destroy: function() {
  5854. this.handles.remove();
  5855. this.range.remove();
  5856. this.element
  5857. .removeClass( "ui-slider" +
  5858. " ui-slider-horizontal" +
  5859. " ui-slider-vertical" +
  5860. " ui-slider-disabled" +
  5861. " ui-widget" +
  5862. " ui-widget-content" +
  5863. " ui-corner-all" )
  5864. .removeData( "slider" )
  5865. .unbind( ".slider" );
  5866. this._mouseDestroy();
  5867. return this;
  5868. },
  5869. _mouseCapture: function( event ) {
  5870. var o = this.options,
  5871. position,
  5872. normValue,
  5873. distance,
  5874. closestHandle,
  5875. self,
  5876. index,
  5877. allowed,
  5878. offset,
  5879. mouseOverHandle;
  5880. if ( o.disabled ) {
  5881. return false;
  5882. }
  5883. this.elementSize = {
  5884. width: this.element.outerWidth(),
  5885. height: this.element.outerHeight()
  5886. };
  5887. this.elementOffset = this.element.offset();
  5888. position = { x: event.pageX, y: event.pageY };
  5889. normValue = this._normValueFromMouse( position );
  5890. distance = this._valueMax() - this._valueMin() + 1;
  5891. self = this;
  5892. this.handles.each(function( i ) {
  5893. var thisDistance = Math.abs( normValue - self.values(i) );
  5894. if ( distance > thisDistance ) {
  5895. distance = thisDistance;
  5896. closestHandle = $( this );
  5897. index = i;
  5898. }
  5899. });
  5900. // workaround for bug #3736 (if both handles of a range are at 0,
  5901. // the first is always used as the one with least distance,
  5902. // and moving it is obviously prevented by preventing negative ranges)
  5903. if( o.range === true && this.values(1) === o.min ) {
  5904. index += 1;
  5905. closestHandle = $( this.handles[index] );
  5906. }
  5907. allowed = this._start( event, index );
  5908. if ( allowed === false ) {
  5909. return false;
  5910. }
  5911. this._mouseSliding = true;
  5912. self._handleIndex = index;
  5913. closestHandle
  5914. .addClass( "ui-state-active" )
  5915. .focus();
  5916. offset = closestHandle.offset();
  5917. mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
  5918. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  5919. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  5920. top: event.pageY - offset.top -
  5921. ( closestHandle.height() / 2 ) -
  5922. ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
  5923. ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
  5924. ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
  5925. };
  5926. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  5927. this._slide( event, index, normValue );
  5928. }
  5929. this._animateOff = true;
  5930. return true;
  5931. },
  5932. _mouseStart: function( event ) {
  5933. return true;
  5934. },
  5935. _mouseDrag: function( event ) {
  5936. var position = { x: event.pageX, y: event.pageY },
  5937. normValue = this._normValueFromMouse( position );
  5938. this._slide( event, this._handleIndex, normValue );
  5939. return false;
  5940. },
  5941. _mouseStop: function( event ) {
  5942. this.handles.removeClass( "ui-state-active" );
  5943. this._mouseSliding = false;
  5944. this._stop( event, this._handleIndex );
  5945. this._change( event, this._handleIndex );
  5946. this._handleIndex = null;
  5947. this._clickOffset = null;
  5948. this._animateOff = false;
  5949. return false;
  5950. },
  5951. _detectOrientation: function() {
  5952. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  5953. },
  5954. _normValueFromMouse: function( position ) {
  5955. var pixelTotal,
  5956. pixelMouse,
  5957. percentMouse,
  5958. valueTotal,
  5959. valueMouse;
  5960. if ( this.orientation === "horizontal" ) {
  5961. pixelTotal = this.elementSize.width;
  5962. pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
  5963. } else {
  5964. pixelTotal = this.elementSize.height;
  5965. pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
  5966. }
  5967. percentMouse = ( pixelMouse / pixelTotal );
  5968. if ( percentMouse > 1 ) {
  5969. percentMouse = 1;
  5970. }
  5971. if ( percentMouse < 0 ) {
  5972. percentMouse = 0;
  5973. }
  5974. if ( this.orientation === "vertical" ) {
  5975. percentMouse = 1 - percentMouse;
  5976. }
  5977. valueTotal = this._valueMax() - this._valueMin();
  5978. valueMouse = this._valueMin() + percentMouse * valueTotal;
  5979. return this._trimAlignValue( valueMouse );
  5980. },
  5981. _start: function( event, index ) {
  5982. var uiHash = {
  5983. handle: this.handles[ index ],
  5984. value: this.value()
  5985. };
  5986. if ( this.options.values && this.options.values.length ) {
  5987. uiHash.value = this.values( index );
  5988. uiHash.values = this.values();
  5989. }
  5990. return this._trigger( "start", event, uiHash );
  5991. },
  5992. _slide: function( event, index, newVal ) {
  5993. var otherVal,
  5994. newValues,
  5995. allowed;
  5996. if ( this.options.values && this.options.values.length ) {
  5997. otherVal = this.values( index ? 0 : 1 );
  5998. if ( ( this.options.values.length === 2 && this.options.range === true ) &&
  5999. ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
  6000. ) {
  6001. newVal = otherVal;
  6002. }
  6003. if ( newVal !== this.values( index ) ) {
  6004. newValues = this.values();
  6005. newValues[ index ] = newVal;
  6006. // A slide can be canceled by returning false from the slide callback
  6007. allowed = this._trigger( "slide", event, {
  6008. handle: this.handles[ index ],
  6009. value: newVal,
  6010. values: newValues
  6011. } );
  6012. otherVal = this.values( index ? 0 : 1 );
  6013. if ( allowed !== false ) {
  6014. this.values( index, newVal, true );
  6015. }
  6016. }
  6017. } else {
  6018. if ( newVal !== this.value() ) {
  6019. // A slide can be canceled by returning false from the slide callback
  6020. allowed = this._trigger( "slide", event, {
  6021. handle: this.handles[ index ],
  6022. value: newVal
  6023. } );
  6024. if ( allowed !== false ) {
  6025. this.value( newVal );
  6026. }
  6027. }
  6028. }
  6029. },
  6030. _stop: function( event, index ) {
  6031. var uiHash = {
  6032. handle: this.handles[ index ],
  6033. value: this.value()
  6034. };
  6035. if ( this.options.values && this.options.values.length ) {
  6036. uiHash.value = this.values( index );
  6037. uiHash.values = this.values();
  6038. }
  6039. this._trigger( "stop", event, uiHash );
  6040. },
  6041. _change: function( event, index ) {
  6042. if ( !this._keySliding && !this._mouseSliding ) {
  6043. var uiHash = {
  6044. handle: this.handles[ index ],
  6045. value: this.value()
  6046. };
  6047. if ( this.options.values && this.options.values.length ) {
  6048. uiHash.value = this.values( index );
  6049. uiHash.values = this.values();
  6050. }
  6051. this._trigger( "change", event, uiHash );
  6052. }
  6053. },
  6054. value: function( newValue ) {
  6055. if ( arguments.length ) {
  6056. this.options.value = this._trimAlignValue( newValue );
  6057. this._refreshValue();
  6058. this._change( null, 0 );
  6059. }
  6060. return this._value();
  6061. },
  6062. values: function( index, newValue ) {
  6063. var vals,
  6064. newValues,
  6065. i;
  6066. if ( arguments.length > 1 ) {
  6067. this.options.values[ index ] = this._trimAlignValue( newValue );
  6068. this._refreshValue();
  6069. this._change( null, index );
  6070. }
  6071. if ( arguments.length ) {
  6072. if ( $.isArray( arguments[ 0 ] ) ) {
  6073. vals = this.options.values;
  6074. newValues = arguments[ 0 ];
  6075. for ( i = 0; i < vals.length; i += 1 ) {
  6076. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  6077. this._change( null, i );
  6078. }
  6079. this._refreshValue();
  6080. } else {
  6081. if ( this.options.values && this.options.values.length ) {
  6082. return this._values( index );
  6083. } else {
  6084. return this.value();
  6085. }
  6086. }
  6087. } else {
  6088. return this._values();
  6089. }
  6090. },
  6091. _setOption: function( key, value ) {
  6092. var i,
  6093. valsLength = 0;
  6094. if ( $.isArray( this.options.values ) ) {
  6095. valsLength = this.options.values.length;
  6096. }
  6097. $.Widget.prototype._setOption.apply( this, arguments );
  6098. switch ( key ) {
  6099. case "disabled":
  6100. if ( value ) {
  6101. this.handles.filter( ".ui-state-focus" ).blur();
  6102. this.handles.removeClass( "ui-state-hover" );
  6103. this.handles.attr( "disabled", "disabled" );
  6104. this.element.addClass( "ui-disabled" );
  6105. } else {
  6106. this.handles.removeAttr( "disabled" );
  6107. this.element.removeClass( "ui-disabled" );
  6108. }
  6109. break;
  6110. case "orientation":
  6111. this._detectOrientation();
  6112. this.element
  6113. .removeClass( "ui-slider-horizontal ui-slider-vertical" )
  6114. .addClass( "ui-slider-" + this.orientation );
  6115. this._refreshValue();
  6116. break;
  6117. case "value":
  6118. this._animateOff = true;
  6119. this._refreshValue();
  6120. this._change( null, 0 );
  6121. this._animateOff = false;
  6122. break;
  6123. case "values":
  6124. this._animateOff = true;
  6125. this._refreshValue();
  6126. for ( i = 0; i < valsLength; i += 1 ) {
  6127. this._change( null, i );
  6128. }
  6129. this._animateOff = false;
  6130. break;
  6131. }
  6132. },
  6133. //internal value getter
  6134. // _value() returns value trimmed by min and max, aligned by step
  6135. _value: function() {
  6136. var val = this.options.value;
  6137. val = this._trimAlignValue( val );
  6138. return val;
  6139. },
  6140. //internal values getter
  6141. // _values() returns array of values trimmed by min and max, aligned by step
  6142. // _values( index ) returns single value trimmed by min and max, aligned by step
  6143. _values: function( index ) {
  6144. var val,
  6145. vals,
  6146. i;
  6147. if ( arguments.length ) {
  6148. val = this.options.values[ index ];
  6149. val = this._trimAlignValue( val );
  6150. return val;
  6151. } else {
  6152. // .slice() creates a copy of the array
  6153. // this copy gets trimmed by min and max and then returned
  6154. vals = this.options.values.slice();
  6155. for ( i = 0; i < vals.length; i+= 1) {
  6156. vals[ i ] = this._trimAlignValue( vals[ i ] );
  6157. }
  6158. return vals;
  6159. }
  6160. },
  6161. // returns the step-aligned value that val is closest to, between (inclusive) min and max
  6162. _trimAlignValue: function( val ) {
  6163. if ( val <= this._valueMin() ) {
  6164. return this._valueMin();
  6165. }
  6166. if ( val >= this._valueMax() ) {
  6167. return this._valueMax();
  6168. }
  6169. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  6170. valModStep = (val - this._valueMin()) % step;
  6171. alignValue = val - valModStep;
  6172. if ( Math.abs(valModStep) * 2 >= step ) {
  6173. alignValue += ( valModStep > 0 ) ? step : ( -step );
  6174. }
  6175. // Since JavaScript has problems with large floats, round
  6176. // the final value to 5 digits after the decimal point (see #4124)
  6177. return parseFloat( alignValue.toFixed(5) );
  6178. },
  6179. _valueMin: function() {
  6180. return this.options.min;
  6181. },
  6182. _valueMax: function() {
  6183. return this.options.max;
  6184. },
  6185. _refreshValue: function() {
  6186. var oRange = this.options.range,
  6187. o = this.options,
  6188. self = this,
  6189. animate = ( !this._animateOff ) ? o.animate : false,
  6190. valPercent,
  6191. _set = {},
  6192. lastValPercent,
  6193. value,
  6194. valueMin,
  6195. valueMax;
  6196. if ( this.options.values && this.options.values.length ) {
  6197. this.handles.each(function( i, j ) {
  6198. valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
  6199. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  6200. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  6201. if ( self.options.range === true ) {
  6202. if ( self.orientation === "horizontal" ) {
  6203. if ( i === 0 ) {
  6204. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
  6205. }
  6206. if ( i === 1 ) {
  6207. self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  6208. }
  6209. } else {
  6210. if ( i === 0 ) {
  6211. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
  6212. }
  6213. if ( i === 1 ) {
  6214. self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  6215. }
  6216. }
  6217. }
  6218. lastValPercent = valPercent;
  6219. });
  6220. } else {
  6221. value = this.value();
  6222. valueMin = this._valueMin();
  6223. valueMax = this._valueMax();
  6224. valPercent = ( valueMax !== valueMin ) ?
  6225. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  6226. 0;
  6227. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  6228. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  6229. if ( oRange === "min" && this.orientation === "horizontal" ) {
  6230. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
  6231. }
  6232. if ( oRange === "max" && this.orientation === "horizontal" ) {
  6233. this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  6234. }
  6235. if ( oRange === "min" && this.orientation === "vertical" ) {
  6236. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
  6237. }
  6238. if ( oRange === "max" && this.orientation === "vertical" ) {
  6239. this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  6240. }
  6241. }
  6242. }
  6243. });
  6244. $.extend( $.ui.slider, {
  6245. version: "1.8.11"
  6246. });
  6247. }(jQuery));
  6248. /*
  6249. * Note: While Microsoft is not the author of this file, Microsoft is
  6250. * offering you a license subject to the terms of the Microsoft Software
  6251. * License Terms for Microsoft ASP.NET Model View Controller 3.
  6252. * Microsoft reserves all other rights. The notices below are provided
  6253. * for informational purposes only and are not the license terms under
  6254. * which Microsoft distributed this file.
  6255. *
  6256. * jQuery UI Tabs 1.8.11
  6257. *
  6258. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  6259. *
  6260. * http://docs.jquery.com/UI/Tabs
  6261. *
  6262. * Depends:
  6263. * jquery.ui.core.js
  6264. * jquery.ui.widget.js
  6265. */
  6266. (function( $, undefined ) {
  6267. var tabId = 0,
  6268. listId = 0;
  6269. function getNextTabId() {
  6270. return ++tabId;
  6271. }
  6272. function getNextListId() {
  6273. return ++listId;
  6274. }
  6275. $.widget( "ui.tabs", {
  6276. options: {
  6277. add: null,
  6278. ajaxOptions: null,
  6279. cache: false,
  6280. cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
  6281. collapsible: false,
  6282. disable: null,
  6283. disabled: [],
  6284. enable: null,
  6285. event: "click",
  6286. fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
  6287. idPrefix: "ui-tabs-",
  6288. load: null,
  6289. panelTemplate: "<div></div>",
  6290. remove: null,
  6291. select: null,
  6292. show: null,
  6293. spinner: "<em>Loading&#8230;</em>",
  6294. tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
  6295. },
  6296. _create: function() {
  6297. this._tabify( true );
  6298. },
  6299. _setOption: function( key, value ) {
  6300. if ( key == "selected" ) {
  6301. if (this.options.collapsible && value == this.options.selected ) {
  6302. return;
  6303. }
  6304. this.select( value );
  6305. } else {
  6306. this.options[ key ] = value;
  6307. this._tabify();
  6308. }
  6309. },
  6310. _tabId: function( a ) {
  6311. return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
  6312. this.options.idPrefix + getNextTabId();
  6313. },
  6314. _sanitizeSelector: function( hash ) {
  6315. // we need this because an id may contain a ":"
  6316. return hash.replace( /:/g, "\\:" );
  6317. },
  6318. _cookie: function() {
  6319. var cookie = this.cookie ||
  6320. ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
  6321. return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
  6322. },
  6323. _ui: function( tab, panel ) {
  6324. return {
  6325. tab: tab,
  6326. panel: panel,
  6327. index: this.anchors.index( tab )
  6328. };
  6329. },
  6330. _cleanup: function() {
  6331. // restore all former loading tabs labels
  6332. this.lis.filter( ".ui-state-processing" )
  6333. .removeClass( "ui-state-processing" )
  6334. .find( "span:data(label.tabs)" )
  6335. .each(function() {
  6336. var el = $( this );
  6337. el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
  6338. });
  6339. },
  6340. _tabify: function( init ) {
  6341. var self = this,
  6342. o = this.options,
  6343. fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
  6344. this.list = this.element.find( "ol,ul" ).eq( 0 );
  6345. this.lis = $( " > li:has(a[href])", this.list );
  6346. this.anchors = this.lis.map(function() {
  6347. return $( "a", this )[ 0 ];
  6348. });
  6349. this.panels = $( [] );
  6350. this.anchors.each(function( i, a ) {
  6351. var href = $( a ).attr( "href" );
  6352. // For dynamically created HTML that contains a hash as href IE < 8 expands
  6353. // such href to the full page url with hash and then misinterprets tab as ajax.
  6354. // Same consideration applies for an added tab with a fragment identifier
  6355. // since a[href=#fragment-identifier] does unexpectedly not match.
  6356. // Thus normalize href attribute...
  6357. var hrefBase = href.split( "#" )[ 0 ],
  6358. baseEl;
  6359. if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
  6360. ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
  6361. href = a.hash;
  6362. a.href = href;
  6363. }
  6364. // inline tab
  6365. if ( fragmentId.test( href ) ) {
  6366. self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
  6367. // remote tab
  6368. // prevent loading the page itself if href is just "#"
  6369. } else if ( href && href !== "#" ) {
  6370. // required for restore on destroy
  6371. $.data( a, "href.tabs", href );
  6372. // TODO until #3808 is fixed strip fragment identifier from url
  6373. // (IE fails to load from such url)
  6374. $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
  6375. var id = self._tabId( a );
  6376. a.href = "#" + id;
  6377. var $panel = self.element.find( "#" + id );
  6378. if ( !$panel.length ) {
  6379. $panel = $( o.panelTemplate )
  6380. .attr( "id", id )
  6381. .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  6382. .insertAfter( self.panels[ i - 1 ] || self.list );
  6383. $panel.data( "destroy.tabs", true );
  6384. }
  6385. self.panels = self.panels.add( $panel );
  6386. // invalid tab href
  6387. } else {
  6388. o.disabled.push( i );
  6389. }
  6390. });
  6391. // initialization from scratch
  6392. if ( init ) {
  6393. // attach necessary classes for styling
  6394. this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
  6395. this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  6396. this.lis.addClass( "ui-state-default ui-corner-top" );
  6397. this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
  6398. // Selected tab
  6399. // use "selected" option or try to retrieve:
  6400. // 1. from fragment identifier in url
  6401. // 2. from cookie
  6402. // 3. from selected class attribute on <li>
  6403. if ( o.selected === undefined ) {
  6404. if ( location.hash ) {
  6405. this.anchors.each(function( i, a ) {
  6406. if ( a.hash == location.hash ) {
  6407. o.selected = i;
  6408. return false;
  6409. }
  6410. });
  6411. }
  6412. if ( typeof o.selected !== "number" && o.cookie ) {
  6413. o.selected = parseInt( self._cookie(), 10 );
  6414. }
  6415. if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
  6416. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  6417. }
  6418. o.selected = o.selected || ( this.lis.length ? 0 : -1 );
  6419. } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
  6420. o.selected = -1;
  6421. }
  6422. // sanity check - default to first tab...
  6423. o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
  6424. ? o.selected
  6425. : 0;
  6426. // Take disabling tabs via class attribute from HTML
  6427. // into account and update option properly.
  6428. // A selected tab cannot become disabled.
  6429. o.disabled = $.unique( o.disabled.concat(
  6430. $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
  6431. return self.lis.index( n );
  6432. })
  6433. ) ).sort();
  6434. if ( $.inArray( o.selected, o.disabled ) != -1 ) {
  6435. o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
  6436. }
  6437. // highlight selected tab
  6438. this.panels.addClass( "ui-tabs-hide" );
  6439. this.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6440. // check for length avoids error when initializing empty list
  6441. if ( o.selected >= 0 && this.anchors.length ) {
  6442. self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
  6443. this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
  6444. // seems to be expected behavior that the show callback is fired
  6445. self.element.queue( "tabs", function() {
  6446. self._trigger( "show", null,
  6447. self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
  6448. });
  6449. this.load( o.selected );
  6450. }
  6451. // clean up to avoid memory leaks in certain versions of IE 6
  6452. // TODO: namespace this event
  6453. $( window ).bind( "unload", function() {
  6454. self.lis.add( self.anchors ).unbind( ".tabs" );
  6455. self.lis = self.anchors = self.panels = null;
  6456. });
  6457. // update selected after add/remove
  6458. } else {
  6459. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  6460. }
  6461. // update collapsible
  6462. // TODO: use .toggleClass()
  6463. this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
  6464. // set or update cookie after init and add/remove respectively
  6465. if ( o.cookie ) {
  6466. this._cookie( o.selected, o.cookie );
  6467. }
  6468. // disable tabs
  6469. for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
  6470. $( li )[ $.inArray( i, o.disabled ) != -1 &&
  6471. // TODO: use .toggleClass()
  6472. !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
  6473. }
  6474. // reset cache if switching from cached to not cached
  6475. if ( o.cache === false ) {
  6476. this.anchors.removeData( "cache.tabs" );
  6477. }
  6478. // remove all handlers before, tabify may run on existing tabs after add or option change
  6479. this.lis.add( this.anchors ).unbind( ".tabs" );
  6480. if ( o.event !== "mouseover" ) {
  6481. var addState = function( state, el ) {
  6482. if ( el.is( ":not(.ui-state-disabled)" ) ) {
  6483. el.addClass( "ui-state-" + state );
  6484. }
  6485. };
  6486. var removeState = function( state, el ) {
  6487. el.removeClass( "ui-state-" + state );
  6488. };
  6489. this.lis.bind( "mouseover.tabs" , function() {
  6490. addState( "hover", $( this ) );
  6491. });
  6492. this.lis.bind( "mouseout.tabs", function() {
  6493. removeState( "hover", $( this ) );
  6494. });
  6495. this.anchors.bind( "focus.tabs", function() {
  6496. addState( "focus", $( this ).closest( "li" ) );
  6497. });
  6498. this.anchors.bind( "blur.tabs", function() {
  6499. removeState( "focus", $( this ).closest( "li" ) );
  6500. });
  6501. }
  6502. // set up animations
  6503. var hideFx, showFx;
  6504. if ( o.fx ) {
  6505. if ( $.isArray( o.fx ) ) {
  6506. hideFx = o.fx[ 0 ];
  6507. showFx = o.fx[ 1 ];
  6508. } else {
  6509. hideFx = showFx = o.fx;
  6510. }
  6511. }
  6512. // Reset certain styles left over from animation
  6513. // and prevent IE's ClearType bug...
  6514. function resetStyle( $el, fx ) {
  6515. $el.css( "display", "" );
  6516. if ( !$.support.opacity && fx.opacity ) {
  6517. $el[ 0 ].style.removeAttribute( "filter" );
  6518. }
  6519. }
  6520. // Show a tab...
  6521. var showTab = showFx
  6522. ? function( clicked, $show ) {
  6523. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  6524. $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
  6525. .animate( showFx, showFx.duration || "normal", function() {
  6526. resetStyle( $show, showFx );
  6527. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  6528. });
  6529. }
  6530. : function( clicked, $show ) {
  6531. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  6532. $show.removeClass( "ui-tabs-hide" );
  6533. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  6534. };
  6535. // Hide a tab, $show is optional...
  6536. var hideTab = hideFx
  6537. ? function( clicked, $hide ) {
  6538. $hide.animate( hideFx, hideFx.duration || "normal", function() {
  6539. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6540. $hide.addClass( "ui-tabs-hide" );
  6541. resetStyle( $hide, hideFx );
  6542. self.element.dequeue( "tabs" );
  6543. });
  6544. }
  6545. : function( clicked, $hide, $show ) {
  6546. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6547. $hide.addClass( "ui-tabs-hide" );
  6548. self.element.dequeue( "tabs" );
  6549. };
  6550. // attach tab event handler, unbind to avoid duplicates from former tabifying...
  6551. this.anchors.bind( o.event + ".tabs", function() {
  6552. var el = this,
  6553. $li = $(el).closest( "li" ),
  6554. $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
  6555. $show = self.element.find( self._sanitizeSelector( el.hash ) );
  6556. // If tab is already selected and not collapsible or tab disabled or
  6557. // or is already loading or click callback returns false stop here.
  6558. // Check if click handler returns false last so that it is not executed
  6559. // for a disabled or loading tab!
  6560. if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
  6561. $li.hasClass( "ui-state-disabled" ) ||
  6562. $li.hasClass( "ui-state-processing" ) ||
  6563. self.panels.filter( ":animated" ).length ||
  6564. self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
  6565. this.blur();
  6566. return false;
  6567. }
  6568. o.selected = self.anchors.index( this );
  6569. self.abort();
  6570. // if tab may be closed
  6571. if ( o.collapsible ) {
  6572. if ( $li.hasClass( "ui-tabs-selected" ) ) {
  6573. o.selected = -1;
  6574. if ( o.cookie ) {
  6575. self._cookie( o.selected, o.cookie );
  6576. }
  6577. self.element.queue( "tabs", function() {
  6578. hideTab( el, $hide );
  6579. }).dequeue( "tabs" );
  6580. this.blur();
  6581. return false;
  6582. } else if ( !$hide.length ) {
  6583. if ( o.cookie ) {
  6584. self._cookie( o.selected, o.cookie );
  6585. }
  6586. self.element.queue( "tabs", function() {
  6587. showTab( el, $show );
  6588. });
  6589. // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
  6590. self.load( self.anchors.index( this ) );
  6591. this.blur();
  6592. return false;
  6593. }
  6594. }
  6595. if ( o.cookie ) {
  6596. self._cookie( o.selected, o.cookie );
  6597. }
  6598. // show new tab
  6599. if ( $show.length ) {
  6600. if ( $hide.length ) {
  6601. self.element.queue( "tabs", function() {
  6602. hideTab( el, $hide );
  6603. });
  6604. }
  6605. self.element.queue( "tabs", function() {
  6606. showTab( el, $show );
  6607. });
  6608. self.load( self.anchors.index( this ) );
  6609. } else {
  6610. throw "jQuery UI Tabs: Mismatching fragment identifier.";
  6611. }
  6612. // Prevent IE from keeping other link focussed when using the back button
  6613. // and remove dotted border from clicked link. This is controlled via CSS
  6614. // in modern browsers; blur() removes focus from address bar in Firefox
  6615. // which can become a usability and annoying problem with tabs('rotate').
  6616. if ( $.browser.msie ) {
  6617. this.blur();
  6618. }
  6619. });
  6620. // disable click in any case
  6621. this.anchors.bind( "click.tabs", function(){
  6622. return false;
  6623. });
  6624. },
  6625. _getIndex: function( index ) {
  6626. // meta-function to give users option to provide a href string instead of a numerical index.
  6627. // also sanitizes numerical indexes to valid values.
  6628. if ( typeof index == "string" ) {
  6629. index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
  6630. }
  6631. return index;
  6632. },
  6633. destroy: function() {
  6634. var o = this.options;
  6635. this.abort();
  6636. this.element
  6637. .unbind( ".tabs" )
  6638. .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
  6639. .removeData( "tabs" );
  6640. this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  6641. this.anchors.each(function() {
  6642. var href = $.data( this, "href.tabs" );
  6643. if ( href ) {
  6644. this.href = href;
  6645. }
  6646. var $this = $( this ).unbind( ".tabs" );
  6647. $.each( [ "href", "load", "cache" ], function( i, prefix ) {
  6648. $this.removeData( prefix + ".tabs" );
  6649. });
  6650. });
  6651. this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
  6652. if ( $.data( this, "destroy.tabs" ) ) {
  6653. $( this ).remove();
  6654. } else {
  6655. $( this ).removeClass([
  6656. "ui-state-default",
  6657. "ui-corner-top",
  6658. "ui-tabs-selected",
  6659. "ui-state-active",
  6660. "ui-state-hover",
  6661. "ui-state-focus",
  6662. "ui-state-disabled",
  6663. "ui-tabs-panel",
  6664. "ui-widget-content",
  6665. "ui-corner-bottom",
  6666. "ui-tabs-hide"
  6667. ].join( " " ) );
  6668. }
  6669. });
  6670. if ( o.cookie ) {
  6671. this._cookie( null, o.cookie );
  6672. }
  6673. return this;
  6674. },
  6675. add: function( url, label, index ) {
  6676. if ( index === undefined ) {
  6677. index = this.anchors.length;
  6678. }
  6679. var self = this,
  6680. o = this.options,
  6681. $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
  6682. id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
  6683. $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
  6684. // try to find an existing element before creating a new one
  6685. var $panel = self.element.find( "#" + id );
  6686. if ( !$panel.length ) {
  6687. $panel = $( o.panelTemplate )
  6688. .attr( "id", id )
  6689. .data( "destroy.tabs", true );
  6690. }
  6691. $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
  6692. if ( index >= this.lis.length ) {
  6693. $li.appendTo( this.list );
  6694. $panel.appendTo( this.list[ 0 ].parentNode );
  6695. } else {
  6696. $li.insertBefore( this.lis[ index ] );
  6697. $panel.insertBefore( this.panels[ index ] );
  6698. }
  6699. o.disabled = $.map( o.disabled, function( n, i ) {
  6700. return n >= index ? ++n : n;
  6701. });
  6702. this._tabify();
  6703. if ( this.anchors.length == 1 ) {
  6704. o.selected = 0;
  6705. $li.addClass( "ui-tabs-selected ui-state-active" );
  6706. $panel.removeClass( "ui-tabs-hide" );
  6707. this.element.queue( "tabs", function() {
  6708. self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
  6709. });
  6710. this.load( 0 );
  6711. }
  6712. this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6713. return this;
  6714. },
  6715. remove: function( index ) {
  6716. index = this._getIndex( index );
  6717. var o = this.options,
  6718. $li = this.lis.eq( index ).remove(),
  6719. $panel = this.panels.eq( index ).remove();
  6720. // If selected tab was removed focus tab to the right or
  6721. // in case the last tab was removed the tab to the left.
  6722. if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
  6723. this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
  6724. }
  6725. o.disabled = $.map(
  6726. $.grep( o.disabled, function(n, i) {
  6727. return n != index;
  6728. }),
  6729. function( n, i ) {
  6730. return n >= index ? --n : n;
  6731. });
  6732. this._tabify();
  6733. this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
  6734. return this;
  6735. },
  6736. enable: function( index ) {
  6737. index = this._getIndex( index );
  6738. var o = this.options;
  6739. if ( $.inArray( index, o.disabled ) == -1 ) {
  6740. return;
  6741. }
  6742. this.lis.eq( index ).removeClass( "ui-state-disabled" );
  6743. o.disabled = $.grep( o.disabled, function( n, i ) {
  6744. return n != index;
  6745. });
  6746. this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6747. return this;
  6748. },
  6749. disable: function( index ) {
  6750. index = this._getIndex( index );
  6751. var self = this, o = this.options;
  6752. // cannot disable already selected tab
  6753. if ( index != o.selected ) {
  6754. this.lis.eq( index ).addClass( "ui-state-disabled" );
  6755. o.disabled.push( index );
  6756. o.disabled.sort();
  6757. this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6758. }
  6759. return this;
  6760. },
  6761. select: function( index ) {
  6762. index = this._getIndex( index );
  6763. if ( index == -1 ) {
  6764. if ( this.options.collapsible && this.options.selected != -1 ) {
  6765. index = this.options.selected;
  6766. } else {
  6767. return this;
  6768. }
  6769. }
  6770. this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
  6771. return this;
  6772. },
  6773. load: function( index ) {
  6774. index = this._getIndex( index );
  6775. var self = this,
  6776. o = this.options,
  6777. a = this.anchors.eq( index )[ 0 ],
  6778. url = $.data( a, "load.tabs" );
  6779. this.abort();
  6780. // not remote or from cache
  6781. if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
  6782. this.element.dequeue( "tabs" );
  6783. return;
  6784. }
  6785. // load remote from here on
  6786. this.lis.eq( index ).addClass( "ui-state-processing" );
  6787. if ( o.spinner ) {
  6788. var span = $( "span", a );
  6789. span.data( "label.tabs", span.html() ).html( o.spinner );
  6790. }
  6791. this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
  6792. url: url,
  6793. success: function( r, s ) {
  6794. self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
  6795. // take care of tab labels
  6796. self._cleanup();
  6797. if ( o.cache ) {
  6798. $.data( a, "cache.tabs", true );
  6799. }
  6800. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  6801. try {
  6802. o.ajaxOptions.success( r, s );
  6803. }
  6804. catch ( e ) {}
  6805. },
  6806. error: function( xhr, s, e ) {
  6807. // take care of tab labels
  6808. self._cleanup();
  6809. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  6810. try {
  6811. // Passing index avoid a race condition when this method is
  6812. // called after the user has selected another tab.
  6813. // Pass the anchor that initiated this request allows
  6814. // loadError to manipulate the tab content panel via $(a.hash)
  6815. o.ajaxOptions.error( xhr, s, index, a );
  6816. }
  6817. catch ( e ) {}
  6818. }
  6819. } ) );
  6820. // last, so that load event is fired before show...
  6821. self.element.dequeue( "tabs" );
  6822. return this;
  6823. },
  6824. abort: function() {
  6825. // stop possibly running animations
  6826. this.element.queue( [] );
  6827. this.panels.stop( false, true );
  6828. // "tabs" queue must not contain more than two elements,
  6829. // which are the callbacks for the latest clicked tab...
  6830. this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
  6831. // terminate pending requests from other tabs
  6832. if ( this.xhr ) {
  6833. this.xhr.abort();
  6834. delete this.xhr;
  6835. }
  6836. // take care of tab labels
  6837. this._cleanup();
  6838. return this;
  6839. },
  6840. url: function( index, url ) {
  6841. this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
  6842. return this;
  6843. },
  6844. length: function() {
  6845. return this.anchors.length;
  6846. }
  6847. });
  6848. $.extend( $.ui.tabs, {
  6849. version: "1.8.11"
  6850. });
  6851. /*
  6852. * Tabs Extensions
  6853. */
  6854. /*
  6855. * Rotate
  6856. */
  6857. $.extend( $.ui.tabs.prototype, {
  6858. rotation: null,
  6859. rotate: function( ms, continuing ) {
  6860. var self = this,
  6861. o = this.options;
  6862. var rotate = self._rotate || ( self._rotate = function( e ) {
  6863. clearTimeout( self.rotation );
  6864. self.rotation = setTimeout(function() {
  6865. var t = o.selected;
  6866. self.select( ++t < self.anchors.length ? t : 0 );
  6867. }, ms );
  6868. if ( e ) {
  6869. e.stopPropagation();
  6870. }
  6871. });
  6872. var stop = self._unrotate || ( self._unrotate = !continuing
  6873. ? function(e) {
  6874. if (e.clientX) { // in case of a true click
  6875. self.rotate(null);
  6876. }
  6877. }
  6878. : function( e ) {
  6879. t = o.selected;
  6880. rotate();
  6881. });
  6882. // start rotation
  6883. if ( ms ) {
  6884. this.element.bind( "tabsshow", rotate );
  6885. this.anchors.bind( o.event + ".tabs", stop );
  6886. rotate();
  6887. // stop rotation
  6888. } else {
  6889. clearTimeout( self.rotation );
  6890. this.element.unbind( "tabsshow", rotate );
  6891. this.anchors.unbind( o.event + ".tabs", stop );
  6892. delete this._rotate;
  6893. delete this._unrotate;
  6894. }
  6895. return this;
  6896. }
  6897. });
  6898. })( jQuery );
  6899. /*
  6900. * Note: While Microsoft is not the author of this file, Microsoft is
  6901. * offering you a license subject to the terms of the Microsoft Software
  6902. * License Terms for Microsoft ASP.NET Model View Controller 3.
  6903. * Microsoft reserves all other rights. The notices below are provided
  6904. * for informational purposes only and are not the license terms under
  6905. * which Microsoft distributed this file.
  6906. *
  6907. * jQuery UI Datepicker 1.8.11
  6908. *
  6909. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  6910. *
  6911. * http://docs.jquery.com/UI/Datepicker
  6912. *
  6913. * Depends:
  6914. * jquery.ui.core.js
  6915. */
  6916. (function( $, undefined ) {
  6917. $.extend($.ui, { datepicker: { version: "1.8.11" } });
  6918. var PROP_NAME = 'datepicker';
  6919. var dpuuid = new Date().getTime();
  6920. /* Date picker manager.
  6921. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  6922. Settings for (groups of) date pickers are maintained in an instance object,
  6923. allowing multiple different settings on the same page. */
  6924. function Datepicker() {
  6925. this.debug = false; // Change this to true to start debugging
  6926. this._curInst = null; // The current instance in use
  6927. this._keyEvent = false; // If the last event was a key event
  6928. this._disabledInputs = []; // List of date picker inputs that have been disabled
  6929. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  6930. this._inDialog = false; // True if showing within a "dialog", false if not
  6931. this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
  6932. this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
  6933. this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
  6934. this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
  6935. this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
  6936. this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
  6937. this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
  6938. this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
  6939. this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
  6940. this.regional = []; // Available regional settings, indexed by language code
  6941. this.regional[''] = { // Default regional settings
  6942. closeText: 'Done', // Display text for close link
  6943. prevText: 'Prev', // Display text for previous month link
  6944. nextText: 'Next', // Display text for next month link
  6945. currentText: 'Today', // Display text for current month link
  6946. monthNames: ['January','February','March','April','May','June',
  6947. 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
  6948. monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
  6949. dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
  6950. dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
  6951. dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
  6952. weekHeader: 'Wk', // Column header for week of the year
  6953. dateFormat: 'mm/dd/yy', // See format options on parseDate
  6954. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  6955. isRTL: false, // True if right-to-left language, false if left-to-right
  6956. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  6957. yearSuffix: '' // Additional text to append to the year in the month headers
  6958. };
  6959. this._defaults = { // Global defaults for all the date picker instances
  6960. showOn: 'focus', // 'focus' for popup on focus,
  6961. // 'button' for trigger button, or 'both' for either
  6962. showAnim: 'fadeIn', // Name of jQuery animation for popup
  6963. showOptions: {}, // Options for enhanced animations
  6964. defaultDate: null, // Used when field is blank: actual date,
  6965. // +/-number for offset from today, null for today
  6966. appendText: '', // Display text following the input box, e.g. showing the format
  6967. buttonText: '...', // Text for trigger button
  6968. buttonImage: '', // URL for trigger button image
  6969. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  6970. hideIfNoPrevNext: false, // True to hide next/previous month links
  6971. // if not applicable, false to just disable them
  6972. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  6973. gotoCurrent: false, // True if today link goes back to current selection instead
  6974. changeMonth: false, // True if month can be selected directly, false if only prev/next
  6975. changeYear: false, // True if year can be selected directly, false if only prev/next
  6976. yearRange: 'c-10:c+10', // Range of years to display in drop-down,
  6977. // either relative to today's year (-nn:+nn), relative to currently displayed year
  6978. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  6979. showOtherMonths: false, // True to show dates in other months, false to leave blank
  6980. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  6981. showWeek: false, // True to show week of the year, false to not show it
  6982. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  6983. // takes a Date and returns the number of the week for it
  6984. shortYearCutoff: '+10', // Short year values < this are in the current century,
  6985. // > this are in the previous century,
  6986. // string value starting with '+' for current year + value
  6987. minDate: null, // The earliest selectable date, or null for no limit
  6988. maxDate: null, // The latest selectable date, or null for no limit
  6989. duration: 'fast', // Duration of display/closure
  6990. beforeShowDay: null, // Function that takes a date and returns an array with
  6991. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
  6992. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6993. beforeShow: null, // Function that takes an input field and
  6994. // returns a set of custom settings for the date picker
  6995. onSelect: null, // Define a callback function when a date is selected
  6996. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  6997. onClose: null, // Define a callback function when the datepicker is closed
  6998. numberOfMonths: 1, // Number of months to show at a time
  6999. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  7000. stepMonths: 1, // Number of months to step back/forward
  7001. stepBigMonths: 12, // Number of months to step back/forward for the big links
  7002. altField: '', // Selector for an alternate field to store selected dates into
  7003. altFormat: '', // The date format to use for the alternate field
  7004. constrainInput: true, // The input is constrained by the current date format
  7005. showButtonPanel: false, // True to show button panel, false to not show it
  7006. autoSize: false // True to size the input for the date format, false to leave as is
  7007. };
  7008. $.extend(this._defaults, this.regional['']);
  7009. this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>');
  7010. }
  7011. $.extend(Datepicker.prototype, {
  7012. /* Class name added to elements to indicate already configured with a date picker. */
  7013. markerClassName: 'hasDatepicker',
  7014. /* Debug logging (if enabled). */
  7015. log: function () {
  7016. if (this.debug)
  7017. console.log.apply('', arguments);
  7018. },
  7019. // TODO rename to "widget" when switching to widget factory
  7020. _widgetDatepicker: function() {
  7021. return this.dpDiv;
  7022. },
  7023. /* Override the default settings for all instances of the date picker.
  7024. @param settings object - the new settings to use as defaults (anonymous object)
  7025. @return the manager object */
  7026. setDefaults: function(settings) {
  7027. extendRemove(this._defaults, settings || {});
  7028. return this;
  7029. },
  7030. /* Attach the date picker to a jQuery selection.
  7031. @param target element - the target input field or division or span
  7032. @param settings object - the new settings to use for this date picker instance (anonymous) */
  7033. _attachDatepicker: function(target, settings) {
  7034. // check for settings on the control itself - in namespace 'date:'
  7035. var inlineSettings = null;
  7036. for (var attrName in this._defaults) {
  7037. var attrValue = target.getAttribute('date:' + attrName);
  7038. if (attrValue) {
  7039. inlineSettings = inlineSettings || {};
  7040. try {
  7041. inlineSettings[attrName] = eval(attrValue);
  7042. } catch (err) {
  7043. inlineSettings[attrName] = attrValue;
  7044. }
  7045. }
  7046. }
  7047. var nodeName = target.nodeName.toLowerCase();
  7048. var inline = (nodeName == 'div' || nodeName == 'span');
  7049. if (!target.id) {
  7050. this.uuid += 1;
  7051. target.id = 'dp' + this.uuid;
  7052. }
  7053. var inst = this._newInst($(target), inline);
  7054. inst.settings = $.extend({}, settings || {}, inlineSettings || {});
  7055. if (nodeName == 'input') {
  7056. this._connectDatepicker(target, inst);
  7057. } else if (inline) {
  7058. this._inlineDatepicker(target, inst);
  7059. }
  7060. },
  7061. /* Create a new instance object. */
  7062. _newInst: function(target, inline) {
  7063. var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
  7064. return {id: id, input: target, // associated target
  7065. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  7066. drawMonth: 0, drawYear: 0, // month being drawn
  7067. inline: inline, // is datepicker inline or not
  7068. dpDiv: (!inline ? this.dpDiv : // presentation div
  7069. $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
  7070. },
  7071. /* Attach the date picker to an input field. */
  7072. _connectDatepicker: function(target, inst) {
  7073. var input = $(target);
  7074. inst.append = $([]);
  7075. inst.trigger = $([]);
  7076. if (input.hasClass(this.markerClassName))
  7077. return;
  7078. this._attachments(input, inst);
  7079. input.addClass(this.markerClassName).keydown(this._doKeyDown).
  7080. keypress(this._doKeyPress).keyup(this._doKeyUp).
  7081. bind("setData.datepicker", function(event, key, value) {
  7082. inst.settings[key] = value;
  7083. }).bind("getData.datepicker", function(event, key) {
  7084. return this._get(inst, key);
  7085. });
  7086. this._autoSize(inst);
  7087. $.data(target, PROP_NAME, inst);
  7088. },
  7089. /* Make attachments based on settings. */
  7090. _attachments: function(input, inst) {
  7091. var appendText = this._get(inst, 'appendText');
  7092. var isRTL = this._get(inst, 'isRTL');
  7093. if (inst.append)
  7094. inst.append.remove();
  7095. if (appendText) {
  7096. inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
  7097. input[isRTL ? 'before' : 'after'](inst.append);
  7098. }
  7099. input.unbind('focus', this._showDatepicker);
  7100. if (inst.trigger)
  7101. inst.trigger.remove();
  7102. var showOn = this._get(inst, 'showOn');
  7103. if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
  7104. input.focus(this._showDatepicker);
  7105. if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
  7106. var buttonText = this._get(inst, 'buttonText');
  7107. var buttonImage = this._get(inst, 'buttonImage');
  7108. inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
  7109. $('<img/>').addClass(this._triggerClass).
  7110. attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  7111. $('<button type="button"></button>').addClass(this._triggerClass).
  7112. html(buttonImage == '' ? buttonText : $('<img/>').attr(
  7113. { src:buttonImage, alt:buttonText, title:buttonText })));
  7114. input[isRTL ? 'before' : 'after'](inst.trigger);
  7115. inst.trigger.click(function() {
  7116. if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
  7117. $.datepicker._hideDatepicker();
  7118. else
  7119. $.datepicker._showDatepicker(input[0]);
  7120. return false;
  7121. });
  7122. }
  7123. },
  7124. /* Apply the maximum length for the date format. */
  7125. _autoSize: function(inst) {
  7126. if (this._get(inst, 'autoSize') && !inst.inline) {
  7127. var date = new Date(2009, 12 - 1, 20); // Ensure double digits
  7128. var dateFormat = this._get(inst, 'dateFormat');
  7129. if (dateFormat.match(/[DM]/)) {
  7130. var findMax = function(names) {
  7131. var max = 0;
  7132. var maxI = 0;
  7133. for (var i = 0; i < names.length; i++) {
  7134. if (names[i].length > max) {
  7135. max = names[i].length;
  7136. maxI = i;
  7137. }
  7138. }
  7139. return maxI;
  7140. };
  7141. date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  7142. 'monthNames' : 'monthNamesShort'))));
  7143. date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  7144. 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
  7145. }
  7146. inst.input.attr('size', this._formatDate(inst, date).length);
  7147. }
  7148. },
  7149. /* Attach an inline date picker to a div. */
  7150. _inlineDatepicker: function(target, inst) {
  7151. var divSpan = $(target);
  7152. if (divSpan.hasClass(this.markerClassName))
  7153. return;
  7154. divSpan.addClass(this.markerClassName).append(inst.dpDiv).
  7155. bind("setData.datepicker", function(event, key, value){
  7156. inst.settings[key] = value;
  7157. }).bind("getData.datepicker", function(event, key){
  7158. return this._get(inst, key);
  7159. });
  7160. $.data(target, PROP_NAME, inst);
  7161. this._setDate(inst, this._getDefaultDate(inst), true);
  7162. this._updateDatepicker(inst);
  7163. this._updateAlternate(inst);
  7164. inst.dpDiv.show();
  7165. },
  7166. /* Pop-up the date picker in a "dialog" box.
  7167. @param input element - ignored
  7168. @param date string or Date - the initial date to display
  7169. @param onSelect function - the function to call when a date is selected
  7170. @param settings object - update the dialog date picker instance's settings (anonymous object)
  7171. @param pos int[2] - coordinates for the dialog's position within the screen or
  7172. event - with x/y coordinates or
  7173. leave empty for default (screen centre)
  7174. @return the manager object */
  7175. _dialogDatepicker: function(input, date, onSelect, settings, pos) {
  7176. var inst = this._dialogInst; // internal instance
  7177. if (!inst) {
  7178. this.uuid += 1;
  7179. var id = 'dp' + this.uuid;
  7180. this._dialogInput = $('<input type="text" id="' + id +
  7181. '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
  7182. this._dialogInput.keydown(this._doKeyDown);
  7183. $('body').append(this._dialogInput);
  7184. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  7185. inst.settings = {};
  7186. $.data(this._dialogInput[0], PROP_NAME, inst);
  7187. }
  7188. extendRemove(inst.settings, settings || {});
  7189. date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
  7190. this._dialogInput.val(date);
  7191. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  7192. if (!this._pos) {
  7193. var browserWidth = document.documentElement.clientWidth;
  7194. var browserHeight = document.documentElement.clientHeight;
  7195. var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  7196. var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  7197. this._pos = // should use actual width/height below
  7198. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  7199. }
  7200. // move input on screen for focus, but hidden behind dialog
  7201. this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
  7202. inst.settings.onSelect = onSelect;
  7203. this._inDialog = true;
  7204. this.dpDiv.addClass(this._dialogClass);
  7205. this._showDatepicker(this._dialogInput[0]);
  7206. if ($.blockUI)
  7207. $.blockUI(this.dpDiv);
  7208. $.data(this._dialogInput[0], PROP_NAME, inst);
  7209. return this;
  7210. },
  7211. /* Detach a datepicker from its control.
  7212. @param target element - the target input field or division or span */
  7213. _destroyDatepicker: function(target) {
  7214. var $target = $(target);
  7215. var inst = $.data(target, PROP_NAME);
  7216. if (!$target.hasClass(this.markerClassName)) {
  7217. return;
  7218. }
  7219. var nodeName = target.nodeName.toLowerCase();
  7220. $.removeData(target, PROP_NAME);
  7221. if (nodeName == 'input') {
  7222. inst.append.remove();
  7223. inst.trigger.remove();
  7224. $target.removeClass(this.markerClassName).
  7225. unbind('focus', this._showDatepicker).
  7226. unbind('keydown', this._doKeyDown).
  7227. unbind('keypress', this._doKeyPress).
  7228. unbind('keyup', this._doKeyUp);
  7229. } else if (nodeName == 'div' || nodeName == 'span')
  7230. $target.removeClass(this.markerClassName).empty();
  7231. },
  7232. /* Enable the date picker to a jQuery selection.
  7233. @param target element - the target input field or division or span */
  7234. _enableDatepicker: function(target) {
  7235. var $target = $(target);
  7236. var inst = $.data(target, PROP_NAME);
  7237. if (!$target.hasClass(this.markerClassName)) {
  7238. return;
  7239. }
  7240. var nodeName = target.nodeName.toLowerCase();
  7241. if (nodeName == 'input') {
  7242. target.disabled = false;
  7243. inst.trigger.filter('button').
  7244. each(function() { this.disabled = false; }).end().
  7245. filter('img').css({opacity: '1.0', cursor: ''});
  7246. }
  7247. else if (nodeName == 'div' || nodeName == 'span') {
  7248. var inline = $target.children('.' + this._inlineClass);
  7249. inline.children().removeClass('ui-state-disabled');
  7250. }
  7251. this._disabledInputs = $.map(this._disabledInputs,
  7252. function(value) { return (value == target ? null : value); }); // delete entry
  7253. },
  7254. /* Disable the date picker to a jQuery selection.
  7255. @param target element - the target input field or division or span */
  7256. _disableDatepicker: function(target) {
  7257. var $target = $(target);
  7258. var inst = $.data(target, PROP_NAME);
  7259. if (!$target.hasClass(this.markerClassName)) {
  7260. return;
  7261. }
  7262. var nodeName = target.nodeName.toLowerCase();
  7263. if (nodeName == 'input') {
  7264. target.disabled = true;
  7265. inst.trigger.filter('button').
  7266. each(function() { this.disabled = true; }).end().
  7267. filter('img').css({opacity: '0.5', cursor: 'default'});
  7268. }
  7269. else if (nodeName == 'div' || nodeName == 'span') {
  7270. var inline = $target.children('.' + this._inlineClass);
  7271. inline.children().addClass('ui-state-disabled');
  7272. }
  7273. this._disabledInputs = $.map(this._disabledInputs,
  7274. function(value) { return (value == target ? null : value); }); // delete entry
  7275. this._disabledInputs[this._disabledInputs.length] = target;
  7276. },
  7277. /* Is the first field in a jQuery collection disabled as a datepicker?
  7278. @param target element - the target input field or division or span
  7279. @return boolean - true if disabled, false if enabled */
  7280. _isDisabledDatepicker: function(target) {
  7281. if (!target) {
  7282. return false;
  7283. }
  7284. for (var i = 0; i < this._disabledInputs.length; i++) {
  7285. if (this._disabledInputs[i] == target)
  7286. return true;
  7287. }
  7288. return false;
  7289. },
  7290. /* Retrieve the instance data for the target control.
  7291. @param target element - the target input field or division or span
  7292. @return object - the associated instance data
  7293. @throws error if a jQuery problem getting data */
  7294. _getInst: function(target) {
  7295. try {
  7296. return $.data(target, PROP_NAME);
  7297. }
  7298. catch (err) {
  7299. throw 'Missing instance data for this datepicker';
  7300. }
  7301. },
  7302. /* Update or retrieve the settings for a date picker attached to an input field or division.
  7303. @param target element - the target input field or division or span
  7304. @param name object - the new settings to update or
  7305. string - the name of the setting to change or retrieve,
  7306. when retrieving also 'all' for all instance settings or
  7307. 'defaults' for all global defaults
  7308. @param value any - the new value for the setting
  7309. (omit if above is an object or to retrieve a value) */
  7310. _optionDatepicker: function(target, name, value) {
  7311. var inst = this._getInst(target);
  7312. if (arguments.length == 2 && typeof name == 'string') {
  7313. return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
  7314. (inst ? (name == 'all' ? $.extend({}, inst.settings) :
  7315. this._get(inst, name)) : null));
  7316. }
  7317. var settings = name || {};
  7318. if (typeof name == 'string') {
  7319. settings = {};
  7320. settings[name] = value;
  7321. }
  7322. if (inst) {
  7323. if (this._curInst == inst) {
  7324. this._hideDatepicker();
  7325. }
  7326. var date = this._getDateDatepicker(target, true);
  7327. var minDate = this._getMinMaxDate(inst, 'min');
  7328. var maxDate = this._getMinMaxDate(inst, 'max');
  7329. extendRemove(inst.settings, settings);
  7330. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  7331. if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
  7332. inst.settings.minDate = this._formatDate(inst, minDate);
  7333. if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
  7334. inst.settings.maxDate = this._formatDate(inst, maxDate);
  7335. this._attachments($(target), inst);
  7336. this._autoSize(inst);
  7337. this._setDateDatepicker(target, date);
  7338. this._updateDatepicker(inst);
  7339. }
  7340. },
  7341. // change method deprecated
  7342. _changeDatepicker: function(target, name, value) {
  7343. this._optionDatepicker(target, name, value);
  7344. },
  7345. /* Redraw the date picker attached to an input field or division.
  7346. @param target element - the target input field or division or span */
  7347. _refreshDatepicker: function(target) {
  7348. var inst = this._getInst(target);
  7349. if (inst) {
  7350. this._updateDatepicker(inst);
  7351. }
  7352. },
  7353. /* Set the dates for a jQuery selection.
  7354. @param target element - the target input field or division or span
  7355. @param date Date - the new date */
  7356. _setDateDatepicker: function(target, date) {
  7357. var inst = this._getInst(target);
  7358. if (inst) {
  7359. this._setDate(inst, date);
  7360. this._updateDatepicker(inst);
  7361. this._updateAlternate(inst);
  7362. }
  7363. },
  7364. /* Get the date(s) for the first entry in a jQuery selection.
  7365. @param target element - the target input field or division or span
  7366. @param noDefault boolean - true if no default date is to be used
  7367. @return Date - the current date */
  7368. _getDateDatepicker: function(target, noDefault) {
  7369. var inst = this._getInst(target);
  7370. if (inst && !inst.inline)
  7371. this._setDateFromField(inst, noDefault);
  7372. return (inst ? this._getDate(inst) : null);
  7373. },
  7374. /* Handle keystrokes. */
  7375. _doKeyDown: function(event) {
  7376. var inst = $.datepicker._getInst(event.target);
  7377. var handled = true;
  7378. var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
  7379. inst._keyEvent = true;
  7380. if ($.datepicker._datepickerShowing)
  7381. switch (event.keyCode) {
  7382. case 9: $.datepicker._hideDatepicker();
  7383. handled = false;
  7384. break; // hide on tab out
  7385. case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
  7386. $.datepicker._currentClass + ')', inst.dpDiv);
  7387. if (sel[0])
  7388. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  7389. else
  7390. $.datepicker._hideDatepicker();
  7391. return false; // don't submit the form
  7392. break; // select the value on enter
  7393. case 27: $.datepicker._hideDatepicker();
  7394. break; // hide on escape
  7395. case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7396. -$.datepicker._get(inst, 'stepBigMonths') :
  7397. -$.datepicker._get(inst, 'stepMonths')), 'M');
  7398. break; // previous month/year on page up/+ ctrl
  7399. case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7400. +$.datepicker._get(inst, 'stepBigMonths') :
  7401. +$.datepicker._get(inst, 'stepMonths')), 'M');
  7402. break; // next month/year on page down/+ ctrl
  7403. case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
  7404. handled = event.ctrlKey || event.metaKey;
  7405. break; // clear on ctrl or command +end
  7406. case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
  7407. handled = event.ctrlKey || event.metaKey;
  7408. break; // current on ctrl or command +home
  7409. case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
  7410. handled = event.ctrlKey || event.metaKey;
  7411. // -1 day on ctrl or command +left
  7412. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7413. -$.datepicker._get(inst, 'stepBigMonths') :
  7414. -$.datepicker._get(inst, 'stepMonths')), 'M');
  7415. // next month/year on alt +left on Mac
  7416. break;
  7417. case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
  7418. handled = event.ctrlKey || event.metaKey;
  7419. break; // -1 week on ctrl or command +up
  7420. case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
  7421. handled = event.ctrlKey || event.metaKey;
  7422. // +1 day on ctrl or command +right
  7423. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7424. +$.datepicker._get(inst, 'stepBigMonths') :
  7425. +$.datepicker._get(inst, 'stepMonths')), 'M');
  7426. // next month/year on alt +right
  7427. break;
  7428. case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
  7429. handled = event.ctrlKey || event.metaKey;
  7430. break; // +1 week on ctrl or command +down
  7431. default: handled = false;
  7432. }
  7433. else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
  7434. $.datepicker._showDatepicker(this);
  7435. else {
  7436. handled = false;
  7437. }
  7438. if (handled) {
  7439. event.preventDefault();
  7440. event.stopPropagation();
  7441. }
  7442. },
  7443. /* Filter entered characters - based on date format. */
  7444. _doKeyPress: function(event) {
  7445. var inst = $.datepicker._getInst(event.target);
  7446. if ($.datepicker._get(inst, 'constrainInput')) {
  7447. var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
  7448. var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
  7449. return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
  7450. }
  7451. },
  7452. /* Synchronise manual entry and field/alternate field. */
  7453. _doKeyUp: function(event) {
  7454. var inst = $.datepicker._getInst(event.target);
  7455. if (inst.input.val() != inst.lastVal) {
  7456. try {
  7457. var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  7458. (inst.input ? inst.input.val() : null),
  7459. $.datepicker._getFormatConfig(inst));
  7460. if (date) { // only if valid
  7461. $.datepicker._setDateFromField(inst);
  7462. $.datepicker._updateAlternate(inst);
  7463. $.datepicker._updateDatepicker(inst);
  7464. }
  7465. }
  7466. catch (event) {
  7467. $.datepicker.log(event);
  7468. }
  7469. }
  7470. return true;
  7471. },
  7472. /* Pop-up the date picker for a given input field.
  7473. @param input element - the input field attached to the date picker or
  7474. event - if triggered by focus */
  7475. _showDatepicker: function(input) {
  7476. input = input.target || input;
  7477. if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
  7478. input = $('input', input.parentNode)[0];
  7479. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
  7480. return;
  7481. var inst = $.datepicker._getInst(input);
  7482. if ($.datepicker._curInst && $.datepicker._curInst != inst) {
  7483. $.datepicker._curInst.dpDiv.stop(true, true);
  7484. }
  7485. var beforeShow = $.datepicker._get(inst, 'beforeShow');
  7486. extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
  7487. inst.lastVal = null;
  7488. $.datepicker._lastInput = input;
  7489. $.datepicker._setDateFromField(inst);
  7490. if ($.datepicker._inDialog) // hide cursor
  7491. input.value = '';
  7492. if (!$.datepicker._pos) { // position below input
  7493. $.datepicker._pos = $.datepicker._findPos(input);
  7494. $.datepicker._pos[1] += input.offsetHeight; // add the height
  7495. }
  7496. var isFixed = false;
  7497. $(input).parents().each(function() {
  7498. isFixed |= $(this).css('position') == 'fixed';
  7499. return !isFixed;
  7500. });
  7501. if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
  7502. $.datepicker._pos[0] -= document.documentElement.scrollLeft;
  7503. $.datepicker._pos[1] -= document.documentElement.scrollTop;
  7504. }
  7505. var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  7506. $.datepicker._pos = null;
  7507. //to avoid flashes on Firefox
  7508. inst.dpDiv.empty();
  7509. // determine sizing offscreen
  7510. inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
  7511. $.datepicker._updateDatepicker(inst);
  7512. // fix width for dynamic number of date pickers
  7513. // and adjust position before showing
  7514. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  7515. inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  7516. 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
  7517. left: offset.left + 'px', top: offset.top + 'px'});
  7518. if (!inst.inline) {
  7519. var showAnim = $.datepicker._get(inst, 'showAnim');
  7520. var duration = $.datepicker._get(inst, 'duration');
  7521. var postProcess = function() {
  7522. $.datepicker._datepickerShowing = true;
  7523. var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
  7524. if( !! cover.length ){
  7525. var borders = $.datepicker._getBorders(inst.dpDiv);
  7526. cover.css({left: -borders[0], top: -borders[1],
  7527. width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
  7528. }
  7529. };
  7530. inst.dpDiv.zIndex($(input).zIndex()+1);
  7531. if ($.effects && $.effects[showAnim])
  7532. inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  7533. else
  7534. inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
  7535. if (!showAnim || !duration)
  7536. postProcess();
  7537. if (inst.input.is(':visible') && !inst.input.is(':disabled'))
  7538. inst.input.focus();
  7539. $.datepicker._curInst = inst;
  7540. }
  7541. },
  7542. /* Generate the date picker content. */
  7543. _updateDatepicker: function(inst) {
  7544. var self = this;
  7545. var borders = $.datepicker._getBorders(inst.dpDiv);
  7546. inst.dpDiv.empty().append(this._generateHTML(inst));
  7547. var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
  7548. if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
  7549. cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
  7550. }
  7551. inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
  7552. .bind('mouseout', function(){
  7553. $(this).removeClass('ui-state-hover');
  7554. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
  7555. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
  7556. })
  7557. .bind('mouseover', function(){
  7558. if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
  7559. $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
  7560. $(this).addClass('ui-state-hover');
  7561. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
  7562. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
  7563. }
  7564. })
  7565. .end()
  7566. .find('.' + this._dayOverClass + ' a')
  7567. .trigger('mouseover')
  7568. .end();
  7569. var numMonths = this._getNumberOfMonths(inst);
  7570. var cols = numMonths[1];
  7571. var width = 17;
  7572. if (cols > 1)
  7573. inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
  7574. else
  7575. inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
  7576. inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
  7577. 'Class']('ui-datepicker-multi');
  7578. inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
  7579. 'Class']('ui-datepicker-rtl');
  7580. if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
  7581. // #6694 - don't focus the input if it's already focused
  7582. // this breaks the change event in IE
  7583. inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
  7584. inst.input.focus();
  7585. // deffered render of the years select (to avoid flashes on Firefox)
  7586. if( inst.yearshtml ){
  7587. var origyearshtml = inst.yearshtml;
  7588. setTimeout(function(){
  7589. //assure that inst.yearshtml didn't change.
  7590. if( origyearshtml === inst.yearshtml ){
  7591. inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
  7592. }
  7593. origyearshtml = inst.yearshtml = null;
  7594. }, 0);
  7595. }
  7596. },
  7597. /* Retrieve the size of left and top borders for an element.
  7598. @param elem (jQuery object) the element of interest
  7599. @return (number[2]) the left and top borders */
  7600. _getBorders: function(elem) {
  7601. var convert = function(value) {
  7602. return {thin: 1, medium: 2, thick: 3}[value] || value;
  7603. };
  7604. return [parseFloat(convert(elem.css('border-left-width'))),
  7605. parseFloat(convert(elem.css('border-top-width')))];
  7606. },
  7607. /* Check positioning to remain on screen. */
  7608. _checkOffset: function(inst, offset, isFixed) {
  7609. var dpWidth = inst.dpDiv.outerWidth();
  7610. var dpHeight = inst.dpDiv.outerHeight();
  7611. var inputWidth = inst.input ? inst.input.outerWidth() : 0;
  7612. var inputHeight = inst.input ? inst.input.outerHeight() : 0;
  7613. var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
  7614. var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
  7615. offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
  7616. offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
  7617. offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  7618. // now check if datepicker is showing outside window viewport - move to a better place if so.
  7619. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  7620. Math.abs(offset.left + dpWidth - viewWidth) : 0);
  7621. offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  7622. Math.abs(dpHeight + inputHeight) : 0);
  7623. return offset;
  7624. },
  7625. /* Find an object's position on the screen. */
  7626. _findPos: function(obj) {
  7627. var inst = this._getInst(obj);
  7628. var isRTL = this._get(inst, 'isRTL');
  7629. while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
  7630. obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
  7631. }
  7632. var position = $(obj).offset();
  7633. return [position.left, position.top];
  7634. },
  7635. /* Hide the date picker from view.
  7636. @param input element - the input field attached to the date picker */
  7637. _hideDatepicker: function(input) {
  7638. var inst = this._curInst;
  7639. if (!inst || (input && inst != $.data(input, PROP_NAME)))
  7640. return;
  7641. if (this._datepickerShowing) {
  7642. var showAnim = this._get(inst, 'showAnim');
  7643. var duration = this._get(inst, 'duration');
  7644. var postProcess = function() {
  7645. $.datepicker._tidyDialog(inst);
  7646. this._curInst = null;
  7647. };
  7648. if ($.effects && $.effects[showAnim])
  7649. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  7650. else
  7651. inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
  7652. (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
  7653. if (!showAnim)
  7654. postProcess();
  7655. var onClose = this._get(inst, 'onClose');
  7656. if (onClose)
  7657. onClose.apply((inst.input ? inst.input[0] : null),
  7658. [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
  7659. this._datepickerShowing = false;
  7660. this._lastInput = null;
  7661. if (this._inDialog) {
  7662. this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
  7663. if ($.blockUI) {
  7664. $.unblockUI();
  7665. $('body').append(this.dpDiv);
  7666. }
  7667. }
  7668. this._inDialog = false;
  7669. }
  7670. },
  7671. /* Tidy up after a dialog display. */
  7672. _tidyDialog: function(inst) {
  7673. inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
  7674. },
  7675. /* Close date picker if clicked elsewhere. */
  7676. _checkExternalClick: function(event) {
  7677. if (!$.datepicker._curInst)
  7678. return;
  7679. var $target = $(event.target);
  7680. if ($target[0].id != $.datepicker._mainDivId &&
  7681. $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
  7682. !$target.hasClass($.datepicker.markerClassName) &&
  7683. !$target.hasClass($.datepicker._triggerClass) &&
  7684. $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
  7685. $.datepicker._hideDatepicker();
  7686. },
  7687. /* Adjust one of the date sub-fields. */
  7688. _adjustDate: function(id, offset, period) {
  7689. var target = $(id);
  7690. var inst = this._getInst(target[0]);
  7691. if (this._isDisabledDatepicker(target[0])) {
  7692. return;
  7693. }
  7694. this._adjustInstDate(inst, offset +
  7695. (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
  7696. period);
  7697. this._updateDatepicker(inst);
  7698. },
  7699. /* Action for current link. */
  7700. _gotoToday: function(id) {
  7701. var target = $(id);
  7702. var inst = this._getInst(target[0]);
  7703. if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
  7704. inst.selectedDay = inst.currentDay;
  7705. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  7706. inst.drawYear = inst.selectedYear = inst.currentYear;
  7707. }
  7708. else {
  7709. var date = new Date();
  7710. inst.selectedDay = date.getDate();
  7711. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7712. inst.drawYear = inst.selectedYear = date.getFullYear();
  7713. }
  7714. this._notifyChange(inst);
  7715. this._adjustDate(target);
  7716. },
  7717. /* Action for selecting a new month/year. */
  7718. _selectMonthYear: function(id, select, period) {
  7719. var target = $(id);
  7720. var inst = this._getInst(target[0]);
  7721. inst._selectingMonthYear = false;
  7722. inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
  7723. inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
  7724. parseInt(select.options[select.selectedIndex].value,10);
  7725. this._notifyChange(inst);
  7726. this._adjustDate(target);
  7727. },
  7728. /* Restore input focus after not changing month/year. */
  7729. _clickMonthYear: function(id) {
  7730. var target = $(id);
  7731. var inst = this._getInst(target[0]);
  7732. if (inst.input && inst._selectingMonthYear) {
  7733. setTimeout(function() {
  7734. inst.input.focus();
  7735. }, 0);
  7736. }
  7737. inst._selectingMonthYear = !inst._selectingMonthYear;
  7738. },
  7739. /* Action for selecting a day. */
  7740. _selectDay: function(id, month, year, td) {
  7741. var target = $(id);
  7742. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  7743. return;
  7744. }
  7745. var inst = this._getInst(target[0]);
  7746. inst.selectedDay = inst.currentDay = $('a', td).html();
  7747. inst.selectedMonth = inst.currentMonth = month;
  7748. inst.selectedYear = inst.currentYear = year;
  7749. this._selectDate(id, this._formatDate(inst,
  7750. inst.currentDay, inst.currentMonth, inst.currentYear));
  7751. },
  7752. /* Erase the input field and hide the date picker. */
  7753. _clearDate: function(id) {
  7754. var target = $(id);
  7755. var inst = this._getInst(target[0]);
  7756. this._selectDate(target, '');
  7757. },
  7758. /* Update the input field with the selected date. */
  7759. _selectDate: function(id, dateStr) {
  7760. var target = $(id);
  7761. var inst = this._getInst(target[0]);
  7762. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  7763. if (inst.input)
  7764. inst.input.val(dateStr);
  7765. this._updateAlternate(inst);
  7766. var onSelect = this._get(inst, 'onSelect');
  7767. if (onSelect)
  7768. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
  7769. else if (inst.input)
  7770. inst.input.trigger('change'); // fire the change event
  7771. if (inst.inline)
  7772. this._updateDatepicker(inst);
  7773. else {
  7774. this._hideDatepicker();
  7775. this._lastInput = inst.input[0];
  7776. if (typeof(inst.input[0]) != 'object')
  7777. inst.input.focus(); // restore focus
  7778. this._lastInput = null;
  7779. }
  7780. },
  7781. /* Update any alternate field to synchronise with the main field. */
  7782. _updateAlternate: function(inst) {
  7783. var altField = this._get(inst, 'altField');
  7784. if (altField) { // update alternate field too
  7785. var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
  7786. var date = this._getDate(inst);
  7787. var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  7788. $(altField).each(function() { $(this).val(dateStr); });
  7789. }
  7790. },
  7791. /* Set as beforeShowDay function to prevent selection of weekends.
  7792. @param date Date - the date to customise
  7793. @return [boolean, string] - is this date selectable?, what is its CSS class? */
  7794. noWeekends: function(date) {
  7795. var day = date.getDay();
  7796. return [(day > 0 && day < 6), ''];
  7797. },
  7798. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  7799. @param date Date - the date to get the week for
  7800. @return number - the number of the week within the year that contains this date */
  7801. iso8601Week: function(date) {
  7802. var checkDate = new Date(date.getTime());
  7803. // Find Thursday of this week starting on Monday
  7804. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  7805. var time = checkDate.getTime();
  7806. checkDate.setMonth(0); // Compare with Jan 1
  7807. checkDate.setDate(1);
  7808. return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  7809. },
  7810. /* Parse a string value into a date object.
  7811. See formatDate below for the possible formats.
  7812. @param format string - the expected format of the date
  7813. @param value string - the date in the above format
  7814. @param settings Object - attributes include:
  7815. shortYearCutoff number - the cutoff year for determining the century (optional)
  7816. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7817. dayNames string[7] - names of the days from Sunday (optional)
  7818. monthNamesShort string[12] - abbreviated names of the months (optional)
  7819. monthNames string[12] - names of the months (optional)
  7820. @return Date - the extracted date value or null if value is blank */
  7821. parseDate: function (format, value, settings) {
  7822. if (format == null || value == null)
  7823. throw 'Invalid arguments';
  7824. value = (typeof value == 'object' ? value.toString() : value + '');
  7825. if (value == '')
  7826. return null;
  7827. var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
  7828. shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
  7829. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  7830. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  7831. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  7832. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  7833. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  7834. var year = -1;
  7835. var month = -1;
  7836. var day = -1;
  7837. var doy = -1;
  7838. var literal = false;
  7839. // Check whether a format character is doubled
  7840. var lookAhead = function(match) {
  7841. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7842. if (matches)
  7843. iFormat++;
  7844. return matches;
  7845. };
  7846. // Extract a number from the string value
  7847. var getNumber = function(match) {
  7848. var isDoubled = lookAhead(match);
  7849. var size = (match == '@' ? 14 : (match == '!' ? 20 :
  7850. (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
  7851. var digits = new RegExp('^\\d{1,' + size + '}');
  7852. var num = value.substring(iValue).match(digits);
  7853. if (!num)
  7854. throw 'Missing number at position ' + iValue;
  7855. iValue += num[0].length;
  7856. return parseInt(num[0], 10);
  7857. };
  7858. // Extract a name from the string value and convert to an index
  7859. var getName = function(match, shortNames, longNames) {
  7860. var names = (lookAhead(match) ? longNames : shortNames);
  7861. for (var i = 0; i < names.length; i++) {
  7862. if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
  7863. iValue += names[i].length;
  7864. return i + 1;
  7865. }
  7866. }
  7867. throw 'Unknown name at position ' + iValue;
  7868. };
  7869. // Confirm that a literal character matches the string value
  7870. var checkLiteral = function() {
  7871. if (value.charAt(iValue) != format.charAt(iFormat))
  7872. throw 'Unexpected literal at position ' + iValue;
  7873. iValue++;
  7874. };
  7875. var iValue = 0;
  7876. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  7877. if (literal)
  7878. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7879. literal = false;
  7880. else
  7881. checkLiteral();
  7882. else
  7883. switch (format.charAt(iFormat)) {
  7884. case 'd':
  7885. day = getNumber('d');
  7886. break;
  7887. case 'D':
  7888. getName('D', dayNamesShort, dayNames);
  7889. break;
  7890. case 'o':
  7891. doy = getNumber('o');
  7892. break;
  7893. case 'm':
  7894. month = getNumber('m');
  7895. break;
  7896. case 'M':
  7897. month = getName('M', monthNamesShort, monthNames);
  7898. break;
  7899. case 'y':
  7900. year = getNumber('y');
  7901. break;
  7902. case '@':
  7903. var date = new Date(getNumber('@'));
  7904. year = date.getFullYear();
  7905. month = date.getMonth() + 1;
  7906. day = date.getDate();
  7907. break;
  7908. case '!':
  7909. var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
  7910. year = date.getFullYear();
  7911. month = date.getMonth() + 1;
  7912. day = date.getDate();
  7913. break;
  7914. case "'":
  7915. if (lookAhead("'"))
  7916. checkLiteral();
  7917. else
  7918. literal = true;
  7919. break;
  7920. default:
  7921. checkLiteral();
  7922. }
  7923. }
  7924. if (year == -1)
  7925. year = new Date().getFullYear();
  7926. else if (year < 100)
  7927. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  7928. (year <= shortYearCutoff ? 0 : -100);
  7929. if (doy > -1) {
  7930. month = 1;
  7931. day = doy;
  7932. do {
  7933. var dim = this._getDaysInMonth(year, month - 1);
  7934. if (day <= dim)
  7935. break;
  7936. month++;
  7937. day -= dim;
  7938. } while (true);
  7939. }
  7940. var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  7941. if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
  7942. throw 'Invalid date'; // E.g. 31/02/*
  7943. return date;
  7944. },
  7945. /* Standard date formats. */
  7946. ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
  7947. COOKIE: 'D, dd M yy',
  7948. ISO_8601: 'yy-mm-dd',
  7949. RFC_822: 'D, d M y',
  7950. RFC_850: 'DD, dd-M-y',
  7951. RFC_1036: 'D, d M y',
  7952. RFC_1123: 'D, d M yy',
  7953. RFC_2822: 'D, d M yy',
  7954. RSS: 'D, d M y', // RFC 822
  7955. TICKS: '!',
  7956. TIMESTAMP: '@',
  7957. W3C: 'yy-mm-dd', // ISO 8601
  7958. _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  7959. Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  7960. /* Format a date object into a string value.
  7961. The format can be combinations of the following:
  7962. d - day of month (no leading zero)
  7963. dd - day of month (two digit)
  7964. o - day of year (no leading zeros)
  7965. oo - day of year (three digit)
  7966. D - day name short
  7967. DD - day name long
  7968. m - month of year (no leading zero)
  7969. mm - month of year (two digit)
  7970. M - month name short
  7971. MM - month name long
  7972. y - year (two digit)
  7973. yy - year (four digit)
  7974. @ - Unix timestamp (ms since 01/01/1970)
  7975. ! - Windows ticks (100ns since 01/01/0001)
  7976. '...' - literal text
  7977. '' - single quote
  7978. @param format string - the desired format of the date
  7979. @param date Date - the date value to format
  7980. @param settings Object - attributes include:
  7981. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7982. dayNames string[7] - names of the days from Sunday (optional)
  7983. monthNamesShort string[12] - abbreviated names of the months (optional)
  7984. monthNames string[12] - names of the months (optional)
  7985. @return string - the date in the above format */
  7986. formatDate: function (format, date, settings) {
  7987. if (!date)
  7988. return '';
  7989. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  7990. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  7991. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  7992. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  7993. // Check whether a format character is doubled
  7994. var lookAhead = function(match) {
  7995. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7996. if (matches)
  7997. iFormat++;
  7998. return matches;
  7999. };
  8000. // Format a number, with leading zero if necessary
  8001. var formatNumber = function(match, value, len) {
  8002. var num = '' + value;
  8003. if (lookAhead(match))
  8004. while (num.length < len)
  8005. num = '0' + num;
  8006. return num;
  8007. };
  8008. // Format a name, short or long as requested
  8009. var formatName = function(match, value, shortNames, longNames) {
  8010. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  8011. };
  8012. var output = '';
  8013. var literal = false;
  8014. if (date)
  8015. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  8016. if (literal)
  8017. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  8018. literal = false;
  8019. else
  8020. output += format.charAt(iFormat);
  8021. else
  8022. switch (format.charAt(iFormat)) {
  8023. case 'd':
  8024. output += formatNumber('d', date.getDate(), 2);
  8025. break;
  8026. case 'D':
  8027. output += formatName('D', date.getDay(), dayNamesShort, dayNames);
  8028. break;
  8029. case 'o':
  8030. output += formatNumber('o',
  8031. (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
  8032. break;
  8033. case 'm':
  8034. output += formatNumber('m', date.getMonth() + 1, 2);
  8035. break;
  8036. case 'M':
  8037. output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
  8038. break;
  8039. case 'y':
  8040. output += (lookAhead('y') ? date.getFullYear() :
  8041. (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
  8042. break;
  8043. case '@':
  8044. output += date.getTime();
  8045. break;
  8046. case '!':
  8047. output += date.getTime() * 10000 + this._ticksTo1970;
  8048. break;
  8049. case "'":
  8050. if (lookAhead("'"))
  8051. output += "'";
  8052. else
  8053. literal = true;
  8054. break;
  8055. default:
  8056. output += format.charAt(iFormat);
  8057. }
  8058. }
  8059. return output;
  8060. },
  8061. /* Extract all possible characters from the date format. */
  8062. _possibleChars: function (format) {
  8063. var chars = '';
  8064. var literal = false;
  8065. // Check whether a format character is doubled
  8066. var lookAhead = function(match) {
  8067. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  8068. if (matches)
  8069. iFormat++;
  8070. return matches;
  8071. };
  8072. for (var iFormat = 0; iFormat < format.length; iFormat++)
  8073. if (literal)
  8074. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  8075. literal = false;
  8076. else
  8077. chars += format.charAt(iFormat);
  8078. else
  8079. switch (format.charAt(iFormat)) {
  8080. case 'd': case 'm': case 'y': case '@':
  8081. chars += '0123456789';
  8082. break;
  8083. case 'D': case 'M':
  8084. return null; // Accept anything
  8085. case "'":
  8086. if (lookAhead("'"))
  8087. chars += "'";
  8088. else
  8089. literal = true;
  8090. break;
  8091. default:
  8092. chars += format.charAt(iFormat);
  8093. }
  8094. return chars;
  8095. },
  8096. /* Get a setting value, defaulting if necessary. */
  8097. _get: function(inst, name) {
  8098. return inst.settings[name] !== undefined ?
  8099. inst.settings[name] : this._defaults[name];
  8100. },
  8101. /* Parse existing date and initialise date picker. */
  8102. _setDateFromField: function(inst, noDefault) {
  8103. if (inst.input.val() == inst.lastVal) {
  8104. return;
  8105. }
  8106. var dateFormat = this._get(inst, 'dateFormat');
  8107. var dates = inst.lastVal = inst.input ? inst.input.val() : null;
  8108. var date, defaultDate;
  8109. date = defaultDate = this._getDefaultDate(inst);
  8110. var settings = this._getFormatConfig(inst);
  8111. try {
  8112. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  8113. } catch (event) {
  8114. this.log(event);
  8115. dates = (noDefault ? '' : dates);
  8116. }
  8117. inst.selectedDay = date.getDate();
  8118. inst.drawMonth = inst.selectedMonth = date.getMonth();
  8119. inst.drawYear = inst.selectedYear = date.getFullYear();
  8120. inst.currentDay = (dates ? date.getDate() : 0);
  8121. inst.currentMonth = (dates ? date.getMonth() : 0);
  8122. inst.currentYear = (dates ? date.getFullYear() : 0);
  8123. this._adjustInstDate(inst);
  8124. },
  8125. /* Retrieve the default date shown on opening. */
  8126. _getDefaultDate: function(inst) {
  8127. return this._restrictMinMax(inst,
  8128. this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
  8129. },
  8130. /* A date may be specified as an exact value or a relative one. */
  8131. _determineDate: function(inst, date, defaultDate) {
  8132. var offsetNumeric = function(offset) {
  8133. var date = new Date();
  8134. date.setDate(date.getDate() + offset);
  8135. return date;
  8136. };
  8137. var offsetString = function(offset) {
  8138. try {
  8139. return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  8140. offset, $.datepicker._getFormatConfig(inst));
  8141. }
  8142. catch (e) {
  8143. // Ignore
  8144. }
  8145. var date = (offset.toLowerCase().match(/^c/) ?
  8146. $.datepicker._getDate(inst) : null) || new Date();
  8147. var year = date.getFullYear();
  8148. var month = date.getMonth();
  8149. var day = date.getDate();
  8150. var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
  8151. var matches = pattern.exec(offset);
  8152. while (matches) {
  8153. switch (matches[2] || 'd') {
  8154. case 'd' : case 'D' :
  8155. day += parseInt(matches[1],10); break;
  8156. case 'w' : case 'W' :
  8157. day += parseInt(matches[1],10) * 7; break;
  8158. case 'm' : case 'M' :
  8159. month += parseInt(matches[1],10);
  8160. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  8161. break;
  8162. case 'y': case 'Y' :
  8163. year += parseInt(matches[1],10);
  8164. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  8165. break;
  8166. }
  8167. matches = pattern.exec(offset);
  8168. }
  8169. return new Date(year, month, day);
  8170. };
  8171. var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
  8172. (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  8173. newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
  8174. if (newDate) {
  8175. newDate.setHours(0);
  8176. newDate.setMinutes(0);
  8177. newDate.setSeconds(0);
  8178. newDate.setMilliseconds(0);
  8179. }
  8180. return this._daylightSavingAdjust(newDate);
  8181. },
  8182. /* Handle switch to/from daylight saving.
  8183. Hours may be non-zero on daylight saving cut-over:
  8184. > 12 when midnight changeover, but then cannot generate
  8185. midnight datetime, so jump to 1AM, otherwise reset.
  8186. @param date (Date) the date to check
  8187. @return (Date) the corrected date */
  8188. _daylightSavingAdjust: function(date) {
  8189. if (!date) return null;
  8190. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  8191. return date;
  8192. },
  8193. /* Set the date(s) directly. */
  8194. _setDate: function(inst, date, noChange) {
  8195. var clear = !date;
  8196. var origMonth = inst.selectedMonth;
  8197. var origYear = inst.selectedYear;
  8198. var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  8199. inst.selectedDay = inst.currentDay = newDate.getDate();
  8200. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  8201. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  8202. if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
  8203. this._notifyChange(inst);
  8204. this._adjustInstDate(inst);
  8205. if (inst.input) {
  8206. inst.input.val(clear ? '' : this._formatDate(inst));
  8207. }
  8208. },
  8209. /* Retrieve the date(s) directly. */
  8210. _getDate: function(inst) {
  8211. var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
  8212. this._daylightSavingAdjust(new Date(
  8213. inst.currentYear, inst.currentMonth, inst.currentDay)));
  8214. return startDate;
  8215. },
  8216. /* Generate the HTML for the current state of the date picker. */
  8217. _generateHTML: function(inst) {
  8218. var today = new Date();
  8219. today = this._daylightSavingAdjust(
  8220. new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
  8221. var isRTL = this._get(inst, 'isRTL');
  8222. var showButtonPanel = this._get(inst, 'showButtonPanel');
  8223. var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
  8224. var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
  8225. var numMonths = this._getNumberOfMonths(inst);
  8226. var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
  8227. var stepMonths = this._get(inst, 'stepMonths');
  8228. var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
  8229. var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  8230. new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  8231. var minDate = this._getMinMaxDate(inst, 'min');
  8232. var maxDate = this._getMinMaxDate(inst, 'max');
  8233. var drawMonth = inst.drawMonth - showCurrentAtPos;
  8234. var drawYear = inst.drawYear;
  8235. if (drawMonth < 0) {
  8236. drawMonth += 12;
  8237. drawYear--;
  8238. }
  8239. if (maxDate) {
  8240. var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  8241. maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  8242. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  8243. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  8244. drawMonth--;
  8245. if (drawMonth < 0) {
  8246. drawMonth = 11;
  8247. drawYear--;
  8248. }
  8249. }
  8250. }
  8251. inst.drawMonth = drawMonth;
  8252. inst.drawYear = drawYear;
  8253. var prevText = this._get(inst, 'prevText');
  8254. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  8255. this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  8256. this._getFormatConfig(inst)));
  8257. var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  8258. '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8259. '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
  8260. ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
  8261. (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>'));
  8262. var nextText = this._get(inst, 'nextText');
  8263. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  8264. this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  8265. this._getFormatConfig(inst)));
  8266. var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  8267. '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8268. '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
  8269. ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
  8270. (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>'));
  8271. var currentText = this._get(inst, 'currentText');
  8272. var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
  8273. currentText = (!navigationAsDateFormat ? currentText :
  8274. this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  8275. var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8276. '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
  8277. var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
  8278. (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8279. '.datepicker._gotoToday(\'#' + inst.id + '\');"' +
  8280. '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
  8281. var firstDay = parseInt(this._get(inst, 'firstDay'),10);
  8282. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  8283. var showWeek = this._get(inst, 'showWeek');
  8284. var dayNames = this._get(inst, 'dayNames');
  8285. var dayNamesShort = this._get(inst, 'dayNamesShort');
  8286. var dayNamesMin = this._get(inst, 'dayNamesMin');
  8287. var monthNames = this._get(inst, 'monthNames');
  8288. var monthNamesShort = this._get(inst, 'monthNamesShort');
  8289. var beforeShowDay = this._get(inst, 'beforeShowDay');
  8290. var showOtherMonths = this._get(inst, 'showOtherMonths');
  8291. var selectOtherMonths = this._get(inst, 'selectOtherMonths');
  8292. var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
  8293. var defaultDate = this._getDefaultDate(inst);
  8294. var html = '';
  8295. for (var row = 0; row < numMonths[0]; row++) {
  8296. var group = '';
  8297. for (var col = 0; col < numMonths[1]; col++) {
  8298. var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  8299. var cornerClass = ' ui-corner-all';
  8300. var calender = '';
  8301. if (isMultiMonth) {
  8302. calender += '<div class="ui-datepicker-group';
  8303. if (numMonths[1] > 1)
  8304. switch (col) {
  8305. case 0: calender += ' ui-datepicker-group-first';
  8306. cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
  8307. case numMonths[1]-1: calender += ' ui-datepicker-group-last';
  8308. cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
  8309. default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
  8310. }
  8311. calender += '">';
  8312. }
  8313. calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
  8314. (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
  8315. (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
  8316. this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  8317. row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  8318. '</div><table class="ui-datepicker-calendar"><thead>' +
  8319. '<tr>';
  8320. var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
  8321. for (var dow = 0; dow < 7; dow++) { // days of the week
  8322. var day = (dow + firstDay) % 7;
  8323. thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
  8324. '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
  8325. }
  8326. calender += thead + '</tr></thead><tbody>';
  8327. var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  8328. if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
  8329. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  8330. var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  8331. var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
  8332. var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  8333. for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  8334. calender += '<tr>';
  8335. var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
  8336. this._get(inst, 'calculateWeek')(printDate) + '</td>');
  8337. for (var dow = 0; dow < 7; dow++) { // create date picker days
  8338. var daySettings = (beforeShowDay ?
  8339. beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
  8340. var otherMonth = (printDate.getMonth() != drawMonth);
  8341. var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  8342. (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  8343. tbody += '<td class="' +
  8344. ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
  8345. (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
  8346. ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
  8347. (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
  8348. // or defaultDate is current printedDate and defaultDate is selectedDate
  8349. ' ' + this._dayOverClass : '') + // highlight selected day
  8350. (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
  8351. (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
  8352. (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
  8353. (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
  8354. ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
  8355. (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
  8356. inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
  8357. (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
  8358. (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
  8359. (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
  8360. (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
  8361. (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
  8362. '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
  8363. printDate.setDate(printDate.getDate() + 1);
  8364. printDate = this._daylightSavingAdjust(printDate);
  8365. }
  8366. calender += tbody + '</tr>';
  8367. }
  8368. drawMonth++;
  8369. if (drawMonth > 11) {
  8370. drawMonth = 0;
  8371. drawYear++;
  8372. }
  8373. calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
  8374. ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
  8375. group += calender;
  8376. }
  8377. html += group;
  8378. }
  8379. html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
  8380. '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
  8381. inst._keyEvent = false;
  8382. return html;
  8383. },
  8384. /* Generate the month and year header. */
  8385. _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  8386. secondary, monthNames, monthNamesShort) {
  8387. var changeMonth = this._get(inst, 'changeMonth');
  8388. var changeYear = this._get(inst, 'changeYear');
  8389. var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
  8390. var html = '<div class="ui-datepicker-title">';
  8391. var monthHtml = '';
  8392. // month selection
  8393. if (secondary || !changeMonth)
  8394. monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
  8395. else {
  8396. var inMinYear = (minDate && minDate.getFullYear() == drawYear);
  8397. var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
  8398. monthHtml += '<select class="ui-datepicker-month" ' +
  8399. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
  8400. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  8401. '>';
  8402. for (var month = 0; month < 12; month++) {
  8403. if ((!inMinYear || month >= minDate.getMonth()) &&
  8404. (!inMaxYear || month <= maxDate.getMonth()))
  8405. monthHtml += '<option value="' + month + '"' +
  8406. (month == drawMonth ? ' selected="selected"' : '') +
  8407. '>' + monthNamesShort[month] + '</option>';
  8408. }
  8409. monthHtml += '</select>';
  8410. }
  8411. if (!showMonthAfterYear)
  8412. html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
  8413. // year selection
  8414. inst.yearshtml = '';
  8415. if (secondary || !changeYear)
  8416. html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
  8417. else {
  8418. // determine range of years to display
  8419. var years = this._get(inst, 'yearRange').split(':');
  8420. var thisYear = new Date().getFullYear();
  8421. var determineYear = function(value) {
  8422. var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  8423. (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
  8424. parseInt(value, 10)));
  8425. return (isNaN(year) ? thisYear : year);
  8426. };
  8427. var year = determineYear(years[0]);
  8428. var endYear = Math.max(year, determineYear(years[1] || ''));
  8429. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  8430. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  8431. inst.yearshtml += '<select class="ui-datepicker-year" ' +
  8432. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
  8433. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  8434. '>';
  8435. for (; year <= endYear; year++) {
  8436. inst.yearshtml += '<option value="' + year + '"' +
  8437. (year == drawYear ? ' selected="selected"' : '') +
  8438. '>' + year + '</option>';
  8439. }
  8440. inst.yearshtml += '</select>';
  8441. //when showing there is no need for later update
  8442. if( ! $.browser.mozilla ){
  8443. html += inst.yearshtml;
  8444. inst.yearshtml = null;
  8445. } else {
  8446. // will be replaced later with inst.yearshtml
  8447. html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
  8448. }
  8449. }
  8450. html += this._get(inst, 'yearSuffix');
  8451. if (showMonthAfterYear)
  8452. html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
  8453. html += '</div>'; // Close datepicker_header
  8454. return html;
  8455. },
  8456. /* Adjust one of the date sub-fields. */
  8457. _adjustInstDate: function(inst, offset, period) {
  8458. var year = inst.drawYear + (period == 'Y' ? offset : 0);
  8459. var month = inst.drawMonth + (period == 'M' ? offset : 0);
  8460. var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
  8461. (period == 'D' ? offset : 0);
  8462. var date = this._restrictMinMax(inst,
  8463. this._daylightSavingAdjust(new Date(year, month, day)));
  8464. inst.selectedDay = date.getDate();
  8465. inst.drawMonth = inst.selectedMonth = date.getMonth();
  8466. inst.drawYear = inst.selectedYear = date.getFullYear();
  8467. if (period == 'M' || period == 'Y')
  8468. this._notifyChange(inst);
  8469. },
  8470. /* Ensure a date is within any min/max bounds. */
  8471. _restrictMinMax: function(inst, date) {
  8472. var minDate = this._getMinMaxDate(inst, 'min');
  8473. var maxDate = this._getMinMaxDate(inst, 'max');
  8474. var newDate = (minDate && date < minDate ? minDate : date);
  8475. newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
  8476. return newDate;
  8477. },
  8478. /* Notify change of month/year. */
  8479. _notifyChange: function(inst) {
  8480. var onChange = this._get(inst, 'onChangeMonthYear');
  8481. if (onChange)
  8482. onChange.apply((inst.input ? inst.input[0] : null),
  8483. [inst.selectedYear, inst.selectedMonth + 1, inst]);
  8484. },
  8485. /* Determine the number of months to show. */
  8486. _getNumberOfMonths: function(inst) {
  8487. var numMonths = this._get(inst, 'numberOfMonths');
  8488. return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
  8489. },
  8490. /* Determine the current maximum date - ensure no time components are set. */
  8491. _getMinMaxDate: function(inst, minMax) {
  8492. return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
  8493. },
  8494. /* Find the number of days in a given month. */
  8495. _getDaysInMonth: function(year, month) {
  8496. return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
  8497. },
  8498. /* Find the day of the week of the first of a month. */
  8499. _getFirstDayOfMonth: function(year, month) {
  8500. return new Date(year, month, 1).getDay();
  8501. },
  8502. /* Determines if we should allow a "next/prev" month display change. */
  8503. _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  8504. var numMonths = this._getNumberOfMonths(inst);
  8505. var date = this._daylightSavingAdjust(new Date(curYear,
  8506. curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  8507. if (offset < 0)
  8508. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  8509. return this._isInRange(inst, date);
  8510. },
  8511. /* Is the given date in the accepted range? */
  8512. _isInRange: function(inst, date) {
  8513. var minDate = this._getMinMaxDate(inst, 'min');
  8514. var maxDate = this._getMinMaxDate(inst, 'max');
  8515. return ((!minDate || date.getTime() >= minDate.getTime()) &&
  8516. (!maxDate || date.getTime() <= maxDate.getTime()));
  8517. },
  8518. /* Provide the configuration settings for formatting/parsing. */
  8519. _getFormatConfig: function(inst) {
  8520. var shortYearCutoff = this._get(inst, 'shortYearCutoff');
  8521. shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
  8522. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  8523. return {shortYearCutoff: shortYearCutoff,
  8524. dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
  8525. monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
  8526. },
  8527. /* Format the given date for display. */
  8528. _formatDate: function(inst, day, month, year) {
  8529. if (!day) {
  8530. inst.currentDay = inst.selectedDay;
  8531. inst.currentMonth = inst.selectedMonth;
  8532. inst.currentYear = inst.selectedYear;
  8533. }
  8534. var date = (day ? (typeof day == 'object' ? day :
  8535. this._daylightSavingAdjust(new Date(year, month, day))) :
  8536. this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  8537. return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
  8538. }
  8539. });
  8540. /* jQuery extend now ignores nulls! */
  8541. function extendRemove(target, props) {
  8542. $.extend(target, props);
  8543. for (var name in props)
  8544. if (props[name] == null || props[name] == undefined)
  8545. target[name] = props[name];
  8546. return target;
  8547. };
  8548. /* Determine whether an object is an array. */
  8549. function isArray(a) {
  8550. return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
  8551. (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
  8552. };
  8553. /* Invoke the datepicker functionality.
  8554. @param options string - a command, optionally followed by additional parameters or
  8555. Object - settings for attaching new datepicker functionality
  8556. @return jQuery object */
  8557. $.fn.datepicker = function(options){
  8558. /* Verify an empty collection wasn't passed - Fixes #6976 */
  8559. if ( !this.length ) {
  8560. return this;
  8561. }
  8562. /* Initialise the date picker. */
  8563. if (!$.datepicker.initialized) {
  8564. $(document).mousedown($.datepicker._checkExternalClick).
  8565. find('body').append($.datepicker.dpDiv);
  8566. $.datepicker.initialized = true;
  8567. }
  8568. var otherArgs = Array.prototype.slice.call(arguments, 1);
  8569. if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
  8570. return $.datepicker['_' + options + 'Datepicker'].
  8571. apply($.datepicker, [this[0]].concat(otherArgs));
  8572. if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
  8573. return $.datepicker['_' + options + 'Datepicker'].
  8574. apply($.datepicker, [this[0]].concat(otherArgs));
  8575. return this.each(function() {
  8576. typeof options == 'string' ?
  8577. $.datepicker['_' + options + 'Datepicker'].
  8578. apply($.datepicker, [this].concat(otherArgs)) :
  8579. $.datepicker._attachDatepicker(this, options);
  8580. });
  8581. };
  8582. $.datepicker = new Datepicker(); // singleton instance
  8583. $.datepicker.initialized = false;
  8584. $.datepicker.uuid = new Date().getTime();
  8585. $.datepicker.version = "1.8.11";
  8586. // Workaround for #4055
  8587. // Add another global to avoid noConflict issues with inline event handlers
  8588. window['DP_jQuery_' + dpuuid] = $;
  8589. })(jQuery);
  8590. /*
  8591. * Note: While Microsoft is not the author of this file, Microsoft is
  8592. * offering you a license subject to the terms of the Microsoft Software
  8593. * License Terms for Microsoft ASP.NET Model View Controller 3.
  8594. * Microsoft reserves all other rights. The notices below are provided
  8595. * for informational purposes only and are not the license terms under
  8596. * which Microsoft distributed this file.
  8597. *
  8598. * jQuery UI Progressbar 1.8.11
  8599. *
  8600. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  8601. *
  8602. * http://docs.jquery.com/UI/Progressbar
  8603. *
  8604. * Depends:
  8605. * jquery.ui.core.js
  8606. * jquery.ui.widget.js
  8607. */
  8608. (function( $, undefined ) {
  8609. $.widget( "ui.progressbar", {
  8610. options: {
  8611. value: 0,
  8612. max: 100
  8613. },
  8614. min: 0,
  8615. _create: function() {
  8616. this.element
  8617. .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8618. .attr({
  8619. role: "progressbar",
  8620. "aria-valuemin": this.min,
  8621. "aria-valuemax": this.options.max,
  8622. "aria-valuenow": this._value()
  8623. });
  8624. this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  8625. .appendTo( this.element );
  8626. this.oldValue = this._value();
  8627. this._refreshValue();
  8628. },
  8629. destroy: function() {
  8630. this.element
  8631. .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8632. .removeAttr( "role" )
  8633. .removeAttr( "aria-valuemin" )
  8634. .removeAttr( "aria-valuemax" )
  8635. .removeAttr( "aria-valuenow" );
  8636. this.valueDiv.remove();
  8637. $.Widget.prototype.destroy.apply( this, arguments );
  8638. },
  8639. value: function( newValue ) {
  8640. if ( newValue === undefined ) {
  8641. return this._value();
  8642. }
  8643. this._setOption( "value", newValue );
  8644. return this;
  8645. },
  8646. _setOption: function( key, value ) {
  8647. if ( key === "value" ) {
  8648. this.options.value = value;
  8649. this._refreshValue();
  8650. if ( this._value() === this.options.max ) {
  8651. this._trigger( "complete" );
  8652. }
  8653. }
  8654. $.Widget.prototype._setOption.apply( this, arguments );
  8655. },
  8656. _value: function() {
  8657. var val = this.options.value;
  8658. // normalize invalid value
  8659. if ( typeof val !== "number" ) {
  8660. val = 0;
  8661. }
  8662. return Math.min( this.options.max, Math.max( this.min, val ) );
  8663. },
  8664. _percentage: function() {
  8665. return 100 * this._value() / this.options.max;
  8666. },
  8667. _refreshValue: function() {
  8668. var value = this.value();
  8669. var percentage = this._percentage();
  8670. if ( this.oldValue !== value ) {
  8671. this.oldValue = value;
  8672. this._trigger( "change" );
  8673. }
  8674. this.valueDiv
  8675. .toggleClass( "ui-corner-right", value === this.options.max )
  8676. .width( percentage.toFixed(0) + "%" );
  8677. this.element.attr( "aria-valuenow", value );
  8678. }
  8679. });
  8680. $.extend( $.ui.progressbar, {
  8681. version: "1.8.11"
  8682. });
  8683. })( jQuery );
  8684. /*
  8685. * Note: While Microsoft is not the author of this file, Microsoft is
  8686. * offering you a license subject to the terms of the Microsoft Software
  8687. * License Terms for Microsoft ASP.NET Model View Controller 3.
  8688. * Microsoft reserves all other rights. The notices below are provided
  8689. * for informational purposes only and are not the license terms under
  8690. * which Microsoft distributed this file.
  8691. *
  8692. * jQuery UI Effects 1.8.11
  8693. *
  8694. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  8695. *
  8696. * http://docs.jquery.com/UI/Effects/
  8697. */
  8698. ;jQuery.effects || (function($, undefined) {
  8699. $.effects = {};
  8700. /******************************************************************************/
  8701. /****************************** COLOR ANIMATIONS ******************************/
  8702. /******************************************************************************/
  8703. // override the animation for color styles
  8704. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
  8705. 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
  8706. function(i, attr) {
  8707. $.fx.step[attr] = function(fx) {
  8708. if (!fx.colorInit) {
  8709. fx.start = getColor(fx.elem, attr);
  8710. fx.end = getRGB(fx.end);
  8711. fx.colorInit = true;
  8712. }
  8713. fx.elem.style[attr] = 'rgb(' +
  8714. Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
  8715. Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
  8716. Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
  8717. };
  8718. });
  8719. // Color Conversion functions from highlightFade
  8720. // By Blair Mitchelmore
  8721. // http://jquery.offput.ca/highlightFade/
  8722. // Parse strings looking for color tuples [255,255,255]
  8723. function getRGB(color) {
  8724. var result;
  8725. // Check if we're already dealing with an array of colors
  8726. if ( color && color.constructor == Array && color.length == 3 )
  8727. return color;
  8728. // Look for rgb(num,num,num)
  8729. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  8730. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  8731. // Look for rgb(num%,num%,num%)
  8732. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  8733. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  8734. // Look for #a0b1c2
  8735. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  8736. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  8737. // Look for #fff
  8738. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  8739. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  8740. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  8741. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  8742. return colors['transparent'];
  8743. // Otherwise, we're most likely dealing with a named color
  8744. return colors[$.trim(color).toLowerCase()];
  8745. }
  8746. function getColor(elem, attr) {
  8747. var color;
  8748. do {
  8749. color = $.curCSS(elem, attr);
  8750. // Keep going until we find an element that has color, or we hit the body
  8751. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  8752. break;
  8753. attr = "backgroundColor";
  8754. } while ( elem = elem.parentNode );
  8755. return getRGB(color);
  8756. };
  8757. // Some named colors to work with
  8758. // From Interface by Stefan Petre
  8759. // http://interface.eyecon.ro/
  8760. var colors = {
  8761. aqua:[0,255,255],
  8762. azure:[240,255,255],
  8763. beige:[245,245,220],
  8764. black:[0,0,0],
  8765. blue:[0,0,255],
  8766. brown:[165,42,42],
  8767. cyan:[0,255,255],
  8768. darkblue:[0,0,139],
  8769. darkcyan:[0,139,139],
  8770. darkgrey:[169,169,169],
  8771. darkgreen:[0,100,0],
  8772. darkkhaki:[189,183,107],
  8773. darkmagenta:[139,0,139],
  8774. darkolivegreen:[85,107,47],
  8775. darkorange:[255,140,0],
  8776. darkorchid:[153,50,204],
  8777. darkred:[139,0,0],
  8778. darksalmon:[233,150,122],
  8779. darkviolet:[148,0,211],
  8780. fuchsia:[255,0,255],
  8781. gold:[255,215,0],
  8782. green:[0,128,0],
  8783. indigo:[75,0,130],
  8784. khaki:[240,230,140],
  8785. lightblue:[173,216,230],
  8786. lightcyan:[224,255,255],
  8787. lightgreen:[144,238,144],
  8788. lightgrey:[211,211,211],
  8789. lightpink:[255,182,193],
  8790. lightyellow:[255,255,224],
  8791. lime:[0,255,0],
  8792. magenta:[255,0,255],
  8793. maroon:[128,0,0],
  8794. navy:[0,0,128],
  8795. olive:[128,128,0],
  8796. orange:[255,165,0],
  8797. pink:[255,192,203],
  8798. purple:[128,0,128],
  8799. violet:[128,0,128],
  8800. red:[255,0,0],
  8801. silver:[192,192,192],
  8802. white:[255,255,255],
  8803. yellow:[255,255,0],
  8804. transparent: [255,255,255]
  8805. };
  8806. /******************************************************************************/
  8807. /****************************** CLASS ANIMATIONS ******************************/
  8808. /******************************************************************************/
  8809. var classAnimationActions = ['add', 'remove', 'toggle'],
  8810. shorthandStyles = {
  8811. border: 1,
  8812. borderBottom: 1,
  8813. borderColor: 1,
  8814. borderLeft: 1,
  8815. borderRight: 1,
  8816. borderTop: 1,
  8817. borderWidth: 1,
  8818. margin: 1,
  8819. padding: 1
  8820. };
  8821. function getElementStyles() {
  8822. var style = document.defaultView
  8823. ? document.defaultView.getComputedStyle(this, null)
  8824. : this.currentStyle,
  8825. newStyle = {},
  8826. key,
  8827. camelCase;
  8828. // webkit enumerates style porperties
  8829. if (style && style.length && style[0] && style[style[0]]) {
  8830. var len = style.length;
  8831. while (len--) {
  8832. key = style[len];
  8833. if (typeof style[key] == 'string') {
  8834. camelCase = key.replace(/\-(\w)/g, function(all, letter){
  8835. return letter.toUpperCase();
  8836. });
  8837. newStyle[camelCase] = style[key];
  8838. }
  8839. }
  8840. } else {
  8841. for (key in style) {
  8842. if (typeof style[key] === 'string') {
  8843. newStyle[key] = style[key];
  8844. }
  8845. }
  8846. }
  8847. return newStyle;
  8848. }
  8849. function filterStyles(styles) {
  8850. var name, value;
  8851. for (name in styles) {
  8852. value = styles[name];
  8853. if (
  8854. // ignore null and undefined values
  8855. value == null ||
  8856. // ignore functions (when does this occur?)
  8857. $.isFunction(value) ||
  8858. // shorthand styles that need to be expanded
  8859. name in shorthandStyles ||
  8860. // ignore scrollbars (break in IE)
  8861. (/scrollbar/).test(name) ||
  8862. // only colors or values that can be converted to numbers
  8863. (!(/color/i).test(name) && isNaN(parseFloat(value)))
  8864. ) {
  8865. delete styles[name];
  8866. }
  8867. }
  8868. return styles;
  8869. }
  8870. function styleDifference(oldStyle, newStyle) {
  8871. var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
  8872. name;
  8873. for (name in newStyle) {
  8874. if (oldStyle[name] != newStyle[name]) {
  8875. diff[name] = newStyle[name];
  8876. }
  8877. }
  8878. return diff;
  8879. }
  8880. $.effects.animateClass = function(value, duration, easing, callback) {
  8881. if ($.isFunction(easing)) {
  8882. callback = easing;
  8883. easing = null;
  8884. }
  8885. return this.queue('fx', function() {
  8886. var that = $(this),
  8887. originalStyleAttr = that.attr('style') || ' ',
  8888. originalStyle = filterStyles(getElementStyles.call(this)),
  8889. newStyle,
  8890. className = that.attr('className');
  8891. $.each(classAnimationActions, function(i, action) {
  8892. if (value[action]) {
  8893. that[action + 'Class'](value[action]);
  8894. }
  8895. });
  8896. newStyle = filterStyles(getElementStyles.call(this));
  8897. that.attr('className', className);
  8898. that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
  8899. $.each(classAnimationActions, function(i, action) {
  8900. if (value[action]) { that[action + 'Class'](value[action]); }
  8901. });
  8902. // work around bug in IE by clearing the cssText before setting it
  8903. if (typeof that.attr('style') == 'object') {
  8904. that.attr('style').cssText = '';
  8905. that.attr('style').cssText = originalStyleAttr;
  8906. } else {
  8907. that.attr('style', originalStyleAttr);
  8908. }
  8909. if (callback) { callback.apply(this, arguments); }
  8910. });
  8911. // $.animate adds a function to the end of the queue
  8912. // but we want it at the front
  8913. var queue = $.queue(this),
  8914. anim = queue.splice(queue.length - 1, 1)[0];
  8915. queue.splice(1, 0, anim);
  8916. $.dequeue(this);
  8917. });
  8918. };
  8919. $.fn.extend({
  8920. _addClass: $.fn.addClass,
  8921. addClass: function(classNames, speed, easing, callback) {
  8922. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  8923. },
  8924. _removeClass: $.fn.removeClass,
  8925. removeClass: function(classNames,speed,easing,callback) {
  8926. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  8927. },
  8928. _toggleClass: $.fn.toggleClass,
  8929. toggleClass: function(classNames, force, speed, easing, callback) {
  8930. if ( typeof force == "boolean" || force === undefined ) {
  8931. if ( !speed ) {
  8932. // without speed parameter;
  8933. return this._toggleClass(classNames, force);
  8934. } else {
  8935. return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
  8936. }
  8937. } else {
  8938. // without switch parameter;
  8939. return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
  8940. }
  8941. },
  8942. switchClass: function(remove,add,speed,easing,callback) {
  8943. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  8944. }
  8945. });
  8946. /******************************************************************************/
  8947. /*********************************** EFFECTS **********************************/
  8948. /******************************************************************************/
  8949. $.extend($.effects, {
  8950. version: "1.8.11",
  8951. // Saves a set of properties in a data storage
  8952. save: function(element, set) {
  8953. for(var i=0; i < set.length; i++) {
  8954. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  8955. }
  8956. },
  8957. // Restores a set of previously saved properties from a data storage
  8958. restore: function(element, set) {
  8959. for(var i=0; i < set.length; i++) {
  8960. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  8961. }
  8962. },
  8963. setMode: function(el, mode) {
  8964. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  8965. return mode;
  8966. },
  8967. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  8968. // this should be a little more flexible in the future to handle a string & hash
  8969. var y, x;
  8970. switch (origin[0]) {
  8971. case 'top': y = 0; break;
  8972. case 'middle': y = 0.5; break;
  8973. case 'bottom': y = 1; break;
  8974. default: y = origin[0] / original.height;
  8975. };
  8976. switch (origin[1]) {
  8977. case 'left': x = 0; break;
  8978. case 'center': x = 0.5; break;
  8979. case 'right': x = 1; break;
  8980. default: x = origin[1] / original.width;
  8981. };
  8982. return {x: x, y: y};
  8983. },
  8984. // Wraps the element around a wrapper that copies position properties
  8985. createWrapper: function(element) {
  8986. // if the element is already wrapped, return it
  8987. if (element.parent().is('.ui-effects-wrapper')) {
  8988. return element.parent();
  8989. }
  8990. // wrap the element
  8991. var props = {
  8992. width: element.outerWidth(true),
  8993. height: element.outerHeight(true),
  8994. 'float': element.css('float')
  8995. },
  8996. wrapper = $('<div></div>')
  8997. .addClass('ui-effects-wrapper')
  8998. .css({
  8999. fontSize: '100%',
  9000. background: 'transparent',
  9001. border: 'none',
  9002. margin: 0,
  9003. padding: 0
  9004. });
  9005. element.wrap(wrapper);
  9006. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
  9007. // transfer positioning properties to the wrapper
  9008. if (element.css('position') == 'static') {
  9009. wrapper.css({ position: 'relative' });
  9010. element.css({ position: 'relative' });
  9011. } else {
  9012. $.extend(props, {
  9013. position: element.css('position'),
  9014. zIndex: element.css('z-index')
  9015. });
  9016. $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
  9017. props[pos] = element.css(pos);
  9018. if (isNaN(parseInt(props[pos], 10))) {
  9019. props[pos] = 'auto';
  9020. }
  9021. });
  9022. element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });
  9023. }
  9024. return wrapper.css(props).show();
  9025. },
  9026. removeWrapper: function(element) {
  9027. if (element.parent().is('.ui-effects-wrapper'))
  9028. return element.parent().replaceWith(element);
  9029. return element;
  9030. },
  9031. setTransition: function(element, list, factor, value) {
  9032. value = value || {};
  9033. $.each(list, function(i, x){
  9034. unit = element.cssUnit(x);
  9035. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  9036. });
  9037. return value;
  9038. }
  9039. });
  9040. function _normalizeArguments(effect, options, speed, callback) {
  9041. // shift params for method overloading
  9042. if (typeof effect == 'object') {
  9043. callback = options;
  9044. speed = null;
  9045. options = effect;
  9046. effect = options.effect;
  9047. }
  9048. if ($.isFunction(options)) {
  9049. callback = options;
  9050. speed = null;
  9051. options = {};
  9052. }
  9053. if (typeof options == 'number' || $.fx.speeds[options]) {
  9054. callback = speed;
  9055. speed = options;
  9056. options = {};
  9057. }
  9058. if ($.isFunction(speed)) {
  9059. callback = speed;
  9060. speed = null;
  9061. }
  9062. options = options || {};
  9063. speed = speed || options.duration;
  9064. speed = $.fx.off ? 0 : typeof speed == 'number'
  9065. ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
  9066. callback = callback || options.complete;
  9067. return [effect, options, speed, callback];
  9068. }
  9069. function standardSpeed( speed ) {
  9070. // valid standard speeds
  9071. if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
  9072. return true;
  9073. }
  9074. // invalid strings - treat as "normal" speed
  9075. if ( typeof speed === "string" && !$.effects[ speed ] ) {
  9076. return true;
  9077. }
  9078. return false;
  9079. }
  9080. $.fn.extend({
  9081. effect: function(effect, options, speed, callback) {
  9082. var args = _normalizeArguments.apply(this, arguments),
  9083. // TODO: make effects take actual parameters instead of a hash
  9084. args2 = {
  9085. options: args[1],
  9086. duration: args[2],
  9087. callback: args[3]
  9088. },
  9089. mode = args2.options.mode,
  9090. effectMethod = $.effects[effect];
  9091. if ( $.fx.off || !effectMethod ) {
  9092. // delegate to the original method (e.g., .show()) if possible
  9093. if ( mode ) {
  9094. return this[ mode ]( args2.duration, args2.callback );
  9095. } else {
  9096. return this.each(function() {
  9097. if ( args2.callback ) {
  9098. args2.callback.call( this );
  9099. }
  9100. });
  9101. }
  9102. }
  9103. return effectMethod.call(this, args2);
  9104. },
  9105. _show: $.fn.show,
  9106. show: function(speed) {
  9107. if ( standardSpeed( speed ) ) {
  9108. return this._show.apply(this, arguments);
  9109. } else {
  9110. var args = _normalizeArguments.apply(this, arguments);
  9111. args[1].mode = 'show';
  9112. return this.effect.apply(this, args);
  9113. }
  9114. },
  9115. _hide: $.fn.hide,
  9116. hide: function(speed) {
  9117. if ( standardSpeed( speed ) ) {
  9118. return this._hide.apply(this, arguments);
  9119. } else {
  9120. var args = _normalizeArguments.apply(this, arguments);
  9121. args[1].mode = 'hide';
  9122. return this.effect.apply(this, args);
  9123. }
  9124. },
  9125. // jQuery core overloads toggle and creates _toggle
  9126. __toggle: $.fn.toggle,
  9127. toggle: function(speed) {
  9128. if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
  9129. return this.__toggle.apply(this, arguments);
  9130. } else {
  9131. var args = _normalizeArguments.apply(this, arguments);
  9132. args[1].mode = 'toggle';
  9133. return this.effect.apply(this, args);
  9134. }
  9135. },
  9136. // helper functions
  9137. cssUnit: function(key) {
  9138. var style = this.css(key), val = [];
  9139. $.each( ['em','px','%','pt'], function(i, unit){
  9140. if(style.indexOf(unit) > 0)
  9141. val = [parseFloat(style), unit];
  9142. });
  9143. return val;
  9144. }
  9145. });
  9146. /******************************************************************************/
  9147. /*********************************** EASING ***********************************/
  9148. /******************************************************************************/
  9149. /*
  9150. * Note: While Microsoft is not the author of this file, Microsoft is
  9151. * offering you a license subject to the terms of the Microsoft Software
  9152. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9153. * Microsoft reserves all other rights. The notices below are provided
  9154. * for informational purposes only and are not the license terms under
  9155. * which Microsoft distributed this file.
  9156. *
  9157. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  9158. *
  9159. * Uses the built in easing capabilities added In jQuery 1.1
  9160. * to offer multiple easing options
  9161. *
  9162. * Copyright 2008 George McGinley Smith
  9163. *
  9164. */
  9165. // t: current time, b: begInnIng value, c: change In value, d: duration
  9166. $.easing.jswing = $.easing.swing;
  9167. $.extend($.easing,
  9168. {
  9169. def: 'easeOutQuad',
  9170. swing: function (x, t, b, c, d) {
  9171. //alert($.easing.default);
  9172. return $.easing[$.easing.def](x, t, b, c, d);
  9173. },
  9174. easeInQuad: function (x, t, b, c, d) {
  9175. return c*(t/=d)*t + b;
  9176. },
  9177. easeOutQuad: function (x, t, b, c, d) {
  9178. return -c *(t/=d)*(t-2) + b;
  9179. },
  9180. easeInOutQuad: function (x, t, b, c, d) {
  9181. if ((t/=d/2) < 1) return c/2*t*t + b;
  9182. return -c/2 * ((--t)*(t-2) - 1) + b;
  9183. },
  9184. easeInCubic: function (x, t, b, c, d) {
  9185. return c*(t/=d)*t*t + b;
  9186. },
  9187. easeOutCubic: function (x, t, b, c, d) {
  9188. return c*((t=t/d-1)*t*t + 1) + b;
  9189. },
  9190. easeInOutCubic: function (x, t, b, c, d) {
  9191. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  9192. return c/2*((t-=2)*t*t + 2) + b;
  9193. },
  9194. easeInQuart: function (x, t, b, c, d) {
  9195. return c*(t/=d)*t*t*t + b;
  9196. },
  9197. easeOutQuart: function (x, t, b, c, d) {
  9198. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  9199. },
  9200. easeInOutQuart: function (x, t, b, c, d) {
  9201. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  9202. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  9203. },
  9204. easeInQuint: function (x, t, b, c, d) {
  9205. return c*(t/=d)*t*t*t*t + b;
  9206. },
  9207. easeOutQuint: function (x, t, b, c, d) {
  9208. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  9209. },
  9210. easeInOutQuint: function (x, t, b, c, d) {
  9211. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  9212. return c/2*((t-=2)*t*t*t*t + 2) + b;
  9213. },
  9214. easeInSine: function (x, t, b, c, d) {
  9215. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  9216. },
  9217. easeOutSine: function (x, t, b, c, d) {
  9218. return c * Math.sin(t/d * (Math.PI/2)) + b;
  9219. },
  9220. easeInOutSine: function (x, t, b, c, d) {
  9221. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  9222. },
  9223. easeInExpo: function (x, t, b, c, d) {
  9224. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  9225. },
  9226. easeOutExpo: function (x, t, b, c, d) {
  9227. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  9228. },
  9229. easeInOutExpo: function (x, t, b, c, d) {
  9230. if (t==0) return b;
  9231. if (t==d) return b+c;
  9232. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  9233. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  9234. },
  9235. easeInCirc: function (x, t, b, c, d) {
  9236. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  9237. },
  9238. easeOutCirc: function (x, t, b, c, d) {
  9239. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  9240. },
  9241. easeInOutCirc: function (x, t, b, c, d) {
  9242. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  9243. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  9244. },
  9245. easeInElastic: function (x, t, b, c, d) {
  9246. var s=1.70158;var p=0;var a=c;
  9247. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  9248. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9249. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9250. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  9251. },
  9252. easeOutElastic: function (x, t, b, c, d) {
  9253. var s=1.70158;var p=0;var a=c;
  9254. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  9255. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9256. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9257. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  9258. },
  9259. easeInOutElastic: function (x, t, b, c, d) {
  9260. var s=1.70158;var p=0;var a=c;
  9261. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  9262. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9263. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9264. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  9265. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  9266. },
  9267. easeInBack: function (x, t, b, c, d, s) {
  9268. if (s == undefined) s = 1.70158;
  9269. return c*(t/=d)*t*((s+1)*t - s) + b;
  9270. },
  9271. easeOutBack: function (x, t, b, c, d, s) {
  9272. if (s == undefined) s = 1.70158;
  9273. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  9274. },
  9275. easeInOutBack: function (x, t, b, c, d, s) {
  9276. if (s == undefined) s = 1.70158;
  9277. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  9278. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  9279. },
  9280. easeInBounce: function (x, t, b, c, d) {
  9281. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  9282. },
  9283. easeOutBounce: function (x, t, b, c, d) {
  9284. if ((t/=d) < (1/2.75)) {
  9285. return c*(7.5625*t*t) + b;
  9286. } else if (t < (2/2.75)) {
  9287. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  9288. } else if (t < (2.5/2.75)) {
  9289. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  9290. } else {
  9291. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  9292. }
  9293. },
  9294. easeInOutBounce: function (x, t, b, c, d) {
  9295. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  9296. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  9297. }
  9298. });
  9299. /*
  9300. * Note: While Microsoft is not the author of this file, Microsoft is
  9301. * offering you a license subject to the terms of the Microsoft Software
  9302. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9303. * Microsoft reserves all other rights. The notices below are provided
  9304. * for informational purposes only and are not the license terms under
  9305. * which Microsoft distributed this file.
  9306. *
  9307. *
  9308. * Copyright 2001 Robert Penner
  9309. * All rights reserved.
  9310. *
  9311. */
  9312. })(jQuery);
  9313. /*
  9314. * Note: While Microsoft is not the author of this file, Microsoft is
  9315. * offering you a license subject to the terms of the Microsoft Software
  9316. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9317. * Microsoft reserves all other rights. The notices below are provided
  9318. * for informational purposes only and are not the license terms under
  9319. * which Microsoft distributed this file.
  9320. *
  9321. * jQuery UI Effects Blind 1.8.11
  9322. *
  9323. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9324. *
  9325. * http://docs.jquery.com/UI/Effects/Blind
  9326. *
  9327. * Depends:
  9328. * jquery.effects.core.js
  9329. */
  9330. (function( $, undefined ) {
  9331. $.effects.blind = function(o) {
  9332. return this.queue(function() {
  9333. // Create element
  9334. var el = $(this), props = ['position','top','bottom','left','right'];
  9335. // Set options
  9336. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9337. var direction = o.options.direction || 'vertical'; // Default direction
  9338. // Adjust
  9339. $.effects.save(el, props); el.show(); // Save & Show
  9340. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9341. var ref = (direction == 'vertical') ? 'height' : 'width';
  9342. var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
  9343. if(mode == 'show') wrapper.css(ref, 0); // Shift
  9344. // Animation
  9345. var animation = {};
  9346. animation[ref] = mode == 'show' ? distance : 0;
  9347. // Animate
  9348. wrapper.animate(animation, o.duration, o.options.easing, function() {
  9349. if(mode == 'hide') el.hide(); // Hide
  9350. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9351. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9352. el.dequeue();
  9353. });
  9354. });
  9355. };
  9356. })(jQuery);
  9357. /*
  9358. * Note: While Microsoft is not the author of this file, Microsoft is
  9359. * offering you a license subject to the terms of the Microsoft Software
  9360. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9361. * Microsoft reserves all other rights. The notices below are provided
  9362. * for informational purposes only and are not the license terms under
  9363. * which Microsoft distributed this file.
  9364. *
  9365. * jQuery UI Effects Bounce 1.8.11
  9366. *
  9367. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9368. *
  9369. * http://docs.jquery.com/UI/Effects/Bounce
  9370. *
  9371. * Depends:
  9372. * jquery.effects.core.js
  9373. */
  9374. (function( $, undefined ) {
  9375. $.effects.bounce = function(o) {
  9376. return this.queue(function() {
  9377. // Create element
  9378. var el = $(this), props = ['position','top','bottom','left','right'];
  9379. // Set options
  9380. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9381. var direction = o.options.direction || 'up'; // Default direction
  9382. var distance = o.options.distance || 20; // Default distance
  9383. var times = o.options.times || 5; // Default # of times
  9384. var speed = o.duration || 250; // Default speed per bounce
  9385. if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
  9386. // Adjust
  9387. $.effects.save(el, props); el.show(); // Save & Show
  9388. $.effects.createWrapper(el); // Create Wrapper
  9389. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9390. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9391. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
  9392. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  9393. if (mode == 'hide') distance = distance / (times * 2);
  9394. if (mode != 'hide') times--;
  9395. // Animate
  9396. if (mode == 'show') { // Show Bounce
  9397. var animation = {opacity: 1};
  9398. animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9399. el.animate(animation, speed / 2, o.options.easing);
  9400. distance = distance / 2;
  9401. times--;
  9402. };
  9403. for (var i = 0; i < times; i++) { // Bounces
  9404. var animation1 = {}, animation2 = {};
  9405. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9406. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9407. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
  9408. distance = (mode == 'hide') ? distance * 2 : distance / 2;
  9409. };
  9410. if (mode == 'hide') { // Last Bounce
  9411. var animation = {opacity: 0};
  9412. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9413. el.animate(animation, speed / 2, o.options.easing, function(){
  9414. el.hide(); // Hide
  9415. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9416. if(o.callback) o.callback.apply(this, arguments); // Callback
  9417. });
  9418. } else {
  9419. var animation1 = {}, animation2 = {};
  9420. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9421. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9422. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
  9423. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9424. if(o.callback) o.callback.apply(this, arguments); // Callback
  9425. });
  9426. };
  9427. el.queue('fx', function() { el.dequeue(); });
  9428. el.dequeue();
  9429. });
  9430. };
  9431. })(jQuery);
  9432. /*
  9433. * Note: While Microsoft is not the author of this file, Microsoft is
  9434. * offering you a license subject to the terms of the Microsoft Software
  9435. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9436. * Microsoft reserves all other rights. The notices below are provided
  9437. * for informational purposes only and are not the license terms under
  9438. * which Microsoft distributed this file.
  9439. *
  9440. * jQuery UI Effects Clip 1.8.11
  9441. *
  9442. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9443. *
  9444. * http://docs.jquery.com/UI/Effects/Clip
  9445. *
  9446. * Depends:
  9447. * jquery.effects.core.js
  9448. */
  9449. (function( $, undefined ) {
  9450. $.effects.clip = function(o) {
  9451. return this.queue(function() {
  9452. // Create element
  9453. var el = $(this), props = ['position','top','bottom','left','right','height','width'];
  9454. // Set options
  9455. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9456. var direction = o.options.direction || 'vertical'; // Default direction
  9457. // Adjust
  9458. $.effects.save(el, props); el.show(); // Save & Show
  9459. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9460. var animate = el[0].tagName == 'IMG' ? wrapper : el;
  9461. var ref = {
  9462. size: (direction == 'vertical') ? 'height' : 'width',
  9463. position: (direction == 'vertical') ? 'top' : 'left'
  9464. };
  9465. var distance = (direction == 'vertical') ? animate.height() : animate.width();
  9466. if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
  9467. // Animation
  9468. var animation = {};
  9469. animation[ref.size] = mode == 'show' ? distance : 0;
  9470. animation[ref.position] = mode == 'show' ? 0 : distance / 2;
  9471. // Animate
  9472. animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9473. if(mode == 'hide') el.hide(); // Hide
  9474. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9475. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9476. el.dequeue();
  9477. }});
  9478. });
  9479. };
  9480. })(jQuery);
  9481. /*
  9482. * Note: While Microsoft is not the author of this file, Microsoft is
  9483. * offering you a license subject to the terms of the Microsoft Software
  9484. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9485. * Microsoft reserves all other rights. The notices below are provided
  9486. * for informational purposes only and are not the license terms under
  9487. * which Microsoft distributed this file.
  9488. *
  9489. * jQuery UI Effects Drop 1.8.11
  9490. *
  9491. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9492. *
  9493. * http://docs.jquery.com/UI/Effects/Drop
  9494. *
  9495. * Depends:
  9496. * jquery.effects.core.js
  9497. */
  9498. (function( $, undefined ) {
  9499. $.effects.drop = function(o) {
  9500. return this.queue(function() {
  9501. // Create element
  9502. var el = $(this), props = ['position','top','bottom','left','right','opacity'];
  9503. // Set options
  9504. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9505. var direction = o.options.direction || 'left'; // Default Direction
  9506. // Adjust
  9507. $.effects.save(el, props); el.show(); // Save & Show
  9508. $.effects.createWrapper(el); // Create Wrapper
  9509. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9510. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9511. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
  9512. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  9513. // Animation
  9514. var animation = {opacity: mode == 'show' ? 1 : 0};
  9515. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  9516. // Animate
  9517. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9518. if(mode == 'hide') el.hide(); // Hide
  9519. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9520. if(o.callback) o.callback.apply(this, arguments); // Callback
  9521. el.dequeue();
  9522. }});
  9523. });
  9524. };
  9525. })(jQuery);
  9526. /*
  9527. * Note: While Microsoft is not the author of this file, Microsoft is
  9528. * offering you a license subject to the terms of the Microsoft Software
  9529. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9530. * Microsoft reserves all other rights. The notices below are provided
  9531. * for informational purposes only and are not the license terms under
  9532. * which Microsoft distributed this file.
  9533. *
  9534. * jQuery UI Effects Explode 1.8.11
  9535. *
  9536. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9537. *
  9538. * http://docs.jquery.com/UI/Effects/Explode
  9539. *
  9540. * Depends:
  9541. * jquery.effects.core.js
  9542. */
  9543. (function( $, undefined ) {
  9544. $.effects.explode = function(o) {
  9545. return this.queue(function() {
  9546. var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  9547. var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  9548. o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
  9549. var el = $(this).show().css('visibility', 'hidden');
  9550. var offset = el.offset();
  9551. //Substract the margins - not fixing the problem yet.
  9552. offset.top -= parseInt(el.css("marginTop"),10) || 0;
  9553. offset.left -= parseInt(el.css("marginLeft"),10) || 0;
  9554. var width = el.outerWidth(true);
  9555. var height = el.outerHeight(true);
  9556. for(var i=0;i<rows;i++) { // =
  9557. for(var j=0;j<cells;j++) { // ||
  9558. el
  9559. .clone()
  9560. .appendTo('body')
  9561. .wrap('<div></div>')
  9562. .css({
  9563. position: 'absolute',
  9564. visibility: 'visible',
  9565. left: -j*(width/cells),
  9566. top: -i*(height/rows)
  9567. })
  9568. .parent()
  9569. .addClass('ui-effects-explode')
  9570. .css({
  9571. position: 'absolute',
  9572. overflow: 'hidden',
  9573. width: width/cells,
  9574. height: height/rows,
  9575. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
  9576. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
  9577. opacity: o.options.mode == 'show' ? 0 : 1
  9578. }).animate({
  9579. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
  9580. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
  9581. opacity: o.options.mode == 'show' ? 1 : 0
  9582. }, o.duration || 500);
  9583. }
  9584. }
  9585. // Set a timeout, to call the callback approx. when the other animations have finished
  9586. setTimeout(function() {
  9587. o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
  9588. if(o.callback) o.callback.apply(el[0]); // Callback
  9589. el.dequeue();
  9590. $('div.ui-effects-explode').remove();
  9591. }, o.duration || 500);
  9592. });
  9593. };
  9594. })(jQuery);
  9595. /*
  9596. * Note: While Microsoft is not the author of this file, Microsoft is
  9597. * offering you a license subject to the terms of the Microsoft Software
  9598. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9599. * Microsoft reserves all other rights. The notices below are provided
  9600. * for informational purposes only and are not the license terms under
  9601. * which Microsoft distributed this file.
  9602. *
  9603. * jQuery UI Effects Fade 1.8.11
  9604. *
  9605. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)\
  9606. *
  9607. * http://docs.jquery.com/UI/Effects/Fade
  9608. *
  9609. * Depends:
  9610. * jquery.effects.core.js
  9611. */
  9612. (function( $, undefined ) {
  9613. $.effects.fade = function(o) {
  9614. return this.queue(function() {
  9615. var elem = $(this),
  9616. mode = $.effects.setMode(elem, o.options.mode || 'hide');
  9617. elem.animate({ opacity: mode }, {
  9618. queue: false,
  9619. duration: o.duration,
  9620. easing: o.options.easing,
  9621. complete: function() {
  9622. (o.callback && o.callback.apply(this, arguments));
  9623. elem.dequeue();
  9624. }
  9625. });
  9626. });
  9627. };
  9628. })(jQuery);
  9629. /*
  9630. * Note: While Microsoft is not the author of this file, Microsoft is
  9631. * offering you a license subject to the terms of the Microsoft Software
  9632. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9633. * Microsoft reserves all other rights. The notices below are provided
  9634. * for informational purposes only and are not the license terms under
  9635. * which Microsoft distributed this file.
  9636. *
  9637. * jQuery UI Effects Fold 1.8.11
  9638. *
  9639. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9640. *
  9641. * http://docs.jquery.com/UI/Effects/Fold
  9642. *
  9643. * Depends:
  9644. * jquery.effects.core.js
  9645. */
  9646. (function( $, undefined ) {
  9647. $.effects.fold = function(o) {
  9648. return this.queue(function() {
  9649. // Create element
  9650. var el = $(this), props = ['position','top','bottom','left','right'];
  9651. // Set options
  9652. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9653. var size = o.options.size || 15; // Default fold size
  9654. var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
  9655. var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
  9656. // Adjust
  9657. $.effects.save(el, props); el.show(); // Save & Show
  9658. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9659. var widthFirst = ((mode == 'show') != horizFirst);
  9660. var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
  9661. var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
  9662. var percent = /([0-9]+)%/.exec(size);
  9663. if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
  9664. if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
  9665. // Animation
  9666. var animation1 = {}, animation2 = {};
  9667. animation1[ref[0]] = mode == 'show' ? distance[0] : size;
  9668. animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
  9669. // Animate
  9670. wrapper.animate(animation1, duration, o.options.easing)
  9671. .animate(animation2, duration, o.options.easing, function() {
  9672. if(mode == 'hide') el.hide(); // Hide
  9673. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9674. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9675. el.dequeue();
  9676. });
  9677. });
  9678. };
  9679. })(jQuery);
  9680. /*
  9681. * Note: While Microsoft is not the author of this file, Microsoft is
  9682. * offering you a license subject to the terms of the Microsoft Software
  9683. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9684. * Microsoft reserves all other rights. The notices below are provided
  9685. * for informational purposes only and are not the license terms under
  9686. * which Microsoft distributed this file.
  9687. *
  9688. * jQuery UI Effects Highlight 1.8.11
  9689. *
  9690. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)\
  9691. *
  9692. * http://docs.jquery.com/UI/Effects/Highlight
  9693. *
  9694. * Depends:
  9695. * jquery.effects.core.js
  9696. */
  9697. (function( $, undefined ) {
  9698. $.effects.highlight = function(o) {
  9699. return this.queue(function() {
  9700. var elem = $(this),
  9701. props = ['backgroundImage', 'backgroundColor', 'opacity'],
  9702. mode = $.effects.setMode(elem, o.options.mode || 'show'),
  9703. animation = {
  9704. backgroundColor: elem.css('backgroundColor')
  9705. };
  9706. if (mode == 'hide') {
  9707. animation.opacity = 0;
  9708. }
  9709. $.effects.save(elem, props);
  9710. elem
  9711. .show()
  9712. .css({
  9713. backgroundImage: 'none',
  9714. backgroundColor: o.options.color || '#ffff99'
  9715. })
  9716. .animate(animation, {
  9717. queue: false,
  9718. duration: o.duration,
  9719. easing: o.options.easing,
  9720. complete: function() {
  9721. (mode == 'hide' && elem.hide());
  9722. $.effects.restore(elem, props);
  9723. (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
  9724. (o.callback && o.callback.apply(this, arguments));
  9725. elem.dequeue();
  9726. }
  9727. });
  9728. });
  9729. };
  9730. })(jQuery);
  9731. /*
  9732. * Note: While Microsoft is not the author of this file, Microsoft is
  9733. * offering you a license subject to the terms of the Microsoft Software
  9734. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9735. * Microsoft reserves all other rights. The notices below are provided
  9736. * for informational purposes only and are not the license terms under
  9737. * which Microsoft distributed this file.
  9738. *
  9739. * jQuery UI Effects Pulsate 1.8.11
  9740. *
  9741. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9742. *
  9743. * http://docs.jquery.com/UI/Effects/Pulsate
  9744. *
  9745. * Depends:
  9746. * jquery.effects.core.js
  9747. */
  9748. (function( $, undefined ) {
  9749. $.effects.pulsate = function(o) {
  9750. return this.queue(function() {
  9751. var elem = $(this),
  9752. mode = $.effects.setMode(elem, o.options.mode || 'show');
  9753. times = ((o.options.times || 5) * 2) - 1;
  9754. duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
  9755. isVisible = elem.is(':visible'),
  9756. animateTo = 0;
  9757. if (!isVisible) {
  9758. elem.css('opacity', 0).show();
  9759. animateTo = 1;
  9760. }
  9761. if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
  9762. times--;
  9763. }
  9764. for (var i = 0; i < times; i++) {
  9765. elem.animate({ opacity: animateTo }, duration, o.options.easing);
  9766. animateTo = (animateTo + 1) % 2;
  9767. }
  9768. elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
  9769. if (animateTo == 0) {
  9770. elem.hide();
  9771. }
  9772. (o.callback && o.callback.apply(this, arguments));
  9773. });
  9774. elem
  9775. .queue('fx', function() { elem.dequeue(); })
  9776. .dequeue();
  9777. });
  9778. };
  9779. })(jQuery);
  9780. /*
  9781. * Note: While Microsoft is not the author of this file, Microsoft is
  9782. * offering you a license subject to the terms of the Microsoft Software
  9783. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9784. * Microsoft reserves all other rights. The notices below are provided
  9785. * for informational purposes only and are not the license terms under
  9786. * which Microsoft distributed this file.
  9787. *
  9788. * jQuery UI Effects Scale 1.8.11
  9789. *
  9790. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9791. *
  9792. * http://docs.jquery.com/UI/Effects/Scale
  9793. *
  9794. * Depends:
  9795. * jquery.effects.core.js
  9796. */
  9797. (function( $, undefined ) {
  9798. $.effects.puff = function(o) {
  9799. return this.queue(function() {
  9800. var elem = $(this),
  9801. mode = $.effects.setMode(elem, o.options.mode || 'hide'),
  9802. percent = parseInt(o.options.percent, 10) || 150,
  9803. factor = percent / 100,
  9804. original = { height: elem.height(), width: elem.width() };
  9805. $.extend(o.options, {
  9806. fade: true,
  9807. mode: mode,
  9808. percent: mode == 'hide' ? percent : 100,
  9809. from: mode == 'hide'
  9810. ? original
  9811. : {
  9812. height: original.height * factor,
  9813. width: original.width * factor
  9814. }
  9815. });
  9816. elem.effect('scale', o.options, o.duration, o.callback);
  9817. elem.dequeue();
  9818. });
  9819. };
  9820. $.effects.scale = function(o) {
  9821. return this.queue(function() {
  9822. // Create element
  9823. var el = $(this);
  9824. // Set options
  9825. var options = $.extend(true, {}, o.options);
  9826. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9827. var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
  9828. var direction = o.options.direction || 'both'; // Set default axis
  9829. var origin = o.options.origin; // The origin of the scaling
  9830. if (mode != 'effect') { // Set default origin and restore for show/hide
  9831. options.origin = origin || ['middle','center'];
  9832. options.restore = true;
  9833. }
  9834. var original = {height: el.height(), width: el.width()}; // Save original
  9835. el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
  9836. // Adjust
  9837. var factor = { // Set scaling factor
  9838. y: direction != 'horizontal' ? (percent / 100) : 1,
  9839. x: direction != 'vertical' ? (percent / 100) : 1
  9840. };
  9841. el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
  9842. if (o.options.fade) { // Fade option to support puff
  9843. if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
  9844. if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
  9845. };
  9846. // Animation
  9847. options.from = el.from; options.to = el.to; options.mode = mode;
  9848. // Animate
  9849. el.effect('size', options, o.duration, o.callback);
  9850. el.dequeue();
  9851. });
  9852. };
  9853. $.effects.size = function(o) {
  9854. return this.queue(function() {
  9855. // Create element
  9856. var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity'];
  9857. var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore
  9858. var props2 = ['width','height','overflow']; // Copy for children
  9859. var cProps = ['fontSize'];
  9860. var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
  9861. var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
  9862. // Set options
  9863. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9864. var restore = o.options.restore || false; // Default restore
  9865. var scale = o.options.scale || 'both'; // Default scale mode
  9866. var origin = o.options.origin; // The origin of the sizing
  9867. var original = {height: el.height(), width: el.width()}; // Save original
  9868. el.from = o.options.from || original; // Default from state
  9869. el.to = o.options.to || original; // Default to state
  9870. // Adjust
  9871. if (origin) { // Calculate baseline shifts
  9872. var baseline = $.effects.getBaseline(origin, original);
  9873. el.from.top = (original.height - el.from.height) * baseline.y;
  9874. el.from.left = (original.width - el.from.width) * baseline.x;
  9875. el.to.top = (original.height - el.to.height) * baseline.y;
  9876. el.to.left = (original.width - el.to.width) * baseline.x;
  9877. };
  9878. var factor = { // Set scaling factor
  9879. from: {y: el.from.height / original.height, x: el.from.width / original.width},
  9880. to: {y: el.to.height / original.height, x: el.to.width / original.width}
  9881. };
  9882. if (scale == 'box' || scale == 'both') { // Scale the css box
  9883. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9884. props = props.concat(vProps);
  9885. el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
  9886. el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
  9887. };
  9888. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  9889. props = props.concat(hProps);
  9890. el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
  9891. el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
  9892. };
  9893. };
  9894. if (scale == 'content' || scale == 'both') { // Scale the content
  9895. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9896. props = props.concat(cProps);
  9897. el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
  9898. el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
  9899. };
  9900. };
  9901. $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
  9902. $.effects.createWrapper(el); // Create Wrapper
  9903. el.css('overflow','hidden').css(el.from); // Shift
  9904. // Animate
  9905. if (scale == 'content' || scale == 'both') { // Scale the children
  9906. vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
  9907. hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
  9908. props2 = props.concat(vProps).concat(hProps); // Concat
  9909. el.find("*[width]").each(function(){
  9910. child = $(this);
  9911. if (restore) $.effects.save(child, props2);
  9912. var c_original = {height: child.height(), width: child.width()}; // Save original
  9913. child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
  9914. child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
  9915. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9916. child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
  9917. child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
  9918. };
  9919. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  9920. child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
  9921. child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
  9922. };
  9923. child.css(child.from); // Shift children
  9924. child.animate(child.to, o.duration, o.options.easing, function(){
  9925. if (restore) $.effects.restore(child, props2); // Restore children
  9926. }); // Animate children
  9927. });
  9928. };
  9929. // Animate
  9930. el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9931. if (el.to.opacity === 0) {
  9932. el.css('opacity', el.from.opacity);
  9933. }
  9934. if(mode == 'hide') el.hide(); // Hide
  9935. $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
  9936. if(o.callback) o.callback.apply(this, arguments); // Callback
  9937. el.dequeue();
  9938. }});
  9939. });
  9940. };
  9941. })(jQuery);
  9942. /*
  9943. * Note: While Microsoft is not the author of this file, Microsoft is
  9944. * offering you a license subject to the terms of the Microsoft Software
  9945. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9946. * Microsoft reserves all other rights. The notices below are provided
  9947. * for informational purposes only and are not the license terms under
  9948. * which Microsoft distributed this file.
  9949. *
  9950. * jQuery UI Effects Shake 1.8.11
  9951. *
  9952. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  9953. *
  9954. * http://docs.jquery.com/UI/Effects/Shake
  9955. *
  9956. * Depends:
  9957. * jquery.effects.core.js
  9958. */
  9959. (function( $, undefined ) {
  9960. $.effects.shake = function(o) {
  9961. return this.queue(function() {
  9962. // Create element
  9963. var el = $(this), props = ['position','top','bottom','left','right'];
  9964. // Set options
  9965. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9966. var direction = o.options.direction || 'left'; // Default direction
  9967. var distance = o.options.distance || 20; // Default distance
  9968. var times = o.options.times || 3; // Default # of times
  9969. var speed = o.duration || o.options.duration || 140; // Default speed per shake
  9970. // Adjust
  9971. $.effects.save(el, props); el.show(); // Save & Show
  9972. $.effects.createWrapper(el); // Create Wrapper
  9973. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9974. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9975. // Animation
  9976. var animation = {}, animation1 = {}, animation2 = {};
  9977. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9978. animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
  9979. animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
  9980. // Animate
  9981. el.animate(animation, speed, o.options.easing);
  9982. for (var i = 1; i < times; i++) { // Shakes
  9983. el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
  9984. };
  9985. el.animate(animation1, speed, o.options.easing).
  9986. animate(animation, speed / 2, o.options.easing, function(){ // Last shake
  9987. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9988. if(o.callback) o.callback.apply(this, arguments); // Callback
  9989. });
  9990. el.queue('fx', function() { el.dequeue(); });
  9991. el.dequeue();
  9992. });
  9993. };
  9994. })(jQuery);
  9995. /*
  9996. * Note: While Microsoft is not the author of this file, Microsoft is
  9997. * offering you a license subject to the terms of the Microsoft Software
  9998. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9999. * Microsoft reserves all other rights. The notices below are provided
  10000. * for informational purposes only and are not the license terms under
  10001. * which Microsoft distributed this file.
  10002. *
  10003. * jQuery UI Effects Slide 1.8.11
  10004. *
  10005. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  10006. *
  10007. * http://docs.jquery.com/UI/Effects/Slide
  10008. *
  10009. * Depends:
  10010. * jquery.effects.core.js
  10011. */
  10012. (function( $, undefined ) {
  10013. $.effects.slide = function(o) {
  10014. return this.queue(function() {
  10015. // Create element
  10016. var el = $(this), props = ['position','top','bottom','left','right'];
  10017. // Set options
  10018. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  10019. var direction = o.options.direction || 'left'; // Default Direction
  10020. // Adjust
  10021. $.effects.save(el, props); el.show(); // Save & Show
  10022. $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  10023. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  10024. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  10025. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
  10026. if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
  10027. // Animation
  10028. var animation = {};
  10029. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  10030. // Animate
  10031. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  10032. if(mode == 'hide') el.hide(); // Hide
  10033. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  10034. if(o.callback) o.callback.apply(this, arguments); // Callback
  10035. el.dequeue();
  10036. }});
  10037. });
  10038. };
  10039. })(jQuery);
  10040. /*
  10041. * Note: While Microsoft is not the author of this file, Microsoft is
  10042. * offering you a license subject to the terms of the Microsoft Software
  10043. * License Terms for Microsoft ASP.NET Model View Controller 3.
  10044. * Microsoft reserves all other rights. The notices below are provided
  10045. * for informational purposes only and are not the license terms under
  10046. * which Microsoft distributed this file.
  10047. *
  10048. * jQuery UI Effects Transfer 1.8.11
  10049. *
  10050. * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  10051. *
  10052. * http://docs.jquery.com/UI/Effects/Transfer
  10053. *
  10054. * Depends:
  10055. * jquery.effects.core.js
  10056. */
  10057. (function( $, undefined ) {
  10058. $.effects.transfer = function(o) {
  10059. return this.queue(function() {
  10060. var elem = $(this),
  10061. target = $(o.options.to),
  10062. endPosition = target.offset(),
  10063. animation = {
  10064. top: endPosition.top,
  10065. left: endPosition.left,
  10066. height: target.innerHeight(),
  10067. width: target.innerWidth()
  10068. },
  10069. startPosition = elem.offset(),
  10070. transfer = $('<div class="ui-effects-transfer"></div>')
  10071. .appendTo(document.body)
  10072. .addClass(o.options.className)
  10073. .css({
  10074. top: startPosition.top,
  10075. left: startPosition.left,
  10076. height: elem.innerHeight(),
  10077. width: elem.innerWidth(),
  10078. position: 'absolute'
  10079. })
  10080. .animate(animation, o.duration, o.options.easing, function() {
  10081. transfer.remove();
  10082. (o.callback && o.callback.apply(elem[0], arguments));
  10083. elem.dequeue();
  10084. });
  10085. });
  10086. };
  10087. })(jQuery);