1
0
Fork 0
forked from forgejo/forgejo

Init popup for new code comment (#20234)

- Initialize the popup for the tooltip inside the new code comment.
- This works and is good enough to have this issue fixed for 1.17


Fix #20068
This commit is contained in:
Gusted 2022-07-05 14:28:31 +02:00 committed by GitHub
parent f5c97172f0
commit ed13d7aadf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View file

@ -75,6 +75,20 @@ export function initGlobalButtonClickOnEnter() {
});
}
export function initPopup(target) {
const $el = $(target);
const attr = $el.attr('data-variation');
const attrs = attr ? attr.split(' ') : [];
const variations = new Set([...attrs, 'inverted', 'tiny']);
$el.attr('data-variation', [...variations].join(' ')).popup();
}
export function initGlobalPopups() {
$('.tooltip').each((_, el) => {
initPopup(el);
});
}
export function initGlobalCommon() {
// Show exact time
$('.time-since').each(function () {
@ -121,15 +135,6 @@ export function initGlobalCommon() {
$('.ui.checkbox').checkbox();
// init popups
$('.tooltip').each((_, el) => {
const $el = $(el);
const attr = $el.attr('data-variation');
const attrs = attr ? attr.split(' ') : [];
const variations = new Set([...attrs, 'inverted', 'tiny']);
$el.attr('data-variation', [...variations].join(' ')).popup();
});
$('.top.menu .tooltip').popup({
onShow() {
if ($('.top.menu .menu.transition').hasClass('visible')) {