Files
pyrom/data/static/js/bits/progressive-enhancement.js

29 lines
515 B
JavaScript

export const b = {
init: 'enhance enhanceHide',
}
export function enhance(_, __, el) {
if (el === undefined) { // nothing to enhance but init still runs
return;
}
if (el.classList.contains('js-only')) {
el.classList.remove('js-only');
}
if (el.disabled) {
el.disabled = false;
if (el.title.search('JavaScript') !== -1) {
el.removeAttribute('title');
}
}
}
export function enhanceHide(_, __, el) {
if (el === undefined) {
return;
}
el.style.display = 'none';
}