Skip to content

Instantly share code, notes, and snippets.

@amundo
Created April 19, 2014 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amundo/11100956 to your computer and use it in GitHub Desktop.
Save amundo/11100956 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>page</title>
<meta charset=utf-8>
</head>
<body>
<div id="airplane">
<form class="col-md-8 form-horizontal">
<fieldset>
<div class="form-group">
<label for="" class="col-lg-2 control-label">Keyword</label>
<div class="col-lg-10">
<input class="form-control" class="inputWord" placeholder="Word" type="text">
</div>
</div>
<div class="form-group">
<label for="inputOrthographic" class="col-lg-2 control-label">Orthographic</label>
<div class="col-lg-10">
<input class="form-control" class="inputOrthographic" placeholder="Orthographic" type="orthographic">
</div>
</div>
<div class="form-group">
<label for="inputPhonetic" class="col-lg-2 control-label">Phonetic</label>
<div class="col-lg-10">
<input class="form-control" class="inputPhonetic" placeholder="Phonetic" type="phonetic">
</div>
</div>
<div class="form-group">
<label for="textArea" class=comment class="col-lg-2 control-label">Comment</label>
<div class="col-lg-10">
<textarea class="form-control" rows="3" id="textArea"></textarea>
<span class="help-block">Anything else you’d like to share about this word?</span>
</div>
</div>
</fieldset>
</form>
</div>
<!--word from section end-->
</body>
</html>
var word = {}; // an empty object to represent the word
// actually we'll iterate trhough all these but just to get the idea…
word.word = $('#airplane .inputWord').val();
word.orthographic = $('#airplane .inputWord').val();
word.phonetic = $('#airplane .inputWord').val();
word.comment = $('#airplane .textareaComment').val();
// now we get the equivalent of a python dict:
/*
var airplane = {
"word": "airplane",
"orthographic": "avión",
"phonetic": "aβiˈon",
"comment": "This is a comment about the Spanish word for airplane."
}
*/
// Then once we've done this for each word, we'll push them onto a lexicon array, something like:
var lexicon = [ airplane, train ] // etc
// and print it to a JSON file. maybe we can use: https://github.com/eligrey/FileSaver.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment