Mise à jour de jquery.qtip + amélioration des tooltips dans les elements financier

This commit is contained in:
Michael RICOIS 2011-10-07 09:51:38 +00:00
parent 2fee6ca45a
commit 652633ed7c
4 changed files with 32 additions and 25 deletions

View File

@ -20,8 +20,8 @@ $(document).ready( function()
classes: "ui-tooltip-dark"
},
position: {
at: "bottom center",
my: "top center"
my: "top left",
at: "bottom left"
}
});
});

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Sep 13 17:04:02.0000000000 2011
* Date: Sun Oct 2 09:21:22.0000000000 2011
*/
/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
@ -249,13 +249,9 @@ function QTip(target, options, id, attr)
// 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
@ -280,11 +276,20 @@ function QTip(target, options, id, attr)
'aria-atomic': TRUE
})
)
.insertBefore(elements.content);
.insertBefore(elements.content)
// Button-specific events
.delegate('.ui-state-default', 'mousedown keydown mouseup keyup mouseout', function(event) {
$(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down');
})
.delegate('.ui-state-default', 'mouseover mouseout', function(event){
$(this).toggleClass('ui-state-hover', event.type === 'mouseover');
});
// Create button if enabled
if(options.content.title.button) { createButton(); }
// Redraw the tooltip dimensions if it's rendered
else if(self.rendered){ self.redraw(); }
}
@ -549,7 +554,7 @@ function QTip(target, options, id, attr)
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');
if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1) {
if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1 && !$target.is(':disabled')) {
self.hide(event);
}
});
@ -993,7 +998,7 @@ function QTip(target, options, id, attr)
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); }
if((callback.solo = !!opts.solo)) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); }
}
else {
// Clear show timer if we're hiding
@ -1760,7 +1765,7 @@ PLUGINS = QTIP.plugins = {
parent = container,
deep = 0,
docBody = document.body,
coffset;
coffset, overflow;
function scroll(e, i) {
pos.left += i * e.scrollLeft();
@ -1778,14 +1783,16 @@ PLUGINS = QTIP.plugins = {
pos.left -= coffset.left + (parseInt(parent.css('borderLeftWidth'), 10) || 0) + (parseInt(parent.css('marginLeft'), 10) || 0);
pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);
deep++;
overflow = parent.css('overflow');
if(overflow === 'scroll' || overflow === 'auto') { deep++; }
}
if(parent[0] === docBody) { break; }
}
while(parent = parent.offsetParent());
// Compensate for containers scroll if it also has an offsetParent
if(container[0] !== docBody && deep > 1) { scroll( container, 1 ); }
if(container[0] !== docBody && deep) { scroll( container, 1 ); }
}
return pos;
@ -1978,8 +1985,7 @@ function Ajax(api)
};
$.extend(self, {
init: function()
{
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);
@ -1988,9 +1994,7 @@ function Ajax(api)
return self;
},
load: function(event, first)
{
load: function(event, first) {
var hasSelector = opts.url.indexOf(' '),
url = opts.url,
selector,
@ -2035,7 +2039,10 @@ function Ajax(api)
}
// Error handler
function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); }
function errorHandler(xh, status, error) {
if (xh.status === 0) { return; }
api.set('content.text', status + ': ' + error);
}
// Setup $.ajax option object and process the request
$.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after }) );
@ -2887,12 +2894,12 @@ function Modal(api)
// Apply our show/hide/focus modal events
.bind('tooltipshow'+globalNamespace+' tooltiphide'+globalNamespace, function(event, api, duration) {
var oEvent = event.originalEvent;
// Make sure mouseout doesn't trigger a hide when showing the modal and mousing onto backdrop
if(oEvent && event.type === 'tooltiphide' && /mouse(leave|enter)/.test(oEvent.type) && $(oEvent.relatedTarget).closest(overlay[0]).length) {
try { event.preventDefault(); } catch(e) {}
}
else {
else if(oEvent && !oEvent.solo){
self[ event.type.replace('tooltip', '') ](event, duration);
}
})

View File

@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Sep 13 17:04:02.0000000000 2011
* Date: Sun Oct 2 09:21:22.0000000000 2011
*/
/* Core qTip styles */
@ -19,7 +19,7 @@
top: -28000px;
display: none;
max-width: 800px;
max-width: 500px;
min-width: 50px;
font-size: 10.5px;