varcurrently_dragging=null;// if this is null, we have nothing being dragged. if it's not null, then it will represent the glyph object (as goes in the glyphs array) which is currently being dragged
// this function expects that there's a #consonant-grid table, where each row corresponds to a glyph set
// the cells of the row need to be filled with the various possible configurations of that glyph
// so like, the <th> in a given row should contain a .megaglyph svg group, which contains the base glyph plus all possible radicals.
// then we use the split_megaglyph function to generate the five possible configurations out of that megaglyph
// and insert the five configured glyphs into their corresponding (td) cells of the table
$("#consonant-grid tbody tr").each(function(asdf,row){// iterate over the rows in the table
// row will now be something like <tr><th/><td/><td/><td/><td/><td/><th/></tr>
// that is, a tr containing one th on either end plus a td for each consonant in this row
varhead=$(row).find("th:first-child svg");// this is the header for the row, which should contain the .megaglyph object
varmegaglyph=head.find(".megaglyph");
varglyphs=split_megaglyph(megaglyph);// now this is a list of the configured consonant symbols
$(row).find("td").each(function(idx,cell){// iterate over the cells in the row
// cell will now be a <td> cell which contains the IPA for that cell's consonants, plus the <svg> canvas into which to insert the configured consonant symbol
$(cell).find("svg").append(glyphs[idx]);
});
});
}
functionsplit_megaglyph(megaglyph){
// megaglyph is an svg object which contains all the possible radicals at once.
// this should return a list of new glyphs, cloned frmo megaglyph, each of which contains only the radicals it wants.
varone=megaglyph.clone();
one.find('.line_1,.line_2,.line_3,.dot_2,.dot_3').remove();// only .dot_1
remove_class(one,"megaglyph");
vartwo=megaglyph.clone();
two.find('.line_2,.line_3,.dot_1,.dot_2,.dot_3').remove();// line 1 only
remove_class(two,"megaglyph");
varthree=megaglyph.clone();
three.find('.line_1,.line_2,.line_3,.dot_1').remove();// only dots 2 and 3
remove_class(three,"megaglyph");
varfour=megaglyph.clone();
four.find('.line_1,.dot_1,.dot_2,.dot_3').remove();//lines 2 and 3
remove_class(four,"megaglyph");
varfive=megaglyph.clone();
five.find('.line_1,.line_2,.line_3').remove();// all three dots
// this is called on the whole document when the mouse is released on it. event.data is meaningless. this should handle releasing the current dragged element, if it exists.