This commit is contained in:
silverwind 2024-04-26 23:20:17 +02:00
parent ea07720a9b
commit 623da66687
No known key found for this signature in database
GPG Key ID: 2E62B41C93869443
2 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,7 @@
.ui.dimmer {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
@ -12,6 +13,8 @@
overflow-y: auto;
justify-content: center;
padding: 8px 0;
transition: opacity 1s ease;
user-select: none;
}
.ui.active.dimmer {
@ -21,5 +24,5 @@
.ui.dimmer > * {
position: static;
margin: auto !important;
margin: auto 0 !important;
}

View File

@ -1,24 +1,27 @@
import $ from 'jquery';
import {showElem, hideElem, queryElemChildren} from '../../utils/dom.js';
import {queryElemChildren} from '../../utils/dom.js';
export function initFomanticDimmer() {
// stand-in for removed dimmer module
$.fn.dimmer = function (arg0, $el) {
if (arg0 === 'add content') {
this._dimmer = document.createElement('div');
queryElemChildren(document.body, '.ui.dimmer', (el) => el.remove());
this._dimmer.classList.add('ui', 'dimmer', 'tw-hidden');
const existingDimmer = document.querySelector('body > .ui.dimmer');
if (existingDimmer) {
queryElemChildren(existingDimmer, '*', (el) => el.remove());
this._dimmer = existingDimmer;
} else {
this._dimmer = document.createElement('div');
this._dimmer.classList.add('ui', 'dimmer');
document.body.append(this._dimmer);
}
this._dimmer.append($el[0]);
document.body.append(this._dimmer);
} else if (arg0 === 'get dimmer') {
return $(this._dimmer);
} else if (arg0 === 'show') {
this._dimmer.classList.add('active');
showElem(this._dimmer);
document.body.classList.add('tw-overflow-hidden');
} else if (arg0 === 'hide') {
this._dimmer.classList.remove('active');
hideElem(this._dimmer);
document.body.classList.remove('tw-overflow-hidden');
}
return this;