aboutsummaryrefslogtreecommitdiff
path: root/static/development-bundle/ui/jquery-ui-1.7.2.custom.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/development-bundle/ui/jquery-ui-1.7.2.custom.js')
-rw-r--r--static/development-bundle/ui/jquery-ui-1.7.2.custom.js9133
1 files changed, 9133 insertions, 0 deletions
diff --git a/static/development-bundle/ui/jquery-ui-1.7.2.custom.js b/static/development-bundle/ui/jquery-ui-1.7.2.custom.js
new file mode 100644
index 0000000..01da18f
--- /dev/null
+++ b/static/development-bundle/ui/jquery-ui-1.7.2.custom.js
@@ -0,0 +1,9133 @@
1/*
2 * jQuery UI 1.7.2
3 *
4 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
7 *
8 * http://docs.jquery.com/UI
9 */
10;jQuery.ui || (function($) {
11
12var _remove = $.fn.remove,
13 isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
14
15//Helper functions and ui object
16$.ui = {
17 version: "1.7.2",
18
19 // $.ui.plugin is deprecated. Use the proxy pattern instead.
20 plugin: {
21 add: function(module, option, set) {
22 var proto = $.ui[module].prototype;
23 for(var i in set) {
24 proto.plugins[i] = proto.plugins[i] || [];
25 proto.plugins[i].push([option, set[i]]);
26 }
27 },
28 call: function(instance, name, args) {
29 var set = instance.plugins[name];
30 if(!set || !instance.element[0].parentNode) { return; }
31
32 for (var i = 0; i < set.length; i++) {
33 if (instance.options[set[i][0]]) {
34 set[i][1].apply(instance.element, args);
35 }
36 }
37 }
38 },
39
40 contains: function(a, b) {
41 return document.compareDocumentPosition
42 ? a.compareDocumentPosition(b) & 16
43 : a !== b && a.contains(b);
44 },
45
46 hasScroll: function(el, a) {
47
48 //If overflow is hidden, the element might have extra content, but the user wants to hide it
49 if ($(el).css('overflow') == 'hidden') { return false; }
50
51 var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
52 has = false;
53
54 if (el[scroll] > 0) { return true; }
55
56 // TODO: determine which cases actually cause this to happen
57 // if the element doesn't have the scroll set, see if it's possible to
58 // set the scroll
59 el[scroll] = 1;
60 has = (el[scroll] > 0);
61 el[scroll] = 0;
62 return has;
63 },
64
65 isOverAxis: function(x, reference, size) {
66 //Determines when x coordinate is over "b" element axis
67 return (x > reference) && (x < (reference + size));
68 },
69
70 isOver: function(y, x, top, left, height, width) {
71 //Determines when x, y coordinates is over "b" element
72 return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
73 },
74
75 keyCode: {
76 BACKSPACE: 8,
77 CAPS_LOCK: 20,
78 COMMA: 188,
79 CONTROL: 17,
80 DELETE: 46,
81 DOWN: 40,
82 END: 35,
83 ENTER: 13,
84 ESCAPE: 27,
85 HOME: 36,
86 INSERT: 45,
87 LEFT: 37,
88 NUMPAD_ADD: 107,
89 NUMPAD_DECIMAL: 110,
90 NUMPAD_DIVIDE: 111,
91 NUMPAD_ENTER: 108,
92 NUMPAD_MULTIPLY: 106,
93 NUMPAD_SUBTRACT: 109,
94 PAGE_DOWN: 34,
95 PAGE_UP: 33,
96 PERIOD: 190,
97 RIGHT: 39,
98 SHIFT: 16,
99 SPACE: 32,
100 TAB: 9,
101 UP: 38
102 }
103};
104
105// WAI-ARIA normalization
106if (isFF2) {
107 var attr = $.attr,
108 removeAttr = $.fn.removeAttr,
109 ariaNS = "http://www.w3.org/2005/07/aaa",
110 ariaState = /^aria-/,
111 ariaRole = /^wairole:/;
112
113 $.attr = function(elem, name, value) {
114 var set = value !== undefined;
115
116 return (name == 'role'
117 ? (set
118 ? attr.call(this, elem, name, "wairole:" + value)
119 : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
120 : (ariaState.test(name)
121 ? (set
122 ? elem.setAttributeNS(ariaNS,
123 name.replace(ariaState, "aaa:"), value)
124 : attr.call(this, elem, name.replace(ariaState, "aaa:")))
125 : attr.apply(this, arguments)));
126 };
127
128 $.fn.removeAttr = function(name) {
129 return (ariaState.test(name)
130 ? this.each(function() {
131 this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
132 }) : removeAttr.call(this, name));
133 };
134}
135
136//jQuery plugins
137$.fn.extend({
138 remove: function() {
139 // Safari has a native remove event which actually removes DOM elements,
140 // so we have to use triggerHandler instead of trigger (#3037).
141 $("*", this).add(this).each(function() {
142 $(this).triggerHandler("remove");
143 });
144 return _remove.apply(this, arguments );
145 },
146
147 enableSelection: function() {
148 return this
149 .attr('unselectable', 'off')
150 .css('MozUserSelect', '')
151 .unbind('selectstart.ui');
152 },
153
154 disableSelection: function() {
155 return this
156 .attr('unselectable', 'on')
157 .css('MozUserSelect', 'none')
158 .bind('selectstart.ui', function() { return false; });
159 },
160
161 scrollParent: function() {
162 var scrollParent;
163 if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
164 scrollParent = this.parents().filter(function() {
165 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));
166 }).eq(0);
167 } else {
168 scrollParent = this.parents().filter(function() {
169 return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
170 }).eq(0);
171 }
172
173 return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
174 }
175});
176
177
178//Additional selectors
179$.extend($.expr[':'], {
180 data: function(elem, i, match) {
181 return !!$.data(elem, match[3]);
182 },
183
184 focusable: function(element) {
185 var nodeName = element.nodeName.toLowerCase(),
186 tabIndex = $.attr(element, 'tabindex');
187 return (/input|select|textarea|button|object/.test(nodeName)
188 ? !element.disabled
189 : 'a' == nodeName || 'area' == nodeName
190 ? element.href || !isNaN(tabIndex)
191 : !isNaN(tabIndex))
192 // the element and all of its ancestors must be visible
193 // the browser may report that the area is hidden
194 && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
195 },
196
197 tabbable: function(element) {
198 var tabIndex = $.attr(element, 'tabindex');
199 return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
200 }
201});
202
203
204// $.widget is a factory to create jQuery plugins
205// taking some boilerplate code out of the plugin code
206function getter(namespace, plugin, method, args) {
207 function getMethods(type) {
208 var methods = $[namespace][plugin][type] || [];
209 return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
210 }
211
212 var methods = getMethods('getter');
213 if (args.length == 1 && typeof args[0] == 'string') {
214 methods = methods.concat(getMethods('getterSetter'));
215 }
216 return ($.inArray(method, methods) != -1);
217}
218
219$.widget = function(name, prototype) {
220 var namespace = name.split(".")[0];
221 name = name.split(".")[1];
222
223 // create plugin method
224 $.fn[name] = function(options) {
225 var isMethodCall = (typeof options == 'string'),
226 args = Array.prototype.slice.call(arguments, 1);
227
228 // prevent calls to internal methods
229 if (isMethodCall && options.substring(0, 1) == '_') {
230 return this;
231 }
232
233 // handle getter methods
234 if (isMethodCall && getter(namespace, name, options, args)) {
235 var instance = $.data(this[0], name);
236 return (instance ? instance[options].apply(instance, args)
237 : undefined);
238 }
239
240 // handle initialization and non-getter methods
241 return this.each(function() {
242 var instance = $.data(this, name);
243
244 // constructor
245 (!instance && !isMethodCall &&
246 $.data(this, name, new $[namespace][name](this, options))._init());
247
248 // method call
249 (instance && isMethodCall && $.isFunction(instance[options]) &&
250 instance[options].apply(instance, args));
251 });
252 };
253
254 // create widget constructor
255 $[namespace] = $[namespace] || {};
256 $[namespace][name] = function(element, options) {
257 var self = this;
258
259 this.namespace = namespace;
260 this.widgetName = name;
261 this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
262 this.widgetBaseClass = namespace + '-' + name;
263
264 this.options = $.extend({},
265 $.widget.defaults,
266 $[namespace][name].defaults,
267 $.metadata && $.metadata.get(element)[name],
268 options);
269
270 this.element = $(element)
271 .bind('setData.' + name, function(event, key, value) {
272 if (event.target == element) {
273 return self._setData(key, value);
274 }
275 })
276 .bind('getData.' + name, function(event, key) {
277 if (event.target == element) {
278 return self._getData(key);
279 }
280 })
281 .bind('remove', function() {
282 return self.destroy();
283 });
284 };
285
286 // add widget prototype
287 $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
288
289 // TODO: merge getter and getterSetter properties from widget prototype
290 // and plugin prototype
291 $[namespace][name].getterSetter = 'option';
292};
293
294$.widget.prototype = {
295 _init: function() {},
296 destroy: function() {
297 this.element.removeData(this.widgetName)
298 .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
299 .removeAttr('aria-disabled');
300 },
301
302 option: function(key, value) {
303 var options = key,
304 self = this;
305
306 if (typeof key == "string") {
307 if (value === undefined) {
308 return this._getData(key);
309 }
310 options = {};
311 options[key] = value;
312 }
313
314 $.each(options, function(key, value) {
315 self._setData(key, value);
316 });
317 },
318 _getData: function(key) {
319 return this.options[key];
320 },
321 _setData: function(key, value) {
322 this.options[key] = value;
323
324 if (key == 'disabled') {
325 this.element
326 [value ? 'addClass' : 'removeClass'](
327 this.widgetBaseClass + '-disabled' + ' ' +
328 this.namespace + '-state-disabled')
329 .attr("aria-disabled", value);
330 }
331 },
332
333 enable: function() {
334 this._setData('disabled', false);
335 },
336 disable: function() {
337 this._setData('disabled', true);
338 },
339
340 _trigger: function(type, event, data) {
341 var callback = this.options[type],
342 eventName = (type == this.widgetEventPrefix
343 ? type : this.widgetEventPrefix + type);
344
345 event = $.Event(event);
346 event.type = eventName;
347
348 // copy original event properties over to the new event
349 // this would happen if we could call $.event.fix instead of $.Event
350 // but we don't have a way to force an event to be fixed multiple times
351 if (event.originalEvent) {
352 for (var i = $.event.props.length, prop; i;) {
353 prop = $.event.props[--i];
354 event[prop] = event.originalEvent[prop];
355 }
356 }
357
358 this.element.trigger(event, data);
359
360 return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
361 || event.isDefaultPrevented());
362 }
363};
364
365$.widget.defaults = {
366 disabled: false
367};
368
369
370/** Mouse Interaction Plugin **/
371
372$.ui.mouse = {
373 _mouseInit: function() {
374 var self = this;
375
376 this.element
377 .bind('mousedown.'+this.widgetName, function(event) {
378 return self._mouseDown(event);
379 })
380 .bind('click.'+this.widgetName, function(event) {
381 if(self._preventClickEvent) {
382 self._preventClickEvent = false;
383 event.stopImmediatePropagation();
384 return false;
385 }
386 });
387
388 // Prevent text selection in IE
389 if ($.browser.msie) {
390 this._mouseUnselectable = this.element.attr('unselectable');
391 this.element.attr('unselectable', 'on');
392 }
393
394 this.started = false;
395 },
396
397 // TODO: make sure destroying one instance of mouse doesn't mess with
398 // other instances of mouse
399 _mouseDestroy: function() {
400 this.element.unbind('.'+this.widgetName);
401
402 // Restore text selection in IE
403 ($.browser.msie
404 && this.element.attr('unselectable', this._mouseUnselectable));
405 },
406
407 _mouseDown: function(event) {
408 // don't let more than one widget handle mouseStart
409 // TODO: figure out why we have to use originalEvent
410 event.originalEvent = event.originalEvent || {};
411 if (event.originalEvent.mouseHandled) { return; }
412
413 // we may have missed mouseup (out of window)
414 (this._mouseStarted && this._mouseUp(event));
415
416 this._mouseDownEvent = event;
417
418 var self = this,
419 btnIsLeft = (event.which == 1),
420 elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
421 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
422 return true;
423 }
424
425 this.mouseDelayMet = !this.options.delay;
426 if (!this.mouseDelayMet) {
427 this._mouseDelayTimer = setTimeout(function() {
428 self.mouseDelayMet = true;
429 }, this.options.delay);
430 }
431
432 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
433 this._mouseStarted = (this._mouseStart(event) !== false);
434 if (!this._mouseStarted) {
435 event.preventDefault();
436 return true;
437 }
438 }
439
440 // these delegates are required to keep context
441 this._mouseMoveDelegate = function(event) {
442 return self._mouseMove(event);
443 };
444 this._mouseUpDelegate = function(event) {
445 return self._mouseUp(event);
446 };
447 $(document)
448 .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
449 .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
450
451 // preventDefault() is used to prevent the selection of text here -
452 // however, in Safari, this causes select boxes not to be selectable
453 // anymore, so this fix is needed
454 ($.browser.safari || event.preventDefault());
455
456 event.originalEvent.mouseHandled = true;
457 return true;
458 },
459
460 _mouseMove: function(event) {
461 // IE mouseup check - mouseup happened when mouse was out of window
462 if ($.browser.msie && !event.button) {
463 return this._mouseUp(event);
464 }
465
466 if (this._mouseStarted) {
467 this._mouseDrag(event);
468 return event.preventDefault();
469 }
470
471 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
472 this._mouseStarted =
473 (this._mouseStart(this._mouseDownEvent, event) !== false);
474 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
475 }
476
477 return !this._mouseStarted;
478 },
479
480 _mouseUp: function(event) {
481 $(document)
482 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
483 .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
484
485 if (this._mouseStarted) {
486 this._mouseStarted = false;
487 this._preventClickEvent = (event.target == this._mouseDownEvent.target);
488 this._mouseStop(event);
489 }
490
491 return false;
492 },
493
494 _mouseDistanceMet: function(event) {
495 return (Math.max(
496 Math.abs(this._mouseDownEvent.pageX - event.pageX),
497 Math.abs(this._mouseDownEvent.pageY - event.pageY)
498 ) >= this.options.distance
499 );
500 },
501
502 _mouseDelayMet: function(event) {
503 return this.mouseDelayMet;
504 },
505
506 // These are placeholder methods, to be overriden by extending plugin
507 _mouseStart: function(event) {},
508 _mouseDrag: function(event) {},
509 _mouseStop: function(event) {},
510 _mouseCapture: function(event) { return true; }
511};
512
513$.ui.mouse.defaults = {
514 cancel: null,
515 distance: 1,
516 delay: 0
517};
518
519})(jQuery);
520/*
521 * jQuery UI Draggable 1.7.2
522 *
523 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
524 * Dual licensed under the MIT (MIT-LICENSE.txt)
525 * and GPL (GPL-LICENSE.txt) licenses.
526 *
527 * http://docs.jquery.com/UI/Draggables
528 *
529 * Depends:
530 * ui.core.js
531 */
532(function($) {
533
534$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
535
536 _init: function() {
537
538 if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
539 this.element[0].style.position = 'relative';
540
541 (this.options.addClasses && this.element.addClass("ui-draggable"));
542 (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
543
544 this._mouseInit();
545
546 },
547
548 destroy: function() {
549 if(!this.element.data('draggable')) return;
550 this.element
551 .removeData("draggable")
552 .unbind(".draggable")
553 .removeClass("ui-draggable"
554 + " ui-draggable-dragging"
555 + " ui-draggable-disabled");
556 this._mouseDestroy();
557 },
558
559 _mouseCapture: function(event) {
560
561 var o = this.options;
562
563 if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
564 return false;
565
566 //Quit if we're not on a valid handle
567 this.handle = this._getHandle(event);
568 if (!this.handle)
569 return false;
570
571 return true;
572
573 },
574
575 _mouseStart: function(event) {
576
577 var o = this.options;
578
579 //Create and append the visible helper
580 this.helper = this._createHelper(event);
581
582 //Cache the helper size
583 this._cacheHelperProportions();
584
585 //If ddmanager is used for droppables, set the global draggable
586 if($.ui.ddmanager)
587 $.ui.ddmanager.current = this;
588
589 /*
590 * - Position generation -
591 * This block generates everything position related - it's the core of draggables.
592 */
593
594 //Cache the margins of the original element
595 this._cacheMargins();
596
597 //Store the helper's css position
598 this.cssPosition = this.helper.css("position");
599 this.scrollParent = this.helper.scrollParent();
600
601 //The element's absolute position on the page minus margins
602 this.offset = this.element.offset();
603 this.offset = {
604 top: this.offset.top - this.margins.top,
605 left: this.offset.left - this.margins.left
606 };
607
608 $.extend(this.offset, {
609 click: { //Where the click happened, relative to the element
610 left: event.pageX - this.offset.left,
611 top: event.pageY - this.offset.top
612 },
613 parent: this._getParentOffset(),
614 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
615 });
616
617 //Generate the original position
618 this.originalPosition = this._generatePosition(event);
619 this.originalPageX = event.pageX;
620 this.originalPageY = event.pageY;
621
622 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
623 if(o.cursorAt)
624 this._adjustOffsetFromHelper(o.cursorAt);
625
626 //Set a containment if given in the options
627 if(o.containment)
628 this._setContainment();
629
630 //Call plugins and callbacks
631 this._trigger("start", event);
632
633 //Recache the helper size
634 this._cacheHelperProportions();
635
636 //Prepare the droppable offsets
637 if ($.ui.ddmanager && !o.dropBehaviour)
638 $.ui.ddmanager.prepareOffsets(this, event);
639
640 this.helper.addClass("ui-draggable-dragging");
641 this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
642 return true;
643 },
644
645 _mouseDrag: function(event, noPropagation) {
646
647 //Compute the helpers position
648 this.position = this._generatePosition(event);
649 this.positionAbs = this._convertPositionTo("absolute");
650
651 //Call plugins and callbacks and use the resulting position if something is returned
652 if (!noPropagation) {
653 var ui = this._uiHash();
654 this._trigger('drag', event, ui);
655 this.position = ui.position;
656 }
657
658 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
659 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
660 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
661
662 return false;
663 },
664
665 _mouseStop: function(event) {
666
667 //If we are using droppables, inform the manager about the drop
668 var dropped = false;
669 if ($.ui.ddmanager && !this.options.dropBehaviour)
670 dropped = $.ui.ddmanager.drop(this, event);
671
672 //if a drop comes from outside (a sortable)
673 if(this.dropped) {
674 dropped = this.dropped;
675 this.dropped = false;
676 }
677
678 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))) {
679 var self = this;
680 $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
681 self._trigger("stop", event);
682 self._clear();
683 });
684 } else {
685 this._trigger("stop", event);
686 this._clear();
687 }
688
689 return false;
690 },
691
692 _getHandle: function(event) {
693
694 var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
695 $(this.options.handle, this.element)
696 .find("*")
697 .andSelf()
698 .each(function() {
699 if(this == event.target) handle = true;
700 });
701
702 return handle;
703
704 },
705
706 _createHelper: function(event) {
707
708 var o = this.options;
709 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
710
711 if(!helper.parents('body').length)
712 helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
713
714 if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
715 helper.css("position", "absolute");
716
717 return helper;
718
719 },
720
721 _adjustOffsetFromHelper: function(obj) {
722 if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
723 if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
724 if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
725 if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
726 },
727
728 _getParentOffset: function() {
729
730 //Get the offsetParent and cache its position
731 this.offsetParent = this.helper.offsetParent();
732 var po = this.offsetParent.offset();
733
734 // This is a special case where we need to modify a offset calculated on start, since the following happened:
735 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
736 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
737 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
738 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
739 po.left += this.scrollParent.scrollLeft();
740 po.top += this.scrollParent.scrollTop();
741 }
742
743 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
744 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
745 po = { top: 0, left: 0 };
746
747 return {
748 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
749 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
750 };
751
752 },
753
754 _getRelativeOffset: function() {
755
756 if(this.cssPosition == "relative") {
757 var p = this.element.position();
758 return {
759 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
760 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
761 };
762 } else {
763 return { top: 0, left: 0 };
764 }
765
766 },
767
768 _cacheMargins: function() {
769 this.margins = {
770 left: (parseInt(this.element.css("marginLeft"),10) || 0),
771 top: (parseInt(this.element.css("marginTop"),10) || 0)
772 };
773 },
774
775 _cacheHelperProportions: function() {
776 this.helperProportions = {
777 width: this.helper.outerWidth(),
778 height: this.helper.outerHeight()
779 };
780 },
781
782 _setContainment: function() {
783
784 var o = this.options;
785 if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
786 if(o.containment == 'document' || o.containment == 'window') this.containment = [
787 0 - this.offset.relative.left - this.offset.parent.left,
788 0 - this.offset.relative.top - this.offset.parent.top,
789 $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
790 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
791 ];
792
793 if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
794 var ce = $(o.containment)[0]; if(!ce) return;
795 var co = $(o.containment).offset();
796 var over = ($(ce).css("overflow") != 'hidden');
797
798 this.containment = [
799 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
800 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
801 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,
802 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
803 ];
804 } else if(o.containment.constructor == Array) {
805 this.containment = o.containment;
806 }
807
808 },
809
810 _convertPositionTo: function(d, pos) {
811
812 if(!pos) pos = this.position;
813 var mod = d == "absolute" ? 1 : -1;
814 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);
815
816 return {
817 top: (
818 pos.top // The absolute mouse position
819 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
820 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
821 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
822 ),
823 left: (
824 pos.left // The absolute mouse position
825 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
826 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
827 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
828 )
829 };
830
831 },
832
833 _generatePosition: function(event) {
834
835 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);
836
837 // This is another very weird special case that only happens for relative elements:
838 // 1. If the css position is relative
839 // 2. and the scroll parent is the document or similar to the offset parent
840 // we have to refresh the relative offset during the scroll so there are no jumps
841 if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
842 this.offset.relative = this._getRelativeOffset();
843 }
844
845 var pageX = event.pageX;
846 var pageY = event.pageY;
847
848 /*
849 * - Position constraining -
850 * Constrain the position to a mix of grid, containment.
851 */
852
853 if(this.originalPosition) { //If we are not dragging yet, we won't check for options
854
855 if(this.containment) {
856 if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
857 if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
858 if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
859 if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
860 }
861
862 if(o.grid) {
863 var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
864 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;
865
866 var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
867 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;
868 }
869
870 }
871
872 return {
873 top: (
874 pageY // The absolute mouse position
875 - this.offset.click.top // Click offset (relative to the element)
876 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
877 - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
878 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
879 ),
880 left: (
881 pageX // The absolute mouse position
882 - this.offset.click.left // Click offset (relative to the element)
883 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
884 - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
885 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
886 )
887 };
888
889 },
890
891 _clear: function() {
892 this.helper.removeClass("ui-draggable-dragging");
893 if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
894 //if($.ui.ddmanager) $.ui.ddmanager.current = null;
895 this.helper = null;
896 this.cancelHelperRemoval = false;
897 },
898
899 // From now on bulk stuff - mainly helpers
900
901 _trigger: function(type, event, ui) {
902 ui = ui || this._uiHash();
903 $.ui.plugin.call(this, type, [event, ui]);
904 if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
905 return $.widget.prototype._trigger.call(this, type, event, ui);
906 },
907
908 plugins: {},
909
910 _uiHash: function(event) {
911 return {
912 helper: this.helper,
913 position: this.position,
914 absolutePosition: this.positionAbs, //deprecated
915 offset: this.positionAbs
916 };
917 }
918
919}));
920
921$.extend($.ui.draggable, {
922 version: "1.7.2",
923 eventPrefix: "drag",
924 defaults: {
925 addClasses: true,
926 appendTo: "parent",
927 axis: false,
928 cancel: ":input,option",
929 connectToSortable: false,
930 containment: false,
931 cursor: "auto",
932 cursorAt: false,
933 delay: 0,
934 distance: 1,
935 grid: false,
936 handle: false,
937 helper: "original",
938 iframeFix: false,
939 opacity: false,
940 refreshPositions: false,
941 revert: false,
942 revertDuration: 500,
943 scope: "default",
944 scroll: true,
945 scrollSensitivity: 20,
946 scrollSpeed: 20,
947 snap: false,
948 snapMode: "both",
949 snapTolerance: 20,
950 stack: false,
951 zIndex: false
952 }
953});
954
955$.ui.plugin.add("draggable", "connectToSortable", {
956 start: function(event, ui) {
957
958 var inst = $(this).data("draggable"), o = inst.options,
959 uiSortable = $.extend({}, ui, { item: inst.element });
960 inst.sortables = [];
961 $(o.connectToSortable).each(function() {
962 var sortable = $.data(this, 'sortable');
963 if (sortable && !sortable.options.disabled) {
964 inst.sortables.push({
965 instance: sortable,
966 shouldRevert: sortable.options.revert
967 });
968 sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
969 sortable._trigger("activate", event, uiSortable);
970 }
971 });
972
973 },
974 stop: function(event, ui) {
975
976 //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
977 var inst = $(this).data("draggable"),
978 uiSortable = $.extend({}, ui, { item: inst.element });
979
980 $.each(inst.sortables, function() {
981 if(this.instance.isOver) {
982
983 this.instance.isOver = 0;
984
985 inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
986 this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
987
988 //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
989 if(this.shouldRevert) this.instance.options.revert = true;
990
991 //Trigger the stop of the sortable
992 this.instance._mouseStop(event);
993
994 this.instance.options.helper = this.instance.options._helper;
995
996 //If the helper has been the original item, restore properties in the sortable
997 if(inst.options.helper == 'original')
998 this.instance.currentItem.css({ top: 'auto', left: 'auto' });
999
1000 } else {
1001 this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
1002 this.instance._trigger("deactivate", event, uiSortable);
1003 }
1004
1005 });
1006
1007 },
1008 drag: function(event, ui) {
1009
1010 var inst = $(this).data("draggable"), self = this;
1011
1012 var checkPos = function(o) {
1013 var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
1014 var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
1015 var itemHeight = o.height, itemWidth = o.width;
1016 var itemTop = o.top, itemLeft = o.left;
1017
1018 return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
1019 };
1020
1021 $.each(inst.sortables, function(i) {
1022
1023 //Copy over some variables to allow calling the sortable's native _intersectsWith
1024 this.instance.positionAbs = inst.positionAbs;
1025 this.instance.helperProportions = inst.helperProportions;
1026 this.instance.offset.click = inst.offset.click;
1027
1028 if(this.instance._intersectsWith(this.instance.containerCache)) {
1029
1030 //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
1031 if(!this.instance.isOver) {
1032
1033 this.instance.isOver = 1;
1034 //Now we fake the start of dragging for the sortable instance,
1035 //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
1036 //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)
1037 this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
1038 this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
1039 this.instance.options.helper = function() { return ui.helper[0]; };
1040
1041 event.target = this.instance.currentItem[0];
1042 this.instance._mouseCapture(event, true);
1043 this.instance._mouseStart(event, true, true);
1044
1045 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
1046 this.instance.offset.click.top = inst.offset.click.top;
1047 this.instance.offset.click.left = inst.offset.click.left;
1048 this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
1049 this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
1050
1051 inst._trigger("toSortable", event);
1052 inst.dropped = this.instance.element; //draggable revert needs that
1053 //hack so receive/update callbacks work (mostly)
1054 inst.currentItem = inst.element;
1055 this.instance.fromOutside = inst;
1056
1057 }
1058
1059 //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
1060 if(this.instance.currentItem) this.instance._mouseDrag(event);
1061
1062 } else {
1063
1064 //If it doesn't intersect with the sortable, and it intersected before,
1065 //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
1066 if(this.instance.isOver) {
1067
1068 this.instance.isOver = 0;
1069 this.instance.cancelHelperRemoval = true;
1070
1071 //Prevent reverting on this forced stop
1072 this.instance.options.revert = false;
1073
1074 // The out event needs to be triggered independently
1075 this.instance._trigger('out', event, this.instance._uiHash(this.instance));
1076
1077 this.instance._mouseStop(event, true);
1078 this.instance.options.helper = this.instance.options._helper;
1079
1080 //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
1081 this.instance.currentItem.remove();
1082 if(this.instance.placeholder) this.instance.placeholder.remove();
1083
1084 inst._trigger("fromSortable", event);
1085 inst.dropped = false; //draggable revert needs that
1086 }
1087
1088 };
1089
1090 });
1091
1092 }
1093});
1094
1095$.ui.plugin.add("draggable", "cursor", {
1096 start: function(event, ui) {
1097 var t = $('body'), o = $(this).data('draggable').options;
1098 if (t.css("cursor")) o._cursor = t.css("cursor");
1099 t.css("cursor", o.cursor);
1100 },
1101 stop: function(event, ui) {
1102 var o = $(this).data('draggable').options;
1103 if (o._cursor) $('body').css("cursor", o._cursor);
1104 }
1105});
1106
1107$.ui.plugin.add("draggable", "iframeFix", {
1108 start: function(event, ui) {
1109 var o = $(this).data('draggable').options;
1110 $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1111 $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1112 .css({
1113 width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1114 position: "absolute", opacity: "0.001", zIndex: 1000
1115 })
1116 .css($(this).offset())
1117 .appendTo("body");
1118 });
1119 },
1120 stop: function(event, ui) {
1121 $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
1122 }
1123});
1124
1125$.ui.plugin.add("draggable", "opacity", {
1126 start: function(event, ui) {
1127 var t = $(ui.helper), o = $(this).data('draggable').options;
1128 if(t.css("opacity")) o._opacity = t.css("opacity");
1129 t.css('opacity', o.opacity);
1130 },
1131 stop: function(event, ui) {
1132 var o = $(this).data('draggable').options;
1133 if(o._opacity) $(ui.helper).css('opacity', o._opacity);
1134 }
1135});
1136
1137$.ui.plugin.add("draggable", "scroll", {
1138 start: function(event, ui) {
1139 var i = $(this).data("draggable");
1140 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
1141 },
1142 drag: function(event, ui) {
1143
1144 var i = $(this).data("draggable"), o = i.options, scrolled = false;
1145
1146 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
1147
1148 if(!o.axis || o.axis != 'x') {
1149 if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
1150 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
1151 else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
1152 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
1153 }
1154
1155 if(!o.axis || o.axis != 'y') {
1156 if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
1157 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
1158 else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
1159 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
1160 }
1161
1162 } else {
1163
1164 if(!o.axis || o.axis != 'x') {
1165 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
1166 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1167 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
1168 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1169 }
1170
1171 if(!o.axis || o.axis != 'y') {
1172 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
1173 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1174 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
1175 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1176 }
1177
1178 }
1179
1180 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
1181 $.ui.ddmanager.prepareOffsets(i, event);
1182
1183 }
1184});
1185
1186$.ui.plugin.add("draggable", "snap", {
1187 start: function(event, ui) {
1188
1189 var i = $(this).data("draggable"), o = i.options;
1190 i.snapElements = [];
1191
1192 $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
1193 var $t = $(this); var $o = $t.offset();
1194 if(this != i.element[0]) i.snapElements.push({
1195 item: this,
1196 width: $t.outerWidth(), height: $t.outerHeight(),
1197 top: $o.top, left: $o.left
1198 });
1199 });
1200
1201 },
1202 drag: function(event, ui) {
1203
1204 var inst = $(this).data("draggable"), o = inst.options;
1205 var d = o.snapTolerance;
1206
1207 var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1208 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1209
1210 for (var i = inst.snapElements.length - 1; i >= 0; i--){
1211
1212 var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
1213 t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
1214
1215 //Yes, I know, this is insane ;)
1216 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))) {
1217 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 })));
1218 inst.snapElements[i].snapping = false;
1219 continue;
1220 }
1221
1222 if(o.snapMode != 'inner') {
1223 var ts = Math.abs(t - y2) <= d;
1224 var bs = Math.abs(b - y1) <= d;
1225 var ls = Math.abs(l - x2) <= d;
1226 var rs = Math.abs(r - x1) <= d;
1227 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1228 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
1229 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
1230 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
1231 }
1232
1233 var first = (ts || bs || ls || rs);
1234
1235 if(o.snapMode != 'outer') {
1236 var ts = Math.abs(t - y1) <= d;
1237 var bs = Math.abs(b - y2) <= d;
1238 var ls = Math.abs(l - x1) <= d;
1239 var rs = Math.abs(r - x2) <= d;
1240 if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
1241 if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1242 if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
1243 if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
1244 }
1245
1246 if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
1247 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1248 inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
1249
1250 };
1251
1252 }
1253});
1254
1255$.ui.plugin.add("draggable", "stack", {
1256 start: function(event, ui) {
1257
1258 var o = $(this).data("draggable").options;
1259
1260 var group = $.makeArray($(o.stack.group)).sort(function(a,b) {
1261 return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min);
1262 });
1263
1264 $(group).each(function(i) {
1265 this.style.zIndex = o.stack.min + i;
1266 });
1267
1268 this[0].style.zIndex = o.stack.min + group.length;
1269
1270 }
1271});
1272
1273$.ui.plugin.add("draggable", "zIndex", {
1274 start: function(event, ui) {
1275 var t = $(ui.helper), o = $(this).data("draggable").options;
1276 if(t.css("zIndex")) o._zIndex = t.css("zIndex");
1277 t.css('zIndex', o.zIndex);
1278 },
1279 stop: function(event, ui) {
1280 var o = $(this).data("draggable").options;
1281 if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
1282 }
1283});
1284
1285})(jQuery);
1286/*
1287 * jQuery UI Droppable 1.7.2
1288 *
1289 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
1290 * Dual licensed under the MIT (MIT-LICENSE.txt)
1291 * and GPL (GPL-LICENSE.txt) licenses.
1292 *
1293 * http://docs.jquery.com/UI/Droppables
1294 *
1295 * Depends:
1296 * ui.core.js
1297 * ui.draggable.js
1298 */
1299(function($) {
1300
1301$.widget("ui.droppable", {
1302
1303 _init: function() {
1304
1305 var o = this.options, accept = o.accept;
1306 this.isover = 0; this.isout = 1;
1307
1308 this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
1309 return d.is(accept);
1310 };
1311
1312 //Store the droppable's proportions
1313 this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
1314
1315 // Add the reference and positions to the manager
1316 $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
1317 $.ui.ddmanager.droppables[this.options.scope].push(this);
1318
1319 (this.options.addClasses && this.element.addClass("ui-droppable"));
1320
1321 },
1322
1323 destroy: function() {
1324 var drop = $.ui.ddmanager.droppables[this.options.scope];
1325 for ( var i = 0; i < drop.length; i++ )
1326 if ( drop[i] == this )
1327 drop.splice(i, 1);
1328
1329 this.element
1330 .removeClass("ui-droppable ui-droppable-disabled")
1331 .removeData("droppable")
1332 .unbind(".droppable");
1333 },
1334
1335 _setData: function(key, value) {
1336
1337 if(key == 'accept') {
1338 this.options.accept = value && $.isFunction(value) ? value : function(d) {
1339 return d.is(value);
1340 };
1341 } else {
1342 $.widget.prototype._setData.apply(this, arguments);
1343 }
1344
1345 },
1346
1347 _activate: function(event) {
1348 var draggable = $.ui.ddmanager.current;
1349 if(this.options.activeClass) this.element.addClass(this.options.activeClass);
1350 (draggable && this._trigger('activate', event, this.ui(draggable)));
1351 },
1352
1353 _deactivate: function(event) {
1354 var draggable = $.ui.ddmanager.current;
1355 if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1356 (draggable && this._trigger('deactivate', event, this.ui(draggable)));
1357 },
1358
1359 _over: function(event) {
1360
1361 var draggable = $.ui.ddmanager.current;
1362 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1363
1364 if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1365 if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
1366 this._trigger('over', event, this.ui(draggable));
1367 }
1368
1369 },
1370
1371 _out: function(event) {
1372
1373 var draggable = $.ui.ddmanager.current;
1374 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1375
1376 if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1377 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1378 this._trigger('out', event, this.ui(draggable));
1379 }
1380
1381 },
1382
1383 _drop: function(event,custom) {
1384
1385 var draggable = custom || $.ui.ddmanager.current;
1386 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
1387
1388 var childrenIntersection = false;
1389 this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
1390 var inst = $.data(this, 'droppable');
1391 if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
1392 childrenIntersection = true; return false;
1393 }
1394 });
1395 if(childrenIntersection) return false;
1396
1397 if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1398 if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1399 if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1400 this._trigger('drop', event, this.ui(draggable));
1401 return this.element;
1402 }
1403
1404 return false;
1405
1406 },
1407
1408 ui: function(c) {
1409 return {
1410 draggable: (c.currentItem || c.element),
1411 helper: c.helper,
1412 position: c.position,
1413 absolutePosition: c.positionAbs, //deprecated
1414 offset: c.positionAbs
1415 };
1416 }
1417
1418});
1419
1420$.extend($.ui.droppable, {
1421 version: "1.7.2",
1422 eventPrefix: 'drop',
1423 defaults: {
1424 accept: '*',
1425 activeClass: false,
1426 addClasses: true,
1427 greedy: false,
1428 hoverClass: false,
1429 scope: 'default',
1430 tolerance: 'intersect'
1431 }
1432});
1433
1434$.ui.intersect = function(draggable, droppable, toleranceMode) {
1435
1436 if (!droppable.offset) return false;
1437
1438 var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
1439 y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
1440 var l = droppable.offset.left, r = l + droppable.proportions.width,
1441 t = droppable.offset.top, b = t + droppable.proportions.height;
1442
1443 switch (toleranceMode) {
1444 case 'fit':
1445 return (l < x1 && x2 < r
1446 && t < y1 && y2 < b);
1447 break;
1448 case 'intersect':
1449 return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
1450 && x2 - (draggable.helperProportions.width / 2) < r // Left Half
1451 && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
1452 && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
1453 break;
1454 case 'pointer':
1455 var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
1456 draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
1457 isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
1458 return isOver;
1459 break;
1460 case 'touch':
1461 return (
1462 (y1 >= t && y1 <= b) || // Top edge touching
1463 (y2 >= t && y2 <= b) || // Bottom edge touching
1464 (y1 < t && y2 > b) // Surrounded vertically
1465 ) && (
1466 (x1 >= l && x1 <= r) || // Left edge touching
1467 (x2 >= l && x2 <= r) || // Right edge touching
1468 (x1 < l && x2 > r) // Surrounded horizontally
1469 );
1470 break;
1471 default:
1472 return false;
1473 break;
1474 }
1475
1476};
1477
1478/*
1479 This manager tracks offsets of draggables and droppables
1480*/
1481$.ui.ddmanager = {
1482 current: null,
1483 droppables: { 'default': [] },
1484 prepareOffsets: function(t, event) {
1485
1486 var m = $.ui.ddmanager.droppables[t.options.scope];
1487 var type = event ? event.type : null; // workaround for #2317
1488 var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
1489
1490 droppablesLoop: for (var i = 0; i < m.length; i++) {
1491
1492 if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
1493 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
1494 m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
1495
1496 m[i].offset = m[i].element.offset();
1497 m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
1498
1499 if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
1500
1501 }
1502
1503 },
1504 drop: function(draggable, event) {
1505
1506 var dropped = false;
1507 $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
1508
1509 if(!this.options) return;
1510 if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
1511 dropped = this._drop.call(this, event);
1512
1513 if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1514 this.isout = 1; this.isover = 0;
1515 this._deactivate.call(this, event);
1516 }
1517
1518 });
1519 return dropped;
1520
1521 },
1522 drag: function(draggable, event) {
1523
1524 //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
1525 if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
1526
1527 //Run through all droppables and check their positions based on specific tolerance options
1528
1529 $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
1530
1531 if(this.options.disabled || this.greedyChild || !this.visible) return;
1532 var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
1533
1534 var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
1535 if(!c) return;
1536
1537 var parentInstance;
1538 if (this.options.greedy) {
1539 var parent = this.element.parents(':data(droppable):eq(0)');
1540 if (parent.length) {
1541 parentInstance = $.data(parent[0], 'droppable');
1542 parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
1543 }
1544 }
1545
1546 // we just moved into a greedy child
1547 if (parentInstance && c == 'isover') {
1548 parentInstance['isover'] = 0;
1549 parentInstance['isout'] = 1;
1550 parentInstance._out.call(parentInstance, event);
1551 }
1552
1553 this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
1554 this[c == "isover" ? "_over" : "_out"].call(this, event);
1555
1556 // we just moved out of a greedy child
1557 if (parentInstance && c == 'isout') {
1558 parentInstance['isout'] = 0;
1559 parentInstance['isover'] = 1;
1560 parentInstance._over.call(parentInstance, event);
1561 }
1562 });
1563
1564 }
1565};
1566
1567})(jQuery);
1568/*
1569 * jQuery UI Resizable 1.7.2
1570 *
1571 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
1572 * Dual licensed under the MIT (MIT-LICENSE.txt)
1573 * and GPL (GPL-LICENSE.txt) licenses.
1574 *
1575 * http://docs.jquery.com/UI/Resizables
1576 *
1577 * Depends:
1578 * ui.core.js
1579 */
1580(function($) {
1581
1582$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
1583
1584 _init: function() {
1585
1586 var self = this, o = this.options;
1587 this.element.addClass("ui-resizable");
1588
1589 $.extend(this, {
1590 _aspectRatio: !!(o.aspectRatio),
1591 aspectRatio: o.aspectRatio,
1592 originalElement: this.element,
1593 _proportionallyResizeElements: [],
1594 _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
1595 });
1596
1597 //Wrap the element if it cannot hold child nodes
1598 if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
1599
1600 //Opera fix for relative positioning
1601 if (/relative/.test(this.element.css('position')) && $.browser.opera)
1602 this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
1603
1604 //Create a wrapper element and set the wrapper to the new current internal element
1605 this.element.wrap(
1606 $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
1607 position: this.element.css('position'),
1608 width: this.element.outerWidth(),
1609 height: this.element.outerHeight(),
1610 top: this.element.css('top'),
1611 left: this.element.css('left')
1612 })
1613 );
1614
1615 //Overwrite the original this.element
1616 this.element = this.element.parent().data(
1617 "resizable", this.element.data('resizable')
1618 );
1619
1620 this.elementIsWrapper = true;
1621
1622 //Move margins to the wrapper
1623 this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
1624 this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
1625
1626 //Prevent Safari textarea resize
1627 this.originalResizeStyle = this.originalElement.css('resize');
1628 this.originalElement.css('resize', 'none');
1629
1630 //Push the actual element to our proportionallyResize internal array
1631 this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
1632
1633 // avoid IE jump (hard set the margin)
1634 this.originalElement.css({ margin: this.originalElement.css('margin') });
1635
1636 // fix handlers offset
1637 this._proportionallyResize();
1638
1639 }
1640
1641 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' });
1642 if(this.handles.constructor == String) {
1643
1644 if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
1645 var n = this.handles.split(","); this.handles = {};
1646
1647 for(var i = 0; i < n.length; i++) {
1648
1649 var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
1650 var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
1651
1652 // increase zIndex of sw, se, ne, nw axis
1653 //TODO : this modifies original option
1654 if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
1655
1656 //TODO : What's going on here?
1657 if ('se' == handle) {
1658 axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
1659 };
1660
1661 //Insert into internal handles object and append to element
1662 this.handles[handle] = '.ui-resizable-'+handle;
1663 this.element.append(axis);
1664 }
1665
1666 }
1667
1668 this._renderAxis = function(target) {
1669
1670 target = target || this.element;
1671
1672 for(var i in this.handles) {
1673
1674 if(this.handles[i].constructor == String)
1675 this.handles[i] = $(this.handles[i], this.element).show();
1676
1677 //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
1678 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
1679
1680 var axis = $(this.handles[i], this.element), padWrapper = 0;
1681
1682 //Checking the correct pad and border
1683 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
1684
1685 //The padding type i have to apply...
1686 var padPos = [ 'padding',
1687 /ne|nw|n/.test(i) ? 'Top' :
1688 /se|sw|s/.test(i) ? 'Bottom' :
1689 /^e$/.test(i) ? 'Right' : 'Left' ].join("");
1690
1691 target.css(padPos, padWrapper);
1692
1693 this._proportionallyResize();
1694
1695 }
1696
1697 //TODO: What's that good for? There's not anything to be executed left
1698 if(!$(this.handles[i]).length)
1699 continue;
1700
1701 }
1702 };
1703
1704 //TODO: make renderAxis a prototype function
1705 this._renderAxis(this.element);
1706
1707 this._handles = $('.ui-resizable-handle', this.element)
1708 .disableSelection();
1709
1710 //Matching axis name
1711 this._handles.mouseover(function() {
1712 if (!self.resizing) {
1713 if (this.className)
1714 var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
1715 //Axis, default = se
1716 self.axis = axis && axis[1] ? axis[1] : 'se';
1717 }
1718 });
1719
1720 //If we want to auto hide the elements
1721 if (o.autoHide) {
1722 this._handles.hide();
1723 $(this.element)
1724 .addClass("ui-resizable-autohide")
1725 .hover(function() {
1726 $(this).removeClass("ui-resizable-autohide");
1727 self._handles.show();
1728 },
1729 function(){
1730 if (!self.resizing) {
1731 $(this).addClass("ui-resizable-autohide");
1732 self._handles.hide();
1733 }
1734 });
1735 }
1736
1737 //Initialize the mouse interaction
1738 this._mouseInit();
1739
1740 },
1741
1742 destroy: function() {
1743
1744 this._mouseDestroy();
1745
1746 var _destroy = function(exp) {
1747 $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
1748 .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
1749 };
1750
1751 //TODO: Unwrap at same DOM position
1752 if (this.elementIsWrapper) {
1753 _destroy(this.element);
1754 var wrapper = this.element;
1755 wrapper.parent().append(
1756 this.originalElement.css({
1757 position: wrapper.css('position'),
1758 width: wrapper.outerWidth(),
1759 height: wrapper.outerHeight(),
1760 top: wrapper.css('top'),
1761 left: wrapper.css('left')
1762 })
1763 ).end().remove();
1764 }
1765
1766 this.originalElement.css('resize', this.originalResizeStyle);
1767 _destroy(this.originalElement);
1768
1769 },
1770
1771 _mouseCapture: function(event) {
1772
1773 var handle = false;
1774 for(var i in this.handles) {
1775 if($(this.handles[i])[0] == event.target) handle = true;
1776 }
1777
1778 return this.options.disabled || !!handle;
1779
1780 },
1781
1782 _mouseStart: function(event) {
1783
1784 var o = this.options, iniPos = this.element.position(), el = this.element;
1785
1786 this.resizing = true;
1787 this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
1788
1789 // bugfix for http://dev.jquery.com/ticket/1749
1790 if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
1791 el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
1792 }
1793
1794 //Opera fixing relative position
1795 if ($.browser.opera && (/relative/).test(el.css('position')))
1796 el.css({ position: 'relative', top: 'auto', left: 'auto' });
1797
1798 this._renderProxy();
1799
1800 var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
1801
1802 if (o.containment) {
1803 curleft += $(o.containment).scrollLeft() || 0;
1804 curtop += $(o.containment).scrollTop() || 0;
1805 }
1806
1807 //Store needed variables
1808 this.offset = this.helper.offset();
1809 this.position = { left: curleft, top: curtop };
1810 this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
1811 this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
1812 this.originalPosition = { left: curleft, top: curtop };
1813 this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
1814 this.originalMousePosition = { left: event.pageX, top: event.pageY };
1815
1816 //Aspect Ratio
1817 this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
1818
1819 var cursor = $('.ui-resizable-' + this.axis).css('cursor');
1820 $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
1821
1822 el.addClass("ui-resizable-resizing");
1823 this._propagate("start", event);
1824 return true;
1825 },
1826
1827 _mouseDrag: function(event) {
1828
1829 //Increase performance, avoid regex
1830 var el = this.helper, o = this.options, props = {},
1831 self = this, smp = this.originalMousePosition, a = this.axis;
1832
1833 var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
1834 var trigger = this._change[a];
1835 if (!trigger) return false;
1836
1837 // Calculate the attrs that will be change
1838 var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
1839
1840 if (this._aspectRatio || event.shiftKey)
1841 data = this._updateRatio(data, event);
1842
1843 data = this._respectSize(data, event);
1844
1845 // plugins callbacks need to be called first
1846 this._propagate("resize", event);
1847
1848 el.css({
1849 top: this.position.top + "px", left: this.position.left + "px",
1850 width: this.size.width + "px", height: this.size.height + "px"
1851 });
1852
1853 if (!this._helper && this._proportionallyResizeElements.length)
1854 this._proportionallyResize();
1855
1856 this._updateCache(data);
1857
1858 // calling the user callback at the end
1859 this._trigger('resize', event, this.ui());
1860
1861 return false;
1862 },
1863
1864 _mouseStop: function(event) {
1865
1866 this.resizing = false;
1867 var o = this.options, self = this;
1868
1869 if(this._helper) {
1870 var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
1871 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
1872 soffsetw = ista ? 0 : self.sizeDiff.width;
1873
1874 var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
1875 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
1876 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
1877
1878 if (!o.animate)
1879 this.element.css($.extend(s, { top: top, left: left }));
1880
1881 self.helper.height(self.size.height);
1882 self.helper.width(self.size.width);
1883
1884 if (this._helper && !o.animate) this._proportionallyResize();
1885 }
1886
1887 $('body').css('cursor', 'auto');
1888
1889 this.element.removeClass("ui-resizable-resizing");
1890
1891 this._propagate("stop", event);
1892
1893 if (this._helper) this.helper.remove();
1894 return false;
1895
1896 },
1897
1898 _updateCache: function(data) {
1899 var o = this.options;
1900 this.offset = this.helper.offset();
1901 if (isNumber(data.left)) this.position.left = data.left;
1902 if (isNumber(data.top)) this.position.top = data.top;
1903 if (isNumber(data.height)) this.size.height = data.height;
1904 if (isNumber(data.width)) this.size.width = data.width;
1905 },
1906
1907 _updateRatio: function(data, event) {
1908
1909 var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
1910
1911 if (data.height) data.width = (csize.height * this.aspectRatio);
1912 else if (data.width) data.height = (csize.width / this.aspectRatio);
1913
1914 if (a == 'sw') {
1915 data.left = cpos.left + (csize.width - data.width);
1916 data.top = null;
1917 }
1918 if (a == 'nw') {
1919 data.top = cpos.top + (csize.height - data.height);
1920 data.left = cpos.left + (csize.width - data.width);
1921 }
1922
1923 return data;
1924 },
1925
1926 _respectSize: function(data, event) {
1927
1928 var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
1929 ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
1930 isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
1931
1932 if (isminw) data.width = o.minWidth;
1933 if (isminh) data.height = o.minHeight;
1934 if (ismaxw) data.width = o.maxWidth;
1935 if (ismaxh) data.height = o.maxHeight;
1936
1937 var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
1938 var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
1939
1940 if (isminw && cw) data.left = dw - o.minWidth;
1941 if (ismaxw && cw) data.left = dw - o.maxWidth;
1942 if (isminh && ch) data.top = dh - o.minHeight;
1943 if (ismaxh && ch) data.top = dh - o.maxHeight;
1944
1945 // fixing jump error on top/left - bug #2330
1946 var isNotwh = !data.width && !data.height;
1947 if (isNotwh && !data.left && data.top) data.top = null;
1948 else if (isNotwh && !data.top && data.left) data.left = null;
1949
1950 return data;
1951 },
1952
1953 _proportionallyResize: function() {
1954
1955 var o = this.options;
1956 if (!this._proportionallyResizeElements.length) return;
1957 var element = this.helper || this.element;
1958
1959 for (var i=0; i < this._proportionallyResizeElements.length; i++) {
1960
1961 var prel = this._proportionallyResizeElements[i];
1962
1963 if (!this.borderDif) {
1964 var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
1965 p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
1966
1967 this.borderDif = $.map(b, function(v, i) {
1968 var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
1969 return border + padding;
1970 });
1971 }
1972
1973 if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
1974 continue;
1975
1976 prel.css({
1977 height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
1978 width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
1979 });
1980
1981 };
1982
1983 },
1984
1985 _renderProxy: function() {
1986
1987 var el = this.element, o = this.options;
1988 this.elementOffset = el.offset();
1989
1990 if(this._helper) {
1991
1992 this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
1993
1994 // fix ie6 offset TODO: This seems broken
1995 var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
1996 pxyoffset = ( ie6 ? 2 : -1 );
1997
1998 this.helper.addClass(this._helper).css({
1999 width: this.element.outerWidth() + pxyoffset,
2000 height: this.element.outerHeight() + pxyoffset,
2001 position: 'absolute',
2002 left: this.elementOffset.left - ie6offset +'px',
2003 top: this.elementOffset.top - ie6offset +'px',
2004 zIndex: ++o.zIndex //TODO: Don't modify option
2005 });
2006
2007 this.helper
2008 .appendTo("body")
2009 .disableSelection();
2010
2011 } else {
2012 this.helper = this.element;
2013 }
2014
2015 },
2016
2017 _change: {
2018 e: function(event, dx, dy) {
2019 return { width: this.originalSize.width + dx };
2020 },
2021 w: function(event, dx, dy) {
2022 var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2023 return { left: sp.left + dx, width: cs.width - dx };
2024 },
2025 n: function(event, dx, dy) {
2026 var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2027 return { top: sp.top + dy, height: cs.height - dy };
2028 },
2029 s: function(event, dx, dy) {
2030 return { height: this.originalSize.height + dy };
2031 },
2032 se: function(event, dx, dy) {
2033 return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2034 },
2035 sw: function(event, dx, dy) {
2036 return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2037 },
2038 ne: function(event, dx, dy) {
2039 return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2040 },
2041 nw: function(event, dx, dy) {
2042 return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2043 }
2044 },
2045
2046 _propagate: function(n, event) {
2047 $.ui.plugin.call(this, n, [event, this.ui()]);
2048 (n != "resize" && this._trigger(n, event, this.ui()));
2049 },
2050
2051 plugins: {},
2052
2053 ui: function() {
2054 return {
2055 originalElement: this.originalElement,
2056 element: this.element,
2057 helper: this.helper,
2058 position: this.position,
2059 size: this.size,
2060 originalSize: this.originalSize,
2061 originalPosition: this.originalPosition
2062 };
2063 }
2064
2065}));
2066
2067$.extend($.ui.resizable, {
2068 version: "1.7.2",
2069 eventPrefix: "resize",
2070 defaults: {
2071 alsoResize: false,
2072 animate: false,
2073 animateDuration: "slow",
2074 animateEasing: "swing",
2075 aspectRatio: false,
2076 autoHide: false,
2077 cancel: ":input,option",
2078 containment: false,
2079 delay: 0,
2080 distance: 1,
2081 ghost: false,
2082 grid: false,
2083 handles: "e,s,se",
2084 helper: false,
2085 maxHeight: null,
2086 maxWidth: null,
2087 minHeight: 10,
2088 minWidth: 10,
2089 zIndex: 1000
2090 }
2091});
2092
2093/*
2094 * Resizable Extensions
2095 */
2096
2097$.ui.plugin.add("resizable", "alsoResize", {
2098
2099 start: function(event, ui) {
2100
2101 var self = $(this).data("resizable"), o = self.options;
2102
2103 _store = function(exp) {
2104 $(exp).each(function() {
2105 $(this).data("resizable-alsoresize", {
2106 width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
2107 left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
2108 });
2109 });
2110 };
2111
2112 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
2113 if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
2114 else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
2115 }else{
2116 _store(o.alsoResize);
2117 }
2118 },
2119
2120 resize: function(event, ui){
2121 var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
2122
2123 var delta = {
2124 height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
2125 top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
2126 },
2127
2128 _alsoResize = function(exp, c) {
2129 $(exp).each(function() {
2130 var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
2131
2132 $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
2133 var sum = (start[prop]||0) + (delta[prop]||0);
2134 if (sum && sum >= 0)
2135 style[prop] = sum || null;
2136 });
2137
2138 //Opera fixing relative position
2139 if (/relative/.test(el.css('position')) && $.browser.opera) {
2140 self._revertToRelativePosition = true;
2141 el.css({ position: 'absolute', top: 'auto', left: 'auto' });
2142 }
2143
2144 el.css(style);
2145 });
2146 };
2147
2148 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
2149 $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
2150 }else{
2151 _alsoResize(o.alsoResize);
2152 }
2153 },
2154
2155 stop: function(event, ui){
2156 var self = $(this).data("resizable");
2157
2158 //Opera fixing relative position
2159 if (self._revertToRelativePosition && $.browser.opera) {
2160 self._revertToRelativePosition = false;
2161 el.css({ position: 'relative' });
2162 }
2163
2164 $(this).removeData("resizable-alsoresize-start");
2165 }
2166});
2167
2168$.ui.plugin.add("resizable", "animate", {
2169
2170 stop: function(event, ui) {
2171 var self = $(this).data("resizable"), o = self.options;
2172
2173 var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2174 soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
2175 soffsetw = ista ? 0 : self.sizeDiff.width;
2176
2177 var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
2178 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
2179 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
2180
2181 self.element.animate(
2182 $.extend(style, top && left ? { top: top, left: left } : {}), {
2183 duration: o.animateDuration,
2184 easing: o.animateEasing,
2185 step: function() {
2186
2187 var data = {
2188 width: parseInt(self.element.css('width'), 10),
2189 height: parseInt(self.element.css('height'), 10),
2190 top: parseInt(self.element.css('top'), 10),
2191 left: parseInt(self.element.css('left'), 10)
2192 };
2193
2194 if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
2195
2196 // propagating resize, and updating values for each animation step
2197 self._updateCache(data);
2198 self._propagate("resize", event);
2199
2200 }
2201 }
2202 );
2203 }
2204
2205});
2206
2207$.ui.plugin.add("resizable", "containment", {
2208
2209 start: function(event, ui) {
2210 var self = $(this).data("resizable"), o = self.options, el = self.element;
2211 var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
2212 if (!ce) return;
2213
2214 self.containerElement = $(ce);
2215
2216 if (/document/.test(oc) || oc == document) {
2217 self.containerOffset = { left: 0, top: 0 };
2218 self.containerPosition = { left: 0, top: 0 };
2219
2220 self.parentData = {
2221 element: $(document), left: 0, top: 0,
2222 width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
2223 };
2224 }
2225
2226 // i'm a node, so compute top, left, right, bottom
2227 else {
2228 var element = $(ce), p = [];
2229 $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
2230
2231 self.containerOffset = element.offset();
2232 self.containerPosition = element.position();
2233 self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
2234
2235 var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
2236 width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
2237
2238 self.parentData = {
2239 element: ce, left: co.left, top: co.top, width: width, height: height
2240 };
2241 }
2242 },
2243
2244 resize: function(event, ui) {
2245 var self = $(this).data("resizable"), o = self.options,
2246 ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
2247 pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
2248
2249 if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
2250
2251 if (cp.left < (self._helper ? co.left : 0)) {
2252 self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
2253 if (pRatio) self.size.height = self.size.width / o.aspectRatio;
2254 self.position.left = o.helper ? co.left : 0;
2255 }
2256
2257 if (cp.top < (self._helper ? co.top : 0)) {
2258 self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
2259 if (pRatio) self.size.width = self.size.height * o.aspectRatio;
2260 self.position.top = self._helper ? co.top : 0;
2261 }
2262
2263 self.offset.left = self.parentData.left+self.position.left;
2264 self.offset.top = self.parentData.top+self.position.top;
2265
2266 var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
2267 hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
2268
2269 var isParent = self.containerElement.get(0) == self.element.parent().get(0),
2270 isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
2271
2272 if(isParent && isOffsetRelative) woset -= self.parentData.left;
2273
2274 if (woset + self.size.width >= self.parentData.width) {
2275 self.size.width = self.parentData.width - woset;
2276 if (pRatio) self.size.height = self.size.width / self.aspectRatio;
2277 }
2278
2279 if (hoset + self.size.height >= self.parentData.height) {
2280 self.size.height = self.parentData.height - hoset;
2281 if (pRatio) self.size.width = self.size.height * self.aspectRatio;
2282 }
2283 },
2284
2285 stop: function(event, ui){
2286 var self = $(this).data("resizable"), o = self.options, cp = self.position,
2287 co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
2288
2289 var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
2290
2291 if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
2292 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2293
2294 if (self._helper && !o.animate && (/static/).test(ce.css('position')))
2295 $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2296
2297 }
2298});
2299
2300$.ui.plugin.add("resizable", "ghost", {
2301
2302 start: function(event, ui) {
2303
2304 var self = $(this).data("resizable"), o = self.options, cs = self.size;
2305
2306 self.ghost = self.originalElement.clone();
2307 self.ghost
2308 .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
2309 .addClass('ui-resizable-ghost')
2310 .addClass(typeof o.ghost == 'string' ? o.ghost : '');
2311
2312 self.ghost.appendTo(self.helper);
2313
2314 },
2315
2316 resize: function(event, ui){
2317 var self = $(this).data("resizable"), o = self.options;
2318 if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
2319 },
2320
2321 stop: function(event, ui){
2322 var self = $(this).data("resizable"), o = self.options;
2323 if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
2324 }
2325
2326});
2327
2328$.ui.plugin.add("resizable", "grid", {
2329
2330 resize: function(event, ui) {
2331 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;
2332 o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
2333 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);
2334
2335 if (/^(se|s|e)$/.test(a)) {
2336 self.size.width = os.width + ox;
2337 self.size.height = os.height + oy;
2338 }
2339 else if (/^(ne)$/.test(a)) {
2340 self.size.width = os.width + ox;
2341 self.size.height = os.height + oy;
2342 self.position.top = op.top - oy;
2343 }
2344 else if (/^(sw)$/.test(a)) {
2345 self.size.width = os.width + ox;
2346 self.size.height = os.height + oy;
2347 self.position.left = op.left - ox;
2348 }
2349 else {
2350 self.size.width = os.width + ox;
2351 self.size.height = os.height + oy;
2352 self.position.top = op.top - oy;
2353 self.position.left = op.left - ox;
2354 }
2355 }
2356
2357});
2358
2359var num = function(v) {
2360 return parseInt(v, 10) || 0;
2361};
2362
2363var isNumber = function(value) {
2364 return !isNaN(parseInt(value, 10));
2365};
2366
2367})(jQuery);
2368/*
2369 * jQuery UI Selectable 1.7.2
2370 *
2371 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
2372 * Dual licensed under the MIT (MIT-LICENSE.txt)
2373 * and GPL (GPL-LICENSE.txt) licenses.
2374 *
2375 * http://docs.jquery.com/UI/Selectables
2376 *
2377 * Depends:
2378 * ui.core.js
2379 */
2380(function($) {
2381
2382$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
2383
2384 _init: function() {
2385 var self = this;
2386
2387 this.element.addClass("ui-selectable");
2388
2389 this.dragged = false;
2390
2391 // cache selectee children based on filter
2392 var selectees;
2393 this.refresh = function() {
2394 selectees = $(self.options.filter, self.element[0]);
2395 selectees.each(function() {
2396 var $this = $(this);
2397 var pos = $this.offset();
2398 $.data(this, "selectable-item", {
2399 element: this,
2400 $element: $this,
2401 left: pos.left,
2402 top: pos.top,
2403 right: pos.left + $this.outerWidth(),
2404 bottom: pos.top + $this.outerHeight(),
2405 startselected: false,
2406 selected: $this.hasClass('ui-selected'),
2407 selecting: $this.hasClass('ui-selecting'),
2408 unselecting: $this.hasClass('ui-unselecting')
2409 });
2410 });
2411 };
2412 this.refresh();
2413
2414 this.selectees = selectees.addClass("ui-selectee");
2415
2416 this._mouseInit();
2417
2418 this.helper = $(document.createElement('div'))
2419 .css({border:'1px dotted black'})
2420 .addClass("ui-selectable-helper");
2421 },
2422
2423 destroy: function() {
2424 this.element
2425 .removeClass("ui-selectable ui-selectable-disabled")
2426 .removeData("selectable")
2427 .unbind(".selectable");
2428 this._mouseDestroy();
2429 },
2430
2431 _mouseStart: function(event) {
2432 var self = this;
2433
2434 this.opos = [event.pageX, event.pageY];
2435
2436 if (this.options.disabled)
2437 return;
2438
2439 var options = this.options;
2440
2441 this.selectees = $(options.filter, this.element[0]);
2442
2443 this._trigger("start", event);
2444
2445 $(options.appendTo).append(this.helper);
2446 // position helper (lasso)
2447 this.helper.css({
2448 "z-index": 100,
2449 "position": "absolute",
2450 "left": event.clientX,
2451 "top": event.clientY,
2452 "width": 0,
2453 "height": 0
2454 });
2455
2456 if (options.autoRefresh) {
2457 this.refresh();
2458 }
2459
2460 this.selectees.filter('.ui-selected').each(function() {
2461 var selectee = $.data(this, "selectable-item");
2462 selectee.startselected = true;
2463 if (!event.metaKey) {
2464 selectee.$element.removeClass('ui-selected');
2465 selectee.selected = false;
2466 selectee.$element.addClass('ui-unselecting');
2467 selectee.unselecting = true;
2468 // selectable UNSELECTING callback
2469 self._trigger("unselecting", event, {
2470 unselecting: selectee.element
2471 });
2472 }
2473 });
2474
2475 $(event.target).parents().andSelf().each(function() {
2476 var selectee = $.data(this, "selectable-item");
2477 if (selectee) {
2478 selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');
2479 selectee.unselecting = false;
2480 selectee.selecting = true;
2481 selectee.selected = true;
2482 // selectable SELECTING callback
2483 self._trigger("selecting", event, {
2484 selecting: selectee.element
2485 });
2486 return false;
2487 }
2488 });
2489
2490 },
2491
2492 _mouseDrag: function(event) {
2493 var self = this;
2494 this.dragged = true;
2495
2496 if (this.options.disabled)
2497 return;
2498
2499 var options = this.options;
2500
2501 var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
2502 if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
2503 if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
2504 this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
2505
2506 this.selectees.each(function() {
2507 var selectee = $.data(this, "selectable-item");
2508 //prevent helper from being selected if appendTo: selectable
2509 if (!selectee || selectee.element == self.element[0])
2510 return;
2511 var hit = false;
2512 if (options.tolerance == 'touch') {
2513 hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
2514 } else if (options.tolerance == 'fit') {
2515 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
2516 }
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
2562 selectee.$element.addClass('ui-unselecting');
2563 selectee.unselecting = true;
2564 // selectable UNSELECTING callback
2565 self._trigger("unselecting", event, {
2566 unselecting: selectee.element
2567 });
2568 }
2569 }
2570 }
2571 });
2572
2573 return false;
2574 },
2575
2576 _mouseStop: function(event) {
2577 var self = this;
2578
2579 this.dragged = false;
2580
2581 var options = this.options;
2582
2583 $('.ui-unselecting', this.element[0]).each(function() {
2584 var selectee = $.data(this, "selectable-item");
2585 selectee.$element.removeClass('ui-unselecting');
2586 selectee.unselecting = false;
2587 selectee.startselected = false;
2588 self._trigger("unselected", event, {
2589 unselected: selectee.element
2590 });
2591 });
2592 $('.ui-selecting', this.element[0]).each(function() {
2593 var selectee = $.data(this, "selectable-item");
2594 selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
2595 selectee.selecting = false;
2596 selectee.selected = true;
2597 selectee.startselected = true;
2598 self._trigger("selected", event, {
2599 selected: selectee.element
2600 });
2601 });
2602 this._trigger("stop", event);
2603
2604 this.helper.remove();
2605
2606 return false;
2607 }
2608
2609}));
2610
2611$.extend($.ui.selectable, {
2612 version: "1.7.2",
2613 defaults: {
2614 appendTo: 'body',
2615 autoRefresh: true,
2616 cancel: ":input,option",
2617 delay: 0,
2618 distance: 0,
2619 filter: '*',
2620 tolerance: 'touch'
2621 }
2622});
2623
2624})(jQuery);
2625/*
2626 * jQuery UI Sortable 1.7.2
2627 *
2628 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
2629 * Dual licensed under the MIT (MIT-LICENSE.txt)
2630 * and GPL (GPL-LICENSE.txt) licenses.
2631 *
2632 * http://docs.jquery.com/UI/Sortables
2633 *
2634 * Depends:
2635 * ui.core.js
2636 */
2637(function($) {
2638
2639$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
2640 _init: function() {
2641
2642 var o = this.options;
2643 this.containerCache = {};
2644 this.element.addClass("ui-sortable");
2645
2646 //Get the items
2647 this.refresh();
2648
2649 //Let's determine if the items are floating
2650 this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
2651
2652 //Let's determine the parent's offset
2653 this.offset = this.element.offset();
2654
2655 //Initialize mouse events for interaction
2656 this._mouseInit();
2657
2658 },
2659
2660 destroy: function() {
2661 this.element
2662 .removeClass("ui-sortable ui-sortable-disabled")
2663 .removeData("sortable")
2664 .unbind(".sortable");
2665 this._mouseDestroy();
2666
2667 for ( var i = this.items.length - 1; i >= 0; i-- )
2668 this.items[i].item.removeData("sortable-item");
2669 },
2670
2671 _mouseCapture: function(event, overrideHandle) {
2672
2673 if (this.reverting) {
2674 return false;
2675 }
2676
2677 if(this.options.disabled || this.options.type == 'static') return false;
2678
2679 //We have to refresh the items data once first
2680 this._refreshItems(event);
2681
2682 //Find out if the clicked node (or one of its parents) is a actual item in this.items
2683 var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
2684 if($.data(this, 'sortable-item') == self) {
2685 currentItem = $(this);
2686 return false;
2687 }
2688 });
2689 if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
2690
2691 if(!currentItem) return false;
2692 if(this.options.handle && !overrideHandle) {
2693 var validHandle = false;
2694
2695 $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
2696 if(!validHandle) return false;
2697 }
2698
2699 this.currentItem = currentItem;
2700 this._removeCurrentsFromItems();
2701 return true;
2702
2703 },
2704
2705 _mouseStart: function(event, overrideHandle, noActivation) {
2706
2707 var o = this.options, self = this;
2708 this.currentContainer = this;
2709
2710 //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
2711 this.refreshPositions();
2712
2713 //Create and append the visible helper
2714 this.helper = this._createHelper(event);
2715
2716 //Cache the helper size
2717 this._cacheHelperProportions();
2718
2719 /*
2720 * - Position generation -
2721 * This block generates everything position related - it's the core of draggables.
2722 */
2723
2724 //Cache the margins of the original element
2725 this._cacheMargins();
2726
2727 //Get the next scrolling parent
2728 this.scrollParent = this.helper.scrollParent();
2729
2730 //The element's absolute position on the page minus margins
2731 this.offset = this.currentItem.offset();
2732 this.offset = {
2733 top: this.offset.top - this.margins.top,
2734 left: this.offset.left - this.margins.left
2735 };
2736
2737 // Only after we got the offset, we can change the helper's position to absolute
2738 // TODO: Still need to figure out a way to make relative sorting possible
2739 this.helper.css("position", "absolute");
2740 this.cssPosition = this.helper.css("position");
2741
2742 $.extend(this.offset, {
2743 click: { //Where the click happened, relative to the element
2744 left: event.pageX - this.offset.left,
2745 top: event.pageY - this.offset.top
2746 },
2747 parent: this._getParentOffset(),
2748 relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
2749 });
2750
2751 //Generate the original position
2752 this.originalPosition = this._generatePosition(event);
2753 this.originalPageX = event.pageX;
2754 this.originalPageY = event.pageY;
2755
2756 //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
2757 if(o.cursorAt)
2758 this._adjustOffsetFromHelper(o.cursorAt);
2759
2760 //Cache the former DOM position
2761 this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
2762
2763 //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
2764 if(this.helper[0] != this.currentItem[0]) {
2765 this.currentItem.hide();
2766 }
2767
2768 //Create the placeholder
2769 this._createPlaceholder();
2770
2771 //Set a containment if given in the options
2772 if(o.containment)
2773 this._setContainment();
2774
2775 if(o.cursor) { // cursor option
2776 if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
2777 $('body').css("cursor", o.cursor);
2778 }
2779
2780 if(o.opacity) { // opacity option
2781 if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
2782 this.helper.css("opacity", o.opacity);
2783 }
2784
2785 if(o.zIndex) { // zIndex option
2786 if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
2787 this.helper.css("zIndex", o.zIndex);
2788 }
2789
2790 //Prepare scrolling
2791 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
2792 this.overflowOffset = this.scrollParent.offset();
2793
2794 //Call callbacks
2795 this._trigger("start", event, this._uiHash());
2796
2797 //Recache the helper size
2798 if(!this._preserveHelperProportions)
2799 this._cacheHelperProportions();
2800
2801
2802 //Post 'activate' events to possible containers
2803 if(!noActivation) {
2804 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
2805 }
2806
2807 //Prepare possible droppables
2808 if($.ui.ddmanager)
2809 $.ui.ddmanager.current = this;
2810
2811 if ($.ui.ddmanager && !o.dropBehaviour)
2812 $.ui.ddmanager.prepareOffsets(this, event);
2813
2814 this.dragging = true;
2815
2816 this.helper.addClass("ui-sortable-helper");
2817 this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
2818 return true;
2819
2820 },
2821
2822 _mouseDrag: function(event) {
2823
2824 //Compute the helpers position
2825 this.position = this._generatePosition(event);
2826 this.positionAbs = this._convertPositionTo("absolute");
2827
2828 if (!this.lastPositionAbs) {
2829 this.lastPositionAbs = this.positionAbs;
2830 }
2831
2832 //Do scrolling
2833 if(this.options.scroll) {
2834 var o = this.options, scrolled = false;
2835 if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
2836
2837 if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
2838 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
2839 else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
2840 this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
2841
2842 if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
2843 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
2844 else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
2845 this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
2846
2847 } else {
2848
2849 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
2850 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
2851 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
2852 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
2853
2854 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
2855 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
2856 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
2857 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
2858
2859 }
2860
2861 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
2862 $.ui.ddmanager.prepareOffsets(this, event);
2863 }
2864
2865 //Regenerate the absolute position used for position checks
2866 this.positionAbs = this._convertPositionTo("absolute");
2867
2868 //Set the helper position
2869 if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
2870 if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
2871
2872 //Rearrange
2873 for (var i = this.items.length - 1; i >= 0; i--) {
2874
2875 //Cache variables and intersection, continue if no intersection
2876 var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
2877 if (!intersection) continue;
2878
2879 if(itemElement != this.currentItem[0] //cannot intersect with itself
2880 && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
2881 && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
2882 && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
2883 ) {
2884
2885 this.direction = intersection == 1 ? "down" : "up";
2886
2887 if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
2888 this._rearrange(event, item);
2889 } else {
2890 break;
2891 }
2892
2893 this._trigger("change", event, this._uiHash());
2894 break;
2895 }
2896 }
2897
2898 //Post events to containers
2899 this._contactContainers(event);
2900
2901 //Interconnect with droppables
2902 if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
2903
2904 //Call callbacks
2905 this._trigger('sort', event, this._uiHash());
2906
2907 this.lastPositionAbs = this.positionAbs;
2908 return false;
2909
2910 },
2911
2912 _mouseStop: function(event, noPropagation) {
2913
2914 if(!event) return;
2915
2916 //If we are using droppables, inform the manager about the drop
2917 if ($.ui.ddmanager && !this.options.dropBehaviour)
2918 $.ui.ddmanager.drop(this, event);
2919
2920 if(this.options.revert) {
2921 var self = this;
2922 var cur = self.placeholder.offset();
2923
2924 self.reverting = true;
2925
2926 $(this.helper).animate({
2927 left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
2928 top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
2929 }, parseInt(this.options.revert, 10) || 500, function() {
2930 self._clear(event);
2931 });
2932 } else {
2933 this._clear(event, noPropagation);
2934 }
2935
2936 return false;
2937
2938 },
2939
2940 cancel: function() {
2941
2942 var self = this;
2943
2944 if(this.dragging) {
2945
2946 this._mouseUp();
2947
2948 if(this.options.helper == "original")
2949 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
2950 else
2951 this.currentItem.show();
2952
2953 //Post deactivating events to containers
2954 for (var i = this.containers.length - 1; i >= 0; i--){
2955 this.containers[i]._trigger("deactivate", null, self._uiHash(this));
2956 if(this.containers[i].containerCache.over) {
2957 this.containers[i]._trigger("out", null, self._uiHash(this));
2958 this.containers[i].containerCache.over = 0;
2959 }
2960 }
2961
2962 }
2963
2964 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
2965 if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
2966 if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
2967
2968 $.extend(this, {
2969 helper: null,
2970 dragging: false,
2971 reverting: false,
2972 _noFinalSort: null
2973 });
2974
2975 if(this.domPosition.prev) {
2976 $(this.domPosition.prev).after(this.currentItem);
2977 } else {
2978 $(this.domPosition.parent).prepend(this.currentItem);
2979 }
2980
2981 return true;
2982
2983 },
2984
2985 serialize: function(o) {
2986
2987 var items = this._getItemsAsjQuery(o && o.connected);
2988 var str = []; o = o || {};
2989
2990 $(items).each(function() {
2991 var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
2992 if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
2993 });
2994
2995 return str.join('&');
2996
2997 },
2998
2999 toArray: function(o) {
3000
3001 var items = this._getItemsAsjQuery(o && o.connected);
3002 var ret = []; o = o || {};
3003
3004 items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
3005 return ret;
3006
3007 },
3008
3009 /* Be careful with the following core functions */
3010 _intersectsWith: function(item) {
3011
3012 var x1 = this.positionAbs.left,
3013 x2 = x1 + this.helperProportions.width,
3014 y1 = this.positionAbs.top,
3015 y2 = y1 + this.helperProportions.height;
3016
3017 var l = item.left,
3018 r = l + item.width,
3019 t = item.top,
3020 b = t + item.height;
3021
3022 var dyClick = this.offset.click.top,
3023 dxClick = this.offset.click.left;
3024
3025 var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
3026
3027 if( this.options.tolerance == "pointer"
3028 || this.options.forcePointerForContainers
3029 || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
3030 ) {
3031 return isOverElement;
3032 } else {
3033
3034 return (l < x1 + (this.helperProportions.width / 2) // Right Half
3035 && x2 - (this.helperProportions.width / 2) < r // Left Half
3036 && t < y1 + (this.helperProportions.height / 2) // Bottom Half
3037 && y2 - (this.helperProportions.height / 2) < b ); // Top Half
3038
3039 }
3040 },
3041
3042 _intersectsWithPointer: function(item) {
3043
3044 var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
3045 isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
3046 isOverElement = isOverElementHeight && isOverElementWidth,
3047 verticalDirection = this._getDragVerticalDirection(),
3048 horizontalDirection = this._getDragHorizontalDirection();
3049
3050 if (!isOverElement)
3051 return false;
3052
3053 return this.floating ?
3054 ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
3055 : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
3056
3057 },
3058
3059 _intersectsWithSides: function(item) {
3060
3061 var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
3062 isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
3063 verticalDirection = this._getDragVerticalDirection(),
3064 horizontalDirection = this._getDragHorizontalDirection();
3065
3066 if (this.floating && horizontalDirection) {
3067 return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
3068 } else {
3069 return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
3070 }
3071
3072 },
3073
3074 _getDragVerticalDirection: function() {
3075 var delta = this.positionAbs.top - this.lastPositionAbs.top;
3076 return delta != 0 && (delta > 0 ? "down" : "up");
3077 },
3078
3079 _getDragHorizontalDirection: function() {
3080 var delta = this.positionAbs.left - this.lastPositionAbs.left;
3081 return delta != 0 && (delta > 0 ? "right" : "left");
3082 },
3083
3084 refresh: function(event) {
3085 this._refreshItems(event);
3086 this.refreshPositions();
3087 },
3088
3089 _connectWith: function() {
3090 var options = this.options;
3091 return options.connectWith.constructor == String
3092 ? [options.connectWith]
3093 : options.connectWith;
3094 },
3095
3096 _getItemsAsjQuery: function(connected) {
3097
3098 var self = this;
3099 var items = [];
3100 var queries = [];
3101 var connectWith = this._connectWith();
3102
3103 if(connectWith && connected) {
3104 for (var i = connectWith.length - 1; i >= 0; i--){
3105 var cur = $(connectWith[i]);
3106 for (var j = cur.length - 1; j >= 0; j--){
3107 var inst = $.data(cur[j], 'sortable');
3108 if(inst && inst != this && !inst.options.disabled) {
3109 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
3110 }
3111 };
3112 };
3113 }
3114
3115 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"), this]);
3116
3117 for (var i = queries.length - 1; i >= 0; i--){
3118 queries[i][0].each(function() {
3119 items.push(this);
3120 });
3121 };
3122
3123 return $(items);
3124
3125 },
3126
3127 _removeCurrentsFromItems: function() {
3128
3129 var list = this.currentItem.find(":data(sortable-item)");
3130
3131 for (var i=0; i < this.items.length; i++) {
3132
3133 for (var j=0; j < list.length; j++) {
3134 if(list[j] == this.items[i].item[0])
3135 this.items.splice(i,1);
3136 };
3137
3138 };
3139
3140 },
3141
3142 _refreshItems: function(event) {
3143
3144 this.items = [];
3145 this.containers = [this];
3146 var items = this.items;
3147 var self = this;
3148 var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
3149 var connectWith = this._connectWith();
3150
3151 if(connectWith) {
3152 for (var i = connectWith.length - 1; i >= 0; i--){
3153 var cur = $(connectWith[i]);
3154 for (var j = cur.length - 1; j >= 0; j--){
3155 var inst = $.data(cur[j], 'sortable');
3156 if(inst && inst != this && !inst.options.disabled) {
3157 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
3158 this.containers.push(inst);
3159 }
3160 };
3161 };
3162 }
3163
3164 for (var i = queries.length - 1; i >= 0; i--) {
3165 var targetData = queries[i][1];
3166 var _queries = queries[i][0];
3167
3168 for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
3169 var item = $(_queries[j]);
3170
3171 item.data('sortable-item', targetData); // Data for target checking (mouse manager)
3172
3173 items.push({
3174 item: item,
3175 instance: targetData,
3176 width: 0, height: 0,
3177 left: 0, top: 0
3178 });
3179 };
3180 };
3181
3182 },
3183
3184 refreshPositions: function(fast) {
3185
3186 //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
3187 if(this.offsetParent && this.helper) {
3188 this.offset.parent = this._getParentOffset();
3189 }
3190
3191 for (var i = this.items.length - 1; i >= 0; i--){
3192 var item = this.items[i];
3193
3194 //We ignore calculating positions of all connected containers when we're not over them
3195 if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
3196 continue;
3197
3198 var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
3199
3200 if (!fast) {
3201 item.width = t.outerWidth();
3202 item.height = t.outerHeight();
3203 }
3204
3205 var p = t.offset();
3206 item.left = p.left;
3207 item.top = p.top;
3208 };
3209
3210 if(this.options.custom && this.options.custom.refreshContainers) {
3211 this.options.custom.refreshContainers.call(this);
3212 } else {
3213 for (var i = this.containers.length - 1; i >= 0; i--){
3214 var p = this.containers[i].element.offset();
3215 this.containers[i].containerCache.left = p.left;
3216 this.containers[i].containerCache.top = p.top;
3217 this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
3218 this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
3219 };
3220 }
3221
3222 },
3223
3224 _createPlaceholder: function(that) {
3225
3226 var self = that || this, o = self.options;
3227
3228 if(!o.placeholder || o.placeholder.constructor == String) {
3229 var className = o.placeholder;
3230 o.placeholder = {
3231 element: function() {
3232
3233 var el = $(document.createElement(self.currentItem[0].nodeName))
3234 .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
3235 .removeClass("ui-sortable-helper")[0];
3236
3237 if(!className)
3238 el.style.visibility = "hidden";
3239
3240 return el;
3241 },
3242 update: function(container, p) {
3243
3244 // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
3245 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
3246 if(className && !o.forcePlaceholderSize) return;
3247
3248 //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
3249 if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
3250 if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
3251 }
3252 };
3253 }
3254
3255 //Create the placeholder
3256 self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
3257
3258 //Append it after the actual current item
3259 self.currentItem.after(self.placeholder);
3260
3261 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
3262 o.placeholder.update(self, self.placeholder);
3263
3264 },
3265
3266 _contactContainers: function(event) {
3267 for (var i = this.containers.length - 1; i >= 0; i--){
3268
3269 if(this._intersectsWith(this.containers[i].containerCache)) {
3270 if(!this.containers[i].containerCache.over) {
3271
3272 if(this.currentContainer != this.containers[i]) {
3273
3274 //When entering a new container, we will find the item with the least distance and append our item near it
3275 var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
3276 for (var j = this.items.length - 1; j >= 0; j--) {
3277 if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue;
3278 var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
3279 if(Math.abs(cur - base) < dist) {
3280 dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
3281 }
3282 }
3283
3284 if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
3285 continue;
3286
3287 this.currentContainer = this.containers[i];
3288 itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[i].element, true);
3289 this._trigger("change", event, this._uiHash());
3290 this.containers[i]._trigger("change", event, this._uiHash(this));
3291
3292 //Update the placeholder
3293 this.options.placeholder.update(this.currentContainer, this.placeholder);
3294
3295 }
3296
3297 this.containers[i]._trigger("over", event, this._uiHash(this));
3298 this.containers[i].containerCache.over = 1;
3299 }
3300 } else {
3301 if(this.containers[i].containerCache.over) {
3302 this.containers[i]._trigger("out", event, this._uiHash(this));
3303 this.containers[i].containerCache.over = 0;
3304 }
3305 }
3306
3307 };
3308 },
3309
3310 _createHelper: function(event) {
3311
3312 var o = this.options;
3313 var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
3314
3315 if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
3316 $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
3317
3318 if(helper[0] == this.currentItem[0])
3319 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") };
3320
3321 if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
3322 if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
3323
3324 return helper;
3325
3326 },
3327
3328 _adjustOffsetFromHelper: function(obj) {
3329 if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
3330 if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
3331 if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
3332 if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
3333 },
3334
3335 _getParentOffset: function() {
3336
3337
3338 //Get the offsetParent and cache its position
3339 this.offsetParent = this.helper.offsetParent();
3340 var po = this.offsetParent.offset();
3341
3342 // This is a special case where we need to modify a offset calculated on start, since the following happened:
3343 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
3344 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
3345 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
3346 if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
3347 po.left += this.scrollParent.scrollLeft();
3348 po.top += this.scrollParent.scrollTop();
3349 }
3350
3351 if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
3352 || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
3353 po = { top: 0, left: 0 };
3354
3355 return {
3356 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
3357 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
3358 };
3359
3360 },
3361
3362 _getRelativeOffset: function() {
3363
3364 if(this.cssPosition == "relative") {
3365 var p = this.currentItem.position();
3366 return {
3367 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
3368 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
3369 };
3370 } else {
3371 return { top: 0, left: 0 };
3372 }
3373
3374 },
3375
3376 _cacheMargins: function() {
3377 this.margins = {
3378 left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
3379 top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
3380 };
3381 },
3382
3383 _cacheHelperProportions: function() {
3384 this.helperProportions = {
3385 width: this.helper.outerWidth(),
3386 height: this.helper.outerHeight()
3387 };
3388 },
3389
3390 _setContainment: function() {
3391
3392 var o = this.options;
3393 if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
3394 if(o.containment == 'document' || o.containment == 'window') this.containment = [
3395 0 - this.offset.relative.left - this.offset.parent.left,
3396 0 - this.offset.relative.top - this.offset.parent.top,
3397 $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
3398 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
3399 ];
3400
3401 if(!(/^(document|window|parent)$/).test(o.containment)) {
3402 var ce = $(o.containment)[0];
3403 var co = $(o.containment).offset();
3404 var over = ($(ce).css("overflow") != 'hidden');
3405
3406 this.containment = [
3407 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
3408 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
3409 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,
3410 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
3411 ];
3412 }
3413
3414 },
3415
3416 _convertPositionTo: function(d, pos) {
3417
3418 if(!pos) pos = this.position;
3419 var mod = d == "absolute" ? 1 : -1;
3420 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);
3421
3422 return {
3423 top: (
3424 pos.top // The absolute mouse position
3425 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
3426 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
3427 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
3428 ),
3429 left: (
3430 pos.left // The absolute mouse position
3431 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
3432 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
3433 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
3434 )
3435 };
3436
3437 },
3438
3439 _generatePosition: function(event) {
3440
3441 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);
3442
3443 // This is another very weird special case that only happens for relative elements:
3444 // 1. If the css position is relative
3445 // 2. and the scroll parent is the document or similar to the offset parent
3446 // we have to refresh the relative offset during the scroll so there are no jumps
3447 if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
3448 this.offset.relative = this._getRelativeOffset();
3449 }
3450
3451 var pageX = event.pageX;
3452 var pageY = event.pageY;
3453
3454 /*
3455 * - Position constraining -
3456 * Constrain the position to a mix of grid, containment.
3457 */
3458
3459 if(this.originalPosition) { //If we are not dragging yet, we won't check for options
3460
3461 if(this.containment) {
3462 if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
3463 if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
3464 if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
3465 if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
3466 }
3467
3468 if(o.grid) {
3469 var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
3470 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;
3471
3472 var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
3473 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;
3474 }
3475
3476 }
3477
3478 return {
3479 top: (
3480 pageY // The absolute mouse position
3481 - this.offset.click.top // Click offset (relative to the element)
3482 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
3483 - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
3484 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
3485 ),
3486 left: (
3487 pageX // The absolute mouse position
3488 - this.offset.click.left // Click offset (relative to the element)
3489 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
3490 - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
3491 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
3492 )
3493 };
3494
3495 },
3496
3497 _rearrange: function(event, i, a, hardRefresh) {
3498
3499 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));
3500
3501 //Various things done here to improve the performance:
3502 // 1. we create a setTimeout, that calls refreshPositions
3503 // 2. on the instance, we have a counter variable, that get's higher after every append
3504 // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
3505 // 4. this lets only the last addition to the timeout stack through
3506 this.counter = this.counter ? ++this.counter : 1;
3507 var self = this, counter = this.counter;
3508
3509 window.setTimeout(function() {
3510 if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
3511 },0);
3512
3513 },
3514
3515 _clear: function(event, noPropagation) {
3516
3517 this.reverting = false;
3518 // We delay all events that have to be triggered to after the point where the placeholder has been removed and
3519 // everything else normalized again
3520 var delayedTriggers = [], self = this;
3521
3522 // We first have to update the dom position of the actual currentItem
3523 // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
3524 if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
3525 this._noFinalSort = null;
3526
3527 if(this.helper[0] == this.currentItem[0]) {
3528 for(var i in this._storedCSS) {
3529 if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
3530 }
3531 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
3532 } else {
3533 this.currentItem.show();
3534 }
3535
3536 if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
3537 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
3538 if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
3539 if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
3540 for (var i = this.containers.length - 1; i >= 0; i--){
3541 if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
3542 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
3543 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
3544 }
3545 };
3546 };
3547
3548 //Post events to containers
3549 for (var i = this.containers.length - 1; i >= 0; i--){
3550 if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
3551 if(this.containers[i].containerCache.over) {
3552 delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
3553 this.containers[i].containerCache.over = 0;
3554 }
3555 }
3556
3557 //Do what was originally in plugins
3558 if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
3559 if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset cursor
3560 if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
3561
3562 this.dragging = false;
3563 if(this.cancelHelperRemoval) {
3564 if(!noPropagation) {
3565 this._trigger("beforeStop", event, this._uiHash());
3566 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
3567 this._trigger("stop", event, this._uiHash());
3568 }
3569 return false;
3570 }
3571
3572 if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
3573
3574 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
3575 this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
3576
3577 if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
3578
3579 if(!noPropagation) {
3580 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
3581 this._trigger("stop", event, this._uiHash());
3582 }
3583
3584 this.fromOutside = false;
3585 return true;
3586
3587 },
3588
3589 _trigger: function() {
3590 if ($.widget.prototype._trigger.apply(this, arguments) === false) {
3591 this.cancel();
3592 }
3593 },
3594
3595 _uiHash: function(inst) {
3596 var self = inst || this;
3597 return {
3598 helper: self.helper,
3599 placeholder: self.placeholder || $([]),
3600 position: self.position,
3601 absolutePosition: self.positionAbs, //deprecated
3602 offset: self.positionAbs,
3603 item: self.currentItem,
3604 sender: inst ? inst.element : null
3605 };
3606 }
3607
3608}));
3609
3610$.extend($.ui.sortable, {
3611 getter: "serialize toArray",
3612 version: "1.7.2",
3613 eventPrefix: "sort",
3614 defaults: {
3615 appendTo: "parent",
3616 axis: false,
3617 cancel: ":input,option",
3618 connectWith: false,
3619 containment: false,
3620 cursor: 'auto',
3621 cursorAt: false,
3622 delay: 0,
3623 distance: 1,
3624 dropOnEmpty: true,
3625 forcePlaceholderSize: false,
3626 forceHelperSize: false,
3627 grid: false,
3628 handle: false,
3629 helper: "original",
3630 items: '> *',
3631 opacity: false,
3632 placeholder: false,
3633 revert: false,
3634 scroll: true,
3635 scrollSensitivity: 20,
3636 scrollSpeed: 20,
3637 scope: "default",
3638 tolerance: "intersect",
3639 zIndex: 1000
3640 }
3641});
3642
3643})(jQuery);
3644/*
3645 * jQuery UI Accordion 1.7.2
3646 *
3647 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
3648 * Dual licensed under the MIT (MIT-LICENSE.txt)
3649 * and GPL (GPL-LICENSE.txt) licenses.
3650 *
3651 * http://docs.jquery.com/UI/Accordion
3652 *
3653 * Depends:
3654 * ui.core.js
3655 */
3656(function($) {
3657
3658$.widget("ui.accordion", {
3659
3660 _init: function() {
3661
3662 var o = this.options, self = this;
3663 this.running = 0;
3664
3665 // if the user set the alwaysOpen option on init
3666 // then we need to set the collapsible option
3667 // if they set both on init, collapsible will take priority
3668 if (o.collapsible == $.ui.accordion.defaults.collapsible &&
3669 o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
3670 o.collapsible = !o.alwaysOpen;
3671 }
3672
3673 if ( o.navigation ) {
3674 var current = this.element.find("a").filter(o.navigationFilter);
3675 if ( current.length ) {
3676 if ( current.filter(o.header).length ) {
3677 this.active = current;
3678 } else {
3679 this.active = current.parent().parent().prev();
3680 current.addClass("ui-accordion-content-active");
3681 }
3682 }
3683 }
3684
3685 this.element.addClass("ui-accordion ui-widget ui-helper-reset");
3686
3687 // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
3688 if (this.element[0].nodeName == "UL") {
3689 this.element.children("li").addClass("ui-accordion-li-fix");
3690 }
3691
3692 this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
3693 .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
3694 .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
3695 .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
3696 .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); });
3697
3698 this.headers
3699 .next()
3700 .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
3701
3702 this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
3703 this.active.next().addClass('ui-accordion-content-active');
3704
3705 //Append icon elements
3706 $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
3707 this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
3708
3709 // IE7-/Win - Extra vertical space in lists fixed
3710 if ($.browser.msie) {
3711 this.element.find('a').css('zoom', '1');
3712 }
3713
3714 this.resize();
3715
3716 //ARIA
3717 this.element.attr('role','tablist');
3718
3719 this.headers
3720 .attr('role','tab')
3721 .bind('keydown', function(event) { return self._keydown(event); })
3722 .next()
3723 .attr('role','tabpanel');
3724
3725 this.headers
3726 .not(this.active || "")
3727 .attr('aria-expanded','false')
3728 .attr("tabIndex", "-1")
3729 .next()
3730 .hide();
3731
3732 // make sure at least one header is in the tab order
3733 if (!this.active.length) {
3734 this.headers.eq(0).attr('tabIndex','0');
3735 } else {
3736 this.active
3737 .attr('aria-expanded','true')
3738 .attr('tabIndex', '0');
3739 }
3740
3741 // only need links in taborder for Safari
3742 if (!$.browser.safari)
3743 this.headers.find('a').attr('tabIndex','-1');
3744
3745 if (o.event) {
3746 this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); });
3747 }
3748
3749 },
3750
3751 destroy: function() {
3752 var o = this.options;
3753
3754 this.element
3755 .removeClass("ui-accordion ui-widget ui-helper-reset")
3756 .removeAttr("role")
3757 .unbind('.accordion')
3758 .removeData('accordion');
3759
3760 this.headers
3761 .unbind(".accordion")
3762 .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
3763 .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
3764
3765 this.headers.find("a").removeAttr("tabindex");
3766 this.headers.children(".ui-icon").remove();
3767 var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
3768 if (o.autoHeight || o.fillHeight) {
3769 contents.css("height", "");
3770 }
3771 },
3772
3773 _setData: function(key, value) {
3774 if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
3775 $.widget.prototype._setData.apply(this, arguments);
3776 },
3777
3778 _keydown: function(event) {
3779
3780 var o = this.options, keyCode = $.ui.keyCode;
3781
3782 if (o.disabled || event.altKey || event.ctrlKey)
3783 return;
3784
3785 var length = this.headers.length;
3786 var currentIndex = this.headers.index(event.target);
3787 var toFocus = false;
3788
3789 switch(event.keyCode) {
3790 case keyCode.RIGHT:
3791 case keyCode.DOWN:
3792 toFocus = this.headers[(currentIndex + 1) % length];
3793 break;
3794 case keyCode.LEFT:
3795 case keyCode.UP:
3796 toFocus = this.headers[(currentIndex - 1 + length) % length];
3797 break;
3798 case keyCode.SPACE:
3799 case keyCode.ENTER:
3800 return this._clickHandler({ target: event.target }, event.target);
3801 }
3802
3803 if (toFocus) {
3804 $(event.target).attr('tabIndex','-1');
3805 $(toFocus).attr('tabIndex','0');
3806 toFocus.focus();
3807 return false;
3808 }
3809
3810 return true;
3811
3812 },
3813
3814 resize: function() {
3815
3816 var o = this.options, maxHeight;
3817
3818 if (o.fillSpace) {
3819
3820 if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
3821 maxHeight = this.element.parent().height();
3822 if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
3823
3824 this.headers.each(function() {
3825 maxHeight -= $(this).outerHeight();
3826 });
3827
3828 var maxPadding = 0;
3829 this.headers.next().each(function() {
3830 maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
3831 }).height(Math.max(0, maxHeight - maxPadding))
3832 .css('overflow', 'auto');
3833
3834 } else if ( o.autoHeight ) {
3835 maxHeight = 0;
3836 this.headers.next().each(function() {
3837 maxHeight = Math.max(maxHeight, $(this).outerHeight());
3838 }).height(maxHeight);
3839 }
3840
3841 },
3842
3843 activate: function(index) {
3844 // call clickHandler with custom event
3845 var active = this._findActive(index)[0];
3846 this._clickHandler({ target: active }, active);
3847 },
3848
3849 _findActive: function(selector) {
3850 return selector
3851 ? typeof selector == "number"
3852 ? this.headers.filter(":eq(" + selector + ")")
3853 : this.headers.not(this.headers.not(selector))
3854 : selector === false
3855 ? $([])
3856 : this.headers.filter(":eq(0)");
3857 },
3858
3859 _clickHandler: function(event, target) {
3860
3861 var o = this.options;
3862 if (o.disabled) return false;
3863
3864 // called only when using activate(false) to close all parts programmatically
3865 if (!event.target && o.collapsible) {
3866 this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
3867 .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
3868 this.active.next().addClass('ui-accordion-content-active');
3869 var toHide = this.active.next(),
3870 data = {
3871 options: o,
3872 newHeader: $([]),
3873 oldHeader: o.active,
3874 newContent: $([]),
3875 oldContent: toHide
3876 },
3877 toShow = (this.active = $([]));
3878 this._toggle(toShow, toHide, data);
3879 return false;
3880 }
3881
3882 // get the click target
3883 var clicked = $(event.currentTarget || target);
3884 var clickedIsActive = clicked[0] == this.active[0];
3885
3886 // if animations are still active, or the active header is the target, ignore click
3887 if (this.running || (!o.collapsible && clickedIsActive)) {
3888 return false;
3889 }
3890
3891 // switch classes
3892 this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
3893 .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
3894 this.active.next().addClass('ui-accordion-content-active');
3895 if (!clickedIsActive) {
3896 clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
3897 .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
3898 clicked.next().addClass('ui-accordion-content-active');
3899 }
3900
3901 // find elements to show and hide
3902 var toShow = clicked.next(),
3903 toHide = this.active.next(),
3904 data = {
3905 options: o,
3906 newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
3907 oldHeader: this.active,
3908 newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
3909 oldContent: toHide.find('> *')
3910 },
3911 down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
3912
3913 this.active = clickedIsActive ? $([]) : clicked;
3914 this._toggle(toShow, toHide, data, clickedIsActive, down);
3915
3916 return false;
3917
3918 },
3919
3920 _toggle: function(toShow, toHide, data, clickedIsActive, down) {
3921
3922 var o = this.options, self = this;
3923
3924 this.toShow = toShow;
3925 this.toHide = toHide;
3926 this.data = data;
3927
3928 var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };
3929
3930 // trigger changestart event
3931 this._trigger("changestart", null, this.data);
3932
3933 // count elements to animate
3934 this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
3935
3936 if (o.animated) {
3937
3938 var animOptions = {};
3939
3940 if ( o.collapsible && clickedIsActive ) {
3941 animOptions = {
3942 toShow: $([]),
3943 toHide: toHide,
3944 complete: complete,
3945 down: down,
3946 autoHeight: o.autoHeight || o.fillSpace
3947 };
3948 } else {
3949 animOptions = {
3950 toShow: toShow,
3951 toHide: toHide,
3952 complete: complete,
3953 down: down,
3954 autoHeight: o.autoHeight || o.fillSpace
3955 };
3956 }
3957
3958 if (!o.proxied) {
3959 o.proxied = o.animated;
3960 }
3961
3962 if (!o.proxiedDuration) {
3963 o.proxiedDuration = o.duration;
3964 }
3965
3966 o.animated = $.isFunction(o.proxied) ?
3967 o.proxied(animOptions) : o.proxied;
3968
3969 o.duration = $.isFunction(o.proxiedDuration) ?
3970 o.proxiedDuration(animOptions) : o.proxiedDuration;
3971
3972 var animations = $.ui.accordion.animations,
3973 duration = o.duration,
3974 easing = o.animated;
3975
3976 if (!animations[easing]) {
3977 animations[easing] = function(options) {
3978 this.slide(options, {
3979 easing: easing,
3980 duration: duration || 700
3981 });
3982 };
3983 }
3984
3985 animations[easing](animOptions);
3986
3987 } else {
3988
3989 if (o.collapsible && clickedIsActive) {
3990 toShow.toggle();
3991 } else {
3992 toHide.hide();
3993 toShow.show();
3994 }
3995
3996 complete(true);
3997
3998 }
3999
4000 toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
4001 toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
4002
4003 },
4004
4005 _completed: function(cancel) {
4006
4007 var o = this.options;
4008
4009 this.running = cancel ? 0 : --this.running;
4010 if (this.running) return;
4011
4012 if (o.clearStyle) {
4013 this.toShow.add(this.toHide).css({
4014 height: "",
4015 overflow: ""
4016 });
4017 }
4018
4019 this._trigger('change', null, this.data);
4020 }
4021
4022});
4023
4024
4025$.extend($.ui.accordion, {
4026 version: "1.7.2",
4027 defaults: {
4028 active: null,
4029 alwaysOpen: true, //deprecated, use collapsible
4030 animated: 'slide',
4031 autoHeight: true,
4032 clearStyle: false,
4033 collapsible: false,
4034 event: "click",
4035 fillSpace: false,
4036 header: "> li > :first-child,> :not(li):even",
4037 icons: {
4038 header: "ui-icon-triangle-1-e",
4039 headerSelected: "ui-icon-triangle-1-s"
4040 },
4041 navigation: false,
4042 navigationFilter: function() {
4043 return this.href.toLowerCase() == location.href.toLowerCase();
4044 }
4045 },
4046 animations: {
4047 slide: function(options, additions) {
4048 options = $.extend({
4049 easing: "swing",
4050 duration: 300
4051 }, options, additions);
4052 if ( !options.toHide.size() ) {
4053 options.toShow.animate({height: "show"}, options);
4054 return;
4055 }
4056 if ( !options.toShow.size() ) {
4057 options.toHide.animate({height: "hide"}, options);
4058 return;
4059 }
4060 var overflow = options.toShow.css('overflow'),
4061 percentDone,
4062 showProps = {},
4063 hideProps = {},
4064 fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
4065 originalWidth;
4066 // fix width before calculating height of hidden element
4067 var s = options.toShow;
4068 originalWidth = s[0].style.width;
4069 s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
4070
4071 $.each(fxAttrs, function(i, prop) {
4072 hideProps[prop] = 'hide';
4073
4074 var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
4075 showProps[prop] = {
4076 value: parts[1],
4077 unit: parts[2] || 'px'
4078 };
4079 });
4080 options.toShow.css({ height: 0, overflow: 'hidden' }).show();
4081 options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
4082 step: function(now, settings) {
4083 // only calculate the percent when animating height
4084 // IE gets very inconsistent results when animating elements
4085 // with small values, which is common for padding
4086 if (settings.prop == 'height') {
4087 percentDone = (settings.now - settings.start) / (settings.end - settings.start);
4088 }
4089
4090 options.toShow[0].style[settings.prop] =
4091 (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
4092 },
4093 duration: options.duration,
4094 easing: options.easing,
4095 complete: function() {
4096 if ( !options.autoHeight ) {
4097 options.toShow.css("height", "");
4098 }
4099 options.toShow.css("width", originalWidth);
4100 options.toShow.css({overflow: overflow});
4101 options.complete();
4102 }
4103 });
4104 },
4105 bounceslide: function(options) {
4106 this.slide(options, {
4107 easing: options.down ? "easeOutBounce" : "swing",
4108 duration: options.down ? 1000 : 200
4109 });
4110 },
4111 easeslide: function(options) {
4112 this.slide(options, {
4113 easing: "easeinout",
4114 duration: 700
4115 });
4116 }
4117 }
4118});
4119
4120})(jQuery);
4121/*
4122 * jQuery UI Dialog 1.7.2
4123 *
4124 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4125 * Dual licensed under the MIT (MIT-LICENSE.txt)
4126 * and GPL (GPL-LICENSE.txt) licenses.
4127 *
4128 * http://docs.jquery.com/UI/Dialog
4129 *
4130 * Depends:
4131 * ui.core.js
4132 * ui.draggable.js
4133 * ui.resizable.js
4134 */
4135(function($) {
4136
4137var setDataSwitch = {
4138 dragStart: "start.draggable",
4139 drag: "drag.draggable",
4140 dragStop: "stop.draggable",
4141 maxHeight: "maxHeight.resizable",
4142 minHeight: "minHeight.resizable",
4143 maxWidth: "maxWidth.resizable",
4144 minWidth: "minWidth.resizable",
4145 resizeStart: "start.resizable",
4146 resize: "drag.resizable",
4147 resizeStop: "stop.resizable"
4148 },
4149
4150 uiDialogClasses =
4151 'ui-dialog ' +
4152 'ui-widget ' +
4153 'ui-widget-content ' +
4154 'ui-corner-all ';
4155
4156$.widget("ui.dialog", {
4157
4158 _init: function() {
4159 this.originalTitle = this.element.attr('title');
4160
4161 var self = this,
4162 options = this.options,
4163
4164 title = options.title || this.originalTitle || '&nbsp;',
4165 titleId = $.ui.dialog.getTitleId(this.element),
4166
4167 uiDialog = (this.uiDialog = $('<div/>'))
4168 .appendTo(document.body)
4169 .hide()
4170 .addClass(uiDialogClasses + options.dialogClass)
4171 .css({
4172 position: 'absolute',
4173 overflow: 'hidden',
4174 zIndex: options.zIndex
4175 })
4176 // setting tabIndex makes the div focusable
4177 // setting outline to 0 prevents a border on focus in Mozilla
4178 .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
4179 (options.closeOnEscape && event.keyCode
4180 && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
4181 })
4182 .attr({
4183 role: 'dialog',
4184 'aria-labelledby': titleId
4185 })
4186 .mousedown(function(event) {
4187 self.moveToTop(false, event);
4188 }),
4189
4190 uiDialogContent = this.element
4191 .show()
4192 .removeAttr('title')
4193 .addClass(
4194 'ui-dialog-content ' +
4195 'ui-widget-content')
4196 .appendTo(uiDialog),
4197
4198 uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
4199 .addClass(
4200 'ui-dialog-titlebar ' +
4201 'ui-widget-header ' +
4202 'ui-corner-all ' +
4203 'ui-helper-clearfix'
4204 )
4205 .prependTo(uiDialog),
4206
4207 uiDialogTitlebarClose = $('<a href="#"/>')
4208 .addClass(
4209 'ui-dialog-titlebar-close ' +
4210 'ui-corner-all'
4211 )
4212 .attr('role', 'button')
4213 .hover(
4214 function() {
4215 uiDialogTitlebarClose.addClass('ui-state-hover');
4216 },
4217 function() {
4218 uiDialogTitlebarClose.removeClass('ui-state-hover');
4219 }
4220 )
4221 .focus(function() {
4222 uiDialogTitlebarClose.addClass('ui-state-focus');
4223 })
4224 .blur(function() {
4225 uiDialogTitlebarClose.removeClass('ui-state-focus');
4226 })
4227 .mousedown(function(ev) {
4228 ev.stopPropagation();
4229 })
4230 .click(function(event) {
4231 self.close(event);
4232 return false;
4233 })
4234 .appendTo(uiDialogTitlebar),
4235
4236 uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
4237 .addClass(
4238 'ui-icon ' +
4239 'ui-icon-closethick'
4240 )
4241 .text(options.closeText)
4242 .appendTo(uiDialogTitlebarClose),
4243
4244 uiDialogTitle = $('<span/>')
4245 .addClass('ui-dialog-title')
4246 .attr('id', titleId)
4247 .html(title)
4248 .prependTo(uiDialogTitlebar);
4249
4250 uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
4251
4252 (options.draggable && $.fn.draggable && this._makeDraggable());
4253 (options.resizable && $.fn.resizable && this._makeResizable());
4254
4255 this._createButtons(options.buttons);
4256 this._isOpen = false;
4257
4258 (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
4259 (options.autoOpen && this.open());
4260
4261 },
4262
4263 destroy: function() {
4264 (this.overlay && this.overlay.destroy());
4265 this.uiDialog.hide();
4266 this.element
4267 .unbind('.dialog')
4268 .removeData('dialog')
4269 .removeClass('ui-dialog-content ui-widget-content')
4270 .hide().appendTo('body');
4271 this.uiDialog.remove();
4272
4273 (this.originalTitle && this.element.attr('title', this.originalTitle));
4274 },
4275
4276 close: function(event) {
4277 var self = this;
4278
4279 if (false === self._trigger('beforeclose', event)) {
4280 return;
4281 }
4282
4283 (self.overlay && self.overlay.destroy());
4284 self.uiDialog.unbind('keypress.ui-dialog');
4285
4286 (self.options.hide
4287 ? self.uiDialog.hide(self.options.hide, function() {
4288 self._trigger('close', event);
4289 })
4290 : self.uiDialog.hide() && self._trigger('close', event));
4291
4292 $.ui.dialog.overlay.resize();
4293
4294 self._isOpen = false;
4295
4296 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
4297 if (self.options.modal) {
4298 var maxZ = 0;
4299 $('.ui-dialog').each(function() {
4300 if (this != self.uiDialog[0]) {
4301 maxZ = Math.max(maxZ, $(this).css('z-index'));
4302 }
4303 });
4304 $.ui.dialog.maxZ = maxZ;
4305 }
4306 },
4307
4308 isOpen: function() {
4309 return this._isOpen;
4310 },
4311
4312 // the force parameter allows us to move modal dialogs to their correct
4313 // position on open
4314 moveToTop: function(force, event) {
4315
4316 if ((this.options.modal && !force)
4317 || (!this.options.stack && !this.options.modal)) {
4318 return this._trigger('focus', event);
4319 }
4320
4321 if (this.options.zIndex > $.ui.dialog.maxZ) {
4322 $.ui.dialog.maxZ = this.options.zIndex;
4323 }
4324 (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ));
4325
4326 //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
4327 // http://ui.jquery.com/bugs/ticket/3193
4328 var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
4329 this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
4330 this.element.attr(saveScroll);
4331 this._trigger('focus', event);
4332 },
4333
4334 open: function() {
4335 if (this._isOpen) { return; }
4336
4337 var options = this.options,
4338 uiDialog = this.uiDialog;
4339
4340 this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null;
4341 (uiDialog.next().length && uiDialog.appendTo('body'));
4342 this._size();
4343 this._position(options.position);
4344 uiDialog.show(options.show);
4345 this.moveToTop(true);
4346
4347 // prevent tabbing out of modal dialogs
4348 (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) {
4349 if (event.keyCode != $.ui.keyCode.TAB) {
4350 return;
4351 }
4352
4353 var tabbables = $(':tabbable', this),
4354 first = tabbables.filter(':first')[0],
4355 last = tabbables.filter(':last')[0];
4356
4357 if (event.target == last && !event.shiftKey) {
4358 setTimeout(function() {
4359 first.focus();
4360 }, 1);
4361 } else if (event.target == first && event.shiftKey) {
4362 setTimeout(function() {
4363 last.focus();
4364 }, 1);
4365 }
4366 }));
4367
4368 // set focus to the first tabbable element in the content area or the first button
4369 // if there are no tabbable elements, set focus on the dialog itself
4370 $([])
4371 .add(uiDialog.find('.ui-dialog-content :tabbable:first'))
4372 .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
4373 .add(uiDialog)
4374 .filter(':first')
4375 .focus();
4376
4377 this._trigger('open');
4378 this._isOpen = true;
4379 },
4380
4381 _createButtons: function(buttons) {
4382 var self = this,
4383 hasButtons = false,
4384 uiDialogButtonPane = $('<div></div>')
4385 .addClass(
4386 'ui-dialog-buttonpane ' +
4387 'ui-widget-content ' +
4388 'ui-helper-clearfix'
4389 );
4390
4391 // if we already have a button pane, remove it
4392 this.uiDialog.find('.ui-dialog-buttonpane').remove();
4393
4394 (typeof buttons == 'object' && buttons !== null &&
4395 $.each(buttons, function() { return !(hasButtons = true); }));
4396 if (hasButtons) {
4397 $.each(buttons, function(name, fn) {
4398 $('<button type="button"></button>')
4399 .addClass(
4400 'ui-state-default ' +
4401 'ui-corner-all'
4402 )
4403 .text(name)
4404 .click(function() { fn.apply(self.element[0], arguments); })
4405 .hover(
4406 function() {
4407 $(this).addClass('ui-state-hover');
4408 },
4409 function() {
4410 $(this).removeClass('ui-state-hover');
4411 }
4412 )
4413 .focus(function() {
4414 $(this).addClass('ui-state-focus');
4415 })
4416 .blur(function() {
4417 $(this).removeClass('ui-state-focus');
4418 })
4419 .appendTo(uiDialogButtonPane);
4420 });
4421 uiDialogButtonPane.appendTo(this.uiDialog);
4422 }
4423 },
4424
4425 _makeDraggable: function() {
4426 var self = this,
4427 options = this.options,
4428 heightBeforeDrag;
4429
4430 this.uiDialog.draggable({
4431 cancel: '.ui-dialog-content',
4432 handle: '.ui-dialog-titlebar',
4433 containment: 'document',
4434 start: function() {
4435 heightBeforeDrag = options.height;
4436 $(this).height($(this).height()).addClass("ui-dialog-dragging");
4437 (options.dragStart && options.dragStart.apply(self.element[0], arguments));
4438 },
4439 drag: function() {
4440 (options.drag && options.drag.apply(self.element[0], arguments));
4441 },
4442 stop: function() {
4443 $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
4444 (options.dragStop && options.dragStop.apply(self.element[0], arguments));
4445 $.ui.dialog.overlay.resize();
4446 }
4447 });
4448 },
4449
4450 _makeResizable: function(handles) {
4451 handles = (handles === undefined ? this.options.resizable : handles);
4452 var self = this,
4453 options = this.options,
4454 resizeHandles = typeof handles == 'string'
4455 ? handles
4456 : 'n,e,s,w,se,sw,ne,nw';
4457
4458 this.uiDialog.resizable({
4459 cancel: '.ui-dialog-content',
4460 alsoResize: this.element,
4461 maxWidth: options.maxWidth,
4462 maxHeight: options.maxHeight,
4463 minWidth: options.minWidth,
4464 minHeight: options.minHeight,
4465 start: function() {
4466 $(this).addClass("ui-dialog-resizing");
4467 (options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
4468 },
4469 resize: function() {
4470 (options.resize && options.resize.apply(self.element[0], arguments));
4471 },
4472 handles: resizeHandles,
4473 stop: function() {
4474 $(this).removeClass("ui-dialog-resizing");
4475 options.height = $(this).height();
4476 options.width = $(this).width();
4477 (options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
4478 $.ui.dialog.overlay.resize();
4479 }
4480 })
4481 .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
4482 },
4483
4484 _position: function(pos) {
4485 var wnd = $(window), doc = $(document),
4486 pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
4487 minTop = pTop;
4488
4489 if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
4490 pos = [
4491 pos == 'right' || pos == 'left' ? pos : 'center',
4492 pos == 'top' || pos == 'bottom' ? pos : 'middle'
4493 ];
4494 }
4495 if (pos.constructor != Array) {
4496 pos = ['center', 'middle'];
4497 }
4498 if (pos[0].constructor == Number) {
4499 pLeft += pos[0];
4500 } else {
4501 switch (pos[0]) {
4502 case 'left':
4503 pLeft += 0;
4504 break;
4505 case 'right':
4506 pLeft += wnd.width() - this.uiDialog.outerWidth();
4507 break;
4508 default:
4509 case 'center':
4510 pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
4511 }
4512 }
4513 if (pos[1].constructor == Number) {
4514 pTop += pos[1];
4515 } else {
4516 switch (pos[1]) {
4517 case 'top':
4518 pTop += 0;
4519 break;
4520 case 'bottom':
4521 pTop += wnd.height() - this.uiDialog.outerHeight();
4522 break;
4523 default:
4524 case 'middle':
4525 pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2;
4526 }
4527 }
4528
4529 // prevent the dialog from being too high (make sure the titlebar
4530 // is accessible)
4531 pTop = Math.max(pTop, minTop);
4532 this.uiDialog.css({top: pTop, left: pLeft});
4533 },
4534
4535 _setData: function(key, value){
4536 (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
4537 switch (key) {
4538 case "buttons":
4539 this._createButtons(value);
4540 break;
4541 case "closeText":
4542 this.uiDialogTitlebarCloseText.text(value);
4543 break;
4544 case "dialogClass":
4545 this.uiDialog
4546 .removeClass(this.options.dialogClass)
4547 .addClass(uiDialogClasses + value);
4548 break;
4549 case "draggable":
4550 (value
4551 ? this._makeDraggable()
4552 : this.uiDialog.draggable('destroy'));
4553 break;
4554 case "height":
4555 this.uiDialog.height(value);
4556 break;
4557 case "position":
4558 this._position(value);
4559 break;
4560 case "resizable":
4561 var uiDialog = this.uiDialog,
4562 isResizable = this.uiDialog.is(':data(resizable)');
4563
4564 // currently resizable, becoming non-resizable
4565 (isResizable && !value && uiDialog.resizable('destroy'));
4566
4567 // currently resizable, changing handles
4568 (isResizable && typeof value == 'string' &&
4569 uiDialog.resizable('option', 'handles', value));
4570
4571 // currently non-resizable, becoming resizable
4572 (isResizable || this._makeResizable(value));
4573 break;
4574 case "title":
4575 $(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
4576 break;
4577 case "width":
4578 this.uiDialog.width(value);
4579 break;
4580 }
4581
4582 $.widget.prototype._setData.apply(this, arguments);
4583 },
4584
4585 _size: function() {
4586 /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
4587 * divs will both have width and height set, so we need to reset them
4588 */
4589 var options = this.options;
4590
4591 // reset content sizing
4592 this.element.css({
4593 height: 0,
4594 minHeight: 0,
4595 width: 'auto'
4596 });
4597
4598 // reset wrapper sizing
4599 // determine the height of all the non-content elements
4600 var nonContentHeight = this.uiDialog.css({
4601 height: 'auto',
4602 width: options.width
4603 })
4604 .height();
4605
4606 this.element
4607 .css({
4608 minHeight: Math.max(options.minHeight - nonContentHeight, 0),
4609 height: options.height == 'auto'
4610 ? 'auto'
4611 : Math.max(options.height - nonContentHeight, 0)
4612 });
4613 }
4614});
4615
4616$.extend($.ui.dialog, {
4617 version: "1.7.2",
4618 defaults: {
4619 autoOpen: true,
4620 bgiframe: false,
4621 buttons: {},
4622 closeOnEscape: true,
4623 closeText: 'close',
4624 dialogClass: '',
4625 draggable: true,
4626 hide: null,
4627 height: 'auto',
4628 maxHeight: false,
4629 maxWidth: false,
4630 minHeight: 150,
4631 minWidth: 150,
4632 modal: false,
4633 position: 'center',
4634 resizable: true,
4635 show: null,
4636 stack: true,
4637 title: '',
4638 width: 300,
4639 zIndex: 1000
4640 },
4641
4642 getter: 'isOpen',
4643
4644 uuid: 0,
4645 maxZ: 0,
4646
4647 getTitleId: function($el) {
4648 return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
4649 },
4650
4651 overlay: function(dialog) {
4652 this.$el = $.ui.dialog.overlay.create(dialog);
4653 }
4654});
4655
4656$.extend($.ui.dialog.overlay, {
4657 instances: [],
4658 maxZ: 0,
4659 events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
4660 function(event) { return event + '.dialog-overlay'; }).join(' '),
4661 create: function(dialog) {
4662 if (this.instances.length === 0) {
4663 // prevent use of anchors and inputs
4664 // we use a setTimeout in case the overlay is created from an
4665 // event that we're going to be cancelling (see #2804)
4666 setTimeout(function() {
4667 // handle $(el).dialog().dialog('close') (see #4065)
4668 if ($.ui.dialog.overlay.instances.length) {
4669 $(document).bind($.ui.dialog.overlay.events, function(event) {
4670 var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0;
4671 return (dialogZ > $.ui.dialog.overlay.maxZ);
4672 });
4673 }
4674 }, 1);
4675
4676 // allow closing by pressing the escape key
4677 $(document).bind('keydown.dialog-overlay', function(event) {
4678 (dialog.options.closeOnEscape && event.keyCode
4679 && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
4680 });
4681
4682 // handle window resize
4683 $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
4684 }
4685
4686 var $el = $('<div></div>').appendTo(document.body)
4687 .addClass('ui-widget-overlay').css({
4688 width: this.width(),
4689 height: this.height()
4690 });
4691
4692 (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
4693
4694 this.instances.push($el);
4695 return $el;
4696 },
4697
4698 destroy: function($el) {
4699 this.instances.splice($.inArray(this.instances, $el), 1);
4700
4701 if (this.instances.length === 0) {
4702 $([document, window]).unbind('.dialog-overlay');
4703 }
4704
4705 $el.remove();
4706
4707 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
4708 var maxZ = 0;
4709 $.each(this.instances, function() {
4710 maxZ = Math.max(maxZ, this.css('z-index'));
4711 });
4712 this.maxZ = maxZ;
4713 },
4714
4715 height: function() {
4716 // handle IE 6
4717 if ($.browser.msie && $.browser.version < 7) {
4718 var scrollHeight = Math.max(
4719 document.documentElement.scrollHeight,
4720 document.body.scrollHeight
4721 );
4722 var offsetHeight = Math.max(
4723 document.documentElement.offsetHeight,
4724 document.body.offsetHeight
4725 );
4726
4727 if (scrollHeight < offsetHeight) {
4728 return $(window).height() + 'px';
4729 } else {
4730 return scrollHeight + 'px';
4731 }
4732 // handle "good" browsers
4733 } else {
4734 return $(document).height() + 'px';
4735 }
4736 },
4737
4738 width: function() {
4739 // handle IE 6
4740 if ($.browser.msie && $.browser.version < 7) {
4741 var scrollWidth = Math.max(
4742 document.documentElement.scrollWidth,
4743 document.body.scrollWidth
4744 );
4745 var offsetWidth = Math.max(
4746 document.documentElement.offsetWidth,
4747 document.body.offsetWidth
4748 );
4749
4750 if (scrollWidth < offsetWidth) {
4751 return $(window).width() + 'px';
4752 } else {
4753 return scrollWidth + 'px';
4754 }
4755 // handle "good" browsers
4756 } else {
4757 return $(document).width() + 'px';
4758 }
4759 },
4760
4761 resize: function() {
4762 /* If the dialog is draggable and the user drags it past the
4763 * right edge of the window, the document becomes wider so we
4764 * need to stretch the overlay. If the user then drags the
4765 * dialog back to the left, the document will become narrower,
4766 * so we need to shrink the overlay to the appropriate size.
4767 * This is handled by shrinking the overlay before setting it
4768 * to the full document size.
4769 */
4770 var $overlays = $([]);
4771 $.each($.ui.dialog.overlay.instances, function() {
4772 $overlays = $overlays.add(this);
4773 });
4774
4775 $overlays.css({
4776 width: 0,
4777 height: 0
4778 }).css({
4779 width: $.ui.dialog.overlay.width(),
4780 height: $.ui.dialog.overlay.height()
4781 });
4782 }
4783});
4784
4785$.extend($.ui.dialog.overlay.prototype, {
4786 destroy: function() {
4787 $.ui.dialog.overlay.destroy(this.$el);
4788 }
4789});
4790
4791})(jQuery);
4792/*
4793 * jQuery UI Slider 1.7.2
4794 *
4795 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4796 * Dual licensed under the MIT (MIT-LICENSE.txt)
4797 * and GPL (GPL-LICENSE.txt) licenses.
4798 *
4799 * http://docs.jquery.com/UI/Slider
4800 *
4801 * Depends:
4802 * ui.core.js
4803 */
4804
4805(function($) {
4806
4807$.widget("ui.slider", $.extend({}, $.ui.mouse, {
4808
4809 _init: function() {
4810
4811 var self = this, o = this.options;
4812 this._keySliding = false;
4813 this._handleIndex = null;
4814 this._detectOrientation();
4815 this._mouseInit();
4816
4817 this.element
4818 .addClass("ui-slider"
4819 + " ui-slider-" + this.orientation
4820 + " ui-widget"
4821 + " ui-widget-content"
4822 + " ui-corner-all");
4823
4824 this.range = $([]);
4825
4826 if (o.range) {
4827
4828 if (o.range === true) {
4829 this.range = $('<div></div>');
4830 if (!o.values) o.values = [this._valueMin(), this._valueMin()];
4831 if (o.values.length && o.values.length != 2) {
4832 o.values = [o.values[0], o.values[0]];
4833 }
4834 } else {
4835 this.range = $('<div></div>');
4836 }
4837
4838 this.range
4839 .appendTo(this.element)
4840 .addClass("ui-slider-range");
4841
4842 if (o.range == "min" || o.range == "max") {
4843 this.range.addClass("ui-slider-range-" + o.range);
4844 }
4845
4846 // note: this isn't the most fittingly semantic framework class for this element,
4847 // but worked best visually with a variety of themes
4848 this.range.addClass("ui-widget-header");
4849
4850 }
4851
4852 if ($(".ui-slider-handle", this.element).length == 0)
4853 $('<a href="#"></a>')
4854 .appendTo(this.element)
4855 .addClass("ui-slider-handle");
4856
4857 if (o.values && o.values.length) {
4858 while ($(".ui-slider-handle", this.element).length < o.values.length)
4859 $('<a href="#"></a>')
4860 .appendTo(this.element)
4861 .addClass("ui-slider-handle");
4862 }
4863
4864 this.handles = $(".ui-slider-handle", this.element)
4865 .addClass("ui-state-default"
4866 + " ui-corner-all");
4867
4868 this.handle = this.handles.eq(0);
4869
4870 this.handles.add(this.range).filter("a")
4871 .click(function(event) {
4872 event.preventDefault();
4873 })
4874 .hover(function() {
4875 if (!o.disabled) {
4876 $(this).addClass('ui-state-hover');
4877 }
4878 }, function() {
4879 $(this).removeClass('ui-state-hover');
4880 })
4881 .focus(function() {
4882 if (!o.disabled) {
4883 $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus');
4884 } else {
4885 $(this).blur();
4886 }
4887 })
4888 .blur(function() {
4889 $(this).removeClass('ui-state-focus');
4890 });
4891
4892 this.handles.each(function(i) {
4893 $(this).data("index.ui-slider-handle", i);
4894 });
4895
4896 this.handles.keydown(function(event) {
4897
4898 var ret = true;
4899
4900 var index = $(this).data("index.ui-slider-handle");
4901
4902 if (self.options.disabled)
4903 return;
4904
4905 switch (event.keyCode) {
4906 case $.ui.keyCode.HOME:
4907 case $.ui.keyCode.END:
4908 case $.ui.keyCode.UP:
4909 case $.ui.keyCode.RIGHT:
4910 case $.ui.keyCode.DOWN:
4911 case $.ui.keyCode.LEFT:
4912 ret = false;
4913 if (!self._keySliding) {
4914 self._keySliding = true;
4915 $(this).addClass("ui-state-active");
4916 self._start(event, index);
4917 }
4918 break;
4919 }
4920
4921 var curVal, newVal, step = self._step();
4922 if (self.options.values && self.options.values.length) {
4923 curVal = newVal = self.values(index);
4924 } else {
4925 curVal = newVal = self.value();
4926 }
4927
4928 switch (event.keyCode) {
4929 case $.ui.keyCode.HOME:
4930 newVal = self._valueMin();
4931 break;
4932 case $.ui.keyCode.END:
4933 newVal = self._valueMax();
4934 break;
4935 case $.ui.keyCode.UP:
4936 case $.ui.keyCode.RIGHT:
4937 if(curVal == self._valueMax()) return;
4938 newVal = curVal + step;
4939 break;
4940 case $.ui.keyCode.DOWN:
4941 case $.ui.keyCode.LEFT:
4942 if(curVal == self._valueMin()) return;
4943 newVal = curVal - step;
4944 break;
4945 }
4946
4947 self._slide(event, index, newVal);
4948
4949 return ret;
4950
4951 }).keyup(function(event) {
4952
4953 var index = $(this).data("index.ui-slider-handle");
4954
4955 if (self._keySliding) {
4956 self._stop(event, index);
4957 self._change(event, index);
4958 self._keySliding = false;
4959 $(this).removeClass("ui-state-active");
4960 }
4961
4962 });
4963
4964 this._refreshValue();
4965
4966 },
4967
4968 destroy: function() {
4969
4970 this.handles.remove();
4971 this.range.remove();
4972
4973 this.element
4974 .removeClass("ui-slider"
4975 + " ui-slider-horizontal"
4976 + " ui-slider-vertical"
4977 + " ui-slider-disabled"
4978 + " ui-widget"
4979 + " ui-widget-content"
4980 + " ui-corner-all")
4981 .removeData("slider")
4982 .unbind(".slider");
4983
4984 this._mouseDestroy();
4985
4986 },
4987
4988 _mouseCapture: function(event) {
4989
4990 var o = this.options;
4991
4992 if (o.disabled)
4993 return false;
4994
4995 this.elementSize = {
4996 width: this.element.outerWidth(),
4997 height: this.element.outerHeight()
4998 };
4999 this.elementOffset = this.element.offset();
5000
5001 var position = { x: event.pageX, y: event.pageY };
5002 var normValue = this._normValueFromMouse(position);
5003
5004 var distance = this._valueMax() - this._valueMin() + 1, closestHandle;
5005 var self = this, index;
5006 this.handles.each(function(i) {
5007 var thisDistance = Math.abs(normValue - self.values(i));
5008 if (distance > thisDistance) {
5009 distance = thisDistance;
5010 closestHandle = $(this);
5011 index = i;
5012 }
5013 });
5014
5015 // workaround for bug #3736 (if both handles of a range are at 0,
5016 // the first is always used as the one with least distance,
5017 // and moving it is obviously prevented by preventing negative ranges)
5018 if(o.range == true && this.values(1) == o.min) {
5019 closestHandle = $(this.handles[++index]);
5020 }
5021
5022 this._start(event, index);
5023
5024 self._handleIndex = index;
5025
5026 closestHandle
5027 .addClass("ui-state-active")
5028 .focus();
5029
5030 var offset = closestHandle.offset();
5031 var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle');
5032 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
5033 left: event.pageX - offset.left - (closestHandle.width() / 2),
5034 top: event.pageY - offset.top
5035 - (closestHandle.height() / 2)
5036 - (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
5037 - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
5038 + (parseInt(closestHandle.css('marginTop'),10) || 0)
5039 };
5040
5041 normValue = this._normValueFromMouse(position);
5042 this._slide(event, index, normValue);
5043 return true;
5044
5045 },
5046
5047 _mouseStart: function(event) {
5048 return true;
5049 },
5050
5051 _mouseDrag: function(event) {
5052
5053 var position = { x: event.pageX, y: event.pageY };
5054 var normValue = this._normValueFromMouse(position);
5055
5056 this._slide(event, this._handleIndex, normValue);
5057
5058 return false;
5059
5060 },
5061
5062 _mouseStop: function(event) {
5063
5064 this.handles.removeClass("ui-state-active");
5065 this._stop(event, this._handleIndex);
5066 this._change(event, this._handleIndex);
5067 this._handleIndex = null;
5068 this._clickOffset = null;
5069
5070 return false;
5071
5072 },
5073
5074 _detectOrientation: function() {
5075 this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
5076 },
5077
5078 _normValueFromMouse: function(position) {
5079
5080 var pixelTotal, pixelMouse;
5081 if ('horizontal' == this.orientation) {
5082 pixelTotal = this.elementSize.width;
5083 pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
5084 } else {
5085 pixelTotal = this.elementSize.height;
5086 pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
5087 }
5088
5089 var percentMouse = (pixelMouse / pixelTotal);
5090 if (percentMouse > 1) percentMouse = 1;
5091 if (percentMouse < 0) percentMouse = 0;
5092 if ('vertical' == this.orientation)
5093 percentMouse = 1 - percentMouse;
5094
5095 var valueTotal = this._valueMax() - this._valueMin(),
5096 valueMouse = percentMouse * valueTotal,
5097 valueMouseModStep = valueMouse % this.options.step,
5098 normValue = this._valueMin() + valueMouse - valueMouseModStep;
5099
5100 if (valueMouseModStep > (this.options.step / 2))
5101 normValue += this.options.step;
5102
5103 // Since JavaScript has problems with large floats, round
5104 // the final value to 5 digits after the decimal point (see #4124)
5105 return parseFloat(normValue.toFixed(5));
5106
5107 },
5108
5109 _start: function(event, index) {
5110 var uiHash = {
5111 handle: this.handles[index],
5112 value: this.value()
5113 };
5114 if (this.options.values && this.options.values.length) {
5115 uiHash.value = this.values(index);
5116 uiHash.values = this.values();
5117 }
5118 this._trigger("start", event, uiHash);
5119 },
5120
5121 _slide: function(event, index, newVal) {
5122
5123 var handle = this.handles[index];
5124
5125 if (this.options.values && this.options.values.length) {
5126
5127 var otherVal = this.values(index ? 0 : 1);
5128
5129 if ((this.options.values.length == 2 && this.options.range === true) &&
5130 ((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))){
5131 newVal = otherVal;
5132 }
5133
5134 if (newVal != this.values(index)) {
5135 var newValues = this.values();
5136 newValues[index] = newVal;
5137 // A slide can be canceled by returning false from the slide callback
5138 var allowed = this._trigger("slide", event, {
5139 handle: this.handles[index],
5140 value: newVal,
5141 values: newValues
5142 });
5143 var otherVal = this.values(index ? 0 : 1);
5144 if (allowed !== false) {
5145 this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
5146 }
5147 }
5148
5149 } else {
5150
5151 if (newVal != this.value()) {
5152 // A slide can be canceled by returning false from the slide callback
5153 var allowed = this._trigger("slide", event, {
5154 handle: this.handles[index],
5155 value: newVal
5156 });
5157 if (allowed !== false) {
5158 this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
5159 }
5160
5161 }
5162
5163 }
5164
5165 },
5166
5167 _stop: function(event, index) {
5168 var uiHash = {
5169 handle: this.handles[index],
5170 value: this.value()
5171 };
5172 if (this.options.values && this.options.values.length) {
5173 uiHash.value = this.values(index);
5174 uiHash.values = this.values();
5175 }
5176 this._trigger("stop", event, uiHash);
5177 },
5178
5179 _change: function(event, index) {
5180 var uiHash = {
5181 handle: this.handles[index],
5182 value: this.value()
5183 };
5184 if (this.options.values && this.options.values.length) {
5185 uiHash.value = this.values(index);
5186 uiHash.values = this.values();
5187 }
5188 this._trigger("change", event, uiHash);
5189 },
5190
5191 value: function(newValue) {
5192
5193 if (arguments.length) {
5194 this._setData("value", newValue);
5195 this._change(null, 0);
5196 }
5197
5198 return this._value();
5199
5200 },
5201
5202 values: function(index, newValue, animated, noPropagation) {
5203
5204 if (arguments.length > 1) {
5205 this.options.values[index] = newValue;
5206 this._refreshValue(animated);
5207 if(!noPropagation) this._change(null, index);
5208 }
5209
5210 if (arguments.length) {
5211 if (this.options.values && this.options.values.length) {
5212 return this._values(index);
5213 } else {
5214 return this.value();
5215 }
5216 } else {
5217 return this._values();
5218 }
5219
5220 },
5221
5222 _setData: function(key, value, animated) {
5223
5224 $.widget.prototype._setData.apply(this, arguments);
5225
5226 switch (key) {
5227 case 'disabled':
5228 if (value) {
5229 this.handles.filter(".ui-state-focus").blur();
5230 this.handles.removeClass("ui-state-hover");
5231 this.handles.attr("disabled", "disabled");
5232 } else {
5233 this.handles.removeAttr("disabled");
5234 }
5235 case 'orientation':
5236
5237 this._detectOrientation();
5238
5239 this.element
5240 .removeClass("ui-slider-horizontal ui-slider-vertical")
5241 .addClass("ui-slider-" + this.orientation);
5242 this._refreshValue(animated);
5243 break;
5244 case 'value':
5245 this._refreshValue(animated);
5246 break;
5247 }
5248
5249 },
5250
5251 _step: function() {
5252 var step = this.options.step;
5253 return step;
5254 },
5255
5256 _value: function() {
5257
5258 var val = this.options.value;
5259 if (val < this._valueMin()) val = this._valueMin();
5260 if (val > this._valueMax()) val = this._valueMax();
5261
5262 return val;
5263
5264 },
5265
5266 _values: function(index) {
5267
5268 if (arguments.length) {
5269 var val = this.options.values[index];
5270 if (val < this._valueMin()) val = this._valueMin();
5271 if (val > this._valueMax()) val = this._valueMax();
5272
5273 return val;
5274 } else {
5275 return this.options.values;
5276 }
5277
5278 },
5279
5280 _valueMin: function() {
5281 var valueMin = this.options.min;
5282 return valueMin;
5283 },
5284
5285 _valueMax: function() {
5286 var valueMax = this.options.max;
5287 return valueMax;
5288 },
5289
5290 _refreshValue: function(animate) {
5291
5292 var oRange = this.options.range, o = this.options, self = this;
5293
5294 if (this.options.values && this.options.values.length) {
5295 var vp0, vp1;
5296 this.handles.each(function(i, j) {
5297 var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
5298 var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
5299 $(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
5300 if (self.options.range === true) {
5301 if (self.orientation == 'horizontal') {
5302 (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
5303 (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
5304 } else {
5305 (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
5306 (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
5307 }
5308 }
5309 lastValPercent = valPercent;
5310 });
5311 } else {
5312 var value = this.value(),
5313 valueMin = this._valueMin(),
5314 valueMax = this._valueMax(),
5315 valPercent = valueMax != valueMin
5316 ? (value - valueMin) / (valueMax - valueMin) * 100
5317 : 0;
5318 var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
5319 this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
5320
5321 (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
5322 (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
5323 (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
5324 (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
5325 }
5326
5327 }
5328
5329}));
5330
5331$.extend($.ui.slider, {
5332 getter: "value values",
5333 version: "1.7.2",
5334 eventPrefix: "slide",
5335 defaults: {
5336 animate: false,
5337 delay: 0,
5338 distance: 0,
5339 max: 100,
5340 min: 0,
5341 orientation: 'horizontal',
5342 range: false,
5343 step: 1,
5344 value: 0,
5345 values: null
5346 }
5347});
5348
5349})(jQuery);
5350/*
5351 * jQuery UI Tabs 1.7.2
5352 *
5353 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5354 * Dual licensed under the MIT (MIT-LICENSE.txt)
5355 * and GPL (GPL-LICENSE.txt) licenses.
5356 *
5357 * http://docs.jquery.com/UI/Tabs
5358 *
5359 * Depends:
5360 * ui.core.js
5361 */
5362(function($) {
5363
5364$.widget("ui.tabs", {
5365
5366 _init: function() {
5367 if (this.options.deselectable !== undefined) {
5368 this.options.collapsible = this.options.deselectable;
5369 }
5370 this._tabify(true);
5371 },
5372
5373 _setData: function(key, value) {
5374 if (key == 'selected') {
5375 if (this.options.collapsible && value == this.options.selected) {
5376 return;
5377 }
5378 this.select(value);
5379 }
5380 else {
5381 this.options[key] = value;
5382 if (key == 'deselectable') {
5383 this.options.collapsible = value;
5384 }
5385 this._tabify();
5386 }
5387 },
5388
5389 _tabId: function(a) {
5390 return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
5391 this.options.idPrefix + $.data(a);
5392 },
5393
5394 _sanitizeSelector: function(hash) {
5395 return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
5396 },
5397
5398 _cookie: function() {
5399 var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0]));
5400 return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
5401 },
5402
5403 _ui: function(tab, panel) {
5404 return {
5405 tab: tab,
5406 panel: panel,
5407 index: this.anchors.index(tab)
5408 };
5409 },
5410
5411 _cleanup: function() {
5412 // restore all former loading tabs labels
5413 this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
5414 .find('span:data(label.tabs)')
5415 .each(function() {
5416 var el = $(this);
5417 el.html(el.data('label.tabs')).removeData('label.tabs');
5418 });
5419 },
5420
5421 _tabify: function(init) {
5422
5423 this.list = this.element.children('ul:first');
5424 this.lis = $('li:has(a[href])', this.list);
5425 this.anchors = this.lis.map(function() { return $('a', this)[0]; });
5426 this.panels = $([]);
5427
5428 var self = this, o = this.options;
5429
5430 var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
5431 this.anchors.each(function(i, a) {
5432 var href = $(a).attr('href');
5433
5434 // For dynamically created HTML that contains a hash as href IE < 8 expands
5435 // such href to the full page url with hash and then misinterprets tab as ajax.
5436 // Same consideration applies for an added tab with a fragment identifier
5437 // since a[href=#fragment-identifier] does unexpectedly not match.
5438 // Thus normalize href attribute...
5439 var hrefBase = href.split('#')[0], baseEl;
5440 if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
5441 (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
5442 href = a.hash;
5443 a.href = href;
5444 }
5445
5446 // inline tab
5447 if (fragmentId.test(href)) {
5448 self.panels = self.panels.add(self._sanitizeSelector(href));
5449 }
5450
5451 // remote tab
5452 else if (href != '#') { // prevent loading the page itself if href is just "#"
5453 $.data(a, 'href.tabs', href); // required for restore on destroy
5454
5455 // TODO until #3808 is fixed strip fragment identifier from url
5456 // (IE fails to load from such url)
5457 $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
5458
5459 var id = self._tabId(a);
5460 a.href = '#' + id;
5461 var $panel = $('#' + id);
5462 if (!$panel.length) {
5463 $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
5464 .insertAfter(self.panels[i - 1] || self.list);
5465 $panel.data('destroy.tabs', true);
5466 }
5467 self.panels = self.panels.add($panel);
5468 }
5469
5470 // invalid tab href
5471 else {
5472 o.disabled.push(i);
5473 }
5474 });
5475
5476 // initialization from scratch
5477 if (init) {
5478
5479 // attach necessary classes for styling
5480 this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
5481 this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
5482 this.lis.addClass('ui-state-default ui-corner-top');
5483 this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');
5484
5485 // Selected tab
5486 // use "selected" option or try to retrieve:
5487 // 1. from fragment identifier in url
5488 // 2. from cookie
5489 // 3. from selected class attribute on <li>
5490 if (o.selected === undefined) {
5491 if (location.hash) {
5492 this.anchors.each(function(i, a) {
5493 if (a.hash == location.hash) {
5494 o.selected = i;
5495 return false; // break
5496 }
5497 });
5498 }
5499 if (typeof o.selected != 'number' && o.cookie) {
5500 o.selected = parseInt(self._cookie(), 10);
5501 }
5502 if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
5503 o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
5504 }
5505 o.selected = o.selected || 0;
5506 }
5507 else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
5508 o.selected = -1;
5509 }
5510
5511 // sanity check - default to first tab...
5512 o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;
5513
5514 // Take disabling tabs via class attribute from HTML
5515 // into account and update option properly.
5516 // A selected tab cannot become disabled.
5517 o.disabled = $.unique(o.disabled.concat(
5518 $.map(this.lis.filter('.ui-state-disabled'),
5519 function(n, i) { return self.lis.index(n); } )
5520 )).sort();
5521
5522 if ($.inArray(o.selected, o.disabled) != -1) {
5523 o.disabled.splice($.inArray(o.selected, o.disabled), 1);
5524 }
5525
5526 // highlight selected tab
5527 this.panels.addClass('ui-tabs-hide');
5528 this.lis.removeClass('ui-tabs-selected ui-state-active');
5529 if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
5530 this.panels.eq(o.selected).removeClass('ui-tabs-hide');
5531 this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
5532
5533 // seems to be expected behavior that the show callback is fired
5534 self.element.queue("tabs", function() {
5535 self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
5536 });
5537
5538 this.load(o.selected);
5539 }
5540
5541 // clean up to avoid memory leaks in certain versions of IE 6
5542 $(window).bind('unload', function() {
5543 self.lis.add(self.anchors).unbind('.tabs');
5544 self.lis = self.anchors = self.panels = null;
5545 });
5546
5547 }
5548 // update selected after add/remove
5549 else {
5550 o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
5551 }
5552
5553 // update collapsible
5554 this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
5555
5556 // set or update cookie after init and add/remove respectively
5557 if (o.cookie) {
5558 this._cookie(o.selected, o.cookie);
5559 }
5560
5561 // disable tabs
5562 for (var i = 0, li; (li = this.lis[i]); i++) {
5563 $(li)[$.inArray(i, o.disabled) != -1 &&
5564 !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
5565 }
5566
5567 // reset cache if switching from cached to not cached
5568 if (o.cache === false) {
5569 this.anchors.removeData('cache.tabs');
5570 }
5571
5572 // remove all handlers before, tabify may run on existing tabs after add or option change
5573 this.lis.add(this.anchors).unbind('.tabs');
5574
5575 if (o.event != 'mouseover') {
5576 var addState = function(state, el) {
5577 if (el.is(':not(.ui-state-disabled)')) {
5578 el.addClass('ui-state-' + state);
5579 }
5580 };
5581 var removeState = function(state, el) {
5582 el.removeClass('ui-state-' + state);
5583 };
5584 this.lis.bind('mouseover.tabs', function() {
5585 addState('hover', $(this));
5586 });
5587 this.lis.bind('mouseout.tabs', function() {
5588 removeState('hover', $(this));
5589 });
5590 this.anchors.bind('focus.tabs', function() {
5591 addState('focus', $(this).closest('li'));
5592 });
5593 this.anchors.bind('blur.tabs', function() {
5594 removeState('focus', $(this).closest('li'));
5595 });
5596 }
5597
5598 // set up animations
5599 var hideFx, showFx;
5600 if (o.fx) {
5601 if ($.isArray(o.fx)) {
5602 hideFx = o.fx[0];
5603 showFx = o.fx[1];
5604 }
5605 else {
5606 hideFx = showFx = o.fx;
5607 }
5608 }
5609
5610 // Reset certain styles left over from animation
5611 // and prevent IE's ClearType bug...
5612 function resetStyle($el, fx) {
5613 $el.css({ display: '' });
5614 if ($.browser.msie && fx.opacity) {
5615 $el[0].style.removeAttribute('filter');
5616 }
5617 }
5618
5619 // Show a tab...
5620 var showTab = showFx ?
5621 function(clicked, $show) {
5622 $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
5623 $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
5624 .animate(showFx, showFx.duration || 'normal', function() {
5625 resetStyle($show, showFx);
5626 self._trigger('show', null, self._ui(clicked, $show[0]));
5627 });
5628 } :
5629 function(clicked, $show) {
5630 $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
5631 $show.removeClass('ui-tabs-hide');
5632 self._trigger('show', null, self._ui(clicked, $show[0]));
5633 };
5634
5635 // Hide a tab, $show is optional...
5636 var hideTab = hideFx ?
5637 function(clicked, $hide) {
5638 $hide.animate(hideFx, hideFx.duration || 'normal', function() {
5639 self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
5640 $hide.addClass('ui-tabs-hide');
5641 resetStyle($hide, hideFx);
5642 self.element.dequeue("tabs");
5643 });
5644 } :
5645 function(clicked, $hide, $show) {
5646 self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
5647 $hide.addClass('ui-tabs-hide');
5648 self.element.dequeue("tabs");
5649 };
5650
5651 // attach tab event handler, unbind to avoid duplicates from former tabifying...
5652 this.anchors.bind(o.event + '.tabs', function() {
5653 var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
5654 $show = $(self._sanitizeSelector(this.hash));
5655
5656 // If tab is already selected and not collapsible or tab disabled or
5657 // or is already loading or click callback returns false stop here.
5658 // Check if click handler returns false last so that it is not executed
5659 // for a disabled or loading tab!
5660 if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
5661 $li.hasClass('ui-state-disabled') ||
5662 $li.hasClass('ui-state-processing') ||
5663 self._trigger('select', null, self._ui(this, $show[0])) === false) {
5664 this.blur();
5665 return false;
5666 }
5667
5668 o.selected = self.anchors.index(this);
5669
5670 self.abort();
5671
5672 // if tab may be closed
5673 if (o.collapsible) {
5674 if ($li.hasClass('ui-tabs-selected')) {
5675 o.selected = -1;
5676
5677 if (o.cookie) {
5678 self._cookie(o.selected, o.cookie);
5679 }
5680
5681 self.element.queue("tabs", function() {
5682 hideTab(el, $hide);
5683 }).dequeue("tabs");
5684
5685 this.blur();
5686 return false;
5687 }
5688 else if (!$hide.length) {
5689 if (o.cookie) {
5690 self._cookie(o.selected, o.cookie);
5691 }
5692
5693 self.element.queue("tabs", function() {
5694 showTab(el, $show);
5695 });
5696
5697 self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
5698
5699 this.blur();
5700 return false;
5701 }
5702 }
5703
5704 if (o.cookie) {
5705 self._cookie(o.selected, o.cookie);
5706 }
5707
5708 // show new tab
5709 if ($show.length) {
5710 if ($hide.length) {
5711 self.element.queue("tabs", function() {
5712 hideTab(el, $hide);
5713 });
5714 }
5715 self.element.queue("tabs", function() {
5716 showTab(el, $show);
5717 });
5718
5719 self.load(self.anchors.index(this));
5720 }
5721 else {
5722 throw 'jQuery UI Tabs: Mismatching fragment identifier.';
5723 }
5724
5725 // Prevent IE from keeping other link focussed when using the back button
5726 // and remove dotted border from clicked link. This is controlled via CSS
5727 // in modern browsers; blur() removes focus from address bar in Firefox
5728 // which can become a usability and annoying problem with tabs('rotate').
5729 if ($.browser.msie) {
5730 this.blur();
5731 }
5732
5733 });
5734
5735 // disable click in any case
5736 this.anchors.bind('click.tabs', function(){return false;});
5737
5738 },
5739
5740 destroy: function() {
5741 var o = this.options;
5742
5743 this.abort();
5744
5745 this.element.unbind('.tabs')
5746 .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
5747 .removeData('tabs');
5748
5749 this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
5750
5751 this.anchors.each(function() {
5752 var href = $.data(this, 'href.tabs');
5753 if (href) {
5754 this.href = href;
5755 }
5756 var $this = $(this).unbind('.tabs');
5757 $.each(['href', 'load', 'cache'], function(i, prefix) {
5758 $this.removeData(prefix + '.tabs');
5759 });
5760 });
5761
5762 this.lis.unbind('.tabs').add(this.panels).each(function() {
5763 if ($.data(this, 'destroy.tabs')) {
5764 $(this).remove();
5765 }
5766 else {
5767 $(this).removeClass([
5768 'ui-state-default',
5769 'ui-corner-top',
5770 'ui-tabs-selected',
5771 'ui-state-active',
5772 'ui-state-hover',
5773 'ui-state-focus',
5774 'ui-state-disabled',
5775 'ui-tabs-panel',
5776 'ui-widget-content',
5777 'ui-corner-bottom',
5778 'ui-tabs-hide'
5779 ].join(' '));
5780 }
5781 });
5782
5783 if (o.cookie) {
5784 this._cookie(null, o.cookie);
5785 }
5786 },
5787
5788 add: function(url, label, index) {
5789 if (index === undefined) {
5790 index = this.anchors.length; // append by default
5791 }
5792
5793 var self = this, o = this.options,
5794 $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
5795 id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);
5796
5797 $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);
5798
5799 // try to find an existing element before creating a new one
5800 var $panel = $('#' + id);
5801 if (!$panel.length) {
5802 $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
5803 }
5804 $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');
5805
5806 if (index >= this.lis.length) {
5807 $li.appendTo(this.list);
5808 $panel.appendTo(this.list[0].parentNode);
5809 }
5810 else {
5811 $li.insertBefore(this.lis[index]);
5812 $panel.insertBefore(this.panels[index]);
5813 }
5814
5815 o.disabled = $.map(o.disabled,
5816 function(n, i) { return n >= index ? ++n : n; });
5817
5818 this._tabify();
5819
5820 if (this.anchors.length == 1) { // after tabify
5821 $li.addClass('ui-tabs-selected ui-state-active');
5822 $panel.removeClass('ui-tabs-hide');
5823 this.element.queue("tabs", function() {
5824 self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
5825 });
5826
5827 this.load(0);
5828 }
5829
5830 // callback
5831 this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
5832 },
5833
5834 remove: function(index) {
5835 var o = this.options, $li = this.lis.eq(index).remove(),
5836 $panel = this.panels.eq(index).remove();
5837
5838 // If selected tab was removed focus tab to the right or
5839 // in case the last tab was removed the tab to the left.
5840 if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
5841 this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
5842 }
5843
5844 o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
5845 function(n, i) { return n >= index ? --n : n; });
5846
5847 this._tabify();
5848
5849 // callback
5850 this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
5851 },
5852
5853 enable: function(index) {
5854 var o = this.options;
5855 if ($.inArray(index, o.disabled) == -1) {
5856 return;
5857 }
5858
5859 this.lis.eq(index).removeClass('ui-state-disabled');
5860 o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
5861
5862 // callback
5863 this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
5864 },
5865
5866 disable: function(index) {
5867 var self = this, o = this.options;
5868 if (index != o.selected) { // cannot disable already selected tab
5869 this.lis.eq(index).addClass('ui-state-disabled');
5870
5871 o.disabled.push(index);
5872 o.disabled.sort();
5873
5874 // callback
5875 this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
5876 }
5877 },
5878
5879 select: function(index) {
5880 if (typeof index == 'string') {
5881 index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
5882 }
5883 else if (index === null) { // usage of null is deprecated, TODO remove in next release
5884 index = -1;
5885 }
5886 if (index == -1 && this.options.collapsible) {
5887 index = this.options.selected;
5888 }
5889
5890 this.anchors.eq(index).trigger(this.options.event + '.tabs');
5891 },
5892
5893 load: function(index) {
5894 var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
5895
5896 this.abort();
5897
5898 // not remote or from cache
5899 if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
5900 this.element.dequeue("tabs");
5901 return;
5902 }
5903
5904 // load remote from here on
5905 this.lis.eq(index).addClass('ui-state-processing');
5906
5907 if (o.spinner) {
5908 var span = $('span', a);
5909 span.data('label.tabs', span.html()).html(o.spinner);
5910 }
5911
5912 this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
5913 url: url,
5914 success: function(r, s) {
5915 $(self._sanitizeSelector(a.hash)).html(r);
5916
5917 // take care of tab labels
5918 self._cleanup();
5919
5920 if (o.cache) {
5921 $.data(a, 'cache.tabs', true); // if loaded once do not load them again
5922 }
5923
5924 // callbacks
5925 self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
5926 try {
5927 o.ajaxOptions.success(r, s);
5928 }
5929 catch (e) {}
5930
5931 // last, so that load event is fired before show...
5932 self.element.dequeue("tabs");
5933 }
5934 }));
5935 },
5936
5937 abort: function() {
5938 // stop possibly running animations
5939 this.element.queue([]);
5940 this.panels.stop(false, true);
5941
5942 // terminate pending requests from other tabs
5943 if (this.xhr) {
5944 this.xhr.abort();
5945 delete this.xhr;
5946 }
5947
5948 // take care of tab labels
5949 this._cleanup();
5950
5951 },
5952
5953 url: function(index, url) {
5954 this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
5955 },
5956
5957 length: function() {
5958 return this.anchors.length;
5959 }
5960
5961});
5962
5963$.extend($.ui.tabs, {
5964 version: '1.7.2',
5965 getter: 'length',
5966 defaults: {
5967 ajaxOptions: null,
5968 cache: false,
5969 cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
5970 collapsible: false,
5971 disabled: [],
5972 event: 'click',
5973 fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
5974 idPrefix: 'ui-tabs-',
5975 panelTemplate: '<div></div>',
5976 spinner: '<em>Loading&#8230;</em>',
5977 tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
5978 }
5979});
5980
5981/*
5982 * Tabs Extensions
5983 */
5984
5985/*
5986 * Rotate
5987 */
5988$.extend($.ui.tabs.prototype, {
5989 rotation: null,
5990 rotate: function(ms, continuing) {
5991
5992 var self = this, o = this.options;
5993
5994 var rotate = self._rotate || (self._rotate = function(e) {
5995 clearTimeout(self.rotation);
5996 self.rotation = setTimeout(function() {
5997 var t = o.selected;
5998 self.select( ++t < self.anchors.length ? t : 0 );
5999 }, ms);
6000
6001 if (e) {
6002 e.stopPropagation();
6003 }
6004 });
6005
6006 var stop = self._unrotate || (self._unrotate = !continuing ?
6007 function(e) {
6008 if (e.clientX) { // in case of a true click
6009 self.rotate(null);
6010 }
6011 } :
6012 function(e) {
6013 t = o.selected;
6014 rotate();
6015 });
6016
6017 // start rotation
6018 if (ms) {
6019 this.element.bind('tabsshow', rotate);
6020 this.anchors.bind(o.event + '.tabs', stop);
6021 rotate();
6022 }
6023 // stop rotation
6024 else {
6025 clearTimeout(self.rotation);
6026 this.element.unbind('tabsshow', rotate);
6027 this.anchors.unbind(o.event + '.tabs', stop);
6028 delete this._rotate;
6029 delete this._unrotate;
6030 }
6031 }
6032});
6033
6034})(jQuery);
6035/*
6036 * jQuery UI Datepicker 1.7.2
6037 *
6038 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
6039 * Dual licensed under the MIT (MIT-LICENSE.txt)
6040 * and GPL (GPL-LICENSE.txt) licenses.
6041 *
6042 * http://docs.jquery.com/UI/Datepicker
6043 *
6044 * Depends:
6045 * ui.core.js
6046 */
6047
6048(function($) { // hide the namespace
6049
6050$.extend($.ui, { datepicker: { version: "1.7.2" } });
6051
6052var PROP_NAME = 'datepicker';
6053
6054/* Date picker manager.
6055 Use the singleton instance of this class, $.datepicker, to interact with the date picker.
6056 Settings for (groups of) date pickers are maintained in an instance object,
6057 allowing multiple different settings on the same page. */
6058
6059function Datepicker() {
6060 this.debug = false; // Change this to true to start debugging
6061 this._curInst = null; // The current instance in use
6062 this._keyEvent = false; // If the last event was a key event
6063 this._disabledInputs = []; // List of date picker inputs that have been disabled
6064 this._datepickerShowing = false; // True if the popup picker is showing , false if not
6065 this._inDialog = false; // True if showing within a "dialog", false if not
6066 this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
6067 this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
6068 this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
6069 this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
6070 this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
6071 this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
6072 this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
6073 this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
6074 this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
6075 this.regional = []; // Available regional settings, indexed by language code
6076 this.regional[''] = { // Default regional settings
6077 closeText: 'Done', // Display text for close link
6078 prevText: 'Prev', // Display text for previous month link
6079 nextText: 'Next', // Display text for next month link
6080 currentText: 'Today', // Display text for current month link
6081 monthNames: ['January','February','March','April','May','June',
6082 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
6083 monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
6084 dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
6085 dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
6086 dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
6087 dateFormat: 'mm/dd/yy', // See format options on parseDate
6088 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
6089 isRTL: false // True if right-to-left language, false if left-to-right
6090 };
6091 this._defaults = { // Global defaults for all the date picker instances
6092 showOn: 'focus', // 'focus' for popup on focus,
6093 // 'button' for trigger button, or 'both' for either
6094 showAnim: 'show', // Name of jQuery animation for popup
6095 showOptions: {}, // Options for enhanced animations
6096 defaultDate: null, // Used when field is blank: actual date,
6097 // +/-number for offset from today, null for today
6098 appendText: '', // Display text following the input box, e.g. showing the format
6099 buttonText: '...', // Text for trigger button
6100 buttonImage: '', // URL for trigger button image
6101 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
6102 hideIfNoPrevNext: false, // True to hide next/previous month links
6103 // if not applicable, false to just disable them
6104 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
6105 gotoCurrent: false, // True if today link goes back to current selection instead
6106 changeMonth: false, // True if month can be selected directly, false if only prev/next
6107 changeYear: false, // True if year can be selected directly, false if only prev/next
6108 showMonthAfterYear: false, // True if the year select precedes month, false for month then year
6109 yearRange: '-10:+10', // Range of years to display in drop-down,
6110 // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
6111 showOtherMonths: false, // True to show dates in other months, false to leave blank
6112 calculateWeek: this.iso8601Week, // How to calculate the week of the year,
6113 // takes a Date and returns the number of the week for it
6114 shortYearCutoff: '+10', // Short year values < this are in the current century,
6115 // > this are in the previous century,
6116 // string value starting with '+' for current year + value
6117 minDate: null, // The earliest selectable date, or null for no limit
6118 maxDate: null, // The latest selectable date, or null for no limit
6119 duration: 'normal', // Duration of display/closure
6120 beforeShowDay: null, // Function that takes a date and returns an array with
6121 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
6122 // [2] = cell title (optional), e.g. $.datepicker.noWeekends
6123 beforeShow: null, // Function that takes an input field and
6124 // returns a set of custom settings for the date picker
6125 onSelect: null, // Define a callback function when a date is selected
6126 onChangeMonthYear: null, // Define a callback function when the month or year is changed
6127 onClose: null, // Define a callback function when the datepicker is closed
6128 numberOfMonths: 1, // Number of months to show at a time
6129 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
6130 stepMonths: 1, // Number of months to step back/forward
6131 stepBigMonths: 12, // Number of months to step back/forward for the big links
6132 altField: '', // Selector for an alternate field to store selected dates into
6133 altFormat: '', // The date format to use for the alternate field
6134 constrainInput: true, // The input is constrained by the current date format
6135 showButtonPanel: false // True to show button panel, false to not show it
6136 };
6137 $.extend(this._defaults, this.regional['']);
6138 this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
6139}
6140
6141$.extend(Datepicker.prototype, {
6142 /* Class name added to elements to indicate already configured with a date picker. */
6143 markerClassName: 'hasDatepicker',
6144
6145 /* Debug logging (if enabled). */
6146 log: function () {
6147 if (this.debug)
6148 console.log.apply('', arguments);
6149 },
6150
6151 /* Override the default settings for all instances of the date picker.
6152 @param settings object - the new settings to use as defaults (anonymous object)
6153 @return the manager object */
6154 setDefaults: function(settings) {
6155 extendRemove(this._defaults, settings || {});
6156 return this;
6157 },
6158
6159 /* Attach the date picker to a jQuery selection.
6160 @param target element - the target input field or division or span
6161 @param settings object - the new settings to use for this date picker instance (anonymous) */
6162 _attachDatepicker: function(target, settings) {
6163 // check for settings on the control itself - in namespace 'date:'
6164 var inlineSettings = null;
6165 for (var attrName in this._defaults) {
6166 var attrValue = target.getAttribute('date:' + attrName);
6167 if (attrValue) {
6168 inlineSettings = inlineSettings || {};
6169 try {
6170 inlineSettings[attrName] = eval(attrValue);
6171 } catch (err) {
6172 inlineSettings[attrName] = attrValue;
6173 }
6174 }
6175 }
6176 var nodeName = target.nodeName.toLowerCase();
6177 var inline = (nodeName == 'div' || nodeName == 'span');
6178 if (!target.id)
6179 target.id = 'dp' + (++this.uuid);
6180 var inst = this._newInst($(target), inline);
6181 inst.settings = $.extend({}, settings || {}, inlineSettings || {});
6182 if (nodeName == 'input') {
6183 this._connectDatepicker(target, inst);
6184 } else if (inline) {
6185 this._inlineDatepicker(target, inst);
6186 }
6187 },
6188
6189 /* Create a new instance object. */
6190 _newInst: function(target, inline) {
6191 var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
6192 return {id: id, input: target, // associated target
6193 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
6194 drawMonth: 0, drawYear: 0, // month being drawn
6195 inline: inline, // is datepicker inline or not
6196 dpDiv: (!inline ? this.dpDiv : // presentation div
6197 $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
6198 },
6199
6200 /* Attach the date picker to an input field. */
6201 _connectDatepicker: function(target, inst) {
6202 var input = $(target);
6203 inst.append = $([]);
6204 inst.trigger = $([]);
6205 if (input.hasClass(this.markerClassName))
6206 return;
6207 var appendText = this._get(inst, 'appendText');
6208 var isRTL = this._get(inst, 'isRTL');
6209 if (appendText) {
6210 inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
6211 input[isRTL ? 'before' : 'after'](inst.append);
6212 }
6213 var showOn = this._get(inst, 'showOn');
6214 if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
6215 input.focus(this._showDatepicker);
6216 if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
6217 var buttonText = this._get(inst, 'buttonText');
6218 var buttonImage = this._get(inst, 'buttonImage');
6219 inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
6220 $('<img/>').addClass(this._triggerClass).
6221 attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
6222 $('<button type="button"></button>').addClass(this._triggerClass).
6223 html(buttonImage == '' ? buttonText : $('<img/>').attr(
6224 { src:buttonImage, alt:buttonText, title:buttonText })));
6225 input[isRTL ? 'before' : 'after'](inst.trigger);
6226 inst.trigger.click(function() {
6227 if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
6228 $.datepicker._hideDatepicker();
6229 else
6230 $.datepicker._showDatepicker(target);
6231 return false;
6232 });
6233 }
6234 input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
6235 bind("setData.datepicker", function(event, key, value) {
6236 inst.settings[key] = value;
6237 }).bind("getData.datepicker", function(event, key) {
6238 return this._get(inst, key);
6239 });
6240 $.data(target, PROP_NAME, inst);
6241 },
6242
6243 /* Attach an inline date picker to a div. */
6244 _inlineDatepicker: function(target, inst) {
6245 var divSpan = $(target);
6246 if (divSpan.hasClass(this.markerClassName))
6247 return;
6248 divSpan.addClass(this.markerClassName).append(inst.dpDiv).
6249 bind("setData.datepicker", function(event, key, value){
6250 inst.settings[key] = value;
6251 }).bind("getData.datepicker", function(event, key){
6252 return this._get(inst, key);
6253 });
6254 $.data(target, PROP_NAME, inst);
6255 this._setDate(inst, this._getDefaultDate(inst));
6256 this._updateDatepicker(inst);
6257 this._updateAlternate(inst);
6258 },
6259
6260 /* Pop-up the date picker in a "dialog" box.
6261 @param input element - ignored
6262 @param dateText string - the initial date to display (in the current format)
6263 @param onSelect function - the function(dateText) to call when a date is selected
6264 @param settings object - update the dialog date picker instance's settings (anonymous object)
6265 @param pos int[2] - coordinates for the dialog's position within the screen or
6266 event - with x/y coordinates or
6267 leave empty for default (screen centre)
6268 @return the manager object */
6269 _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
6270 var inst = this._dialogInst; // internal instance
6271 if (!inst) {
6272 var id = 'dp' + (++this.uuid);
6273 this._dialogInput = $('<input type="text" id="' + id +
6274 '" size="1" style="position: absolute; top: -100px;"/>');
6275 this._dialogInput.keydown(this._doKeyDown);
6276 $('body').append(this._dialogInput);
6277 inst = this._dialogInst = this._newInst(this._dialogInput, false);
6278 inst.settings = {};
6279 $.data(this._dialogInput[0], PROP_NAME, inst);
6280 }
6281 extendRemove(inst.settings, settings || {});
6282 this._dialogInput.val(dateText);
6283
6284 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
6285 if (!this._pos) {
6286 var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
6287 var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
6288 var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
6289 var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
6290 this._pos = // should use actual width/height below
6291 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
6292 }
6293
6294 // move input on screen for focus, but hidden behind dialog
6295 this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
6296 inst.settings.onSelect = onSelect;
6297 this._inDialog = true;
6298 this.dpDiv.addClass(this._dialogClass);
6299 this._showDatepicker(this._dialogInput[0]);
6300 if ($.blockUI)
6301 $.blockUI(this.dpDiv);
6302 $.data(this._dialogInput[0], PROP_NAME, inst);
6303 return this;
6304 },
6305
6306 /* Detach a datepicker from its control.
6307 @param target element - the target input field or division or span */
6308 _destroyDatepicker: function(target) {
6309 var $target = $(target);
6310 var inst = $.data(target, PROP_NAME);
6311 if (!$target.hasClass(this.markerClassName)) {
6312 return;
6313 }
6314 var nodeName = target.nodeName.toLowerCase();
6315 $.removeData(target, PROP_NAME);
6316 if (nodeName == 'input') {
6317 inst.append.remove();
6318 inst.trigger.remove();
6319 $target.removeClass(this.markerClassName).
6320 unbind('focus', this._showDatepicker).
6321 unbind('keydown', this._doKeyDown).
6322 unbind('keypress', this._doKeyPress);
6323 } else if (nodeName == 'div' || nodeName == 'span')
6324 $target.removeClass(this.markerClassName).empty();
6325 },
6326
6327 /* Enable the date picker to a jQuery selection.
6328 @param target element - the target input field or division or span */
6329 _enableDatepicker: function(target) {
6330 var $target = $(target);
6331 var inst = $.data(target, PROP_NAME);
6332 if (!$target.hasClass(this.markerClassName)) {
6333 return;
6334 }
6335 var nodeName = target.nodeName.toLowerCase();
6336 if (nodeName == 'input') {
6337 target.disabled = false;
6338 inst.trigger.filter('button').
6339 each(function() { this.disabled = false; }).end().
6340 filter('img').css({opacity: '1.0', cursor: ''});
6341 }
6342 else if (nodeName == 'div' || nodeName == 'span') {
6343 var inline = $target.children('.' + this._inlineClass);
6344 inline.children().removeClass('ui-state-disabled');
6345 }
6346 this._disabledInputs = $.map(this._disabledInputs,
6347 function(value) { return (value == target ? null : value); }); // delete entry
6348 },
6349
6350 /* Disable the date picker to a jQuery selection.
6351 @param target element - the target input field or division or span */
6352 _disableDatepicker: function(target) {
6353 var $target = $(target);
6354 var inst = $.data(target, PROP_NAME);
6355 if (!$target.hasClass(this.markerClassName)) {
6356 return;
6357 }
6358 var nodeName = target.nodeName.toLowerCase();
6359 if (nodeName == 'input') {
6360 target.disabled = true;
6361 inst.trigger.filter('button').
6362 each(function() { this.disabled = true; }).end().
6363 filter('img').css({opacity: '0.5', cursor: 'default'});
6364 }
6365 else if (nodeName == 'div' || nodeName == 'span') {
6366 var inline = $target.children('.' + this._inlineClass);
6367 inline.children().addClass('ui-state-disabled');
6368 }
6369 this._disabledInputs = $.map(this._disabledInputs,
6370 function(value) { return (value == target ? null : value); }); // delete entry
6371 this._disabledInputs[this._disabledInputs.length] = target;
6372 },
6373
6374 /* Is the first field in a jQuery collection disabled as a datepicker?
6375 @param target element - the target input field or division or span
6376 @return boolean - true if disabled, false if enabled */
6377 _isDisabledDatepicker: function(target) {
6378 if (!target) {
6379 return false;
6380 }
6381 for (var i = 0; i < this._disabledInputs.length; i++) {
6382 if (this._disabledInputs[i] == target)
6383 return true;
6384 }
6385 return false;
6386 },
6387
6388 /* Retrieve the instance data for the target control.
6389 @param target element - the target input field or division or span
6390 @return object - the associated instance data
6391 @throws error if a jQuery problem getting data */
6392 _getInst: function(target) {
6393 try {
6394 return $.data(target, PROP_NAME);
6395 }
6396 catch (err) {
6397 throw 'Missing instance data for this datepicker';
6398 }
6399 },
6400
6401 /* Update or retrieve the settings for a date picker attached to an input field or division.
6402 @param target element - the target input field or division or span
6403 @param name object - the new settings to update or
6404 string - the name of the setting to change or retrieve,
6405 when retrieving also 'all' for all instance settings or
6406 'defaults' for all global defaults
6407 @param value any - the new value for the setting
6408 (omit if above is an object or to retrieve a value) */
6409 _optionDatepicker: function(target, name, value) {
6410 var inst = this._getInst(target);
6411 if (arguments.length == 2 && typeof name == 'string') {
6412 return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
6413 (inst ? (name == 'all' ? $.extend({}, inst.settings) :
6414 this._get(inst, name)) : null));
6415 }
6416 var settings = name || {};
6417 if (typeof name == 'string') {
6418 settings = {};
6419 settings[name] = value;
6420 }
6421 if (inst) {
6422 if (this._curInst == inst) {
6423 this._hideDatepicker(null);
6424 }
6425 var date = this._getDateDatepicker(target);
6426 extendRemove(inst.settings, settings);
6427 this._setDateDatepicker(target, date);
6428 this._updateDatepicker(inst);
6429 }
6430 },
6431
6432 // change method deprecated
6433 _changeDatepicker: function(target, name, value) {
6434 this._optionDatepicker(target, name, value);
6435 },
6436
6437 /* Redraw the date picker attached to an input field or division.
6438 @param target element - the target input field or division or span */
6439 _refreshDatepicker: function(target) {
6440 var inst = this._getInst(target);
6441 if (inst) {
6442 this._updateDatepicker(inst);
6443 }
6444 },
6445
6446 /* Set the dates for a jQuery selection.
6447 @param target element - the target input field or division or span
6448 @param date Date - the new date
6449 @param endDate Date - the new end date for a range (optional) */
6450 _setDateDatepicker: function(target, date, endDate) {
6451 var inst = this._getInst(target);
6452 if (inst) {
6453 this._setDate(inst, date, endDate);
6454 this._updateDatepicker(inst);
6455 this._updateAlternate(inst);
6456 }
6457 },
6458
6459 /* Get the date(s) for the first entry in a jQuery selection.
6460 @param target element - the target input field or division or span
6461 @return Date - the current date or
6462 Date[2] - the current dates for a range */
6463 _getDateDatepicker: function(target) {
6464 var inst = this._getInst(target);
6465 if (inst && !inst.inline)
6466 this._setDateFromField(inst);
6467 return (inst ? this._getDate(inst) : null);
6468 },
6469
6470 /* Handle keystrokes. */
6471 _doKeyDown: function(event) {
6472 var inst = $.datepicker._getInst(event.target);
6473 var handled = true;
6474 var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
6475 inst._keyEvent = true;
6476 if ($.datepicker._datepickerShowing)
6477 switch (event.keyCode) {
6478 case 9: $.datepicker._hideDatepicker(null, '');
6479 break; // hide on tab out
6480 case 13: var sel = $('td.' + $.datepicker._dayOverClass +
6481 ', td.' + $.datepicker._currentClass, inst.dpDiv);
6482 if (sel[0])
6483 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
6484 else
6485 $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
6486 return false; // don't submit the form
6487 break; // select the value on enter
6488 case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
6489 break; // hide on escape
6490 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
6491 -$.datepicker._get(inst, 'stepBigMonths') :
6492 -$.datepicker._get(inst, 'stepMonths')), 'M');
6493 break; // previous month/year on page up/+ ctrl
6494 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
6495 +$.datepicker._get(inst, 'stepBigMonths') :
6496 +$.datepicker._get(inst, 'stepMonths')), 'M');
6497 break; // next month/year on page down/+ ctrl
6498 case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
6499 handled = event.ctrlKey || event.metaKey;
6500 break; // clear on ctrl or command +end
6501 case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
6502 handled = event.ctrlKey || event.metaKey;
6503 break; // current on ctrl or command +home
6504 case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
6505 handled = event.ctrlKey || event.metaKey;
6506 // -1 day on ctrl or command +left
6507 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
6508 -$.datepicker._get(inst, 'stepBigMonths') :
6509 -$.datepicker._get(inst, 'stepMonths')), 'M');
6510 // next month/year on alt +left on Mac
6511 break;
6512 case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
6513 handled = event.ctrlKey || event.metaKey;
6514 break; // -1 week on ctrl or command +up
6515 case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
6516 handled = event.ctrlKey || event.metaKey;
6517 // +1 day on ctrl or command +right
6518 if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
6519 +$.datepicker._get(inst, 'stepBigMonths') :
6520 +$.datepicker._get(inst, 'stepMonths')), 'M');
6521 // next month/year on alt +right
6522 break;
6523 case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
6524 handled = event.ctrlKey || event.metaKey;
6525 break; // +1 week on ctrl or command +down
6526 default: handled = false;
6527 }
6528 else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
6529 $.datepicker._showDatepicker(this);
6530 else {
6531 handled = false;
6532 }
6533 if (handled) {
6534 event.preventDefault();
6535 event.stopPropagation();
6536 }
6537 },
6538
6539 /* Filter entered characters - based on date format. */
6540 _doKeyPress: function(event) {
6541 var inst = $.datepicker._getInst(event.target);
6542 if ($.datepicker._get(inst, 'constrainInput')) {
6543 var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
6544 var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
6545 return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
6546 }
6547 },
6548
6549 /* Pop-up the date picker for a given input field.
6550 @param input element - the input field attached to the date picker or
6551 event - if triggered by focus */
6552 _showDatepicker: function(input) {
6553 input = input.target || input;
6554 if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
6555 input = $('input', input.parentNode)[0];
6556 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
6557 return;
6558 var inst = $.datepicker._getInst(input);
6559 var beforeShow = $.datepicker._get(inst, 'beforeShow');
6560 extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
6561 $.datepicker._hideDatepicker(null, '');
6562 $.datepicker._lastInput = input;
6563 $.datepicker._setDateFromField(inst);
6564 if ($.datepicker._inDialog) // hide cursor
6565 input.value = '';
6566 if (!$.datepicker._pos) { // position below input
6567 $.datepicker._pos = $.datepicker._findPos(input);
6568 $.datepicker._pos[1] += input.offsetHeight; // add the height
6569 }
6570 var isFixed = false;
6571 $(input).parents().each(function() {
6572 isFixed |= $(this).css('position') == 'fixed';
6573 return !isFixed;
6574 });
6575 if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
6576 $.datepicker._pos[0] -= document.documentElement.scrollLeft;
6577 $.datepicker._pos[1] -= document.documentElement.scrollTop;
6578 }
6579 var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
6580 $.datepicker._pos = null;
6581 inst.rangeStart = null;
6582 // determine sizing offscreen
6583 inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
6584 $.datepicker._updateDatepicker(inst);
6585 // fix width for dynamic number of date pickers
6586 // and adjust position before showing
6587 offset = $.datepicker._checkOffset(inst, offset, isFixed);
6588 inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
6589 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
6590 left: offset.left + 'px', top: offset.top + 'px'});
6591 if (!inst.inline) {
6592 var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
6593 var duration = $.datepicker._get(inst, 'duration');
6594 var postProcess = function() {
6595 $.datepicker._datepickerShowing = true;
6596 if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems
6597 $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
6598 height: inst.dpDiv.height() + 4});
6599 };
6600 if ($.effects && $.effects[showAnim])
6601 inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
6602 else
6603 inst.dpDiv[showAnim](duration, postProcess);
6604 if (duration == '')
6605 postProcess();
6606 if (inst.input[0].type != 'hidden')
6607 inst.input[0].focus();
6608 $.datepicker._curInst = inst;
6609 }
6610 },
6611
6612 /* Generate the date picker content. */
6613 _updateDatepicker: function(inst) {
6614 var dims = {width: inst.dpDiv.width() + 4,
6615 height: inst.dpDiv.height() + 4};
6616 var self = this;
6617 inst.dpDiv.empty().append(this._generateHTML(inst))
6618 .find('iframe.ui-datepicker-cover').
6619 css({width: dims.width, height: dims.height})
6620 .end()
6621 .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
6622 .bind('mouseout', function(){
6623 $(this).removeClass('ui-state-hover');
6624 if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
6625 if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
6626 })
6627 .bind('mouseover', function(){
6628 if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
6629 $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
6630 $(this).addClass('ui-state-hover');
6631 if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
6632 if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
6633 }
6634 })
6635 .end()
6636 .find('.' + this._dayOverClass + ' a')
6637 .trigger('mouseover')
6638 .end();
6639 var numMonths = this._getNumberOfMonths(inst);
6640 var cols = numMonths[1];
6641 var width = 17;
6642 if (cols > 1) {
6643 inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
6644 } else {
6645 inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
6646 }
6647 inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
6648 'Class']('ui-datepicker-multi');
6649 inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
6650 'Class']('ui-datepicker-rtl');
6651 if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
6652 $(inst.input[0]).focus();
6653 },
6654
6655 /* Check positioning to remain on screen. */
6656 _checkOffset: function(inst, offset, isFixed) {
6657 var dpWidth = inst.dpDiv.outerWidth();
6658 var dpHeight = inst.dpDiv.outerHeight();
6659 var inputWidth = inst.input ? inst.input.outerWidth() : 0;
6660 var inputHeight = inst.input ? inst.input.outerHeight() : 0;
6661 var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
6662 var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();
6663
6664 offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
6665 offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
6666 offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
6667
6668 // now check if datepicker is showing outside window viewport - move to a better place if so.
6669 offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
6670 offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;
6671
6672 return offset;
6673 },
6674
6675 /* Find an object's position on the screen. */
6676 _findPos: function(obj) {
6677 while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
6678 obj = obj.nextSibling;
6679 }
6680 var position = $(obj).offset();
6681 return [position.left, position.top];
6682 },
6683
6684 /* Hide the date picker from view.
6685 @param input element - the input field attached to the date picker
6686 @param duration string - the duration over which to close the date picker */
6687 _hideDatepicker: function(input, duration) {
6688 var inst = this._curInst;
6689 if (!inst || (input && inst != $.data(input, PROP_NAME)))
6690 return;
6691 if (inst.stayOpen)
6692 this._selectDate('#' + inst.id, this._formatDate(inst,
6693 inst.currentDay, inst.currentMonth, inst.currentYear));
6694 inst.stayOpen = false;
6695 if (this._datepickerShowing) {
6696 duration = (duration != null ? duration : this._get(inst, 'duration'));
6697 var showAnim = this._get(inst, 'showAnim');
6698 var postProcess = function() {
6699 $.datepicker._tidyDialog(inst);
6700 };
6701 if (duration != '' && $.effects && $.effects[showAnim])
6702 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
6703 duration, postProcess);
6704 else
6705 inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
6706 (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
6707 if (duration == '')
6708 this._tidyDialog(inst);
6709 var onClose = this._get(inst, 'onClose');
6710 if (onClose)
6711 onClose.apply((inst.input ? inst.input[0] : null),
6712 [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
6713 this._datepickerShowing = false;
6714 this._lastInput = null;
6715 if (this._inDialog) {
6716 this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
6717 if ($.blockUI) {
6718 $.unblockUI();
6719 $('body').append(this.dpDiv);
6720 }
6721 }
6722 this._inDialog = false;
6723 }
6724 this._curInst = null;
6725 },
6726
6727 /* Tidy up after a dialog display. */
6728 _tidyDialog: function(inst) {
6729 inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
6730 },
6731
6732 /* Close date picker if clicked elsewhere. */
6733 _checkExternalClick: function(event) {
6734 if (!$.datepicker._curInst)
6735 return;
6736 var $target = $(event.target);
6737 if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
6738 !$target.hasClass($.datepicker.markerClassName) &&
6739 !$target.hasClass($.datepicker._triggerClass) &&
6740 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
6741 $.datepicker._hideDatepicker(null, '');
6742 },
6743
6744 /* Adjust one of the date sub-fields. */
6745 _adjustDate: function(id, offset, period) {
6746 var target = $(id);
6747 var inst = this._getInst(target[0]);
6748 if (this._isDisabledDatepicker(target[0])) {
6749 return;
6750 }
6751 this._adjustInstDate(inst, offset +
6752 (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
6753 period);
6754 this._updateDatepicker(inst);
6755 },
6756
6757 /* Action for current link. */
6758 _gotoToday: function(id) {
6759 var target = $(id);
6760 var inst = this._getInst(target[0]);
6761 if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
6762 inst.selectedDay = inst.currentDay;
6763 inst.drawMonth = inst.selectedMonth = inst.currentMonth;
6764 inst.drawYear = inst.selectedYear = inst.currentYear;
6765 }
6766 else {
6767 var date = new Date();
6768 inst.selectedDay = date.getDate();
6769 inst.drawMonth = inst.selectedMonth = date.getMonth();
6770 inst.drawYear = inst.selectedYear = date.getFullYear();
6771 }
6772 this._notifyChange(inst);
6773 this._adjustDate(target);
6774 },
6775
6776 /* Action for selecting a new month/year. */
6777 _selectMonthYear: function(id, select, period) {
6778 var target = $(id);
6779 var inst = this._getInst(target[0]);
6780 inst._selectingMonthYear = false;
6781 inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
6782 inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
6783 parseInt(select.options[select.selectedIndex].value,10);
6784 this._notifyChange(inst);
6785 this._adjustDate(target);
6786 },
6787
6788 /* Restore input focus after not changing month/year. */
6789 _clickMonthYear: function(id) {
6790 var target = $(id);
6791 var inst = this._getInst(target[0]);
6792 if (inst.input && inst._selectingMonthYear && !$.browser.msie)
6793 inst.input[0].focus();
6794 inst._selectingMonthYear = !inst._selectingMonthYear;
6795 },
6796
6797 /* Action for selecting a day. */
6798 _selectDay: function(id, month, year, td) {
6799 var target = $(id);
6800 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
6801 return;
6802 }
6803 var inst = this._getInst(target[0]);
6804 inst.selectedDay = inst.currentDay = $('a', td).html();
6805 inst.selectedMonth = inst.currentMonth = month;
6806 inst.selectedYear = inst.currentYear = year;
6807 if (inst.stayOpen) {
6808 inst.endDay = inst.endMonth = inst.endYear = null;
6809 }
6810 this._selectDate(id, this._formatDate(inst,
6811 inst.currentDay, inst.currentMonth, inst.currentYear));
6812 if (inst.stayOpen) {
6813 inst.rangeStart = this._daylightSavingAdjust(
6814 new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
6815 this._updateDatepicker(inst);
6816 }
6817 },
6818
6819 /* Erase the input field and hide the date picker. */
6820 _clearDate: function(id) {
6821 var target = $(id);
6822 var inst = this._getInst(target[0]);
6823 inst.stayOpen = false;
6824 inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
6825 this._selectDate(target, '');
6826 },
6827
6828 /* Update the input field with the selected date. */
6829 _selectDate: function(id, dateStr) {
6830 var target = $(id);
6831 var inst = this._getInst(target[0]);
6832 dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
6833 if (inst.input)
6834 inst.input.val(dateStr);
6835 this._updateAlternate(inst);
6836 var onSelect = this._get(inst, 'onSelect');
6837 if (onSelect)
6838 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
6839 else if (inst.input)
6840 inst.input.trigger('change'); // fire the change event
6841 if (inst.inline)
6842 this._updateDatepicker(inst);
6843 else if (!inst.stayOpen) {
6844 this._hideDatepicker(null, this._get(inst, 'duration'));
6845 this._lastInput = inst.input[0];
6846 if (typeof(inst.input[0]) != 'object')
6847 inst.input[0].focus(); // restore focus
6848 this._lastInput = null;
6849 }
6850 },
6851
6852 /* Update any alternate field to synchronise with the main field. */
6853 _updateAlternate: function(inst) {
6854 var altField = this._get(inst, 'altField');
6855 if (altField) { // update alternate field too
6856 var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
6857 var date = this._getDate(inst);
6858 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
6859 $(altField).each(function() { $(this).val(dateStr); });
6860 }
6861 },
6862
6863 /* Set as beforeShowDay function to prevent selection of weekends.
6864 @param date Date - the date to customise
6865 @return [boolean, string] - is this date selectable?, what is its CSS class? */
6866 noWeekends: function(date) {
6867 var day = date.getDay();
6868 return [(day > 0 && day < 6), ''];
6869 },
6870
6871 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
6872 @param date Date - the date to get the week for
6873 @return number - the number of the week within the year that contains this date */
6874 iso8601Week: function(date) {
6875 var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
6876 var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
6877 var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
6878 firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
6879 if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
6880 checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
6881 return $.datepicker.iso8601Week(checkDate);
6882 } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
6883 firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
6884 if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
6885 return 1;
6886 }
6887 }
6888 return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
6889 },
6890
6891 /* Parse a string value into a date object.
6892 See formatDate below for the possible formats.
6893
6894 @param format string - the expected format of the date
6895 @param value string - the date in the above format
6896 @param settings Object - attributes include:
6897 shortYearCutoff number - the cutoff year for determining the century (optional)
6898 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
6899 dayNames string[7] - names of the days from Sunday (optional)
6900 monthNamesShort string[12] - abbreviated names of the months (optional)
6901 monthNames string[12] - names of the months (optional)
6902 @return Date - the extracted date value or null if value is blank */
6903 parseDate: function (format, value, settings) {
6904 if (format == null || value == null)
6905 throw 'Invalid arguments';
6906 value = (typeof value == 'object' ? value.toString() : value + '');
6907 if (value == '')
6908 return null;
6909 var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
6910 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
6911 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
6912 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
6913 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
6914 var year = -1;
6915 var month = -1;
6916 var day = -1;
6917 var doy = -1;
6918 var literal = false;
6919 // Check whether a format character is doubled
6920 var lookAhead = function(match) {
6921 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
6922 if (matches)
6923 iFormat++;
6924 return matches;
6925 };
6926 // Extract a number from the string value
6927 var getNumber = function(match) {
6928 lookAhead(match);
6929 var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
6930 var size = origSize;
6931 var num = 0;
6932 while (size > 0 && iValue < value.length &&
6933 value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
6934 num = num * 10 + parseInt(value.charAt(iValue++),10);
6935 size--;
6936 }
6937 if (size == origSize)
6938 throw 'Missing number at position ' + iValue;
6939 return num;
6940 };
6941 // Extract a name from the string value and convert to an index
6942 var getName = function(match, shortNames, longNames) {
6943 var names = (lookAhead(match) ? longNames : shortNames);
6944 var size = 0;
6945 for (var j = 0; j < names.length; j++)
6946 size = Math.max(size, names[j].length);
6947 var name = '';
6948 var iInit = iValue;
6949 while (size > 0 && iValue < value.length) {
6950 name += value.charAt(iValue++);
6951 for (var i = 0; i < names.length; i++)
6952 if (name == names[i])
6953 return i + 1;
6954 size--;
6955 }
6956 throw 'Unknown name at position ' + iInit;
6957 };
6958 // Confirm that a literal character matches the string value
6959 var checkLiteral = function() {
6960 if (value.charAt(iValue) != format.charAt(iFormat))
6961 throw 'Unexpected literal at position ' + iValue;
6962 iValue++;
6963 };
6964 var iValue = 0;
6965 for (var iFormat = 0; iFormat < format.length; iFormat++) {
6966 if (literal)
6967 if (format.charAt(iFormat) == "'" && !lookAhead("'"))
6968 literal = false;
6969 else
6970 checkLiteral();
6971 else
6972 switch (format.charAt(iFormat)) {
6973 case 'd':
6974 day = getNumber('d');
6975 break;
6976 case 'D':
6977 getName('D', dayNamesShort, dayNames);
6978 break;
6979 case 'o':
6980 doy = getNumber('o');
6981 break;
6982 case 'm':
6983 month = getNumber('m');
6984 break;
6985 case 'M':
6986 month = getName('M', monthNamesShort, monthNames);
6987 break;
6988 case 'y':
6989 year = getNumber('y');
6990 break;
6991 case '@':
6992 var date = new Date(getNumber('@'));
6993 year = date.getFullYear();
6994 month = date.getMonth() + 1;
6995 day = date.getDate();
6996 break;
6997 case "'":
6998 if (lookAhead("'"))
6999 checkLiteral();
7000 else
7001 literal = true;
7002 break;
7003 default:
7004 checkLiteral();
7005 }
7006 }
7007 if (year == -1)
7008 year = new Date().getFullYear();
7009 else if (year < 100)
7010 year += new Date().getFullYear() - new Date().getFullYear() % 100 +
7011 (year <= shortYearCutoff ? 0 : -100);
7012 if (doy > -1) {
7013 month = 1;
7014 day = doy;
7015 do {
7016 var dim = this._getDaysInMonth(year, month - 1);
7017 if (day <= dim)
7018 break;
7019 month++;
7020 day -= dim;
7021 } while (true);
7022 }
7023 var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
7024 if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
7025 throw 'Invalid date'; // E.g. 31/02/*
7026 return date;
7027 },
7028
7029 /* Standard date formats. */
7030 ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
7031 COOKIE: 'D, dd M yy',
7032 ISO_8601: 'yy-mm-dd',
7033 RFC_822: 'D, d M y',
7034 RFC_850: 'DD, dd-M-y',
7035 RFC_1036: 'D, d M y',
7036 RFC_1123: 'D, d M yy',
7037 RFC_2822: 'D, d M yy',
7038 RSS: 'D, d M y', // RFC 822
7039 TIMESTAMP: '@',
7040 W3C: 'yy-mm-dd', // ISO 8601
7041
7042 /* Format a date object into a string value.
7043 The format can be combinations of the following:
7044 d - day of month (no leading zero)
7045 dd - day of month (two digit)
7046 o - day of year (no leading zeros)
7047 oo - day of year (three digit)
7048 D - day name short
7049 DD - day name long
7050 m - month of year (no leading zero)
7051 mm - month of year (two digit)
7052 M - month name short
7053 MM - month name long
7054 y - year (two digit)
7055 yy - year (four digit)
7056 @ - Unix timestamp (ms since 01/01/1970)
7057 '...' - literal text
7058 '' - single quote
7059
7060 @param format string - the desired format of the date
7061 @param date Date - the date value to format
7062 @param settings Object - attributes include:
7063 dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
7064 dayNames string[7] - names of the days from Sunday (optional)
7065 monthNamesShort string[12] - abbreviated names of the months (optional)
7066 monthNames string[12] - names of the months (optional)
7067 @return string - the date in the above format */
7068 formatDate: function (format, date, settings) {
7069 if (!date)
7070 return '';
7071 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
7072 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
7073 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
7074 var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
7075 // Check whether a format character is doubled
7076 var lookAhead = function(match) {
7077 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
7078 if (matches)
7079 iFormat++;
7080 return matches;
7081 };
7082 // Format a number, with leading zero if necessary
7083 var formatNumber = function(match, value, len) {
7084 var num = '' + value;
7085 if (lookAhead(match))
7086 while (num.length < len)
7087 num = '0' + num;
7088 return num;
7089 };
7090 // Format a name, short or long as requested
7091 var formatName = function(match, value, shortNames, longNames) {
7092 return (lookAhead(match) ? longNames[value] : shortNames[value]);
7093 };
7094 var output = '';
7095 var literal = false;
7096 if (date)
7097 for (var iFormat = 0; iFormat < format.length; iFormat++) {
7098 if (literal)
7099 if (format.charAt(iFormat) == "'" && !lookAhead("'"))
7100 literal = false;
7101 else
7102 output += format.charAt(iFormat);
7103 else
7104 switch (format.charAt(iFormat)) {
7105 case 'd':
7106 output += formatNumber('d', date.getDate(), 2);
7107 break;
7108 case 'D':
7109 output += formatName('D', date.getDay(), dayNamesShort, dayNames);
7110 break;
7111 case 'o':
7112 var doy = date.getDate();
7113 for (var m = date.getMonth() - 1; m >= 0; m--)
7114 doy += this._getDaysInMonth(date.getFullYear(), m);
7115 output += formatNumber('o', doy, 3);
7116 break;
7117 case 'm':
7118 output += formatNumber('m', date.getMonth() + 1, 2);
7119 break;
7120 case 'M':
7121 output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
7122 break;
7123 case 'y':
7124 output += (lookAhead('y') ? date.getFullYear() :
7125 (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
7126 break;
7127 case '@':
7128 output += date.getTime();
7129 break;
7130 case "'":
7131 if (lookAhead("'"))
7132 output += "'";
7133 else
7134 literal = true;
7135 break;
7136 default:
7137 output += format.charAt(iFormat);
7138 }
7139 }
7140 return output;
7141 },
7142
7143 /* Extract all possible characters from the date format. */
7144 _possibleChars: function (format) {
7145 var chars = '';
7146 var literal = false;
7147 for (var iFormat = 0; iFormat < format.length; iFormat++)
7148 if (literal)
7149 if (format.charAt(iFormat) == "'" && !lookAhead("'"))
7150 literal = false;
7151 else
7152 chars += format.charAt(iFormat);
7153 else
7154 switch (format.charAt(iFormat)) {
7155 case 'd': case 'm': case 'y': case '@':
7156 chars += '0123456789';
7157 break;
7158 case 'D': case 'M':
7159 return null; // Accept anything
7160 case "'":
7161 if (lookAhead("'"))
7162 chars += "'";
7163 else
7164 literal = true;
7165 break;
7166 default:
7167 chars += format.charAt(iFormat);
7168 }
7169 return chars;
7170 },
7171
7172 /* Get a setting value, defaulting if necessary. */
7173 _get: function(inst, name) {
7174 return inst.settings[name] !== undefined ?
7175 inst.settings[name] : this._defaults[name];
7176 },
7177
7178 /* Parse existing date and initialise date picker. */
7179 _setDateFromField: function(inst) {
7180 var dateFormat = this._get(inst, 'dateFormat');
7181 var dates = inst.input ? inst.input.val() : null;
7182 inst.endDay = inst.endMonth = inst.endYear = null;
7183 var date = defaultDate = this._getDefaultDate(inst);
7184 var settings = this._getFormatConfig(inst);
7185 try {
7186 date = this.parseDate(dateFormat, dates, settings) || defaultDate;
7187 } catch (event) {
7188 this.log(event);
7189 date = defaultDate;
7190 }
7191 inst.selectedDay = date.getDate();
7192 inst.drawMonth = inst.selectedMonth = date.getMonth();
7193 inst.drawYear = inst.selectedYear = date.getFullYear();
7194 inst.currentDay = (dates ? date.getDate() : 0);
7195 inst.currentMonth = (dates ? date.getMonth() : 0);
7196 inst.currentYear = (dates ? date.getFullYear() : 0);
7197 this._adjustInstDate(inst);
7198 },
7199
7200 /* Retrieve the default date shown on opening. */
7201 _getDefaultDate: function(inst) {
7202 var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
7203 var minDate = this._getMinMaxDate(inst, 'min', true);
7204 var maxDate = this._getMinMaxDate(inst, 'max');
7205 date = (minDate && date < minDate ? minDate : date);
7206 date = (maxDate && date > maxDate ? maxDate : date);
7207 return date;
7208 },
7209
7210 /* A date may be specified as an exact value or a relative one. */
7211 _determineDate: function(date, defaultDate) {
7212 var offsetNumeric = function(offset) {
7213 var date = new Date();
7214 date.setDate(date.getDate() + offset);
7215 return date;
7216 };
7217 var offsetString = function(offset, getDaysInMonth) {
7218 var date = new Date();
7219 var year = date.getFullYear();
7220 var month = date.getMonth();
7221 var day = date.getDate();
7222 var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
7223 var matches = pattern.exec(offset);
7224 while (matches) {
7225 switch (matches[2] || 'd') {
7226 case 'd' : case 'D' :
7227 day += parseInt(matches[1],10); break;
7228 case 'w' : case 'W' :
7229 day += parseInt(matches[1],10) * 7; break;
7230 case 'm' : case 'M' :
7231 month += parseInt(matches[1],10);
7232 day = Math.min(day, getDaysInMonth(year, month));
7233 break;
7234 case 'y': case 'Y' :
7235 year += parseInt(matches[1],10);
7236 day = Math.min(day, getDaysInMonth(year, month));
7237 break;
7238 }
7239 matches = pattern.exec(offset);
7240 }
7241 return new Date(year, month, day);
7242 };
7243 date = (date == null ? defaultDate :
7244 (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
7245 (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
7246 date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
7247 if (date) {
7248 date.setHours(0);
7249 date.setMinutes(0);
7250 date.setSeconds(0);
7251 date.setMilliseconds(0);
7252 }
7253 return this._daylightSavingAdjust(date);
7254 },
7255
7256 /* Handle switch to/from daylight saving.
7257 Hours may be non-zero on daylight saving cut-over:
7258 > 12 when midnight changeover, but then cannot generate
7259 midnight datetime, so jump to 1AM, otherwise reset.
7260 @param date (Date) the date to check
7261 @return (Date) the corrected date */
7262 _daylightSavingAdjust: function(date) {
7263 if (!date) return null;
7264 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
7265 return date;
7266 },
7267
7268 /* Set the date(s) directly. */
7269 _setDate: function(inst, date, endDate) {
7270 var clear = !(date);
7271 var origMonth = inst.selectedMonth;
7272 var origYear = inst.selectedYear;
7273 date = this._determineDate(date, new Date());
7274 inst.selectedDay = inst.currentDay = date.getDate();
7275 inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
7276 inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
7277 if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
7278 this._notifyChange(inst);
7279 this._adjustInstDate(inst);
7280 if (inst.input) {
7281 inst.input.val(clear ? '' : this._formatDate(inst));
7282 }
7283 },
7284
7285 /* Retrieve the date(s) directly. */
7286 _getDate: function(inst) {
7287 var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
7288 this._daylightSavingAdjust(new Date(
7289 inst.currentYear, inst.currentMonth, inst.currentDay)));
7290 return startDate;
7291 },
7292
7293 /* Generate the HTML for the current state of the date picker. */
7294 _generateHTML: function(inst) {
7295 var today = new Date();
7296 today = this._daylightSavingAdjust(
7297 new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
7298 var isRTL = this._get(inst, 'isRTL');
7299 var showButtonPanel = this._get(inst, 'showButtonPanel');
7300 var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
7301 var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
7302 var numMonths = this._getNumberOfMonths(inst);
7303 var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
7304 var stepMonths = this._get(inst, 'stepMonths');
7305 var stepBigMonths = this._get(inst, 'stepBigMonths');
7306 var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
7307 var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
7308 new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
7309 var minDate = this._getMinMaxDate(inst, 'min', true);
7310 var maxDate = this._getMinMaxDate(inst, 'max');
7311 var drawMonth = inst.drawMonth - showCurrentAtPos;
7312 var drawYear = inst.drawYear;
7313 if (drawMonth < 0) {
7314 drawMonth += 12;
7315 drawYear--;
7316 }
7317 if (maxDate) {
7318 var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
7319 maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
7320 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
7321 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
7322 drawMonth--;
7323 if (drawMonth < 0) {
7324 drawMonth = 11;
7325 drawYear--;
7326 }
7327 }
7328 }
7329 inst.drawMonth = drawMonth;
7330 inst.drawYear = drawYear;
7331 var prevText = this._get(inst, 'prevText');
7332 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
7333 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
7334 this._getFormatConfig(inst)));
7335 var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
7336 '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
7337 ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
7338 (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>'));
7339 var nextText = this._get(inst, 'nextText');
7340 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
7341 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
7342 this._getFormatConfig(inst)));
7343 var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
7344 '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
7345 ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
7346 (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>'));
7347 var currentText = this._get(inst, 'currentText');
7348 var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
7349 currentText = (!navigationAsDateFormat ? currentText :
7350 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
7351 var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
7352 var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
7353 (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
7354 '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
7355 var firstDay = parseInt(this._get(inst, 'firstDay'),10);
7356 firstDay = (isNaN(firstDay) ? 0 : firstDay);
7357 var dayNames = this._get(inst, 'dayNames');
7358 var dayNamesShort = this._get(inst, 'dayNamesShort');
7359 var dayNamesMin = this._get(inst, 'dayNamesMin');
7360 var monthNames = this._get(inst, 'monthNames');
7361 var monthNamesShort = this._get(inst, 'monthNamesShort');
7362 var beforeShowDay = this._get(inst, 'beforeShowDay');
7363 var showOtherMonths = this._get(inst, 'showOtherMonths');
7364 var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
7365 var endDate = inst.endDay ? this._daylightSavingAdjust(
7366 new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
7367 var defaultDate = this._getDefaultDate(inst);
7368 var html = '';
7369 for (var row = 0; row < numMonths[0]; row++) {
7370 var group = '';
7371 for (var col = 0; col < numMonths[1]; col++) {
7372 var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
7373 var cornerClass = ' ui-corner-all';
7374 var calender = '';
7375 if (isMultiMonth) {
7376 calender += '<div class="ui-datepicker-group ui-datepicker-group-';
7377 switch (col) {
7378 case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
7379 case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
7380 default: calender += 'middle'; cornerClass = ''; break;
7381 }
7382 calender += '">';
7383 }
7384 calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
7385 (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
7386 (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
7387 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
7388 selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
7389 '</div><table class="ui-datepicker-calendar"><thead>' +
7390 '<tr>';
7391 var thead = '';
7392 for (var dow = 0; dow < 7; dow++) { // days of the week
7393 var day = (dow + firstDay) % 7;
7394 thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
7395 '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
7396 }
7397 calender += thead + '</tr></thead><tbody>';
7398 var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
7399 if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
7400 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
7401 var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
7402 var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
7403 var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
7404 for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
7405 calender += '<tr>';
7406 var tbody = '';
7407 for (var dow = 0; dow < 7; dow++) { // create date picker days
7408 var daySettings = (beforeShowDay ?
7409 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
7410 var otherMonth = (printDate.getMonth() != drawMonth);
7411 var unselectable = otherMonth || !daySettings[0] ||
7412 (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
7413 tbody += '<td class="' +
7414 ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
7415 (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
7416 ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
7417 (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
7418 // or defaultDate is current printedDate and defaultDate is selectedDate
7419 ' ' + this._dayOverClass : '') + // highlight selected day
7420 (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
7421 (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
7422 (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
7423 ' ' + this._currentClass : '') + // highlight selected day
7424 (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
7425 ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
7426 (unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' +
7427 inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
7428 (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
7429 (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
7430 (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
7431 (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
7432 ' ui-state-active' : '') + // highlight selected day
7433 '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
7434 printDate.setDate(printDate.getDate() + 1);
7435 printDate = this._daylightSavingAdjust(printDate);
7436 }
7437 calender += tbody + '</tr>';
7438 }
7439 drawMonth++;
7440 if (drawMonth > 11) {
7441 drawMonth = 0;
7442 drawYear++;
7443 }
7444 calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
7445 ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
7446 group += calender;
7447 }
7448 html += group;
7449 }
7450 html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
7451 '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
7452 inst._keyEvent = false;
7453 return html;
7454 },
7455
7456 /* Generate the month and year header. */
7457 _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
7458 selectedDate, secondary, monthNames, monthNamesShort) {
7459 minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
7460 var changeMonth = this._get(inst, 'changeMonth');
7461 var changeYear = this._get(inst, 'changeYear');
7462 var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
7463 var html = '<div class="ui-datepicker-title">';
7464 var monthHtml = '';
7465 // month selection
7466 if (secondary || !changeMonth)
7467 monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span> ';
7468 else {
7469 var inMinYear = (minDate && minDate.getFullYear() == drawYear);
7470 var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
7471 monthHtml += '<select class="ui-datepicker-month" ' +
7472 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
7473 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
7474 '>';
7475 for (var month = 0; month < 12; month++) {
7476 if ((!inMinYear || month >= minDate.getMonth()) &&
7477 (!inMaxYear || month <= maxDate.getMonth()))
7478 monthHtml += '<option value="' + month + '"' +
7479 (month == drawMonth ? ' selected="selected"' : '') +
7480 '>' + monthNamesShort[month] + '</option>';
7481 }
7482 monthHtml += '</select>';
7483 }
7484 if (!showMonthAfterYear)
7485 html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? '&#xa0;' : '');
7486 // year selection
7487 if (secondary || !changeYear)
7488 html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
7489 else {
7490 // determine range of years to display
7491 var years = this._get(inst, 'yearRange').split(':');
7492 var year = 0;
7493 var endYear = 0;
7494 if (years.length != 2) {
7495 year = drawYear - 10;
7496 endYear = drawYear + 10;
7497 } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
7498 year = drawYear + parseInt(years[0], 10);
7499 endYear = drawYear + parseInt(years[1], 10);
7500 } else {
7501 year = parseInt(years[0], 10);
7502 endYear = parseInt(years[1], 10);
7503 }
7504 year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
7505 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
7506 html += '<select class="ui-datepicker-year" ' +
7507 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
7508 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
7509 '>';
7510 for (; year <= endYear; year++) {
7511 html += '<option value="' + year + '"' +
7512 (year == drawYear ? ' selected="selected"' : '') +
7513 '>' + year + '</option>';
7514 }
7515 html += '</select>';
7516 }
7517 if (showMonthAfterYear)
7518 html += (secondary || changeMonth || changeYear ? '&#xa0;' : '') + monthHtml;
7519 html += '</div>'; // Close datepicker_header
7520 return html;
7521 },
7522
7523 /* Adjust one of the date sub-fields. */
7524 _adjustInstDate: function(inst, offset, period) {
7525 var year = inst.drawYear + (period == 'Y' ? offset : 0);
7526 var month = inst.drawMonth + (period == 'M' ? offset : 0);
7527 var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
7528 (period == 'D' ? offset : 0);
7529 var date = this._daylightSavingAdjust(new Date(year, month, day));
7530 // ensure it is within the bounds set
7531 var minDate = this._getMinMaxDate(inst, 'min', true);
7532 var maxDate = this._getMinMaxDate(inst, 'max');
7533 date = (minDate && date < minDate ? minDate : date);
7534 date = (maxDate && date > maxDate ? maxDate : date);
7535 inst.selectedDay = date.getDate();
7536 inst.drawMonth = inst.selectedMonth = date.getMonth();
7537 inst.drawYear = inst.selectedYear = date.getFullYear();
7538 if (period == 'M' || period == 'Y')
7539 this._notifyChange(inst);
7540 },
7541
7542 /* Notify change of month/year. */
7543 _notifyChange: function(inst) {
7544 var onChange = this._get(inst, 'onChangeMonthYear');
7545 if (onChange)
7546 onChange.apply((inst.input ? inst.input[0] : null),
7547 [inst.selectedYear, inst.selectedMonth + 1, inst]);
7548 },
7549
7550 /* Determine the number of months to show. */
7551 _getNumberOfMonths: function(inst) {
7552 var numMonths = this._get(inst, 'numberOfMonths');
7553 return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
7554 },
7555
7556 /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
7557 _getMinMaxDate: function(inst, minMax, checkRange) {
7558 var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
7559 return (!checkRange || !inst.rangeStart ? date :
7560 (!date || inst.rangeStart > date ? inst.rangeStart : date));
7561 },
7562
7563 /* Find the number of days in a given month. */
7564 _getDaysInMonth: function(year, month) {
7565 return 32 - new Date(year, month, 32).getDate();
7566 },
7567
7568 /* Find the day of the week of the first of a month. */
7569 _getFirstDayOfMonth: function(year, month) {
7570 return new Date(year, month, 1).getDay();
7571 },
7572
7573 /* Determines if we should allow a "next/prev" month display change. */
7574 _canAdjustMonth: function(inst, offset, curYear, curMonth) {
7575 var numMonths = this._getNumberOfMonths(inst);
7576 var date = this._daylightSavingAdjust(new Date(
7577 curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
7578 if (offset < 0)
7579 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
7580 return this._isInRange(inst, date);
7581 },
7582
7583 /* Is the given date in the accepted range? */
7584 _isInRange: function(inst, date) {
7585 // during range selection, use minimum of selected date and range start
7586 var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(
7587 new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
7588 newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
7589 var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
7590 var maxDate = this._getMinMaxDate(inst, 'max');
7591 return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
7592 },
7593
7594 /* Provide the configuration settings for formatting/parsing. */
7595 _getFormatConfig: function(inst) {
7596 var shortYearCutoff = this._get(inst, 'shortYearCutoff');
7597 shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
7598 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
7599 return {shortYearCutoff: shortYearCutoff,
7600 dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
7601 monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
7602 },
7603
7604 /* Format the given date for display. */
7605 _formatDate: function(inst, day, month, year) {
7606 if (!day) {
7607 inst.currentDay = inst.selectedDay;
7608 inst.currentMonth = inst.selectedMonth;
7609 inst.currentYear = inst.selectedYear;
7610 }
7611 var date = (day ? (typeof day == 'object' ? day :
7612 this._daylightSavingAdjust(new Date(year, month, day))) :
7613 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
7614 return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
7615 }
7616});
7617
7618/* jQuery extend now ignores nulls! */
7619function extendRemove(target, props) {
7620 $.extend(target, props);
7621 for (var name in props)
7622 if (props[name] == null || props[name] == undefined)
7623 target[name] = props[name];
7624 return target;
7625};
7626
7627/* Determine whether an object is an array. */
7628function isArray(a) {
7629 return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
7630 (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
7631};
7632
7633/* Invoke the datepicker functionality.
7634 @param options string - a command, optionally followed by additional parameters or
7635 Object - settings for attaching new datepicker functionality
7636 @return jQuery object */
7637$.fn.datepicker = function(options){
7638
7639 /* Initialise the date picker. */
7640 if (!$.datepicker.initialized) {
7641 $(document).mousedown($.datepicker._checkExternalClick).
7642 find('body').append($.datepicker.dpDiv);
7643 $.datepicker.initialized = true;
7644 }
7645
7646 var otherArgs = Array.prototype.slice.call(arguments, 1);
7647 if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
7648 return $.datepicker['_' + options + 'Datepicker'].
7649 apply($.datepicker, [this[0]].concat(otherArgs));
7650 if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
7651 return $.datepicker['_' + options + 'Datepicker'].
7652 apply($.datepicker, [this[0]].concat(otherArgs));
7653 return this.each(function() {
7654 typeof options == 'string' ?
7655 $.datepicker['_' + options + 'Datepicker'].
7656 apply($.datepicker, [this].concat(otherArgs)) :
7657 $.datepicker._attachDatepicker(this, options);
7658 });
7659};
7660
7661$.datepicker = new Datepicker(); // singleton instance
7662$.datepicker.initialized = false;
7663$.datepicker.uuid = new Date().getTime();
7664$.datepicker.version = "1.7.2";
7665
7666// Workaround for #4055
7667// Add another global to avoid noConflict issues with inline event handlers
7668window.DP_jQuery = $;
7669
7670})(jQuery);
7671/*
7672 * jQuery UI Progressbar 1.7.2
7673 *
7674 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
7675 * Dual licensed under the MIT (MIT-LICENSE.txt)
7676 * and GPL (GPL-LICENSE.txt) licenses.
7677 *
7678 * http://docs.jquery.com/UI/Progressbar
7679 *
7680 * Depends:
7681 * ui.core.js
7682 */
7683(function($) {
7684
7685$.widget("ui.progressbar", {
7686
7687 _init: function() {
7688
7689 this.element
7690 .addClass("ui-progressbar"
7691 + " ui-widget"
7692 + " ui-widget-content"
7693 + " ui-corner-all")
7694 .attr({
7695 role: "progressbar",
7696 "aria-valuemin": this._valueMin(),
7697 "aria-valuemax": this._valueMax(),
7698 "aria-valuenow": this._value()
7699 });
7700
7701 this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
7702
7703 this._refreshValue();
7704
7705 },
7706
7707 destroy: function() {
7708
7709 this.element
7710 .removeClass("ui-progressbar"
7711 + " ui-widget"
7712 + " ui-widget-content"
7713 + " ui-corner-all")
7714 .removeAttr("role")
7715 .removeAttr("aria-valuemin")
7716 .removeAttr("aria-valuemax")
7717 .removeAttr("aria-valuenow")
7718 .removeData("progressbar")
7719 .unbind(".progressbar");
7720
7721 this.valueDiv.remove();
7722
7723 $.widget.prototype.destroy.apply(this, arguments);
7724
7725 },
7726
7727 value: function(newValue) {
7728 if (newValue === undefined) {
7729 return this._value();
7730 }
7731
7732 this._setData('value', newValue);
7733 return this;
7734 },
7735
7736 _setData: function(key, value) {
7737
7738 switch (key) {
7739 case 'value':
7740 this.options.value = value;
7741 this._refreshValue();
7742 this._trigger('change', null, {});
7743 break;
7744 }
7745
7746 $.widget.prototype._setData.apply(this, arguments);
7747
7748 },
7749
7750 _value: function() {
7751
7752 var val = this.options.value;
7753 if (val < this._valueMin()) val = this._valueMin();
7754 if (val > this._valueMax()) val = this._valueMax();
7755
7756 return val;
7757
7758 },
7759
7760 _valueMin: function() {
7761 var valueMin = 0;
7762 return valueMin;
7763 },
7764
7765 _valueMax: function() {
7766 var valueMax = 100;
7767 return valueMax;
7768 },
7769
7770 _refreshValue: function() {
7771 var value = this.value();
7772 this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
7773 this.valueDiv.width(value + '%');
7774 this.element.attr("aria-valuenow", value);
7775 }
7776
7777});
7778
7779$.extend($.ui.progressbar, {
7780 version: "1.7.2",
7781 defaults: {
7782 value: 0
7783 }
7784});
7785
7786})(jQuery);
7787/*
7788 * jQuery UI Effects 1.7.2
7789 *
7790 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
7791 * Dual licensed under the MIT (MIT-LICENSE.txt)
7792 * and GPL (GPL-LICENSE.txt) licenses.
7793 *
7794 * http://docs.jquery.com/UI/Effects/
7795 */
7796;jQuery.effects || (function($) {
7797
7798$.effects = {
7799 version: "1.7.2",
7800
7801 // Saves a set of properties in a data storage
7802 save: function(element, set) {
7803 for(var i=0; i < set.length; i++) {
7804 if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
7805 }
7806 },
7807
7808 // Restores a set of previously saved properties from a data storage
7809 restore: function(element, set) {
7810 for(var i=0; i < set.length; i++) {
7811 if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
7812 }
7813 },
7814
7815 setMode: function(el, mode) {
7816 if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
7817 return mode;
7818 },
7819
7820 getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
7821 // this should be a little more flexible in the future to handle a string & hash
7822 var y, x;
7823 switch (origin[0]) {
7824 case 'top': y = 0; break;
7825 case 'middle': y = 0.5; break;
7826 case 'bottom': y = 1; break;
7827 default: y = origin[0] / original.height;
7828 };
7829 switch (origin[1]) {
7830 case 'left': x = 0; break;
7831 case 'center': x = 0.5; break;
7832 case 'right': x = 1; break;
7833 default: x = origin[1] / original.width;
7834 };
7835 return {x: x, y: y};
7836 },
7837
7838 // Wraps the element around a wrapper that copies position properties
7839 createWrapper: function(element) {
7840
7841 //if the element is already wrapped, return it
7842 if (element.parent().is('.ui-effects-wrapper'))
7843 return element.parent();
7844
7845 //Cache width,height and float properties of the element, and create a wrapper around it
7846 var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
7847 element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
7848 var wrapper = element.parent();
7849
7850 //Transfer the positioning of the element to the wrapper
7851 if (element.css('position') == 'static') {
7852 wrapper.css({ position: 'relative' });
7853 element.css({ position: 'relative'} );
7854 } else {
7855 var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
7856 var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
7857 wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
7858 element.css({position: 'relative', top: 0, left: 0 });
7859 }
7860
7861 wrapper.css(props);
7862 return wrapper;
7863 },
7864
7865 removeWrapper: function(element) {
7866 if (element.parent().is('.ui-effects-wrapper'))
7867 return element.parent().replaceWith(element);
7868 return element;
7869 },
7870
7871 setTransition: function(element, list, factor, value) {
7872 value = value || {};
7873 $.each(list, function(i, x){
7874 unit = element.cssUnit(x);
7875 if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
7876 });
7877 return value;
7878 },
7879
7880 //Base function to animate from one class to another in a seamless transition
7881 animateClass: function(value, duration, easing, callback) {
7882
7883 var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
7884 var ea = (typeof easing == "string" ? easing : null);
7885
7886 return this.each(function() {
7887
7888 var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
7889 if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
7890 if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
7891
7892 //Let's get a style offset
7893 var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
7894 if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
7895 var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
7896 if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
7897
7898 // The main function to form the object for animation
7899 for(var n in newStyle) {
7900 if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
7901 && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
7902 && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
7903 && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
7904 && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
7905 ) offset[n] = newStyle[n];
7906 }
7907
7908 that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
7909 // Change style attribute back to original. For stupid IE, we need to clear the damn object.
7910 if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
7911 if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
7912 if(cb) cb.apply(this, arguments);
7913 });
7914
7915 });
7916 }
7917};
7918
7919
7920function _normalizeArguments(a, m) {
7921
7922 var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
7923 var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument
7924 speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
7925 var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
7926
7927 return [a[0], o, speed, callback];
7928
7929}
7930
7931//Extend the methods of jQuery
7932$.fn.extend({
7933
7934 //Save old methods
7935 _show: $.fn.show,
7936 _hide: $.fn.hide,
7937 __toggle: $.fn.toggle,
7938 _addClass: $.fn.addClass,
7939 _removeClass: $.fn.removeClass,
7940 _toggleClass: $.fn.toggleClass,
7941
7942 // New effect methods
7943 effect: function(fx, options, speed, callback) {
7944 return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
7945 },
7946
7947 show: function() {
7948 if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
7949 return this._show.apply(this, arguments);
7950 else {
7951 return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
7952 }
7953 },
7954
7955 hide: function() {
7956 if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
7957 return this._hide.apply(this, arguments);
7958 else {
7959 return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
7960 }
7961 },
7962
7963 toggle: function(){
7964 if(!arguments[0] ||
7965 (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) ||
7966 ($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) {
7967 return this.__toggle.apply(this, arguments);
7968 } else {
7969 return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
7970 }
7971 },
7972
7973 addClass: function(classNames, speed, easing, callback) {
7974 return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
7975 },
7976 removeClass: function(classNames,speed,easing,callback) {
7977 return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
7978 },
7979 toggleClass: function(classNames,speed,easing,callback) {
7980 return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
7981 },
7982 morph: function(remove,add,speed,easing,callback) {
7983 return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
7984 },
7985 switchClass: function() {
7986 return this.morph.apply(this, arguments);
7987 },
7988
7989 // helper functions
7990 cssUnit: function(key) {
7991 var style = this.css(key), val = [];
7992 $.each( ['em','px','%','pt'], function(i, unit){
7993 if(style.indexOf(unit) > 0)
7994 val = [parseFloat(style), unit];
7995 });
7996 return val;
7997 }
7998});
7999
8000/*
8001 * jQuery Color Animations
8002 * Copyright 2007 John Resig
8003 * Released under the MIT and GPL licenses.
8004 */
8005
8006// We override the animation for all of these color styles
8007$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
8008 $.fx.step[attr] = function(fx) {
8009 if ( fx.state == 0 ) {
8010 fx.start = getColor( fx.elem, attr );
8011 fx.end = getRGB( fx.end );
8012 }
8013
8014 fx.elem.style[attr] = "rgb(" + [
8015 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
8016 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
8017 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
8018 ].join(",") + ")";
8019 };
8020});
8021
8022// Color Conversion functions from highlightFade
8023// By Blair Mitchelmore
8024// http://jquery.offput.ca/highlightFade/
8025
8026// Parse strings looking for color tuples [255,255,255]
8027function getRGB(color) {
8028 var result;
8029
8030 // Check if we're already dealing with an array of colors
8031 if ( color && color.constructor == Array && color.length == 3 )
8032 return color;
8033
8034 // Look for rgb(num,num,num)
8035 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
8036 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
8037
8038 // Look for rgb(num%,num%,num%)
8039 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
8040 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
8041
8042 // Look for #a0b1c2
8043 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
8044 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
8045
8046 // Look for #fff
8047 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
8048 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
8049
8050 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
8051 if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
8052 return colors['transparent'];
8053
8054 // Otherwise, we're most likely dealing with a named color
8055 return colors[$.trim(color).toLowerCase()];
8056}
8057
8058function getColor(elem, attr) {
8059 var color;
8060
8061 do {
8062 color = $.curCSS(elem, attr);
8063
8064 // Keep going until we find an element that has color, or we hit the body
8065 if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
8066 break;
8067
8068 attr = "backgroundColor";
8069 } while ( elem = elem.parentNode );
8070
8071 return getRGB(color);
8072};
8073
8074// Some named colors to work with
8075// From Interface by Stefan Petre
8076// http://interface.eyecon.ro/
8077
8078var colors = {
8079 aqua:[0,255,255],
8080 azure:[240,255,255],
8081 beige:[245,245,220],
8082 black:[0,0,0],
8083 blue:[0,0,255],
8084 brown:[165,42,42],
8085 cyan:[0,255,255],
8086 darkblue:[0,0,139],
8087 darkcyan:[0,139,139],
8088 darkgrey:[169,169,169],
8089 darkgreen:[0,100,0],
8090 darkkhaki:[189,183,107],
8091 darkmagenta:[139,0,139],
8092 darkolivegreen:[85,107,47],
8093 darkorange:[255,140,0],
8094 darkorchid:[153,50,204],
8095 darkred:[139,0,0],
8096 darksalmon:[233,150,122],
8097 darkviolet:[148,0,211],
8098 fuchsia:[255,0,255],
8099 gold:[255,215,0],
8100 green:[0,128,0],
8101 indigo:[75,0,130],
8102 khaki:[240,230,140],
8103 lightblue:[173,216,230],
8104 lightcyan:[224,255,255],
8105 lightgreen:[144,238,144],
8106 lightgrey:[211,211,211],
8107 lightpink:[255,182,193],
8108 lightyellow:[255,255,224],
8109 lime:[0,255,0],
8110 magenta:[255,0,255],
8111 maroon:[128,0,0],
8112 navy:[0,0,128],
8113 olive:[128,128,0],
8114 orange:[255,165,0],
8115 pink:[255,192,203],
8116 purple:[128,0,128],
8117 violet:[128,0,128],
8118 red:[255,0,0],
8119 silver:[192,192,192],
8120 white:[255,255,255],
8121 yellow:[255,255,0],
8122 transparent: [255,255,255]
8123};
8124
8125/*
8126 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
8127 *
8128 * Uses the built in easing capabilities added In jQuery 1.1
8129 * to offer multiple easing options
8130 *
8131 * TERMS OF USE - jQuery Easing
8132 *
8133 * Open source under the BSD License.
8134 *
8135 * Copyright 2008 George McGinley Smith
8136 * All rights reserved.
8137 *
8138 * Redistribution and use in source and binary forms, with or without modification,
8139 * are permitted provided that the following conditions are met:
8140 *
8141 * Redistributions of source code must retain the above copyright notice, this list of
8142 * conditions and the following disclaimer.
8143 * Redistributions in binary form must reproduce the above copyright notice, this list
8144 * of conditions and the following disclaimer in the documentation and/or other materials
8145 * provided with the distribution.
8146 *
8147 * Neither the name of the author nor the names of contributors may be used to endorse
8148 * or promote products derived from this software without specific prior written permission.
8149 *
8150 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
8151 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
8152 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
8153 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
8154 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
8155 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
8156 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
8157 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
8158 * OF THE POSSIBILITY OF SUCH DAMAGE.
8159 *
8160*/
8161
8162// t: current time, b: begInnIng value, c: change In value, d: duration
8163$.easing.jswing = $.easing.swing;
8164
8165$.extend($.easing,
8166{
8167 def: 'easeOutQuad',
8168 swing: function (x, t, b, c, d) {
8169 //alert($.easing.default);
8170 return $.easing[$.easing.def](x, t, b, c, d);
8171 },
8172 easeInQuad: function (x, t, b, c, d) {
8173 return c*(t/=d)*t + b;
8174 },
8175 easeOutQuad: function (x, t, b, c, d) {
8176 return -c *(t/=d)*(t-2) + b;
8177 },
8178 easeInOutQuad: function (x, t, b, c, d) {
8179 if ((t/=d/2) < 1) return c/2*t*t + b;
8180 return -c/2 * ((--t)*(t-2) - 1) + b;
8181 },
8182 easeInCubic: function (x, t, b, c, d) {
8183 return c*(t/=d)*t*t + b;
8184 },
8185 easeOutCubic: function (x, t, b, c, d) {
8186 return c*((t=t/d-1)*t*t + 1) + b;
8187 },
8188 easeInOutCubic: function (x, t, b, c, d) {
8189 if ((t/=d/2) < 1) return c/2*t*t*t + b;
8190 return c/2*((t-=2)*t*t + 2) + b;
8191 },
8192 easeInQuart: function (x, t, b, c, d) {
8193 return c*(t/=d)*t*t*t + b;
8194 },
8195 easeOutQuart: function (x, t, b, c, d) {
8196 return -c * ((t=t/d-1)*t*t*t - 1) + b;
8197 },
8198 easeInOutQuart: function (x, t, b, c, d) {
8199 if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
8200 return -c/2 * ((t-=2)*t*t*t - 2) + b;
8201 },
8202 easeInQuint: function (x, t, b, c, d) {
8203 return c*(t/=d)*t*t*t*t + b;
8204 },
8205 easeOutQuint: function (x, t, b, c, d) {
8206 return c*((t=t/d-1)*t*t*t*t + 1) + b;
8207 },
8208 easeInOutQuint: function (x, t, b, c, d) {
8209 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
8210 return c/2*((t-=2)*t*t*t*t + 2) + b;
8211 },
8212 easeInSine: function (x, t, b, c, d) {
8213 return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
8214 },
8215 easeOutSine: function (x, t, b, c, d) {
8216 return c * Math.sin(t/d * (Math.PI/2)) + b;
8217 },
8218 easeInOutSine: function (x, t, b, c, d) {
8219 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
8220 },
8221 easeInExpo: function (x, t, b, c, d) {
8222 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
8223 },
8224 easeOutExpo: function (x, t, b, c, d) {
8225 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
8226 },
8227 easeInOutExpo: function (x, t, b, c, d) {
8228 if (t==0) return b;
8229 if (t==d) return b+c;
8230 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
8231 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
8232 },
8233 easeInCirc: function (x, t, b, c, d) {
8234 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
8235 },
8236 easeOutCirc: function (x, t, b, c, d) {
8237 return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
8238 },
8239 easeInOutCirc: function (x, t, b, c, d) {
8240 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
8241 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
8242 },
8243 easeInElastic: function (x, t, b, c, d) {
8244 var s=1.70158;var p=0;var a=c;
8245 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
8246 if (a < Math.abs(c)) { a=c; var s=p/4; }
8247 else var s = p/(2*Math.PI) * Math.asin (c/a);
8248 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
8249 },
8250 easeOutElastic: function (x, t, b, c, d) {
8251 var s=1.70158;var p=0;var a=c;
8252 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
8253 if (a < Math.abs(c)) { a=c; var s=p/4; }
8254 else var s = p/(2*Math.PI) * Math.asin (c/a);
8255 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
8256 },
8257 easeInOutElastic: function (x, t, b, c, d) {
8258 var s=1.70158;var p=0;var a=c;
8259 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
8260 if (a < Math.abs(c)) { a=c; var s=p/4; }
8261 else var s = p/(2*Math.PI) * Math.asin (c/a);
8262 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
8263 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
8264 },
8265 easeInBack: function (x, t, b, c, d, s) {
8266 if (s == undefined) s = 1.70158;
8267 return c*(t/=d)*t*((s+1)*t - s) + b;
8268 },
8269 easeOutBack: function (x, t, b, c, d, s) {
8270 if (s == undefined) s = 1.70158;
8271 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
8272 },
8273 easeInOutBack: function (x, t, b, c, d, s) {
8274 if (s == undefined) s = 1.70158;
8275 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
8276 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
8277 },
8278 easeInBounce: function (x, t, b, c, d) {
8279 return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
8280 },
8281 easeOutBounce: function (x, t, b, c, d) {
8282 if ((t/=d) < (1/2.75)) {
8283 return c*(7.5625*t*t) + b;
8284 } else if (t < (2/2.75)) {
8285 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
8286 } else if (t < (2.5/2.75)) {
8287 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
8288 } else {
8289 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
8290 }
8291 },
8292 easeInOutBounce: function (x, t, b, c, d) {
8293 if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
8294 return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
8295 }
8296});
8297
8298/*
8299 *
8300 * TERMS OF USE - EASING EQUATIONS
8301 *
8302 * Open source under the BSD License.
8303 *
8304 * Copyright 2001 Robert Penner
8305 * All rights reserved.
8306 *
8307 * Redistribution and use in source and binary forms, with or without modification,
8308 * are permitted provided that the following conditions are met:
8309 *
8310 * Redistributions of source code must retain the above copyright notice, this list of
8311 * conditions and the following disclaimer.
8312 * Redistributions in binary form must reproduce the above copyright notice, this list
8313 * of conditions and the following disclaimer in the documentation and/or other materials
8314 * provided with the distribution.
8315 *
8316 * Neither the name of the author nor the names of contributors may be used to endorse
8317 * or promote products derived from this software without specific prior written permission.
8318 *
8319 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
8320 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
8321 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
8322 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
8323 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
8324 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
8325 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
8326 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
8327 * OF THE POSSIBILITY OF SUCH DAMAGE.
8328 *
8329 */
8330
8331})(jQuery);
8332/*
8333 * jQuery UI Effects Blind 1.7.2
8334 *
8335 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8336 * Dual licensed under the MIT (MIT-LICENSE.txt)
8337 * and GPL (GPL-LICENSE.txt) licenses.
8338 *
8339 * http://docs.jquery.com/UI/Effects/Blind
8340 *
8341 * Depends:
8342 * effects.core.js
8343 */
8344(function($) {
8345
8346$.effects.blind = function(o) {
8347
8348 return this.queue(function() {
8349
8350 // Create element
8351 var el = $(this), props = ['position','top','left'];
8352
8353 // Set options
8354 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
8355 var direction = o.options.direction || 'vertical'; // Default direction
8356
8357 // Adjust
8358 $.effects.save(el, props); el.show(); // Save & Show
8359 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
8360 var ref = (direction == 'vertical') ? 'height' : 'width';
8361 var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
8362 if(mode == 'show') wrapper.css(ref, 0); // Shift
8363
8364 // Animation
8365 var animation = {};
8366 animation[ref] = mode == 'show' ? distance : 0;
8367
8368 // Animate
8369 wrapper.animate(animation, o.duration, o.options.easing, function() {
8370 if(mode == 'hide') el.hide(); // Hide
8371 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8372 if(o.callback) o.callback.apply(el[0], arguments); // Callback
8373 el.dequeue();
8374 });
8375
8376 });
8377
8378};
8379
8380})(jQuery);
8381/*
8382 * jQuery UI Effects Bounce 1.7.2
8383 *
8384 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8385 * Dual licensed under the MIT (MIT-LICENSE.txt)
8386 * and GPL (GPL-LICENSE.txt) licenses.
8387 *
8388 * http://docs.jquery.com/UI/Effects/Bounce
8389 *
8390 * Depends:
8391 * effects.core.js
8392 */
8393(function($) {
8394
8395$.effects.bounce = function(o) {
8396
8397 return this.queue(function() {
8398
8399 // Create element
8400 var el = $(this), props = ['position','top','left'];
8401
8402 // Set options
8403 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
8404 var direction = o.options.direction || 'up'; // Default direction
8405 var distance = o.options.distance || 20; // Default distance
8406 var times = o.options.times || 5; // Default # of times
8407 var speed = o.duration || 250; // Default speed per bounce
8408 if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
8409
8410 // Adjust
8411 $.effects.save(el, props); el.show(); // Save & Show
8412 $.effects.createWrapper(el); // Create Wrapper
8413 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
8414 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
8415 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
8416 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
8417 if (mode == 'hide') distance = distance / (times * 2);
8418 if (mode != 'hide') times--;
8419
8420 // Animate
8421 if (mode == 'show') { // Show Bounce
8422 var animation = {opacity: 1};
8423 animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
8424 el.animate(animation, speed / 2, o.options.easing);
8425 distance = distance / 2;
8426 times--;
8427 };
8428 for (var i = 0; i < times; i++) { // Bounces
8429 var animation1 = {}, animation2 = {};
8430 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
8431 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
8432 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
8433 distance = (mode == 'hide') ? distance * 2 : distance / 2;
8434 };
8435 if (mode == 'hide') { // Last Bounce
8436 var animation = {opacity: 0};
8437 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
8438 el.animate(animation, speed / 2, o.options.easing, function(){
8439 el.hide(); // Hide
8440 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8441 if(o.callback) o.callback.apply(this, arguments); // Callback
8442 });
8443 } else {
8444 var animation1 = {}, animation2 = {};
8445 animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
8446 animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
8447 el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
8448 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8449 if(o.callback) o.callback.apply(this, arguments); // Callback
8450 });
8451 };
8452 el.queue('fx', function() { el.dequeue(); });
8453 el.dequeue();
8454 });
8455
8456};
8457
8458})(jQuery);
8459/*
8460 * jQuery UI Effects Clip 1.7.2
8461 *
8462 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8463 * Dual licensed under the MIT (MIT-LICENSE.txt)
8464 * and GPL (GPL-LICENSE.txt) licenses.
8465 *
8466 * http://docs.jquery.com/UI/Effects/Clip
8467 *
8468 * Depends:
8469 * effects.core.js
8470 */
8471(function($) {
8472
8473$.effects.clip = function(o) {
8474
8475 return this.queue(function() {
8476
8477 // Create element
8478 var el = $(this), props = ['position','top','left','height','width'];
8479
8480 // Set options
8481 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
8482 var direction = o.options.direction || 'vertical'; // Default direction
8483
8484 // Adjust
8485 $.effects.save(el, props); el.show(); // Save & Show
8486 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
8487 var animate = el[0].tagName == 'IMG' ? wrapper : el;
8488 var ref = {
8489 size: (direction == 'vertical') ? 'height' : 'width',
8490 position: (direction == 'vertical') ? 'top' : 'left'
8491 };
8492 var distance = (direction == 'vertical') ? animate.height() : animate.width();
8493 if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
8494
8495 // Animation
8496 var animation = {};
8497 animation[ref.size] = mode == 'show' ? distance : 0;
8498 animation[ref.position] = mode == 'show' ? 0 : distance / 2;
8499
8500 // Animate
8501 animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
8502 if(mode == 'hide') el.hide(); // Hide
8503 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8504 if(o.callback) o.callback.apply(el[0], arguments); // Callback
8505 el.dequeue();
8506 }});
8507
8508 });
8509
8510};
8511
8512})(jQuery);
8513/*
8514 * jQuery UI Effects Drop 1.7.2
8515 *
8516 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8517 * Dual licensed under the MIT (MIT-LICENSE.txt)
8518 * and GPL (GPL-LICENSE.txt) licenses.
8519 *
8520 * http://docs.jquery.com/UI/Effects/Drop
8521 *
8522 * Depends:
8523 * effects.core.js
8524 */
8525(function($) {
8526
8527$.effects.drop = function(o) {
8528
8529 return this.queue(function() {
8530
8531 // Create element
8532 var el = $(this), props = ['position','top','left','opacity'];
8533
8534 // Set options
8535 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
8536 var direction = o.options.direction || 'left'; // Default Direction
8537
8538 // Adjust
8539 $.effects.save(el, props); el.show(); // Save & Show
8540 $.effects.createWrapper(el); // Create Wrapper
8541 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
8542 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
8543 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
8544 if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
8545
8546 // Animation
8547 var animation = {opacity: mode == 'show' ? 1 : 0};
8548 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
8549
8550 // Animate
8551 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
8552 if(mode == 'hide') el.hide(); // Hide
8553 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8554 if(o.callback) o.callback.apply(this, arguments); // Callback
8555 el.dequeue();
8556 }});
8557
8558 });
8559
8560};
8561
8562})(jQuery);
8563/*
8564 * jQuery UI Effects Explode 1.7.2
8565 *
8566 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8567 * Dual licensed under the MIT (MIT-LICENSE.txt)
8568 * and GPL (GPL-LICENSE.txt) licenses.
8569 *
8570 * http://docs.jquery.com/UI/Effects/Explode
8571 *
8572 * Depends:
8573 * effects.core.js
8574 */
8575(function($) {
8576
8577$.effects.explode = function(o) {
8578
8579 return this.queue(function() {
8580
8581 var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
8582 var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
8583
8584 o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
8585 var el = $(this).show().css('visibility', 'hidden');
8586 var offset = el.offset();
8587
8588 //Substract the margins - not fixing the problem yet.
8589 offset.top -= parseInt(el.css("marginTop"),10) || 0;
8590 offset.left -= parseInt(el.css("marginLeft"),10) || 0;
8591
8592 var width = el.outerWidth(true);
8593 var height = el.outerHeight(true);
8594
8595 for(var i=0;i<rows;i++) { // =
8596 for(var j=0;j<cells;j++) { // ||
8597 el
8598 .clone()
8599 .appendTo('body')
8600 .wrap('<div></div>')
8601 .css({
8602 position: 'absolute',
8603 visibility: 'visible',
8604 left: -j*(width/cells),
8605 top: -i*(height/rows)
8606 })
8607 .parent()
8608 .addClass('ui-effects-explode')
8609 .css({
8610 position: 'absolute',
8611 overflow: 'hidden',
8612 width: width/cells,
8613 height: height/rows,
8614 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
8615 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
8616 opacity: o.options.mode == 'show' ? 0 : 1
8617 }).animate({
8618 left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
8619 top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
8620 opacity: o.options.mode == 'show' ? 1 : 0
8621 }, o.duration || 500);
8622 }
8623 }
8624
8625 // Set a timeout, to call the callback approx. when the other animations have finished
8626 setTimeout(function() {
8627
8628 o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
8629 if(o.callback) o.callback.apply(el[0]); // Callback
8630 el.dequeue();
8631
8632 $('div.ui-effects-explode').remove();
8633
8634 }, o.duration || 500);
8635
8636
8637 });
8638
8639};
8640
8641})(jQuery);
8642/*
8643 * jQuery UI Effects Fold 1.7.2
8644 *
8645 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8646 * Dual licensed under the MIT (MIT-LICENSE.txt)
8647 * and GPL (GPL-LICENSE.txt) licenses.
8648 *
8649 * http://docs.jquery.com/UI/Effects/Fold
8650 *
8651 * Depends:
8652 * effects.core.js
8653 */
8654(function($) {
8655
8656$.effects.fold = function(o) {
8657
8658 return this.queue(function() {
8659
8660 // Create element
8661 var el = $(this), props = ['position','top','left'];
8662
8663 // Set options
8664 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
8665 var size = o.options.size || 15; // Default fold size
8666 var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
8667 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
8668
8669 // Adjust
8670 $.effects.save(el, props); el.show(); // Save & Show
8671 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
8672 var widthFirst = ((mode == 'show') != horizFirst);
8673 var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
8674 var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
8675 var percent = /([0-9]+)%/.exec(size);
8676 if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
8677 if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
8678
8679 // Animation
8680 var animation1 = {}, animation2 = {};
8681 animation1[ref[0]] = mode == 'show' ? distance[0] : size;
8682 animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
8683
8684 // Animate
8685 wrapper.animate(animation1, duration, o.options.easing)
8686 .animate(animation2, duration, o.options.easing, function() {
8687 if(mode == 'hide') el.hide(); // Hide
8688 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
8689 if(o.callback) o.callback.apply(el[0], arguments); // Callback
8690 el.dequeue();
8691 });
8692
8693 });
8694
8695};
8696
8697})(jQuery);
8698/*
8699 * jQuery UI Effects Highlight 1.7.2
8700 *
8701 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8702 * Dual licensed under the MIT (MIT-LICENSE.txt)
8703 * and GPL (GPL-LICENSE.txt) licenses.
8704 *
8705 * http://docs.jquery.com/UI/Effects/Highlight
8706 *
8707 * Depends:
8708 * effects.core.js
8709 */
8710(function($) {
8711
8712$.effects.highlight = function(o) {
8713
8714 return this.queue(function() {
8715
8716 // Create element
8717 var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
8718
8719 // Set options
8720 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
8721 var color = o.options.color || "#ffff99"; // Default highlight color
8722 var oldColor = el.css("backgroundColor");
8723
8724 // Adjust
8725 $.effects.save(el, props); el.show(); // Save & Show
8726 el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
8727
8728 // Animation
8729 var animation = {backgroundColor: oldColor };
8730 if (mode == "hide") animation['opacity'] = 0;
8731
8732 // Animate
8733 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
8734 if(mode == "hide") el.hide();
8735 $.effects.restore(el, props);
8736 if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
8737 if(o.callback) o.callback.apply(this, arguments);
8738 el.dequeue();
8739 }});
8740
8741 });
8742
8743};
8744
8745})(jQuery);
8746/*
8747 * jQuery UI Effects Pulsate 1.7.2
8748 *
8749 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8750 * Dual licensed under the MIT (MIT-LICENSE.txt)
8751 * and GPL (GPL-LICENSE.txt) licenses.
8752 *
8753 * http://docs.jquery.com/UI/Effects/Pulsate
8754 *
8755 * Depends:
8756 * effects.core.js
8757 */
8758(function($) {
8759
8760$.effects.pulsate = function(o) {
8761
8762 return this.queue(function() {
8763
8764 // Create element
8765 var el = $(this);
8766
8767 // Set options
8768 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
8769 var times = o.options.times || 5; // Default # of times
8770 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
8771
8772 // Adjust
8773 if (mode == 'hide') times--;
8774 if (el.is(':hidden')) { // Show fadeIn
8775 el.css('opacity', 0);
8776 el.show(); // Show
8777 el.animate({opacity: 1}, duration, o.options.easing);
8778 times = times-2;
8779 }
8780
8781 // Animate
8782 for (var i = 0; i < times; i++) { // Pulsate
8783 el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing);
8784 };
8785 if (mode == 'hide') { // Last Pulse
8786 el.animate({opacity: 0}, duration, o.options.easing, function(){
8787 el.hide(); // Hide
8788 if(o.callback) o.callback.apply(this, arguments); // Callback
8789 });
8790 } else {
8791 el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){
8792 if(o.callback) o.callback.apply(this, arguments); // Callback
8793 });
8794 };
8795 el.queue('fx', function() { el.dequeue(); });
8796 el.dequeue();
8797 });
8798
8799};
8800
8801})(jQuery);
8802/*
8803 * jQuery UI Effects Scale 1.7.2
8804 *
8805 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8806 * Dual licensed under the MIT (MIT-LICENSE.txt)
8807 * and GPL (GPL-LICENSE.txt) licenses.
8808 *
8809 * http://docs.jquery.com/UI/Effects/Scale
8810 *
8811 * Depends:
8812 * effects.core.js
8813 */
8814(function($) {
8815
8816$.effects.puff = function(o) {
8817
8818 return this.queue(function() {
8819
8820 // Create element
8821 var el = $(this);
8822
8823 // Set options
8824 var options = $.extend(true, {}, o.options);
8825 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
8826 var percent = parseInt(o.options.percent,10) || 150; // Set default puff percent
8827 options.fade = true; // It's not a puff if it doesn't fade! :)
8828 var original = {height: el.height(), width: el.width()}; // Save original
8829
8830 // Adjust
8831 var factor = percent / 100;
8832 el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
8833
8834 // Animation
8835 options.from = el.from;
8836 options.percent = (mode == 'hide') ? percent : 100;
8837 options.mode = mode;
8838
8839 // Animate
8840 el.effect('scale', options, o.duration, o.callback);
8841 el.dequeue();
8842 });
8843
8844};
8845
8846$.effects.scale = function(o) {
8847
8848 return this.queue(function() {
8849
8850 // Create element
8851 var el = $(this);
8852
8853 // Set options
8854 var options = $.extend(true, {}, o.options);
8855 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
8856 var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
8857 var direction = o.options.direction || 'both'; // Set default axis
8858 var origin = o.options.origin; // The origin of the scaling
8859 if (mode != 'effect') { // Set default origin and restore for show/hide
8860 options.origin = origin || ['middle','center'];
8861 options.restore = true;
8862 }
8863 var original = {height: el.height(), width: el.width()}; // Save original
8864 el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
8865
8866 // Adjust
8867 var factor = { // Set scaling factor
8868 y: direction != 'horizontal' ? (percent / 100) : 1,
8869 x: direction != 'vertical' ? (percent / 100) : 1
8870 };
8871 el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
8872
8873 if (o.options.fade) { // Fade option to support puff
8874 if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
8875 if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
8876 };
8877
8878 // Animation
8879 options.from = el.from; options.to = el.to; options.mode = mode;
8880
8881 // Animate
8882 el.effect('size', options, o.duration, o.callback);
8883 el.dequeue();
8884 });
8885
8886};
8887
8888$.effects.size = function(o) {
8889
8890 return this.queue(function() {
8891
8892 // Create element
8893 var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
8894 var props1 = ['position','top','left','overflow','opacity']; // Always restore
8895 var props2 = ['width','height','overflow']; // Copy for children
8896 var cProps = ['fontSize'];
8897 var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
8898 var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
8899
8900 // Set options
8901 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
8902 var restore = o.options.restore || false; // Default restore
8903 var scale = o.options.scale || 'both'; // Default scale mode
8904 var origin = o.options.origin; // The origin of the sizing
8905 var original = {height: el.height(), width: el.width()}; // Save original
8906 el.from = o.options.from || original; // Default from state
8907 el.to = o.options.to || original; // Default to state
8908 // Adjust
8909 if (origin) { // Calculate baseline shifts
8910 var baseline = $.effects.getBaseline(origin, original);
8911 el.from.top = (original.height - el.from.height) * baseline.y;
8912 el.from.left = (original.width - el.from.width) * baseline.x;
8913 el.to.top = (original.height - el.to.height) * baseline.y;
8914 el.to.left = (original.width - el.to.width) * baseline.x;
8915 };
8916 var factor = { // Set scaling factor
8917 from: {y: el.from.height / original.height, x: el.from.width / original.width},
8918 to: {y: el.to.height / original.height, x: el.to.width / original.width}
8919 };
8920 if (scale == 'box' || scale == 'both') { // Scale the css box
8921 if (factor.from.y != factor.to.y) { // Vertical props scaling
8922 props = props.concat(vProps);
8923 el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
8924 el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
8925 };
8926 if (factor.from.x != factor.to.x) { // Horizontal props scaling
8927 props = props.concat(hProps);
8928 el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
8929 el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
8930 };
8931 };
8932 if (scale == 'content' || scale == 'both') { // Scale the content
8933 if (factor.from.y != factor.to.y) { // Vertical props scaling
8934 props = props.concat(cProps);
8935 el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
8936 el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
8937 };
8938 };
8939 $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
8940 $.effects.createWrapper(el); // Create Wrapper
8941 el.css('overflow','hidden').css(el.from); // Shift
8942
8943 // Animate
8944 if (scale == 'content' || scale == 'both') { // Scale the children
8945 vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
8946 hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
8947 props2 = props.concat(vProps).concat(hProps); // Concat
8948 el.find("*[width]").each(function(){
8949 child = $(this);
8950 if (restore) $.effects.save(child, props2);
8951 var c_original = {height: child.height(), width: child.width()}; // Save original
8952 child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
8953 child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
8954 if (factor.from.y != factor.to.y) { // Vertical props scaling
8955 child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
8956 child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
8957 };
8958 if (factor.from.x != factor.to.x) { // Horizontal props scaling
8959 child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
8960 child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
8961 };
8962 child.css(child.from); // Shift children
8963 child.animate(child.to, o.duration, o.options.easing, function(){
8964 if (restore) $.effects.restore(child, props2); // Restore children
8965 }); // Animate children
8966 });
8967 };
8968
8969 // Animate
8970 el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
8971 if(mode == 'hide') el.hide(); // Hide
8972 $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
8973 if(o.callback) o.callback.apply(this, arguments); // Callback
8974 el.dequeue();
8975 }});
8976
8977 });
8978
8979};
8980
8981})(jQuery);
8982/*
8983 * jQuery UI Effects Shake 1.7.2
8984 *
8985 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8986 * Dual licensed under the MIT (MIT-LICENSE.txt)
8987 * and GPL (GPL-LICENSE.txt) licenses.
8988 *
8989 * http://docs.jquery.com/UI/Effects/Shake
8990 *
8991 * Depends:
8992 * effects.core.js
8993 */
8994(function($) {
8995
8996$.effects.shake = function(o) {
8997
8998 return this.queue(function() {
8999
9000 // Create element
9001 var el = $(this), props = ['position','top','left'];
9002
9003 // Set options
9004 var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
9005 var direction = o.options.direction || 'left'; // Default direction
9006 var distance = o.options.distance || 20; // Default distance
9007 var times = o.options.times || 3; // Default # of times
9008 var speed = o.duration || o.options.duration || 140; // Default speed per shake
9009
9010 // Adjust
9011 $.effects.save(el, props); el.show(); // Save & Show
9012 $.effects.createWrapper(el); // Create Wrapper
9013 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
9014 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
9015
9016 // Animation
9017 var animation = {}, animation1 = {}, animation2 = {};
9018 animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
9019 animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
9020 animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
9021
9022 // Animate
9023 el.animate(animation, speed, o.options.easing);
9024 for (var i = 1; i < times; i++) { // Shakes
9025 el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
9026 };
9027 el.animate(animation1, speed, o.options.easing).
9028 animate(animation, speed / 2, o.options.easing, function(){ // Last shake
9029 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
9030 if(o.callback) o.callback.apply(this, arguments); // Callback
9031 });
9032 el.queue('fx', function() { el.dequeue(); });
9033 el.dequeue();
9034 });
9035
9036};
9037
9038})(jQuery);
9039/*
9040 * jQuery UI Effects Slide 1.7.2
9041 *
9042 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
9043 * Dual licensed under the MIT (MIT-LICENSE.txt)
9044 * and GPL (GPL-LICENSE.txt) licenses.
9045 *
9046 * http://docs.jquery.com/UI/Effects/Slide
9047 *
9048 * Depends:
9049 * effects.core.js
9050 */
9051(function($) {
9052
9053$.effects.slide = function(o) {
9054
9055 return this.queue(function() {
9056
9057 // Create element
9058 var el = $(this), props = ['position','top','left'];
9059
9060 // Set options
9061 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
9062 var direction = o.options.direction || 'left'; // Default Direction
9063
9064 // Adjust
9065 $.effects.save(el, props); el.show(); // Save & Show
9066 $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
9067 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
9068 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
9069 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
9070 if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
9071
9072 // Animation
9073 var animation = {};
9074 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
9075
9076 // Animate
9077 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
9078 if(mode == 'hide') el.hide(); // Hide
9079 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
9080 if(o.callback) o.callback.apply(this, arguments); // Callback
9081 el.dequeue();
9082 }});
9083
9084 });
9085
9086};
9087
9088})(jQuery);
9089/*
9090 * jQuery UI Effects Transfer 1.7.2
9091 *
9092 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
9093 * Dual licensed under the MIT (MIT-LICENSE.txt)
9094 * and GPL (GPL-LICENSE.txt) licenses.
9095 *
9096 * http://docs.jquery.com/UI/Effects/Transfer
9097 *
9098 * Depends:
9099 * effects.core.js
9100 */
9101(function($) {
9102
9103$.effects.transfer = function(o) {
9104 return this.queue(function() {
9105 var elem = $(this),
9106 target = $(o.options.to),
9107 endPosition = target.offset(),
9108 animation = {
9109 top: endPosition.top,
9110 left: endPosition.left,
9111 height: target.innerHeight(),
9112 width: target.innerWidth()
9113 },
9114 startPosition = elem.offset(),
9115 transfer = $('<div class="ui-effects-transfer"></div>')
9116 .appendTo(document.body)
9117 .addClass(o.options.className)
9118 .css({
9119 top: startPosition.top,
9120 left: startPosition.left,
9121 height: elem.innerHeight(),
9122 width: elem.innerWidth(),
9123 position: 'absolute'
9124 })
9125 .animate(animation, o.duration, o.options.easing, function() {
9126 transfer.remove();
9127 (o.callback && o.callback.apply(elem[0], arguments));
9128 elem.dequeue();
9129 });
9130 });
9131};
9132
9133})(jQuery);