@@ -2,7 +2,6 @@ import $ from 'jquery';
22import { AJAX } from './ajax.ts' ;
33import { Navigation } from './navigation.ts' ;
44import { CommonParams } from './common.ts' ;
5- import tooltip from './tooltip.ts' ;
65import highlightSql from './sql-highlight.ts' ;
76import { ajaxRemoveMessage , ajaxShowMessage } from './ajax-message.ts' ;
87import { escapeHtml } from './functions/escape.ts' ;
@@ -123,11 +122,13 @@ export function addDatepicker ($thisElement, type = undefined, options = undefin
123122 // Fix wrong timepicker z-index, doesn't work without timeout
124123 $ ( '#ui-timepicker-div' ) . css ( 'z-index' , $ ( '#ui-datepicker-div' ) . css ( 'z-index' ) ) ;
125124 // Integrate tooltip text into dialog
126- var tooltip = $thisElement . uiTooltip ( 'instance' ) ;
127- if ( typeof tooltip !== 'undefined' ) {
128- tooltip . disable ( ) ;
129- var $note = $ ( '<p class="note"></div>' ) ;
130- $note . text ( tooltip . option ( 'content' ) ) ;
125+ if ( $thisElement . hasClass ( 'timefield' ) ) {
126+ const $note = $ ( '<p class="note"></div>' ) ;
127+ $note . text ( window . Messages . strMysqlAllowedValuesTipTime ) ;
128+ $ ( 'div.ui-datepicker' ) . append ( $note ) ;
129+ } else if ( $thisElement . hasClass ( 'datefield' ) ) {
130+ const $note = $ ( '<p class="note"></div>' ) ;
131+ $note . text ( window . Messages . strMysqlAllowedValuesTipDate ) ;
131132 $ ( 'div.ui-datepicker' ) . append ( $note ) ;
132133 }
133134 } , 0 ) ;
@@ -141,17 +142,13 @@ export function addDatepicker ($thisElement, type = undefined, options = undefin
141142 if ( typeof $thisElement . data ( 'datepicker' ) !== 'undefined' ) {
142143 $thisElement . data ( 'datepicker' ) . inline = false ;
143144 }
144-
145- var tooltip = $thisElement . uiTooltip ( 'instance' ) ;
146- if ( typeof tooltip !== 'undefined' ) {
147- tooltip . enable ( ) ;
148- }
149145 }
150146 } ;
151147 if ( type === 'time' ) {
152148 $thisElement . timepicker ( $ . extend ( defaultOptions , options ) ) ;
153149 // Add a tip regarding entering MySQL allowed-values for TIME data-type
154- tooltip ( $thisElement , 'input' , window . Messages . strMysqlAllowedValuesTipTime ) ;
150+ window . bootstrap . Tooltip . getOrCreateInstance ( $thisElement . get ( 0 ) , { title : window . Messages . strMysqlAllowedValuesTipTime } )
151+ . setContent ( { '.tooltip-inner' : window . Messages . strMysqlAllowedValuesTipTime } ) ;
155152 } else {
156153 $thisElement . datetimepicker ( $ . extend ( defaultOptions , options ) ) ;
157154 }
@@ -198,12 +195,13 @@ export function addDateTimePicker () {
198195 firstDay : window . firstDayOfCalendar
199196 } ) ;
200197
201- // Add a tip regarding entering MySQL allowed-values
202- // for TIME and DATE data-type
203- if ( $ ( this ) . hasClass ( 'timefield' ) ) {
204- tooltip ( $ ( this ) , 'input' , window . Messages . strMysqlAllowedValuesTipTime ) ;
205- } else if ( $ ( this ) . hasClass ( 'datefield' ) ) {
206- tooltip ( $ ( this ) , 'input' , window . Messages . strMysqlAllowedValuesTipDate ) ;
198+ // Add a tip regarding entering MySQL allowed-values for TIME and DATE data-type
199+ if ( this . classList . contains ( 'timefield' ) ) {
200+ window . bootstrap . Tooltip . getOrCreateInstance ( this , { title : window . Messages . strMysqlAllowedValuesTipTime } )
201+ . setContent ( { '.tooltip-inner' : window . Messages . strMysqlAllowedValuesTipTime } ) ;
202+ } else if ( this . classList . contains ( 'datefield' ) ) {
203+ window . bootstrap . Tooltip . getOrCreateInstance ( this , { title : window . Messages . strMysqlAllowedValuesTipDate } )
204+ . setContent ( { '.tooltip-inner' : window . Messages . strMysqlAllowedValuesTipDate } ) ;
207205 }
208206 } ) ;
209207}
@@ -1507,22 +1505,6 @@ export function dismissNotifications () {
15071505 }
15081506 } ) ;
15091507
1510- /**
1511- * The below two functions hide the "Dismiss notification" tooltip when a user
1512- * is hovering a link or button that is inside an ajax message
1513- */
1514- $ ( document ) . on ( 'mouseover' , 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input' , function ( ) {
1515- if ( $ ( this ) . parents ( 'span.ajax_notification' ) . is ( ':data(tooltip)' ) ) {
1516- $ ( this ) . parents ( 'span.ajax_notification' ) . uiTooltip ( 'disable' ) ;
1517- }
1518- } ) ;
1519-
1520- $ ( document ) . on ( 'mouseout' , 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input' , function ( ) {
1521- if ( $ ( this ) . parents ( 'span.ajax_notification' ) . is ( ':data(tooltip)' ) ) {
1522- $ ( this ) . parents ( 'span.ajax_notification' ) . uiTooltip ( 'enable' ) ;
1523- }
1524- } ) ;
1525-
15261508 $ ( document ) . on ( 'click' , 'a.copyQueryBtn' , function ( event ) {
15271509 event . preventDefault ( ) ;
15281510 var copyStatus = copyToClipboard ( $ ( this ) . attr ( 'data-text' ) ) ;
@@ -1536,11 +1518,8 @@ export function dismissNotifications () {
15361518 message = $ ( this ) . hasClass ( 'copyQueryBtn' ) ? window . Messages . strCopyToClipboard : window . Messages . strEditQuery ;
15371519 }
15381520
1539- tooltip (
1540- $ ( '.ajax_notification' ) ,
1541- 'span' ,
1542- message
1543- ) ;
1521+ window . bootstrap . Tooltip . getOrCreateInstance ( '.ajax_notification' , { title : message } )
1522+ . setContent ( { '.tooltip-inner' : message } ) ;
15441523 } ) ;
15451524
15461525 $ ( document ) . on ( 'mouseup' , '.ajax_notification a' , function ( event ) {
@@ -2846,13 +2825,19 @@ export function showIndexEditDialog ($outer) {
28462825 * in the whole body
28472826 **/
28482827export function showHints ( $div : JQuery < HTMLElement > | undefined = undefined ) {
2828+ if ( $ ( '#no_hint' ) . length > 0 ) {
2829+ return ;
2830+ }
2831+
28492832 var $newDiv = $div ;
28502833 if ( $newDiv === undefined || ! ( $newDiv instanceof $ ) || $newDiv . length === 0 ) {
28512834 $newDiv = $ ( 'body' ) ;
28522835 }
28532836
2854- $newDiv . find ( '.pma_hint' ) . each ( function ( ) {
2855- tooltip ( $ ( this ) . children ( 'img' ) , 'img' , $ ( this ) . children ( 'span' ) . html ( ) ) ;
2837+ $newDiv . get ( 0 ) . querySelectorAll ( '.pma_hint' ) . forEach ( ( hintElement : HTMLElement ) : void => {
2838+ const content = hintElement . querySelector ( 'span' ) . textContent ;
2839+ window . bootstrap . Tooltip . getOrCreateInstance ( hintElement , { title : content } )
2840+ . setContent ( { '.tooltip-inner' : content } ) ;
28562841 } ) ;
28572842}
28582843
0 commit comments