Skip to content

Commit bef9e8f

Browse files
author
Kevin Nadro
committed
more!
figuring out how all of this stuff works, still very confused on where to include javascript files and how to access the code through all the modules
1 parent 73f5da4 commit bef9e8f

File tree

5 files changed

+47
-12
lines changed

5 files changed

+47
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
var logger = new LogTracer();

index.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,16 @@ <h3>
131131
<div>
132132
<div>
133133
# of Rows:
134-
<input id="numRows" type="number" value="0">
134+
<input id="numRows" type="number" value="5">
135135
</div>
136136

137137
<div>
138138
# of Columns:
139-
<input id="numColumns" type="number" value="0">
139+
<input id="numColumns" type="number" value="5">
140+
</div>
141+
142+
<div>
143+
<button id="button-2DMatrix">Create 2DMatrix</button>
140144
</div>
141145
</div>
142146
</div>

js/create/index.js

+37-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
11
'use strict';
22

3-
var sandbox = require('./sb');
3+
const modules = require('../module');
44

5-
const CAT = () => {
6-
console.log("DOG");
5+
const getNumRows = () => {
6+
var row_field = document.getElementById("numRows");
7+
return row_field.value;
78
};
89

10+
const getNumColumns = () => {
11+
var column_field = document.getElementById("numColumns");
12+
return column_field.value;
13+
};
14+
15+
const fauxData = (r, c) => {
16+
var arr = new Array(r);
17+
for (var i = 0; i < c; i++) {
18+
arr[i] = new Array(c);
19+
}
20+
21+
for (var i = 0; i < r; i++) {
22+
for(var j = 0; j < c; j++){
23+
arr[i][j] = 0;
24+
}
25+
}
26+
return arr;
27+
};
28+
29+
const setupButtons = () => {
30+
31+
var button_2DMatrix = document.getElementById("button-2DMatrix");
32+
button_2DMatrix.addEventListener('click',function(){
33+
var arr2DTracer = new modules.Array2DTracer();
34+
var numRows = getNumRows();
35+
var numColumns = getNumColumns();
36+
var data = fauxData(numRows, numColumns);
37+
console.log(data);
38+
arr2DTracer.setData(data);
39+
},false);
40+
};
941

1042
module.exports = {
11-
CAT
12-
}
43+
setupButtons
44+
};

js/create/sb.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

3-
const PRINT = () => {
4-
console.log("hiya");
5-
};
63

74
module.exports = {
8-
PRINT
5+
96
};

js/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ $(() => {
7373
} else {
7474
DOM.showFirstAlgorithm();
7575
}
76+
77+
Sandbox.setupButtons();
78+
7679
});
7780

7881
Server.loadWikiList().then((data) => {

0 commit comments

Comments
 (0)