MCPcopy Create free account
hub / github.com/MathMan05/Fermi / generateHTML

Method generateHTML

src/webpage/settings.ts:631–699  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

629 return div;
630 }
631 async popUpSearchBox(x: number, y: number, done: () => void) {
632 const searchBox = document.createElement("div");
633 searchBox.style.top = y + "px";
634 searchBox.style.left = x + "px";
635 searchBox.classList.add("amsBox");
636 const input = document.createElement("input");
637 input.type = "text";
638
639 const reses = document.createElement("div");
640 reses.classList.add("flexttb", "reses");
641 searchBox.append(input, reses);
642 let opts = [] as searchRes[];
643 const search = async () => {
644 const res = await this.searchFunc(input.value || "", this.value);
645 reses.textContent = "";
646 opts = res;
647 for (const opt of opts) {
648 const span = document.createElement("span");
649 span.textContent = opt.name;
650 span.onmousedown = () => {
651 removeAni(searchBox);
652 this.value.push(opt.value);
653 this.nmap.push(opt.name);
654 done();
655 };
656 reses.append(span);
657 }
658 input.onblur = async () => {
659 removeAni(searchBox);
660 };
661 };
662
663 input.onkeyup = (e) => {
664 if (e.key === "Enter" && opts[0]) {
665 removeAni(searchBox);
666 this.value.push(opts[0].value);
667 this.nmap.push(opts[0].name);
668 done();
669 } else {
670 search();
671 }
672 };
673
674 search();
675 document.body.append(searchBox);
676 input.focus();
677 }
678 submit() {
679 this.onSubmit(this.value);
680 }
681 onchange: (str: string[]) => void = (_) => {};
682 watchForChange(func: (str: string[]) => void) {
683 this.onchange = func;
684 }
685}
686class SelectInput implements OptionsElement<number> {
687 readonly label: string;
688 readonly owner: Options;

Callers

nothing calls this directly

Calls 3

onChangeMethod · 0.95
addMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected