MCPcopy Create free account
hub / github.com/JKPotato-Computer/SignMaker / updateForm

Function updateForm

js/main copy.js:666–788  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

664 * Update the fields in the form to the values of the currently selected panel.
665 */
666 const updateForm = function() {
667 const panel = post.panels[currentlySelectedPanelIndex];
668
669 const panelList = document.getElementById("panelList");
670
671 while (panelList.firstChild) {
672 panelList.removeChild(panelList.lastChild);
673 }
674
675 for (let panelIndex = 0, panelsLength = post.panels.length; panelIndex < panelsLength; panelIndex++) {
676 var new_button = document.createElement("input");
677 new_button.type = "button";
678 new_button.id = "edit" + (panelIndex + 1);
679 new_button.value = "Panel " + (panelIndex + 1);
680 new_button.addEventListener("click", function() {
681 changeEditingPanel(panelIndex);
682 });
683 panelList.appendChild(new_button);
684 }
685
686 document.getElementById("panelNumberLabel").innerHTML = "Panel " + String(currentlySelectedPanelIndex + 1);
687
688
689 const panelColorSelectElmt = document.getElementById("panelColor");
690 for (const option of panelColorSelectElmt.options) {
691 if (option.value == panel.color) {
692 option.selected = true;
693 break;
694 }
695 }
696
697 const panelCornerSelectElmt = document.getElementById("panelCorner");
698 for (const option of panelCornerSelectElmt.options) {
699 if (option.value == panel.corner) {
700 option.selected = true;
701 break;
702 }
703 }
704
705 const exitNumberElmt = document.getElementById("exitNumber");
706 exitNumberElmt.value = panel.exitTab.number;
707
708 const exitTabPositionSelectElmt = document.getElementById("exitTabPosition");
709 for (const option of exitTabPositionSelectElmt.options) {
710 if (option.value == panel.exitTab.position) {
711 option.selected = true;
712 break;
713 }
714 }
715
716 const exitTabWidthSelectElmt = document.getElementById("exitTabWidth");
717 for (const option of exitTabWidthSelectElmt.options) {
718 if (option.value == panel.exitTab.width) {
719 option.selected = true;
720 break;
721 }
722 }
723

Callers 5

newPanelFunction · 0.70
duplicatePanelFunction · 0.70
deletePanelFunction · 0.70
changeEditingPanelFunction · 0.70
importDataFunction · 0.70

Calls 2

changeEditingPanelFunction · 0.70
updateShieldSubformFunction · 0.70

Tested by

no test coverage detected