Merge pull request #1443 from lostdalek/master

PHRAS-605, PHRAS-555
This commit is contained in:
Benoît Burnichon
2015-07-21 10:49:26 +02:00
3 changed files with 47 additions and 7 deletions

View File

@@ -40,6 +40,7 @@
fade: true,
showURL: true,
outside: true,
isBrowsable: false,
extraClass: "",
top: 15,
left: 15,
@@ -199,7 +200,8 @@
helper.url.hide();
// add an optional class for this tip
// helper.parent.addClass(settings(this).extraClass);
helper.parent.removeClass();
helper.parent.addClass(settings(this).extraClass);
if (this.ajaxLoad) {
clearTimeout($.tooltip.ajaxTimeout);
$.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300);
@@ -470,6 +472,18 @@
} else {
helper.parent.show();
}
$(helper.parent[0])
.unbind('mouseleave')
.mouseleave(function () {
if (settings($.tooltip.current).isBrowsable) {
// if tooltip has scrollable content or selectionnable text - should be closed on mouseleave:
$.tooltip.currentHover = false;
helper.parent.hide();
}
});
update();
}
@@ -510,11 +524,13 @@
// stop updating when tracking is disabled and the tooltip is visible
if (!track && helper.parent.is(":visible")) {
$(document.body).unbind('mousemove', update);
$.tooltip.currentHover = true;
}
// if no current element is available, remove this listener
if ($.tooltip.current === null) {
$(document.body).unbind('mousemove', update);
$.tooltip.currentHover = false;
return;
}
@@ -573,8 +589,16 @@
// hide helper and restore added classes and the title
function hide(event) {
if( $.tooltip.currentHover && settings($.tooltip.current).isBrowsable ) {
return;
}
if ($.tooltip.blocked || !$.tooltip.current)
return;
$(helper.parent[0])
.unbind('mouseleave');
// clear timeout if possible
if (tID)
clearTimeout(tID);

View File

@@ -11,4 +11,15 @@
#answers {
overflow-x: hidden;
overflow-y: auto;
}
}
.caption-tooltip-container {
max-width: 500px;
}
.caption-tooltip-container .popover-inner .popover-content {
max-width: 500px;
max-height: 500px;
overflow: auto;
overflow-x: hidden;
}

View File

@@ -390,7 +390,12 @@ function afterSearch() {
answAjaxrunning = false;
$('#answers').removeClass('loading');
$('.captionTips, .captionRolloverTips, .infoTips').tooltip({
$('.captionTips, .captionRolloverTips').tooltip({
delay: 0,
isBrowsable: true,
extraClass: 'caption-tooltip-container'
});
$('.infoTips').tooltip({
delay: 0
});
$('.previewTips').tooltip({
@@ -570,9 +575,10 @@ function getFacetsTree() {
var length = 15;
var facetFilterString = facetFilter;
var facetFilterTruncatedString = facetFilterString.substring(0,length);
s_label.appendChild(document.createTextNode(facetFilterTruncatedString + "…"));
if( facetFilterString.length > length) {
facetFilterString = facetFilterString.substring(0,length) + '…';
}
s_label.appendChild(document.createTextNode(facetFilterString));
var s_closer = document.createElement("A");
s_closer.setAttribute("class", "facetFilter-closer");
@@ -591,7 +597,6 @@ function getFacetsTree() {
s_closer.click(
function(event) {
console.debug(this);
event.stopPropagation();
var facetTitle = $(this).data("facetTitle");
delete selectedFacetValues[facetTitle];