V 3.5 RC 1

This commit is contained in:
Romain Neutron
2011-12-05 00:23:28 +01:00
parent 6f1ee368aa
commit 4c5b7eb658
5563 changed files with 466984 additions and 985416 deletions

View File

@@ -7,14 +7,14 @@
* Copyright (c) 2006 - 2008 J<>rn Zaefferer
*
* $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
*
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($) {
// the tooltip element
var helper = {},
// the title of the current element, used for restoring
@@ -25,7 +25,7 @@
IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
// flag for mouse tracking
track = false;
$.tooltip = {
blocked: false,
ajaxTimeout : false,
@@ -36,6 +36,7 @@
defaults: {
delay: 700,
fixable:false,
fixableIndex:100,
fade: true,
showURL: true,
outside: true,
@@ -50,8 +51,17 @@
delayAjax : function(a,b,c)
{
//
var options_serial = p4.tot_options;
var query = p4.tot_query;
var datas = {
options_serial:options_serial,
query:query
};
$.tooltip.ajaxRequest = $.ajax({
url: $.tooltip.current.tooltipSrc,
type:'post',
data:datas,
success: function(data) {
title = data;
positioning($.tooltip.ajaxEvent);
@@ -62,7 +72,7 @@
});
}
};
$.fn.extend({
tooltip: function(settings) {
settings = $.extend({}, $.tooltip.defaults, settings);
@@ -122,7 +132,7 @@
return this.attr('href') || this.attr('src');
}
});
function createHelper(settings) {
// there can be only one tooltip helper
if( helper.parent )
@@ -133,7 +143,7 @@
.appendTo(document.body)
// hide it at first
.hide();
// apply bgiframe if available
if ( $.fn.bgiframe )
helper.parent.bgiframe();
@@ -143,11 +153,11 @@
helper.body = $('div.body', helper.parent);
helper.url = $('div.url', helper.parent);
}
function settings(element) {
return $.data(element, "tooltip");
}
// main event handler to start showing tooltips
function handle(event) {
@@ -160,15 +170,15 @@
else
visible();
show();
// if selected, update the helper position when the mouse moves
track = !!settings(this).track;
$(document.body).bind('mousemove', update);
// update at least once
update(event);
}
// save elements title before the tooltip is displayed
function save(event) {
// if this is the current source, or it has no title (occurs with click event), stop
@@ -183,7 +193,7 @@
// save current
$.tooltip.current = this;
title = this.tooltipText;
// if ( settings(this).bodyHandler ) {
// helper.title.hide();
// var bodyContent = settings(this).bodyHandler.call(this);
@@ -206,13 +216,13 @@
// } else {
// helper.body.html(title).show();
// }
// if element has href or src, add and show it, otherwise hide it
if( settings(this).showURL && $(this).url() )
helper.url.html( $(this).url().replace('http://', '') ).show();
else
helper.url.hide();
// add an optional class for this tip
// helper.parent.addClass(settings(this).extraClass);
if(this.ajaxLoad)
@@ -242,10 +252,12 @@
var width = 'auto';
var height = 'auto';
var ratio = 1;
if ($('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
width = parseInt($('#' + settings($.tooltip.current).id + ' .imgTips')[0].style.width);
height = parseInt($('#' + settings($.tooltip.current).id + ' .imgTips')[0].style.height);
var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
if ($imgTips[0]) {
width = parseInt($imgTips[0].style.width);
height = parseInt($imgTips[0].style.height);
ratio = width/height;
$imgTips.css({top:'0px',left:'0px'});
}
var v = viewport(),
@@ -428,12 +440,12 @@
top: top
});
var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
$imgTips.css({
width: width,
height: height,
left: left,
top: top
height: height
// ,
// left: left,
// top: top
});
// if($imgTips.size() > 0)
@@ -452,7 +464,7 @@
// delete timeout and show helper
function show() {
tID = null;
if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) {
if (helper.parent.is(":animated"))
helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100);
@@ -463,7 +475,7 @@
}
update();
}
function fix(event)
{
if(!settings(this).fixable)
@@ -474,25 +486,25 @@
event.cancelBubble = true;
if(event.stopPropagation)
event.stopPropagation();
showOverlay('_tooltip','body',unfix_tooltip);
showOverlay('_tooltip','body',unfix_tooltip, settings(this).fixableIndex);
$('#tooltip .tooltip_closer').show();
$.tooltip.blocked = true;
}
function visible(){
$.tooltip.visible = true;
helper.parent.css({
visibility:'visible'
});
}
/**
* callback for mousemove
* updates the helper position
* removes itself when no current element
*/
function update(event) {
if($.tooltip.blocked)
return;
@@ -504,7 +516,7 @@
if ( !track && helper.parent.is(":visible")) {
$(document.body).unbind('mousemove', update);
}
// if no current element is available, remove this listener
if( $.tooltip.current === null ) {
$(document.body).unbind('mousemove', update);
@@ -513,7 +525,7 @@
// remove position helper classes
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
if(!settings($.tooltip.current).outside)
{
var left = helper.parent[0].offsetLeft;
@@ -535,7 +547,7 @@
top: top
});
}
var v = viewport(),
h = helper.parent[0];
// check horizontal position
@@ -554,17 +566,17 @@
}
}
}
function viewport() {
return {
x: $(window).width(),
y: $(window).height(),
cx: 0,
cy: 0
};
}
// hide helper and restore added classes and the title
function hide(event)
{
@@ -592,11 +604,11 @@
helper.parent.stop().fadeOut(tsettings.fade, complete);
} else
complete();
if( tsettings.fixPNG )
helper.parent.unfixPNG();
}
})(jQuery);
function unfix_tooltip()
@@ -609,9 +621,10 @@ function unfix_tooltip()
hideOverlay('_tooltip');
}
$(document).bind('keydown', function(event){
if(event.keyCode == 27 && $.tooltip.blocked === true)
{
unfix_tooltip();
}
});
});