Skip to content

Commit 244e4fd

Browse files
committed
Finished user input.
1 parent 6703fe8 commit 244e4fd

File tree

2 files changed

+37
-24
lines changed

2 files changed

+37
-24
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
</div>
8383
<div class="form-group">
8484
<label for="first-row-header">Make first row column headers:</label>
85-
<input id="first-row-header" type="checkbox" name="fr-headers"><br>
85+
<input id="first-row-header" type="checkbox" name="fr-headers" checked><br>
8686
</div>
8787
<div class="form-group">
8888
<label for="first-row-include">Include first row along with colum headers:</label>
@@ -122,7 +122,7 @@
122122
</div>
123123
<div class="form-group">
124124
<label for="quotes">Treat quoted text as a single cell:</label>
125-
<input id="quotes" type="checkbox" name="quotes"><br>
125+
<input id="quotes" type="checkbox" name="quotes" checked><br>
126126
</div>
127127
<br/><br/>
128128
</form>

js/index.js

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,34 +105,47 @@ function isSM(){
105105
* of the method call.
106106
*/
107107
function getUserInput() {
108-
var userInput = {};
109-
110-
userInput.maxRows = getFMaxRows();
111-
userInput.encoding = getFEncoding();
112-
userInput.columnSeparator = getFColumnSeparator();
113-
userInput.useQuotes = isFUseQuotes();
108+
var userInput = {};
109+
110+
userInput.maxRows = getMaxRows();
111+
userInput.encoding = getEncoding();
112+
userInput.columnSeparator = getColumnSeparator();
113+
userInput.useQuotes = useQuotes();
114+
userInput.firstRowHeaders = firstRowHeaders();
115+
userInput.firstRowInlcude = firstRowInclude();
116+
userInput.files = getFiles();
114117

115-
return userInput;
116-
}
117-
118-
function getFMaxRows(){
119-
return $("#max-rows").val() === "" ? "0" : $("#max-rows").val();
120-
}
118+
function getMaxRows(){
119+
return $("#max-rows").val() === "" ? "0" : $("#max-rows").val();
120+
}
121121

122-
function getFEncoding(){
123-
return $("#encoding").val();
124-
}
122+
function getEncoding(){
123+
return $("#encoding").val();
124+
}
125125

126-
function getFColumnSeparator(){
127-
return $("#column-separator").val();
128-
}
126+
function getColumnSeparator(){
127+
return $("#column-separator").val();
128+
}
129129

130-
function isFUseQuotes(){
131-
return $("#quotes").val();
130+
function useQuotes(){
131+
return $("#quotes").is(":checked");
132+
}
133+
134+
function firstRowHeaders(){
135+
return $("#first-row-header").is(":checked");
136+
}
137+
138+
function firstRowInclude(){
139+
return $("#first-row-include").is(":checked");
140+
}
141+
142+
function getFiles(){
143+
return $("#upload").prop('files');
144+
}
145+
146+
return userInput;
132147
}
133148

134149
$("#go").click(function (){
135-
userInput = getUserInput();
136150

137-
alert(userInput.maxRows + "\n" + userInput.encoding + "\n" + userInput.columnSeparator + "\n" + userInput.useQuotes);
138151
});

0 commit comments

Comments
 (0)