mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
PHRAS-1113 - fix tooltip positionning for records previews
This commit is contained in:
@@ -77,19 +77,19 @@
|
|||||||
settings = $.extend({}, $.tooltip.defaults, settings);
|
settings = $.extend({}, $.tooltip.defaults, settings);
|
||||||
createHelper(settings);
|
createHelper(settings);
|
||||||
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).attr('title');
|
this.tooltipText = $(this).attr('title');
|
||||||
this.tooltipSrc = $(this).attr('tooltipsrc');
|
this.tooltipSrc = $(this).attr('tooltipsrc');
|
||||||
|
|
||||||
this.ajaxLoad = ($.trim(this.tooltipText) === '' && this.tooltipSrc !== '');
|
this.ajaxLoad = ($.trim(this.tooltipText) === '' && this.tooltipSrc !== '');
|
||||||
this.ajaxTimeout;
|
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
|
||||||
this.alt = "";
|
this.alt = "";
|
||||||
})
|
})
|
||||||
.mouseover(save)
|
.mouseover(save)
|
||||||
.mouseout(hide)
|
.mouseout(hide)
|
||||||
.mouseleave(function () {
|
.mouseleave(function () {
|
||||||
@@ -114,10 +114,10 @@
|
|||||||
'backgroundImage': 'none',
|
'backgroundImage': 'none',
|
||||||
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
||||||
}).each(function () {
|
}).each(function () {
|
||||||
var position = $(this).css('position');
|
var position = $(this).css('position');
|
||||||
if (position != 'absolute' && position != 'relative')
|
if (position != 'absolute' && position != 'relative')
|
||||||
$(this).css('position', 'relative');
|
$(this).css('position', 'relative');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} : function () {
|
} : function () {
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
},
|
},
|
||||||
hideWhenEmpty: function () {
|
hideWhenEmpty: function () {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
$(this)[ $(this).html() ? "show" : "hide" ]();
|
$(this)[$(this).html() ? "show" : "hide"]();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
url: function () {
|
url: function () {
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
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="body"></div></div>')
|
helper.parent = $('<div id="' + settings.id + '"><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
|
||||||
.hide();
|
.hide();
|
||||||
@@ -197,8 +197,9 @@
|
|||||||
|
|
||||||
event.cancelBubble = true;
|
event.cancelBubble = true;
|
||||||
|
|
||||||
if ($.tooltip.blocked || this == $.tooltip.current || (!this.tooltipText && !this.tooltipSrc && !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;
|
||||||
@@ -239,7 +240,7 @@
|
|||||||
helper.body.show();
|
helper.body.show();
|
||||||
var $this = $.tooltip.current;
|
var $this = $.tooltip.current;
|
||||||
var tooltipSettings = settings($this) ? settings($this) : {};
|
var tooltipSettings = settings($this) ? settings($this) : {};
|
||||||
var fixedPosition = tooltipSettings.fixable ? tooltipSettings.fixable : false;
|
var fixedPosition = $.tooltip.blocked;
|
||||||
// fix PNG background for IE
|
// fix PNG background for IE
|
||||||
if (tooltipSettings.fixPNG)
|
if (tooltipSettings.fixPNG)
|
||||||
helper.parent.fixPNG();
|
helper.parent.fixPNG();
|
||||||
@@ -349,7 +350,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $selector !== undefined) {
|
if ($selector !== undefined) {
|
||||||
$selector.css({width: Math.floor(resizeW), height: Math.floor(resizeH)});
|
$selector.css({width: Math.floor(resizeW), height: Math.floor(resizeH)});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +366,6 @@
|
|||||||
|
|
||||||
// since event target can have different positionning, try to get common closest parent:
|
// since event target can have different positionning, try to get common closest parent:
|
||||||
var $eventTarget = $origEventTarget.closest('.diapo');
|
var $eventTarget = $origEventTarget.closest('.diapo');
|
||||||
|
|
||||||
if ($eventTarget.length > 0) {
|
if ($eventTarget.length > 0) {
|
||||||
// tooltip from records answer
|
// tooltip from records answer
|
||||||
recordWidthOffset = 148; // remove size
|
recordWidthOffset = 148; // remove size
|
||||||
@@ -499,7 +499,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var resizeProperties = {
|
var resizeProperties = {
|
||||||
left: left,
|
left: left,
|
||||||
top: top
|
top: top
|
||||||
@@ -532,7 +531,7 @@
|
|||||||
function show() {
|
function show() {
|
||||||
tID = null;
|
tID = null;
|
||||||
var isBrowsable = false;
|
var isBrowsable = false;
|
||||||
if( $.tooltip.current !== null ) {
|
if ($.tooltip.current !== null) {
|
||||||
isBrowsable = settings($.tooltip.current).isBrowsable;
|
isBrowsable = settings($.tooltip.current).isBrowsable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +547,7 @@
|
|||||||
$(helper.parent[0])
|
$(helper.parent[0])
|
||||||
.unbind('mouseenter')
|
.unbind('mouseenter')
|
||||||
.unbind('mouseleave')
|
.unbind('mouseleave')
|
||||||
.mouseenter(function(){
|
.mouseenter(function () {
|
||||||
if (isBrowsable) {
|
if (isBrowsable) {
|
||||||
$.tooltip.currentHover = true;
|
$.tooltip.currentHover = true;
|
||||||
}
|
}
|
||||||
@@ -575,6 +574,7 @@
|
|||||||
showOverlay('_tooltip', 'body', unfix_tooltip, settings(this).fixableIndex);
|
showOverlay('_tooltip', 'body', unfix_tooltip, settings(this).fixableIndex);
|
||||||
$('#tooltip .tooltip_closer').show().bind('click', unfix_tooltip);
|
$('#tooltip .tooltip_closer').show().bind('click', unfix_tooltip);
|
||||||
$.tooltip.blocked = true;
|
$.tooltip.blocked = true;
|
||||||
|
positioning.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function visible() {
|
function visible() {
|
||||||
@@ -613,7 +613,6 @@
|
|||||||
|
|
||||||
// remove position helper classes
|
// remove position helper classes
|
||||||
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
|
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
|
||||||
|
|
||||||
if (!settings($.tooltip.current).outside) {
|
if (!settings($.tooltip.current).outside) {
|
||||||
var left = helper.parent[0].offsetLeft;
|
var left = helper.parent[0].offsetLeft;
|
||||||
var top = helper.parent[0].offsetTop;
|
var top = helper.parent[0].offsetTop;
|
||||||
@@ -667,10 +666,10 @@
|
|||||||
// hide helper and restore added classes and the title
|
// hide helper and restore added classes and the title
|
||||||
function hide(event) {
|
function hide(event) {
|
||||||
var isBrowsable = false;
|
var isBrowsable = false;
|
||||||
if( $.tooltip.current !== null ) {
|
if ($.tooltip.current !== null) {
|
||||||
isBrowsable = settings($.tooltip.current).isBrowsable;
|
isBrowsable = settings($.tooltip.current).isBrowsable;
|
||||||
}
|
}
|
||||||
if( $.tooltip.currentHover && isBrowsable ) {
|
if ($.tooltip.currentHover && isBrowsable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,7 +722,7 @@ function unfix_tooltip() {
|
|||||||
|
|
||||||
|
|
||||||
$(document).bind('keydown', function (event) {
|
$(document).bind('keydown', function (event) {
|
||||||
if( $.tooltip === undefined ) return;
|
if ($.tooltip === undefined) return;
|
||||||
|
|
||||||
if (event.keyCode == 27 && $.tooltip.blocked === true) {
|
if (event.keyCode == 27 && $.tooltip.blocked === true) {
|
||||||
unfix_tooltip();
|
unfix_tooltip();
|
||||||
|
Reference in New Issue
Block a user