Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// this is just a part
var serializeWords = function() {
var log = function(x) {console.log(x);}
var textarea = $('<textarea />').attr('id','wordsContainer');
$('body').append(textarea);
var vocabsSize = vocabs.length;
//log(vocabsSize);
for(var i = 1; i < vocabsSize; i++) {
var crntTr = $('#datatable').find('tr').eq(i),
wordText = crntTr.find('td').eq(0).text(),
meaningText = crntTr.find('td').eq(1).text(),
soundText = crntTr.find('td').eq(2).text(),
classText = crntTr.find('td').eq(3).text(),
categoryText = crntTr.find('td').eq(4).text();
levelText = crntTr.find('td').eq(5).text();
if(soundText.slice(-1) == "'") {
//log(soundText);
soundText = soundText.slice(0, -1);
//log(soundText);
}
//log(crntTr);
var text = "Word.create(:word => '"+wordText+"', :sound => '" + soundText + "', :meaning => '"+meaningText +"', :category => '"+ classText+"', :group => '" + categoryText+"', :level => "+levelText+")\n";
//log(text);
textarea.append(text);
}
}
serializeWords();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment