MCPcopy Index your code
hub / github.com/JKPotato-Computer/SignMaker / init

Function init

js/main.js:22–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 // Initialize the application, and populates dropdowns and the default post.
21
22 const init = function() {
23 // Create the post on which to place panels
24 post = new Post(Post.prototype.polePositions[0]);
25
26 // Populate post position options
27 const postPositionSelectElmt = document.getElementById("postPosition");
28 for (const polePosition of Post.prototype.polePositions) {
29 lib.appendOption(postPositionSelectElmt, polePosition, {
30 selected: (polePosition == "Left")
31 });
32 }
33
34
35 // Populate color options
36 const colorSelectElmt = document.getElementById("panelColor");
37 for (const color in lib.colors) {
38 lib.appendOption(colorSelectElmt, color, {
39 text: color
40 });
41 }
42
43 const cornerTypeSelectElmt = document.getElementById("panelCorner");
44 for (const corner of Panel.prototype.cornerType) {
45 lib.appendOption(cornerTypeSelectElmt, corner, {
46 selected: (corner == "Round")
47 });
48 }
49
50
51 // Populate exit tab position options
52 const exitTabPositionSelectElmt = document.getElementById("exitTabPosition");
53 for (const position of ExitTab.prototype.positions) {
54 lib.appendOption(exitTabPositionSelectElmt, position, {
55 selected: (position == "Right")
56 });
57 }
58
59 // Populate exit tab width options
60 const exitTabWidthSelectElmt = document.getElementById("exitTabWidth");
61 for (const width of ExitTab.prototype.widths) {
62 lib.appendOption(exitTabWidthSelectElmt, width, {
63 selected: (width == "Narrow")
64 });
65 }
66
67 // Populate the exit color options
68 const exitColorSelectElement = document.getElementById("exitColor");
69 for (const exitColor of ExitTab.prototype.colors) {
70 lib.appendOption(exitColorSelectElement, exitColor);
71 }
72
73 // Populate the exit variants
74 const exitVariantSelectElmt = document.getElementById("exitVariant");
75 for (const exitVariant of ExitTab.prototype.variants) {
76 lib.appendOption(exitVariantSelectElmt, exitVariant)
77 }
78
79 // Populate the exit icons

Callers

nothing calls this directly

Calls 2

updatePreviewFunction · 0.85
newPanelFunction · 0.70

Tested by

no test coverage detected