Replace jQuery UI's tooltip from ajax messages
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
db3e882700
commit
f2dd364582
@ -1,5 +1,4 @@
|
||||
import $ from 'jquery';
|
||||
import tooltip from './tooltip.ts';
|
||||
import highlightSql from './sql-highlight.ts';
|
||||
|
||||
/**
|
||||
@ -115,9 +114,7 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
$retval
|
||||
.delay(newTimeOut)
|
||||
.fadeOut('medium', function () {
|
||||
if ($(this).is(':data(tooltip)')) {
|
||||
$(this).uiTooltip('destroy');
|
||||
}
|
||||
window.bootstrap.Tooltip.getInstance(this)?.dispose();
|
||||
|
||||
// Remove the notification
|
||||
$(this).remove();
|
||||
@ -132,7 +129,8 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
* Add a tooltip to the notification to let the user know that they
|
||||
* can dismiss the ajax notification by clicking on it.
|
||||
*/
|
||||
tooltip($retval, 'span', window.Messages.strDismiss);
|
||||
window.bootstrap.Tooltip.getOrCreateInstance($retval.get(0), { title: window.Messages.strDismiss })
|
||||
.setContent({ '.tooltip-inner': window.Messages.strDismiss });
|
||||
}
|
||||
|
||||
// Hide spinner if this is not a loading message
|
||||
@ -152,15 +150,13 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
*/
|
||||
const ajaxRemoveMessage = function ($thisMessageBox: JQuery | boolean): void {
|
||||
if ($thisMessageBox !== undefined && typeof $thisMessageBox !== 'boolean' && $thisMessageBox instanceof $) {
|
||||
window.bootstrap.Tooltip.getInstance($thisMessageBox.get(0))?.dispose();
|
||||
|
||||
$thisMessageBox
|
||||
.stop(true, true)
|
||||
.fadeOut('medium');
|
||||
|
||||
if ($thisMessageBox.is(':data(tooltip)')) {
|
||||
$thisMessageBox.uiTooltip('destroy');
|
||||
} else {
|
||||
$thisMessageBox.remove();
|
||||
}
|
||||
$thisMessageBox.remove();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1507,22 +1507,6 @@ export function dismissNotifications () {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The below two functions hide the "Dismiss notification" tooltip when a user
|
||||
* is hovering a link or button that is inside an ajax message
|
||||
*/
|
||||
$(document).on('mouseover', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () {
|
||||
if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) {
|
||||
$(this).parents('span.ajax_notification').uiTooltip('disable');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('mouseout', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () {
|
||||
if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) {
|
||||
$(this).parents('span.ajax_notification').uiTooltip('enable');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', 'a.copyQueryBtn', function (event) {
|
||||
event.preventDefault();
|
||||
var copyStatus = copyToClipboard($(this).attr('data-text'));
|
||||
@ -1536,11 +1520,8 @@ export function dismissNotifications () {
|
||||
message = $(this).hasClass('copyQueryBtn') ? window.Messages.strCopyToClipboard : window.Messages.strEditQuery;
|
||||
}
|
||||
|
||||
tooltip(
|
||||
$('.ajax_notification'),
|
||||
'span',
|
||||
message
|
||||
);
|
||||
window.bootstrap.Tooltip.getOrCreateInstance('.ajax_notification', { title: message })
|
||||
.setContent({ '.tooltip-inner': message });
|
||||
});
|
||||
|
||||
$(document).on('mouseup', '.ajax_notification a', function (event) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user