Replace fomantic popup module with tippy.js (#20428)

- replace fomantic popup module with tippy.js
- fix chaining and add comment
- add 100ms delay to tooltips
- stopwatch improvments, raise default maxWidth
- update web_src/js/features/common-global.js
- use type=submit instead of js
This commit is contained in:
silverwind 2022-08-09 14:37:34 +02:00 committed by GitHub
parent 36f9ee5813
commit 1b2cd4c4e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 199 additions and 2129 deletions

View file

@ -1,16 +1,20 @@
import $ from 'jquery';
import {createTippy} from '../../modules/tippy.js';
const {csrfToken} = window.config;
export function initCompReactionSelector(parent) {
let reactions = '';
let selector = 'a.label';
if (!parent) {
parent = $(document);
reactions = '.reactions > ';
selector = `.reactions ${selector}`;
}
parent.find(`${reactions}a.label`).popup({position: 'bottom left', metadata: {content: 'title', title: 'none'}});
for (const el of parent[0].querySelectorAll(selector)) {
createTippy(el, {placement: 'bottom-start', content: el.getAttribute('data-title')});
}
parent.find(`.select-reaction > .menu > .item, ${reactions}a.label`).on('click', function (e) {
parent.find(`.select-reaction > .menu > .item, ${selector}`).on('click', function (e) {
e.preventDefault();
if ($(this).hasClass('disabled')) return;