N°931 UI: Display a regular tooltip instead of a qtip when item has no description.

This commit is contained in:
Molkobain
2018-09-28 15:47:22 +02:00
parent 16a6b70708
commit 4bf748641d

View File

@@ -259,21 +259,32 @@ EOF;
EOF
);
// Attribute tag tooltips
// Attribute set tooltip on items
$this->add_ready_script(
<<<EOF
$('.attribute-set-item').each(function(){
$(this).qtip({
content: {
// Encoding only title as the content is already sanitized by the HTML attribute.
text: $(this).attr('data-description'),
title: { text: $('<div/>').text($(this).attr('data-label')).html()},
},
show: { delay: 300, when: 'mouseover' },
hide: { delay: 140, when: 'mouseout', fixed: true },
style: { name: 'dark', tip: 'bottomLeft' },
position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }}
});
var sLabel = $('<div/>').text($(this).attr('data-label')).html();
var sDescription = $(this).attr('data-description');
// Make nice tooltip if item has a description, otherwise just make a title attribute so the truncated label can be read.
if(sDescription !== '')
{
$(this).qtip({
content: {
// Encoding only title as the content is already sanitized by the HTML attribute.
text: sDescription,
title: { text: sLabel},
},
show: { delay: 300, when: 'mouseover' },
hide: { delay: 140, when: 'mouseout', fixed: true },
style: { name: 'dark', tip: 'bottomLeft' },
position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }}
});
}
else
{
$(this).attr('title', sLabel);
}
});
EOF
);