Skip to content

Commit e0fd522

Browse files
Update page.js
1 parent 2c70484 commit e0fd522

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/documentation/templates/page.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,21 @@ dcmnt.addEventListener('DOMContentLoaded', () => {
376376
const sd = dcmnt.querySelector('.search');
377377
const sk = dcmnt.getElementById("search");
378378
const updateSD = (toggle = false) => {
379-
if(cooldown0)return;else{cooldown(300,0)};
380-
if (!toggle) {sd.innerHTML = ''};
379+
let run = true;
380+
if (cooldown0) run = false; else {
381+
cooldown(300,0)
382+
};
383+
if (!toggle && run) {sd.innerHTML = ''};
381384
const leftt = sb.offsetLeft + sb.parentElement.offsetLeft;
382385
const toppp = sb.parentElement.offsetTop + sb.offsetHeight - (sb.parentElement.offsetWidth == 0 ? 15 : 0);
383-
sd.style.left = `${leftt}px`;
384-
sd.style.top = `${toppp}px`;
385-
sd.style.width = `${sb.offsetWidth - 8*2}px`;
386-
sd.style.opacity = toggle ? 1 : 0;
387-
sd.style.pointerEvents = toggle ? 'all' : 'none';
388-
sd.style.setProperty('--sdfix', `calc(-${leftt}px + ${sb.offsetLeft}px)`);
386+
sd.style.left = run ? `${leftt}px` : sd.style.left;
387+
sd.style.top = run ? `${toppp}px` : sd.style.top;
388+
sd.style.width = run ? `${sb.offsetWidth - 8*2}px` : sd.style.width;
389+
if (run) {
390+
sd.style.opacity = toggle ? 1 : 0;
391+
sd.style.pointerEvents = toggle ? 'all' : 'none';
392+
sd.style.setProperty('--sdfix', `calc(-${leftt}px + ${sb.offsetLeft}px)`);
393+
}
389394

390395
sk.style.left = `${leftt + sb.offsetWidth}px`;
391396
sk.style.top = `${toppp - (sb.offsetHeight / 2)}px`;

0 commit comments

Comments
 (0)