Mise à jour de la librairie Qtip2
This commit is contained in:
parent
917502cb73
commit
52ad3497de
File diff suppressed because one or more lines are too long
@ -9,14 +9,22 @@
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*
|
||||
* Date: Tue Feb 21 04:23:23 2012 +0000
|
||||
* Date: Mon Feb 27 02:13:34 2012 +0000
|
||||
*/
|
||||
|
||||
/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
|
||||
/*global window: false, jQuery: false, console: false */
|
||||
/*global window: false, jQuery: false, console: false, define: false */
|
||||
|
||||
|
||||
(function($, window, undefined) {
|
||||
// Uses AMD or browser globals to create a jQuery plugin.
|
||||
(function(factory) {
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
}
|
||||
else {
|
||||
factory(jQuery);
|
||||
}
|
||||
}
|
||||
(function($) {
|
||||
|
||||
"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
|
||||
|
||||
@ -24,6 +32,7 @@
|
||||
var TRUE = true,
|
||||
FALSE = false,
|
||||
NULL = null,
|
||||
undefined,
|
||||
|
||||
// Shortcut vars
|
||||
QTIP, PLUGINS, MOUSE,
|
||||
@ -199,7 +208,7 @@ function QTip(target, options, id, attr)
|
||||
function setWidget() {
|
||||
var on = options.style.widget;
|
||||
|
||||
tooltip.toggleClass(widget, on).toggleClass(defaultClass, options.style['default'] && !on);
|
||||
tooltip.toggleClass(widget, on).toggleClass(defaultClass, options.style.def && !on);
|
||||
elements.content.toggleClass(widget+'-content', on);
|
||||
|
||||
if(elements.titlebar){
|
||||
@ -325,8 +334,8 @@ function QTip(target, options, id, attr)
|
||||
content = content.call(target, cache.event, self);
|
||||
}
|
||||
|
||||
// Remove title if callback returns false
|
||||
if(content === FALSE) { return removeTitle(FALSE); }
|
||||
// Remove title if callback returns false or null/undefined (but not '')
|
||||
if(content === FALSE || (!content && content !== '')) { return removeTitle(FALSE); }
|
||||
|
||||
// Append new content if its a DOM array and show it if hidden
|
||||
else if(content.jquery && content.length > 0) {
|
||||
@ -547,13 +556,13 @@ function QTip(target, options, id, attr)
|
||||
|
||||
// Hide tooltip on document mousedown if unfocus events are enabled
|
||||
if(('' + options.hide.event).indexOf('unfocus') > -1) {
|
||||
targets.document.bind('mousedown'+namespace, function(event) {
|
||||
var $target = $(event.target),
|
||||
posOptions.container.closest('html').bind('mousedown'+namespace, function(event) {
|
||||
var elem = $(event.target),
|
||||
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible'),
|
||||
isAncestor = $target.parents(selector).filter(tooltip[0]).length > 0;
|
||||
isAncestor = elem.parents(selector).filter(tooltip[0]).length > 0;
|
||||
|
||||
if($target[0] !== tooltip[0] && !isAncestor &&
|
||||
!$target.closest(target).length && !$target.attr('disabled')
|
||||
if(elem[0] !== target[0] && elem[0] !== tooltip[0] && !isAncestor &&
|
||||
!target.has(elem[0]).length && !elem.attr('disabled')
|
||||
) {
|
||||
self.hide(event);
|
||||
}
|
||||
@ -1586,7 +1595,7 @@ function init(id, opts)
|
||||
if(!posOptions.container.length) { 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.show.solo === TRUE) { config.show.solo = posOptions.container.closest('body'); }
|
||||
if(config.hide.target === FALSE) { config.hide.target = newTarget; }
|
||||
if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; }
|
||||
|
||||
@ -1613,8 +1622,8 @@ function init(id, opts)
|
||||
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-'+id, function(){ obj.destroy(); });
|
||||
// Catch remove/removeqtip events on target element to destroy redundant tooltip
|
||||
elem.bind('remove.qtip-'+id+' removeqtip.qtip-'+id, function(){ obj.destroy(); });
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -1783,7 +1792,7 @@ PLUGINS = QTIP.plugins = {
|
||||
// Custom (more correct for qTip!) offset calculator
|
||||
offset: function(elem, container) {
|
||||
var pos = elem.offset(),
|
||||
docBody = document.body,
|
||||
docBody = elem.closest('body')[0],
|
||||
parent = container, scrolled,
|
||||
coffset, overflow;
|
||||
|
||||
@ -1805,9 +1814,8 @@ PLUGINS = QTIP.plugins = {
|
||||
// If this is the first parent element with an overflow of "scroll" or "auto", store it
|
||||
if(!scrolled && (overflow = parent.css('overflow')) !== 'hidden' && overflow !== 'visible') { scrolled = parent; }
|
||||
}
|
||||
if(parent[0] === docBody) { break; }
|
||||
}
|
||||
while(parent = parent.offsetParent());
|
||||
while((parent = $(parent[0].offsetParent)).length);
|
||||
|
||||
// Compensate for containers scroll if it also has an offsetParent
|
||||
if(scrolled && scrolled[0] !== docBody) { scroll( scrolled, 1 ); }
|
||||
@ -1870,24 +1878,6 @@ PLUGINS = QTIP.plugins = {
|
||||
}
|
||||
|
||||
return elems;
|
||||
},
|
||||
|
||||
/*
|
||||
* Taken directly from jQuery 1.8.2 widget source code
|
||||
* Trigger 'remove' event on all elements on removal
|
||||
*/
|
||||
remove: $.ui ? NULL : function( selector, keepData ) {
|
||||
if($.ui) { return; } // We don't need to do this if jQuery UI is present!
|
||||
|
||||
$(this).each(function() {
|
||||
if (!keepData) {
|
||||
if (!selector || $.filter( selector, [ this ] ).length) {
|
||||
$('*', this).add(this).each(function() {
|
||||
$(this).triggerHandler('remove');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1902,6 +1892,21 @@ $.each(PLUGINS.fn, function(name, func) {
|
||||
};
|
||||
});
|
||||
|
||||
/* Fire off 'removeqtip' handler in $.cleanData if jQuery UI not present (it already does similar).
|
||||
* This snippet is taken directly from jQuery UI source code found here:
|
||||
* http://code.jquery.com/ui/jquery-ui-git.js
|
||||
*/
|
||||
if(!$.ui) {
|
||||
$['cleanData'+replaceSuffix] = $.cleanData;
|
||||
$.cleanData = function( elems ) {
|
||||
for(var i = 0, elem; (elem = elems[i]) !== undefined; i++) {
|
||||
try { $( elem ).triggerHandler('removeqtip'); }
|
||||
catch( e ) {}
|
||||
}
|
||||
$['cleanData'+replaceSuffix]( elems );
|
||||
};
|
||||
}
|
||||
|
||||
// Set global qTip properties
|
||||
QTIP.version = '2.0.0pre';
|
||||
QTIP.nextid = 0;
|
||||
@ -1965,7 +1970,7 @@ QTIP.defaults = {
|
||||
widget: FALSE,
|
||||
width: FALSE,
|
||||
height: FALSE,
|
||||
'default': TRUE
|
||||
def: TRUE
|
||||
},
|
||||
events: {
|
||||
render: NULL,
|
||||
@ -3239,4 +3244,4 @@ $.extend(TRUE, QTIP.defaults, {
|
||||
});
|
||||
|
||||
|
||||
}(jQuery, window));
|
||||
}));
|
@ -9,7 +9,7 @@
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*
|
||||
* Date: Tue Feb 21 04:23:23 2012 +0000
|
||||
* Date: Mon Feb 27 02:13:34 2012 +0000
|
||||
*/
|
||||
|
||||
/* Core qTip styles */
|
||||
|
Loading…
Reference in New Issue
Block a user