| Server IP : 185.11.201.71 / Your IP : 192.168.7.18 Web Server : Apache/2.4.29 (Ubuntu) System : Linux tech-virtual-machine 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : tech ( 1000) PHP Version : 7.4.28 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wordpress/App/src/js/free/ |
Upload File : |
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
import EventHandler from '../mdb/dom/event-handler';
import BSTooltip from '../bootstrap/mdb-prefix/tooltip';
import SelectorEngine from '../mdb/dom/selector-engine';
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'tooltip';
const DATA_KEY = `mdb.${NAME}`;
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_HIDE_BS = 'hide.bs.tooltip';
const EVENT_HIDDEN_BS = 'hidden.bs.tooltip';
const EVENT_SHOW_BS = 'show.bs.tooltip';
const EVENT_SHOWN_BS = 'shown.bs.tooltip';
const EVENT_INSERTED_BS = 'inserted.bs.tooltip';
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_SHOW = `show${EVENT_KEY}`;
const EVENT_SHOWN = `shown${EVENT_KEY}`;
const EVENT_INSERTED = `inserted${EVENT_KEY}`;
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="tooltip"]';
class Tooltip extends BSTooltip {
constructor(element, data) {
super(element, data);
this._init();
}
dispose() {
EventHandler.off(this._element, EVENT_SHOW_BS);
EventHandler.off(this._element, EVENT_SHOWN_BS);
EventHandler.off(this._element, EVENT_HIDE_BS);
EventHandler.off(this._element, EVENT_HIDDEN_BS);
EventHandler.off(this._element, EVENT_INSERTED_BS);
super.dispose();
}
// Getters
static get NAME() {
return NAME;
}
// Private
_init() {
this._bindShowEvent();
this._bindShownEvent();
this._bindHideEvent();
this._bindHiddenEvent();
this._bindHidePreventedEvent();
}
_bindShowEvent() {
EventHandler.on(this.element, EVENT_SHOW_BS, () => {
EventHandler.trigger(this.element, EVENT_SHOW);
});
}
_bindShownEvent() {
EventHandler.on(this.element, EVENT_SHOWN_BS, () => {
EventHandler.trigger(this.element, EVENT_SHOWN);
});
}
_bindHideEvent() {
EventHandler.on(this.element, EVENT_HIDE_BS, () => {
EventHandler.trigger(this.element, EVENT_HIDE);
});
}
_bindHiddenEvent() {
EventHandler.on(this.element, EVENT_HIDDEN_BS, () => {
EventHandler.trigger(this.element, EVENT_HIDDEN);
});
}
_bindHidePreventedEvent() {
EventHandler.on(this.element, EVENT_INSERTED_BS, () => {
EventHandler.trigger(this.element, EVENT_INSERTED);
});
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation - auto initialization
* ------------------------------------------------------------------------
*/
SelectorEngine.find(SELECTOR_DATA_TOGGLE).forEach((el) => {
let instance = Tooltip.getInstance(el);
if (!instance) {
instance = new Tooltip(el);
}
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
* add .rating to jQuery only if jQuery is present
*/
onDOMContentLoaded(() => {
const $ = getjQuery();
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tooltip.jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip.jQueryInterface;
};
}
});
export default Tooltip;