summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/tooltips/index.js
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/assets/javascripts/tooltips/index.js
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/assets/javascripts/tooltips/index.js')
-rw-r--r--app/assets/javascripts/tooltips/index.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/assets/javascripts/tooltips/index.js b/app/assets/javascripts/tooltips/index.js
index f7cad6639ae..b216affc818 100644
--- a/app/assets/javascripts/tooltips/index.js
+++ b/app/assets/javascripts/tooltips/index.js
@@ -68,7 +68,7 @@ const invokeBootstrapApi = (elements, method) => {
}
};
-const isGlTooltipsEnabled = () => Boolean(window.gon.glTooltipsEnabled);
+const isGlTooltipsEnabled = () => Boolean(window.gon.features?.glTooltips);
const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) => {
if (isGlTooltipsEnabled()) {
@@ -81,12 +81,12 @@ const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) =>
export const initTooltips = (config = {}) => {
if (isGlTooltipsEnabled()) {
const triggers = config?.triggers || DEFAULT_TRIGGER;
- const events = triggers.split(' ').map(trigger => EVENTS_MAP[trigger]);
+ const events = triggers.split(' ').map((trigger) => EVENTS_MAP[trigger]);
- events.forEach(event => {
+ events.forEach((event) => {
document.addEventListener(
event,
- e => handleTooltipEvent(document, e, config.selector, config),
+ (e) => handleTooltipEvent(document, e, config.selector, config),
true,
);
});
@@ -103,28 +103,28 @@ export const add = (elements, config = {}) => {
return invokeBootstrapApi(elements, config);
};
export const dispose = tooltipApiInvoker({
- glHandler: element => tooltipsApp().dispose(element),
- bsHandler: elements => invokeBootstrapApi(elements, 'dispose'),
+ glHandler: (element) => tooltipsApp().dispose(element),
+ bsHandler: (elements) => invokeBootstrapApi(elements, 'dispose'),
});
export const fixTitle = tooltipApiInvoker({
- glHandler: element => tooltipsApp().fixTitle(element),
- bsHandler: elements => invokeBootstrapApi(elements, '_fixTitle'),
+ glHandler: (element) => tooltipsApp().fixTitle(element),
+ bsHandler: (elements) => invokeBootstrapApi(elements, '_fixTitle'),
});
export const enable = tooltipApiInvoker({
- glHandler: element => tooltipsApp().triggerEvent(element, 'enable'),
- bsHandler: elements => invokeBootstrapApi(elements, 'enable'),
+ glHandler: (element) => tooltipsApp().triggerEvent(element, 'enable'),
+ bsHandler: (elements) => invokeBootstrapApi(elements, 'enable'),
});
export const disable = tooltipApiInvoker({
- glHandler: element => tooltipsApp().triggerEvent(element, 'disable'),
- bsHandler: elements => invokeBootstrapApi(elements, 'disable'),
+ glHandler: (element) => tooltipsApp().triggerEvent(element, 'disable'),
+ bsHandler: (elements) => invokeBootstrapApi(elements, 'disable'),
});
export const hide = tooltipApiInvoker({
- glHandler: element => tooltipsApp().triggerEvent(element, 'close'),
- bsHandler: elements => invokeBootstrapApi(elements, 'hide'),
+ glHandler: (element) => tooltipsApp().triggerEvent(element, 'close'),
+ bsHandler: (elements) => invokeBootstrapApi(elements, 'hide'),
});
export const show = tooltipApiInvoker({
- glHandler: element => tooltipsApp().triggerEvent(element, 'open'),
- bsHandler: elements => invokeBootstrapApi(elements, 'show'),
+ glHandler: (element) => tooltipsApp().triggerEvent(element, 'open'),
+ bsHandler: (elements) => invokeBootstrapApi(elements, 'show'),
});
export const destroy = () => {
tooltipsApp().$destroy();