diff --git a/dist/jquery.qtip.basic.js b/dist/jquery.qtip.basic.js index 19ad5480..c160c31e 100644 --- a/dist/jquery.qtip.basic.js +++ b/dist/jquery.qtip.basic.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Apr 23 00:41:47 2011 +0100 +* Date: Mon May 2 20:12:06 2011 +0100 */ "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ @@ -31,6 +31,7 @@ disabled = 'ui-state-disabled', selector = 'div.qtip.'+uitooltip, focusClass = uitooltip + '-focus', + hoverClass = uitooltip + '-hover', hideOffset = '-31000px', replaceSuffix = '_replacedByqTip', oldtitle = 'oldtitle'; @@ -480,10 +481,15 @@ function QTip(target, options, id, attr) }); } - // Focus/blur the tooltip - tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) { + // Focus the tooltip on mouseenter (z-index stacking) + tooltip.bind('mouseenter'+namespace, function(event) { self[ event.type === 'mouseenter' ? 'focus' : 'blur' ](event); }); + + // Add hover class on mouseenter/mouseleave + tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) { + tooltip.toggleClass(hoverClass, event.type === 'mouseenter'); + }); } // Assign hide events @@ -499,6 +505,16 @@ function QTip(target, options, id, attr) }); } + /* + * Make sure hoverIntent functions properly by using mouseleave to clear show timer if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. + */ + if(/mouse(over|enter)/i.test(options.show.event) && !/mouse(out|leave)/i.test(options.hide.event)) { + targets.hide.bind('mouseleave'+namespace, function(event) { + clearTimeout(self.timers.show); + }); + } + // Apply hide events $.each(events.hide, function(index, type) { var showIndex = $.inArray(type, events.show), @@ -532,11 +548,12 @@ function QTip(target, options, id, attr) if('number' === typeof options.hide.distance) { // Bind mousemove to target to detect distance difference targets.show.bind('mousemove'+namespace, function(event) { - var coords = cache.coords || [], - limit = options.hide.distance; + var origin = cache.origin || {}, + limit = options.hide.distance, + abs = Math.abs; // Check if the movement has gone beyond the limit, and hide it if so - if(coords && (Math.abs(event.pageX - coords[0]) >= limit || Math.abs(event.pageY - coords[1]) >= limit)){ + if(origin && (abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit)){ self.hide(event); } }); @@ -907,6 +924,9 @@ function QTip(target, options, id, attr) // Execute state specific properties if(state) { + // Store show origin coordinates + cache.origin = $.extend({}, MOUSE); + // Focus the tooltip self.focus(event); @@ -918,18 +938,13 @@ function QTip(target, options, id, attr) // Hide other tooltips if tooltip is solo, using it as the context if(opts.solo) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); } - - // Store coordinates if hide.distance is set - if('number' === typeof options.hide.distance) { - cache.coords = [ event.pageX, event.pageY ]; - } } else { // Clear show timer if we're hiding clearTimeout(self.timers.show); - // Delete cached coords - delete cache.coords; + // Remove cached origin on hide + delete cache.origin; // Blur the tooltip self.blur(event); @@ -998,26 +1013,26 @@ function QTip(target, options, id, attr) // Only update the z-index if it has changed and tooltip is not already focused if(!tooltip.hasClass(focusClass)) { - // Only update z-index's if they've changed' - if(curIndex !== newIndex) { - // Reduce our z-index's and keep them properly ordered - qtips.each(function() { - if(this.style.zIndex > curIndex) { - this.style.zIndex = this.style.zIndex - 1; - } - }); - - // Fire blur event for focused tooltip - qtips.filter('.' + focusClass).qtip('blur', cachedEvent); - } - // Call API method callback = $.Event('tooltipfocus'); callback.originalEvent = cachedEvent; tooltip.trigger(callback, [self, newIndex]); - // If callback wasn't FALSE + // If default action wasn't prevented... if(!callback.isDefaultPrevented()) { + // Only update z-index's if they've changed + if(curIndex !== newIndex) { + // Reduce our z-index's and keep them properly ordered + qtips.each(function() { + if(this.style.zIndex > curIndex) { + this.style.zIndex = this.style.zIndex - 1; + } + }); + + // Fire blur event for focused tooltip + qtips.filter('.' + focusClass).qtip('blur', cachedEvent); + } + // Set the new z-index tooltip.addClass(focusClass)[0].style.zIndex = newIndex; } @@ -1067,27 +1082,35 @@ function QTip(target, options, id, attr) // Repositioning method and axis detection horizontal: method[0], vertical: method[1] || method[0], - tip: options.style.tip, + tip: options.style.tip || {}, // Reposition methods left: function(posLeft) { - var viewportScroll = viewport.offset.left + viewport.scrollLeft, + var isShift = readjust.horizontal === 'shift', + viewportScroll = viewport.offset.left + viewport.scrollLeft, myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2, atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2, - tipAdjust = tip && tip.precedance === 'y' ? readjust.tip.width + readjust.tip.border * 2 : 0, + tipWidth = (readjust.tip.width + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'x' && !isShift ? tipWidth : 0, overflowLeft = viewportScroll - posLeft - tipAdjust, overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust, offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0), isCenter = my.x === 'center'; // Optional 'shift' style repositioning - if(readjust.horizontal === 'shift') { - position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'y' ? tipWidth : 0; + offset = (my.x === 'left' ? 1 : -1) * myWidth - tipAdjust; - // Make sure we stay within the viewport boundaries - position.left = Math.min( - Math.max(viewportScroll, position.left), - Math.max(overflowLeft > 0 ? -1E9 : 0, viewportScroll + viewport.width - elemWidth) + // Adjust position but keep it within viewport dimensions + position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + position.left = Math.max( + viewport.offset.left + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posLeft - offset, + Math.min( + Math.max(viewport.offset.left + viewport.width, posLeft + offset), + position.left + ) ); } @@ -1108,23 +1131,31 @@ function QTip(target, options, id, attr) return position.left - posLeft; }, top: function(posTop) { - var viewportScroll = viewport.offset.top + viewport.scrollTop, + var isShift = readjust.vertical === 'shift', + viewportScroll = viewport.offset.top + viewport.scrollTop, myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2, atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2, - tipAdjust = tip && tip.precedance === 'x' ? readjust.tip.height + readjust.tip.border * 2 : 0, + tipHeight = (readjust.tip.height + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'y' && !isShift ? tipHeight : 0, overflowTop = viewportScroll - posTop - tipAdjust, overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust, offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0), isCenter = my.y === 'center'; // Optional 'shift' style repositioning - if(readjust.vertical === 'shift') { - position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'x' ? tipHeight : 0; + offset = (my.y === 'top' ? 1 : -1) * myHeight - tipAdjust; - // Make sure we stay within the viewport boundaries - position.top = Math.min( - Math.max(viewportScroll, position.top), - Math.max(overflowTop > 0 ? -1E9 : 0, viewportScroll + viewport.height - elemHeight) + // Adjust position but keep it within viewport dimensions + position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + position.top = Math.max( + viewport.offset.top + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posTop - offset, + Math.min( + Math.max(viewport.offset.top + viewport.height, posTop + offset), + position.top + ) ); } @@ -1146,18 +1177,6 @@ function QTip(target, options, id, attr) } }; - - - // Cache our viewport details - viewport = !viewport ? FALSE : { - elem: viewport, - height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), - width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), - scrollLeft: viewport.scrollLeft(), - scrollTop: viewport.scrollTop(), - offset: viewport.offset() || { left:0, top: 0 } - }; - // Check if mouse was the target if(target === 'mouse') { // Force left top to allow flipping @@ -1165,8 +1184,9 @@ function QTip(target, options, id, attr) // Use cached event if one isn't available for positioning event = event && (event.type === 'resize' || event.type === 'scroll') ? cache.event : - adjust.mouse || !event || !event.pageX || (/over|enter$/i.test(event.type) && !adjust.mouse) ? - $.extend({}, MOUSE) : event; + !adjust.mouse && cache.origin ? cache.origin : + MOUSE && (adjust.mouse || !event || !event.pageX) ? { pageX: MOUSE.pageX, pageY: MOUSE.pageY } : + event; // Use event coordinates for position position = { top: event.pageY, left: event.pageX }; @@ -1193,8 +1213,8 @@ function QTip(target, options, id, attr) if(target[0] === window) { position = { - top: !fixed || PLUGINS.iOS ? viewport.scrollTop : 0, - left: !fixed || PLUGINS.iOS ? viewport.scrollLeft : 0 + top: !fixed || PLUGINS.iOS ? viewport.scrollTop() : 0, + left: !fixed || PLUGINS.iOS ? viewport.scrollLeft() : 0 }; } } @@ -1203,7 +1223,7 @@ function QTip(target, options, id, attr) else if(target.is('area') && PLUGINS.imagemap) { position = PLUGINS.imagemap(target, at); } - else if(target[0].namespaceURI == 'http://www.w3.org/2000/svg' && PLUGINS.svg) { + else if(target[0].namespaceURI === 'http://www.w3.org/2000/svg' && PLUGINS.svg) { position = PLUGINS.svg(target, at); } @@ -1211,7 +1231,7 @@ function QTip(target, options, id, attr) targetWidth = target.outerWidth(); targetHeight = target.outerHeight(); - position = PLUGINS.offset(target, posOptions.container); + position = PLUGINS.offset(target, posOptions.container, fixed); } // Parse returned plugin values into proper variables @@ -1230,16 +1250,29 @@ function QTip(target, options, id, attr) position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0); position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0); - // Calculate collision offset values - if(posOptions.viewport.jquery && target[0] !== window && target[0] !== docBody) { + // Calculate collision offset values if viewport positioning is enabled + if(viewport.jquery && target[0] !== window && target[0] !== docBody && + readjust.vertical+readjust.horizontal !== 'nonenone') + { + // Cache our viewport details + viewport = { + elem: viewport, + height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), + width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), + scrollLeft: viewport.scrollLeft(), + scrollTop: viewport.scrollTop(), + offset: viewport.offset() || { left: 0, top: 0 } + }; + + // Adjust position based onviewport and adjustment options position.adjusted = { left: readjust.horizontal !== 'none' ? readjust.left(position.left) : 0, top: readjust.vertical !== 'none' ? readjust.top(position.top) : 0 }; } - else { - position.adjusted = { left: 0, top: 0 }; - } + + //Viewport adjustment is disabled, set values to zero + else { position.adjusted = { left: 0, top: 0 }; } // Set tooltip position class tooltip.attr('class', function(i, val) { @@ -1249,7 +1282,7 @@ function QTip(target, options, id, attr) // Call API method callback.originalEvent = $.extend({}, event); - tooltip.trigger(callback, [self, position, viewport.elem]); + tooltip.trigger(callback, [self, position, viewport.elem || viewport]); if(callback.isDefaultPrevented()){ return self; } delete position.adjusted; @@ -1281,8 +1314,12 @@ function QTip(target, options, id, attr) { if(self.rendered < 1 || options.style.width || isDrawing) { return self; } - var fluid = uitooltip + '-fluid', width, max, min; - isDrawing = 1; // Set drawing flag + var fluid = uitooltip + '-fluid', + container = options.position.container, + perc, width, max, min; + + // Set drawing flag + isDrawing = 1; // Reset width and add fluid class tooltip.css('width', '').addClass(fluid); @@ -1290,15 +1327,20 @@ function QTip(target, options, id, attr) // Grab our tooltip width (add 1 so we don't get wrapping problems in Gecko) width = tooltip.width() + ($.browser.mozilla ? 1 : 0); - // Parse our max/min properties - max = parseInt(tooltip.css('max-width'), 10) || 0; - min = parseInt(tooltip.css('min-width'), 10) || 0; + // Grab our max/min properties + max = tooltip.css('max-width') || ''; + min = tooltip.css('min-width') || ''; + + // Parse into proper pixel values + perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0; + max = ((max.indexOf('%') > -1 ? perc : 1) * parseInt(max, 10)) || width; + min = ((min.indexOf('%') > -1 ? perc : 1) * parseInt(min, 10)) || 0; // Determine new dimension size based on max/min/current values width = max + min ? Math.min(Math.max(width, min), max) : width; // Set the newly calculated width and remvoe fluid class - tooltip.css('width', width).removeClass(fluid); + tooltip.css('width', Math.round(width)).removeClass(fluid); // Set drawing flag isDrawing = 0; @@ -1532,12 +1574,14 @@ QTIP.bind = function(opts, event) show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace, hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace }; - + /* - * If hide event is just 'unfocus', we'll use mouseleave as the hide event... - * since unfocus is actually library specific and won't fire as an event anywho. + * Make sure hoverIntent functions properly by using mouseleave as a hide event if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. */ - if(options.hide.event === 'unfocus') { events.hide = 'mouseleave' + namespace; } + if(/mouse(over|enter)/i.test(events.show) && !/mouse(out|leave)/i.test(events.hide)) { + events.hide += ' mouseleave' + namespace; + } // Define hoverIntent function function hoverIntent(event) { @@ -1592,7 +1636,7 @@ PLUGINS = QTIP.plugins = { }, // Custom (more correct for qTip!) offset calculator - offset: function(elem, container) { + offset: function(elem, container, fixed) { var pos = elem.offset(), parent = container, deep = 0, @@ -1620,7 +1664,9 @@ PLUGINS = QTIP.plugins = { // Compensate for containers scroll if it also has an offsetParent if(container[0] !== docBody || deep > 1) { scroll( container, 1 ); } - if(PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) { scroll( $(window), -1 ); } + + // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2 - v4.0) + if((PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) || (!PLUGINS.iOS && fixed)) { scroll( $(window), -1 ); } } return pos; diff --git a/dist/jquery.qtip.css b/dist/jquery.qtip.css index 228eecd0..33e2a0ff 100644 --- a/dist/jquery.qtip.css +++ b/dist/jquery.qtip.css @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Apr 23 00:41:47 2011 +0100 +* Date: Mon May 2 20:12:06 2011 +0100 */ /* Fluid class for determining actual width in IE */ @@ -108,6 +108,11 @@ } +/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */ +.ui-tooltip-hover{ + +} + /*! Default tooltip style */ .ui-tooltip-titlebar, @@ -440,8 +445,7 @@ /* Tipsy style */ .ui-tooltip-tipsy{ - border: 0 solid #000; - border: 0 solid rgba(0,0,0,.87); + border: 0; } .ui-tooltip-tipsy .ui-tooltip-titlebar, @@ -452,7 +456,7 @@ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)"; color: white; - border: 0 dashed transparent; + border: 0px transparent; font-size: 11px; font-family: 'Lucida Grande', sans-serif; diff --git a/dist/jquery.qtip.js b/dist/jquery.qtip.js index b943bea7..1a623fca 100644 --- a/dist/jquery.qtip.js +++ b/dist/jquery.qtip.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Apr 23 00:41:47 2011 +0100 +* Date: Mon May 2 20:12:06 2011 +0100 */ "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ @@ -31,6 +31,7 @@ disabled = 'ui-state-disabled', selector = 'div.qtip.'+uitooltip, focusClass = uitooltip + '-focus', + hoverClass = uitooltip + '-hover', hideOffset = '-31000px', replaceSuffix = '_replacedByqTip', oldtitle = 'oldtitle'; @@ -480,10 +481,15 @@ function QTip(target, options, id, attr) }); } - // Focus/blur the tooltip - tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) { + // Focus the tooltip on mouseenter (z-index stacking) + tooltip.bind('mouseenter'+namespace, function(event) { self[ event.type === 'mouseenter' ? 'focus' : 'blur' ](event); }); + + // Add hover class on mouseenter/mouseleave + tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) { + tooltip.toggleClass(hoverClass, event.type === 'mouseenter'); + }); } // Assign hide events @@ -499,6 +505,16 @@ function QTip(target, options, id, attr) }); } + /* + * Make sure hoverIntent functions properly by using mouseleave to clear show timer if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. + */ + if(/mouse(over|enter)/i.test(options.show.event) && !/mouse(out|leave)/i.test(options.hide.event)) { + targets.hide.bind('mouseleave'+namespace, function(event) { + clearTimeout(self.timers.show); + }); + } + // Apply hide events $.each(events.hide, function(index, type) { var showIndex = $.inArray(type, events.show), @@ -532,11 +548,12 @@ function QTip(target, options, id, attr) if('number' === typeof options.hide.distance) { // Bind mousemove to target to detect distance difference targets.show.bind('mousemove'+namespace, function(event) { - var coords = cache.coords || [], - limit = options.hide.distance; + var origin = cache.origin || {}, + limit = options.hide.distance, + abs = Math.abs; // Check if the movement has gone beyond the limit, and hide it if so - if(coords && (Math.abs(event.pageX - coords[0]) >= limit || Math.abs(event.pageY - coords[1]) >= limit)){ + if(origin && (abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit)){ self.hide(event); } }); @@ -907,6 +924,9 @@ function QTip(target, options, id, attr) // Execute state specific properties if(state) { + // Store show origin coordinates + cache.origin = $.extend({}, MOUSE); + // Focus the tooltip self.focus(event); @@ -918,18 +938,13 @@ function QTip(target, options, id, attr) // Hide other tooltips if tooltip is solo, using it as the context if(opts.solo) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); } - - // Store coordinates if hide.distance is set - if('number' === typeof options.hide.distance) { - cache.coords = [ event.pageX, event.pageY ]; - } } else { // Clear show timer if we're hiding clearTimeout(self.timers.show); - // Delete cached coords - delete cache.coords; + // Remove cached origin on hide + delete cache.origin; // Blur the tooltip self.blur(event); @@ -998,26 +1013,26 @@ function QTip(target, options, id, attr) // Only update the z-index if it has changed and tooltip is not already focused if(!tooltip.hasClass(focusClass)) { - // Only update z-index's if they've changed' - if(curIndex !== newIndex) { - // Reduce our z-index's and keep them properly ordered - qtips.each(function() { - if(this.style.zIndex > curIndex) { - this.style.zIndex = this.style.zIndex - 1; - } - }); - - // Fire blur event for focused tooltip - qtips.filter('.' + focusClass).qtip('blur', cachedEvent); - } - // Call API method callback = $.Event('tooltipfocus'); callback.originalEvent = cachedEvent; tooltip.trigger(callback, [self, newIndex]); - // If callback wasn't FALSE + // If default action wasn't prevented... if(!callback.isDefaultPrevented()) { + // Only update z-index's if they've changed + if(curIndex !== newIndex) { + // Reduce our z-index's and keep them properly ordered + qtips.each(function() { + if(this.style.zIndex > curIndex) { + this.style.zIndex = this.style.zIndex - 1; + } + }); + + // Fire blur event for focused tooltip + qtips.filter('.' + focusClass).qtip('blur', cachedEvent); + } + // Set the new z-index tooltip.addClass(focusClass)[0].style.zIndex = newIndex; } @@ -1067,27 +1082,35 @@ function QTip(target, options, id, attr) // Repositioning method and axis detection horizontal: method[0], vertical: method[1] || method[0], - tip: options.style.tip, + tip: options.style.tip || {}, // Reposition methods left: function(posLeft) { - var viewportScroll = viewport.offset.left + viewport.scrollLeft, + var isShift = readjust.horizontal === 'shift', + viewportScroll = viewport.offset.left + viewport.scrollLeft, myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2, atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2, - tipAdjust = tip && tip.precedance === 'y' ? readjust.tip.width + readjust.tip.border * 2 : 0, + tipWidth = (readjust.tip.width + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'x' && !isShift ? tipWidth : 0, overflowLeft = viewportScroll - posLeft - tipAdjust, overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust, offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0), isCenter = my.x === 'center'; // Optional 'shift' style repositioning - if(readjust.horizontal === 'shift') { - position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'y' ? tipWidth : 0; + offset = (my.x === 'left' ? 1 : -1) * myWidth - tipAdjust; - // Make sure we stay within the viewport boundaries - position.left = Math.min( - Math.max(viewportScroll, position.left), - Math.max(overflowLeft > 0 ? -1E9 : 0, viewportScroll + viewport.width - elemWidth) + // Adjust position but keep it within viewport dimensions + position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + position.left = Math.max( + viewport.offset.left + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posLeft - offset, + Math.min( + Math.max(viewport.offset.left + viewport.width, posLeft + offset), + position.left + ) ); } @@ -1108,23 +1131,31 @@ function QTip(target, options, id, attr) return position.left - posLeft; }, top: function(posTop) { - var viewportScroll = viewport.offset.top + viewport.scrollTop, + var isShift = readjust.vertical === 'shift', + viewportScroll = viewport.offset.top + viewport.scrollTop, myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2, atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2, - tipAdjust = tip && tip.precedance === 'x' ? readjust.tip.height + readjust.tip.border * 2 : 0, + tipHeight = (readjust.tip.height + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'y' && !isShift ? tipHeight : 0, overflowTop = viewportScroll - posTop - tipAdjust, overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust, offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0), isCenter = my.y === 'center'; // Optional 'shift' style repositioning - if(readjust.vertical === 'shift') { - position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'x' ? tipHeight : 0; + offset = (my.y === 'top' ? 1 : -1) * myHeight - tipAdjust; - // Make sure we stay within the viewport boundaries - position.top = Math.min( - Math.max(viewportScroll, position.top), - Math.max(overflowTop > 0 ? -1E9 : 0, viewportScroll + viewport.height - elemHeight) + // Adjust position but keep it within viewport dimensions + position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + position.top = Math.max( + viewport.offset.top + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posTop - offset, + Math.min( + Math.max(viewport.offset.top + viewport.height, posTop + offset), + position.top + ) ); } @@ -1146,18 +1177,6 @@ function QTip(target, options, id, attr) } }; - - - // Cache our viewport details - viewport = !viewport ? FALSE : { - elem: viewport, - height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), - width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), - scrollLeft: viewport.scrollLeft(), - scrollTop: viewport.scrollTop(), - offset: viewport.offset() || { left:0, top: 0 } - }; - // Check if mouse was the target if(target === 'mouse') { // Force left top to allow flipping @@ -1165,8 +1184,9 @@ function QTip(target, options, id, attr) // Use cached event if one isn't available for positioning event = event && (event.type === 'resize' || event.type === 'scroll') ? cache.event : - adjust.mouse || !event || !event.pageX || (/over|enter$/i.test(event.type) && !adjust.mouse) ? - $.extend({}, MOUSE) : event; + !adjust.mouse && cache.origin ? cache.origin : + MOUSE && (adjust.mouse || !event || !event.pageX) ? { pageX: MOUSE.pageX, pageY: MOUSE.pageY } : + event; // Use event coordinates for position position = { top: event.pageY, left: event.pageX }; @@ -1193,8 +1213,8 @@ function QTip(target, options, id, attr) if(target[0] === window) { position = { - top: !fixed || PLUGINS.iOS ? viewport.scrollTop : 0, - left: !fixed || PLUGINS.iOS ? viewport.scrollLeft : 0 + top: !fixed || PLUGINS.iOS ? viewport.scrollTop() : 0, + left: !fixed || PLUGINS.iOS ? viewport.scrollLeft() : 0 }; } } @@ -1203,7 +1223,7 @@ function QTip(target, options, id, attr) else if(target.is('area') && PLUGINS.imagemap) { position = PLUGINS.imagemap(target, at); } - else if(target[0].namespaceURI == 'http://www.w3.org/2000/svg' && PLUGINS.svg) { + else if(target[0].namespaceURI === 'http://www.w3.org/2000/svg' && PLUGINS.svg) { position = PLUGINS.svg(target, at); } @@ -1211,7 +1231,7 @@ function QTip(target, options, id, attr) targetWidth = target.outerWidth(); targetHeight = target.outerHeight(); - position = PLUGINS.offset(target, posOptions.container); + position = PLUGINS.offset(target, posOptions.container, fixed); } // Parse returned plugin values into proper variables @@ -1230,16 +1250,29 @@ function QTip(target, options, id, attr) position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0); position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0); - // Calculate collision offset values - if(posOptions.viewport.jquery && target[0] !== window && target[0] !== docBody) { + // Calculate collision offset values if viewport positioning is enabled + if(viewport.jquery && target[0] !== window && target[0] !== docBody && + readjust.vertical+readjust.horizontal !== 'nonenone') + { + // Cache our viewport details + viewport = { + elem: viewport, + height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), + width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), + scrollLeft: viewport.scrollLeft(), + scrollTop: viewport.scrollTop(), + offset: viewport.offset() || { left: 0, top: 0 } + }; + + // Adjust position based onviewport and adjustment options position.adjusted = { left: readjust.horizontal !== 'none' ? readjust.left(position.left) : 0, top: readjust.vertical !== 'none' ? readjust.top(position.top) : 0 }; } - else { - position.adjusted = { left: 0, top: 0 }; - } + + //Viewport adjustment is disabled, set values to zero + else { position.adjusted = { left: 0, top: 0 }; } // Set tooltip position class tooltip.attr('class', function(i, val) { @@ -1249,7 +1282,7 @@ function QTip(target, options, id, attr) // Call API method callback.originalEvent = $.extend({}, event); - tooltip.trigger(callback, [self, position, viewport.elem]); + tooltip.trigger(callback, [self, position, viewport.elem || viewport]); if(callback.isDefaultPrevented()){ return self; } delete position.adjusted; @@ -1281,8 +1314,12 @@ function QTip(target, options, id, attr) { if(self.rendered < 1 || options.style.width || isDrawing) { return self; } - var fluid = uitooltip + '-fluid', width, max, min; - isDrawing = 1; // Set drawing flag + var fluid = uitooltip + '-fluid', + container = options.position.container, + perc, width, max, min; + + // Set drawing flag + isDrawing = 1; // Reset width and add fluid class tooltip.css('width', '').addClass(fluid); @@ -1290,15 +1327,20 @@ function QTip(target, options, id, attr) // Grab our tooltip width (add 1 so we don't get wrapping problems in Gecko) width = tooltip.width() + ($.browser.mozilla ? 1 : 0); - // Parse our max/min properties - max = parseInt(tooltip.css('max-width'), 10) || 0; - min = parseInt(tooltip.css('min-width'), 10) || 0; + // Grab our max/min properties + max = tooltip.css('max-width') || ''; + min = tooltip.css('min-width') || ''; + + // Parse into proper pixel values + perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0; + max = ((max.indexOf('%') > -1 ? perc : 1) * parseInt(max, 10)) || width; + min = ((min.indexOf('%') > -1 ? perc : 1) * parseInt(min, 10)) || 0; // Determine new dimension size based on max/min/current values width = max + min ? Math.min(Math.max(width, min), max) : width; // Set the newly calculated width and remvoe fluid class - tooltip.css('width', width).removeClass(fluid); + tooltip.css('width', Math.round(width)).removeClass(fluid); // Set drawing flag isDrawing = 0; @@ -1532,12 +1574,14 @@ QTIP.bind = function(opts, event) show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace, hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace }; - + /* - * If hide event is just 'unfocus', we'll use mouseleave as the hide event... - * since unfocus is actually library specific and won't fire as an event anywho. + * Make sure hoverIntent functions properly by using mouseleave as a hide event if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. */ - if(options.hide.event === 'unfocus') { events.hide = 'mouseleave' + namespace; } + if(/mouse(over|enter)/i.test(events.show) && !/mouse(out|leave)/i.test(events.hide)) { + events.hide += ' mouseleave' + namespace; + } // Define hoverIntent function function hoverIntent(event) { @@ -1592,7 +1636,7 @@ PLUGINS = QTIP.plugins = { }, // Custom (more correct for qTip!) offset calculator - offset: function(elem, container) { + offset: function(elem, container, fixed) { var pos = elem.offset(), parent = container, deep = 0, @@ -1620,7 +1664,9 @@ PLUGINS = QTIP.plugins = { // Compensate for containers scroll if it also has an offsetParent if(container[0] !== docBody || deep > 1) { scroll( container, 1 ); } - if(PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) { scroll( $(window), -1 ); } + + // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2 - v4.0) + if((PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) || (!PLUGINS.iOS && fixed)) { scroll( $(window), -1 ); } } return pos; @@ -2045,8 +2091,7 @@ function Tip(qTip, command) } else { props = offset.bottom !== undefined ? - [ adjust.top, -offset.top ] : - [ -adjust.top, offset.top ]; + [ adjust.top, -offset.top ] : [ -adjust.top, offset.top ]; if( (shift.y = Math.max(props[0], props[1])) > props[0] ) { pos.top -= adjust.top; @@ -2674,12 +2719,12 @@ function Modal(api) // Apply our show/hide/focus modal events .bind('tooltipshow'+globalNamespace+' tooltiphide'+globalNamespace, function(event, api, duration) { - self[ event.type.replace('tooltip', '') ](duration); + self[ event.type.replace('tooltip', '') ](event, duration); }) // Adjust modal z-index on tooltip focus .bind('tooltipfocus'+globalNamespace, function(event, api, zIndex) { - overlay.css('z-index', zIndex - 1); + overlay[0].style.zIndex = zIndex - 1; }) // Focus any other visible modals when this one blurs @@ -2738,8 +2783,11 @@ function Modal(api) return overlay; }, - toggle: function(state) + toggle: function(event, state, duration) { + // Make sure default event hasn't been prevented + if(event && event.isDefaultPrevented()) { return self; } + var effect = options.effect, type = state ? 'show': 'hide', modals = $('[' + attr + ']:visible').not(tooltip), @@ -2748,14 +2796,11 @@ function Modal(api) // Create our overlay if it isn't present already if(!overlay) { overlay = self.create(); } - // Prevent modal from conflicting with show.solo - if(overlay.is(':animated') && !state) { return self; } - - // Make sure not to hide the backdrop if other modals are visible - if(!state && modals.length) { return self; } + // Prevent modal from conflicting with show.solo, and don't hide backdrop is other modals are visible + if((overlay.is(':animated') && !state) || (!state && modals.length)) { return self; } // Toggle backdrop cursor style on show - else if(state) { + if(state) { elems.overlay.css('cursor', options.blur ? 'pointer' : ''); } @@ -2774,7 +2819,7 @@ function Modal(api) // Use basic fade function else { - overlay.fadeTo(90, state ? 0.7 : 0, function() { + overlay.fadeTo( parseInt(duration, 10) || 90, state ? 0.7 : 0, function() { if(!state) { $(this).hide(); } }); } @@ -2782,8 +2827,8 @@ function Modal(api) return self; }, - show: function() { return self.toggle(TRUE); }, - hide: function() { return self.toggle(FALSE); }, + show: function(event, duration) { return self.toggle(event, TRUE, duration); }, + hide: function(event, duration) { return self.toggle(event, FALSE, duration); }, destroy: function() { diff --git a/dist/jquery.qtip.min.css b/dist/jquery.qtip.min.css index 4ad08dff..9147bd78 100644 --- a/dist/jquery.qtip.min.css +++ b/dist/jquery.qtip.min.css @@ -1 +1 @@ -.ui-tooltip-fluid{display:block;visibility:hidden;position:static!important;float:left!important;}.ui-tooltip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;}.ui-tooltip-content{position:relative;padding:5px 9px;overflow:hidden;border-width:1px;border-style:solid;text-align:left;word-wrap:break-word;overflow:hidden;}.ui-tooltip-titlebar{position:relative;min-height:14px;padding:5px 35px 5px 10px;overflow:hidden;border-width:1px 1px 0;border-style:solid;font-weight:bold;}.ui-tooltip-titlebar+.ui-tooltip-content{border-top-width:0!important;}/*!Default close button class */ .ui-tooltip-titlebar .ui-state-default{position:absolute;right:4px;top:50%;margin-top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;}* html .ui-tooltip-titlebar .ui-state-default{top:16px;}.ui-tooltip-titlebar .ui-icon,.ui-tooltip-icon .ui-icon{display:block;text-indent:-1000em;}.ui-tooltip-icon,.ui-tooltip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.ui-tooltip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em;}/*!Default tooltip style */ .ui-tooltip-titlebar,.ui-tooltip-content{border-color:#F1D031;background-color:#FFFFA3;color:#555;}.ui-tooltip-titlebar{background-color:#FFEF93;}.ui-tooltip-titlebar .ui-tooltip-icon{border-color:#CCC;background:#F1F1F1;color:#777;}.ui-tooltip-titlebar .ui-state-hover{border-color:#AAA;color:#111;}/*!Light tooltip style */ .ui-tooltip-light .ui-tooltip-titlebar,.ui-tooltip-light .ui-tooltip-content{border-color:#E2E2E2;color:#454545;}.ui-tooltip-light .ui-tooltip-content{background-color:white;}.ui-tooltip-light .ui-tooltip-titlebar{background-color:#f1f1f1;}/*!Dark tooltip style */ .ui-tooltip-dark .ui-tooltip-titlebar,.ui-tooltip-dark .ui-tooltip-content{border-color:#303030;color:#f3f3f3;}.ui-tooltip-dark .ui-tooltip-content{background-color:#505050;}.ui-tooltip-dark .ui-tooltip-titlebar{background-color:#404040;}.ui-tooltip-dark .ui-tooltip-icon{border-color:#444;}.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}/*!Cream tooltip style */ .ui-tooltip-cream .ui-tooltip-titlebar,.ui-tooltip-cream .ui-tooltip-content{border-color:#F9E98E;color:#A27D35;}.ui-tooltip-cream .ui-tooltip-content{background-color:#FBF7AA;}.ui-tooltip-cream .ui-tooltip-titlebar{background-color:#F0DE7D;}.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{background-position:-82px 0;}/*!Red tooltip style */ .ui-tooltip-red .ui-tooltip-titlebar,.ui-tooltip-red .ui-tooltip-content{border-color:#D95252;color:#912323;}.ui-tooltip-red .ui-tooltip-content{background-color:#F78B83;}.ui-tooltip-red .ui-tooltip-titlebar{background-color:#F06D65;}.ui-tooltip-red .ui-state-default .ui-tooltip-icon{background-position:-102px 0;}.ui-tooltip-red .ui-tooltip-icon{border-color:#D95252;}.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{border-color:#D95252;}/*!Green tooltip style */ .ui-tooltip-green .ui-tooltip-titlebar,.ui-tooltip-green .ui-tooltip-content{border-color:#90D93F;color:#3F6219;}.ui-tooltip-green .ui-tooltip-content{background-color:#CAED9E;}.ui-tooltip-green .ui-tooltip-titlebar{background-color:#B0DE78;}.ui-tooltip-green .ui-state-default .ui-tooltip-icon{background-position:-42px 0;}/*!Blue tooltip style */ .ui-tooltip-blue .ui-tooltip-titlebar,.ui-tooltip-blue .ui-tooltip-content{border-color:#ADD9ED;color:#5E99BD;}.ui-tooltip-blue .ui-tooltip-content{background-color:#E5F6FE;}.ui-tooltip-blue .ui-tooltip-titlebar{background-color:#D0E9F5;}.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{background-position:-2px 0;}.ui-tooltip .ui-tooltip-tip{margin:0 auto;overflow:hidden;background:transparent!important;border:0 dashed transparent!important;z-index:10;}.ui-tooltip .ui-tooltip-tip,.ui-tooltip .ui-tooltip-tip *{position:absolute;line-height:.1px!important;font-size:.1px!important;color:#123456;background:transparent;border:0 dashed transparent;}.ui-tooltip .ui-tooltip-tip canvas{position:static;}#qtip-overlay{position:absolute;left:-10000em;top:-10000em;background-color:black;opacity:.7;filter:alpha(opacity=70);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";}/*!Add shadows to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE6+,Safari 2+*/ .ui-tooltip-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);}.ui-tooltip-shadow .ui-tooltip-titlebar,.ui-tooltip-shadow .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3);-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3)";_margin-bottom:-3px;.margin-bottom:-3px;}/*!Add rounded corners to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE9+,Safari 2+*/ .ui-tooltip-rounded,.ui-tooltip-rounded .ui-tooltip-content,.ui-tooltip-tipsy,.ui-tooltip-tipsy .ui-tooltip-content,.ui-tooltip-youtube,.ui-tooltip-youtube .ui-tooltip-content{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.ui-tooltip-rounded .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-titlebar{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.ui-tooltip-rounded .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-tipsy .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-youtube .ui-tooltip-titlebar+.ui-tooltip-content{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px;}/*!Youtube tooltip style */ .ui-tooltip-youtube{-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;}.ui-tooltip-youtube .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-content{background:transparent;background:rgba(0,0,0,0.85);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border-color:#CCC;}.ui-tooltip-youtube .ui-tooltip-icon{border-color:#222;}.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-jtools{background:#232323;background:rgba(0,0,0,0.7);background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333;}.ui-tooltip-jtools .ui-tooltip-titlebar{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";}.ui-tooltip-jtools .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";}.ui-tooltip-jtools .ui-tooltip-titlebar,.ui-tooltip-jtools .ui-tooltip-content{background:transparent;color:white;border:0 dashed transparent;}.ui-tooltip-jtools .ui-tooltip-icon{border-color:#555;}.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{border-color:#333;}.ui-tooltip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,0.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,0.4);box-shadow:4px 4px 5px rgba(0,0,0,0.4);}.ui-tooltip-cluetip .ui-tooltip-titlebar{background-color:#87876A;color:white;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-content{background-color:#D9D9C2;color:#111;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-icon{border-color:#808064;}.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{border-color:#696952;color:#696952;}.ui-tooltip-tipsy{border:0 solid #000;border:0 solid rgba(0,0,0,.87);}.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-content{background:transparent;background:rgba(0,0,0,.87);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border:0 dashed transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:bold;line-height:16px;text-shadow:0 1px black;}.ui-tooltip-tipsy .ui-tooltip-titlebar{padding:6px 35px 0 10;}.ui-tooltip-tipsy .ui-tooltip-content{padding:6px 10;}.ui-tooltip-tipsy .ui-tooltip-icon{border-color:#222;text-shadow:none;}.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-tipped .ui-tooltip-titlebar,.ui-tooltip-tipped .ui-tooltip-content{border:3px solid #959FA9;}.ui-tooltip-tipped .ui-tooltip-titlebar{background:#3A79B8;background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";color:white;font-weight:normal;font-family:serif;border-bottom-width:0;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;}.ui-tooltip-tipped .ui-tooltip-content{background-color:#F9F9F9;color:#454545;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.ui-tooltip-tipped .ui-tooltip-icon{border:2px solid #285589;background:#285589;}.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{background-color:#FBFBFB;color:#555;} \ No newline at end of file +.ui-tooltip-fluid{display:block;visibility:hidden;position:static!important;float:left!important;}.ui-tooltip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;}.ui-tooltip-content{position:relative;padding:5px 9px;overflow:hidden;border-width:1px;border-style:solid;text-align:left;word-wrap:break-word;overflow:hidden;}.ui-tooltip-titlebar{position:relative;min-height:14px;padding:5px 35px 5px 10px;overflow:hidden;border-width:1px 1px 0;border-style:solid;font-weight:bold;}.ui-tooltip-titlebar+.ui-tooltip-content{border-top-width:0!important;}/*!Default close button class */ .ui-tooltip-titlebar .ui-state-default{position:absolute;right:4px;top:50%;margin-top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;}* html .ui-tooltip-titlebar .ui-state-default{top:16px;}.ui-tooltip-titlebar .ui-icon,.ui-tooltip-icon .ui-icon{display:block;text-indent:-1000em;}.ui-tooltip-icon,.ui-tooltip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.ui-tooltip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em;}/*!Default tooltip style */ .ui-tooltip-titlebar,.ui-tooltip-content{border-color:#F1D031;background-color:#FFFFA3;color:#555;}.ui-tooltip-titlebar{background-color:#FFEF93;}.ui-tooltip-titlebar .ui-tooltip-icon{border-color:#CCC;background:#F1F1F1;color:#777;}.ui-tooltip-titlebar .ui-state-hover{border-color:#AAA;color:#111;}/*!Light tooltip style */ .ui-tooltip-light .ui-tooltip-titlebar,.ui-tooltip-light .ui-tooltip-content{border-color:#E2E2E2;color:#454545;}.ui-tooltip-light .ui-tooltip-content{background-color:white;}.ui-tooltip-light .ui-tooltip-titlebar{background-color:#f1f1f1;}/*!Dark tooltip style */ .ui-tooltip-dark .ui-tooltip-titlebar,.ui-tooltip-dark .ui-tooltip-content{border-color:#303030;color:#f3f3f3;}.ui-tooltip-dark .ui-tooltip-content{background-color:#505050;}.ui-tooltip-dark .ui-tooltip-titlebar{background-color:#404040;}.ui-tooltip-dark .ui-tooltip-icon{border-color:#444;}.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}/*!Cream tooltip style */ .ui-tooltip-cream .ui-tooltip-titlebar,.ui-tooltip-cream .ui-tooltip-content{border-color:#F9E98E;color:#A27D35;}.ui-tooltip-cream .ui-tooltip-content{background-color:#FBF7AA;}.ui-tooltip-cream .ui-tooltip-titlebar{background-color:#F0DE7D;}.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{background-position:-82px 0;}/*!Red tooltip style */ .ui-tooltip-red .ui-tooltip-titlebar,.ui-tooltip-red .ui-tooltip-content{border-color:#D95252;color:#912323;}.ui-tooltip-red .ui-tooltip-content{background-color:#F78B83;}.ui-tooltip-red .ui-tooltip-titlebar{background-color:#F06D65;}.ui-tooltip-red .ui-state-default .ui-tooltip-icon{background-position:-102px 0;}.ui-tooltip-red .ui-tooltip-icon{border-color:#D95252;}.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{border-color:#D95252;}/*!Green tooltip style */ .ui-tooltip-green .ui-tooltip-titlebar,.ui-tooltip-green .ui-tooltip-content{border-color:#90D93F;color:#3F6219;}.ui-tooltip-green .ui-tooltip-content{background-color:#CAED9E;}.ui-tooltip-green .ui-tooltip-titlebar{background-color:#B0DE78;}.ui-tooltip-green .ui-state-default .ui-tooltip-icon{background-position:-42px 0;}/*!Blue tooltip style */ .ui-tooltip-blue .ui-tooltip-titlebar,.ui-tooltip-blue .ui-tooltip-content{border-color:#ADD9ED;color:#5E99BD;}.ui-tooltip-blue .ui-tooltip-content{background-color:#E5F6FE;}.ui-tooltip-blue .ui-tooltip-titlebar{background-color:#D0E9F5;}.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{background-position:-2px 0;}.ui-tooltip .ui-tooltip-tip{margin:0 auto;overflow:hidden;background:transparent!important;border:0 dashed transparent!important;z-index:10;}.ui-tooltip .ui-tooltip-tip,.ui-tooltip .ui-tooltip-tip *{position:absolute;line-height:.1px!important;font-size:.1px!important;color:#123456;background:transparent;border:0 dashed transparent;}.ui-tooltip .ui-tooltip-tip canvas{position:static;}#qtip-overlay{position:absolute;left:-10000em;top:-10000em;background-color:black;opacity:.7;filter:alpha(opacity=70);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";}/*!Add shadows to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE6+,Safari 2+*/ .ui-tooltip-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);}.ui-tooltip-shadow .ui-tooltip-titlebar,.ui-tooltip-shadow .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3);-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3)";_margin-bottom:-3px;.margin-bottom:-3px;}/*!Add rounded corners to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE9+,Safari 2+*/ .ui-tooltip-rounded,.ui-tooltip-rounded .ui-tooltip-content,.ui-tooltip-tipsy,.ui-tooltip-tipsy .ui-tooltip-content,.ui-tooltip-youtube,.ui-tooltip-youtube .ui-tooltip-content{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.ui-tooltip-rounded .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-titlebar{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.ui-tooltip-rounded .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-tipsy .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-youtube .ui-tooltip-titlebar+.ui-tooltip-content{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px;}/*!Youtube tooltip style */ .ui-tooltip-youtube{-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;}.ui-tooltip-youtube .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-content{background:transparent;background:rgba(0,0,0,0.85);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border-color:#CCC;}.ui-tooltip-youtube .ui-tooltip-icon{border-color:#222;}.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-jtools{background:#232323;background:rgba(0,0,0,0.7);background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333;}.ui-tooltip-jtools .ui-tooltip-titlebar{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";}.ui-tooltip-jtools .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";}.ui-tooltip-jtools .ui-tooltip-titlebar,.ui-tooltip-jtools .ui-tooltip-content{background:transparent;color:white;border:0 dashed transparent;}.ui-tooltip-jtools .ui-tooltip-icon{border-color:#555;}.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{border-color:#333;}.ui-tooltip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,0.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,0.4);box-shadow:4px 4px 5px rgba(0,0,0,0.4);}.ui-tooltip-cluetip .ui-tooltip-titlebar{background-color:#87876A;color:white;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-content{background-color:#D9D9C2;color:#111;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-icon{border-color:#808064;}.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{border-color:#696952;color:#696952;}.ui-tooltip-tipsy{border:0;}.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-content{background:transparent;background:rgba(0,0,0,.87);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border:0 transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:bold;line-height:16px;text-shadow:0 1px black;}.ui-tooltip-tipsy .ui-tooltip-titlebar{padding:6px 35px 0 10;}.ui-tooltip-tipsy .ui-tooltip-content{padding:6px 10;}.ui-tooltip-tipsy .ui-tooltip-icon{border-color:#222;text-shadow:none;}.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-tipped .ui-tooltip-titlebar,.ui-tooltip-tipped .ui-tooltip-content{border:3px solid #959FA9;}.ui-tooltip-tipped .ui-tooltip-titlebar{background:#3A79B8;background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";color:white;font-weight:normal;font-family:serif;border-bottom-width:0;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;}.ui-tooltip-tipped .ui-tooltip-content{background-color:#F9F9F9;color:#454545;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.ui-tooltip-tipped .ui-tooltip-icon{border:2px solid #285589;background:#285589;}.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{background-color:#FBFBFB;color:#555;} \ No newline at end of file diff --git a/dist/jquery.qtip.min.js b/dist/jquery.qtip.min.js index 4a78c792..0bcd4632 100644 --- a/dist/jquery.qtip.min.js +++ b/dist/jquery.qtip.min.js @@ -9,5 +9,5 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Apr 23 00:41:47 2011 +0100 -*/"use strict",function(a,b,c){function z(b){var c=this,d=b.elements,e=d.tooltip,f=".bgiframe-"+b.id;a.extend(c,{init:function(){d.bgiframe=a(''),d.bgiframe.appendTo(e),e.bind("tooltipmove"+f,c.adjust)},adjust:function(){var a=b.get("dimensions"),c=b.plugins.tip,f=d.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},c&&f&&(g=c.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),d.bgiframe.css(h).css(a)},destroy:function(){d.bgiframe.remove(),e.unbind(f)}}),c.init()}function y(c){var f=this,g=c.options.show.modal,h=c.elements,i=h.tooltip,j="#qtip-overlay",k=".qtipmodal",l=k+c.id,m="is-modal-qtip",o;c.checks.modal={"^show.modal.(on|blur)$":function(){f.init(),h.overlay.toggle(i.is(":visible"))}},a.extend(f,{init:function(){if(!g.on)return f;o=f.create(),i.attr(m,d).unbind(k).unbind(l).bind("tooltipshow"+k+" tooltiphide"+k,function(a,b,c){f[a.type.replace("tooltip","")](c)}).bind("tooltipfocus"+k,function(a,b,c){o.css("z-index",c-1)}).bind("tooltipblur"+k,function(b){a("["+m+"]:visible").not(i).last().qtip("focus",b)}),g.escape&&a(b).unbind(l).bind("keydown"+l,function(a){a.keyCode===27&&i.hasClass(n)&&c.hide(a)}),g.blur&&h.overlay.unbind(l).bind("click"+l,function(a){i.hasClass(n)&&c.hide(a)});return f},create:function(){var c=a(j);if(c.length){h.overlay=c;return c}o=h.overlay=a("
",{id:j.substr(1),css:{position:"absolute",top:0,left:0,display:"none"},mousedown:function(){return e}}).appendTo(document.body),a(b).unbind(k).bind("resize"+k,function(){o.css({height:Math.max(a(b).height(),a(document).height()),width:Math.max(a(b).width(),a(document).width())})}).trigger("resize");return o},toggle:function(b){var c=g.effect,j=b?"show":"hide",k=a("["+m+"]:visible").not(i),l;o||(o=f.create());if(o.is(":animated")&&!b)return f;if(!b&&k.length)return f;b&&h.overlay.css("cursor",g.blur?"pointer":""),o.stop(d,e),a.isFunction(c)?c.call(o,b):c===e?o[j]():o.fadeTo(90,b?.7:0,function(){b||a(this).hide()});return f},show:function(){return f.toggle(d)},hide:function(){return f.toggle(e)},destroy:function(){var d=o;d&&(d=a("["+m+"]").not(i).length<1,d?(h.overlay.remove(),a(b).unbind(k)):h.overlay.unbind(k+c.id));return i.removeAttr(m).unbind(k)}}),f.init()}function x(b,g){function v(a){var b=a.precedance==="y",c=n[b?"width":"height"],d=n[b?"height":"width"],e=a.string().indexOf("center")>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,i,j,k,l=Math.sqrt(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];m[2]=Math.sqrt(g(m[0],2)-g(p,2)),m[3]=Math.sqrt(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)];return{height:k[b?0:1],width:k[b?1:0]}}function u(b){var c=k.titlebar&&b.y==="top",d=c?k.titlebar:k.content,e=a.browser.mozilla,f=e?"-moz-":a.browser.webkit?"-webkit-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"border-radius-"+g:"border-"+g+"-radius");return parseInt(d.css(h),10)||parseInt(l.css(h),10)||0}function t(a,b,c){b=b?b:a[a.precedance];var d=k.titlebar&&a.y==="top",e=d?k.titlebar:k.content,f="border-"+b+"-width",g=parseInt(e.css(f),10);return(c?g||parseInt(l.css(f),10):g)||0}function s(f,g,h,l){if(k.tip){var n=a.extend({},i.corner),o=h.adjusted,p=b.options.position.adjust.method.split(" "),q=p[0],r=p[1]||p[0],s={left:e,top:e,x:0,y:0},t,u={},v;i.corner.fixed!==d&&(q==="shift"&&n.precedance==="x"&&o.left&&n.y!=="center"?n.precedance=n.precedance==="x"?"y":"x":q==="flip"&&o.left&&(n.x=n.x==="center"?o.left>0?"left":"right":n.x==="left"?"right":"left"),r==="shift"&&n.precedance==="y"&&o.top&&n.x!=="center"?n.precedance=n.precedance==="y"?"x":"y":r==="flip"&&o.top&&(n.y=n.y==="center"?o.top>0?"top":"bottom":n.y==="top"?"bottom":"top"),n.string()!==m.corner&&(m.top!==o.top||m.left!==o.left)&&i.update(n,e)),t=i.position(n,o),t.right!==c&&(t.left=-t.right),t.bottom!==c&&(t.top=-t.bottom),t.user=Math.max(0,j.offset);if(s.left=q==="shift"&&!!o.left)n.x==="center"?u["margin-left"]=s.x=t["margin-left"]-o.left:(v=t.right!==c?[o.left,-t.left]:[-o.left,t.left],(s.x=Math.max(v[0],v[1]))>v[0]&&(h.left-=o.left,s.left=e),u[t.right!==c?"right":"left"]=s.x);if(s.top=r==="shift"&&!!o.top)n.y==="center"?u["margin-top"]=s.y=t["margin-top"]-o.top:(v=t.bottom!==c?[o.top,-t.top]:[-o.top,t.top],(s.y=Math.max(v[0],v[1]))>v[0]&&(h.top-=o.top,s.top=e),u[t.bottom!==c?"bottom":"top"]=s.y);k.tip.css(u).toggle(!(s.x&&s.y||n.x==="center"&&s.y||n.y==="center"&&s.x)),h.left-=t.left.charAt?t.user:q!=="shift"||s.top||!s.left&&!s.top?t.left:0,h.top-=t.top.charAt?t.user:r!=="shift"||s.left||!s.left&&!s.top?t.top:0,m.left=o.left,m.top=o.top,m.corner=n.string()}}var i=this,j=b.options.style.tip,k=b.elements,l=k.tooltip,m={top:0,left:0,corner:""},n={width:j.width,height:j.height},o={},p=j.border||0,q=".qtip-tip",r=a("")[0].getContext;i.corner=f,i.mimic=f,i.position={},b.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){i.init()||i.destroy(),b.reposition()},"^style.tip.(height|width)$":function(){n={width:j.width,height:j.height},i.create(),i.update(),b.reposition()},"^content.title.text|style.(classes|widget)$":function(){k.tip&&i.update()}},a.extend(i,{init:function(){var b=i.detectCorner()&&(r||a.browser.msie);b&&(i.create(),i.update(),l.unbind(q).bind("tooltipmove"+q,s));return b},detectCorner:function(){var a=j.corner,c=b.options.position,f=c.at,g=c.my.string?c.my.string():c.my;if(a===e||g===e&&f===e)return e;a===d?i.corner=new h.Corner(g):a.string||(i.corner=new h.Corner(a),i.corner.fixed=d);return i.corner.string()!=="centercenter"},detectColours:function(){var c,d,e,f=k.tip.css({backgroundColor:"",border:""}),g=i.corner,h=g[g.precedance],m="border-"+h+"-color",p="border"+h.charAt(0)+h.substr(1)+"Color",q=/rgba?\(0, 0, 0(, 0)?\)|transparent/i,r="background-color",s="transparent",t="ui-tooltip-fluid",u=a(document.body).css("color"),v=b.elements.content.css("color"),w=k.titlebar&&(g.y==="top"||g.y==="center"&&f.position().top+n.height/2+j.offset",{"class":"ui-tooltip-tip"}).css({width:b,height:c}).prependTo(l),r?a("").appendTo(k.tip)[0].getContext("2d").save():(d='',k.tip.html(p?d+=d:d))},update:function(b,c){var g=k.tip,l=g.children(),m=n.width,q=n.height,s="px solid ",u="px dashed transparent",x=j.mimic,y=Math.round,z,A,B,C,D;b||(b=i.corner),x===e?x=b:(x=new h.Corner(x),x.precedance=b.precedance,x.x==="inherit"?x.x=b.x:x.y==="inherit"?x.y=b.y:x.x===x.y&&(x[b.precedance]=b[b.precedance])),z=x.precedance,i.detectColours(),p=o.border==="transparent"||o.border==="#123456"?0:j.border===d?t(b,f,d):j.border,B=w(x,m,q),D=v(b),g.css(D),b.precedance==="y"?C=[y(x.x==="left"?p:x.x==="right"?D.width-m-p:(D.width-m)/2),y(x.y==="top"?D.height-q:0)]:C=[y(x.x==="left"?D.width-m:0),y(x.y==="top"?p:x.y==="bottom"?D.height-q-p:(D.height-q)/2)],r?(l.attr(D),A=l[0].getContext("2d"),A.restore(),A.save(),A.clearRect(0,0,3e3,3e3),A.translate(C[0],C[1]),A.beginPath(),A.moveTo(B[0][0],B[0][1]),A.lineTo(B[1][0],B[1][1]),A.lineTo(B[2][0],B[2][1]),A.closePath(),A.fillStyle=o.fill,A.strokeStyle=o.border,A.lineWidth=p*2,A.lineJoin="miter",A.miterLimit=100,A.stroke(),A.fill()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" xe",C[2]=p&&/^(r|b)/i.test(b.string())?parseFloat(a.browser.version,10)===8?2:1:0,l.css({antialias:""+(x.string().indexOf("center")>-1),left:C[0]-C[2]*Number(z==="x"),top:C[1]-C[2]*Number(z==="y"),width:m+p,height:q+p}).each(function(b){var c=a(this);c.attr({coordsize:m+p+" "+(q+p),path:B,fillcolor:o.fill,filled:!!b,stroked:!b}).css({display:p||b?"block":"none"}),!b&&p>0&&c.html()===""&&c.html('')})),c!==e&&i.position(b)},position:function(b){var c=k.tip,f={},g=Math.max(0,j.offset),h,l,m;if(j.corner===e||!c)return e;b=b||i.corner,h=b.precedance,l=v(b),m=[b.x,b.y],h==="x"&&m.reverse(),a.each(m,function(a,c){var e,i;c==="center"?(e=h==="y"?"left":"top",f[e]="50%",f["margin-"+e]=-Math.round(l[h==="y"?"width":"height"]/2)+g):(e=t(b,c,d),i=u(b),f[c]=a?t(b,c):g+(i>e?i:0))}),f[b[h]]-=l[h==="x"?"width":"height"],c.css({top:"",bottom:"",left:"",right:"",margin:""}).css(f);return f},destroy:function(){k.tip&&k.tip.remove(),l.unbind(q)}}),i.init()}function w(a,b,c){var d=Math.ceil(b/2),e=Math.ceil(c/2),f={bottomright:[[0,0],[b,c],[b,0]],bottomleft:[[0,0],[b,0],[0,c]],topright:[[0,c],[b,0],[b,c]],topleft:[[0,0],[0,c],[b,c]],topcenter:[[0,c],[d,0],[b,c]],bottomcenter:[[0,0],[b,0],[d,c]],rightcenter:[[0,0],[b,e],[0,c]],leftcenter:[[b,0],[b,c],[0,e]]};f.lefttop=f.bottomright,f.righttop=f.bottomleft,f.leftbottom=f.topright,f.rightbottom=f.topleft;return f[a.string()]}function v(b){var c=this,f=b.elements.tooltip,g=b.options.content.ajax,h=".qtip-ajax",i=/)<[^<]*)*<\/script>/gi,j=d;b.checks.ajax={"^content.ajax":function(a,b,d){b==="ajax"&&(g=d),b==="once"?c.init():g&&g.url?c.load():f.unbind(h)}},a.extend(c,{init:function(){g&&g.url&&f.unbind(h)[g.once?"one":"bind"]("tooltipshow"+h,c.load);return c},load:function(d,h){function p(a,c,d){b.set("content.text",c+": "+d),n()}function o(c){l&&(c=a("
").append(c.replace(i,"")).find(l)),b.set("content.text",c),n()}function n(){m&&(f.css("visibility",""),h=e)}if(d&&d.isDefaultPrevented())return c;var j=g.url.indexOf(" "),k=g.url,l,m=g.once&&!g.loading&&h;m&&f.css("visibility","hidden"),j>-1&&(l=k.substr(j),k=k.substr(0,j)),a.ajax(a.extend({success:o,error:p,context:b},g,{url:k}));return c}}),c.init()}function u(b,c){var i,j,k,l,m=a(this),n=a(document.body),o=this===document?n:m,p=m.metadata?m.metadata(c.metadata):f,u=c.metadata.type==="html5"&&p?p[c.metadata.name]:f,v=m.data(c.metadata.name||"qtipopts");try{v=typeof v==="string"?(new Function("return "+v))():v}catch(w){r("Unable to parse HTML5 attribute data: "+v)}l=a.extend(d,{},g.defaults,c,typeof v==="object"?s(v):f,s(u||p)),p&&a.removeData(this,"metadata"),j=l.position,l.id=b;if("boolean"===typeof l.content.text){k=m.attr(l.content.attr);if(l.content.attr!==e&&k)l.content.text=k;else return e}j.container===e&&(j.container=n),j.target===e&&(j.target=o),l.show.target===e&&(l.show.target=o),l.show.solo===d&&(l.show.solo=n),l.hide.target===e&&(l.hide.target=o),l.position.viewport===d&&(l.position.viewport=j.container),j.at=new h.Corner(j.at),j.my=new h.Corner(j.my);if(a.data(this,"qtip"))if(l.overwrite)m.qtip("destroy");else if(l.overwrite===e)return e;a.attr(this,"title")&&(a.attr(this,q,a.attr(this,"title")),this.removeAttribute("title")),i=new t(m,l,b,!!k),a.data(this,"qtip",i),m.bind("remove.qtip",function(){i.destroy()});return i}function t(c,o,p,r){function K(c,d,e,f){f=parseInt(f,10)!==0;var g=".qtip-"+p,h={show:c&&o.show.target[0],hide:d&&o.hide.target[0],tooltip:e&&t.rendered&&z.tooltip[0],content:e&&t.rendered&&z.content[0],container:f&&o.position.container[0]===u?document:o.position.container[0],window:f&&b};t.rendered?a([]).pushStack(a.grep([h.show,h.hide,h.tooltip,h.container,h.content,h.window],function(a){return typeof a==="object"})).unbind(g):c&&o.show.target.unbind(g+"-create")}function J(d,f,h,j){function C(a){y.is(":visible")&&t.reposition(a)}function B(a){if(y.hasClass(l))return e;clearTimeout(t.timers.inactive),t.timers.inactive=setTimeout(function(){t.hide(a)},o.hide.inactive)}function x(b){if(y.hasClass(l))return e;var c=a(b.relatedTarget||b.target),d=c.closest(m)[0]===y[0],f=c[0]===q.show[0];clearTimeout(t.timers.show),clearTimeout(t.timers.hide);if(n.target==="mouse"&&d||o.hide.fixed&&(/mouse(out|leave|move)/.test(b.type)&&(d||f))){b.stopPropagation(),b.preventDefault();return e}o.hide.delay>0?t.timers.hide=setTimeout(function(){t.hide(b)},o.hide.delay):t.hide(b)}function w(a){if(y.hasClass(l))return e;q.show.trigger("qtip-"+p+"-inactive"),clearTimeout(t.timers.show),clearTimeout(t.timers.hide);var b=function(){t.show(a)};o.show.delay>0?t.timers.show=setTimeout(b,o.show.delay):b()}var k=".qtip-"+p,n=o.position,q={show:o.show.target,hide:o.hide.target,container:n.container[0]===u?a(document):n.container,doc:a(document)},r={show:a.trim(""+o.show.event).split(" "),hide:a.trim(""+o.hide.event).split(" ")},s=a.browser.msie&&parseInt(a.browser.version,10)===6,v;h&&(o.hide.fixed&&(q.hide=q.hide.add(y),y.bind("mouseover"+k,function(){y.hasClass(l)||clearTimeout(t.timers.hide)})),n.target==="mouse"&&n.adjust.mouse&&o.hide.event&&y.bind("mouseleave"+k,function(a){(a.relatedTarget||a.target)!==q.show[0]&&t.hide(a)}),y.bind("mouseenter"+k+" mouseleave"+k,function(a){t[a.type==="mouseenter"?"focus":"blur"](a)})),f&&("number"===typeof o.hide.inactive&&(q.show.bind("qtip-"+p+"-inactive",B),a.each(g.inactiveEvents,function(a,b){q.hide.add(z.tooltip).bind(b+k+"-inactive",B)})),a.each(r.hide,function(b,c){var d=a.inArray(c,r.show),e=a(q.hide);d>-1&&e.add(q.show).length===e.length||c==="unfocus"?(q.show.bind(c+k,function(a){y.is(":visible")?x(a):w(a)}),delete r.show[d]):q.hide.bind(c+k,x)})),d&&(a.each(r.show,function(a,b){q.show.bind(b+k,w)}),"number"===typeof o.hide.distance&&q.show.bind("mousemove"+k,function(a){var b=A.coords||[],c=o.hide.distance;b&&(Math.abs(a.pageX-b[0])>=c||Math.abs(a.pageY-b[1])>=c)&&t.hide(a)})),j&&((n.adjust.resize||n.viewport)&&a(a.event.special.resize?n.viewport:b).bind("resize"+k,C),(n.viewport||s&&y.css("position")==="fixed")&&a(n.viewport).bind("scroll"+k,C),/unfocus/i.test(o.hide.event)&&q.doc.bind("mousedown"+k,function(b){var d=a(b.target);d.parents(m).length===0&&d.add(c).length>1&&y.is(":visible")&&!y.hasClass(l)&&t.hide(b)}),o.hide.leave&&/mouseleave|mouseout/i.test(o.hide.event)&&a(b).bind("blur"+k+" mouse"+(o.hide.leave.indexOf("frame")>-1?"out":"leave")+k,function(a){a.relatedTarget||t.hide(a)}),n.target==="mouse"&&q.doc.bind("mousemove"+k,function(a){n.adjust.mouse&&!y.hasClass(l)&&y.is(":visible")&&t.reposition(a||i)}))}function I(b,d){function g(a){function c(c){(b=b.not(this)).length===0&&(t.redraw(),t.reposition(A.event),a())}var b;if((b=f.find("img:not([height]):not([width])")).length===0)return c.call(b);b.each(function(a,b){(function d(){var e=t.timers.img;if(b.height&&b.width){clearTimeout(e[a]);return c.call(b)}e[a]=setTimeout(d,20)})()})}var f=z.content;b=b||o.content.text;if(!t.rendered||!b)return e;a.isFunction(b)&&(b=b.call(c,t)||""),b.jquery&&b.length>0?f.empty().append(b.css({display:"block"})):f.html(b),t.rendered<0?y.queue("fx",g):(x=0,g(a.noop));return t}function H(b){var d=z.title;if(!t.rendered||!b)return e;a.isFunction(b)&&(b=b.call(c,t)||""),b.jquery&&b.length>0?d.empty().append(b.css({display:"block"})):d.html(b),t.redraw(),t.rendered&&y.is(":visible")&&t.reposition(A.event)}function G(a){var b=z.button,c=z.title;if(!t.rendered)return e;a?(c||F(),E()):b.remove()}function F(){var b=v+"-title";z.titlebar&&D(),z.titlebar=a("
",{"class":j+"-titlebar "+(o.style.widget?"ui-widget-header":"")}).append(z.title=a("
",{id:b,"class":j+"-title","aria-atomic":d})).insertBefore(z.content),o.content.title.button?E():t.rendered&&t.redraw()}function E(){var b=o.content.title.button,c=typeof b==="string",d=c?b:"Close tooltip";z.button&&z.button.remove(),b.jquery?z.button=b:z.button=a("",{"class":"ui-state-default "+(o.style.widget?"":j+"-icon"),title:d,"aria-label":d}).prepend(a("",{"class":"ui-icon ui-icon-close",html:"×"})),z.button.appendTo(z.titlebar).attr("role","button").hover(function(b){a(this).toggleClass("ui-state-hover",b.type==="mouseenter")}).click(function(a){y.hasClass(l)||t.hide(a);return e}).bind("mousedown keydown mouseup keyup mouseout",function(b){a(this).toggleClass("ui-state-active ui-state-focus",b.type.substr(-4)==="down")}),t.redraw()}function D(){z.title&&(z.titlebar.remove(),z.titlebar=z.title=z.button=f,t.reposition())}function C(){var a=o.style.widget;y.toggleClass(k,a),z.content.toggleClass(k+"-content",a),z.titlebar&&z.titlebar.toggleClass(k+"-header",a),z.button&&z.button.toggleClass(j+"-icon",!a)}function B(a){var b=0,c,d=o,e=a.split(".");while(d=d[e[b++]])b0&&!a("#"+i).length&&(y[0].id=i,z.content[0].id=i+"-content",z.title[0].id=i+"-title")},"^content.text$":function(a,b,c){I(c)},"^content.title.text$":function(a,b,c){if(!c)return D();!z.title&&c&&F(),H(c)},"^content.title.button$":function(a,b,c){G(c)},"^position.(my|at)$":function(a,b,c){"string"===typeof c&&(a[b]=new h.Corner(c))},"^position.container$":function(a,b,c){t.rendered&&y.appendTo(c)},"^(show|hide).(event|target|fixed|delay|inactive)$":function(a,b,c,d,e){var f=[1,0,0];f[e[1]==="show"?"push":"unshift"](0),K.apply(t,f),J.apply(t,[1,1,0,0])},"^show.ready$":function(){t.rendered?t.show():t.render(1)},"^style.classes$":function(b,c,d){a.attr(y[0],"class",j+" qtip ui-helper-reset "+d)},"^style.widget|content.title":C,"^events.(render|show|move|hide|focus|blur)$":function(b,c,d){y[(a.isFunction(d)?"":"un")+"bind"]("tooltip"+c,d)}},a.extend(t,{render:function(b){if(t.rendered)return t;var f=o.content.title.text,g=a.Event("tooltiprender");a.attr(c[0],"aria-describedby",v),y=z.tooltip=a("
",{id:v,"class":j+" qtip ui-helper-reset "+o.style.classes,width:o.style.width||"",role:"alert","aria-live":"polite","aria-atomic":e,"aria-describedby":v+"-content","aria-hidden":d}).toggleClass(l,A.disabled).data("qtip",t).appendTo(o.position.container).append(z.content=a("
",{"class":j+"-content",id:v+"-content","aria-atomic":d})),t.rendered=-1,x=1,f&&(F(),H(f)),I(),t.rendered=d,C(),a.each(o.events,function(b,c){a.isFunction(c)&&y.bind(b==="toggle"?"tooltipshow tooltiphide":"tooltip"+b,c)}),a.each(h,function(){this.initialize==="render"&&this(t)}),J(1,1,1,1),y.queue("fx",function(a){g.originalEvent=A.event,y.trigger(g,[t]),x=0,t.redraw(),(o.show.ready||b)&&t.show(A.event),a()});return t},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:y.outerHeight(),width:y.outerWidth()};break;case"offset":b=h.offset(y,o.position.container);break;default:c=B(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(b,c){function m(a,b){var c,d,e;for(c in k)for(d in k[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),k[c][d].apply(t,b)}var g=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,i=e,j=e,k=t.checks,l;"string"===typeof b?(l=b,b={},b[l]=c):b=a.extend(d,{},b),a.each(b,function(c,d){var e=B(c.toLowerCase()),f;f=e[0][e[1]],e[0][e[1]]="object"===typeof d&&d.nodeType?a(d):d,b[c]=[e[0],e[1],d,f],i=g.test(c)||i,j=h.test(c)||j}),s(o),w=x=1,a.each(b,m),w=x=0,y.is(":visible")&&t.rendered&&(i&&t.reposition(o.position.target==="mouse"?f:A.event),j&&t.redraw());return t},toggle:function(b,c){function k(){b?(a.browser.msie&&y[0].style.removeAttribute("filter"),y.css("overflow","")):y.css({display:"",visibility:"",width:"",opacity:"",left:"",top:""})}if(!t.rendered)if(b)t.render(1);else return t;var d=b?"show":"hide",g=o[d],h=y.is(":visible"),i,j;(typeof b).search("boolean|number")&&(b=!h);if(h===b)return t;if(c){if(/over|enter/.test(c.type)&&/out|leave/.test(A.event.type)&&c.target===o.show.target[0]&&y.has(c.relatedTarget).length)return t;A.event=a.extend({},c)}j=a.Event("tooltip"+d),j.originalEvent=c?A.event:f,y.trigger(j,[t,90]);if(j.isDefaultPrevented())return t;a.attr(y[0],"aria-hidden",!b),b?(t.focus(c),a.isFunction(o.content.text)&&I(),t.reposition(c),g.solo&&a(m,g.solo).not(y).qtip("hide",j),"number"===typeof o.hide.distance&&(A.coords=[c.pageX,c.pageY])):(clearTimeout(t.timers.show),delete A.coords,t.blur(c)),y.stop(0,1),a.isFunction(g.effect)?(g.effect.call(y,t),y.queue("fx",function(a){k(),a()})):g.effect===e?(y[d](),k.call(y)):y.fadeTo(90,b?1:0,k),b&&g.target.trigger("qtip-"+p+"-inactive");return t},show:function(a){return t.toggle(d,a)},hide:function(a){return t.toggle(e,a)},focus:function(b){if(!t.rendered)return t;var c=a(m),d=parseInt(y[0].style.zIndex,10),e=g.zindex+c.length,f=a.extend({},b),h,i;y.hasClass(n)||(d!==e&&(c.each(function(){this.style.zIndex>d&&(this.style.zIndex=this.style.zIndex-1)}),c.filter("."+n).qtip("blur",f)),i=a.Event("tooltipfocus"),i.originalEvent=f,y.trigger(i,[t,e]),i.isDefaultPrevented()||(y.addClass(n)[0].style.zIndex=e));return t},blur:function(b){var c=a.extend({},b),d;y.removeClass(n),d=a.Event("tooltipblur"),d.originalEvent=c,y.trigger(d,[t]);return t},reposition:function(c,d){if(!t.rendered||w)return t;w=1;var f=o.position.target,g=o.position,k=g.my,l=g.at,m=g.adjust,n=m.method.split(" "),p=y.outerWidth(),q=y.outerHeight(),r=0,s=0,v=a.Event("tooltipmove"),x=y.css("position")==="fixed",z=g.viewport,B={left:0,top:0},C=(t.plugins.tip||{}).corner,D={horizontal:n[0],vertical:n[1]||n[0],tip:o.style.tip,left:function(a){var b=z.offset.left+z.scrollLeft,c=k.x==="left"?p:k.x==="right"?-p:-p/2,d=l.x==="left"?r:l.x==="right"?-r:-r/2,e=C&&C.precedance==="y"?D.tip.width+D.tip.border*2:0,f=b-a-e,g=a+p-z.width-b+e,h=c-(k.precedance==="x"||k.x===k.y?d:0),i=k.x==="center";D.horizontal==="shift"?(B.left+=f>0?f:g>0?-g:0,B.left=Math.min(Math.max(b,B.left),Math.max(f>0?-1e9:0,b+z.width-p))):(f>0&&(k.x!=="left"||g>0)?B.left-=h+(i?0:2*m.x):g>0&&(k.x!=="right"||f>0)&&(B.left-=i?-h:h+2*m.x),B.left!==a&&i&&(B.left-=m.x),B.leftg&&(B.left=a));return B.left-a},top:function(a){var b=z.offset.top+z.scrollTop,c=k.y==="top"?q:k.y==="bottom"?-q:-q/2,d=l.y==="top"?s:l.y==="bottom"?-s:-s/2,e=C&&C.precedance==="x"?D.tip.height+D.tip.border*2:0,f=b-a-e,g=a+q-z.height-b+e,h=c-(k.precedance==="y"||k.x===k.y?d:0),i=k.y==="center";D.vertical==="shift"?(B.top+=f>0?f:g>0?-g:0,B.top=Math.min(Math.max(b,B.top),Math.max(f>0?-1e9:0,b+z.height-q))):(f>0&&(k.y!=="top"||g>0)?B.top-=h+(i?0:2*m.y):g>0&&(k.y!=="bottom"||f>0)&&(B.top-=i?-h:h+2*m.y),B.top!==a&&i&&(B.top-=m.y),B.top<0&&-B.top>g&&(B.top=a));return B.top-a}};z=z?{elem:z,height:z[(z[0]===b?"h":"outerH")+"eight"](),width:z[(z[0]===b?"w":"outerW")+"idth"](),scrollLeft:z.scrollLeft(),scrollTop:z.scrollTop(),offset:z.offset()||{left:0,top:0}}:e;if(f==="mouse")l={x:"left",y:"top"},c=c&&(c.type==="resize"||c.type==="scroll")?A.event:m.mouse||!c||!c.pageX||/over|enter$/i.test(c.type)&&!m.mouse?a.extend({},i):c,B={top:c.pageY,left:c.pageX};else{f==="event"&&(c&&c.target&&c.type!=="scroll"&&c.type!=="resize"?f=A.target=a(c.target):f=A.target),f=a(f).eq(0);if(f.length===0)return t;f[0]===document||f[0]===b?(r=f.width(),s=f.height(),f[0]===b&&(B={top:!x||h.iOS?z.scrollTop:0,left:!x||h.iOS?z.scrollLeft:0})):f.is("area")&&h.imagemap?B=h.imagemap(f,l):f[0].namespaceURI=="http://www.w3.org/2000/svg"&&h.svg?B=h.svg(f,l):(r=f.outerWidth(),s=f.outerHeight(),B=h.offset(f,g.container)),B.offset&&(r=B.width,s=B.height,B=B.offset),B.left+=l.x==="right"?r:l.x==="center"?r/2:0,B.top+=l.y==="bottom"?s:l.y==="center"?s/2:0}B.left+=m.x+(k.x==="right"?-p:k.x==="center"?-p/2:0),B.top+=m.y+(k.y==="bottom"?-q:k.y==="center"?-q/2:0),g.viewport.jquery&&f[0]!==b&&f[0]!==u?B.adjusted={left:D.horizontal!=="none"?D.left(B.left):0,top:D.vertical!=="none"?D.top(B.top):0}:B.adjusted={left:0,top:0},y.attr("class",function(b,c){return a.attr(this,"class").replace(/ui-tooltip-pos-\w+/i,"")}).addClass(j+"-pos-"+k.abbreviation()),v.originalEvent=a.extend({},c),y.trigger(v,[t,B,z.elem]);if(v.isDefaultPrevented())return t;delete B.adjusted,d===e||isNaN(B.left)||isNaN(B.top)||!a.isFunction(g.effect)?y.css(B):a.isFunction(g.effect)&&(g.effect.call(y,t,a.extend({},B)),y.queue(function(b){a(this).css({opacity:"",height:""}),a.browser.msie&&this.style.removeAttribute("filter"),b()})),w=0;return t},redraw:function(){if(t.rendered<1||o.style.width||x)return t;var b=j+"-fluid",c,d,e;x=1,y.css("width","").addClass(b),c=y.width()+(a.browser.mozilla?1:0),d=parseInt(y.css("max-width"),10)||0,e=parseInt(y.css("min-width"),10)||0,c=d+e?Math.min(Math.max(c,e),d):c,y.css("width",c).removeClass(b),x=0;return t},disable:function(b){var c=l;"boolean"!==typeof b&&(b=!y.hasClass(c)&&!A.disabled),t.rendered?(y.toggleClass(c,b),a.attr(y[0],"aria-disabled",b)):A.disabled=!!b;return t},enable:function(){return t.disable(e)},destroy:function(){var b=c[0],d=a.attr(b,q);t.rendered&&(y.remove(),a.each(t.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(t.timers.show),clearTimeout(t.timers.hide),K(1,1,1,1),a.removeData(b,"qtip"),d&&(a.attr(b,"title",d),c.removeAttr(q)),c.removeAttr("aria-describedby").unbind(".qtip");return c}})}function s(b){var c;if(!b||"object"!==typeof b)return e;"object"!==typeof b.metadata&&(b.metadata={type:b.metadata});if("content"in b){if("object"!==typeof b.content||b.content.jquery)b.content={text:b.content};c=b.content.text||e,!a.isFunction(c)&&(!c&&!c.attr||c.length<1||"object"===typeof c&&!c.jquery)&&(b.content.text=e),"title"in b.content&&("object"!==typeof b.content.title&&(b.content.title={text:b.content.title}),c=b.content.title.text||e,!a.isFunction(c)&&(!c&&!c.attr||c.length<1||"object"===typeof c&&!c.jquery)&&(b.content.title.text=e))}"position"in b&&("object"!==typeof b.position&&(b.position={my:b.position,at:b.position})),"show"in b&&("object"!==typeof b.show&&(b.show.jquery?b.show={target:b.show}:b.show={event:b.show})),"hide"in b&&("object"!==typeof b.hide&&(b.hide.jquery?b.hide={target:b.hide}:b.hide={event:b.hide})),"style"in b&&("object"!==typeof b.style&&(b.style={classes:b.style})),a.each(h,function(){this.sanitize&&this.sanitize(b)});return b}function r(){var c=b.console;return c&&(c.error||c.log||a.noop).apply(c,arguments)}var d=!0,e=!1,f=null,g,h,i,j="ui-tooltip",k="ui-widget",l="ui-state-disabled",m="div.qtip."+j,n=j+"-focus",o="-31000px",p="_replacedByqTip",q="oldtitle";g=a.fn.qtip=function(b,h,i){var j=(""+b).toLowerCase(),k=f,l=j==="disable"?[d]:a.makeArray(arguments).slice(1,10),m=l[l.length-1],n=this[0]?a.data(this[0],"qtip"):f;if(!arguments.length&&n||j==="api")return n;if("string"===typeof b){this.each(function(){var b=a.data(this,"qtip");if(!b)return d;m&&m.timeStamp&&(b.cache.event=m);if(j!=="option"&&j!=="options"||!h)b[j]&&b[j].apply(b[j],l);else if(a.isPlainObject(h)||i!==c)b.set(h,i);else{k=b.get(h);return e}});return k!==f?k:this}if("object"===typeof b||!arguments.length){n=s(a.extend(d,{},b));return g.bind.call(this,n,m)}},g.bind=function(b,c){return this.each(function(f){function p(b){function c(){o.render(typeof b==="object"||i.show.ready),k.show.unbind(l.show),k.hide.unbind(l.hide)}if(o.cache.disabled)return e;o.cache.event=a.extend({},b),i.show.delay>0?(clearTimeout(o.timers.show),o.timers.show=setTimeout(c,i.show.delay),l.show!==l.hide&&k.hide.bind(l.hide,function(){clearTimeout(o.timers.show)})):c()}var i,k,l,m=!b.id||b.id===e||b.id.length<1||a("#"+j+"-"+b.id).length?g.nextid++:b.id,n=".qtip-"+m+"-create",o=u.call(this,m,b);if(o===e)return d;i=o.options,a.each(h,function(){this.initialize==="initialize"&&this(o)}),k={show:i.show.target,hide:i.hide.target},l={show:a.trim(""+i.show.event).replace(/ /g,n+" ")+n,hide:a.trim(""+i.hide.event).replace(/ /g,n+" ")+n},i.hide.event==="unfocus"&&(l.hide="mouseleave"+n),k.show.bind(l.show,p),(i.show.ready||i.prerender)&&p(c)})},h=g.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.precedance=a.charAt(0).search(/^(t|b)/)>-1?"y":"x",this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y},this.abbreviation=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b}},offset:function(c,d){function k(a,b){e.left+=b*a.scrollLeft(),e.top+=b*a.scrollTop()}var e=c.offset(),f=d,g=0,i=document.body,j;if(f){do{if(f[0]===i)break;f.css("position")!=="static"&&(j=f.position(),e.left-=j.left+(parseInt(f.css("borderLeftWidth"),10)||0),e.top-=j.top+(parseInt(f.css("borderTopWidth"),10)||0),g++)}while(f=f.offsetParent());(d[0]!==i||g>1)&&k(d,1),h.iOS<4.1&&h.iOS>3.1&&k(a(b),-1)}return e},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||e,fn:{attr:function(b,c){if(this.length){var d=this[0],e="title",f=a.data(d,"qtip");if(b===e){if(arguments.length<2)return a.attr(d,q);if(typeof f==="object"){f&&f.rendered&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",c),a.fn["attr"+p].apply(this,arguments),a.attr(d,q,a.attr(d,e));return this.removeAttr(e)}}}},clone:function(b){var c=a([]),d="title",e;e=a.fn["clone"+p].apply(this,arguments).filter("[oldtitle]").each(function(){a.attr(this,d,a.attr(this,q)),this.removeAttribute(q)}).end();return e},remove:a.ui?f:function(b,c){a(this).each(function(){c||(!b||a.filter(b,[this]).length)&&a("*",this).add(this).each(function(){a(this).triggerHandler("remove")})})}}},a.each(h.fn,function(b,c){if(!c)return d;var e=a.fn[b+p]=a.fn[b];a.fn[b]=function(){return c.apply(this,arguments)||e.apply(this,arguments)}}),a(document).bind("mousemove.qtip",function(a){i={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),g.version="2.0.0pre",g.nextid=0,g.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),g.zindex=15e3,g.defaults={prerender:e,id:e,overwrite:d,content:{text:d,attr:"title",title:{text:e,button:e}},position:{my:"top left",at:"bottom right",target:e,container:e,viewport:e,adjust:{x:0,y:0,mouse:d,resize:d,method:"flip flip"},effect:d},show:{target:e,event:"mouseenter",effect:d,delay:90,solo:e,ready:e},hide:{target:e,event:"mouseleave",effect:d,delay:0,fixed:e,inactive:e,leave:"window",distance:e},style:{classes:"",widget:e,width:e},events:{render:f,move:f,show:f,hide:f,toggle:f,focus:f,blur:f}},h.ajax=function(a){var b=a.plugins.ajax;return"object"===typeof b?b:a.plugins.ajax=new v(a)},h.ajax.initialize="render",h.ajax.sanitize=function(a){var b=a.content,c;b&&"ajax"in b&&(c=b.ajax,typeof c!=="object"&&(c=a.content.ajax={url:c}),"boolean"!==typeof c.once&&c.once&&(c.once=!!c.once))},a.extend(d,g.defaults,{content:{ajax:{loading:d,once:d}}}),h.tip=function(a){var b=a.plugins.tip;return"object"===typeof b?b:a.plugins.tip=new x(a)},h.tip.initialize="render",h.tip.sanitize=function(a){var b=a.style,c;b&&"tip"in b&&(c=a.style.tip,typeof c!=="object"&&(a.style.tip={corner:c}),/string|boolean/i.test(typeof c.corner)||(c.corner=d),typeof c.width!=="number"&&delete c.width,typeof c.height!=="number"&&delete c.height,typeof c.border!=="number"&&c.border!==d&&delete c.border,typeof c.offset!=="number"&&delete c.offset)},a.extend(d,g.defaults,{style:{tip:{corner:d,mimic:e,width:6,height:6,border:d,offset:0}}}),h.imagemap=function(b,c){function l(a,b){var d=0,e=1,f=1,g=0,h=0,i=a.width,j=a.height;while(i>0&&j>0&&e>0&&f>0){i=Math.floor(i/2),j=Math.floor(j/2),c.x==="left"?e=i:c.x==="right"?e=a.width-i:e+=Math.floor(i/2),c.y==="top"?f=j:c.y==="bottom"?f=a.height-j:f+=Math.floor(j/2),d=b.length;while(d--){if(b.length<2)break;g=b[d][0]-a.offset.left,h=b[d][1]-a.offset.top,(c.x==="left"&&g>=e||c.x==="right"&&g<=e||c.x==="center"&&(ga.width-e)||c.y==="top"&&h>=f||c.y==="bottom"&&h<=f||c.y==="center"&&(ha.height-f))&&b.splice(d,1)}}return{left:b[0][0],top:b[0][1]}}var d=b.attr("shape").toLowerCase(),e=b.attr("coords").split(","),f=[],g=a('img[usemap="#'+b.parent("map").attr("name")+'"]'),h=g.offset(),i={width:0,height:0,offset:{top:1e10,right:0,bottom:0,left:1e10}},j=0,k=0;h.left+=Math.ceil((g.outerWidth()-g.width())/2),h.top+=Math.ceil((g.outerHeight()-g.height())/2);if(d==="poly"){j=e.length;while(j--)k=[parseInt(e[--j],10),parseInt(e[j+1],10)],k[0]>i.offset.right&&(i.offset.right=k[0]),k[0]i.offset.bottom&&(i.offset.bottom=k[1]),k[1]'),d.bgiframe.appendTo(e),e.bind("tooltipmove"+f,c.adjust)},adjust:function(){var a=b.get("dimensions"),c=b.plugins.tip,f=d.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},c&&f&&(g=c.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),d.bgiframe.css(h).css(a)},destroy:function(){d.bgiframe.remove(),e.unbind(f)}}),c.init()}function z(c){var f=this,g=c.options.show.modal,h=c.elements,i=h.tooltip,j="#qtip-overlay",k=".qtipmodal",l=k+c.id,m="is-modal-qtip",o;c.checks.modal={"^show.modal.(on|blur)$":function(){f.init(),h.overlay.toggle(i.is(":visible"))}},a.extend(f,{init:function(){if(!g.on)return f;o=f.create(),i.attr(m,d).unbind(k).unbind(l).bind("tooltipshow"+k+" tooltiphide"+k,function(a,b,c){f[a.type.replace("tooltip","")](a,c)}).bind("tooltipfocus"+k,function(a,b,c){o[0].style.zIndex=c-1}).bind("tooltipblur"+k,function(b){a("["+m+"]:visible").not(i).last().qtip("focus",b)}),g.escape&&a(b).unbind(l).bind("keydown"+l,function(a){a.keyCode===27&&i.hasClass(n)&&c.hide(a)}),g.blur&&h.overlay.unbind(l).bind("click"+l,function(a){i.hasClass(n)&&c.hide(a)});return f},create:function(){var c=a(j);if(c.length){h.overlay=c;return c}o=h.overlay=a("
",{id:j.substr(1),css:{position:"absolute",top:0,left:0,display:"none"},mousedown:function(){return e}}).appendTo(document.body),a(b).unbind(k).bind("resize"+k,function(){o.css({height:Math.max(a(b).height(),a(document).height()),width:Math.max(a(b).width(),a(document).width())})}).trigger("resize");return o},toggle:function(b,c,j){if(b&&b.isDefaultPrevented())return f;var k=g.effect,l=c?"show":"hide",n=a("["+m+"]:visible").not(i),p;o||(o=f.create());if(o.is(":animated")&&!c||!c&&n.length)return f;c&&h.overlay.css("cursor",g.blur?"pointer":""),o.stop(d,e),a.isFunction(k)?k.call(o,c):k===e?o[l]():o.fadeTo(parseInt(j,10)||90,c?.7:0,function(){c||a(this).hide()});return f},show:function(a,b){return f.toggle(a,d,b)},hide:function(a,b){return f.toggle(a,e,b)},destroy:function(){var d=o;d&&(d=a("["+m+"]").not(i).length<1,d?(h.overlay.remove(),a(b).unbind(k)):h.overlay.unbind(k+c.id));return i.removeAttr(m).unbind(k)}}),f.init()}function y(b,g){function v(a){var b=a.precedance==="y",c=n[b?"width":"height"],d=n[b?"height":"width"],e=a.string().indexOf("center")>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,i,j,k,l=Math.sqrt(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];m[2]=Math.sqrt(g(m[0],2)-g(p,2)),m[3]=Math.sqrt(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)];return{height:k[b?0:1],width:k[b?1:0]}}function u(b){var c=k.titlebar&&b.y==="top",d=c?k.titlebar:k.content,e=a.browser.mozilla,f=e?"-moz-":a.browser.webkit?"-webkit-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"border-radius-"+g:"border-"+g+"-radius");return parseInt(d.css(h),10)||parseInt(l.css(h),10)||0}function t(a,b,c){b=b?b:a[a.precedance];var d=k.titlebar&&a.y==="top",e=d?k.titlebar:k.content,f="border-"+b+"-width",g=parseInt(e.css(f),10);return(c?g||parseInt(l.css(f),10):g)||0}function s(f,g,h,l){if(k.tip){var n=a.extend({},i.corner),o=h.adjusted,p=b.options.position.adjust.method.split(" "),q=p[0],r=p[1]||p[0],s={left:e,top:e,x:0,y:0},t,u={},v;i.corner.fixed!==d&&(q==="shift"&&n.precedance==="x"&&o.left&&n.y!=="center"?n.precedance=n.precedance==="x"?"y":"x":q==="flip"&&o.left&&(n.x=n.x==="center"?o.left>0?"left":"right":n.x==="left"?"right":"left"),r==="shift"&&n.precedance==="y"&&o.top&&n.x!=="center"?n.precedance=n.precedance==="y"?"x":"y":r==="flip"&&o.top&&(n.y=n.y==="center"?o.top>0?"top":"bottom":n.y==="top"?"bottom":"top"),n.string()!==m.corner&&(m.top!==o.top||m.left!==o.left)&&i.update(n,e)),t=i.position(n,o),t.right!==c&&(t.left=-t.right),t.bottom!==c&&(t.top=-t.bottom),t.user=Math.max(0,j.offset);if(s.left=q==="shift"&&!!o.left)n.x==="center"?u["margin-left"]=s.x=t["margin-left"]-o.left:(v=t.right!==c?[o.left,-t.left]:[-o.left,t.left],(s.x=Math.max(v[0],v[1]))>v[0]&&(h.left-=o.left,s.left=e),u[t.right!==c?"right":"left"]=s.x);if(s.top=r==="shift"&&!!o.top)n.y==="center"?u["margin-top"]=s.y=t["margin-top"]-o.top:(v=t.bottom!==c?[o.top,-t.top]:[-o.top,t.top],(s.y=Math.max(v[0],v[1]))>v[0]&&(h.top-=o.top,s.top=e),u[t.bottom!==c?"bottom":"top"]=s.y);k.tip.css(u).toggle(!(s.x&&s.y||n.x==="center"&&s.y||n.y==="center"&&s.x)),h.left-=t.left.charAt?t.user:q!=="shift"||s.top||!s.left&&!s.top?t.left:0,h.top-=t.top.charAt?t.user:r!=="shift"||s.left||!s.left&&!s.top?t.top:0,m.left=o.left,m.top=o.top,m.corner=n.string()}}var i=this,j=b.options.style.tip,k=b.elements,l=k.tooltip,m={top:0,left:0,corner:""},n={width:j.width,height:j.height},o={},p=j.border||0,q=".qtip-tip",r=a("")[0].getContext;i.corner=f,i.mimic=f,i.position={},b.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){i.init()||i.destroy(),b.reposition()},"^style.tip.(height|width)$":function(){n={width:j.width,height:j.height},i.create(),i.update(),b.reposition()},"^content.title.text|style.(classes|widget)$":function(){k.tip&&i.update()}},a.extend(i,{init:function(){var b=i.detectCorner()&&(r||a.browser.msie);b&&(i.create(),i.update(),l.unbind(q).bind("tooltipmove"+q,s));return b},detectCorner:function(){var a=j.corner,c=b.options.position,f=c.at,g=c.my.string?c.my.string():c.my;if(a===e||g===e&&f===e)return e;a===d?i.corner=new h.Corner(g):a.string||(i.corner=new h.Corner(a),i.corner.fixed=d);return i.corner.string()!=="centercenter"},detectColours:function(){var c,d,e,f=k.tip.css({backgroundColor:"",border:""}),g=i.corner,h=g[g.precedance],m="border-"+h+"-color",p="border"+h.charAt(0)+h.substr(1)+"Color",q=/rgba?\(0, 0, 0(, 0)?\)|transparent/i,r="background-color",s="transparent",t="ui-tooltip-fluid",u=a(document.body).css("color"),v=b.elements.content.css("color"),w=k.titlebar&&(g.y==="top"||g.y==="center"&&f.position().top+n.height/2+j.offset",{"class":"ui-tooltip-tip"}).css({width:b,height:c}).prependTo(l),r?a("").appendTo(k.tip)[0].getContext("2d").save():(d='',k.tip.html(p?d+=d:d))},update:function(b,c){var g=k.tip,l=g.children(),m=n.width,q=n.height,s="px solid ",u="px dashed transparent",w=j.mimic,y=Math.round,z,A,B,C,D;b||(b=i.corner),w===e?w=b:(w=new h.Corner(w),w.precedance=b.precedance,w.x==="inherit"?w.x=b.x:w.y==="inherit"?w.y=b.y:w.x===w.y&&(w[b.precedance]=b[b.precedance])),z=w.precedance,i.detectColours(),p=o.border==="transparent"||o.border==="#123456"?0:j.border===d?t(b,f,d):j.border,B=x(w,m,q),D=v(b),g.css(D),b.precedance==="y"?C=[y(w.x==="left"?p:w.x==="right"?D.width-m-p:(D.width-m)/2),y(w.y==="top"?D.height-q:0)]:C=[y(w.x==="left"?D.width-m:0),y(w.y==="top"?p:w.y==="bottom"?D.height-q-p:(D.height-q)/2)],r?(l.attr(D),A=l[0].getContext("2d"),A.restore(),A.save(),A.clearRect(0,0,3e3,3e3),A.translate(C[0],C[1]),A.beginPath(),A.moveTo(B[0][0],B[0][1]),A.lineTo(B[1][0],B[1][1]),A.lineTo(B[2][0],B[2][1]),A.closePath(),A.fillStyle=o.fill,A.strokeStyle=o.border,A.lineWidth=p*2,A.lineJoin="miter",A.miterLimit=100,A.stroke(),A.fill()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" xe",C[2]=p&&/^(r|b)/i.test(b.string())?parseFloat(a.browser.version,10)===8?2:1:0,l.css({antialias:""+(w.string().indexOf("center")>-1),left:C[0]-C[2]*Number(z==="x"),top:C[1]-C[2]*Number(z==="y"),width:m+p,height:q+p}).each(function(b){var c=a(this);c.attr({coordsize:m+p+" "+(q+p),path:B,fillcolor:o.fill,filled:!!b,stroked:!b}).css({display:p||b?"block":"none"}),!b&&p>0&&c.html()===""&&c.html('')})),c!==e&&i.position(b)},position:function(b){var c=k.tip,f={},g=Math.max(0,j.offset),h,l,m;if(j.corner===e||!c)return e;b=b||i.corner,h=b.precedance,l=v(b),m=[b.x,b.y],h==="x"&&m.reverse(),a.each(m,function(a,c){var e,i;c==="center"?(e=h==="y"?"left":"top",f[e]="50%",f["margin-"+e]=-Math.round(l[h==="y"?"width":"height"]/2)+g):(e=t(b,c,d),i=u(b),f[c]=a?t(b,c):g+(i>e?i:0))}),f[b[h]]-=l[h==="x"?"width":"height"],c.css({top:"",bottom:"",left:"",right:"",margin:""}).css(f);return f},destroy:function(){k.tip&&k.tip.remove(),l.unbind(q)}}),i.init()}function x(a,b,c){var d=Math.ceil(b/2),e=Math.ceil(c/2),f={bottomright:[[0,0],[b,c],[b,0]],bottomleft:[[0,0],[b,0],[0,c]],topright:[[0,c],[b,0],[b,c]],topleft:[[0,0],[0,c],[b,c]],topcenter:[[0,c],[d,0],[b,c]],bottomcenter:[[0,0],[b,0],[d,c]],rightcenter:[[0,0],[b,e],[0,c]],leftcenter:[[b,0],[b,c],[0,e]]};f.lefttop=f.bottomright,f.righttop=f.bottomleft,f.leftbottom=f.topright,f.rightbottom=f.topleft;return f[a.string()]}function w(b){var c=this,f=b.elements.tooltip,g=b.options.content.ajax,h=".qtip-ajax",i=/)<[^<]*)*<\/script>/gi,j=d;b.checks.ajax={"^content.ajax":function(a,b,d){b==="ajax"&&(g=d),b==="once"?c.init():g&&g.url?c.load():f.unbind(h)}},a.extend(c,{init:function(){g&&g.url&&f.unbind(h)[g.once?"one":"bind"]("tooltipshow"+h,c.load);return c},load:function(d,h){function p(a,c,d){b.set("content.text",c+": "+d),n()}function o(c){l&&(c=a("
").append(c.replace(i,"")).find(l)),b.set("content.text",c),n()}function n(){m&&(f.css("visibility",""),h=e)}if(d&&d.isDefaultPrevented())return c;var j=g.url.indexOf(" "),k=g.url,l,m=g.once&&!g.loading&&h;m&&f.css("visibility","hidden"),j>-1&&(l=k.substr(j),k=k.substr(0,j)),a.ajax(a.extend({success:o,error:p,context:b},g,{url:k}));return c}}),c.init()}function v(b,c){var i,j,k,l,m=a(this),n=a(document.body),o=this===document?n:m,p=m.metadata?m.metadata(c.metadata):f,q=c.metadata.type==="html5"&&p?p[c.metadata.name]:f,v=m.data(c.metadata.name||"qtipopts");try{v=typeof v==="string"?(new Function("return "+v))():v}catch(w){s("Unable to parse HTML5 attribute data: "+v)}l=a.extend(d,{},g.defaults,c,typeof v==="object"?t(v):f,t(q||p)),p&&a.removeData(this,"metadata"),j=l.position,l.id=b;if("boolean"===typeof l.content.text){k=m.attr(l.content.attr);if(l.content.attr!==e&&k)l.content.text=k;else return e}j.container===e&&(j.container=n),j.target===e&&(j.target=o),l.show.target===e&&(l.show.target=o),l.show.solo===d&&(l.show.solo=n),l.hide.target===e&&(l.hide.target=o),l.position.viewport===d&&(l.position.viewport=j.container),j.at=new h.Corner(j.at),j.my=new h.Corner(j.my);if(a.data(this,"qtip"))if(l.overwrite)m.qtip("destroy");else if(l.overwrite===e)return e;a.attr(this,"title")&&(a.attr(this,r,a.attr(this,"title")),this.removeAttribute("title")),i=new u(m,l,b,!!k),a.data(this,"qtip",i),m.bind("remove.qtip",function(){i.destroy()});return i}function u(c,p,q,s){function L(c,d,e,f){f=parseInt(f,10)!==0;var g=".qtip-"+q,h={show:c&&p.show.target[0],hide:d&&p.hide.target[0],tooltip:e&&u.rendered&&A.tooltip[0],content:e&&u.rendered&&A.content[0],container:f&&p.position.container[0]===v?document:p.position.container[0],window:f&&b};u.rendered?a([]).pushStack(a.grep([h.show,h.hide,h.tooltip,h.container,h.content,h.window],function(a){return typeof a==="object"})).unbind(g):c&&p.show.target.unbind(g+"-create")}function K(d,f,h,j){function D(a){z.is(":visible")&&u.reposition(a)}function C(a){if(z.hasClass(l))return e;clearTimeout(u.timers.inactive),u.timers.inactive=setTimeout(function(){u.hide(a)},p.hide.inactive)}function y(b){if(z.hasClass(l))return e;var c=a(b.relatedTarget||b.target),d=c.closest(m)[0]===z[0],f=c[0]===r.show[0];clearTimeout(u.timers.show),clearTimeout(u.timers.hide);if(n.target==="mouse"&&d||p.hide.fixed&&(/mouse(out|leave|move)/.test(b.type)&&(d||f))){b.stopPropagation(),b.preventDefault();return e}p.hide.delay>0?u.timers.hide=setTimeout(function(){u.hide(b)},p.hide.delay):u.hide(b)}function x(a){if(z.hasClass(l))return e;r.show.trigger("qtip-"+q+"-inactive"),clearTimeout(u.timers.show),clearTimeout(u.timers.hide);var b=function(){u.show(a)};p.show.delay>0?u.timers.show=setTimeout(b,p.show.delay):b()}var k=".qtip-"+q,n=p.position,r={show:p.show.target,hide:p.hide.target,container:n.container[0]===v?a(document):n.container,doc:a(document)},s={show:a.trim(""+p.show.event).split(" "),hide:a.trim(""+p.hide.event).split(" ")},t=a.browser.msie&&parseInt(a.browser.version,10)===6,w;h&&(p.hide.fixed&&(r.hide=r.hide.add(z),z.bind("mouseover"+k,function(){z.hasClass(l)||clearTimeout(u.timers.hide)})),n.target==="mouse"&&n.adjust.mouse&&p.hide.event&&z.bind("mouseleave"+k,function(a){(a.relatedTarget||a.target)!==r.show[0]&&u.hide(a)}),z.bind("mouseenter"+k,function(a){u[a.type==="mouseenter"?"focus":"blur"](a)}),z.bind("mouseenter"+k+" mouseleave"+k,function(a){z.toggleClass(o,a.type==="mouseenter")})),f&&("number"===typeof p.hide.inactive&&(r.show.bind("qtip-"+q+"-inactive",C),a.each(g.inactiveEvents,function(a,b){r.hide.add(A.tooltip).bind(b+k+"-inactive",C)})),/mouse(over|enter)/i.test(p.show.event)&&!/mouse(out|leave)/i.test(p.hide.event)&&r.hide.bind("mouseleave"+k,function(a){clearTimeout(u.timers.show)}),a.each(s.hide,function(b,c){var d=a.inArray(c,s.show),e=a(r.hide);d>-1&&e.add(r.show).length===e.length||c==="unfocus"?(r.show.bind(c+k,function(a){z.is(":visible")?y(a):x(a)}),delete s.show[d]):r.hide.bind(c+k,y)})),d&&(a.each(s.show,function(a,b){r.show.bind(b+k,x)}),"number"===typeof p.hide.distance&&r.show.bind("mousemove"+k,function(a){var b=B.origin||{},c=p.hide.distance,d=Math.abs;b&&(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&u.hide(a)})),j&&((n.adjust.resize||n.viewport)&&a(a.event.special.resize?n.viewport:b).bind("resize"+k,D),(n.viewport||t&&z.css("position")==="fixed")&&a(n.viewport).bind("scroll"+k,D),/unfocus/i.test(p.hide.event)&&r.doc.bind("mousedown"+k,function(b){var d=a(b.target);d.parents(m).length===0&&d.add(c).length>1&&z.is(":visible")&&!z.hasClass(l)&&u.hide(b)}),p.hide.leave&&/mouseleave|mouseout/i.test(p.hide.event)&&a(b).bind("blur"+k+" mouse"+(p.hide.leave.indexOf("frame")>-1?"out":"leave")+k,function(a){a.relatedTarget||u.hide(a)}),n.target==="mouse"&&r.doc.bind("mousemove"+k,function(a){n.adjust.mouse&&!z.hasClass(l)&&z.is(":visible")&&u.reposition(a||i)}))}function J(b,d){function g(a){function c(c){(b=b.not(this)).length===0&&(u.redraw(),u.reposition(B.event),a())}var b;if((b=f.find("img:not([height]):not([width])")).length===0)return c.call(b);b.each(function(a,b){(function d(){var e=u.timers.img;if(b.height&&b.width){clearTimeout(e[a]);return c.call(b)}e[a]=setTimeout(d,20)})()})}var f=A.content;b=b||p.content.text;if(!u.rendered||!b)return e;a.isFunction(b)&&(b=b.call(c,u)||""),b.jquery&&b.length>0?f.empty().append(b.css({display:"block"})):f.html(b),u.rendered<0?z.queue("fx",g):(y=0,g(a.noop));return u}function I(b){var d=A.title;if(!u.rendered||!b)return e;a.isFunction(b)&&(b=b.call(c,u)||""),b.jquery&&b.length>0?d.empty().append(b.css({display:"block"})):d.html(b),u.redraw(),u.rendered&&z.is(":visible")&&u.reposition(B.event)}function H(a){var b=A.button,c=A.title;if(!u.rendered)return e;a?(c||G(),F()):b.remove()}function G(){var b=w+"-title";A.titlebar&&E(),A.titlebar=a("
",{"class":j+"-titlebar "+(p.style.widget?"ui-widget-header":"")}).append(A.title=a("
",{id:b,"class":j+"-title","aria-atomic":d})).insertBefore(A.content),p.content.title.button?F():u.rendered&&u.redraw()}function F(){var b=p.content.title.button,c=typeof b==="string",d=c?b:"Close tooltip";A.button&&A.button.remove(),b.jquery?A.button=b:A.button=a("",{"class":"ui-state-default "+(p.style.widget?"":j+"-icon"),title:d,"aria-label":d}).prepend(a("",{"class":"ui-icon ui-icon-close",html:"×"})),A.button.appendTo(A.titlebar).attr("role","button").hover(function(b){a(this).toggleClass("ui-state-hover",b.type==="mouseenter")}).click(function(a){z.hasClass(l)||u.hide(a);return e}).bind("mousedown keydown mouseup keyup mouseout",function(b){a(this).toggleClass("ui-state-active ui-state-focus",b.type.substr(-4)==="down")}),u.redraw()}function E(){A.title&&(A.titlebar.remove(),A.titlebar=A.title=A.button=f,u.reposition())}function D(){var a=p.style.widget;z.toggleClass(k,a),A.content.toggleClass(k+"-content",a),A.titlebar&&A.titlebar.toggleClass(k+"-header",a),A.button&&A.button.toggleClass(j+"-icon",!a)}function C(a){var b=0,c,d=p,e=a.split(".");while(d=d[e[b++]])b0&&!a("#"+i).length&&(z[0].id=i,A.content[0].id=i+"-content",A.title[0].id=i+"-title")},"^content.text$":function(a,b,c){J(c)},"^content.title.text$":function(a,b,c){if(!c)return E();!A.title&&c&&G(),I(c)},"^content.title.button$":function(a,b,c){H(c)},"^position.(my|at)$":function(a,b,c){"string"===typeof c&&(a[b]=new h.Corner(c))},"^position.container$":function(a,b,c){u.rendered&&z.appendTo(c)},"^(show|hide).(event|target|fixed|delay|inactive)$":function(a,b,c,d,e){var f=[1,0,0];f[e[1]==="show"?"push":"unshift"](0),L.apply(u,f),K.apply(u,[1,1,0,0])},"^show.ready$":function(){u.rendered?u.show():u.render(1)},"^style.classes$":function(b,c,d){a.attr(z[0],"class",j+" qtip ui-helper-reset "+d)},"^style.widget|content.title":D,"^events.(render|show|move|hide|focus|blur)$":function(b,c,d){z[(a.isFunction(d)?"":"un")+"bind"]("tooltip"+c,d)}},a.extend(u,{render:function(b){if(u.rendered)return u;var f=p.content.title.text,g=a.Event("tooltiprender");a.attr(c[0],"aria-describedby",w),z=A.tooltip=a("
",{id:w,"class":j+" qtip ui-helper-reset "+p.style.classes,width:p.style.width||"",role:"alert","aria-live":"polite","aria-atomic":e,"aria-describedby":w+"-content","aria-hidden":d}).toggleClass(l,B.disabled).data("qtip",u).appendTo(p.position.container).append(A.content=a("
",{"class":j+"-content",id:w+"-content","aria-atomic":d})),u.rendered=-1,y=1,f&&(G(),I(f)),J(),u.rendered=d,D(),a.each(p.events,function(b,c){a.isFunction(c)&&z.bind(b==="toggle"?"tooltipshow tooltiphide":"tooltip"+b,c)}),a.each(h,function(){this.initialize==="render"&&this(u)}),K(1,1,1,1),z.queue("fx",function(a){g.originalEvent=B.event,z.trigger(g,[u]),y=0,u.redraw(),(p.show.ready||b)&&u.show(B.event),a()});return u},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:z.outerHeight(),width:z.outerWidth()};break;case"offset":b=h.offset(z,p.position.container);break;default:c=C(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(b,c){function m(a,b){var c,d,e;for(c in k)for(d in k[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),k[c][d].apply(u,b)}var g=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,i=e,j=e,k=u.checks,l;"string"===typeof b?(l=b,b={},b[l]=c):b=a.extend(d,{},b),a.each(b,function(c,d){var e=C(c.toLowerCase()),f;f=e[0][e[1]],e[0][e[1]]="object"===typeof d&&d.nodeType?a(d):d,b[c]=[e[0],e[1],d,f],i=g.test(c)||i,j=h.test(c)||j}),t(p),x=y=1,a.each(b,m),x=y=0,z.is(":visible")&&u.rendered&&(i&&u.reposition(p.position.target==="mouse"?f:B.event),j&&u.redraw());return u},toggle:function(b,c){function l(){b?(a.browser.msie&&z[0].style.removeAttribute("filter"),z.css("overflow","")):z.css({display:"",visibility:"",width:"",opacity:"",left:"",top:""})}if(!u.rendered)if(b)u.render(1);else return u;var d=b?"show":"hide",g=p[d],h=z.is(":visible"),j,k;(typeof b).search("boolean|number")&&(b=!h);if(h===b)return u;if(c){if(/over|enter/.test(c.type)&&/out|leave/.test(B.event.type)&&c.target===p.show.target[0]&&z.has(c.relatedTarget).length)return u;B.event=a.extend({},c)}k=a.Event("tooltip"+d),k.originalEvent=c?B.event:f,z.trigger(k,[u,90]);if(k.isDefaultPrevented())return u;a.attr(z[0],"aria-hidden",!b),b?(B.origin=a.extend({},i),u.focus(c),a.isFunction(p.content.text)&&J(),u.reposition(c),g.solo&&a(m,g.solo).not(z).qtip("hide",k)):(clearTimeout(u.timers.show),delete B.origin,u.blur(c)),z.stop(0,1),a.isFunction(g.effect)?(g.effect.call(z,u),z.queue("fx",function(a){l(),a()})):g.effect===e?(z[d](),l.call(z)):z.fadeTo(90,b?1:0,l),b&&g.target.trigger("qtip-"+q+"-inactive");return u},show:function(a){return u.toggle(d,a)},hide:function(a){return u.toggle(e,a)},focus:function(b){if(!u.rendered)return u;var c=a(m),d=parseInt(z[0].style.zIndex,10),e=g.zindex+c.length,f=a.extend({},b),h,i;z.hasClass(n)||(i=a.Event("tooltipfocus"),i.originalEvent=f,z.trigger(i,[u,e]),i.isDefaultPrevented()||(d!==e&&(c.each(function(){this.style.zIndex>d&&(this.style.zIndex=this.style.zIndex-1)}),c.filter("."+n).qtip("blur",f)),z.addClass(n)[0].style.zIndex=e));return u},blur:function(b){var c=a.extend({},b),d;z.removeClass(n),d=a.Event("tooltipblur"),d.originalEvent=c,z.trigger(d,[u]);return u},reposition:function(c,d){if(!u.rendered||x)return u;x=1;var f=p.position.target,g=p.position,k=g.my,l=g.at,m=g.adjust,n=m.method.split(" "),o=z.outerWidth(),q=z.outerHeight(),r=0,s=0,t=a.Event("tooltipmove"),w=z.css("position")==="fixed",y=g.viewport,A={left:0,top:0},C=(u.plugins.tip||{}).corner,D={horizontal:n[0],vertical:n[1]||n[0],tip:p.style.tip||{},left:function(a){var b=D.horizontal==="shift",c=y.offset.left+y.scrollLeft,d=k.x==="left"?o:k.x==="right"?-o:-o/2,e=l.x==="left"?r:l.x==="right"?-r:-r/2,f=D.tip.width+D.tip.border*2||0,g=C&&C.precedance==="x"&&!b?f:0,h=c-a-g,i=a+o-y.width-c+g,j=d-(k.precedance==="x"||k.x===k.y?e:0),n=k.x==="center";b?(g=C&&C.precedance==="y"?f:0,j=(k.x==="left"?1:-1)*d-g,A.left+=h>0?h:i>0?-i:0,A.left=Math.max(y.offset.left+(g&&C.x==="center"?D.tip.offset:0),a-j,Math.min(Math.max(y.offset.left+y.width,a+j),A.left))):(h>0&&(k.x!=="left"||i>0)?A.left-=j+(n?0:2*m.x):i>0&&(k.x!=="right"||h>0)&&(A.left-=n?-j:j+2*m.x),A.left!==a&&n&&(A.left-=m.x),A.lefti&&(A.left=a));return A.left-a},top:function(a){var b=D.vertical==="shift",c=y.offset.top+y.scrollTop,d=k.y==="top"?q:k.y==="bottom"?-q:-q/2,e=l.y==="top"?s:l.y==="bottom"?-s:-s/2,f=D.tip.height+D.tip.border*2||0,g=C&&C.precedance==="y"&&!b?f:0,h=c-a-g,i=a+q-y.height-c+g,j=d-(k.precedance==="y"||k.x===k.y?e:0),n=k.y==="center";b?(g=C&&C.precedance==="x"?f:0,j=(k.y==="top"?1:-1)*d-g,A.top+=h>0?h:i>0?-i:0,A.top=Math.max(y.offset.top+(g&&C.x==="center"?D.tip.offset:0),a-j,Math.min(Math.max(y.offset.top+y.height,a+j),A.top))):(h>0&&(k.y!=="top"||i>0)?A.top-=j+(n?0:2*m.y):i>0&&(k.y!=="bottom"||h>0)&&(A.top-=n?-j:j+2*m.y),A.top!==a&&n&&(A.top-=m.y),A.top<0&&-A.top>i&&(A.top=a));return A.top-a}};if(f==="mouse")l={x:"left",y:"top"},c=c&&(c.type==="resize"||c.type==="scroll")?B.event:!m.mouse&&B.origin?B.origin:i&&(m.mouse||!c||!c.pageX)?{pageX:i.pageX,pageY:i.pageY}:c,A={top:c.pageY,left:c.pageX};else{f==="event"&&(c&&c.target&&c.type!=="scroll"&&c.type!=="resize"?f=B.target=a(c.target):f=B.target),f=a(f).eq(0);if(f.length===0)return u;f[0]===document||f[0]===b?(r=f.width(),s=f.height(),f[0]===b&&(A={top:!w||h.iOS?y.scrollTop():0,left:!w||h.iOS?y.scrollLeft():0})):f.is("area")&&h.imagemap?A=h.imagemap(f,l):f[0].namespaceURI==="http://www.w3.org/2000/svg"&&h.svg?A=h.svg(f,l):(r=f.outerWidth(),s=f.outerHeight(),A=h.offset(f,g.container,w)),A.offset&&(r=A.width,s=A.height,A=A.offset),A.left+=l.x==="right"?r:l.x==="center"?r/2:0,A.top+=l.y==="bottom"?s:l.y==="center"?s/2:0}A.left+=m.x+(k.x==="right"?-o:k.x==="center"?-o/2:0),A.top+=m.y+(k.y==="bottom"?-q:k.y==="center"?-q/2:0),y.jquery&&f[0]!==b&&f[0]!==v&&D.vertical+D.horizontal!=="nonenone"?(y={elem:y,height:y[(y[0]===b?"h":"outerH")+"eight"](),width:y[(y[0]===b?"w":"outerW")+"idth"](),scrollLeft:y.scrollLeft(),scrollTop:y.scrollTop(),offset:y.offset()||{left:0,top:0}},A.adjusted={left:D.horizontal!=="none"?D.left(A.left):0,top:D.vertical!=="none"?D.top(A.top):0}):A.adjusted={left:0,top:0},z.attr("class",function(b,c){return a.attr(this,"class").replace(/ui-tooltip-pos-\w+/i,"")}).addClass(j+"-pos-"+k.abbreviation()),t.originalEvent=a.extend({},c),z.trigger(t,[u,A,y.elem||y]);if(t.isDefaultPrevented())return u;delete A.adjusted,d===e||isNaN(A.left)||isNaN(A.top)||!a.isFunction(g.effect)?z.css(A):a.isFunction(g.effect)&&(g.effect.call(z,u,a.extend({},A)),z.queue(function(b){a(this).css({opacity:"",height:""}),a.browser.msie&&this.style.removeAttribute("filter"),b()})),x=0;return u},redraw:function(){if(u.rendered<1||p.style.width||y)return u;var b=j+"-fluid",c=p.position.container,d,e,f,g;y=1,z.css("width","").addClass(b),e=z.width()+(a.browser.mozilla?1:0),f=z.css("max-width")||"",g=z.css("min-width")||"",d=(f+g).indexOf("%")>-1?c.width()/100:0,f=(f.indexOf("%")>-1?d:1)*parseInt(f,10)||e,g=(g.indexOf("%")>-1?d:1)*parseInt(g,10)||0,e=f+g?Math.min(Math.max(e,g),f):e,z.css("width",Math.round(e)).removeClass(b),y=0;return u},disable:function(b){var c=l;"boolean"!==typeof b&&(b=!z.hasClass(c)&&!B.disabled),u.rendered?(z.toggleClass(c,b),a.attr(z[0],"aria-disabled",b)):B.disabled=!!b;return u},enable:function(){return u.disable(e)},destroy:function(){var b=c[0],d=a.attr(b,r);u.rendered&&(z.remove(),a.each(u.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(u.timers.show),clearTimeout(u.timers.hide),L(1,1,1,1),a.removeData(b,"qtip"),d&&(a.attr(b,"title",d),c.removeAttr(r)),c.removeAttr("aria-describedby").unbind(".qtip");return c}})}function t(b){var c;if(!b||"object"!==typeof b)return e;"object"!==typeof b.metadata&&(b.metadata={type:b.metadata});if("content"in b){if("object"!==typeof b.content||b.content.jquery)b.content={text:b.content};c=b.content.text||e,!a.isFunction(c)&&(!c&&!c.attr||c.length<1||"object"===typeof c&&!c.jquery)&&(b.content.text=e),"title"in b.content&&("object"!==typeof b.content.title&&(b.content.title={text:b.content.title}),c=b.content.title.text||e,!a.isFunction(c)&&(!c&&!c.attr||c.length<1||"object"===typeof c&&!c.jquery)&&(b.content.title.text=e))}"position"in b&&("object"!==typeof b.position&&(b.position={my:b.position,at:b.position})),"show"in b&&("object"!==typeof b.show&&(b.show.jquery?b.show={target:b.show}:b.show={event:b.show})),"hide"in b&&("object"!==typeof b.hide&&(b.hide.jquery?b.hide={target:b.hide}:b.hide={event:b.hide})),"style"in b&&("object"!==typeof b.style&&(b.style={classes:b.style})),a.each(h,function(){this.sanitize&&this.sanitize(b)});return b}function s(){var c=b.console;return c&&(c.error||c.log||a.noop).apply(c,arguments)}var d=!0,e=!1,f=null,g,h,i,j="ui-tooltip",k="ui-widget",l="ui-state-disabled",m="div.qtip."+j,n=j+"-focus",o=j+"-hover",p="-31000px",q="_replacedByqTip",r="oldtitle";g=a.fn.qtip=function(b,h,i){var j=(""+b).toLowerCase(),k=f,l=j==="disable"?[d]:a.makeArray(arguments).slice(1,10),m=l[l.length-1],n=this[0]?a.data(this[0],"qtip"):f;if(!arguments.length&&n||j==="api")return n;if("string"===typeof b){this.each(function(){var b=a.data(this,"qtip");if(!b)return d;m&&m.timeStamp&&(b.cache.event=m);if(j!=="option"&&j!=="options"||!h)b[j]&&b[j].apply(b[j],l);else if(a.isPlainObject(h)||i!==c)b.set(h,i);else{k=b.get(h);return e}});return k!==f?k:this}if("object"===typeof b||!arguments.length){n=t(a.extend(d,{},b));return g.bind.call(this,n,m)}},g.bind=function(b,c){return this.each(function(f){function p(b){function c(){o.render(typeof b==="object"||i.show.ready),k.show.unbind(l.show),k.hide.unbind(l.hide)}if(o.cache.disabled)return e;o.cache.event=a.extend({},b),i.show.delay>0?(clearTimeout(o.timers.show),o.timers.show=setTimeout(c,i.show.delay),l.show!==l.hide&&k.hide.bind(l.hide,function(){clearTimeout(o.timers.show)})):c()}var i,k,l,m=!b.id||b.id===e||b.id.length<1||a("#"+j+"-"+b.id).length?g.nextid++:b.id,n=".qtip-"+m+"-create",o=v.call(this,m,b);if(o===e)return d;i=o.options,a.each(h,function(){this.initialize==="initialize"&&this(o)}),k={show:i.show.target,hide:i.hide.target},l={show:a.trim(""+i.show.event).replace(/ /g,n+" ")+n,hide:a.trim(""+i.hide.event).replace(/ /g,n+" ")+n},/mouse(over|enter)/i.test(l.show)&&!/mouse(out|leave)/i.test(l.hide)&&(l.hide+=" mouseleave"+n),k.show.bind(l.show,p),(i.show.ready||i.prerender)&&p(c)})},h=g.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.precedance=a.charAt(0).search(/^(t|b)/)>-1?"y":"x",this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y},this.abbreviation=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b}},offset:function(c,d,e){function l(a,b){f.left+=b*a.scrollLeft(),f.top+=b*a.scrollTop()}var f=c.offset(),g=d,i=0,j=document.body,k;if(g){do{if(g[0]===j)break;g.css("position")!=="static"&&(k=g.position(),f.left-=k.left+(parseInt(g.css("borderLeftWidth"),10)||0),f.top-=k.top+(parseInt(g.css("borderTopWidth"),10)||0),i++)}while(g=g.offsetParent());(d[0]!==j||i>1)&&l(d,1),(h.iOS<4.1&&h.iOS>3.1||!h.iOS&&e)&&l(a(b),-1)}return f},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||e,fn:{attr:function(b,c){if(this.length){var d=this[0],e="title",f=a.data(d,"qtip");if(b===e){if(arguments.length<2)return a.attr(d,r);if(typeof f==="object"){f&&f.rendered&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",c),a.fn["attr"+q].apply(this,arguments),a.attr(d,r,a.attr(d,e));return this.removeAttr(e)}}}},clone:function(b){var c=a([]),d="title",e;e=a.fn["clone"+q].apply(this,arguments).filter("[oldtitle]").each(function(){a.attr(this,d,a.attr(this,r)),this.removeAttribute(r)}).end();return e},remove:a.ui?f:function(b,c){a(this).each(function(){c||(!b||a.filter(b,[this]).length)&&a("*",this).add(this).each(function(){a(this).triggerHandler("remove")})})}}},a.each(h.fn,function(b,c){if(!c)return d;var e=a.fn[b+q]=a.fn[b];a.fn[b]=function(){return c.apply(this,arguments)||e.apply(this,arguments)}}),a(document).bind("mousemove.qtip",function(a){i={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),g.version="2.0.0pre",g.nextid=0,g.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),g.zindex=15e3,g.defaults={prerender:e,id:e,overwrite:d,content:{text:d,attr:"title",title:{text:e,button:e}},position:{my:"top left",at:"bottom right",target:e,container:e,viewport:e,adjust:{x:0,y:0,mouse:d,resize:d,method:"flip flip"},effect:d},show:{target:e,event:"mouseenter",effect:d,delay:90,solo:e,ready:e},hide:{target:e,event:"mouseleave",effect:d,delay:0,fixed:e,inactive:e,leave:"window",distance:e},style:{classes:"",widget:e,width:e},events:{render:f,move:f,show:f,hide:f,toggle:f,focus:f,blur:f}},h.ajax=function(a){var b=a.plugins.ajax;return"object"===typeof b?b:a.plugins.ajax=new w(a)},h.ajax.initialize="render",h.ajax.sanitize=function(a){var b=a.content,c;b&&"ajax"in b&&(c=b.ajax,typeof c!=="object"&&(c=a.content.ajax={url:c}),"boolean"!==typeof c.once&&c.once&&(c.once=!!c.once))},a.extend(d,g.defaults,{content:{ajax:{loading:d,once:d}}}),h.tip=function(a){var b=a.plugins.tip;return"object"===typeof b?b:a.plugins.tip=new y(a)},h.tip.initialize="render",h.tip.sanitize=function(a){var b=a.style,c;b&&"tip"in b&&(c=a.style.tip,typeof c!=="object"&&(a.style.tip={corner:c}),/string|boolean/i.test(typeof c.corner)||(c.corner=d),typeof c.width!=="number"&&delete c.width,typeof c.height!=="number"&&delete c.height,typeof c.border!=="number"&&c.border!==d&&delete c.border,typeof c.offset!=="number"&&delete c.offset)},a.extend(d,g.defaults,{style:{tip:{corner:d,mimic:e,width:6,height:6,border:d,offset:0}}}),h.imagemap=function(b,c){function l(a,b){var d=0,e=1,f=1,g=0,h=0,i=a.width,j=a.height;while(i>0&&j>0&&e>0&&f>0){i=Math.floor(i/2),j=Math.floor(j/2),c.x==="left"?e=i:c.x==="right"?e=a.width-i:e+=Math.floor(i/2),c.y==="top"?f=j:c.y==="bottom"?f=a.height-j:f+=Math.floor(j/2),d=b.length;while(d--){if(b.length<2)break;g=b[d][0]-a.offset.left,h=b[d][1]-a.offset.top,(c.x==="left"&&g>=e||c.x==="right"&&g<=e||c.x==="center"&&(ga.width-e)||c.y==="top"&&h>=f||c.y==="bottom"&&h<=f||c.y==="center"&&(ha.height-f))&&b.splice(d,1)}}return{left:b[0][0],top:b[0][1]}}var d=b.attr("shape").toLowerCase(),e=b.attr("coords").split(","),f=[],g=a('img[usemap="#'+b.parent("map").attr("name")+'"]'),h=g.offset(),i={width:0,height:0,offset:{top:1e10,right:0,bottom:0,left:1e10}},j=0,k=0;h.left+=Math.ceil((g.outerWidth()-g.width())/2),h.top+=Math.ceil((g.outerHeight()-g.height())/2);if(d==="poly"){j=e.length;while(j--)k=[parseInt(e[--j],10),parseInt(e[j+1],10)],k[0]>i.offset.right&&(i.offset.right=k[0]),k[0]i.offset.bottom&&(i.offset.bottom=k[1]),k[1]35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('"5z 5A",9(a,b,c){9 z(b){P c=R,d=b.2O,e=d.1o,f=".1Y-"+b.1m;a.1k(c,{1I:9(){d.1Y=a(\'<4r 1R="1r-1o-1Y" 86="0" 85="-1" 5C="5D:\\\'\\\';" 15="2g:2L; 16:3R; z-55:-1; 2C:7O(4l=0); -7J-2C:"5F:5G.84.5H(5I=0)";">\'),d.1Y.2M(e),e.18("4d"+f,c.25)},25:9(){P a=b.3O("57"),c=b.1C.12,f=d.12,g,h;h=1u(e.X("1a-N-T"),10)||0,h={N:-h,L:-h},c&&f&&(g=c.1h.1d==="x"?["T","N"]:["V","L"],h[g[1]]-=f[g[0]]()),d.1Y.X(h).X(a)},2a:9(){d.1Y.1O(),e.1q(f)}}),c.1I()}9 y(c){P f=R,g=c.23.O.1w,h=c.2O,i=h.1o,j="#1b-2p",k=".7D",l=k+c.1m,m="1M-1w-1b",o;c.2P.1w={"^O.1w.(2T|1H)$":9(){f.1I(),h.2p.1S(i.1M(":1W"))}},a.1k(f,{1I:9(){S(!g.2T)M f;o=f.2i(),i.13(m,d).1q(k).1q(l).18("46"+k+" 56"+k,9(a,b,c){f[a.1y.24("1o","")](c)}).18("5f"+k,9(a,b,c){o.X("z-55",c-1)}).18("4s"+k,9(b){a("["+m+"]:1W").2v(i).5K().1b("2m",b)}),g.5a&&a(b).1q(l).18("4X"+l,9(a){a.5L===27&&i.1L(n)&&c.Q(a)}),g.1H&&h.2p.1q(l).18("4c"+l,9(a){i.1L(n)&&c.Q(a)});M f},2i:9(){P c=a(j);S(c.19){h.2p=c;M c}o=h.2p=a("<2j />",{1m:j.2z(1),X:{16:"3R",L:0,N:0,2g:"3F"},3m:9(){M e}}).2M(1A.37),a(b).1q(k).18("2o"+k,9(){o.X({V:14.1F(a(b).V(),a(1A).V()),T:14.1F(a(b).T(),a(1A).T())})}).2s("2o");M o},1S:9(b){P c=g.1N,j=b?"O":"Q",k=a("["+m+"]:1W").2v(i),l;o||(o=f.2i());S(o.1M(":5N")&&!b)M f;S(!b&&k.19)M f;b&&h.2p.X("7s",g.1H?"7e":""),o.5c(d,e),a.1Q(c)?c.1V(o,b):c===e?o[j]():o.5d(3L,b?.7:0,9(){b||a(R).Q()});M f},O:9(){M f.1S(d)},Q:9(){M f.1S(e)},2a:9(){P d=o;d&&(d=a("["+m+"]").2v(i).19<1,d?(h.2p.1O(),a(b).1q(k)):h.2p.1q(k+c.1m));M i.3s(m).1q(k)}}),f.1I()}9 x(b,g){9 v(a){P b=a.1d==="y",c=n[b?"T":"V"],d=n[b?"V":"T"],e=a.1n().3v("1f")>-1,f=c*(e?.5:1),g=14.5R,h=14.3V,i,j,k,l=14.3W(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];m[2]=14.3W(g(m[0],2)-g(p,2)),m[3]=14.3W(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)];M{V:k[b?0:1],T:k[b?1:0]}}9 u(b){P c=k.1x&&b.y==="L",d=c?k.1x:k.U,e=a.21.5t,f=e?"-6G-":a.21.4M?"-4M-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"1a-4t-"+g:"1a-"+g+"-4t");M 1u(d.X(h),10)||1u(l.X(h),10)||0}9 t(a,b,c){b=b?b:a[a.1d];P d=k.1x&&a.y==="L",e=d?k.1x:k.U,f="1a-"+b+"-T",g=1u(e.X(f),10);M(c?g||1u(l.X(f),10):g)||0}9 s(f,g,h,l){S(k.12){P n=a.1k({},i.1h),o=h.3H,p=b.23.16.25.4m.2A(" "),q=p[0],r=p[1]||p[0],s={N:e,L:e,x:0,y:0},t,u={},v;i.1h.2c!==d&&(q==="2q"&&n.1d==="x"&&o.N&&n.y!=="1f"?n.1d=n.1d==="x"?"y":"x":q==="3J"&&o.N&&(n.x=n.x==="1f"?o.N>0?"N":"1i":n.x==="N"?"1i":"N"),r==="2q"&&n.1d==="y"&&o.L&&n.x!=="1f"?n.1d=n.1d==="y"?"x":"y":r==="3J"&&o.L&&(n.y=n.y==="1f"?o.L>0?"L":"1j":n.y==="L"?"1j":"L"),n.1n()!==m.1h&&(m.L!==o.L||m.N!==o.N)&&i.3f(n,e)),t=i.16(n,o),t.1i!==c&&(t.N=-t.1i),t.1j!==c&&(t.L=-t.1j),t.3U=14.1F(0,j.W);S(s.N=q==="2q"&&!!o.N)n.x==="1f"?u["2N-N"]=s.x=t["2N-N"]-o.N:(v=t.1i!==c?[o.N,-t.N]:[-o.N,t.N],(s.x=14.1F(v[0],v[1]))>v[0]&&(h.N-=o.N,s.N=e),u[t.1i!==c?"1i":"N"]=s.x);S(s.L=r==="2q"&&!!o.L)n.y==="1f"?u["2N-L"]=s.y=t["2N-L"]-o.L:(v=t.1j!==c?[o.L,-t.L]:[-o.L,t.L],(s.y=14.1F(v[0],v[1]))>v[0]&&(h.L-=o.L,s.L=e),u[t.1j!==c?"1j":"L"]=s.y);k.12.X(u).1S(!(s.x&&s.y||n.x==="1f"&&s.y||n.y==="1f"&&s.x)),h.N-=t.N.2W?t.3U:q!=="2q"||s.L||!s.N&&!s.L?t.N:0,h.L-=t.L.2W?t.3U:r!=="2q"||s.N||!s.N&&!s.L?t.L:0,m.N=o.N,m.L=o.L,m.1h=n.1n()}}P i=R,j=b.23.15.12,k=b.2O,l=k.1o,m={L:0,N:0,1h:""},n={T:j.T,V:j.V},o={},p=j.1a||0,q=".1b-12",r=a("<4w />")[0].3P;i.1h=f,i.3y=f,i.16={},b.2P.12={"^16.1P|15.12.(1h|3y|1a)$":9(){i.1I()||i.2a(),b.1T()},"^15.12.(V|T)$":9(){n={T:j.T,V:j.V},i.2i(),i.3f(),b.1T()},"^U.17.1p|15.(39|2n)$":9(){k.12&&i.3f()}},a.1k(i,{1I:9(){P b=i.4u()&&(r||a.21.3b);b&&(i.2i(),i.3f(),l.1q(q).18("4d"+q,s));M b},4u:9(){P a=j.1h,c=b.23.16,f=c.2u,g=c.1P.1n?c.1P.1n():c.1P;S(a===e||g===e&&f===e)M e;a===d?i.1h=1D h.2B(g):a.1n||(i.1h=1D h.2B(a),i.1h.2c=d);M i.1h.1n()!=="5u"},4y:9(){P c,d,e,f=k.12.X({6g:"",1a:""}),g=i.1h,h=g[g.1d],m="1a-"+h+"-3d",p="1a"+h.2W(0)+h.2z(1)+"5U",q=/6h?\\(0, 0, 0(, 0)?\\)|3n/i,r="5W-3d",s="3n",t="1r-1o-5s",u=a(1A.37).X("3d"),v=b.2O.U.X("3d"),w=k.1x&&(g.y==="L"||g.y==="1f"&&f.16().L+n.V/2+j.W",{"1R":"1r-1o-12"}).X({T:b,V:c}).5X(l),r?a("<4w />").2M(k.12)[0].3P("2d").4P():(d=\'<4i:44 5Y="0,0" 15="2g:4H-2L; 16:3R; 4F:2e(#3A#4G);">\',k.12.2J(p?d+=d:d))},3f:9(b,c){P g=k.12,l=g.5Z(),m=n.T,q=n.V,s="3T 60 ",u="3T 61 3n",x=j.3y,y=14.3V,z,A,B,C,D;b||(b=i.1h),x===e?x=b:(x=1D h.2B(x),x.1d=b.1d,x.x==="3E"?x.x=b.x:x.y==="3E"?x.y=b.y:x.x===x.y&&(x[b.1d]=b[b.1d])),z=x.1d,i.4y(),p=o.1a==="3n"||o.1a==="#62"?0:j.1a===d?t(b,f,d):j.1a,B=w(x,m,q),D=v(b),g.X(D),b.1d==="y"?C=[y(x.x==="N"?p:x.x==="1i"?D.T-m-p:(D.T-m)/2),y(x.y==="L"?D.V-q:0)]:C=[y(x.x==="N"?D.T-m:0),y(x.y==="L"?p:x.y==="1j"?D.V-q-p:(D.V-q)/2)],r?(l.13(D),A=l[0].3P("2d"),A.64(),A.4P(),A.65(0,0,4z,4z),A.67(C[0],C[1]),A.68(),A.69(B[0][0],B[0][1]),A.4A(B[1][0],B[1][1]),A.4A(B[2][0],B[2][1]),A.6a(),A.81=o.2G,A.6b=o.1a,A.6c=p*2,A.6d="51",A.7X=6e,A.5x(),A.2G()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" 6f",C[2]=p&&/^(r|b)/i.1B(b.1n())?4S(a.21.3D,10)===8?2:1:0,l.X({7T:""+(x.1n().3v("1f")>-1),N:C[0]-C[2]*5o(z==="x"),L:C[1]-C[2]*5o(z==="y"),T:m+p,V:q+p}).1l(9(b){P c=a(R);c.13({6j:m+p+" "+(q+p),6k:B,6l:o.2G,6m:!!b,6n:!b}).X({2g:p||b?"2L":"3F"}),!b&&p>0&&c.2J()===""&&c.2J(\'<4i:5x 6o="\'+p*2+\'3T" 3d="\'+o.1a+\'" 6p="6q" 6r="51" 15="4F:2e(#3A#4G); 2g:4H-2L;" />\')})),c!==e&&i.16(b)},16:9(b){P c=k.12,f={},g=14.1F(0,j.W),h,l,m;S(j.1h===e||!c)M e;b=b||i.1h,h=b.1d,l=v(b),m=[b.x,b.y],h==="x"&&m.6s(),a.1l(m,9(a,c){P e,i;c==="1f"?(e=h==="y"?"N":"L",f[e]="50%",f["2N-"+e]=-14.3V(l[h==="y"?"T":"V"]/2)+g):(e=t(b,c,d),i=u(b),f[c]=a?t(b,c):g+(i>e?i:0))}),f[b[h]]-=l[h==="x"?"T":"V"],c.X({L:"",1j:"",N:"",1i:"",2N:""}).X(f);M f},2a:9(){k.12&&k.12.1O(),l.1q(q)}}),i.1I()}9 w(a,b,c){P d=14.3p(b/2),e=14.3p(c/2),f={4W:[[0,0],[b,c],[b,0]],4J:[[0,0],[b,0],[0,c]],4T:[[0,c],[b,0],[b,c]],4K:[[0,0],[0,c],[b,c]],7v:[[0,c],[d,0],[b,c]],7u:[[0,0],[b,0],[d,c]],6w:[[0,0],[b,e],[0,c]],6x:[[b,0],[b,c],[0,e]]};f.7r=f.4W,f.6z=f.4J,f.6B=f.4T,f.6C=f.4K;M f[a.1n()]}9 v(b){P c=R,f=b.2O.1o,g=b.23.U.1v,h=".1b-1v",i=/<41\\b[^<]*(?:(?!<\\/41>)<[^<]*)*<\\/41>/5h,j=d;b.2P.1v={"^U.1v":9(a,b,d){b==="1v"&&(g=d),b==="2r"?c.1I():g&&g.2e?c.3Z():f.1q(h)}},a.1k(c,{1I:9(){g&&g.2e&&f.1q(h)[g.2r?"6D":"18"]("46"+h,c.3Z);M c},3Z:9(d,h){9 p(a,c,d){b.34("U.1p",c+": "+d),n()}9 o(c){l&&(c=a("<2j/>").31(c.24(i,"")).4Q(l)),b.34("U.1p",c),n()}9 n(){m&&(f.X("49",""),h=e)}S(d&&d.3G())M c;P j=g.2e.3v(" "),k=g.2e,l,m=g.2r&&!g.4B&&h;m&&f.X("49","3X"),j>-1&&(l=k.2z(j),k=k.2z(0,j)),a.1v(a.1k({6E:o,4q:p,7f:b},g,{2e:k}));M c}}),c.1I()}9 u(b,c){P i,j,k,l,m=a(R),n=a(1A.37),o=R===1A?n:m,p=m.1X?m.1X(c.1X):f,u=c.1X.1y==="6I"&&p?p[c.1X.43]:f,v=m.2k(c.1X.43||"6J");7b{v=Y v==="1n"?(1D 7a("M "+v))():v}6L(w){r("6M 77 76 75 6P 2k: "+v)}l=a.1k(d,{},g.3h,c,Y v==="1e"?s(v):f,s(u||p)),p&&a.5v(R,"1X"),j=l.16,l.1m=b;S("36"===Y l.U.1p){k=m.13(l.U.13);S(l.U.13!==e&&k)l.U.1p=k;2x M e}j.1t===e&&(j.1t=n),j.11===e&&(j.11=o),l.O.11===e&&(l.O.11=o),l.O.3j===d&&(l.O.3j=n),l.Q.11===e&&(l.Q.11=o),l.16.28===d&&(l.16.28=j.1t),j.2u=1D h.2B(j.2u),j.1P=1D h.2B(j.1P);S(a.2k(R,"1b"))S(l.4e)m.1b("2a");2x S(l.4e===e)M e;a.13(R,"17")&&(a.13(R,q,a.13(R,"17")),R.3r("17")),i=1D t(m,l,b,!!k),a.2k(R,"1b",i),m.18("1O.1b",9(){i.2a()});M i}9 t(c,o,p,r){9 K(c,d,e,f){f=1u(f,10)!==0;P g=".1b-"+p,h={O:c&&o.O.11[0],Q:d&&o.Q.11[0],1o:e&&t.1g&&z.1o[0],U:e&&t.1g&&z.U[0],1t:f&&o.16.1t[0]===u?1A:o.16.1t[0],3N:f&&b};t.1g?a([]).6R(a.6S([h.O,h.Q,h.1o,h.1t,h.U,h.3N],9(a){M Y a==="1e"})).1q(g):c&&o.O.11.1q(g+"-2i")}9 J(d,f,h,j){9 C(a){y.1M(":1W")&&t.1T(a)}9 B(a){S(y.1L(l))M e;1E(t.1s.1Z),t.1s.1Z=30(9(){t.Q(a)},o.Q.1Z)}9 x(b){S(y.1L(l))M e;P c=a(b.3B||b.11),d=c.6U(m)[0]===y[0],f=c[0]===q.O[0];1E(t.1s.O),1E(t.1s.Q);S(n.11==="1G"&&d||o.Q.2c&&(/1G(4a|2Q|4k)/.1B(b.1y)&&(d||f))){b.6V(),b.6Y();M e}o.Q.2b>0?t.1s.Q=30(9(){t.Q(b)},o.Q.2b):t.Q(b)}9 w(a){S(y.1L(l))M e;q.O.2s("1b-"+p+"-1Z"),1E(t.1s.O),1E(t.1s.Q);P b=9(){t.O(a)};o.O.2b>0?t.1s.O=30(b,o.O.2b):b()}P k=".1b-"+p,n=o.16,q={O:o.O.11,Q:o.Q.11,1t:n.1t[0]===u?a(1A):n.1t,3Y:a(1A)},r={O:a.3o(""+o.O.1c).2A(" "),Q:a.3o(""+o.Q.1c).2A(" ")},s=a.21.3b&&1u(a.21.3D,10)===6,v;h&&(o.Q.2c&&(q.Q=q.Q.2I(y),y.18("6Z"+k,9(){y.1L(l)||1E(t.1s.Q)})),n.11==="1G"&&n.25.1G&&o.Q.1c&&y.18("2V"+k,9(a){(a.3B||a.11)!==q.O[0]&&t.Q(a)}),y.18("3c"+k+" 2V"+k,9(a){t[a.1y==="3c"?"2m":"1H"](a)})),f&&("2f"===Y o.Q.1Z&&(q.O.18("1b-"+p+"-1Z",B),a.1l(g.4v,9(a,b){q.Q.2I(z.1o).18(b+k+"-1Z",B)})),a.1l(r.Q,9(b,c){P d=a.71(c,r.O),e=a(q.Q);d>-1&&e.2I(q.O).19===e.19||c==="4g"?(q.O.18(c+k,9(a){y.1M(":1W")?x(a):w(a)}),2y r.O[d]):q.Q.18(c+k,x)})),d&&(a.1l(r.O,9(a,b){q.O.18(b+k,w)}),"2f"===Y o.Q.3C&&q.O.18("2X"+k,9(a){P b=A.3u||[],c=o.Q.3C;b&&(14.2S(a.2F-b[0])>=c||14.2S(a.2Z-b[1])>=c)&&t.Q(a)})),j&&((n.25.2o||n.28)&&a(a.1c.72.2o?n.28:b).18("2o"+k,C),(n.28||s&&y.X("16")==="2c")&&a(n.28).18("4f"+k,C),/4g/i.1B(o.Q.1c)&&q.3Y.18("3m"+k,9(b){P d=a(b.11);d.73(m).19===0&&d.2I(c).19>1&&y.1M(":1W")&&!y.1L(l)&&t.Q(b)}),o.Q.2Q&&/2V|4Y/i.1B(o.Q.1c)&&a(b).18("1H"+k+" 1G"+(o.Q.2Q.3v("78")>-1?"4a":"2Q")+k,9(a){a.3B||t.Q(a)}),n.11==="1G"&&q.3Y.18("2X"+k,9(a){n.25.1G&&!y.1L(l)&&y.1M(":1W")&&t.1T(a||i)}))}9 I(b,d){9 g(a){9 c(c){(b=b.2v(R)).19===0&&(t.2D(),t.1T(A.1c),a())}P b;S((b=f.4Q("3t:2v([V]):2v([T])")).19===0)M c.1V(b);b.1l(9(a,b){(9 d(){P e=t.1s.3t;S(b.V&&b.T){1E(e[a]);M c.1V(b)}e[a]=30(d,20)})()})}P f=z.U;b=b||o.U.1p;S(!t.1g||!b)M e;a.1Q(b)&&(b=b.1V(c,t)||""),b.29&&b.19>0?f.4R().31(b.X({2g:"2L"})):f.2J(b),t.1g<0?y.3I("3Q",g):(x=0,g(a.5w));M t}9 H(b){P d=z.17;S(!t.1g||!b)M e;a.1Q(b)&&(b=b.1V(c,t)||""),b.29&&b.19>0?d.4R().31(b.X({2g:"2L"})):d.2J(b),t.2D(),t.1g&&y.1M(":1W")&&t.1T(A.1c)}9 G(a){P b=z.1z,c=z.17;S(!t.1g)M e;a?(c||F(),E()):b.1O()}9 F(){P b=v+"-17";z.1x&&D(),z.1x=a("<2j />",{"1R":j+"-1x "+(o.15.2n?"1r-2n-4Z":"")}).31(z.17=a("<2j />",{1m:b,"1R":j+"-17","1K-45":d})).79(z.U),o.U.17.1z?E():t.1g&&t.2D()}9 E(){P b=o.U.17.1z,c=Y b==="1n",d=c?b:"7c 1o";z.1z&&z.1z.1O(),b.29?z.1z=b:z.1z=a("",{"1R":"1r-3k-3A "+(o.15.2n?"":j+"-3q"),17:d,"1K-7d":d}).7g(a("<7h />",{"1R":"1r-3q 1r-3q-7i",2J:"&7k;"})),z.1z.2M(z.1x).13("54","1z").4V(9(b){a(R).2t("1r-3k-4V",b.1y==="3c")}).4c(9(a){y.1L(l)||t.Q(a);M e}).18("3m 4X 5g 7l 4Y",9(b){a(R).2t("1r-3k-7n 1r-3k-2m",b.1y.2z(-4)==="7o")}),t.2D()}9 D(){z.17&&(z.1x.1O(),z.1x=z.17=z.1z=f,t.1T())}9 C(){P a=o.15.2n;y.2t(k,a),z.U.2t(k+"-U",a),z.1x&&z.1x.2t(k+"-4Z",a),z.1z&&z.1z.2t(j+"-3q",!a)}9 B(a){P b=0,c,d=o,e=a.2A(".");3a(d=d[e[b++]])b0&&!a("#"+i).19&&(y[0].1m=i,z.U[0].1m=i+"-U",z.17[0].1m=i+"-17")},"^U.1p$":9(a,b,c){I(c)},"^U.17.1p$":9(a,b,c){S(!c)M D();!z.17&&c&&F(),H(c)},"^U.17.1z$":9(a,b,c){G(c)},"^16.(1P|2u)$":9(a,b,c){"1n"===Y c&&(a[b]=1D h.2B(c))},"^16.1t$":9(a,b,c){t.1g&&y.2M(c)},"^(O|Q).(1c|11|2c|2b|1Z)$":9(a,b,c,d,e){P f=[1,0,0];f[e[1]==="O"?"47":"7w"](0),K.26(t,f),J.26(t,[1,1,0,0])},"^O.2U$":9(){t.1g?t.O():t.1J(1)},"^15.39$":9(b,c,d){a.13(y[0],"1R",j+" 1b 1r-52-53 "+d)},"^15.2n|U.17":C,"^42.(1J|O|4k|Q|2m|1H)$":9(b,c,d){y[(a.1Q(d)?"":"7x")+"18"]("1o"+c,d)}},a.1k(t,{1J:9(b){S(t.1g)M t;P f=o.U.17.1p,g=a.32("7z");a.13(c[0],"1K-4o",v),y=z.1o=a("<2j/>",{1m:v,"1R":j+" 1b 1r-52-53 "+o.15.39,T:o.15.T||"",54:"7A","1K-7B":"7C","1K-45":e,"1K-4o":v+"-U","1K-3X":d}).2t(l,A.2w).2k("1b",t).2M(o.16.1t).31(z.U=a("<2j />",{"1R":j+"-U",1m:v+"-U","1K-45":d})),t.1g=-1,x=1,f&&(F(),H(f)),I(),t.1g=d,C(),a.1l(o.42,9(b,c){a.1Q(c)&&y.18(b==="1S"?"46 56":"1o"+b,c)}),a.1l(h,9(){R.2E==="1J"&&R(t)}),J(1,1,1,1),y.3I("3Q",9(a){g.3i=A.1c,y.2s(g,[t]),x=0,t.2D(),(o.O.2U||b)&&t.O(A.1c),a()});M t},3O:9(a){P b,c;5e(a.2l()){3g"57":b={V:y.38(),T:y.3z()};2R;3g"W":b=h.W(y,o.16.1t);2R;3A:c=B(a.2l()),b=c[0][c[1]],b=b.1d?b.1n():b}M b},34:9(b,c){9 m(a,b){P c,d,e;58(c 1U k)58(d 1U k[c])S(e=(1D 7E(d,"i")).4N(a))b.47(e),k[c][d].26(t,b)}P g=/^16\\.(1P|2u|25|11|1t)|15|U|O\\.2U/i,h=/^U\\.(17|13)|15/i,i=e,j=e,k=t.2P,l;"1n"===Y b?(l=b,b={},b[l]=c):b=a.1k(d,{},b),a.1l(b,9(c,d){P e=B(c.2l()),f;f=e[0][e[1]],e[0][e[1]]="1e"===Y d&&d.7F?a(d):d,b[c]=[e[0],e[1],d,f],i=g.1B(c)||i,j=h.1B(c)||j}),s(o),w=x=1,a.1l(b,m),w=x=0,y.1M(":1W")&&t.1g&&(i&&t.1T(o.16.11==="1G"?f:A.1c),j&&t.2D());M t},1S:9(b,c){9 k(){b?(a.21.3b&&y[0].15.3r("2C"),y.X("7G","")):y.X({2g:"",49:"",T:"",4l:"",N:"",L:""})}S(!t.1g)S(b)t.1J(1);2x M t;P d=b?"O":"Q",g=o[d],h=y.1M(":1W"),i,j;(Y b).4D("36|2f")&&(b=!h);S(h===b)M t;S(c){S(/5l|5m/.1B(c.1y)&&/4a|2Q/.1B(A.1c.1y)&&c.11===o.O.11[0]&&y.7I(c.3B).19)M t;A.1c=a.1k({},c)}j=a.32("1o"+d),j.3i=c?A.1c:f,y.2s(j,[t,3L]);S(j.3G())M t;a.13(y[0],"1K-3X",!b),b?(t.2m(c),a.1Q(o.U.1p)&&I(),t.1T(c),g.3j&&a(m,g.3j).2v(y).1b("Q",j),"2f"===Y o.Q.3C&&(A.3u=[c.2F,c.2Z])):(1E(t.1s.O),2y A.3u,t.1H(c)),y.5c(0,1),a.1Q(g.1N)?(g.1N.1V(y,t),y.3I("3Q",9(a){k(),a()})):g.1N===e?(y[d](),k.1V(y)):y.5d(3L,b?1:0,k),b&&g.11.2s("1b-"+p+"-1Z");M t},O:9(a){M t.1S(d,a)},Q:9(a){M t.1S(e,a)},2m:9(b){S(!t.1g)M t;P c=a(m),d=1u(y[0].15.2Y,10),e=g.5i+c.19,f=a.1k({},b),h,i;y.1L(n)||(d!==e&&(c.1l(9(){R.15.2Y>d&&(R.15.2Y=R.15.2Y-1)}),c.2C("."+n).1b("1H",f)),i=a.32("5f"),i.3i=f,y.2s(i,[t,e]),i.3G()||(y.3K(n)[0].15.2Y=e));M t},1H:9(b){P c=a.1k({},b),d;y.4n(n),d=a.32("4s"),d.3i=c,y.2s(d,[t]);M t},1T:9(c,d){S(!t.1g||w)M t;w=1;P f=o.16.11,g=o.16,k=g.1P,l=g.2u,m=g.25,n=m.4m.2A(" "),p=y.3z(),q=y.38(),r=0,s=0,v=a.32("4d"),x=y.X("16")==="2c",z=g.28,B={N:0,L:0},C=(t.1C.12||{}).1h,D={4h:n[0],4j:n[1]||n[0],12:o.15.12,N:9(a){P b=z.W.N+z.2K,c=k.x==="N"?p:k.x==="1i"?-p:-p/2,d=l.x==="N"?r:l.x==="1i"?-r:-r/2,e=C&&C.1d==="y"?D.12.T+D.12.1a*2:0,f=b-a-e,g=a+p-z.T-b+e,h=c-(k.1d==="x"||k.x===k.y?d:0),i=k.x==="1f";D.4h==="2q"?(B.N+=f>0?f:g>0?-g:0,B.N=14.3M(14.1F(b,B.N),14.1F(f>0?-5j:0,b+z.T-p))):(f>0&&(k.x!=="N"||g>0)?B.N-=h+(i?0:2*m.x):g>0&&(k.x!=="1i"||f>0)&&(B.N-=i?-h:h+2*m.x),B.N!==a&&i&&(B.N-=m.x),B.Ng&&(B.N=a));M B.N-a},L:9(a){P b=z.W.L+z.2H,c=k.y==="L"?q:k.y==="1j"?-q:-q/2,d=l.y==="L"?s:l.y==="1j"?-s:-s/2,e=C&&C.1d==="x"?D.12.V+D.12.1a*2:0,f=b-a-e,g=a+q-z.V-b+e,h=c-(k.1d==="y"||k.x===k.y?d:0),i=k.y==="1f";D.4j==="2q"?(B.L+=f>0?f:g>0?-g:0,B.L=14.3M(14.1F(b,B.L),14.1F(f>0?-5j:0,b+z.V-q))):(f>0&&(k.y!=="L"||g>0)?B.L-=h+(i?0:2*m.y):g>0&&(k.y!=="1j"||f>0)&&(B.L-=i?-h:h+2*m.y),B.L!==a&&i&&(B.L-=m.y),B.L<0&&-B.L>g&&(B.L=a));M B.L-a}};z=z?{5q:z,V:z[(z[0]===b?"h":"7M")+"7P"](),T:z[(z[0]===b?"w":"7Q")+"7R"](),2K:z.2K(),2H:z.2H(),W:z.W()||{N:0,L:0}}:e;S(f==="1G")l={x:"N",y:"L"},c=c&&(c.1y==="2o"||c.1y==="4f")?A.1c:m.1G||!c||!c.2F||/5l|5m$/i.1B(c.1y)&&!m.1G?a.1k({},i):c,B={L:c.2Z,N:c.2F};2x{f==="1c"&&(c&&c.11&&c.1y!=="4f"&&c.1y!=="2o"?f=A.11=a(c.11):f=A.11),f=a(f).7U(0);S(f.19===0)M t;f[0]===1A||f[0]===b?(r=f.T(),s=f.V(),f[0]===b&&(B={L:!x||h.35?z.2H:0,N:!x||h.35?z.2K:0})):f.1M("7V")&&h.40?B=h.40(f,l):f[0].7W=="7Y://7Z.80.82/83/3l"&&h.3l?B=h.3l(f,l):(r=f.3z(),s=f.38(),B=h.W(f,g.1t)),B.W&&(r=B.T,s=B.V,B=B.W),B.N+=l.x==="1i"?r:l.x==="1f"?r/2:0,B.L+=l.y==="1j"?s:l.y==="1f"?s/2:0}B.N+=m.x+(k.x==="1i"?-p:k.x==="1f"?-p/2:0),B.L+=m.y+(k.y==="1j"?-q:k.y==="1f"?-q/2:0),g.28.29&&f[0]!==b&&f[0]!==u?B.3H={N:D.4h!=="3F"?D.N(B.N):0,L:D.4j!=="3F"?D.L(B.L):0}:B.3H={N:0,L:0},y.13("1R",9(b,c){M a.13(R,"1R").24(/1r-1o-5p-\\w+/i,"")}).3K(j+"-5p-"+k.4E()),v.3i=a.1k({},c),y.2s(v,[t,B,z.5q]);S(v.3G())M t;2y B.3H,d===e||5r(B.N)||5r(B.L)||!a.1Q(g.1N)?y.X(B):a.1Q(g.1N)&&(g.1N.1V(y,t,a.1k({},B)),y.3I(9(b){a(R).X({4l:"",V:""}),a.21.3b&&R.15.3r("2C"),b()})),w=0;M t},2D:9(){S(t.1g<1||o.15.T||x)M t;P b=j+"-5s",c,d,e;x=1,y.X("T","").3K(b),c=y.T()+(a.21.5t?1:0),d=1u(y.X("1F-T"),10)||0,e=1u(y.X("3M-T"),10)||0,c=d+e?14.3M(14.1F(c,e),d):c,y.X("T",c).4n(b),x=0;M t},48:9(b){P c=l;"36"!==Y b&&(b=!y.1L(c)&&!A.2w),t.1g?(y.2t(c,b),a.13(y[0],"1K-2w",b)):A.2w=!!b;M t},87:9(){M t.48(e)},2a:9(){P b=c[0],d=a.13(b,q);t.1g&&(y.1O(),a.1l(t.1C,9(){R.2a&&R.2a()})),1E(t.1s.O),1E(t.1s.Q),K(1,1,1,1),a.5v(b,"1b"),d&&(a.13(b,"17",d),c.3s(q)),c.3s("1K-4o").1q(".1b");M c}})}9 s(b){P c;S(!b||"1e"!==Y b)M e;"1e"!==Y b.1X&&(b.1X={1y:b.1X});S("U"1U b){S("1e"!==Y b.U||b.U.29)b.U={1p:b.U};c=b.U.1p||e,!a.1Q(c)&&(!c&&!c.13||c.19<1||"1e"===Y c&&!c.29)&&(b.U.1p=e),"17"1U b.U&&("1e"!==Y b.U.17&&(b.U.17={1p:b.U.17}),c=b.U.17.1p||e,!a.1Q(c)&&(!c&&!c.13||c.19<1||"1e"===Y c&&!c.29)&&(b.U.17.1p=e))}"16"1U b&&("1e"!==Y b.16&&(b.16={1P:b.16,2u:b.16})),"O"1U b&&("1e"!==Y b.O&&(b.O.29?b.O={11:b.O}:b.O={1c:b.O})),"Q"1U b&&("1e"!==Y b.Q&&(b.Q.29?b.Q={11:b.Q}:b.Q={1c:b.Q})),"15"1U b&&("1e"!==Y b.15&&(b.15={39:b.15})),a.1l(h,9(){R.3e&&R.3e(b)});M b}9 r(){P c=b.5y;M c&&(c.4q||c.5B||a.5w).26(c,22)}P d=!0,e=!1,f=5E,g,h,i,j="1r-1o",k="1r-2n",l="1r-3k-2w",m="2j.1b."+j,n=j+"-2m",o="-5J",p="5M",q="4L";g=a.2h.1b=9(b,h,i){P j=(""+b).2l(),k=f,l=j==="48"?[d]:a.5O(22).4p(1,10),m=l[l.19-1],n=R[0]?a.2k(R[0],"1b"):f;S(!22.19&&n||j==="5P")M n;S("1n"===Y b){R.1l(9(){P b=a.2k(R,"1b");S(!b)M d;m&&m.5Q&&(b.33.1c=m);S(j!=="5S"&&j!=="23"||!h)b[j]&&b[j].26(b[j],l);2x S(a.5T(h)||i!==c)b.34(h,i);2x{k=b.3O(h);M e}});M k!==f?k:R}S("1e"===Y b||!22.19){n=s(a.1k(d,{},b));M g.18.1V(R,n,m)}},g.18=9(b,c){M R.1l(9(f){9 p(b){9 c(){o.1J(Y b==="1e"||i.O.2U),k.O.1q(l.O),k.Q.1q(l.Q)}S(o.33.2w)M e;o.33.1c=a.1k({},b),i.O.2b>0?(1E(o.1s.O),o.1s.O=30(c,i.O.2b),l.O!==l.Q&&k.Q.18(l.Q,9(){1E(o.1s.O)})):c()}P i,k,l,m=!b.1m||b.1m===e||b.1m.19<1||a("#"+j+"-"+b.1m).19?g.4b++:b.1m,n=".1b-"+m+"-2i",o=u.1V(R,m,b);S(o===e)M d;i=o.23,a.1l(h,9(){R.2E==="2E"&&R(o)}),k={O:i.O.11,Q:i.Q.11},l={O:a.3o(""+i.O.1c).24(/ /g,n+" ")+n,Q:a.3o(""+i.Q.1c).24(/ /g,n+" ")+n},i.Q.1c==="4g"&&(l.Q="2V"+n),k.O.18(l.O,p),(i.O.2U||i.5k)&&p(c)})},h=g.1C={2B:9(a){a=(""+a).24(/([A-Z])/," $1").24(/6i/5h,"1f").2l(),R.x=(a.3S(/N|1i/i)||a.3S(/1f/)||["3E"])[0].2l(),R.y=(a.3S(/L|1j|1f/i)||["3E"])[0].2l(),R.1d=a.2W(0).4D(/^(t|b)/)>-1?"y":"x",R.1n=9(){M R.1d==="y"?R.y+R.x:R.x+R.y},R.4E=9(){P a=R.x.2z(0,1),b=R.y.2z(0,1);M a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b}},W:9(c,d){9 k(a,b){e.N+=b*a.2K(),e.L+=b*a.2H()}P e=c.W(),f=d,g=0,i=1A.37,j;S(f){6t{S(f[0]===i)2R;f.X("16")!=="6u"&&(j=f.16(),e.N-=j.N+(1u(f.X("6v"),10)||0),e.L-=j.L+(1u(f.X("6y"),10)||0),g++)}3a(f=f.6A());(d[0]!==i||g>1)&&k(d,1),h.35<4.1&&h.35>3.1&&k(a(b),-1)}M e},35:4S((""+(/4O.*6F ([0-6H]{1,3})|(4O 6K).*6N.*6O/i.4N(6T.6W)||[0,""])[1]).24("5b","70").24("74","."))||e,2h:{13:9(b,c){S(R.19){P d=R[0],e="17",f=a.2k(d,"1b");S(b===e){S(22.19<2)M a.13(d,q);S(Y f==="1e"){f&&f.1g&&f.23.U.13===e&&f.33.13&&f.34("U.1p",c),a.2h["13"+p].26(R,22),a.13(d,q,a.13(d,e));M R.3s(e)}}}},4U:9(b){P c=a([]),d="17",e;e=a.2h["4U"+p].26(R,22).2C("[4L]").1l(9(){a.13(R,d,a.13(R,q)),R.3r(q)}).7p();M e},1O:a.1r?f:9(b,c){a(R).1l(9(){c||(!b||a.2C(b,[R]).19)&&a("*",R).2I(R).1l(9(){a(R).7y("1O")})})}}},a.1l(h.2h,9(b,c){S(!c)M d;P e=a.2h[b+p]=a.2h[b];a.2h[b]=9(){M c.26(R,22)||e.26(R,22)}}),a(1A).18("2X.1b",9(a){i={2F:a.2F,2Z:a.2Z,1y:"2X"}}),g.3D="2.0.7H",g.4b=0,g.4v="4c 7K 3m 5g 2X 2V 3c".2A(" "),g.5i=7N,g.3h={5k:e,1m:e,4e:d,U:{1p:d,13:"17",17:{1p:e,1z:e}},16:{1P:"L N",2u:"1j 1i",11:e,1t:e,28:e,25:{x:0,y:0,1G:d,2o:d,4m:"3J 3J"},1N:d},O:{11:e,1c:"3c",1N:d,2b:3L,3j:e,2U:e},Q:{11:e,1c:"2V",1N:d,2b:0,2c:e,1Z:e,2Q:"3N",3C:e},15:{39:"",2n:e,T:e},42:{1J:f,4k:f,O:f,Q:f,1S:f,2m:f,1H:f}},h.1v=9(a){P b=a.1C.1v;M"1e"===Y b?b:a.1C.1v=1D v(a)},h.1v.2E="1J",h.1v.3e=9(a){P b=a.U,c;b&&"1v"1U b&&(c=b.1v,Y c!=="1e"&&(c=a.U.1v={2e:c}),"36"!==Y c.2r&&c.2r&&(c.2r=!!c.2r))},a.1k(d,g.3h,{U:{1v:{4B:d,2r:d}}}),h.12=9(a){P b=a.1C.12;M"1e"===Y b?b:a.1C.12=1D x(a)},h.12.2E="1J",h.12.3e=9(a){P b=a.15,c;b&&"12"1U b&&(c=a.15.12,Y c!=="1e"&&(a.15.12={1h:c}),/1n|36/i.1B(Y c.1h)||(c.1h=d),Y c.T!=="2f"&&2y c.T,Y c.V!=="2f"&&2y c.V,Y c.1a!=="2f"&&c.1a!==d&&2y c.1a,Y c.W!=="2f"&&2y c.W)},a.1k(d,g.3h,{15:{12:{1h:d,3y:e,T:6,V:6,1a:d,W:0}}}),h.40=9(b,c){9 l(a,b){P d=0,e=1,f=1,g=0,h=0,i=a.T,j=a.V;3a(i>0&&j>0&&e>0&&f>0){i=14.3w(i/2),j=14.3w(j/2),c.x==="N"?e=i:c.x==="1i"?e=a.T-i:e+=14.3w(i/2),c.y==="L"?f=j:c.y==="1j"?f=a.V-j:f+=14.3w(j/2),d=b.19;3a(d--){S(b.19<2)2R;g=b[d][0]-a.W.N,h=b[d][1]-a.W.L,(c.x==="N"&&g>=e||c.x==="1i"&&g<=e||c.x==="1f"&&(ga.T-e)||c.y==="L"&&h>=f||c.y==="1j"&&h<=f||c.y==="1f"&&(ha.V-f))&&b.6Q(d,1)}}M{N:b[0][0],L:b[0][1]}}P d=b.13("44").2l(),e=b.13("3u").2A(","),f=[],g=a(\'3t[7j="#\'+b.7m("59").13("43")+\'"]\'),h=g.W(),i={T:0,V:0,W:{L:3x,1i:0,1j:0,N:3x}},j=0,k=0;h.N+=14.3p((g.3z()-g.T())/2),h.L+=14.3p((g.38()-g.V())/2);S(d==="5n"){j=e.19;3a(j--)k=[1u(e[--j],10),1u(e[j+1],10)],k[0]>i.W.1i&&(i.W.1i=k[0]),k[0]i.W.1j&&(i.W.1j=k[1]),k[1]35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('"87 5z",9(a,b,c){9 A(b){Q c=S,d=b.2V,e=d.1o,f=".1Z-"+b.1q;a.1l(c,{1J:9(){d.1Z=a(\'<54 1Q="1t-1o-1Z" 5A="0" 5B="-1" 85="5D:\\\'\\\';" 15="2h:2U; 14:3U; z-5E:-1; 2C:5F(4m=0); -5G-2C:"5H:5I.5J.7L(7F=0)";">\'),d.1Z.30(e),e.18("4j"+f,c.29)},29:9(){Q a=b.42("56"),c=b.1E.12,f=d.12,g,h;h=1x(e.Y("1d-N-U"),10)||0,h={N:-h,M:-h},c&&f&&(g=c.1k.1e==="x"?["U","N"]:["X","M"],h[g[1]]-=f[g[0]]()),d.1Z.Y(h).Y(a)},25:9(){d.1Z.1K(),e.1s(f)}}),c.1J()}9 z(c){Q f=S,g=c.2a.P.1z,h=c.2V,i=h.1o,j="#1c-2k",k=".5L",l=k+c.1q,m="1N-1z-1c",o;c.2Y.1z={"^P.1z.(2W|1M)$":9(){f.1J(),h.2k.1W(i.1N(":22"))}},a.1l(f,{1J:9(){T(!g.2W)O f;o=f.2f(),i.17(m,d).1s(k).1s(l).18("3X"+k+" 55"+k,9(a,b,c){f[a.1B.23("1o","")](a,c)}).18("5c"+k,9(a,b,c){o[0].15.2N=c-1}).18("5d"+k,9(b){a("["+m+"]:22").2x(i).7E().1c("2e",b)}),g.4t&&a(b).1s(l).18("4M"+l,9(a){a.5N===27&&i.1S(n)&&c.R(a)}),g.1M&&h.2k.1s(l).18("3W"+l,9(a){i.1S(n)&&c.R(a)});O f},2f:9(){Q c=a(j);T(c.1a){h.2k=c;O c}o=h.2k=a("<2p />",{1q:j.2z(1),Y:{14:"3U",M:0,N:0,2h:"3I"},3F:9(){O e}}).30(1D.3a),a(b).1s(k).18("2g"+k,9(){o.Y({X:16.1H(a(b).X(),a(1D).X()),U:16.1H(a(b).U(),a(1D).U())})}).2q("2g");O o},1W:9(b,c,j){T(b&&b.3l())O f;Q k=g.1R,l=c?"P":"R",n=a("["+m+"]:22").2x(i),p;o||(o=f.2f());T(o.1N(":5P")&&!c||!c&&n.1a)O f;c&&h.2k.Y("7w",g.1M?"7q":""),o.5a(d,e),a.1L(k)?k.1V(o,c):k===e?o[l]():o.4w(1x(j,10)||3P,c?.7:0,9(){c||a(S).R()});O f},P:9(a,b){O f.1W(a,d,b)},R:9(a,b){O f.1W(a,e,b)},25:9(){Q d=o;d&&(d=a("["+m+"]").2x(i).1a<1,d?(h.2k.1K(),a(b).1s(k)):h.2k.1s(k+c.1q));O i.3z(m).1s(k)}}),f.1J()}9 y(b,g){9 v(a){Q b=a.1e==="y",c=n[b?"U":"X"],d=n[b?"X":"U"],e=a.1p().2F("1f")>-1,f=c*(e?.5:1),g=16.5S,h=16.3O,i,j,k,l=16.4i(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];m[2]=16.4i(g(m[0],2)-g(p,2)),m[3]=16.4i(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)];O{X:k[b?0:1],U:k[b?1:0]}}9 u(b){Q c=k.1A&&b.y==="M",d=c?k.1A:k.V,e=a.1U.5q,f=e?"-8a-":a.1U.4J?"-4J-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"1d-4F-"+g:"1d-"+g+"-4F");O 1x(d.Y(h),10)||1x(l.Y(h),10)||0}9 t(a,b,c){b=b?b:a[a.1e];Q d=k.1A&&a.y==="M",e=d?k.1A:k.V,f="1d-"+b+"-U",g=1x(e.Y(f),10);O(c?g||1x(l.Y(f),10):g)||0}9 s(f,g,h,l){T(k.12){Q n=a.1l({},i.1k),o=h.3J,p=b.2a.14.29.4n.2A(" "),q=p[0],r=p[1]||p[0],s={N:e,M:e,x:0,y:0},t,u={},v;i.1k.2v!==d&&(q==="2m"&&n.1e==="x"&&o.N&&n.y!=="1f"?n.1e=n.1e==="x"?"y":"x":q==="3N"&&o.N&&(n.x=n.x==="1f"?o.N>0?"N":"1j":n.x==="N"?"1j":"N"),r==="2m"&&n.1e==="y"&&o.M&&n.x!=="1f"?n.1e=n.1e==="y"?"x":"y":r==="3N"&&o.M&&(n.y=n.y==="1f"?o.M>0?"M":"1i":n.y==="M"?"1i":"M"),n.1p()!==m.1k&&(m.M!==o.M||m.N!==o.N)&&i.32(n,e)),t=i.14(n,o),t.1j!==c&&(t.N=-t.1j),t.1i!==c&&(t.M=-t.1i),t.3Y=16.1H(0,j.W);T(s.N=q==="2m"&&!!o.N)n.x==="1f"?u["2P-N"]=s.x=t["2P-N"]-o.N:(v=t.1j!==c?[o.N,-t.N]:[-o.N,t.N],(s.x=16.1H(v[0],v[1]))>v[0]&&(h.N-=o.N,s.N=e),u[t.1j!==c?"1j":"N"]=s.x);T(s.M=r==="2m"&&!!o.M)n.y==="1f"?u["2P-M"]=s.y=t["2P-M"]-o.M:(v=t.1i!==c?[o.M,-t.M]:[-o.M,t.M],(s.y=16.1H(v[0],v[1]))>v[0]&&(h.M-=o.M,s.M=e),u[t.1i!==c?"1i":"M"]=s.y);k.12.Y(u).1W(!(s.x&&s.y||n.x==="1f"&&s.y||n.y==="1f"&&s.x)),h.N-=t.N.33?t.3Y:q!=="2m"||s.M||!s.N&&!s.M?t.N:0,h.M-=t.M.33?t.3Y:r!=="2m"||s.N||!s.N&&!s.M?t.M:0,m.N=o.N,m.M=o.M,m.1k=n.1p()}}Q i=S,j=b.2a.15.12,k=b.2V,l=k.1o,m={M:0,N:0,1k:""},n={U:j.U,X:j.X},o={},p=j.1d||0,q=".1c-12",r=a("<4I />")[0].3V;i.1k=f,i.3A=f,i.14={},b.2Y.12={"^14.1P|15.12.(1k|3A|1d)$":9(){i.1J()||i.25(),b.1Y()},"^15.12.(X|U)$":9(){n={U:j.U,X:j.X},i.2f(),i.32(),b.1Y()},"^V.19.1n|15.(3p|2t)$":9(){k.12&&i.32()}},a.1l(i,{1J:9(){Q b=i.4u()&&(r||a.1U.3c);b&&(i.2f(),i.32(),l.1s(q).18("4j"+q,s));O b},4u:9(){Q a=j.1k,c=b.2a.14,f=c.2s,g=c.1P.1p?c.1P.1p():c.1P;T(a===e||g===e&&f===e)O e;a===d?i.1k=1F h.2H(g):a.1p||(i.1k=1F h.2H(a),i.1k.2v=d);O i.1k.1p()!=="5t"},4x:9(){Q c,d,e,f=k.12.Y({6x:"",1d:""}),g=i.1k,h=g[g.1e],m="1d-"+h+"-34",p="1d"+h.33(0)+h.2z(1)+"5V",q=/5W?\\(0, 0, 0(, 0)?\\)|3t/i,r="5X-34",s="3t",t="1t-1o-5p",u=a(1D.3a).Y("34"),v=b.2V.V.Y("34"),w=k.1A&&(g.y==="M"||g.y==="1f"&&f.14().M+n.X/2+j.W",{"1Q":"1t-1o-12"}).Y({U:b,X:c}).5Y(l),r?a("<4I />").30(k.12)[0].3V("2d").4y():(d=\'<40:44 5Z="0,0" 15="2h:52-2U; 14:3U; 4E:2i(#3D#4G);">\',k.12.2R(p?d+=d:d))},32:9(b,c){Q g=k.12,l=g.60(),m=n.U,q=n.X,s="41 6d ",u="41 61 3t",w=j.3A,y=16.3O,z,A,B,C,D;b||(b=i.1k),w===e?w=b:(w=1F h.2H(w),w.1e=b.1e,w.x==="3q"?w.x=b.x:w.y==="3q"?w.y=b.y:w.x===w.y&&(w[b.1e]=b[b.1e])),z=w.1e,i.4x(),p=o.1d==="3t"||o.1d==="#63"?0:j.1d===d?t(b,f,d):j.1d,B=x(w,m,q),D=v(b),g.Y(D),b.1e==="y"?C=[y(w.x==="N"?p:w.x==="1j"?D.U-m-p:(D.U-m)/2),y(w.y==="M"?D.X-q:0)]:C=[y(w.x==="N"?D.U-m:0),y(w.y==="M"?p:w.y==="1i"?D.X-q-p:(D.X-q)/2)],r?(l.17(D),A=l[0].3V("2d"),A.64(),A.4y(),A.66(0,0,5v,5v),A.67(C[0],C[1]),A.68(),A.69(B[0][0],B[0][1]),A.4z(B[1][0],B[1][1]),A.4z(B[2][0],B[2][1]),A.6a(),A.6b=o.2M,A.6c=o.1d,A.82=p*2,A.6e="4D",A.6f=5r,A.4B(),A.2M()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" 6g",C[2]=p&&/^(r|b)/i.1v(b.1p())?4L(a.1U.3r,10)===8?2:1:0,l.Y({6h:""+(w.1p().2F("1f")>-1),N:C[0]-C[2]*4A(z==="x"),M:C[1]-C[2]*4A(z==="y"),U:m+p,X:q+p}).1m(9(b){Q c=a(S);c.17({6i:m+p+" "+(q+p),7U:B,6k:o.2M,6l:!!b,6m:!b}).Y({2h:p||b?"2U":"3I"}),!b&&p>0&&c.2R()===""&&c.2R(\'<40:4B 6n="\'+p*2+\'41" 34="\'+o.1d+\'" 6o="6p" 6q="4D" 15="4E:2i(#3D#4G); 2h:52-2U;" />\')})),c!==e&&i.14(b)},14:9(b){Q c=k.12,f={},g=16.1H(0,j.W),h,l,m;T(j.1k===e||!c)O e;b=b||i.1k,h=b.1e,l=v(b),m=[b.x,b.y],h==="x"&&m.6r(),a.1m(m,9(a,c){Q e,i;c==="1f"?(e=h==="y"?"N":"M",f[e]="50%",f["2P-"+e]=-16.3O(l[h==="y"?"U":"X"]/2)+g):(e=t(b,c,d),i=u(b),f[c]=a?t(b,c):g+(i>e?i:0))}),f[b[h]]-=l[h==="x"?"U":"X"],c.Y({M:"",1i:"",N:"",1j:"",2P:""}).Y(f);O f},25:9(){k.12&&k.12.1K(),l.1s(q)}}),i.1J()}9 x(a,b,c){Q d=16.3u(b/2),e=16.3u(c/2),f={4Y:[[0,0],[b,c],[b,0]],4W:[[0,0],[b,0],[0,c]],4S:[[0,c],[b,0],[b,c]],4X:[[0,0],[0,c],[b,c]],7A:[[0,c],[d,0],[b,c]],7z:[[0,0],[b,0],[d,c]],6u:[[0,0],[b,e],[0,c]],6v:[[b,0],[b,c],[0,e]]};f.6y=f.4Y,f.6z=f.4W,f.6B=f.4S,f.6D=f.4X;O f[a.1p()]}9 w(b){Q c=S,f=b.2V.1o,g=b.2a.V.1y,h=".1c-1y",i=/<4a\\b[^<]*(?:(?!<\\/4a>)<[^<]*)*<\\/4a>/5i,j=d;b.2Y.1y={"^V.1y":9(a,b,d){b==="1y"&&(g=d),b==="2r"?c.1J():g&&g.2i?c.45():f.1s(h)}},a.1l(c,{1J:9(){g&&g.2i&&f.1s(h)[g.2r?"6E":"18"]("3X"+h,c.45);O c},45:9(d,h){9 p(a,c,d){b.38("V.1n",c+": "+d),n()}9 o(c){l&&(c=a("<2p/>").3d(c.23(i,"")).4P(l)),b.38("V.1n",c),n()}9 n(){m&&(f.Y("4e",""),h=e)}T(d&&d.3l())O c;Q j=g.2i.2F(" "),k=g.2i,l,m=g.2r&&!g.5s&&h;m&&f.Y("4e","4f"),j>-1&&(l=k.2z(j),k=k.2z(0,j)),a.1y(a.1l({6F:o,4s:p,7k:b},g,{2i:k}));O c}}),c.1J()}9 v(b,c){Q i,j,k,l,m=a(S),n=a(1D.3a),o=S===1D?n:m,p=m.1X?m.1X(c.1X):f,q=c.1X.1B==="6H"&&p?p[c.1X.47]:f,v=m.2n(c.1X.47||"6I");7g{v=11 v==="1p"?(1F 6K("O "+v))():v}7e(w){s("6L 7c 7b 7a 6O 2n: "+v)}l=a.1l(d,{},g.3k,c,11 v==="1g"?t(v):f,t(q||p)),p&&a.5w(S,"1X"),j=l.14,l.1q=b;T("35"===11 l.V.1n){k=m.17(l.V.17);T(l.V.17!==e&&k)l.V.1n=k;2y O e}j.1u===e&&(j.1u=n),j.13===e&&(j.13=o),l.P.13===e&&(l.P.13=o),l.P.3o===d&&(l.P.3o=n),l.R.13===e&&(l.R.13=o),l.14.2u===d&&(l.14.2u=j.1u),j.2s=1F h.2H(j.2s),j.1P=1F h.2H(j.1P);T(a.2n(S,"1c"))T(l.4k)m.1c("25");2y T(l.4k===e)O e;a.17(S,"19")&&(a.17(S,r,a.17(S,"19")),S.3v("19")),i=1F u(m,l,b,!!k),a.2n(S,"1c",i),m.18("1K.1c",9(){i.25()});O i}9 u(c,p,q,s){9 L(c,d,e,f){f=1x(f,10)!==0;Q g=".1c-"+q,h={P:c&&p.P.13[0],R:d&&p.R.13[0],1o:e&&u.1h&&A.1o[0],V:e&&u.1h&&A.V[0],1u:f&&p.14.1u[0]===v?1D:p.14.1u[0],3R:f&&b};u.1h?a([]).78(a.6R([h.P,h.R,h.1o,h.1u,h.V,h.3R],9(a){O 11 a==="1g"})).1s(g):c&&p.P.13.1s(g+"-2f")}9 K(d,f,h,j){9 D(a){z.1N(":22")&&u.1Y(a)}9 C(a){T(z.1S(l))O e;1G(u.1r.1T),u.1r.1T=3f(9(){u.R(a)},p.R.1T)}9 y(b){T(z.1S(l))O e;Q c=a(b.3s||b.13),d=c.76(m)[0]===z[0],f=c[0]===r.P[0];1G(u.1r.P),1G(u.1r.R);T(n.13==="1w"&&d||p.R.2v&&(/1w(3i|2w|49)/.1v(b.1B)&&(d||f))){b.6S(),b.6U();O e}p.R.2c>0?u.1r.R=3f(9(){u.R(b)},p.R.2c):u.R(b)}9 x(a){T(z.1S(l))O e;r.P.2q("1c-"+q+"-1T"),1G(u.1r.P),1G(u.1r.R);Q b=9(){u.P(a)};p.P.2c>0?u.1r.P=3f(b,p.P.2c):b()}Q k=".1c-"+q,n=p.14,r={P:p.P.13,R:p.R.13,1u:n.1u[0]===v?a(1D):n.1u,43:a(1D)},s={P:a.3y(""+p.P.1b).2A(" "),R:a.3y(""+p.R.1b).2A(" ")},t=a.1U.3c&&1x(a.1U.3r,10)===6,w;h&&(p.R.2v&&(r.R=r.R.2Q(z),z.18("6V"+k,9(){z.1S(l)||1G(u.1r.R)})),n.13==="1w"&&n.29.1w&&p.R.1b&&z.18("2L"+k,9(a){(a.3s||a.13)!==r.P[0]&&u.R(a)}),z.18("2J"+k,9(a){u[a.1B==="2J"?"2e":"1M"](a)}),z.18("2J"+k+" 2L"+k,9(a){z.28(o,a.1B==="2J")})),f&&("2B"===11 p.R.1T&&(r.P.18("1c-"+q+"-1T",C),a.1m(g.5b,9(a,b){r.R.2Q(A.1o).18(b+k+"-1T",C)})),/1w(4q|4r)/i.1v(p.P.1b)&&!/1w(3i|2w)/i.1v(p.R.1b)&&r.R.18("2L"+k,9(a){1G(u.1r.P)}),a.1m(s.R,9(b,c){Q d=a.6X(c,s.P),e=a(r.R);d>-1&&e.2Q(r.P).1a===e.1a||c==="4N"?(r.P.18(c+k,9(a){z.1N(":22")?y(a):x(a)}),2D s.P[d]):r.R.18(c+k,y)})),d&&(a.1m(s.P,9(a,b){r.P.18(b+k,x)}),"2B"===11 p.R.4l&&r.P.18("31"+k,9(a){Q b=B.3e||{},c=p.R.4l,d=16.3n;b&&(d(a.2j-b.2j)>=c||d(a.2E-b.2E)>=c)&&u.R(a)})),j&&((n.29.2g||n.2u)&&a(a.1b.6Y.2g?n.2u:b).18("2g"+k,D),(n.2u||t&&z.Y("14")==="2v")&&a(n.2u).18("3T"+k,D),/4N/i.1v(p.R.1b)&&r.43.18("3F"+k,9(b){Q d=a(b.13);d.71(m).1a===0&&d.2Q(c).1a>1&&z.1N(":22")&&!z.1S(l)&&u.R(b)}),p.R.2w&&/2L|4U/i.1v(p.R.1b)&&a(b).18("1M"+k+" 1w"+(p.R.2w.2F("72")>-1?"3i":"2w")+k,9(a){a.3s||u.R(a)}),n.13==="1w"&&r.43.18("31"+k,9(a){n.29.1w&&!z.1S(l)&&z.1N(":22")&&u.1Y(a||i)}))}9 J(b,d){9 g(a){9 c(c){(b=b.2x(S)).1a===0&&(u.2I(),u.1Y(B.1b),a())}Q b;T((b=f.4P("3x:2x([X]):2x([U])")).1a===0)O c.1V(b);b.1m(9(a,b){(9 d(){Q e=u.1r.3x;T(b.X&&b.U){1G(e[a]);O c.1V(b)}e[a]=3f(d,20)})()})}Q f=A.V;b=b||p.V.1n;T(!u.1h||!b)O e;a.1L(b)&&(b=b.1V(c,u)||""),b.26&&b.1a>0?f.4Q().3d(b.Y({2h:"2U"})):f.2R(b),u.1h<0?z.3K("4h",g):(y=0,g(a.5u));O u}9 I(b){Q d=A.19;T(!u.1h||!b)O e;a.1L(b)&&(b=b.1V(c,u)||""),b.26&&b.1a>0?d.4Q().3d(b.Y({2h:"2U"})):d.2R(b),u.2I(),u.1h&&z.1N(":22")&&u.1Y(B.1b)}9 H(a){Q b=A.1C,c=A.19;T(!u.1h)O e;a?(c||G(),F()):b.1K()}9 G(){Q b=w+"-19";A.1A&&E(),A.1A=a("<2p />",{"1Q":j+"-1A "+(p.15.2t?"1t-2t-4V":"")}).3d(A.19=a("<2p />",{1q:b,"1Q":j+"-19","1O-4b":d})).75(A.V),p.V.19.1C?F():u.1h&&u.2I()}9 F(){Q b=p.V.19.1C,c=11 b==="1p",d=c?b:"77 1o";A.1C&&A.1C.1K(),b.26?A.1C=b:A.1C=a("",{"1Q":"1t-3g-3D "+(p.15.2t?"":j+"-3B"),19:d,"1O-79":d}).7d(a("<7f />",{"1Q":"1t-3B 1t-3B-7h",2R:"&7l;"})),A.1C.30(A.1A).17("51","1C").3S(9(b){a(S).28("1t-3g-3S",b.1B==="2J")}).3W(9(a){z.1S(l)||u.R(a);O e}).18("3F 4M 5f 7m 4U",9(b){a(S).28("1t-3g-7o 1t-3g-2e",b.1B.2z(-4)==="7p")}),u.2I()}9 E(){A.19&&(A.1A.1K(),A.1A=A.19=A.1C=f,u.1Y())}9 D(){Q a=p.15.2t;z.28(k,a),A.V.28(k+"-V",a),A.1A&&A.1A.28(k+"-4V",a),A.1C&&A.1C.28(j+"-3B",!a)}9 C(a){Q b=0,c,d=p,e=a.2A(".");3b(d=d[e[b++]])b0&&!a("#"+i).1a&&(z[0].1q=i,A.V[0].1q=i+"-V",A.19[0].1q=i+"-19")},"^V.1n$":9(a,b,c){J(c)},"^V.19.1n$":9(a,b,c){T(!c)O E();!A.19&&c&&G(),I(c)},"^V.19.1C$":9(a,b,c){H(c)},"^14.(1P|2s)$":9(a,b,c){"1p"===11 c&&(a[b]=1F h.2H(c))},"^14.1u$":9(a,b,c){u.1h&&z.30(c)},"^(P|R).(1b|13|2v|2c|1T)$":9(a,b,c,d,e){Q f=[1,0,0];f[e[1]==="P"?"4d":"7u"](0),L.2b(u,f),K.2b(u,[1,1,0,0])},"^P.2X$":9(){u.1h?u.P():u.1I(1)},"^15.3p$":9(b,c,d){a.17(z[0],"1Q",j+" 1c 1t-4Z-4H "+d)},"^15.2t|V.19":D,"^48.(1I|P|49|R|2e|1M)$":9(b,c,d){z[(a.1L(d)?"":"7v")+"18"]("1o"+c,d)}},a.1l(u,{1I:9(b){T(u.1h)O u;Q f=p.V.19.1n,g=a.37("7x");a.17(c[0],"1O-4p",w),z=A.1o=a("<2p/>",{1q:w,"1Q":j+" 1c 1t-4Z-4H "+p.15.3p,U:p.15.U||"",51:"7B","1O-7C":"7D","1O-4b":e,"1O-4p":w+"-V","1O-4f":d}).28(l,B.2G).2n("1c",u).30(p.14.1u).3d(A.V=a("<2p />",{"1Q":j+"-V",1q:w+"-V","1O-4b":d})),u.1h=-1,y=1,f&&(G(),I(f)),J(),u.1h=d,D(),a.1m(p.48,9(b,c){a.1L(c)&&z.18(b==="1W"?"3X 55":"1o"+b,c)}),a.1m(h,9(){S.2K==="1I"&&S(u)}),K(1,1,1,1),z.3K("4h",9(a){g.3j=B.1b,z.2q(g,[u]),y=0,u.2I(),(p.P.2X||b)&&u.P(B.1b),a()});O u},42:9(a){Q b,c;5e(a.2o()){3h"56":b={X:z.39(),U:z.3C()};2Z;3h"W":b=h.W(z,p.14.1u);2Z;3D:c=C(a.2o()),b=c[0][c[1]],b=b.1e?b.1p():b}O b},38:9(b,c){9 m(a,b){Q c,d,e;57(c 21 k)57(d 21 k[c])T(e=(1F 7G(d,"i")).4O(a))b.4d(e),k[c][d].2b(u,b)}Q g=/^14\\.(1P|2s|29|13|1u)|15|V|P\\.2X/i,h=/^V\\.(19|17)|15/i,i=e,j=e,k=u.2Y,l;"1p"===11 b?(l=b,b={},b[l]=c):b=a.1l(d,{},b),a.1m(b,9(c,d){Q e=C(c.2o()),f;f=e[0][e[1]],e[0][e[1]]="1g"===11 d&&d.7H?a(d):d,b[c]=[e[0],e[1],d,f],i=g.1v(c)||i,j=h.1v(c)||j}),t(p),x=y=1,a.1m(b,m),x=y=0,z.1N(":22")&&u.1h&&(i&&u.1Y(p.14.13==="1w"?f:B.1b),j&&u.2I());O u},1W:9(b,c){9 l(){b?(a.1U.3c&&z[0].15.3v("2C"),z.Y("7I","")):z.Y({2h:"",4e:"",U:"",4m:"",N:"",M:""})}T(!u.1h)T(b)u.1I(1);2y O u;Q d=b?"P":"R",g=p[d],h=z.1N(":22"),j,k;(11 b).4C("35|2B")&&(b=!h);T(h===b)O u;T(c){T(/4q|4r/.1v(c.1B)&&/3i|2w/.1v(B.1b.1B)&&c.13===p.P.13[0]&&z.7J(c.3s).1a)O u;B.1b=a.1l({},c)}k=a.37("1o"+d),k.3j=c?B.1b:f,z.2q(k,[u,3P]);T(k.3l())O u;a.17(z[0],"1O-4f",!b),b?(B.3e=a.1l({},i),u.2e(c),a.1L(p.V.1n)&&J(),u.1Y(c),g.3o&&a(m,g.3o).2x(z).1c("R",k)):(1G(u.1r.P),2D B.3e,u.1M(c)),z.5a(0,1),a.1L(g.1R)?(g.1R.1V(z,u),z.3K("4h",9(a){l(),a()})):g.1R===e?(z[d](),l.1V(z)):z.4w(3P,b?1:0,l),b&&g.13.2q("1c-"+q+"-1T");O u},P:9(a){O u.1W(d,a)},R:9(a){O u.1W(e,a)},2e:9(b){T(!u.1h)O u;Q c=a(m),d=1x(z[0].15.2N,10),e=g.5h+c.1a,f=a.1l({},b),h,i;z.1S(n)||(i=a.37("5c"),i.3j=f,z.2q(i,[u,e]),i.3l()||(d!==e&&(c.1m(9(){S.15.2N>d&&(S.15.2N=S.15.2N-1)}),c.2C("."+n).1c("1M",f)),z.3L(n)[0].15.2N=e));O u},1M:9(b){Q c=a.1l({},b),d;z.4o(n),d=a.37("5d"),d.3j=c,z.2q(d,[u]);O u},1Y:9(c,d){T(!u.1h||x)O u;x=1;Q f=p.14.13,g=p.14,k=g.1P,l=g.2s,m=g.29,n=m.4n.2A(" "),o=z.3C(),q=z.39(),r=0,s=0,t=a.37("4j"),w=z.Y("14")==="2v",y=g.2u,A={N:0,M:0},C=(u.1E.12||{}).1k,D={3G:n[0],3H:n[1]||n[0],12:p.15.12||{},N:9(a){Q b=D.3G==="2m",c=y.W.N+y.2S,d=k.x==="N"?o:k.x==="1j"?-o:-o/2,e=l.x==="N"?r:l.x==="1j"?-r:-r/2,f=D.12.U+D.12.1d*2||0,g=C&&C.1e==="x"&&!b?f:0,h=c-a-g,i=a+o-y.U-c+g,j=d-(k.1e==="x"||k.x===k.y?e:0),n=k.x==="1f";b?(g=C&&C.1e==="y"?f:0,j=(k.x==="N"?1:-1)*d-g,A.N+=h>0?h:i>0?-i:0,A.N=16.1H(y.W.N+(g&&C.x==="1f"?D.12.W:0),a-j,16.3M(16.1H(y.W.N+y.U,a+j),A.N))):(h>0&&(k.x!=="N"||i>0)?A.N-=j+(n?0:2*m.x):i>0&&(k.x!=="1j"||h>0)&&(A.N-=n?-j:j+2*m.x),A.N!==a&&n&&(A.N-=m.x),A.Ni&&(A.N=a));O A.N-a},M:9(a){Q b=D.3H==="2m",c=y.W.M+y.2O,d=k.y==="M"?q:k.y==="1i"?-q:-q/2,e=l.y==="M"?s:l.y==="1i"?-s:-s/2,f=D.12.X+D.12.1d*2||0,g=C&&C.1e==="y"&&!b?f:0,h=c-a-g,i=a+q-y.X-c+g,j=d-(k.1e==="y"||k.x===k.y?e:0),n=k.y==="1f";b?(g=C&&C.1e==="x"?f:0,j=(k.y==="M"?1:-1)*d-g,A.M+=h>0?h:i>0?-i:0,A.M=16.1H(y.W.M+(g&&C.x==="1f"?D.12.W:0),a-j,16.3M(16.1H(y.W.M+y.X,a+j),A.M))):(h>0&&(k.y!=="M"||i>0)?A.M-=j+(n?0:2*m.y):i>0&&(k.y!=="1i"||h>0)&&(A.M-=n?-j:j+2*m.y),A.M!==a&&n&&(A.M-=m.y),A.M<0&&-A.M>i&&(A.M=a));O A.M-a}};T(f==="1w")l={x:"N",y:"M"},c=c&&(c.1B==="2g"||c.1B==="3T")?B.1b:!m.1w&&B.3e?B.3e:i&&(m.1w||!c||!c.2j)?{2j:i.2j,2E:i.2E}:c,A={M:c.2E,N:c.2j};2y{f==="1b"&&(c&&c.13&&c.1B!=="3T"&&c.1B!=="2g"?f=B.13=a(c.13):f=B.13),f=a(f).7O(0);T(f.1a===0)O u;f[0]===1D||f[0]===b?(r=f.U(),s=f.X(),f[0]===b&&(A={M:!w||h.2T?y.2O():0,N:!w||h.2T?y.2S():0})):f.1N("7P")&&h.46?A=h.46(f,l):f[0].7R==="7S://7V.7W.7X/7Y/3Q"&&h.3Q?A=h.3Q(f,l):(r=f.3C(),s=f.39(),A=h.W(f,g.1u,w)),A.W&&(r=A.U,s=A.X,A=A.W),A.N+=l.x==="1j"?r:l.x==="1f"?r/2:0,A.M+=l.y==="1i"?s:l.y==="1f"?s/2:0}A.N+=m.x+(k.x==="1j"?-o:k.x==="1f"?-o/2:0),A.M+=m.y+(k.y==="1i"?-q:k.y==="1f"?-q/2:0),y.26&&f[0]!==b&&f[0]!==v&&D.3H+D.3G!=="7Z"?(y={5n:y,X:y[(y[0]===b?"h":"80")+"81"](),U:y[(y[0]===b?"w":"83")+"84"](),2S:y.2S(),2O:y.2O(),W:y.W()||{N:0,M:0}},A.3J={N:D.3G!=="3I"?D.N(A.N):0,M:D.3H!=="3I"?D.M(A.M):0}):A.3J={N:0,M:0},z.17("1Q",9(b,c){O a.17(S,"1Q").23(/1t-1o-5m-\\w+/i,"")}).3L(j+"-5m-"+k.53()),t.3j=a.1l({},c),z.2q(t,[u,A,y.5n||y]);T(t.3l())O u;2D A.3J,d===e||5o(A.N)||5o(A.M)||!a.1L(g.1R)?z.Y(A):a.1L(g.1R)&&(g.1R.1V(z,u,a.1l({},A)),z.3K(9(b){a(S).Y({4m:"",X:""}),a.1U.3c&&S.15.3v("2C"),b()})),x=0;O u},2I:9(){T(u.1h<1||p.15.U||y)O u;Q b=j+"-5p",c=p.14.1u,d,e,f,g;y=1,z.Y("U","").3L(b),e=z.U()+(a.1U.5q?1:0),f=z.Y("1H-U")||"",g=z.Y("3M-U")||"",d=(f+g).2F("%")>-1?c.U()/5r:0,f=(f.2F("%")>-1?d:1)*1x(f,10)||e,g=(g.2F("%")>-1?d:1)*1x(g,10)||0,e=f+g?16.3M(16.1H(e,g),f):e,z.Y("U",16.3O(e)).4o(b),y=0;O u},4c:9(b){Q c=l;"35"!==11 b&&(b=!z.1S(c)&&!B.2G),u.1h?(z.28(c,b),a.17(z[0],"1O-2G",b)):B.2G=!!b;O u},86:9(){O u.4c(e)},25:9(){Q b=c[0],d=a.17(b,r);u.1h&&(z.1K(),a.1m(u.1E,9(){S.25&&S.25()})),1G(u.1r.P),1G(u.1r.R),L(1,1,1,1),a.5w(b,"1c"),d&&(a.17(b,"19",d),c.3z(r)),c.3z("1O-4p").1s(".1c");O c}})}9 t(b){Q c;T(!b||"1g"!==11 b)O e;"1g"!==11 b.1X&&(b.1X={1B:b.1X});T("V"21 b){T("1g"!==11 b.V||b.V.26)b.V={1n:b.V};c=b.V.1n||e,!a.1L(c)&&(!c&&!c.17||c.1a<1||"1g"===11 c&&!c.26)&&(b.V.1n=e),"19"21 b.V&&("1g"!==11 b.V.19&&(b.V.19={1n:b.V.19}),c=b.V.19.1n||e,!a.1L(c)&&(!c&&!c.17||c.1a<1||"1g"===11 c&&!c.26)&&(b.V.19.1n=e))}"14"21 b&&("1g"!==11 b.14&&(b.14={1P:b.14,2s:b.14})),"P"21 b&&("1g"!==11 b.P&&(b.P.26?b.P={13:b.P}:b.P={1b:b.P})),"R"21 b&&("1g"!==11 b.R&&(b.R.26?b.R={13:b.R}:b.R={1b:b.R})),"15"21 b&&("1g"!==11 b.15&&(b.15={3p:b.15})),a.1m(h,9(){S.36&&S.36(b)});O b}9 s(){Q c=b.88;O c&&(c.4s||c.5y||a.5u).2b(c,24)}Q d=!0,e=!1,f=5C,g,h,i,j="1t-1o",k="1t-2t",l="1t-3g-2G",m="2p.1c."+j,n=j+"-2e",o=j+"-3S",p="-5K",q="5M",r="4T";g=a.2l.1c=9(b,h,i){Q j=(""+b).2o(),k=f,l=j==="4c"?[d]:a.5O(24).5x(1,10),m=l[l.1a-1],n=S[0]?a.2n(S[0],"1c"):f;T(!24.1a&&n||j==="5Q")O n;T("1p"===11 b){S.1m(9(){Q b=a.2n(S,"1c");T(!b)O d;m&&m.5R&&(b.3m.1b=m);T(j!=="7j"&&j!=="2a"||!h)b[j]&&b[j].2b(b[j],l);2y T(a.5T(h)||i!==c)b.38(h,i);2y{k=b.42(h);O e}});O k!==f?k:S}T("1g"===11 b||!24.1a){n=t(a.1l(d,{},b));O g.18.1V(S,n,m)}},g.18=9(b,c){O S.1m(9(f){9 p(b){9 c(){o.1I(11 b==="1g"||i.P.2X),k.P.1s(l.P),k.R.1s(l.R)}T(o.3m.2G)O e;o.3m.1b=a.1l({},b),i.P.2c>0?(1G(o.1r.P),o.1r.P=3f(c,i.P.2c),l.P!==l.R&&k.R.18(l.R,9(){1G(o.1r.P)})):c()}Q i,k,l,m=!b.1q||b.1q===e||b.1q.1a<1||a("#"+j+"-"+b.1q).1a?g.4g++:b.1q,n=".1c-"+m+"-2f",o=v.1V(S,m,b);T(o===e)O d;i=o.2a,a.1m(h,9(){S.2K==="2K"&&S(o)}),k={P:i.P.13,R:i.R.13},l={P:a.3y(""+i.P.1b).23(/ /g,n+" ")+n,R:a.3y(""+i.R.1b).23(/ /g,n+" ")+n},/1w(4q|4r)/i.1v(l.P)&&!/1w(3i|2w)/i.1v(l.R)&&(l.R+=" 2L"+n),k.P.18(l.P,p),(i.P.2X||i.5k)&&p(c)})},h=g.1E={2H:9(a){a=(""+a).23(/([A-Z])/," $1").23(/6j/5i,"1f").2o(),S.x=(a.3Z(/N|1j/i)||a.3Z(/1f/)||["3q"])[0].2o(),S.y=(a.3Z(/M|1i|1f/i)||["3q"])[0].2o(),S.1e=a.33(0).4C(/^(t|b)/)>-1?"y":"x",S.1p=9(){O S.1e==="y"?S.y+S.x:S.x+S.y},S.53=9(){Q a=S.x.2z(0,1),b=S.y.2z(0,1);O a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b}},W:9(c,d,e){9 l(a,b){f.N+=b*a.2S(),f.M+=b*a.2O()}Q f=c.W(),g=d,i=0,j=1D.3a,k;T(g){6s{T(g[0]===j)2Z;g.Y("14")!=="6t"&&(k=g.14(),f.N-=k.N+(1x(g.Y("6w"),10)||0),f.M-=k.M+(1x(g.Y("6A"),10)||0),i++)}3b(g=g.6C());(d[0]!==j||i>1)&&l(d,1),(h.2T<4.1&&h.2T>3.1||!h.2T&&e)&&l(a(b),-1)}O f},2T:4L((""+(/4R.*6G ([0-6J]{1,3})|(4R 6M).*6N.*6P/i.4O(6T.6W)||[0,""])[1]).23("5g","6Z").23("73","."))||e,2l:{17:9(b,c){T(S.1a){Q d=S[0],e="19",f=a.2n(d,"1c");T(b===e){T(24.1a<2)O a.17(d,r);T(11 f==="1g"){f&&f.1h&&f.2a.V.17===e&&f.3m.17&&f.38("V.1n",c),a.2l["17"+q].2b(S,24),a.17(d,r,a.17(d,e));O S.3z(e)}}}},4K:9(b){Q c=a([]),d="19",e;e=a.2l["4K"+q].2b(S,24).2C("[4T]").1m(9(){a.17(S,d,a.17(S,r)),S.3v(r)}).7s();O e},1K:a.1t?f:9(b,c){a(S).1m(9(){c||(!b||a.2C(b,[S]).1a)&&a("*",S).2Q(S).1m(9(){a(S).7y("1K")})})}}},a.1m(h.2l,9(b,c){T(!c)O d;Q e=a.2l[b+q]=a.2l[b];a.2l[b]=9(){O c.2b(S,24)||e.2b(S,24)}}),a(1D).18("31.1c",9(a){i={2j:a.2j,2E:a.2E,1B:"31"}}),g.3r="2.0.7K",g.4g=0,g.5b="3W 7M 3F 5f 31 2L 2J".2A(" "),g.5h=7Q,g.3k={5k:e,1q:e,4k:d,V:{1n:d,17:"19",19:{1n:e,1C:e}},14:{1P:"M N",2s:"1i 1j",13:e,1u:e,2u:e,29:{x:0,y:0,1w:d,2g:d,4n:"3N 3N"},1R:d},P:{13:e,1b:"2J",1R:d,2c:3P,3o:e,2X:e},R:{13:e,1b:"2L",1R:d,2c:0,2v:e,1T:e,2w:"3R",4l:e},15:{3p:"",2t:e,U:e},48:{1I:f,49:f,P:f,R:f,1W:f,2e:f,1M:f}},h.1y=9(a){Q b=a.1E.1y;O"1g"===11 b?b:a.1E.1y=1F w(a)},h.1y.2K="1I",h.1y.36=9(a){Q b=a.V,c;b&&"1y"21 b&&(c=b.1y,11 c!=="1g"&&(c=a.V.1y={2i:c}),"35"!==11 c.2r&&c.2r&&(c.2r=!!c.2r))},a.1l(d,g.3k,{V:{1y:{5s:d,2r:d}}}),h.12=9(a){Q b=a.1E.12;O"1g"===11 b?b:a.1E.12=1F y(a)},h.12.2K="1I",h.12.36=9(a){Q b=a.15,c;b&&"12"21 b&&(c=a.15.12,11 c!=="1g"&&(a.15.12={1k:c}),/1p|35/i.1v(11 c.1k)||(c.1k=d),11 c.U!=="2B"&&2D c.U,11 c.X!=="2B"&&2D c.X,11 c.1d!=="2B"&&c.1d!==d&&2D c.1d,11 c.W!=="2B"&&2D c.W)},a.1l(d,g.3k,{15:{12:{1k:d,3A:e,U:6,X:6,1d:d,W:0}}}),h.46=9(b,c){9 l(a,b){Q d=0,e=1,f=1,g=0,h=0,i=a.U,j=a.X;3b(i>0&&j>0&&e>0&&f>0){i=16.3w(i/2),j=16.3w(j/2),c.x==="N"?e=i:c.x==="1j"?e=a.U-i:e+=16.3w(i/2),c.y==="M"?f=j:c.y==="1i"?f=a.X-j:f+=16.3w(j/2),d=b.1a;3b(d--){T(b.1a<2)2Z;g=b[d][0]-a.W.N,h=b[d][1]-a.W.M,(c.x==="N"&&g>=e||c.x==="1j"&&g<=e||c.x==="1f"&&(ga.U-e)||c.y==="M"&&h>=f||c.y==="1i"&&h<=f||c.y==="1f"&&(ha.X-f))&&b.6Q(d,1)}}O{N:b[0][0],M:b[0][1]}}Q d=b.17("44").2o(),e=b.17("74").2A(","),f=[],g=a(\'3x[7i="#\'+b.7n("58").17("47")+\'"]\'),h=g.W(),i={U:0,X:0,W:{M:3E,1j:0,1i:0,N:3E}},j=0,k=0;h.N+=16.3u((g.3C()-g.U())/2),h.M+=16.3u((g.39()-g.X())/2);T(d==="5l"){j=e.1a;3b(j--)k=[1x(e[--j],10),1x(e[j+1],10)],k[0]>i.W.1j&&(i.W.1j=k[0]),k[0]i.W.1i&&(i.W.1i=k[1]),k[1]= limit || Math.abs(event.pageY - coords[1]) >= limit)){ + if(origin && (abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit)){ self.hide(event); } }); @@ -865,6 +881,9 @@ function QTip(target, options, id, attr) // Execute state specific properties if(state) { + // Store show origin coordinates + cache.origin = $.extend({}, MOUSE); + // Focus the tooltip self.focus(event); @@ -876,18 +895,13 @@ function QTip(target, options, id, attr) // Hide other tooltips if tooltip is solo, using it as the context if(opts.solo) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); } - - // Store coordinates if hide.distance is set - if('number' === typeof options.hide.distance) { - cache.coords = [ event.pageX, event.pageY ]; - } } else { // Clear show timer if we're hiding clearTimeout(self.timers.show); - // Delete cached coords - delete cache.coords; + // Remove cached origin on hide + delete cache.origin; // Blur the tooltip self.blur(event); @@ -956,26 +970,26 @@ function QTip(target, options, id, attr) // Only update the z-index if it has changed and tooltip is not already focused if(!tooltip.hasClass(focusClass)) { - // Only update z-index's if they've changed' - if(curIndex !== newIndex) { - // Reduce our z-index's and keep them properly ordered - qtips.each(function() { - if(this.style.zIndex > curIndex) { - this.style.zIndex = this.style.zIndex - 1; - } - }); - - // Fire blur event for focused tooltip - qtips.filter('.' + focusClass).qtip('blur', cachedEvent); - } - // Call API method callback = $.Event('tooltipfocus'); callback.originalEvent = cachedEvent; tooltip.trigger(callback, [self, newIndex]); - // If callback wasn't FALSE + // If default action wasn't prevented... if(!callback.isDefaultPrevented()) { + // Only update z-index's if they've changed + if(curIndex !== newIndex) { + // Reduce our z-index's and keep them properly ordered + qtips.each(function() { + if(this.style.zIndex > curIndex) { + this.style.zIndex = this.style.zIndex - 1; + } + }); + + // Fire blur event for focused tooltip + qtips.filter('.' + focusClass).qtip('blur', cachedEvent); + } + // Set the new z-index tooltip.addClass(focusClass)[0].style.zIndex = newIndex; } @@ -1025,27 +1039,35 @@ function QTip(target, options, id, attr) // Repositioning method and axis detection horizontal: method[0], vertical: method[1] || method[0], - tip: options.style.tip, + tip: options.style.tip || {}, // Reposition methods left: function(posLeft) { - var viewportScroll = viewport.offset.left + viewport.scrollLeft, + var isShift = readjust.horizontal === 'shift', + viewportScroll = viewport.offset.left + viewport.scrollLeft, myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2, atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2, - tipAdjust = tip && tip.precedance === 'y' ? readjust.tip.width + readjust.tip.border * 2 : 0, + tipWidth = (readjust.tip.width + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'x' && !isShift ? tipWidth : 0, overflowLeft = viewportScroll - posLeft - tipAdjust, overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust, offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0), isCenter = my.x === 'center'; // Optional 'shift' style repositioning - if(readjust.horizontal === 'shift') { - position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'y' ? tipWidth : 0; + offset = (my.x === 'left' ? 1 : -1) * myWidth - tipAdjust; - // Make sure we stay within the viewport boundaries - position.left = Math.min( - Math.max(viewportScroll, position.left), - Math.max(overflowLeft > 0 ? -1E9 : 0, viewportScroll + viewport.width - elemWidth) + // Adjust position but keep it within viewport dimensions + position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + position.left = Math.max( + viewport.offset.left + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posLeft - offset, + Math.min( + Math.max(viewport.offset.left + viewport.width, posLeft + offset), + position.left + ) ); } @@ -1066,23 +1088,31 @@ function QTip(target, options, id, attr) return position.left - posLeft; }, top: function(posTop) { - var viewportScroll = viewport.offset.top + viewport.scrollTop, + var isShift = readjust.vertical === 'shift', + viewportScroll = viewport.offset.top + viewport.scrollTop, myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2, atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2, - tipAdjust = tip && tip.precedance === 'x' ? readjust.tip.height + readjust.tip.border * 2 : 0, + tipHeight = (readjust.tip.height + readjust.tip.border * 2) || 0, + tipAdjust = tip && tip.precedance === 'y' && !isShift ? tipHeight : 0, overflowTop = viewportScroll - posTop - tipAdjust, overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust, offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0), isCenter = my.y === 'center'; // Optional 'shift' style repositioning - if(readjust.vertical === 'shift') { - position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + if(isShift) { + tipAdjust = tip && tip.precedance === 'x' ? tipHeight : 0; + offset = (my.y === 'top' ? 1 : -1) * myHeight - tipAdjust; - // Make sure we stay within the viewport boundaries - position.top = Math.min( - Math.max(viewportScroll, position.top), - Math.max(overflowTop > 0 ? -1E9 : 0, viewportScroll + viewport.height - elemHeight) + // Adjust position but keep it within viewport dimensions + position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + position.top = Math.max( + viewport.offset.top + (tipAdjust && tip.x === 'center' ? readjust.tip.offset : 0), + posTop - offset, + Math.min( + Math.max(viewport.offset.top + viewport.height, posTop + offset), + position.top + ) ); } @@ -1104,18 +1134,6 @@ function QTip(target, options, id, attr) } }; - - - // Cache our viewport details - viewport = !viewport ? FALSE : { - elem: viewport, - height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), - width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), - scrollLeft: viewport.scrollLeft(), - scrollTop: viewport.scrollTop(), - offset: viewport.offset() || { left:0, top: 0 } - }; - // Check if mouse was the target if(target === 'mouse') { // Force left top to allow flipping @@ -1123,8 +1141,9 @@ function QTip(target, options, id, attr) // Use cached event if one isn't available for positioning event = event && (event.type === 'resize' || event.type === 'scroll') ? cache.event : - adjust.mouse || !event || !event.pageX || (/over|enter$/i.test(event.type) && !adjust.mouse) ? - $.extend({}, MOUSE) : event; + !adjust.mouse && cache.origin ? cache.origin : + MOUSE && (adjust.mouse || !event || !event.pageX) ? { pageX: MOUSE.pageX, pageY: MOUSE.pageY } : + event; // Use event coordinates for position position = { top: event.pageY, left: event.pageX }; @@ -1151,8 +1170,8 @@ function QTip(target, options, id, attr) if(target[0] === window) { position = { - top: !fixed || PLUGINS.iOS ? viewport.scrollTop : 0, - left: !fixed || PLUGINS.iOS ? viewport.scrollLeft : 0 + top: !fixed || PLUGINS.iOS ? viewport.scrollTop() : 0, + left: !fixed || PLUGINS.iOS ? viewport.scrollLeft() : 0 }; } } @@ -1161,7 +1180,7 @@ function QTip(target, options, id, attr) else if(target.is('area') && PLUGINS.imagemap) { position = PLUGINS.imagemap(target, at); } - else if(target[0].namespaceURI == 'http://www.w3.org/2000/svg' && PLUGINS.svg) { + else if(target[0].namespaceURI === 'http://www.w3.org/2000/svg' && PLUGINS.svg) { position = PLUGINS.svg(target, at); } @@ -1169,7 +1188,7 @@ function QTip(target, options, id, attr) targetWidth = target.outerWidth(); targetHeight = target.outerHeight(); - position = PLUGINS.offset(target, posOptions.container); + position = PLUGINS.offset(target, posOptions.container, fixed); } // Parse returned plugin values into proper variables @@ -1188,16 +1207,29 @@ function QTip(target, options, id, attr) position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0); position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0); - // Calculate collision offset values - if(posOptions.viewport.jquery && target[0] !== window && target[0] !== docBody) { + // Calculate collision offset values if viewport positioning is enabled + if(viewport.jquery && target[0] !== window && target[0] !== docBody && + readjust.vertical+readjust.horizontal !== 'nonenone') + { + // Cache our viewport details + viewport = { + elem: viewport, + height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), + width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), + scrollLeft: viewport.scrollLeft(), + scrollTop: viewport.scrollTop(), + offset: viewport.offset() || { left: 0, top: 0 } + }; + + // Adjust position based onviewport and adjustment options position.adjusted = { left: readjust.horizontal !== 'none' ? readjust.left(position.left) : 0, top: readjust.vertical !== 'none' ? readjust.top(position.top) : 0 }; } - else { - position.adjusted = { left: 0, top: 0 }; - } + + //Viewport adjustment is disabled, set values to zero + else { position.adjusted = { left: 0, top: 0 }; } // Set tooltip position class tooltip.attr('class', function(i, val) { @@ -1207,7 +1239,7 @@ function QTip(target, options, id, attr) // Call API method callback.originalEvent = $.extend({}, event); - tooltip.trigger(callback, [self, position, viewport.elem]); + tooltip.trigger(callback, [self, position, viewport.elem || viewport]); if(callback.isDefaultPrevented()){ return self; } delete position.adjusted; @@ -1239,8 +1271,12 @@ function QTip(target, options, id, attr) { if(self.rendered < 1 || options.style.width || isDrawing) { return self; } - var fluid = uitooltip + '-fluid', width, max, min; - isDrawing = 1; // Set drawing flag + var fluid = uitooltip + '-fluid', + container = options.position.container, + perc, width, max, min; + + // Set drawing flag + isDrawing = 1; // Reset width and add fluid class tooltip.css('width', '').addClass(fluid); @@ -1248,15 +1284,20 @@ function QTip(target, options, id, attr) // Grab our tooltip width (add 1 so we don't get wrapping problems in Gecko) width = tooltip.width() + ($.browser.mozilla ? 1 : 0); - // Parse our max/min properties - max = parseInt(tooltip.css('max-width'), 10) || 0; - min = parseInt(tooltip.css('min-width'), 10) || 0; + // Grab our max/min properties + max = tooltip.css('max-width') || ''; + min = tooltip.css('min-width') || ''; + + // Parse into proper pixel values + perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0; + max = ((max.indexOf('%') > -1 ? perc : 1) * parseInt(max, 10)) || width; + min = ((min.indexOf('%') > -1 ? perc : 1) * parseInt(min, 10)) || 0; // Determine new dimension size based on max/min/current values width = max + min ? Math.min(Math.max(width, min), max) : width; // Set the newly calculated width and remvoe fluid class - tooltip.css('width', width).removeClass(fluid); + tooltip.css('width', Math.round(width)).removeClass(fluid); // Set drawing flag isDrawing = 0; @@ -1490,12 +1531,14 @@ QTIP.bind = function(opts, event) show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace, hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace }; - + /* - * If hide event is just 'unfocus', we'll use mouseleave as the hide event... - * since unfocus is actually library specific and won't fire as an event anywho. + * Make sure hoverIntent functions properly by using mouseleave as a hide event if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. */ - if(options.hide.event === 'unfocus') { events.hide = 'mouseleave' + namespace; } + if(/mouse(over|enter)/i.test(events.show) && !/mouse(out|leave)/i.test(events.hide)) { + events.hide += ' mouseleave' + namespace; + } // Define hoverIntent function function hoverIntent(event) { @@ -1550,7 +1593,7 @@ PLUGINS = QTIP.plugins = { }, // Custom (more correct for qTip!) offset calculator - offset: function(elem, container) { + offset: function(elem, container, fixed) { var pos = elem.offset(), parent = container, deep = 0, @@ -1578,7 +1621,9 @@ PLUGINS = QTIP.plugins = { // Compensate for containers scroll if it also has an offsetParent if(container[0] !== docBody || deep > 1) { scroll( container, 1 ); } - if(PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) { scroll( $(window), -1 ); } + + // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2 - v4.0) + if((PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) || (!PLUGINS.iOS && fixed)) { scroll( $(window), -1 ); } } return pos; diff --git a/src/extra.css b/src/extra.css index d1c9b448..6d90e034 100644 --- a/src/extra.css +++ b/src/extra.css @@ -147,8 +147,7 @@ /* Tipsy style */ .ui-tooltip-tipsy{ - border: 0 solid #000; - border: 0 solid rgba(0,0,0,.87); + border: 0; } .ui-tooltip-tipsy .ui-tooltip-titlebar, @@ -159,7 +158,7 @@ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)"; color: white; - border: 0 dashed transparent; + border: 0px transparent; font-size: 11px; font-family: 'Lucida Grande', sans-serif; diff --git a/src/intro.js b/src/intro.js index bc5672c4..50f58f08 100644 --- a/src/intro.js +++ b/src/intro.js @@ -17,6 +17,7 @@ disabled = 'ui-state-disabled', selector = 'div.qtip.'+uitooltip, focusClass = uitooltip + '-focus', + hoverClass = uitooltip + '-hover', hideOffset = '-31000px', replaceSuffix = '_replacedByqTip', oldtitle = 'oldtitle'; diff --git a/src/modal.js b/src/modal.js index 31730176..bb26f70d 100644 --- a/src/modal.js +++ b/src/modal.js @@ -38,12 +38,12 @@ function Modal(api) // Apply our show/hide/focus modal events .bind('tooltipshow'+globalNamespace+' tooltiphide'+globalNamespace, function(event, api, duration) { - self[ event.type.replace('tooltip', '') ](duration); + self[ event.type.replace('tooltip', '') ](event, duration); }) // Adjust modal z-index on tooltip focus .bind('tooltipfocus'+globalNamespace, function(event, api, zIndex) { - overlay.css('z-index', zIndex - 1); + overlay[0].style.zIndex = zIndex - 1; }) // Focus any other visible modals when this one blurs @@ -102,8 +102,11 @@ function Modal(api) return overlay; }, - toggle: function(state) + toggle: function(event, state, duration) { + // Make sure default event hasn't been prevented + if(event && event.isDefaultPrevented()) { return self; } + var effect = options.effect, type = state ? 'show': 'hide', modals = $('[' + attr + ']:visible').not(tooltip), @@ -112,14 +115,11 @@ function Modal(api) // Create our overlay if it isn't present already if(!overlay) { overlay = self.create(); } - // Prevent modal from conflicting with show.solo - if(overlay.is(':animated') && !state) { return self; } - - // Make sure not to hide the backdrop if other modals are visible - if(!state && modals.length) { return self; } + // Prevent modal from conflicting with show.solo, and don't hide backdrop is other modals are visible + if((overlay.is(':animated') && !state) || (!state && modals.length)) { return self; } // Toggle backdrop cursor style on show - else if(state) { + if(state) { elems.overlay.css('cursor', options.blur ? 'pointer' : ''); } @@ -138,7 +138,7 @@ function Modal(api) // Use basic fade function else { - overlay.fadeTo(90, state ? 0.7 : 0, function() { + overlay.fadeTo( parseInt(duration, 10) || 90, state ? 0.7 : 0, function() { if(!state) { $(this).hide(); } }); } @@ -146,8 +146,8 @@ function Modal(api) return self; }, - show: function() { return self.toggle(TRUE); }, - hide: function() { return self.toggle(FALSE); }, + show: function(event, duration) { return self.toggle(event, TRUE, duration); }, + hide: function(event, duration) { return self.toggle(event, FALSE, duration); }, destroy: function() { diff --git a/src/src/ajax.js b/src/src/ajax.js new file mode 100644 index 00000000..5bd05fb7 --- /dev/null +++ b/src/src/ajax.js @@ -0,0 +1,124 @@ +function Ajax(api) +{ + var self = this, + tooltip = api.elements.tooltip, + opts = api.options.content.ajax, + namespace = '.qtip-ajax', + rscript = /)<[^<]*)*<\/script>/gi, + first = TRUE; + + api.checks.ajax = { + '^content.ajax': function(obj, name, v) { + // If content.ajax object was reset, set our local var + if(name === 'ajax') { opts = v; } + + if(name === 'once') { + self.init(); + } + else if(opts && opts.url) { + self.load(); + } + else { + tooltip.unbind(namespace); + } + } + }; + + $.extend(self, { + init: function() + { + // Make sure ajax options are enabled and bind event + if(opts && opts.url) { + tooltip.unbind(namespace)[ opts.once ? 'one' : 'bind' ]('tooltipshow'+namespace, self.load); + } + + return self; + }, + + load: function(event, first) + { + // Make sure default event hasn't been prevented + if(event && event.isDefaultPrevented()) { return self; } + + var hasSelector = opts.url.indexOf(' '), + url = opts.url, + selector, + hideFirst = opts.once && !opts.loading && first; + + // If loading option is disabled, hide the tooltip until content is retrieved (first time only) + if(hideFirst) { tooltip.css('visibility', 'hidden'); } + + // Check if user delcared a content selector like in .load() + if(hasSelector > -1) { + selector = url.substr(hasSelector); + url = url.substr(0, hasSelector); + } + + // Define common after callback for both success/error handlers + function after() { + // Re-display tip if loading and first time, and reset first flag + if(hideFirst) { tooltip.css('visibility', ''); first = FALSE; } + } + + // Define success handler + function successHandler(content) { + if(selector) { + // Create a dummy div to hold the results and grab the selector element + content = $('
') + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append(content.replace(rscript, "")) + + // Locate the specified elements + .find(selector); + } + + // Set the content + api.set('content.text', content); + + after(); // Call common callback + } + + // Error handler + function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); after(); } + + // Setup $.ajax option object and process the request + $.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url }) ); + + return self; + } + }); + + self.init(); +} + + +PLUGINS.ajax = function(api) +{ + var self = api.plugins.ajax; + + return 'object' === typeof self ? self : (api.plugins.ajax = new Ajax(api)); +}; + +PLUGINS.ajax.initialize = 'render'; + +// Setup plugin sanitization +PLUGINS.ajax.sanitize = function(options) +{ + var content = options.content, opts; + if(content && 'ajax' in content) { + opts = content.ajax; + if(typeof opts !== 'object') { opts = options.content.ajax = { url: opts }; } + if('boolean' !== typeof opts.once && opts.once) { opts.once = !!opts.once; } + } +}; + +// Extend original api defaults +$.extend(TRUE, QTIP.defaults, { + content: { + ajax: { + loading: TRUE, + once: TRUE + } + } +}); \ No newline at end of file diff --git a/src/src/bgiframe.js b/src/src/bgiframe.js new file mode 100644 index 00000000..c662fd61 --- /dev/null +++ b/src/src/bgiframe.js @@ -0,0 +1,75 @@ +/* + * BGIFrame adaption (http://plugins.jquery.com/project/bgiframe) + * Special thanks to Brandon Aaron + */ +function BGIFrame(api) +{ + var self = this, + elems = api.elements, + tooltip = elems.tooltip, + namespace = '.bgiframe-' + api.id; + + $.extend(self, { + init: function() + { + // Create the BGIFrame element + elems.bgiframe = $(''); + + // Append the new element to the tooltip + elems.bgiframe.appendTo(tooltip); + + // Update BGIFrame on tooltip move + tooltip.bind('tooltipmove'+namespace, self.adjust); + }, + + adjust: function() + { + var dimensions = api.get('dimensions'), // Determine current tooltip dimensions + plugin = api.plugins.tip, + tip = elems.tip, + tipAdjust, offset; + + // Adjust border offset + offset = parseInt(tooltip.css('border-left-width'), 10) || 0; + offset = { left: -offset, top: -offset }; + + // Adjust for tips plugin + if(plugin && tip) { + tipAdjust = (plugin.corner.precedance === 'x') ? ['width', 'left'] : ['height', 'top']; + offset[ tipAdjust[1] ] -= tip[ tipAdjust[0] ](); + } + + // Update bgiframe + elems.bgiframe.css(offset).css(dimensions); + }, + + destroy: function() + { + // Remove iframe + elems.bgiframe.remove(); + + // Remove bound events + tooltip.unbind(namespace); + } + }); + + self.init(); +} + +PLUGINS.bgiframe = function(api) +{ + var browser = $.browser, + self = api.plugins.bgiframe; + + // Proceed only if the browser is IE6 and offending elements are present + if($('select, object').length < 1 || !(browser.msie && browser.version.charAt(0) === '6')) { + return FALSE; + } + + return 'object' === typeof self ? self : (api.plugins.bgiframe = new BGIFrame(api)); +}; + +// Plugin needs to be initialized on render +PLUGINS.bgiframe.initialize = 'render'; diff --git a/src/src/core.css b/src/src/core.css new file mode 100644 index 00000000..bfa46c54 --- /dev/null +++ b/src/src/core.css @@ -0,0 +1,247 @@ +/* Fluid class for determining actual width in IE */ +.ui-tooltip-fluid{ + display: block; + visibility: hidden; + position: static !important; + float: left !important; +} + +.ui-tooltip, .qtip{ + position: absolute; + left: -28000px; + top: -28000px; + display: none; + + max-width: 280px; + min-width: 50px; + + font-size: 10.5px; + line-height: 12px; +} + + .ui-tooltip-content{ + position: relative; + padding: 5px 9px; + overflow: hidden; + + border-width: 1px; + border-style: solid; + + text-align: left; + word-wrap: break-word; + overflow: hidden; + } + + .ui-tooltip-titlebar{ + position: relative; + min-height: 14px; + padding: 5px 35px 5px 10px; + overflow: hidden; + + border-width: 1px 1px 0; + border-style: solid; + + font-weight: bold; + } + + .ui-tooltip-titlebar + .ui-tooltip-content{ border-top-width: 0px !important; } + + /*! Default close button class */ + .ui-tooltip-titlebar .ui-state-default{ + position: absolute; + right: 4px; + top: 50%; + margin-top: -9px; + + cursor: pointer; + outline: medium none; + + border-width: 1px; + border-style: solid; + } + + * html .ui-tooltip-titlebar .ui-state-default{ + top: 16px; + } + + .ui-tooltip-titlebar .ui-icon, + .ui-tooltip-icon .ui-icon{ + display: block; + text-indent: -1000em; + } + + .ui-tooltip-icon, .ui-tooltip-icon .ui-icon{ + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + } + + .ui-tooltip-icon .ui-icon{ + width: 18px; + height: 14px; + + text-align: center; + text-indent: 0; + font: normal bold 10px/13px Tahoma,sans-serif; + + color: inherit; + background: transparent none no-repeat -100em -100em; + } + + +/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */ +.ui-tooltip-focus{ + +} + + +/*! Default tooltip style */ +.ui-tooltip-titlebar, +.ui-tooltip-content{ + border-color: #F1D031; + background-color: #FFFFA3; + color: #555; +} + + .ui-tooltip-titlebar{ + background-color: #FFEF93; + } + + .ui-tooltip-titlebar .ui-tooltip-icon{ + border-color: #CCC; + background: #F1F1F1; + color: #777; + } + + .ui-tooltip-titlebar .ui-state-hover{ + border-color: #AAA; + color: #111; + } + + +/*! Light tooltip style */ +.ui-tooltip-light .ui-tooltip-titlebar, +.ui-tooltip-light .ui-tooltip-content{ + border-color: #E2E2E2; + color: #454545; +} + + .ui-tooltip-light .ui-tooltip-content{ + background-color: white; + } + + .ui-tooltip-light .ui-tooltip-titlebar{ + background-color: #f1f1f1; + } + + +/*! Dark tooltip style */ +.ui-tooltip-dark .ui-tooltip-titlebar, +.ui-tooltip-dark .ui-tooltip-content{ + border-color: #303030; + color: #f3f3f3; +} + + .ui-tooltip-dark .ui-tooltip-content{ + background-color: #505050; + } + + .ui-tooltip-dark .ui-tooltip-titlebar{ + background-color: #404040; + } + + .ui-tooltip-dark .ui-tooltip-icon{ + border-color: #444; + } + + .ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{ + border-color: #303030; + } + + +/*! Cream tooltip style */ +.ui-tooltip-cream .ui-tooltip-titlebar, +.ui-tooltip-cream .ui-tooltip-content{ + border-color: #F9E98E; + color: #A27D35; +} + + .ui-tooltip-cream .ui-tooltip-content{ + background-color: #FBF7AA; + } + + .ui-tooltip-cream .ui-tooltip-titlebar{ + background-color: #F0DE7D; + } + + .ui-tooltip-cream .ui-state-default .ui-tooltip-icon{ + background-position: -82px 0; + } + + +/*! Red tooltip style */ +.ui-tooltip-red .ui-tooltip-titlebar, +.ui-tooltip-red .ui-tooltip-content{ + border-color: #D95252; + color: #912323; +} + + .ui-tooltip-red .ui-tooltip-content{ + background-color: #F78B83; + } + + .ui-tooltip-red .ui-tooltip-titlebar{ + background-color: #F06D65; + } + + .ui-tooltip-red .ui-state-default .ui-tooltip-icon{ + background-position: -102px 0; + } + + .ui-tooltip-red .ui-tooltip-icon{ + border-color: #D95252; + } + + .ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{ + border-color: #D95252; + } + + +/*! Green tooltip style */ +.ui-tooltip-green .ui-tooltip-titlebar, +.ui-tooltip-green .ui-tooltip-content{ + border-color: #90D93F; + color: #3F6219; +} + + .ui-tooltip-green .ui-tooltip-content{ + background-color: #CAED9E; + } + + .ui-tooltip-green .ui-tooltip-titlebar{ + background-color: #B0DE78; + } + + .ui-tooltip-green .ui-state-default .ui-tooltip-icon{ + background-position: -42px 0; + } + + +/*! Blue tooltip style */ +.ui-tooltip-blue .ui-tooltip-titlebar, +.ui-tooltip-blue .ui-tooltip-content{ + border-color: #ADD9ED; + color: #5E99BD; +} + + .ui-tooltip-blue .ui-tooltip-content{ + background-color: #E5F6FE; + } + + .ui-tooltip-blue .ui-tooltip-titlebar{ + background-color: #D0E9F5; + } + + .ui-tooltip-blue .ui-state-default .ui-tooltip-icon{ + background-position: -2px 0; + } \ No newline at end of file diff --git a/src/src/core.js b/src/src/core.js new file mode 100644 index 00000000..3c183662 --- /dev/null +++ b/src/src/core.js @@ -0,0 +1,1740 @@ +// Option object sanitizer +function sanitizeOptions(opts) +{ + var content; + + if(!opts || 'object' !== typeof opts) { return FALSE; } + + if('object' !== typeof opts.metadata) { + opts.metadata = { + type: opts.metadata + }; + } + + if('content' in opts) { + if('object' !== typeof opts.content || opts.content.jquery) { + opts.content = { + text: opts.content + }; + } + + content = opts.content.text || FALSE; + if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) { + opts.content.text = FALSE; + } + + if('title' in opts.content) { + if('object' !== typeof opts.content.title) { + opts.content.title = { + text: opts.content.title + }; + } + + content = opts.content.title.text || FALSE; + if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) { + opts.content.title.text = FALSE; + } + } + } + + if('position' in opts) { + if('object' !== typeof opts.position) { + opts.position = { + my: opts.position, + at: opts.position + }; + } + } + + if('show' in opts) { + if('object' !== typeof opts.show) { + if(opts.show.jquery) { + opts.show = { target: opts.show }; + } + else { + opts.show = { event: opts.show }; + } + } + } + + if('hide' in opts) { + if('object' !== typeof opts.hide) { + if(opts.hide.jquery) { + opts.hide = { target: opts.hide }; + } + else { + opts.hide = { event: opts.hide }; + } + } + } + + if('style' in opts) { + if('object' !== typeof opts.style) { + opts.style = { + classes: opts.style + }; + } + } + + // Sanitize plugin options + $.each(PLUGINS, function() { + if(this.sanitize) { this.sanitize(opts); } + }); + + return opts; +} + +/* +* Core plugin implementation +*/ +function QTip(target, options, id, attr) +{ + // Declare this reference + var self = this, + docBody = document.body, + tooltipID = uitooltip + '-' + id, + isPositioning = 0, + isDrawing = 0, + tooltip = $(), + elements, cache; + + // Setup class attributes + self.id = id; + self.rendered = FALSE; + self.elements = elements = { target: target }; + self.timers = { img: [] }; + self.options = options; + self.checks = {}; + self.plugins = {}; + self.cache = cache = { + event: {}, + target: NULL, + disabled: FALSE, + attr: attr + }; + + /* + * Private core functions + */ + function convertNotation(notation) + { + var i = 0, obj, option = options, + + // Split notation into array + levels = notation.split('.'); + + // Loop through + while( option = option[ levels[i++] ] ) { + if(i < levels.length) { obj = option; } + } + + return [obj || options, levels.pop()]; + } + + function setWidget() { + var on = options.style.widget; + + tooltip.toggleClass(widget, on); + elements.content.toggleClass(widget+'-content', on); + + if(elements.titlebar){ + elements.titlebar.toggleClass(widget+'-header', on); + } + if(elements.button){ + elements.button.toggleClass(uitooltip+'-icon', !on); + } + } + + function removeTitle() + { + if(elements.title) { + elements.titlebar.remove(); + elements.titlebar = elements.title = elements.button = NULL; + self.reposition(); + } + } + + function createButton() + { + var button = options.content.title.button, + isString = typeof button === 'string', + close = isString ? button : 'Close tooltip'; + + if(elements.button) { elements.button.remove(); } + + // Use custom button if one was supplied by user, else use default + if(button.jquery) { + elements.button = button; + } + else { + elements.button = $('', { + 'class': 'ui-state-default ' + (options.style.widget ? '' : uitooltip+'-icon'), + 'title': close, + 'aria-label': close + }) + .prepend( + $('', { + 'class': 'ui-icon ui-icon-close', + 'html': '×' + }) + ); + } + + // Create button and setup attributes + elements.button.appendTo(elements.titlebar) + .attr('role', 'button') + .hover(function(event){ $(this).toggleClass('ui-state-hover', event.type === 'mouseenter'); }) + .click(function(event) { + if(!tooltip.hasClass(disabled)) { self.hide(event); } + return FALSE; + }) + .bind('mousedown keydown mouseup keyup mouseout', function(event) { + $(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down'); + }); + + // Redraw the tooltip when we're done + self.redraw(); + } + + function createTitle() + { + var id = tooltipID+'-title'; + + // Destroy previous title element, if present + if(elements.titlebar) { removeTitle(); } + + // Create title bar and title elements + elements.titlebar = $('
', { + 'class': uitooltip + '-titlebar ' + (options.style.widget ? 'ui-widget-header' : '') + }) + .append( + elements.title = $('
', { + 'id': id, + 'class': uitooltip + '-title', + 'aria-atomic': TRUE + }) + ) + .insertBefore(elements.content); + + // Create button if enabled + if(options.content.title.button) { createButton(); } + + // Redraw the tooltip dimensions if it's rendered + else if(self.rendered){ self.redraw(); } + } + + function updateButton(button) + { + var elem = elements.button, + title = elements.title; + + // Make sure tooltip is rendered and if not, return + if(!self.rendered) { return FALSE; } + + if(!button) { + elem.remove(); + } + else { + if(!title) { + createTitle(); + } + createButton(); + } + } + + function updateTitle(content) + { + var elem = elements.title; + + // Make sure tooltip is rendered and if not, return + if(!self.rendered || !content) { return FALSE; } + + // Use function to parse content + if($.isFunction(content)) { + content = content.call(target, self) || ''; + } + + // Append new content if its a DOM array and show it if hidden + if(content.jquery && content.length > 0) { + elem.empty().append(content.css({ display: 'block' })); + } + + // Content is a regular string, insert the new content + else { elem.html(content); } + + // Redraw and reposition + self.redraw(); + if(self.rendered && tooltip.is(':visible')) { + self.reposition(cache.event); + } + } + + function updateContent(content, reposition) + { + var elem = elements.content; + content = content || options.content.text; + + // Make sure tooltip is rendered and content is defined. If not return + if(!self.rendered || !content) { return FALSE; } + + // Use function to parse content + if($.isFunction(content)) { + content = content.call(target, self) || ''; + } + + // Append new content if its a DOM array and show it if hidden + if(content.jquery && content.length > 0) { + elem.empty().append(content.css({ display: 'block' })); + } + + // Content is a regular string, insert the new content + else { elem.html(content); } + + // Image detection + function detectImages(next) { + var images; + + function imageLoad(event) { + // If queue is empty after image removal, update tooltip and continue the queue + if((images = images.not(this)).length === 0) { + self.redraw(); + self.reposition(cache.event); + + next(); + } + } + + // Find all content images without dimensions, and if no images were found, continue + if((images = elem.find('img:not([height]):not([width])')).length === 0) { return imageLoad.call(images); } + + // Apply timer to each iamge to poll for dimensions + images.each(function(i, elem) { + (function timer(){ + var timers = self.timers.img; + + // When the dimensions are found, remove the image from the queue and stop timer + if(elem.height && elem.width) { + clearTimeout(timers[i]); + return imageLoad.call(elem); + } + timers[i] = setTimeout(timer, 20); + }()); + }); + } + + /* + * If we're still rendering... insert into 'fx' queue our image dimension + * checker which will halt the showing of the tooltip until image dimensions + * can be detected properly. + */ + if(self.rendered < 0) { tooltip.queue('fx', detectImages); } + + // We're fully rendered, so reset isDrawing flag and proceed without queue delay + else { isDrawing = 0; detectImages($.noop); } + + return self; + } + + function assignEvents(show, hide, tip, doc) + { + var namespace = '.qtip-'+id, + posOptions = options.position, + targets = { + show: options.show.target, + hide: options.hide.target, + container: posOptions.container[0] === docBody ? $(document) : posOptions.container, + doc: $(document) + }, + events = { + show: $.trim('' + options.show.event).split(' '), + hide: $.trim('' + options.hide.event).split(' ') + }, + IE6 = $.browser.msie && parseInt($.browser.version, 10) === 6, + additional; + + // Define show event method + function showMethod(event) + { + if(tooltip.hasClass(disabled)) { return FALSE; } + + // If set, hide tooltip when inactive for delay period + targets.show.trigger('qtip-'+id+'-inactive'); + + // Clear hide timers + clearTimeout(self.timers.show); + clearTimeout(self.timers.hide); + + // Start show timer + var callback = function(){ self.show(event); }; + if(options.show.delay > 0) { + self.timers.show = setTimeout(callback, options.show.delay); + } + else{ callback(); } + } + + // Define hide method + function hideMethod(event) + { + if(tooltip.hasClass(disabled)) { return FALSE; } + + // Check if new target was actually the tooltip element + var relatedTarget = $(event.relatedTarget || event.target), + ontoTooltip = relatedTarget.closest(selector)[0] === tooltip[0], + ontoTarget = relatedTarget[0] === targets.show[0]; + + // Clear timers and stop animation queue + clearTimeout(self.timers.show); + clearTimeout(self.timers.hide); + + // Prevent hiding if tooltip is fixed and event target is the tooltip. Or if mouse positioning is enabled and cursor momentarily overlaps + if((posOptions.target === 'mouse' && ontoTooltip) || (options.hide.fixed && ((/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget)))) + { + // Prevent default and popagation + event.stopPropagation(); + event.preventDefault(); + return FALSE; + } + + // If tooltip has displayed, start hide timer + if(options.hide.delay > 0) { + self.timers.hide = setTimeout(function(){ self.hide(event); }, options.hide.delay); + } + else{ self.hide(event); } + } + + // Define inactive method + function inactiveMethod(event) + { + if(tooltip.hasClass(disabled)) { return FALSE; } + + // Clear timer + clearTimeout(self.timers.inactive); + self.timers.inactive = setTimeout(function(){ self.hide(event); }, options.hide.inactive); + } + + function repositionMethod(event) { + if(tooltip.is(':visible')) { self.reposition(event); } + } + + // Assign tooltip events + if(tip) { + // Enable hide.fixed + if(options.hide.fixed) { + // Add tooltip as a hide target + targets.hide = targets.hide.add(tooltip); + + // Clear hide timer on tooltip hover to prevent it from closing + tooltip.bind('mouseover'+namespace, function() { + if(!tooltip.hasClass(disabled)) { + clearTimeout(self.timers.hide); + } + }); + } + + // If mouse positioning is on, apply a mouseleave event so we don't get problems with overlapping + if(posOptions.target === 'mouse' && posOptions.adjust.mouse && options.hide.event) { + tooltip.bind('mouseleave'+namespace, function(event) { + if((event.relatedTarget || event.target) !== targets.show[0]) { self.hide(event); } + }); + } + + // Focus/blur the tooltip + tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) { + self[ event.type === 'mouseenter' ? 'focus' : 'blur' ](event); + }); + } + + // Assign hide events + if(hide) { + // Check if the tooltip hides when inactive + if('number' === typeof options.hide.inactive) { + // Bind inactive method to target as a custom event + targets.show.bind('qtip-'+id+'-inactive', inactiveMethod); + + // Define events which reset the 'inactive' event handler + $.each(QTIP.inactiveEvents, function(index, type){ + targets.hide.add(elements.tooltip).bind(type+namespace+'-inactive', inactiveMethod); + }); + } + + // Apply hide events + $.each(events.hide, function(index, type) { + var showIndex = $.inArray(type, events.show), + targetHide = $(targets.hide); + + // Both events and targets are identical, apply events using a toggle + if((showIndex > -1 && targetHide.add(targets.show).length === targetHide.length) || type === 'unfocus') + { + targets.show.bind(type+namespace, function(event) + { + if(tooltip.is(':visible')) { hideMethod(event); } + else{ showMethod(event); } + }); + + // Don't bind the event again + delete events.show[ showIndex ]; + } + + // Events are not identical, bind normally + else{ targets.hide.bind(type+namespace, hideMethod); } + }); + } + + // Apply show events + if(show) { + $.each(events.show, function(index, type) { + targets.show.bind(type+namespace, showMethod); + }); + + // Check if the tooltip hides when mouse is moved a certain distance + if('number' === typeof options.hide.distance) { + // Bind mousemove to target to detect distance difference + targets.show.bind('mousemove'+namespace, function(event) { + var coords = cache.coords || [], + limit = options.hide.distance; + + // Check if the movement has gone beyond the limit, and hide it if so + if(coords && (Math.abs(event.pageX - coords[0]) >= limit || Math.abs(event.pageY - coords[1]) >= limit)){ + self.hide(event); + } + }); + } + } + + // Apply document events + if(doc) { + // Adjust positions of the tooltip on window resize if enabled + if(posOptions.adjust.resize || posOptions.viewport) { + $($.event.special.resize ? posOptions.viewport : window).bind('resize'+namespace, repositionMethod); + } + + // Adjust tooltip position on scroll if screen adjustment is enabled + if(posOptions.viewport || (IE6 && tooltip.css('position') === 'fixed')) { + $(posOptions.viewport).bind('scroll'+namespace, repositionMethod); + } + + // Hide tooltip on document mousedown if unfocus events are enabled + if((/unfocus/i).test(options.hide.event)) { + targets.doc.bind('mousedown'+namespace, function(event) { + var $target = $(event.target); + + if($target.parents(selector).length === 0 && $target.add(target).length > 1 && tooltip.is(':visible') && !tooltip.hasClass(disabled)) { + self.hide(event); + } + }); + } + + // Hide mouseleave/mouseout tooltips on window/frame blur/mouseleave + if(options.hide.leave && (/mouseleave|mouseout/i).test(options.hide.event)) { + $(window).bind( + 'blur'+namespace+' mouse' + (options.hide.leave.indexOf('frame') > -1 ? 'out' : 'leave') + namespace, + function(event) { if(!event.relatedTarget) { self.hide(event); } } + ); + } + + // If mouse is the target, update tooltip position on document mousemove + if(posOptions.target === 'mouse') { + targets.doc.bind('mousemove'+namespace, function(event) { + // Update the tooltip position only if the tooltip is visible and adjustment is enabled + if(posOptions.adjust.mouse && !tooltip.hasClass(disabled) && tooltip.is(':visible')) { + self.reposition(event || MOUSE); + } + }); + } + } + } + + function unassignEvents(show, hide, tooltip, doc) + { + doc = parseInt(doc, 10) !== 0; + var namespace = '.qtip-'+id, + targets = { + show: show && options.show.target[0], + hide: hide && options.hide.target[0], + tooltip: tooltip && self.rendered && elements.tooltip[0], + content: tooltip && self.rendered && elements.content[0], + container: doc && options.position.container[0] === docBody ? document : options.position.container[0], + window: doc && window + }; + + // Check if tooltip is rendered + if(self.rendered) + { + $([]).pushStack( + $.grep( + [ targets.show, targets.hide, targets.tooltip, targets.container, targets.content, targets.window ], + function(i){ return typeof i === 'object'; } + ) + ) + .unbind(namespace); + } + + // Tooltip isn't yet rendered, remove render event + else if(show) { options.show.target.unbind(namespace+'-create'); } + } + + // Setup builtin .set() option checks + self.checks.builtin = { + // Core checks + '^id$': function(obj, o, v) { + var id = v === TRUE ? QTIP.nextid : v, + tooltipID = uitooltip + '-' + id; + + if(id !== FALSE && id.length > 0 && !$('#'+tooltipID).length) { + tooltip[0].id = tooltipID; + elements.content[0].id = tooltipID + '-content'; + elements.title[0].id = tooltipID + '-title'; + } + }, + + // Content checks + '^content.text$': function(obj, o, v){ updateContent(v); }, + '^content.title.text$': function(obj, o, v) { + // Remove title if content is null + if(!v) { return removeTitle(); } + + // If title isn't already created, create it now and update + if(!elements.title && v) { createTitle(); } + updateTitle(v); + }, + '^content.title.button$': function(obj, o, v){ updateButton(v); }, + + // Position checks + '^position.(my|at)$': function(obj, o, v){ + // Parse new corner value into Corner objecct + if('string' === typeof v) { + obj[o] = new PLUGINS.Corner(v); + } + }, + + '^position.container$': function(obj, o, v){ + if(self.rendered) { tooltip.appendTo(v); } + }, + + // Show & hide checks + '^(show|hide).(event|target|fixed|delay|inactive)$': function(obj, o, v, p, match) { + // Setup arguments + var args = [1,0,0]; + args[match[1] === 'show' ? 'push' : 'unshift'](0); + + unassignEvents.apply(self, args); + assignEvents.apply(self, [1,1,0,0]); + }, + '^show.ready$': function() { + if(!self.rendered) { self.render(1); } + else { self.show(); } + }, + + // Style checks + '^style.classes$': function(obj, o, v) { + $.attr(tooltip[0], 'class', uitooltip + ' qtip ui-helper-reset ' + v); + }, + '^style.widget|content.title': setWidget, + + // Events check + '^events.(render|show|move|hide|focus|blur)$': function(obj, o, v) { + tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip'+o, v); + } + }; + + /* + * Public API methods + */ + $.extend(self, { + render: function(show) + { + if(self.rendered) { return self; } // If tooltip has already been rendered, exit + + var title = options.content.title.text, + callback = $.Event('tooltiprender'); + + // Add ARIA attributes to target + $.attr(target[0], 'aria-describedby', tooltipID); + + // Create tooltip element + tooltip = elements.tooltip = $('
', { + 'id': tooltipID, + 'class': uitooltip + ' qtip ui-helper-reset ' + options.style.classes, + 'width': options.style.width || '', + + /* ARIA specific attributes */ + 'role': 'alert', + 'aria-live': 'polite', + 'aria-atomic': FALSE, + 'aria-describedby': tooltipID + '-content', + 'aria-hidden': TRUE + }) + .toggleClass(disabled, cache.disabled) + .data('qtip', self) + .appendTo(options.position.container) + .append( + // Create content element + elements.content = $('
', { + 'class': uitooltip + '-content', + 'id': tooltipID + '-content', + 'aria-atomic': TRUE + }) + ); + + // Set rendered flag and prevent redundant redraw calls for npw + self.rendered = -1; + isDrawing = 1; + + // Update title + if(title) { + createTitle(); + updateTitle(title); + } + + // Set proper rendered flag and update content + updateContent(); + self.rendered = TRUE; + + // Setup widget classes + setWidget(); + + // Assign passed event callbacks (before plugins!) + $.each(options.events, function(name, callback) { + if($.isFunction(callback)) { + tooltip.bind(name === 'toggle' ? 'tooltipshow tooltiphide' : 'tooltip'+name, callback); + } + }); + + // Initialize 'render' plugins + $.each(PLUGINS, function() { + if(this.initialize === 'render') { this(self); } + }); + + // Assign events + assignEvents(1, 1, 1, 1); + + /* Queue this part of the render process in our fx queue so we can + * load images before the tooltip renders fully. + * + * See: updateContent method + */ + tooltip.queue('fx', function(next) { + // Trigger tooltiprender event and pass original triggering event as original + callback.originalEvent = cache.event; + tooltip.trigger(callback, [self]); + + // Redraw the tooltip manually now we're fully rendered + isDrawing = 0; self.redraw(); + + // Update tooltip position and show tooltip if needed + if(options.show.ready || show) { + self.show(cache.event); + } + + next(); // Move on to next method in queue + }); + + return self; + }, + + get: function(notation) + { + var result, o; + + switch(notation.toLowerCase()) + { + case 'dimensions': + result = { + height: tooltip.outerHeight(), width: tooltip.outerWidth() + }; + break; + + case 'offset': + result = PLUGINS.offset(tooltip, options.position.container); + break; + + default: + o = convertNotation(notation.toLowerCase()); + result = o[0][ o[1] ]; + result = result.precedance ? result.string() : result; + break; + } + + return result; + }, + + set: function(option, value) + { + var rmove = /^position\.(my|at|adjust|target|container)|style|content|show\.ready/i, + rdraw = /^content\.(title|attr)|style/i, + reposition = FALSE, + redraw = FALSE, + checks = self.checks, + name; + + function callback(notation, args) { + var category, rule, match; + + for(category in checks) { + for(rule in checks[category]) { + if(match = (new RegExp(rule, 'i')).exec(notation)) { + args.push(match); + checks[category][rule].apply(self, args); + } + } + } + } + + // Convert singular option/value pair into object form + if('string' === typeof option) { + name = option; option = {}; option[name] = value; + } + else { option = $.extend(TRUE, {}, option); } + + // Set all of the defined options to their new values + $.each(option, function(notation, value) { + var obj = convertNotation( notation.toLowerCase() ), previous; + + // Set new obj value + previous = obj[0][ obj[1] ]; + obj[0][ obj[1] ] = 'object' === typeof value && value.nodeType ? $(value) : value; + + // Set the new params for the callback + option[notation] = [obj[0], obj[1], value, previous]; + + // Also check if we need to reposition / redraw + reposition = rmove.test(notation) || reposition; + redraw = rdraw.test(notation) || redraw; + }); + + // Re-sanitize options + sanitizeOptions(options); + + /* + * Execute any valid callbacks for the set options + * Also set isPositioning/isDrawing so we don't get loads of redundant repositioning + * and redraw calls. + */ + isPositioning = isDrawing = 1; $.each(option, callback); isPositioning = isDrawing = 0; + + // Update position / redraw if needed + if(tooltip.is(':visible') && self.rendered) { + if(reposition) { + self.reposition( options.position.target === 'mouse' ? NULL : cache.event ); + } + if(redraw) { self.redraw(); } + } + + return self; + }, + + toggle: function(state, event) + { + // Make sure tooltip is rendered + if(!self.rendered) { + if(state) { self.render(1); } // Render the tooltip if showing and it isn't already + else { return self; } + } + + var type = state ? 'show' : 'hide', + opts = options[type], + visible = tooltip.is(':visible'), + delay, + callback; + + // Detect state if valid one isn't provided + if((typeof state).search('boolean|number')) { state = !visible; } + + // Return if element is already in correct state + if(visible === state) { return self; } + + // Try to prevent flickering when tooltip overlaps show element + if(event) { + if((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) && + event.target === options.show.target[0] && tooltip.has(event.relatedTarget).length) { + return self; + } + + // Cache event + cache.event = $.extend({}, event); + } + + // Call API methods + callback = $.Event('tooltip'+type); + callback.originalEvent = event ? cache.event : NULL; + tooltip.trigger(callback, [self, 90]); + if(callback.isDefaultPrevented()){ return self; } + + // Set ARIA hidden status attribute + $.attr(tooltip[0], 'aria-hidden', !!!state); + + // Execute state specific properties + if(state) { + // Focus the tooltip + self.focus(event); + + // Update tooltip content if it's a dynamic function + if($.isFunction(options.content.text)) { updateContent(); } + + // Update the tooltip position + self.reposition(event); + + // Hide other tooltips if tooltip is solo, using it as the context + if(opts.solo) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); } + + // Store coordinates if hide.distance is set + if('number' === typeof options.hide.distance) { + cache.coords = [ event.pageX, event.pageY ]; + } + } + else { + // Clear show timer if we're hiding + clearTimeout(self.timers.show); + + // Delete cached coords + delete cache.coords; + + // Blur the tooltip + self.blur(event); + } + + // Define post-animation state specific properties + function after() { + if(!state) { + // Reset CSS states + tooltip.css({ + display: '', + visibility: '', + width: '', + opacity: '', + left: '', + top: '' + }); + } + else { + // Prevent antialias from disappearing in IE by removing filter + if($.browser.msie) { tooltip[0].style.removeAttribute('filter'); } + + // Remove overflow setting to prevent tip bugs + tooltip.css('overflow', ''); + } + } + + // Clear animation queue + tooltip.stop(0, 1); + + // Use custom function if provided + if($.isFunction(opts.effect)) { + opts.effect.call(tooltip, self); + tooltip.queue('fx', function(n){ after(); n(); }); + } + + // If no effect type is supplied, use a simple toggle + else if(opts.effect === FALSE) { + tooltip[ type ](); + after.call(tooltip); + } + + // Use basic fade function by default + else { tooltip.fadeTo(90, state ? 1 : 0, after); } + + // If inactive hide method is set, active it + if(state) { opts.target.trigger('qtip-'+id+'-inactive'); } + + return self; + }, + + show: function(event){ return self.toggle(TRUE, event); }, + + hide: function(event){ return self.toggle(FALSE, event); }, + + focus: function(event) + { + if(!self.rendered) { return self; } + + var qtips = $(selector), + curIndex = parseInt(tooltip[0].style.zIndex, 10), + newIndex = QTIP.zindex + qtips.length, + cachedEvent = $.extend({}, event), + focusedElem, callback; + + // Only update the z-index if it has changed and tooltip is not already focused + if(!tooltip.hasClass(focusClass)) + { + // Only update z-index's if they've changed' + if(curIndex !== newIndex) { + // Reduce our z-index's and keep them properly ordered + qtips.each(function() { + if(this.style.zIndex > curIndex) { + this.style.zIndex = this.style.zIndex - 1; + } + }); + + // Fire blur event for focused tooltip + qtips.filter('.' + focusClass).qtip('blur', cachedEvent); + } + + // Call API method + callback = $.Event('tooltipfocus'); + callback.originalEvent = cachedEvent; + tooltip.trigger(callback, [self, newIndex]); + + // If callback wasn't FALSE + if(!callback.isDefaultPrevented()) { + // Set the new z-index + tooltip.addClass(focusClass)[0].style.zIndex = newIndex; + } + } + + return self; + }, + + blur: function(event) { + var cachedEvent = $.extend({}, event), + callback; + + // Set focused status to FALSE + tooltip.removeClass(focusClass); + + // Trigger blur event + callback = $.Event('tooltipblur'); + callback.originalEvent = cachedEvent; + tooltip.trigger(callback, [self]); + + return self; + }, + + reposition: function(event, effect) + { + if(!self.rendered || isPositioning) { return self; } + + // Set positioning flag + isPositioning = 1; + + var target = options.position.target, + posOptions = options.position, + my = posOptions.my, + at = posOptions.at, + adjust = posOptions.adjust, + method = adjust.method.split(' '), + elemWidth = tooltip.outerWidth(), + elemHeight = tooltip.outerHeight(), + targetWidth = 0, + targetHeight = 0, + callback = $.Event('tooltipmove'), + fixed = tooltip.css('position') === 'fixed', + viewport = posOptions.viewport.jquery ? posOptions.viewport : $(window), + position = { left: 0, top: 0 }, + tip = (self.plugins.tip || {}).corner, + readjust = { + // Repositioning method and axis detection + horizontal: method[0], + vertical: method[1] || method[0], + tip: options.style.tip, + + // Reposition methods + left: function(posLeft) { + var viewportScroll = viewport.offset.left + viewport.scrollLeft, + myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2, + atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2, + tipAdjust = tip && tip.precedance === 'y' ? readjust.tip.width + readjust.tip.border * 2 : 0, + overflowLeft = viewportScroll - posLeft - tipAdjust, + overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust, + offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0), + isCenter = my.x === 'center'; + + // Optional 'shift' style repositioning + if(readjust.horizontal === 'shift') { + position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0; + + // Make sure we stay within the viewport boundaries + position.left = Math.min( + Math.max(viewportScroll, position.left), + Math.max(overflowLeft > 0 ? -1E9 : 0, viewportScroll + viewport.width - elemWidth) + ); + } + + // Default 'flip' repositioning + else { + if(overflowLeft > 0 && (my.x !== 'left' || overflowRight > 0)) { + position.left -= offset + (isCenter ? 0 : 2 * adjust.x); + } + else if(overflowRight > 0 && (my.x !== 'right' || overflowLeft > 0) ) { + position.left -= isCenter ? -offset : offset + (2 * adjust.x); + } + if(position.left !== posLeft && isCenter) { position.left -= adjust.x; } + + // Make sure we haven't made things worse with the adjustment and return the adjusted difference + if(position.left < viewportScroll && -position.left > overflowRight) { position.left = posLeft; } + } + + return position.left - posLeft; + }, + top: function(posTop) { + var viewportScroll = viewport.offset.top + viewport.scrollTop, + myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2, + atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2, + tipAdjust = tip && tip.precedance === 'x' ? readjust.tip.height + readjust.tip.border * 2 : 0, + overflowTop = viewportScroll - posTop - tipAdjust, + overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust, + offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0), + isCenter = my.y === 'center'; + + // Optional 'shift' style repositioning + if(readjust.vertical === 'shift') { + position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0; + + // Make sure we stay within the viewport boundaries + position.top = Math.min( + Math.max(viewportScroll, position.top), + Math.max(overflowTop > 0 ? -1E9 : 0, viewportScroll + viewport.height - elemHeight) + ); + } + + // Default 'flip' repositioning + else { + if(overflowTop > 0 && (my.y !== 'top' || overflowBottom > 0)) { + position.top -= offset + (isCenter ? 0 : 2 * adjust.y); + } + else if(overflowBottom > 0 && (my.y !== 'bottom' || overflowTop > 0) ) { + position.top -= isCenter ? -offset : offset + (2 * adjust.y); + } + if(position.top !== posTop && isCenter) { position.top -= adjust.y; } + + // Make sure we haven't made things worse with the adjustment and return the adjusted difference + if(position.top < 0 && -position.top > overflowBottom) { position.top = posTop; } + } + + return position.top - posTop; + } + }; + + + + // Cache our viewport details + viewport = !viewport ? FALSE : { + elem: viewport, + height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](), + width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](), + scrollLeft: viewport.scrollLeft(), + scrollTop: viewport.scrollTop(), + offset: viewport.offset() || { left:0, top: 0 } + }; + + // Check if mouse was the target + if(target === 'mouse') { + // Force left top to allow flipping + at = { x: 'left', y: 'top' }; + + // Use cached event if one isn't available for positioning + event = event && (event.type === 'resize' || event.type === 'scroll') ? cache.event : + adjust.mouse || !event || !event.pageX || (/over|enter$/i.test(event.type) && !adjust.mouse) ? + $.extend({}, MOUSE) : event; + + // Use event coordinates for position + position = { top: event.pageY, left: event.pageX }; + } + else { + // Check if event targetting is being used + if(target === 'event') { + if(event && event.target && event.type !== 'scroll' && event.type !== 'resize') { + target = cache.target = $(event.target); + } + else { + target = cache.target; + } + } + + // Parse the target into a jQuery object and make sure there's an element present + target = $(target).eq(0); + if(target.length === 0) { return self; } + + // Check if window or document is the target + else if(target[0] === document || target[0] === window) { + targetWidth = target.width(); + targetHeight = target.height(); + + if(target[0] === window) { + position = { + top: !fixed || PLUGINS.iOS ? viewport.scrollTop : 0, + left: !fixed || PLUGINS.iOS ? viewport.scrollLeft : 0 + }; + } + } + + // Use Imagemap/SVG plugins if needed + else if(target.is('area') && PLUGINS.imagemap) { + position = PLUGINS.imagemap(target, at); + } + else if(target[0].namespaceURI == 'http://www.w3.org/2000/svg' && PLUGINS.svg) { + position = PLUGINS.svg(target, at); + } + + else { + targetWidth = target.outerWidth(); + targetHeight = target.outerHeight(); + + position = PLUGINS.offset(target, posOptions.container); + } + + // Parse returned plugin values into proper variables + if(position.offset) { + targetWidth = position.width; + targetHeight = position.height; + position = position.offset; + } + + // Adjust position relative to target + position.left += at.x === 'right' ? targetWidth : at.x === 'center' ? targetWidth / 2 : 0; + position.top += at.y === 'bottom' ? targetHeight : at.y === 'center' ? targetHeight / 2 : 0; + } + + // Adjust position relative to tooltip + position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0); + position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0); + + // Calculate collision offset values + if(posOptions.viewport.jquery && target[0] !== window && target[0] !== docBody) { + position.adjusted = { + left: readjust.horizontal !== 'none' ? readjust.left(position.left) : 0, + top: readjust.vertical !== 'none' ? readjust.top(position.top) : 0 + }; + } + else { + position.adjusted = { left: 0, top: 0 }; + } + + // Set tooltip position class + tooltip.attr('class', function(i, val) { + return $.attr(this, 'class').replace(/ui-tooltip-pos-\w+/i, ''); + }) + .addClass(uitooltip + '-pos-' + my.abbreviation()); + + // Call API method + callback.originalEvent = $.extend({}, event); + tooltip.trigger(callback, [self, position, viewport.elem]); + if(callback.isDefaultPrevented()){ return self; } + delete position.adjusted; + + // If effect is disabled, no animation is defined or positioning gives NaN out, set CSS directly + if(effect === FALSE || isNaN(position.left) || isNaN(position.top) || !$.isFunction(posOptions.effect)) { + tooltip.css(position); + } + + // Use custom function if provided + else if($.isFunction(posOptions.effect)) { + posOptions.effect.call(tooltip, self, $.extend({}, position)); + tooltip.queue(function(next) { + // Reset attributes to avoid cross-browser rendering bugs + $(this).css({ opacity: '', height: '' }); + if($.browser.msie) { this.style.removeAttribute('filter'); } + + next(); + }); + } + + // Set positioning flag + isPositioning = 0; + + return self; + }, + + // IMax/min width simulator function for all browsers.. yeaaah! + redraw: function() + { + if(self.rendered < 1 || options.style.width || isDrawing) { return self; } + + var fluid = uitooltip + '-fluid', width, max, min; + isDrawing = 1; // Set drawing flag + + // Reset width and add fluid class + tooltip.css('width', '').addClass(fluid); + + // Grab our tooltip width (add 1 so we don't get wrapping problems in Gecko) + width = tooltip.width() + ($.browser.mozilla ? 1 : 0); + + // Parse our max/min properties + max = parseInt(tooltip.css('max-width'), 10) || 0; + min = parseInt(tooltip.css('min-width'), 10) || 0; + + // Determine new dimension size based on max/min/current values + width = max + min ? Math.min(Math.max(width, min), max) : width; + + // Set the newly calculated width and remvoe fluid class + tooltip.css('width', width).removeClass(fluid); + + // Set drawing flag + isDrawing = 0; + + return self; + }, + + disable: function(state) + { + var c = disabled; + + if('boolean' !== typeof state) { + state = !(tooltip.hasClass(c) || cache.disabled); + } + + if(self.rendered) { + tooltip.toggleClass(c, state); + $.attr(tooltip[0], 'aria-disabled', state); + } + else { + cache.disabled = !!state; + } + + return self; + }, + + enable: function() { return self.disable(FALSE); }, + + destroy: function() + { + var t = target[0], + title = $.attr(t, oldtitle); + + // Destroy tooltip and any associated plugins if rendered + if(self.rendered) { + tooltip.remove(); + + $.each(self.plugins, function() { + if(this.destroy) { this.destroy(); } + }); + } + + // Clear timers and remove bound events + clearTimeout(self.timers.show); + clearTimeout(self.timers.hide); + unassignEvents(1, 1, 1, 1); + + // Remove api object + $.removeData(t, 'qtip'); + + // Reset old title attribute if removed + if(title) { + $.attr(t, 'title', title); + target.removeAttr(oldtitle); + } + + // Remove ARIA attributes and bound qtip events + target.removeAttr('aria-describedby').unbind('.qtip'); + + return target; + } + }); +} + +// Initialization method +function init(id, opts) +{ + var obj, posOptions, attr, config, + + // Setup element references + elem = $(this), + docBody = $(document.body), + + // Use document body instead of document element if needed + newTarget = this === document ? docBody : elem, + + // Grab metadata from element if plugin is present + metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL, + + // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise + metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL, + + // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method, + html5 = elem.data(opts.metadata.name || 'qtipopts'); + + // If we don't get an object returned attempt to parse it manualyl without parseJSON + try { html5 = typeof html5 === 'string' ? (new Function("return " + html5))() : html5; } + catch(e) { debug('Unable to parse HTML5 attribute data: ' + html5); } + + // Merge in and sanitize metadata + config = $.extend(TRUE, {}, QTIP.defaults, opts, + typeof html5 === 'object' ? sanitizeOptions(html5) : NULL, + sanitizeOptions(metadata5 || metadata)); + + // Remove metadata object so we don't interfere with other metadata calls + if(metadata) { $.removeData(this, 'metadata'); } + + // Re-grab our positioning options now we've merged our metadata and set id to passed value + posOptions = config.position; + config.id = id; + + // Setup missing content if none is detected + if('boolean' === typeof config.content.text) { + attr = elem.attr(config.content.attr); + + // Grab from supplied attribute if available + if(config.content.attr !== FALSE && attr) { config.content.text = attr; } + + // No valid content was found, abort render + else { return FALSE; } + } + + // Setup target options + if(posOptions.container === FALSE) { posOptions.container = docBody; } + if(posOptions.target === FALSE) { posOptions.target = newTarget; } + if(config.show.target === FALSE) { config.show.target = newTarget; } + if(config.show.solo === TRUE) { config.show.solo = docBody; } + if(config.hide.target === FALSE) { config.hide.target = newTarget; } + if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; } + + // Convert position corner values into x and y strings + posOptions.at = new PLUGINS.Corner(posOptions.at); + posOptions.my = new PLUGINS.Corner(posOptions.my); + + // Destroy previous tooltip if overwrite is enabled, or skip element if not + if($.data(this, 'qtip')) { + if(config.overwrite) { + elem.qtip('destroy'); + } + else if(config.overwrite === FALSE) { + return FALSE; + } + } + + // Remove title attribute and store it if present + if($.attr(this, 'title')) { + $.attr(this, oldtitle, $.attr(this, 'title')); + this.removeAttribute('title'); + } + + // Initialize the tooltip and add API reference + obj = new QTip(elem, config, id, !!attr); + $.data(this, 'qtip', obj); + + // Catch remove events on target element to destroy redundant tooltip + elem.bind('remove.qtip', function(){ obj.destroy(); }); + + return obj; +} + +// jQuery $.fn extension method +QTIP = $.fn.qtip = function(options, notation, newValue) +{ + var command = ('' + options).toLowerCase(), // Parse command + returned = NULL, + args = command === 'disable' ? [TRUE] : $.makeArray(arguments).slice(1, 10), + event = args[args.length - 1], + opts = this[0] ? $.data(this[0], 'qtip') : NULL; + + // Check for API request + if((!arguments.length && opts) || command === 'api') { + return opts; + } + + // Execute API command if present + else if('string' === typeof options) + { + this.each(function() + { + var api = $.data(this, 'qtip'); + if(!api) { return TRUE; } + + // Cache the event if possible + if(event && event.timeStamp) { api.cache.event = event; } + + // Check for specific API commands + if((command === 'option' || command === 'options') && notation) { + if($.isPlainObject(notation) || newValue !== undefined) { + api.set(notation, newValue); + } + else { + returned = api.get(notation); + return FALSE; + } + } + + // Execute API command + else if(api[command]) { + api[command].apply(api[command], args); + } + }); + + return returned !== NULL ? returned : this; + } + + // No API commands. validate provided options and setup qTips + else if('object' === typeof options || !arguments.length) + { + opts = sanitizeOptions($.extend(TRUE, {}, options)); + + // Bind the qTips + return QTIP.bind.call(this, opts, event); + } +}; + +// $.fn.qtip Bind method +QTIP.bind = function(opts, event) +{ + return this.each(function(i) { + var options, targets, events, + + // Find next available ID, or use custom ID if provided + id = (!opts.id || opts.id === FALSE || opts.id.length < 1 || $('#'+uitooltip+'-'+opts.id).length) ? QTIP.nextid++ : opts.id, + + // Setup events namespace + namespace = '.qtip-'+id+'-create', + + // Initialize the qTip and re-grab newly sanitized options + api = init.call(this, id, opts); + if(api === FALSE) { return TRUE; } + options = api.options; + + // Initialize plugins + $.each(PLUGINS, function() { + if(this.initialize === 'initialize') { this(api); } + }); + + // Determine hide and show targets + targets = { show: options.show.target, hide: options.hide.target }; + events = { + show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace, + hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace + }; + + /* + * If hide event is just 'unfocus', we'll use mouseleave as the hide event... + * since unfocus is actually library specific and won't fire as an event anywho. + */ + if(options.hide.event === 'unfocus') { events.hide = 'mouseleave' + namespace; } + + // Define hoverIntent function + function hoverIntent(event) { + function render() { + // Cache mouse coords,render and render the tooltip + api.render(typeof event === 'object' || options.show.ready); + + // Unbind show and hide event + targets.show.unbind(events.show); + targets.hide.unbind(events.hide); + } + + // Only continue if tooltip isn't disabled + if(api.cache.disabled) { return FALSE; } + + // Cache the event data + api.cache.event = $.extend({}, event); + + // Start the event sequence + if(options.show.delay > 0) { + clearTimeout(api.timers.show); + api.timers.show = setTimeout(render, options.show.delay); + if(events.show !== events.hide) { + targets.hide.bind(events.hide, function() { clearTimeout(api.timers.show); }); + } + } + else { render(); } + } + + // Bind show events to target + targets.show.bind(events.show, hoverIntent); + + // Prerendering is enabled, create tooltip now + if(options.show.ready || options.prerender) { hoverIntent(event); } + }); +}; + +// Setup base plugins +PLUGINS = QTIP.plugins = { + // Corner object parser + Corner: function(corner) { + corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, 'center').toLowerCase(); + this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase(); + this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase(); + + this.precedance = (corner.charAt(0).search(/^(t|b)/) > -1) ? 'y' : 'x'; + this.string = function() { return this.precedance === 'y' ? this.y+this.x : this.x+this.y; }; + this.abbreviation = function() { + var x = this.x.substr(0,1), y = this.y.substr(0,1); + return x === y ? x : (x === 'c' || (x !== 'c' && y !== 'c')) ? y + x : x + y; + }; + }, + + // Custom (more correct for qTip!) offset calculator + offset: function(elem, container) { + var pos = elem.offset(), + parent = container, + deep = 0, + docBody = document.body, + coffset; + + function scroll(e, i) { + pos.left += i * e.scrollLeft(); + pos.top += i * e.scrollTop(); + } + + if(parent) { + // Compensate for non-static containers offset + do { + if(parent[0] === docBody) { break; } + else if(parent.css('position') !== 'static') { + coffset = parent.position(); + pos.left -= coffset.left + (parseInt(parent.css('borderLeftWidth'), 10) || 0); + pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0); + + deep++; + } + } + while(parent = parent.offsetParent()); + + // Compensate for containers scroll if it also has an offsetParent + if(container[0] !== docBody || deep > 1) { scroll( container, 1 ); } + if(PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) { scroll( $(window), -1 ); } + } + + return pos; + }, + + /* + * iOS 3.2 - 4.0 scroll fix detection used in offset() function. + */ + iOS: parseFloat( + ('' + (/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]) + .replace('undefined', '3_2').replace('_','.') + ) || FALSE, + + /* + * jQuery-secpfic $.fn overrides + */ + fn: { + /* Allow other plugins to successfully retrieve the title of an element with a qTip applied */ + attr: function(attr, val) { + if(!this.length) { return; } + + var self = this[0], + title = 'title', + api = $.data(self, 'qtip'); + + if(attr === title) { + if(arguments.length < 2) { + return $.attr(self, oldtitle); + } + else if(typeof api === 'object') { + // If qTip is rendered and title was originally used as content, update it + if(api && api.rendered && api.options.content.attr === title && api.cache.attr) { + api.set('content.text', val); + } + + // Use the regular attr method to set, then cache the result + $.fn['attr'+replaceSuffix].apply(this, arguments); + $.attr(self, oldtitle, $.attr(self, title)); + return this.removeAttr(title); + } + } + }, + + /* Allow clone to correctly retrieve cached title attributes */ + clone: function(keepData) { + var titles = $([]), title = 'title', elem; + + // Clone our element using the real clone method + elem = $.fn['clone'+replaceSuffix].apply(this, arguments) + + // Grab all elements with an oldtitle set, and change it to regular title attribute + .filter('[oldtitle]').each(function() { + $.attr(this, title, $.attr(this, oldtitle)); + this.removeAttribute(oldtitle); + }) + .end(); + + return elem; + }, + + /* + * Taken directly from jQuery 1.8.2 widget source code + * Trigger 'remove' event on all elements on removal if jQuery UI isn't present + */ + remove: $.ui ? NULL : function( selector, keepData ) { + $(this).each(function() { + if (!keepData) { + if (!selector || $.filter( selector, [ this ] ).length) { + $('*', this).add(this).each(function() { + $(this).triggerHandler('remove'); + }); + } + } + }); + } + } +}; + +// Apply the fn overrides above +$.each(PLUGINS.fn, function(name, func) { + if(!func) { return TRUE; } + + var old = $.fn[name+replaceSuffix] = $.fn[name]; + $.fn[name] = function() { + return func.apply(this, arguments) || old.apply(this, arguments); + }; +}); + +// Cache mousemove events for positioning purposes +$(document).bind('mousemove.qtip', function(event) { + MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' }; +}); + +// Set global qTip properties +QTIP.version = '@VERSION'; +QTIP.nextid = 0; +QTIP.inactiveEvents = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' '); +QTIP.zindex = 15000; + +// Define configuration defaults +QTIP.defaults = { + prerender: FALSE, + id: FALSE, + overwrite: TRUE, + content: { + text: TRUE, + attr: 'title', + title: { + text: FALSE, + button: FALSE + } + }, + position: { + my: 'top left', + at: 'bottom right', + target: FALSE, + container: FALSE, + viewport: FALSE, + adjust: { + x: 0, y: 0, + mouse: TRUE, + resize: TRUE, + method: 'flip flip' + }, + effect: TRUE + }, + show: { + target: FALSE, + event: 'mouseenter', + effect: TRUE, + delay: 90, + solo: FALSE, + ready: FALSE + }, + hide: { + target: FALSE, + event: 'mouseleave', + effect: TRUE, + delay: 0, + fixed: FALSE, + inactive: FALSE, + leave: 'window', + distance: FALSE + }, + style: { + classes: '', + widget: FALSE, + width: FALSE + }, + events: { + render: NULL, + move: NULL, + show: NULL, + hide: NULL, + toggle: NULL, + focus: NULL, + blur: NULL + } +}; \ No newline at end of file diff --git a/src/src/extra.css b/src/src/extra.css new file mode 100644 index 00000000..d1c9b448 --- /dev/null +++ b/src/src/extra.css @@ -0,0 +1,233 @@ +/*! Add shadows to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE6+, Safari 2+ */ +.ui-tooltip-shadow{ + -webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); + box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); +} + + .ui-tooltip-shadow .ui-tooltip-titlebar, + .ui-tooltip-shadow .ui-tooltip-content{ + filter: progid:DXImageTransform.Microsoft.Shadow(Color='gray', Direction=135, Strength=3); + -ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray', Direction=135, Strength=3)"; + + _margin-bottom: -3px; /* IE6 */ + .margin-bottom: -3px; /* IE7 */ + } + + +/*! Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */ +.ui-tooltip-rounded, +.ui-tooltip-rounded .ui-tooltip-content, +.ui-tooltip-tipsy, +.ui-tooltip-tipsy .ui-tooltip-content, +.ui-tooltip-youtube, +.ui-tooltip-youtube .ui-tooltip-content{ + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +.ui-tooltip-rounded .ui-tooltip-titlebar, +.ui-tooltip-tipsy .ui-tooltip-titlebar, +.ui-tooltip-youtube .ui-tooltip-titlebar{ + -moz-border-radius: 5px 5px 0 0; + -webkit-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; +} + +.ui-tooltip-rounded .ui-tooltip-titlebar + .ui-tooltip-content, +.ui-tooltip-tipsy .ui-tooltip-titlebar + .ui-tooltip-content, +.ui-tooltip-youtube .ui-tooltip-titlebar + .ui-tooltip-content{ + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; +} + + +/*! Youtube tooltip style */ +.ui-tooltip-youtube{ + -webkit-box-shadow: 0 0 3px #333; + -moz-box-shadow: 0 0 3px #333; + box-shadow: 0 0 3px #333; +} + + .ui-tooltip-youtube .ui-tooltip-titlebar, + .ui-tooltip-youtube .ui-tooltip-content{ + background: transparent; + background: rgba(0, 0, 0, 0.85); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)"; + + color: white; + border-color: #CCCCCC; + } + + .ui-tooltip-youtube .ui-tooltip-icon{ + border-color: #222; + } + + .ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{ + border-color: #303030; + } + + +/* jQuery TOOLS Tooltip style */ +.ui-tooltip-jtools{ + background: #232323; + background: rgba(0, 0, 0, 0.7); + background-image: -moz-linear-gradient(top, #717171, #232323); + background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323)); + + border: 2px solid #ddd; + border: 2px solid rgba(241,241,241,1); + + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + + -webkit-box-shadow: 0 0 12px #333; + -moz-box-shadow: 0 0 12px #333; + box-shadow: 0 0 12px #333; +} + + /* IE Specific */ + .ui-tooltip-jtools .ui-tooltip-titlebar{ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)"; + } + .ui-tooltip-jtools .ui-tooltip-content{ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)"; + } + + .ui-tooltip-jtools .ui-tooltip-titlebar, + .ui-tooltip-jtools .ui-tooltip-content{ + background: transparent; + color: white; + border: 0 dashed transparent; + } + + .ui-tooltip-jtools .ui-tooltip-icon{ + border-color: #555; + } + + .ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{ + border-color: #333; + } + + +/* Cluetip style */ +.ui-tooltip-cluetip{ + -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); + -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); + box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); +} + + .ui-tooltip-cluetip .ui-tooltip-titlebar{ + background-color: #87876A; + color: white; + border: 0 dashed transparent; + } + + .ui-tooltip-cluetip .ui-tooltip-content{ + background-color: #D9D9C2; + color: #111; + border: 0 dashed transparent; + } + + .ui-tooltip-cluetip .ui-tooltip-icon{ + border-color: #808064; + } + + .ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{ + border-color: #696952; + color: #696952; + } + + +/* Tipsy style */ +.ui-tooltip-tipsy{ + border: 0 solid #000; + border: 0 solid rgba(0,0,0,.87); +} + + .ui-tooltip-tipsy .ui-tooltip-titlebar, + .ui-tooltip-tipsy .ui-tooltip-content{ + background: transparent; + background: rgba(0, 0, 0, .87); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)"; + + color: white; + border: 0 dashed transparent; + + font-size: 11px; + font-family: 'Lucida Grande', sans-serif; + font-weight: bold; + line-height: 16px; + text-shadow: 0 1px black; + } + + .ui-tooltip-tipsy .ui-tooltip-titlebar{ + padding: 6px 35px 0 10; + } + + .ui-tooltip-tipsy .ui-tooltip-content{ + padding: 6px 10; + } + + .ui-tooltip-tipsy .ui-tooltip-icon{ + border-color: #222; + text-shadow: none; + } + + .ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{ + border-color: #303030; + } + + +/* Tipped style */ +.ui-tooltip-tipped{ + +} + + .ui-tooltip-tipped .ui-tooltip-titlebar, + .ui-tooltip-tipped .ui-tooltip-content{ + border: 3px solid #959FA9; + } + + .ui-tooltip-tipped .ui-tooltip-titlebar{ + background: #3A79B8; + background-image: -moz-linear-gradient(top, #3A79B8, #2E629D); + background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D)); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)"; + + color: white; + font-weight: normal; + font-family: serif; + + border-bottom-width: 0; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; + } + + .ui-tooltip-tipped .ui-tooltip-content{ + background-color: #F9F9F9; + color: #454545; + + -moz-border-radius: 0 0 3px 3px; + -webkit-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; + } + + .ui-tooltip-tipped .ui-tooltip-icon{ + border: 2px solid #285589; + background: #285589; + } + + .ui-tooltip-tipped .ui-tooltip-icon .ui-icon{ + background-color: #FBFBFB; + color: #555; + } diff --git a/src/src/header.txt b/src/src/header.txt new file mode 100644 index 00000000..a639b329 --- /dev/null +++ b/src/src/header.txt @@ -0,0 +1,14 @@ +/* +* qTip2 - Pretty powerful tooltips +* http://craigsworks.com/projects/qtip2/ +* +* Version: @VERSION +* Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com +* +* Dual licensed under MIT or GPLv2 licenses +* http://en.wikipedia.org/wiki/MIT_License +* http://en.wikipedia.org/wiki/GNU_General_Public_License +* +* Date: +*/ + diff --git a/src/src/imagemap.js b/src/src/imagemap.js new file mode 100644 index 00000000..d71e87cb --- /dev/null +++ b/src/src/imagemap.js @@ -0,0 +1,127 @@ +PLUGINS.imagemap = function(area, corner) +{ + var shape = area.attr('shape').toLowerCase(), + baseCoords = area.attr('coords').split(','), + coords = [], + image = $('img[usemap="#'+area.parent('map').attr('name')+'"]'), + imageOffset = image.offset(), + result = { + width: 0, height: 0, + offset: { top: 1e10, right: 0, bottom: 0, left: 1e10 } + }, + i = 0, next = 0; + + // POLY area coordinate calculator + // Special thanks to Ed Cradock for helping out with this. + // Uses a binary search algorithm to find suitable coordinates. + function polyCoordinates(result, coords) + { + var i = 0, + compareX = 1, compareY = 1, + realX = 0, realY = 0, + newWidth = result.width, + newHeight = result.height; + + // Use a binary search algorithm to locate most suitable coordinate (hopefully) + while(newWidth > 0 && newHeight > 0 && compareX > 0 && compareY > 0) + { + newWidth = Math.floor(newWidth / 2); + newHeight = Math.floor(newHeight / 2); + + if(corner.x === 'left'){ compareX = newWidth; } + else if(corner.x === 'right'){ compareX = result.width - newWidth; } + else{ compareX += Math.floor(newWidth / 2); } + + if(corner.y === 'top'){ compareY = newHeight; } + else if(corner.y === 'bottom'){ compareY = result.height - newHeight; } + else{ compareY += Math.floor(newHeight / 2); } + + i = coords.length; while(i--) + { + if(coords.length < 2){ break; } + + realX = coords[i][0] - result.offset.left; + realY = coords[i][1] - result.offset.top; + + if((corner.x === 'left' && realX >= compareX) || + (corner.x === 'right' && realX <= compareX) || + (corner.x === 'center' && (realX < compareX || realX > (result.width - compareX))) || + (corner.y === 'top' && realY >= compareY) || + (corner.y === 'bottom' && realY <= compareY) || + (corner.y === 'center' && (realY < compareY || realY > (result.height - compareY)))) { + coords.splice(i, 1); + } + } + } + + return { left: coords[0][0], top: coords[0][1] }; + } + + // Make sure we account for padding and borders on the image + imageOffset.left += Math.ceil((image.outerWidth() - image.width()) / 2); + imageOffset.top += Math.ceil((image.outerHeight() - image.height()) / 2); + + // Parse coordinates into proper array + if(shape === 'poly') { + i = baseCoords.length; while(i--) + { + next = [ parseInt(baseCoords[--i], 10), parseInt(baseCoords[i+1], 10) ]; + + if(next[0] > result.offset.right){ result.offset.right = next[0]; } + if(next[0] < result.offset.left){ result.offset.left = next[0]; } + if(next[1] > result.offset.bottom){ result.offset.bottom = next[1]; } + if(next[1] < result.offset.top){ result.offset.top = next[1]; } + + coords.push(next); + } + } + else { + coords = $.map(baseCoords, function(coord){ return parseInt(coord, 10); }); + } + + // Calculate details + switch(shape) + { + case 'rect': + result = { + width: Math.abs(coords[2] - coords[0]), + height: Math.abs(coords[3] - coords[1]), + offset: { left: coords[0], top: coords[1] } + }; + break; + + case 'circle': + result = { + width: coords[2] + 2, + height: coords[2] + 2, + offset: { left: coords[0], top: coords[1] } + }; + break; + + case 'poly': + $.extend(result, { + width: Math.abs(result.offset.right - result.offset.left), + height: Math.abs(result.offset.bottom - result.offset.top) + }); + + if(corner.string() === 'centercenter') { + result.offset = { + left: result.offset.left + (result.width / 2), + top: result.offset.top + (result.height / 2) + }; + } + else { + result.offset = polyCoordinates(result, coords.slice()); + } + + result.width = result.height = 0; + break; + } + + // Add image position to offset coordinates + result.offset.left += imageOffset.left; + result.offset.top += imageOffset.top; + + return result; +}; + diff --git a/src/src/intro.js b/src/src/intro.js new file mode 100644 index 00000000..bc5672c4 --- /dev/null +++ b/src/src/intro.js @@ -0,0 +1,28 @@ +"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ +/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */ +/*global window: false, jQuery: false */ + + +(function($, window, undefined) { + + // Munge the primitives - Paul Irish tip + var TRUE = true, + FALSE = false, + NULL = null, + + // Shortcut vars + QTIP, PLUGINS, MOUSE, + uitooltip = 'ui-tooltip', + widget = 'ui-widget', + disabled = 'ui-state-disabled', + selector = 'div.qtip.'+uitooltip, + focusClass = uitooltip + '-focus', + hideOffset = '-31000px', + replaceSuffix = '_replacedByqTip', + oldtitle = 'oldtitle'; + + // Simple console.error wrapper + function debug() { + var c = window.console; + return c && (c.error || c.log || $.noop).apply(c, arguments); + } diff --git a/src/src/modal.css b/src/src/modal.css new file mode 100644 index 00000000..00c29577 --- /dev/null +++ b/src/src/modal.css @@ -0,0 +1,12 @@ +#qtip-overlay{ + position: absolute; + left: -10000em; + top: -10000em; + + background-color: black; + + opacity: 0.7; + filter:alpha(opacity=70); + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; +} + diff --git a/src/src/modal.js b/src/src/modal.js new file mode 100644 index 00000000..31730176 --- /dev/null +++ b/src/src/modal.js @@ -0,0 +1,206 @@ +function Modal(api) +{ + var self = this, + options = api.options.show.modal, + elems = api.elements, + tooltip = elems.tooltip, + selector = '#qtip-overlay', + globalNamespace = '.qtipmodal', + namespace = globalNamespace + api.id, + attr = 'is-modal-qtip', + overlay; + + // Setup option set checks + api.checks.modal = { + '^show.modal.(on|blur)$': function() { + // Initialise + self.init(); + + // Show the modal if not visible already and tooltip is visible + elems.overlay.toggle( tooltip.is(':visible') ); + } + }; + + $.extend(self, { + init: function() + { + // If modal is disabled... return + if(!options.on) { return self; } + + // Create the overlay if needed + overlay = self.create(); + + // Add unique attribute so we can grab modal tooltips easily via a selector + tooltip.attr(attr, TRUE) + + // Remove previous bound events in globalNamespace + .unbind(globalNamespace).unbind(namespace) + + // Apply our show/hide/focus modal events + .bind('tooltipshow'+globalNamespace+' tooltiphide'+globalNamespace, function(event, api, duration) { + self[ event.type.replace('tooltip', '') ](duration); + }) + + // Adjust modal z-index on tooltip focus + .bind('tooltipfocus'+globalNamespace, function(event, api, zIndex) { + overlay.css('z-index', zIndex - 1); + }) + + // Focus any other visible modals when this one blurs + .bind('tooltipblur'+globalNamespace, function(event) { + $('[' + attr + ']:visible').not(tooltip).last().qtip('focus', event); + }); + + // Apply keyboard "Escape key" close handler + if(options.escape) { + $(window).unbind(namespace).bind('keydown'+namespace, function(event) { + if(event.keyCode === 27 && tooltip.hasClass(focusClass)) { + api.hide(event); + } + }); + } + + // Apply click handler for blur option + if(options.blur) { + elems.overlay.unbind(namespace).bind('click'+namespace, function(event) { + if(tooltip.hasClass(focusClass)) { api.hide(event); } + }); + } + + return self; + }, + + create: function() + { + var elem = $(selector); + + // Return if overlay is already rendered + if(elem.length) { elems.overlay = elem; return elem; } + + // Create document overlay + overlay = elems.overlay = $('
', { + id: selector.substr(1), + css: { + position: 'absolute', + top: 0, + left: 0, + display: 'none' + }, + mousedown: function() { return FALSE; } + }) + .appendTo(document.body); + + // Update position on window resize or scroll + $(window).unbind(globalNamespace).bind('resize'+globalNamespace, function() { + overlay.css({ + height: Math.max( $(window).height(), $(document).height() ), + width: Math.max( $(window).width(), $(document).width() ) + }); + }) + .trigger('resize'); + + return overlay; + }, + + toggle: function(state) + { + var effect = options.effect, + type = state ? 'show': 'hide', + modals = $('[' + attr + ']:visible').not(tooltip), + zindex; + + // Create our overlay if it isn't present already + if(!overlay) { overlay = self.create(); } + + // Prevent modal from conflicting with show.solo + if(overlay.is(':animated') && !state) { return self; } + + // Make sure not to hide the backdrop if other modals are visible + if(!state && modals.length) { return self; } + + // Toggle backdrop cursor style on show + else if(state) { + elems.overlay.css('cursor', options.blur ? 'pointer' : ''); + } + + // Setop all animations + overlay.stop(TRUE, FALSE); + + // Use custom function if provided + if($.isFunction(effect)) { + effect.call(overlay, state); + } + + // If no effect type is supplied, use a simple toggle + else if(effect === FALSE) { + overlay[ type ](); + } + + // Use basic fade function + else { + overlay.fadeTo(90, state ? 0.7 : 0, function() { + if(!state) { $(this).hide(); } + }); + } + + return self; + }, + + show: function() { return self.toggle(TRUE); }, + hide: function() { return self.toggle(FALSE); }, + + destroy: function() + { + var delBlanket = overlay; + + if(delBlanket) { + // Check if any other modal tooltips are present + delBlanket = $('[' + attr + ']').not(tooltip).length < 1; + + // Remove overlay if needed + if(delBlanket) { + elems.overlay.remove(); + $(window).unbind(globalNamespace); + } + else { + elems.overlay.unbind(globalNamespace+api.id); + } + } + + // Remove bound events + return tooltip.removeAttr(attr).unbind(globalNamespace); + } + }); + + self.init(); +} + +PLUGINS.modal = function(api) +{ + var self = api.plugins.modal; + + return 'object' === typeof self ? self : (api.plugins.modal = new Modal(api)); +}; + +// Plugin needs to be initialized on render +PLUGINS.modal.initialize = 'render'; + +// Setup sanitiztion rules +PLUGINS.modal.sanitize = function(opts) { + if(opts.show) { + if(typeof opts.show.modal !== 'object') { opts.show.modal = { on: !!opts.show.modal }; } + else if(typeof opts.show.modal.on === 'undefined') { opts.show.modal.on = TRUE; } + } +}; + +// Extend original api defaults +$.extend(TRUE, QTIP.defaults, { + show: { + modal: { + on: FALSE, + effect: TRUE, + blur: TRUE, + escape: TRUE + } + } +}); \ No newline at end of file diff --git a/src/src/outro.js b/src/src/outro.js new file mode 100644 index 00000000..d51ca52d --- /dev/null +++ b/src/src/outro.js @@ -0,0 +1,2 @@ + +}(jQuery, window)); \ No newline at end of file diff --git a/src/src/svg.js b/src/src/svg.js new file mode 100644 index 00000000..511142bd --- /dev/null +++ b/src/src/svg.js @@ -0,0 +1,43 @@ +PLUGINS.svg = function(svg, corner) +{ + var doc = $(document), + elem = svg[0], + result = { + width: 0, height: 0, + offset: { top: 1e10, left: 1e10 } + }, + box, mtx, root, point, tPoint; + + if (elem.getBBox && elem.parentNode) { + box = elem.getBBox(); + mtx = elem.getScreenCTM(); + root = elem.farthestViewportElement || elem; + + // Return if no method is found + if(!root.createSVGPoint) { return result; } + + // Create our point var + point = root.createSVGPoint(); + + // Adjust top and left + point.x = box.x; + point.y = box.y; + tPoint = point.matrixTransform(mtx); + result.offset.left = tPoint.x; + result.offset.top = tPoint.y; + + // Adjust width and height + point.x += box.width; + point.y += box.height; + tPoint = point.matrixTransform(mtx); + result.width = tPoint.x - result.offset.left; + result.height = tPoint.y - result.offset.top; + + // Adjust by scroll offset + result.offset.left += doc.scrollLeft(); + result.offset.top += doc.scrollTop(); + } + + return result; +}; + diff --git a/src/src/tips.css b/src/src/tips.css new file mode 100644 index 00000000..55a2f13c --- /dev/null +++ b/src/src/tips.css @@ -0,0 +1,22 @@ +.ui-tooltip .ui-tooltip-tip{ + margin: 0 auto; + overflow: hidden; + + background: transparent !important; + border: 0px dashed transparent !important; + z-index: 10; +} + + .ui-tooltip .ui-tooltip-tip, + .ui-tooltip .ui-tooltip-tip *{ + position: absolute; + + line-height: 0.1px !important; + font-size: 0.1px !important; + color: #123456; + + background: transparent; + border: 0px dashed transparent; + } + + .ui-tooltip .ui-tooltip-tip canvas{ position: static; } \ No newline at end of file diff --git a/src/src/tips.js b/src/src/tips.js new file mode 100644 index 00000000..d2331006 --- /dev/null +++ b/src/src/tips.js @@ -0,0 +1,563 @@ +// Tip coordinates calculator +function calculateTip(corner, width, height) +{ + var width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2), + + // Define tip coordinates in terms of height and width values + tips = { + bottomright: [[0,0], [width,height], [width,0]], + bottomleft: [[0,0], [width,0], [0,height]], + topright: [[0,height], [width,0], [width,height]], + topleft: [[0,0], [0,height], [width,height]], + topcenter: [[0,height], [width2,0], [width,height]], + bottomcenter: [[0,0], [width,0], [width2,height]], + rightcenter: [[0,0], [width,height2], [0,height]], + leftcenter: [[width,0], [width,height], [0,height2]] + }; + + // Set common side shapes + tips.lefttop = tips.bottomright; tips.righttop = tips.bottomleft; + tips.leftbottom = tips.topright; tips.rightbottom = tips.topleft; + + return tips[ corner.string() ]; +} + + +function Tip(qTip, command) +{ + var self = this, + opts = qTip.options.style.tip, + elems = qTip.elements, + tooltip = elems.tooltip, + cache = { + top: 0, + left: 0, + corner: '' + }, + size = { + width: opts.width, + height: opts.height + }, + color = { }, + border = opts.border || 0, + namespace = '.qtip-tip', + hasCanvas = $('')[0].getContext; + + self.corner = NULL; + self.mimic = NULL; + self.position = {}; + + // Add new option checks for the plugin + qTip.checks.tip = { + '^position.my|style.tip.(corner|mimic|border)$': function() { + // Make sure a tip can be drawn + if(!self.init()) { + self.destroy(); + } + + // Reposition the tooltip + qTip.reposition(); + }, + '^style.tip.(height|width)$': function() { + // Re-set dimensions and redraw the tip + size = { + width: opts.width, + height: opts.height + }; + self.create(); + self.update(); + + // Reposition the tooltip + qTip.reposition(); + }, + '^content.title.text|style.(classes|widget)$': function() { + if(elems.tip) { + self.update(); + } + } + }; + + function reposition(event, api, pos, viewport) { + if(!elems.tip) { return; } + + var newCorner = $.extend({}, self.corner), + adjust = pos.adjusted, + method = qTip.options.position.adjust.method.split(' '), + horizontal = method[0], + vertical = method[1] || method[0], + shift = { left: FALSE, top: FALSE, x: 0, y: 0 }, + offset, css = {}, props; + + // Make sure our tip position isn't fixed e.g. doesn't adjust with viewport + if(self.corner.fixed !== TRUE) { + // Horizontal - Shift or flip method + if(horizontal === 'shift' && newCorner.precedance === 'x' && adjust.left && newCorner.y !== 'center') { + newCorner.precedance = newCorner.precedance === 'x' ? 'y' : 'x'; + } + else if(horizontal === 'flip' && adjust.left){ + newCorner.x = newCorner.x === 'center' ? (adjust.left > 0 ? 'left' : 'right') : (newCorner.x === 'left' ? 'right' : 'left'); + } + + // Vertical - Shift or flip method + if(vertical === 'shift' && newCorner.precedance === 'y' && adjust.top && newCorner.x !== 'center') { + newCorner.precedance = newCorner.precedance === 'y' ? 'x' : 'y'; + } + else if(vertical === 'flip' && adjust.top) { + newCorner.y = newCorner.y === 'center' ? (adjust.top > 0 ? 'top' : 'bottom') : (newCorner.y === 'top' ? 'bottom' : 'top'); + } + + // Update and redraw the tip if needed (check cached details of last drawn tip) + if(newCorner.string() !== cache.corner && (cache.top !== adjust.top || cache.left !== adjust.left)) { + self.update(newCorner, FALSE); + } + } + + // Setup tip offset properties + offset = self.position(newCorner, adjust); + if(offset.right !== undefined) { offset.left = -offset.right; } + if(offset.bottom !== undefined) { offset.top = -offset.bottom; } + offset.user = Math.max(0, opts.offset); + + // Viewport "shift" specific adjustments + if(shift.left = (horizontal === 'shift' && !!adjust.left)) { + if(newCorner.x === 'center') { + css['margin-left'] = shift.x = offset['margin-left'] - adjust.left; + } + else { + props = offset.right !== undefined ? + [ adjust.left, -offset.left ] : [ -adjust.left, offset.left ]; + + if( (shift.x = Math.max(props[0], props[1])) > props[0] ) { + pos.left -= adjust.left; + shift.left = FALSE; + } + + css[ offset.right !== undefined ? 'right' : 'left' ] = shift.x; + } + } + if(shift.top = (vertical === 'shift' && !!adjust.top)) { + if(newCorner.y === 'center') { + css['margin-top'] = shift.y = offset['margin-top'] - adjust.top; + } + else { + props = offset.bottom !== undefined ? + [ adjust.top, -offset.top ] : + [ -adjust.top, offset.top ]; + + if( (shift.y = Math.max(props[0], props[1])) > props[0] ) { + pos.top -= adjust.top; + shift.top = FALSE; + } + + css[ offset.bottom !== undefined ? 'bottom' : 'top' ] = shift.y; + } + } + + /* + * If the tip is adjusted in both dimensions, or in a + * direction that would cause it to be anywhere but the + * outer border, hide it! + */ + elems.tip.css(css).toggle( + !((shift.x && shift.y) || (newCorner.x === 'center' && shift.y) || (newCorner.y === 'center' && shift.x)) + ); + + // Adjust position to accomodate tip dimensions + pos.left -= offset.left.charAt ? offset.user : horizontal !== 'shift' || shift.top || !shift.left && !shift.top ? offset.left : 0; + pos.top -= offset.top.charAt ? offset.user : vertical !== 'shift' || shift.left || !shift.left && !shift.top ? offset.top : 0; + + // Cache details + cache.left = adjust.left; cache.top = adjust.top; + cache.corner = newCorner.string(); + } + + /* border width calculator */ + function borderWidth(corner, side, backup) { + side = !side ? corner[corner.precedance] : side; + + var isTitleTop = elems.titlebar && corner.y === 'top', + elem = isTitleTop ? elems.titlebar : elems.content, + css = 'border-' + side + '-width', + val = parseInt(elem.css(css), 10); + + return (backup ? val || parseInt(tooltip.css(css), 10) : val) || 0; + } + + function borderRadius(corner) { + var isTitleTop = elems.titlebar && corner.y === 'top', + elem = isTitleTop ? elems.titlebar : elems.content, + moz = $.browser.mozilla, + prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '', + side = corner.y + (moz ? '' : '-') + corner.x, + css = prefix + (moz ? 'border-radius-' + side : 'border-' + side + '-radius'); + + return parseInt(elem.css(css), 10) || parseInt(tooltip.css(css), 10) || 0; + } + + function calculateSize(corner) { + var y = corner.precedance === 'y', + width = size [ y ? 'width' : 'height' ], + height = size [ y ? 'height' : 'width' ], + isCenter = corner.string().indexOf('center') > -1, + base = width * (isCenter ? 0.5 : 1), + pow = Math.pow, + round = Math.round, + bigHyp, ratio, result, + + smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ), + + hyp = [ + (border / base) * smallHyp, (border / height) * smallHyp + ]; + hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(border, 2) ); + hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(border, 2) ); + + bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]); + ratio = bigHyp / smallHyp; + + result = [ round(ratio * height), round(ratio * width) ]; + return { height: result[ y ? 0 : 1 ], width: result[ y ? 1 : 0 ] }; + } + + $.extend(self, { + init: function() + { + var enabled = self.detectCorner() && (hasCanvas || $.browser.msie); + + // Determine tip corner and type + if(enabled) { + // Create a new tip and draw it + self.create(); + self.update(); + + // Bind update events + tooltip.unbind(namespace).bind('tooltipmove'+namespace, reposition); + } + + return enabled; + }, + + detectCorner: function() + { + var corner = opts.corner, + posOptions = qTip.options.position, + at = posOptions.at, + my = posOptions.my.string ? posOptions.my.string() : posOptions.my; + + // Detect corner and mimic properties + if(corner === FALSE || (my === FALSE && at === FALSE)) { + return FALSE; + } + else { + if(corner === TRUE) { + self.corner = new PLUGINS.Corner(my); + } + else if(!corner.string) { + self.corner = new PLUGINS.Corner(corner); + self.corner.fixed = TRUE; + } + } + + return self.corner.string() !== 'centercenter'; + }, + + detectColours: function() { + var i, fill, border, + tip = elems.tip.css({ backgroundColor: '', border: '' }), + corner = self.corner, + precedance = corner[ corner.precedance ], + + borderSide = 'border-' + precedance + '-color', + borderSideCamel = 'border' + precedance.charAt(0) + precedance.substr(1) + 'Color', + + invalid = /rgba?\(0, 0, 0(, 0)?\)|transparent/i, + backgroundColor = 'background-color', + transparent = 'transparent', + fluid = 'ui-tooltip-fluid', + + bodyBorder = $(document.body).css('color'), + contentColour = qTip.elements.content.css('color'), + + useTitle = elems.titlebar && (corner.y === 'top' || (corner.y === 'center' && tip.position().top + (size.height / 2) + opts.offset < elems.titlebar.outerHeight(1))), + colorElem = useTitle ? elems.titlebar : elems.content; + + // Apply the fluid class so we can see our CSS values properly + tooltip.addClass(fluid); + + // Detect tip colours from CSS styles + fill = tip.css(backgroundColor) || transparent; + border = tip[0].style[ borderSideCamel ]; + + // Make sure colours are valid + if(!fill || invalid.test(fill)) { + color.fill = colorElem.css(backgroundColor); + if(invalid.test(color.fill)) { + color.fill = tooltip.css(backgroundColor) || fill; + } + } + if(!border || invalid.test(border)) { + color.border = tooltip.css(borderSide); + if(invalid.test(color.border) || color.border === bodyBorder) { + color.border = colorElem.css(borderSide); + if(color.border === contentColour) { color.border = border; } + } + } + + // Reset background and border colours, and remove fluid class + $('*', tip).add(tip).css(backgroundColor, transparent).css('border', ''); + tooltip.removeClass(fluid); + }, + + create: function() + { + var width = size.width, + height = size.height, + vml; + + // Remove previous tip element if present + if(elems.tip) { elems.tip.remove(); } + + // Create tip element and prepend to the tooltip + elems.tip = $('
', { 'class': 'ui-tooltip-tip' }).css({ width: width, height: height }).prependTo(tooltip); + + // Create tip drawing element(s) + if(hasCanvas) { + // save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()! + $('').appendTo(elems.tip)[0].getContext('2d').save(); + } + else { + vml = ''; + elems.tip.html( border ? vml += vml : vml ); + } + }, + + update: function(corner, position) + { + var tip = elems.tip, + inner = tip.children(), + width = size.width, + height = size.height, + regular = 'px solid ', + transparent = 'px dashed transparent', // Dashed IE6 border-transparency hack. Awesome! + mimic = opts.mimic, + round = Math.round, + precedance, context, coords, translate, newSize; + + // Re-determine tip if not already set + if(!corner) { corner = self.corner; } + + // Use corner property if we detect an invalid mimic value + if(mimic === FALSE) { mimic = corner; } + + // Otherwise inherit mimic properties from the corner object as necessary + else { + mimic = new PLUGINS.Corner(mimic); + mimic.precedance = corner.precedance; + + if(mimic.x === 'inherit') { mimic.x = corner.x; } + else if(mimic.y === 'inherit') { mimic.y = corner.y; } + else if(mimic.x === mimic.y) { + mimic[ corner.precedance ] = corner[ corner.precedance ]; + } + } + precedance = mimic.precedance; + + // Update our colours + self.detectColours(); + + // Detect border width, taking into account colours + border = color.border === 'transparent' || color.border === '#123456' ? 0 : + opts.border === TRUE ? borderWidth(corner, NULL, TRUE) : opts.border; + + // Calculate coordinates + coords = calculateTip(mimic, width , height); + + // Determine tip size + newSize = calculateSize(corner); + tip.css(newSize); + + // Calculate tip translation + if(corner.precedance === 'y') { + translate = [ + round(mimic.x === 'left' ? border : mimic.x === 'right' ? newSize.width - width - border : (newSize.width - width) / 2), + round(mimic.y === 'top' ? newSize.height - height : 0) + ]; + } + else { + translate = [ + round(mimic.x === 'left' ? newSize.width - width : 0), + round(mimic.y === 'top' ? border : mimic.y === 'bottom' ? newSize.height - height - border : (newSize.height - height) / 2) + ]; + } + + // Canvas drawing implementation + if(hasCanvas) { + // Set the canvas size using calculated size + inner.attr(newSize); + + // Grab canvas context and clear/save it + context = inner[0].getContext('2d'); + context.restore(); context.save(); + context.clearRect(0,0,3000,3000); + + // Translate origin + context.translate(translate[0], translate[1]); + + // Draw the tip + context.beginPath(); + context.moveTo(coords[0][0], coords[0][1]); + context.lineTo(coords[1][0], coords[1][1]); + context.lineTo(coords[2][0], coords[2][1]); + context.closePath(); + context.fillStyle = color.fill; + context.strokeStyle = color.border; + context.lineWidth = border * 2; + context.lineJoin = 'miter'; + context.miterLimit = 100; + context.stroke(); + context.fill(); + } + + // VML (IE Proprietary implementation) + else { + // Setup coordinates string + coords = 'm' + coords[0][0] + ',' + coords[0][1] + ' l' + coords[1][0] + + ',' + coords[1][1] + ' ' + coords[2][0] + ',' + coords[2][1] + ' xe'; + + // Setup VML-specific offset for pixel-perfection + translate[2] = border && /^(r|b)/i.test(corner.string()) ? + parseFloat($.browser.version, 10) === 8 ? 2 : 1 : 0; + + // Set initial CSS + inner.css({ + antialias: ''+(mimic.string().indexOf('center') > -1), + left: translate[0] - (translate[2] * Number(precedance === 'x')), + top: translate[1] - (translate[2] * Number(precedance === 'y')), + width: width + border, + height: height + border + }) + .each(function(i) { + var $this = $(this); + + // Set shape specific attributes + $this.attr({ + coordsize: (width+border) + ' ' + (height+border), + path: coords, + fillcolor: color.fill, + filled: !!i, + stroked: !!!i + }) + .css({ display: border || i ? 'block' : 'none' }); + + // Check if border is enabled and add stroke element + if(!i && border > 0 && $this.html() === '') { + $this.html( + '' + ); + } + }); + } + + // Position if needed + if(position !== FALSE) { self.position(corner); } + }, + + // Tip positioning method + position: function(corner) + { + var tip = elems.tip, + position = {}, + userOffset = Math.max(0, opts.offset), + precedance, dimensions, corners; + + // Return if tips are disabled or tip is not yet rendered + if(opts.corner === FALSE || !tip) { return FALSE; } + + // Inherit corner if not provided + corner = corner || self.corner; + precedance = corner.precedance; + + // Determine which tip dimension to use for adjustment + dimensions = calculateSize(corner); + + // Setup corners and offset array + corners = [ corner.x, corner.y ]; + if(precedance === 'x') { corners.reverse(); } + + // Calculate tip position + $.each(corners, function(i, side) { + var b, br; + + if(side === 'center') { + b = precedance === 'y' ? 'left' : 'top'; + position[ b ] = '50%'; + position['margin-' + b] = -Math.round(dimensions[ precedance === 'y' ? 'width' : 'height' ] / 2) + userOffset; + } + else { + b = borderWidth(corner, side, TRUE); + br = borderRadius(corner); + + position[ side ] = i ? + borderWidth(corner, side) : + userOffset + (br > b ? br : 0); + } + }); + + // Adjust for tip dimensions + position[ corner[precedance] ] -= dimensions[ precedance === 'x' ? 'width' : 'height' ]; + + // Set and return new position + tip.css({ top: '', bottom: '', left: '', right: '', margin: '' }).css(position); + return position; + }, + + destroy: function() + { + // Remov tip and bound events + if(elems.tip) { elems.tip.remove(); } + tooltip.unbind(namespace); + } + }); + + self.init(); +} + +PLUGINS.tip = function(api) +{ + var self = api.plugins.tip; + + return 'object' === typeof self ? self : (api.plugins.tip = new Tip(api)); +}; + +// Initialize tip on render +PLUGINS.tip.initialize = 'render'; + +// Setup plugin sanitization options +PLUGINS.tip.sanitize = function(options) +{ + var style = options.style, opts; + if(style && 'tip' in style) { + opts = options.style.tip; + if(typeof opts !== 'object'){ options.style.tip = { corner: opts }; } + if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; } + if(typeof opts.width !== 'number'){ delete opts.width; } + if(typeof opts.height !== 'number'){ delete opts.height; } + if(typeof opts.border !== 'number' && opts.border !== TRUE){ delete opts.border; } + if(typeof opts.offset !== 'number'){ delete opts.offset; } + } +}; + +// Extend original qTip defaults +$.extend(TRUE, QTIP.defaults, { + style: { + tip: { + corner: TRUE, + mimic: FALSE, + width: 6, + height: 6, + border: TRUE, + offset: 0 + } + } +}); \ No newline at end of file diff --git a/src/tips.js b/src/tips.js index d2331006..095e98aa 100644 --- a/src/tips.js +++ b/src/tips.js @@ -141,8 +141,7 @@ function Tip(qTip, command) } else { props = offset.bottom !== undefined ? - [ adjust.top, -offset.top ] : - [ -adjust.top, offset.top ]; + [ adjust.top, -offset.top ] : [ -adjust.top, offset.top ]; if( (shift.y = Math.max(props[0], props[1])) > props[0] ) { pos.top -= adjust.top;