mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-31 23:33:08 +08:00
Improve "goto issue by number" button (#24577)
Follow #24479      --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import {debounce} from 'throttle-debounce';
|
||||
|
||||
function elementsCall(el, func, ...args) {
|
||||
if (typeof el === 'string' || el instanceof String) {
|
||||
el = document.querySelectorAll(el);
|
||||
@ -42,6 +44,13 @@ export function toggleElem(el, force) {
|
||||
elementsCall(el, toggleShown, force);
|
||||
}
|
||||
|
||||
export function isElemHidden(el) {
|
||||
const res = [];
|
||||
elementsCall(el, (e) => res.push(e.classList.contains('gt-hidden')));
|
||||
if (res.length > 1) throw new Error(`isElemHidden doesn't work for multiple elements`);
|
||||
return res[0];
|
||||
}
|
||||
|
||||
export function onDomReady(cb) {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', cb);
|
||||
@ -170,3 +179,7 @@ export function autosize(textarea, {viewportMarginBottom = 0} = {}) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function onInputDebounce(fn) {
|
||||
return debounce(300, fn);
|
||||
}
|
||||
|
Reference in New Issue
Block a user