tag 3.1.13

This commit is contained in:
Alchemy
2011-05-04 17:09:25 +02:00
parent fdf355dd88
commit 967a9b339e
2 changed files with 541 additions and 474 deletions

View File

@@ -1,2 +1,2 @@
<?php <?php
define('GV_version','3.1.12'); define('GV_version','3.1.13');

View File

@@ -13,7 +13,7 @@
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
*/ */
/*jsl:ignore*/;/*jsl:end*/(function($) { (function($) {
// the tooltip element // the tooltip element
var helper = {}, var helper = {},
@@ -28,6 +28,9 @@
$.tooltip = { $.tooltip = {
blocked: false, blocked: false,
ajaxTimeout : false,
ajaxRequest : false,
ajaxEvent : false,
current: null, current: null,
visible: false, visible: false,
defaults: { defaults: {
@@ -43,6 +46,20 @@
}, },
block: function() { block: function() {
$.tooltip.blocked = !$.tooltip.blocked; $.tooltip.blocked = !$.tooltip.blocked;
},
delayAjax : function(a,b,c)
{
$.tooltip.ajaxRequest = $.ajax({
url: $.tooltip.current.tooltipSrc,
success: function(data) {
title = data;
positioning($.tooltip.ajaxEvent);
},
"error":function(){
return;
}
});
} }
}; };
@@ -53,7 +70,12 @@
return this.each(function() { return this.each(function() {
$.data(this, "tooltip", settings); $.data(this, "tooltip", settings);
// copy tooltip into its own expando and remove the title // copy tooltip into its own expando and remove the title
this.tooltipText = this.title; this.tooltipText = $(this).attr('title');
this.tooltipSrc = $(this).attr('tooltipsrc');
this.ajaxLoad = (this.tooltipText === '' && this.tooltipSrc !== '');
this.ajaxTimeout;
this.orEl = $(this); this.orEl = $(this);
$(this).removeAttr("title"); $(this).removeAttr("title");
// also remove alt attribute to prevent default tooltip in IE // also remove alt attribute to prevent default tooltip in IE
@@ -78,12 +100,19 @@
}); });
} }
}); });
} : function() { return this; }, } : function() {
return this;
},
unfixPNG: IE ? function() { unfixPNG: IE ? function() {
return this.each(function () { return this.each(function () {
$(this).css({'filter': '', backgroundImage: ''}); $(this).css({
'filter': '',
backgroundImage: ''
}); });
} : function() { return this; }, });
} : function() {
return this;
},
hideWhenEmpty: function() { hideWhenEmpty: function() {
return this.each(function() { return this.each(function() {
$(this)[ $(this).html() ? "show" : "hide" ](); $(this)[ $(this).html() ? "show" : "hide" ]();
@@ -99,7 +128,7 @@
if( helper.parent ) if( helper.parent )
return; return;
// create the helper, h3 for title, div for url // create the helper, h3 for title, div for url
helper.parent = $('<div id="' + settings.id + '"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><a class="tooltip_closer ui-dialog-titlebar-close ui-corner-all" style="background-color:black;position:absolute;top:0;right:0;cursor:pointer;display:none;" onclick="unfix_tooltip();return false;" href="#"><span class="ui-icon ui-icon-closethick" unselectable="on" style="-moz-user-select: none;">close</span></a></div><div class="body"></div></div>') helper.parent = $('<div id="' + settings.id + '"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><a class="tooltip_closer ui-dialog-titlebar-close ui-corner-all" style="background-color:black;position:absolute;top:0;right:0;cursor:pointer;display:none;z-index:100;" onclick="unfix_tooltip();return false;" href="#"><span class="ui-icon ui-icon-closethick" unselectable="on" style="-moz-user-select: none;">close</span></a></div><div class="body"></div></div>')
// add to document // add to document
.appendTo(document.body) .appendTo(document.body)
// hide it at first // hide it at first
@@ -148,35 +177,35 @@
event.cancelBubble = true; event.cancelBubble = true;
if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !settings(this).bodyHandler) ) if ( $.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !this.tooltipSrc && !settings(this).bodyHandler) )
return; return;
// save current // save current
$.tooltip.current = this; $.tooltip.current = this;
title = this.tooltipText; title = this.tooltipText;
if ( settings(this).bodyHandler ) { // if ( settings(this).bodyHandler ) {
helper.title.hide(); // helper.title.hide();
var bodyContent = settings(this).bodyHandler.call(this); // var bodyContent = settings(this).bodyHandler.call(this);
if (bodyContent.nodeType || bodyContent.jquery) { // if (bodyContent.nodeType || bodyContent.jquery) {
helper.body.empty().append(bodyContent); // helper.body.empty().append(bodyContent);
} else { // } else {
helper.body.html( bodyContent ); // helper.body.html( bodyContent );
} // }
helper.body.show(); // helper.body.show();
} else if ( settings(this).showBody ) { // } else if ( settings(this).showBody ) {
var parts = title.split(settings(this).showBody); // var parts = title.split(settings(this).showBody);
helper.title.html(parts.shift()).show(); // helper.title.html(parts.shift()).show();
helper.body.empty(); // helper.body.empty();
for(var i = 0, part; (part = parts[i]); i++) { // for(var i = 0, part; (part = parts[i]); i++) {
if(i > 0) // if(i > 0)
helper.body.append("<br/>"); // helper.body.append("<br/>");
helper.body.append(part); // helper.body.append(part);
} // }
helper.body.hideWhenEmpty(); // helper.body.hideWhenEmpty();
} else { // } else {
helper.body.html(title).show(); // helper.body.html(title).show();
} // }
// if element has href or src, add and show it, otherwise hide it // if element has href or src, add and show it, otherwise hide it
if( settings(this).showURL && $(this).url() ) if( settings(this).showURL && $(this).url() )
@@ -185,12 +214,30 @@
helper.url.hide(); helper.url.hide();
// add an optional class for this tip // add an optional class for this tip
// helper.parent.addClass(settings(this).extraClass); // helper.parent.addClass(settings(this).extraClass);
if(this.ajaxLoad)
{
clearTimeout($.tooltip.ajaxTimeout);
$.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300);
$.tooltip.ajaxEvent = event;
}
else
{
positioning.apply(this, arguments);
}
return;
}
function positioning(event)
{
helper.body.html(title).show();
$this = $.tooltip.current;
// fix PNG background for IE // fix PNG background for IE
if (settings(this).fixPNG ) if (settings($this).fixPNG )
helper.parent.fixPNG(); helper.parent.fixPNG();
if(settings(this).outside) if(settings($this).outside)
{ {
var width = 'auto'; var width = 'auto';
var height = 'auto'; var height = 'auto';
@@ -217,12 +264,17 @@
width = ($(h).width()>(v.x-40))?(v.x-40):$(h).width(); width = ($(h).width()>(v.x-40))?(v.x-40):$(h).width();
height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height(); height = ($(h).height()>(v.y-40))?(v.y-40):$(h).height();
// $('#' + settings($.tooltip.current).id + ' .thumb_wrapper').width('auto').height('auto');
if($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0) if($('#' + settings($.tooltip.current).id + ' .audioTips').length > 0)
{ {
height = height < 26 ? 26 : height; height = height < 26 ? 26 : height;
} }
$(h).css({width:width,height:height}); $(h).css({
width:width,
height:height
});
if (event) { if (event) {
@@ -361,7 +413,8 @@
} }
width = nw; width = nw;
} }
}else{ }else
{
if(vertS < horS) if(vertS < horS)
{ {
height = 'auto'; height = 'auto';
@@ -375,16 +428,24 @@
top: top top: top
}); });
$('#' + settings($.tooltip.current).id + ' .imgTips').css({ var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
$imgTips.css({
width: width, width: width,
height: height, height: height,
left: left, left: left,
top: top top: top
}); });
// if($imgTips.size() > 0)
// {
// $('#' + settings($.tooltip.current).id).image_enhance('destroy').image_enhance({
// zoomable:true
// });
// }
} }
} }
handle.apply(this, arguments); handle.apply($this, arguments);
return; return;
} }
@@ -480,12 +541,16 @@
// check horizontal position // check horizontal position
if (v.x + v.cx < h.offsetLeft + h.offsetWidth) { if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
left -= h.offsetWidth + 20 + settings($.tooltip.current).left; left -= h.offsetWidth + 20 + settings($.tooltip.current).left;
helper.parent.css({left: left + 'px'}).addClass("viewport-right"); helper.parent.css({
left: left + 'px'
}).addClass("viewport-right");
} }
// check vertical position // check vertical position
if (v.y + v.cy < h.offsetTop + h.offsetHeight) { if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
top -= h.offsetHeight + 20 + settings($.tooltip.current).top; top -= h.offsetHeight + 20 + settings($.tooltip.current).top;
helper.parent.css({top: top + 'px'}).addClass("viewport-bottom"); helper.parent.css({
top: top + 'px'
}).addClass("viewport-bottom");
} }
} }
} }
@@ -511,12 +576,14 @@
// no more current element // no more current element
$.tooltip.visible = false; $.tooltip.visible = false;
var tsettings = settings($.tooltip.current); var tsettings = settings($.tooltip.current);
clearTimeout($.tooltip.ajaxTimeout);
if($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort)
{
$.tooltip.ajaxRequest.abort();
}
$.tooltip.current = null; $.tooltip.current = null;
function complete() { function complete() {
helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", ""); helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
var el =helper.parent.find('object').parent();
el.empty();
el.remove();
} }
if ((!IE || !$.fn.bgiframe) && tsettings.fade) { if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
if (helper.parent.is(':animated')) if (helper.parent.is(':animated'))