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)
165); 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/* 522* jQuery UI Dialog 1.7.2 523* 524* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) 525* Dual licensed under the MIT (MIT-LICENSE.txt) 526* and GPL (GPL-LICENSE.txt) licenses. 527* 528* http://docs.jquery.com/UI/Dialog 529* 530* Depends: 531* ui.core.js 532* ui.draggable.js 533* ui.resizable.js 534*/ 535(function ($) { 536 537 var setDataSwitch = { 538 dragStart: "start.draggable", 539 drag: "drag.draggable", 540 dragStop: "stop.draggable", 541 maxHeight: "maxHeight.resizable", 542 minHeight: "minHeight.resizable", 543 maxWidth: "maxWidth.resizable", 544 minWidth: "minWidth.resizable", 545 resizeStart: "start.resizable", 546 resize: "drag.resizable", 547 resizeStop: "stop.resizable" 548 }, 549 550 uiDialogClasses = 551 'ui-dialog ' + 552 'ui-widget ' + 553 'ui-widget-content ' + 554 'ui-corner-all '; 555 556 $.widget("ui.dialog", { 557 558 _init: function () { 559 this.originalTitle = this.element.attr('title'); 560 561 var self = this, 562 options = this.options, 563 564 title = options.title || this.originalTitle || ' ', 565 titleId = $.ui.dialog.getTitleId(this.element), 566 567 uiDialog = (this.uiDialog = $('<div/>')) 568 //.appendTo(document.body) 569 .appendTo((document.forms[0] != null) ? document.forms[0] : document.body) 570 .hide() 571 .addClass(uiDialogClasses + options.dialogClass) 572 .css({ 573 position: 'absolute', 574 overflow: 'hidden', 575 zIndex: options.zIndex 576 }) 577 // setting tabIndex makes the div focusable 578 // setting outline to 0 prevents a border on focus in Mozilla 579 .attr('tabIndex', -1).css('outline', 0).keydown(function (event) { 580 (options.closeOnEscape && event.keyCode 581 && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event)); 582 }) 583 .attr({ 584 role: 'dialog', 585 'aria-labelledby': titleId 586 }) 587 .mousedown(function (event) { 588 self.moveToTop(false, event); 589 }), 590 591 uiDialogContent = this.element 592 .show() 593 .removeAttr('title') 594 .addClass( 595 'ui-dialog-content ' + 596 'ui-widget-content') 597 .appendTo(uiDialog), 598 599 uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>')) 600 .addClass( 601 'ui-dialog-titlebar ' + 602 'ui-widget-header ' + 603 'ui-corner-all ' + 604 'ui-helper-clearfix' 605 ) 606 .prependTo(uiDialog), 607 608 uiDialogTitlebarClose = $('<a href="#"/>') 609 .addClass( 610 'ui-dialog-titlebar-close ' + 611 'ui-corner-all' 612 ) 613 .attr('role', 'button') 614 .hover( 615 function () { 616 uiDialogTitlebarClose.addClass('ui-state-hover'); 617 }, 618 function () { 619 uiDialogTitlebarClose.removeClass('ui-state-hover'); 620 } 621 ) 622 .focus(function () { 623 uiDialogTitlebarClose.addClass('ui-state-focus'); 624 }) 625 .blur(function () { 626 uiDialogTitlebarClose.removeClass('ui-state-focus'); 627 }) 628 .mousedown(function (ev) { 629 ev.stopPropagation(); 630 }) 631 .click(function (event) { 632 self.close(event); 633 return false; 634 }) 635 .appendTo(uiDialogTitlebar), 636 637 uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>')) 638 .addClass( 639 'ui-icon ' + 640 'ui-icon-closethick' 641 )
642 .text(options.closeText) 643 .appendTo(uiDialogTitlebarClose), 644 645 uiDialogTitle = $('<span/>') 646 .addClass('ui-dialog-title') 647 .attr('id', titleId) 648 .html(title) 649 .prependTo(uiDialogTitlebar); 650 651 uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); 652 653 (options.draggable && $.fn.draggable && this._makeDraggable()); 654 (options.resizable && $.fn.resizable && this._makeResizable()); 655 656 this._createButtons(options.buttons); 657 this._isOpen = false; 658 659 (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); 660 (options.autoOpen && this.open()); 661 662 }, 663 664 destroy: function () { 665 (this.overlay && this.overlay.destroy()); 666 this.uiDialog.hide(); 667 this.element 668 .unbind('.dialog') 669 .removeData('dialog') 670 .removeClass('ui-dialog-content ui-widget-content') 671 .hide().appendTo('body'); 672 this.uiDialog.remove(); 673 674 (this.originalTitle && this.element.attr('title', this.originalTitle)); 675 }, 676 677 close: function (event) { 678 var self = this; 679 680 if (false === self._trigger('beforeclose', event)) { 681 return; 682 } 683 684 (self.overlay && self.overlay.destroy()); 685 self.uiDialog.unbind('keypress.ui-dialog'); 686 687 (self.options.hide 688 ? self.uiDialog.hide(self.options.hide, function () { 689 self._trigger('close', event); 690 }) 691 : self.uiDialog.hide() && self._trigger('close', event)); 692 693 $.ui.dialog.overlay.resize(); 694 695 self._isOpen = false; 696 697 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 698 if (self.options.modal) { 699 var maxZ = 0; 700 $('.ui-dialog').each(function () { 701 if (this != self.uiDialog[0]) { 702 maxZ = Math.max(maxZ, $(this).css('z-index')); 703 } 704 }); 705 $.ui.dialog.maxZ = maxZ; 706 } 707 }, 708 709 isOpen: function () { 710 return this._isOpen; 711 }, 712 713 // the force parameter allows us to move modal dialogs to their correct 714 // position on open 715 moveToTop: function (force, event) { 716 717 if ((this.options.modal && !force) 718 || (!this.options.stack && !this.options.modal)) { 719 return this._trigger('focus', event); 720 } 721 722 if (this.options.zIndex > $.ui.dialog.maxZ) { 723 $.ui.dialog.maxZ = this.options.zIndex; 724 } 725 (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ)); 726 727 //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. 728 // http://ui.jquery.com/bugs/ticket/3193 729 var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; 730 this.uiDialog.css('z-index', ++$.ui.dialog.maxZ); 731 this.element.attr(saveScroll); 732 this._trigger('focus', event); 733 }, 734 735 open: function () { 736 if (this._isOpen) { return; } 737 738 var options = this.options, 739 uiDialog = this.uiDialog; 740 741 this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null; 742 //(uiDialog.next().length && uiDialog.appendTo('body')); 743 (uiDialog.next().length && uiDialog.appendTo('form')); 744 this._size(); 745 this._position(options.position); 746 uiDialog.show(options.show); 747 this.moveToTop(true); 748 749 // prevent tabbing out of modal dialogs 750 (options.modal && uiDialog.bind('keypress.ui-dialog', function (event) { 751 if (event.keyCode != $.ui.keyCode.TAB) { 752 return; 753 } 754 755 var tabbables = $(':tabbable', this), 756 first = tabbables.filter(':first')[0], 757 last = tabbables.filter(':last')[0]; 758 759 if (event.target == last && !event.shiftKey) { 760 setTimeout(function () { 761 first.focus(); 762 }, 1); 763 } else if (event.target == first && event.shiftKey) { 764 setTimeout(function () { 765 last.focus(); 766 }, 1); 767 } 768 })); 769 770 // set focus to the first tabbable element in the content area or the first button 771 // if there are no tabbable elements, set focus on the dialog itself 772 $([]) 773 .add(uiDialog.find('.ui-dialog-content :tabbable:first')) 774 .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) 775 .add(uiDialog) 776 .filter(':first') 777 .focus(); 778 779 this._trigger('open'); 780 this._isOpen = true; 781 }, 782 783 _createButtons: function (buttons) { 784 var self = this, 785 hasButtons = false,
786 uiDialogButtonPane = $('<div></div>') 787 .addClass( 788 'ui-dialog-buttonpane ' + 789 'ui-widget-content ' + 790 'ui-helper-clearfix' 791 ); 792 793 // if we already have a button pane, remove it 794 this.uiDialog.find('.ui-dialog-buttonpane').remove(); 795 796 (typeof buttons == 'object' && buttons !== null && 797 $.each(buttons, function () { return !(hasButtons = true); })); 798 if (hasButtons) { 799 $.each(buttons, function (name, fn) { 800 $('<button type="button"></button>') 801 .addClass( 802 'ui-state-default ' + 803 'ui-corner-all' 804 ) 805 .text(name) 806 .click(function () { fn.apply(self.element[0], arguments); }) 807 .hover( 808 function () { 809 $(this).addClass('ui-state-hover'); 810 }, 811 function () { 812 $(this).removeClass('ui-state-hover'); 813 } 814 ) 815 .focus(function () { 816 $(this).addClass('ui-state-focus'); 817 }) 818 .blur(function () { 819 $(this).removeClass('ui-state-focus'); 820 }) 821 .appendTo(uiDialogButtonPane); 822 }); 823 uiDialogButtonPane.appendTo(this.uiDialog); 824 } 825 }, 826 827 _makeDraggable: function () { 828 var self = this, 829 options = this.options, 830 heightBeforeDrag; 831 832 this.uiDialog.draggable({ 833 cancel: '.ui-dialog-content', 834 handle: '.ui-dialog-titlebar', 835 containment: 'document', 836 start: function () { 837 heightBeforeDrag = options.height; 838 $(this).height($(this).height()).addClass("ui-dialog-dragging"); 839 (options.dragStart && options.dragStart.apply(self.element[0], arguments)); 840 }, 841 drag: function () { 842 (options.drag && options.drag.apply(self.element[0], arguments)); 843 }, 844 stop: function () { 845 $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); 846 (options.dragStop && options.dragStop.apply(self.element[0], arguments)); 847 $.ui.dialog.overlay.resize(); 848 } 849 }); 850 }, 851 852 _makeResizable: function (handles) { 853 handles = (handles === undefined ? this.options.resizable : handles); 854 var self = this, 855 options = this.options, 856 resizeHandles = typeof handles == 'string' 857 ? handles 858 : 'n,e,s,w,se,sw,ne,nw'; 859 860 this.uiDialog.resizable({ 861 cancel: '.ui-dialog-content', 862 alsoResize: this.element, 863 maxWidth: options.maxWidth, 864 maxHeight: options.maxHeight, 865 minWidth: options.minWidth, 866 minHeight: options.minHeight, 867 start: function () { 868 $(this).addClass("ui-dialog-resizing"); 869 (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); 870 }, 871 resize: function () { 872 (options.resize && options.resize.apply(self.element[0], arguments)); 873 }, 874 handles: resizeHandles, 875 stop: function () { 876 $(this).removeClass("ui-dialog-resizing"); 877 options.height = $(this).height(); 878 options.width = $(this).width(); 879 (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); 880 $.ui.dialog.overlay.resize(); 881 } 882 }) 883 .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); 884 }, 885 886 _position: function (pos) { 887 var wnd = $(window), doc = $(document), 888 pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), 889 minTop = pTop; 890 891 if ($.inArray(pos, ['center', 'top', 'right', 'bottom', 'left']) >= 0) { 892 pos = [ 893 pos == 'right' || pos == 'left' ? pos : 'center', 894 pos == 'top' || pos == 'bottom' ? pos : 'middle' 895 ]; 896 } 897 if (pos.constructor != Array) { 898 pos = ['center', 'middle']; 899 } 900 if (pos[0].constructor == Number) { 901 pLeft += pos[0]; 902 } else { 903 switch (pos[0]) { 904 case 'left': 905 pLeft += 0;
906 break; 907 case 'right': 908 pLeft += wnd.width() - this.uiDialog.outerWidth(); 909 break; 910 default: 911 case 'center': 912 pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; 913 } 914 } 915 if (pos[1].constructor == Number) { 916 pTop += pos[1]; 917 } else { 918 switch (pos[1]) { 919 case 'top': 920 pTop += 0; 921 break; 922 case 'bottom': 923 pTop += wnd.height() - this.uiDialog.outerHeight(); 924 break; 925 default: 926 case 'middle': 927 pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2; 928 } 929 } 930 931 // prevent the dialog from being too high (make sure the titlebar 932 // is accessible) 933 pTop = Math.max(pTop, minTop); 934 this.uiDialog.css({ top: pTop, left: pLeft }); 935 }, 936 937 _setData: function (key, value) { 938 (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); 939 switch (key) { 940 case "buttons": 941 this._createButtons(value); 942 break; 943 case "closeText": 944 this.uiDialogTitlebarCloseText.text(value); 945 break; 946 case "dialogClass": 947 this.uiDialog 948 .removeClass(this.options.dialogClass) 949 .addClass(uiDialogClasses + value); 950 break; 951 case "draggable": 952 (value 953 ? this._makeDraggable() 954 : this.uiDialog.draggable('destroy')); 955 break; 956 case "height": 957 this.uiDialog.height(value); 958 break; 959 case "position": 960 this._position(value); 961 break; 962 case "resizable": 963 var uiDialog = this.uiDialog, 964 isResizable = this.uiDialog.is(':data(resizable)'); 965 966 // currently resizable, becoming non-resizable 967 (isResizable && !value && uiDialog.resizable('destroy')); 968 969 // currently resizable, changing handles 970 (isResizable && typeof value == 'string' && 971 uiDialog.resizable('option', 'handles', value)); 972 973 // currently non-resizable, becoming resizable 974 (isResizable || this._makeResizable(value)); 975 break; 976 case "title": 977 $(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' '); 978 break; 979 case "width": 980 this.uiDialog.width(value); 981 break; 982 } 983 984 $.widget.prototype._setData.apply(this, arguments); 985 }, 986 987 _size: function () { 988 /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 989 * divs will both have width and height set, so we need to reset them 990 */ 991 var options = this.options; 992 993 // reset content sizing 994 this.element.css({ 995 height: 0, 996 minHeight: 0, 997 width: 'auto' 998 }); 999 1000 // reset wrapper sizing 1001 // determine the height of all the non-content elements 1002 var nonContentHeight = this.uiDialog.css({ 1003 height: 'auto', 1004 width: options.width 1005 }) 1006 .height(); 1007 1008 this.element 1009 .css({ 1010 minHeight: Math.max(options.minHeight - nonContentHeight, 0), 1011 height: options.height == 'auto' 1012 ? 'auto' 1013 : Math.max(options.height - nonContentHeight, 0) 1014 }); 1015 } 1016 }); 1017 1018 $.extend($.ui.dialog, { 1019 version: "1.7.2", 1020 defaults: { 1021 autoOpen: true, 1022 bgiframe: false, 1023 buttons: {}, 1024 closeOnEscape: true, 1025 closeText: 'close', 1026 dialogClass: '', 1027 draggable: true, 1028 hide: null, 1029 height: 'auto', 1030 maxHeight: false, 1031 maxWidth: false, 1032 minHeight: 150, 1033 minWidth: 150, 1034 modal: false, 1035 position: 'center', 1036 resizable: true, 1037 show: null, 1038 stack: true, 1039 title: '', 1040 width: 300, 1041 zIndex: 1000 1042 }, 1043 1044 getter: 'isOpen', 1045 1046 uuid: 0, 1047 maxZ: 0, 1048 1049 getTitleId: function ($el) { 1050 return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); 1051 }, 1052 1053 overlay: function (dialog) { 1054 this.$el = $.ui.dialog.overlay.create(dialog); 1055 } 1056 });
1057 1058 $.extend($.ui.dialog.overlay, { 1059 instances: [], 1060 maxZ: 0, 1061 events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), 1062 function (event) { return event + '.dialog-overlay'; }).join(' '), 1063 create: function (dialog) { 1064 if (this.instances.length === 0) { 1065 // prevent use of anchors and inputs 1066 // we use a setTimeout in case the overlay is created from an 1067 // event that we're going to be cancelling (see #2804) 1068 setTimeout(function () { 1069 // handle $(el).dialog().dialog('close') (see #4065) 1070 if ($.ui.dialog.overlay.instances.length) { 1071 $(document).bind($.ui.dialog.overlay.events, function (event) { 1072 var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0; 1073 return (dialogZ > $.ui.dialog.overlay.maxZ); 1074 }); 1075 } 1076 }, 1); 1077 1078 // allow closing by pressing the escape key 1079 $(document).bind('keydown.dialog-overlay', function (event) { 1080 (dialog.options.closeOnEscape && event.keyCode 1081 && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event)); 1082 }); 1083 1084 // handle window resize 1085 $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); 1086 } 1087 1088 //var $el = $('<div></div>').appendTo(document.body) 1089 var $el = $('<div></div>').appendTo((document.forms[0] != null) ? document.forms[0] : document.body) 1090 .addClass('ui-widget-overlay').css({ 1091 width: this.width(), 1092 height: this.height() 1093 }); 1094 1095 (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); 1096 1097 this.instances.push($el); 1098 return $el; 1099 }, 1100 1101 destroy: function ($el) { 1102 this.instances.splice($.inArray(this.instances, $el), 1); 1103 1104 if (this.instances.length === 0) { 1105 $([document, window]).unbind('.dialog-overlay'); 1106 } 1107 1108 $el.remove(); 1109 1110 // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) 1111 var maxZ = 0; 1112 $.each(this.instances, function () { 1113 maxZ = Math.max(maxZ, this.css('z-index')); 1114 }); 1115 this.maxZ = maxZ; 1116 }, 1117 1118 height: function () { 1119 // handle IE 6 1120 if ($.browser.msie && $.browser.version < 7) { 1121 var scrollHeight = Math.max( 1122 document.documentElement.scrollHeight, 1123 document.body.scrollHeight 1124 ); 1125 var offsetHeight = Math.max( 1126 document.documentElement.offsetHeight, 1127 document.body.offsetHeight 1128 ); 1129 1130 if (scrollHeight < offsetHeight) { 1131 return $(window).height() + 'px'; 1132 } else { 1133 return scrollHeight + 'px'; 1134 } 1135 // handle "good" browsers 1136 } else { 1137 return $(document).height() + 'px'; 1138 } 1139 }, 1140 1141 width: function () { 1142 // handle IE 6 1143 if ($.browser.msie && $.browser.version < 7) { 1144 var scrollWidth = Math.max( 1145 document.documentElement.scrollWidth, 1146 document.body.scrollWidth 1147 ); 1148 var offsetWidth = Math.max( 1149 document.documentElement.offsetWidth, 1150 document.body.offsetWidth 1151 ); 1152 1153 if (scrollWidth < offsetWidth) { 1154 return $(window).width() + 'px'; 1155 } else { 1156 return scrollWidth + 'px'; 1157 } 1158 // handle "good" browsers 1159 } else { 1160 return $(document).width() + 'px'; 1161 } 1162 }, 1163 1164 resize: function () { 1165 /* If the dialog is draggable and the user drags it past the 1166 * right edge of the window, the document becomes wider so we 1167 * need to stretch the overlay. If the user then drags the 1168 * dialog back to the left, the document will become narrower, 1169 * so we need to shrink the overlay to the appropriate size. 1170 * This is handled by shrinking the overlay before setting it 1171 * to the full document size. 1172 */ 1173 var $overlays = $([]); 1174 $.each($.ui.dialog.overlay.instances, function () { 1175 $overlays = $overlays.add(this); 1176 }); 1177 1178 $overlays.css({ 1179 width: 0, 1180 height: 0 1181 }).css({ 1182 width: $.ui.dialog.overlay.width(), 1183 height: $.ui.dialog.overlay.height() 1184 }); 1185 } 1186 });
1187 1188 $.extend($.ui.dialog.overlay.prototype, { 1189 destroy: function () { 1190 $.ui.dialog.overlay.destroy(this.$el); 1191 } 1192 }); 1193 1194})(jQuery); 1195 1196/* 1197* jQuery UI Effects 1.7.2 1198* 1199* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) 1200* Dual licensed under the MIT (MIT-LICENSE.txt) 1201* and GPL (GPL-LICENSE.txt) licenses. 1202* 1203* http://docs.jquery.com/UI/Effects/ 1204*/ 1205; jQuery.effects || (function ($) { 1206 1207 $.effects = { 1208 version: "1.7.2", 1209 1210 // Saves a set of properties in a data storage 1211 save: function (element, set) { 1212 for (var i = 0; i < set.length; i++) { 1213 if (set[i] !== null) element.data("ec.storage." + set[i], element[0].style[set[i]]); 1214 } 1215 }, 1216 1217 // Restores a set of previously saved properties from a data storage 1218 restore: function (element, set) { 1219 for (var i = 0; i < set.length; i++) { 1220 if (set[i] !== null) element.css(set[i], element.data("ec.storage." + set[i])); 1221 } 1222 }, 1223 1224 setMode: function (el, mode) { 1225 if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle 1226 return mode; 1227 }, 1228 1229 getBaseline: function (origin, original) { // Translates a [top,left] array into a baseline value 1230 // this should be a little more flexible in the future to handle a string & hash 1231 var y, x; 1232 switch (origin[0]) { 1233 case 'top': y = 0; break; 1234 case 'middle': y = 0.5; break; 1235 case 'bottom': y = 1; break; 1236 default: y = origin[0] / original.height; 1237 }; 1238 switch (origin[1]) { 1239 case 'left': x = 0; break; 1240 case 'center': x = 0.5; break; 1241 case 'right': x = 1; break; 1242 default: x = origin[1] / original.width; 1243 }; 1244 return { x: x, y: y }; 1245 }, 1246 1247 // Wraps the element around a wrapper that copies position properties 1248 createWrapper: function (element) { 1249 1250 //if the element is already wrapped, return it 1251 if (element.parent().is('.ui-effects-wrapper')) 1252 return element.parent(); 1253 1254 //Cache width,height and float properties of the element, and create a wrapper around it 1255 var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') }; 1256 element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>'); 1257 var wrapper = element.parent(); 1258 1259 //Transfer the positioning of the element to the wrapper 1260 if (element.css('position') == 'static') { 1261 wrapper.css({ position: 'relative' }); 1262 element.css({ position: 'relative' }); 1263 } else { 1264 var top = element.css('top'); if (isNaN(parseInt(top, 10))) top = 'auto'; 1265 var left = element.css('left'); if (isNaN(parseInt(left, 10))) left = 'auto'; 1266 wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show(); 1267 element.css({ position: 'relative', top: 0, left: 0 }); 1268 } 1269 1270 wrapper.css(props); 1271 return wrapper; 1272 }, 1273 1274 removeWrapper: function (element) { 1275 if (element.parent().is('.ui-effects-wrapper')) 1276 return element.parent().replaceWith(element); 1277 return element; 1278 }, 1279 1280 setTransition: function (element, list, factor, value) { 1281 value = value || {}; 1282 $.each(list, function (i, x) { 1283 unit = element.cssUnit(x); 1284 if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; 1285 }); 1286 return value; 1287 }, 1288 1289 //Base function to animate from one class to another in a seamless transition 1290 animateClass: function (value, duration, easing, callback) { 1291 1292 var cb = (typeof easing == "function" ? easing : (callback ? callback : null)); 1293 var ea = (typeof easing == "string" ? easing : null); 1294 1295 return this.each(function () { 1296 1297 var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || ''; 1298 if (typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */ 1299 if (value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; } 1300 1301 //Let's get a style offset 1302 var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle)); 1303 if (value.add) that.addClass(value.add); if (value.remove) that.removeClass(value.remove); 1304 var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle)); 1305 if (value.add) that.removeClass(value.add); if (value.remove) that.addClass(value.remove); 1306 1307 // The main function to form the object for animation 1308 for (var n in newStyle) { 1309 if (typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */ 1310 && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */ 1311 && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */ 1312 && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n], 10)))) /* Only things that can be parsed to integers or colors */ 1313 && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */ 1314 ) offset[n] = newStyle[n]; 1315 } 1316 1317 that.animate(offset, duration, ea, function () { // Animate the newly constructed offset object 1318 // Change style attribute back to original. For stupid IE, we need to clear the damn object. 1319 if (typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr); 1320 if (value.add) $(this).addClass(value.add); if (value.remove) $(this).removeClass(value.remove); 1321 if (cb) cb.apply(this, arguments); 1322 }); 1323 1324 }); 1325 } 1326 }; 1327 1328 1329 function _normalizeArguments(a, m) { 1330 1331 var o = a[1] && a[1].constructor == Object ? a[1] : {}; if (m) o.mode = m; 1332 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 1333 speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default; 1334 var callback = o.callback || ($.isFunction(a[1]) && a[1]) || ($.isFunction(a[2]) && a[2]) || ($.isFunction(a[3]) && a[3]); 1335 1336 return [a[0], o, speed, callback]; 1337 1338 } 1339 1340 //Extend the methods of jQuery 1341 $.fn.extend({ 1342 1343 //Save old methods 1344 _show: $.fn.show, 1345 _hide: $.fn.hide, 1346 __toggle: $.fn.toggle, 1347 _addClass: $.fn.addClass, 1348 _removeClass: $.fn.removeClass, 1349 _toggleClass: $.fn.toggleClass, 1350 1351 // New effect methods 1352 effect: function (fx, options, speed, callback) { 1353 return $.effects[fx] ? $.effects[fx].call(this, { method: fx, options: options || {}, duration: speed, callback: callback }) : null; 1354 }, 1355 1356 show: function () { 1357 if (!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) 1358 return this._show.apply(this, arguments); 1359 else { 1360 return this.effect.apply(this, _normalizeArguments(arguments, 'show')); 1361 } 1362 }, 1363 1364 hide: function () { 1365 if (!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) 1366 return this._hide.apply(this, arguments); 1367 else { 1368 return this.effect.apply(this, _normalizeArguments(arguments, 'hide')); 1369 } 1370 }, 1371 1372 toggle: function () { 1373 if (!arguments[0] || 1374 (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || 1375 ($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) { 1376 return this.__toggle.apply(this, arguments); 1377 } else { 1378 return this.effect.apply(this, _normalizeArguments(arguments, 'toggle')); 1379 } 1380 }, 1381 1382 addClass: function (classNames, speed, easing, callback) { 1383 return speed ? $.effects.animateClass.apply(this, [{ add: classNames }, speed, easing, callback]) : this._addClass(classNames); 1384 }, 1385 removeClass: function (classNames, speed, easing, callback) { 1386 return speed ? $.effects.animateClass.apply(this, [{ remove: classNames }, speed, easing, callback]) : this._removeClass(classNames); 1387 }, 1388 toggleClass: function (classNames, speed, easing, callback) { 1389 return ((typeof speed !== "boolean") && speed) ? $.effects.animateClass.apply(this, [{ toggle: classNames }, speed, easing, callback]) : this._toggleClass(classNames, speed); 1390 }, 1391 morph: function (remove, add, speed, easing, callback) { 1392 return $.effects.animateClass.apply(this, [{ add: add, remove: remove }, speed, easing, callback]); 1393 }, 1394 switchClass: function () { 1395 return this.morph.apply(this, arguments); 1396 }, 1397 1398 // helper functions 1399 cssUnit: function (key) { 1400 var style = this.css(key), val = []; 1401 $.each(['em', 'px', '%', 'pt'], function (i, unit) { 1402 if (style.indexOf(unit) > 0) 1403 val = [parseFloat(style), unit]; 1404 }); 1405 return val; 1406 } 1407 });
1408 1409 /* 1410 * jQuery Color Animations 1411 * Copyright 2007 John Resig 1412 * Released under the MIT and GPL licenses. 1413 */ 1414 1415 // We override the animation for all of these color styles 1416 $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function (i, attr) { 1417 $.fx.step[attr] = function (fx) { 1418 if (fx.state == 0) { 1419 fx.start = getColor(fx.elem, attr); 1420 fx.end = getRGB(fx.end); 1421 } 1422 1423 fx.elem.style[attr] = "rgb(" + [ 1424 Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0), 1425 Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0), 1426 Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) 1427 ].join(",") + ")"; 1428 }; 1429 }); 1430 1431 // Color Conversion functions from highlightFade 1432 // By Blair Mitchelmore 1433 // http://jquery.offput.ca/highlightFade/ 1434 1435 // Parse strings looking for color tuples [255,255,255] 1436 function getRGB(color) { 1437 var result; 1438 1439 // Check if we're already dealing with an array of colors 1440 if (color && color.constructor == Array && color.length == 3) 1441 return color; 1442 1443 // Look for rgb(num,num,num) 1444 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 1445 return [parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10)]; 1446 1447 // Look for rgb(num%,num%,num%) 1448 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 1449 return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55]; 1450 1451 // Look for #a0b1c2 1452 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 1453 return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)]; 1454 1455 // Look for #fff 1456 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 1457 return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)]; 1458 1459 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 1460 if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) 1461 return colors['transparent']; 1462 1463 // Otherwise, we're most likely dealing with a named color 1464 return colors[$.trim(color).toLowerCase()]; 1465 } 1466 1467 function getColor(elem, attr) { 1468 var color; 1469 1470 do { 1471 color = $.curCSS(elem, attr); 1472 1473 // Keep going until we find an element that has color, or we hit the body 1474 if (color != '' && color != 'transparent' || $.nodeName(elem, "body")) 1475 break; 1476 1477 attr = "backgroundColor"; 1478 } while (elem = elem.parentNode); 1479 1480 return getRGB(color); 1481 }; 1482 1483 // Some named colors to work with 1484 // From Interface by Stefan Petre 1485 // http://interface.eyecon.ro/ 1486 1487 var colors = { 1488 aqua: [0, 255, 255], 1489 azure: [240, 255, 255], 1490 beige: [245, 245, 220], 1491 black: [0, 0, 0], 1492 blue: [0, 0, 255], 1493 brown: [165, 42, 42], 1494 cyan: [0, 255, 255], 1495 darkblue: [0, 0, 139], 1496 darkcyan: [0, 139, 139], 1497 darkgrey: [169, 169, 169], 1498 darkgreen: [0, 100, 0], 1499 darkkhaki: [189, 183, 107], 1500 darkmagenta: [139, 0, 139], 1501 darkolivegreen: [85, 107, 47], 1502 darkorange: [255, 140, 0], 1503 darkorchid: [153, 50, 204], 1504 darkred: [139, 0, 0], 1505 darksalmon: [233, 150, 122], 1506 darkviolet: [148, 0, 211], 1507 fuchsia: [255, 0, 255], 1508 gold: [255, 215, 0], 1509 green: [0, 128, 0], 1510 indigo: [75, 0, 130], 1511 khaki: [240, 230, 140], 1512 lightblue: [173, 216, 230], 1513 lightcyan: [224, 255, 255], 1514 lightgreen: [144, 238, 144], 1515 lightgrey: [211, 211, 211], 1516 lightpink: [255, 182, 193], 1517 lightyellow: [255, 255, 224], 1518 lime: [0, 255, 0], 1519 magenta: [255, 0, 255], 1520 maroon: [128, 0, 0], 1521 navy: [0, 0, 128], 1522 olive: [128, 128, 0], 1523 orange: [255, 165, 0], 1524 pink: [255, 192, 203], 1525 purple: [128, 0, 128], 1526 violet: [128, 0, 128], 1527 red: [255, 0, 0], 1528 silver: [192, 192, 192], 1529 white: [255, 255, 255], 1530 yellow: [255, 255, 0],
vendor: 6,663 bytes, lines 1531-1679
1531 transparent: [255, 255, 255] 1532 }; 1533 1534 /* 1535 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 1536 * 1537 * Uses the built in easing capabilities added In jQuery 1.1 1538 * to offer multiple easing options 1539 * 1540 * TERMS OF USE - jQuery Easing 1541 * 1542 * Open source under the BSD License. 1543 * 1544 * Copyright 2008 George McGinley Smith 1545 * All rights reserved. 1546 * 1547 * Redistribution and use in source and binary forms, with or without modification, 1548 * are permitted provided that the following conditions are met: 1549 * 1550 * Redistributions of source code must retain the above copyright notice, this list of 1551 * conditions and the following disclaimer. 1552 * Redistributions in binary form must reproduce the above copyright notice, this list 1553 * of conditions and the following disclaimer in the documentation and/or other materials 1554 * provided with the distribution. 1555 * 1556 * Neither the name of the author nor the names of contributors may be used to endorse 1557 * or promote products derived from this software without specific prior written permission. 1558 * 1559 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 1560 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1561 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1562 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1563 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 1564 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 1565 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1566 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 1567 * OF THE POSSIBILITY OF SUCH DAMAGE. 1568 * 1569 */ 1570 1571 // t: current time, b: begInnIng value, c: change In value, d: duration 1572 $.easing.jswing = $.easing.swing; 1573 1574 $.extend($.easing, 1575{ 1576 def: 'easeOutQuad', 1577 swing: function (x, t, b, c, d) { 1578 //alert($.easing.default); 1579 return $.easing[$.easing.def](x, t, b, c, d); 1580 }, 1581 easeInQuad: function (x, t, b, c, d) { 1582 return c * (t /= d) * t + b; 1583 }, 1584 easeOutQuad: function (x, t, b, c, d) { 1585 return -c * (t /= d) * (t - 2) + b; 1586 }, 1587 easeInOutQuad: function (x, t, b, c, d) { 1588 if ((t /= d / 2) < 1) return c / 2 * t * t + b; 1589 return -c / 2 * ((--t) * (t - 2) - 1) + b; 1590 }, 1591 easeInCubic: function (x, t, b, c, d) { 1592 return c * (t /= d) * t * t + b; 1593 }, 1594 easeOutCubic: function (x, t, b, c, d) { 1595 return c * ((t = t / d - 1) * t * t + 1) + b; 1596 }, 1597 easeInOutCubic: function (x, t, b, c, d) { 1598 if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; 1599 return c / 2 * ((t -= 2) * t * t + 2) + b; 1600 }, 1601 easeInQuart: function (x, t, b, c, d) { 1602 return c * (t /= d) * t * t * t + b; 1603 }, 1604 easeOutQuart: function (x, t, b, c, d) { 1605 return -c * ((t = t / d - 1) * t * t * t - 1) + b; 1606 }, 1607 easeInOutQuart: function (x, t, b, c, d) { 1608 if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; 1609 return -c / 2 * ((t -= 2) * t * t * t - 2) + b; 1610 }, 1611 easeInQuint: function (x, t, b, c, d) { 1612 return c * (t /= d) * t * t * t * t + b; 1613 }, 1614 easeOutQuint: function (x, t, b, c, d) { 1615 return c * ((t = t / d - 1) * t * t * t * t + 1) + b; 1616 }, 1617 easeInOutQuint: function (x, t, b, c, d) { 1618 if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; 1619 return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; 1620 }, 1621 easeInSine: function (x, t, b, c, d) { 1622 return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; 1623 }, 1624 easeOutSine: function (x, t, b, c, d) { 1625 return c * Math.sin(t / d * (Math.PI / 2)) + b; 1626 }, 1627 easeInOutSine: function (x, t, b, c, d) { 1628 return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; 1629 }, 1630 easeInExpo: function (x, t, b, c, d) { 1631 return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; 1632 }, 1633 easeOutExpo: function (x, t, b, c, d) { 1634 return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; 1635 }, 1636 easeInOutExpo: function (x, t, b, c, d) { 1637 if (t == 0) return b; 1638 if (t == d) return b + c; 1639 if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; 1640 return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; 1641 }, 1642 easeInCirc: function (x, t, b, c, d) { 1643 return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; 1644 }, 1645 easeOutCirc: function (x, t, b, c, d) { 1646 return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; 1647 }, 1648 easeInOutCirc: function (x, t, b, c, d) { 1649 if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; 1650 return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; 1651 }, 1652 easeInElastic: function (x, t, b, c, d) { 1653 var s = 1.70158; var p = 0; var a = c; 1654 if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; 1655 if (a < Math.abs(c)) { a = c; var s = p / 4; } 1656 else var s = p / (2 * Math.PI) * Math.asin(c / a); 1657 return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 1658 }, 1659 easeOutElastic: function (x, t, b, c, d) { 1660 var s = 1.70158; var p = 0; var a = c; 1661 if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; 1662 if (a < Math.abs(c)) { a = c; var s = p / 4; } 1663 else var s = p / (2 * Math.PI) * Math.asin(c / a); 1664 return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; 1665 }, 1666 easeInOutElastic: function (x, t, b, c, d) { 1667 var s = 1.70158; var p = 0; var a = c; 1668 if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5); 1669 if (a < Math.abs(c)) { a = c; var s = p / 4; } 1670 else var s = p / (2 * Math.PI) * Math.asin(c / a); 1671 if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 1672 return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; 1673 }, 1674 easeInBack: function (x, t, b, c, d, s) { 1675 if (s == undefined) s = 1.70158; 1676 return c * (t /= d) * t * ((s + 1) * t - s) + b; 1677 }, 1678 easeOutBack: function (x, t, b, c, d, s) { 1679 if (s == undefined) s = 1.70158;
1680 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; 1681 }, 1682 easeInOutBack: function (x, t, b, c, d, s) { 1683 if (s == undefined) s = 1.70158; 1684 if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; 1685 return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; 1686 }, 1687 easeInBounce: function (x, t, b, c, d) { 1688 return c - $.easing.easeOutBounce(x, d - t, 0, c, d) + b; 1689 }, 1690 easeOutBounce: function (x, t, b, c, d) { 1691 if ((t /= d) < (1 / 2.75)) { 1692 return c * (7.5625 * t * t) + b; 1693 } else if (t < (2 / 2.75)) { 1694 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; 1695 } else if (t < (2.5 / 2.75)) { 1696 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; 1697 } else { 1698 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; 1699 } 1700 }, 1701 easeInOutBounce: function (x, t, b, c, d) { 1702 if (t < d / 2) return $.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b; 1703 return $.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b; 1704 } 1705}); 1706 1707 1708})(jQuery); 1709 1710/* 1711 * jQuery UI Effects Clip 1.7.2 1712 * 1713 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) 1714 * Dual licensed under the MIT (MIT-LICENSE.txt) 1715 * and GPL (GPL-LICENSE.txt) licenses. 1716 * 1717 * http://docs.jquery.com/UI/Effects/Clip 1718 * 1719 * Depends: 1720 * effects.core.js 1721 */ 1722(function($) { 1723 1724$.effects.clip = function(o) { 1725 1726 return this.queue(function() { 1727 1728 // Create element 1729 var el = $(this), props = ['position','top','left','height','width']; 1730 1731 // Set options 1732 var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode 1733 var direction = o.options.direction || 'vertical'; // Default direction 1734 1735 // Adjust 1736 $.effects.save(el, props); el.show(); // Save & Show 1737 var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper 1738 var animate = el[0].tagName == 'IMG' ? wrapper : el; 1739 var ref = { 1740 size: (direction == 'vertical') ? 'height' : 'width', 1741 position: (direction == 'vertical') ? 'top' : 'left' 1742 }; 1743 var distance = (direction == 'vertical') ? animate.height() : animate.width(); 1744 if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift 1745 1746 // Animation 1747 var animation = {}; 1748 animation[ref.size] = mode == 'show' ? distance : 0; 1749 animation[ref.position] = mode == 'show' ? 0 : distance / 2; 1750 1751 // Animate 1752 animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 1753 if(mode == 'hide') el.hide(); // Hide 1754 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 1755 if(o.callback) o.callback.apply(el[0], arguments); // Callback 1756 el.dequeue(); 1757 }}); 1758 1759 }); 1760 1761}; 1762 1763})(jQuery); 1764 1765 1766/* 1767 * jQuery UI Effects Highlight 1.7.2 1768 * 1769 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) 1770 * Dual licensed under the MIT (MIT-LICENSE.txt) 1771 * and GPL (GPL-LICENSE.txt) licenses. 1772 * 1773 * http://docs.jquery.com/UI/Effects/Highlight 1774 * 1775 * Depends: 1776 * effects.core.js 1777 */ 1778(function($) { 1779 1780$.effects.highlight = function(o) { 1781 1782 return this.queue(function() { 1783 1784 // Create element 1785 var el = $(this), props = ['backgroundImage','backgroundColor','opacity']; 1786 1787 // Set options 1788 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode 1789 var color = o.options.color || "#ffff99"; // Default highlight color 1790 var oldColor = el.css("backgroundColor"); 1791 1792 // Adjust 1793 $.effects.save(el, props); el.show(); // Save & Show 1794 el.css({backgroundImage: 'none', backgroundColor: color}); // Shift 1795 1796 // Animation 1797 var animation = {backgroundColor: oldColor }; 1798 if (mode == "hide") animation['opacity'] = 0; 1799 1800 // Animate 1801 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { 1802 if(mode == "hide") el.hide(); 1803 $.effects.restore(el, props); 1804 if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter'); 1805 if(o.callback) o.callback.apply(this, arguments); 1806 el.dequeue(); 1807 }}); 1808 1809 }); 1810 1811}; 1812 1813})(jQuery); 1814 1815/* 1816 * jQuery UI Effects Slide 1.7.2 1817 * 1818 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) 1819 * Dual licensed under the MIT (MIT-LICENSE.txt) 1820 * and GPL (GPL-LICENSE.txt) licenses. 1821 * 1822 * http://docs.jquery.com/UI/Effects/Slide 1823 * 1824 * Depends:
1825 * effects.core.js 1826 */ 1827(function ($) { 1828 1829 $.effects.slide = function (o) { 1830 1831 return this.queue(function () { 1832 1833 // Create element 1834 var el = $(this), props = ['position', 'top', 'left']; 1835 1836 // Set options 1837 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode 1838 var direction = o.options.direction || 'left'; // Default Direction 1839 1840 // Adjust 1841 $.effects.save(el, props); el.show(); // Save & Show 1842 $.effects.createWrapper(el).css({ overflow: 'hidden' }); // Create Wrapper 1843 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; 1844 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; 1845 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({ margin: true }) : el.outerWidth({ margin: true })); 1846 if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift 1847 1848 // Animation 1849 var animation = {}; 1850 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; 1851 1852 // Animate 1853 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function () { 1854 if (mode == 'hide') el.hide(); // Hide 1855 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore 1856 if (o.callback) o.callback.apply(this, arguments); // Callback 1857 el.dequeue(); 1858 } 1859 }); 1860 1861 }); 1862 1863 }; 1864 1865})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.