1
0
Fork 0
forked from forgejo/forgejo

Cleanup and use global style on popups (#17674)

* Cleanup and use global style on popups

- Fix typo 'poping' to 'popping'
- Remove most inline 'data-variation' attributes
- Initialize all popups with 'inverted tiny' variation

* misc tweaks

* rename to .tooltip, use jQuery

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind 2021-11-18 04:26:50 +01:00 committed by GitHub
parent c98dd7a3e0
commit 6874fe90e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 129 additions and 121 deletions

View file

@ -62,9 +62,8 @@ export function initGlobalCommon() {
// Show exact time
$('.time-since').each(function () {
$(this)
.addClass('poping up')
.addClass('tooltip')
.attr('data-content', $(this).attr('title'))
.attr('data-variation', 'inverted tiny')
.attr('title', '');
});
@ -88,7 +87,7 @@ export function initGlobalCommon() {
$('.jump.dropdown').dropdown({
action: 'hide',
onShow() {
$('.poping.up').popup('hide');
$('.tooltip').popup('hide');
},
fullTextSearch: 'exact'
});
@ -104,8 +103,17 @@ export function initGlobalCommon() {
$('.ui.progress').progress({
showActivity: false
});
$('.poping.up').attr('data-variation', 'inverted tiny').popup();
$('.top.menu .poping.up').popup({
// 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')) {
return false;