Last active
December 25, 2015 11:08
-
-
Save sonOfRa/6966202 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Unmerge the specified <td> element | |
* @param td td to unmerge | |
*/ | |
function unmerge(td) { | |
var colspan = td.attr("colspan"); | |
td.attr("colspan", 1); | |
var id = td.attr("id").split("x"); | |
for (var i = colspan - 1; i > 0; i--) { | |
var tdclass = td.attr("class"); | |
var tdid = id[0] + "x" + (parseInt(id[1]) + i); | |
var div = td.children().first(); | |
var divclass = div.attr("class"); | |
var divcontent = div.text(); | |
var newTD = "<td class=\"" + tdclass + "\" colspan=\"" + 1 + "\" id=\"" + tdid + "\">" + | |
"<div class=\"" + divclass + "\">" + | |
divcontent + | |
"</div>" + | |
"</td>"; | |
console.log(newTD); | |
td.after(newTD); | |
$("#" + tdid).droppable(timetableDroppable); | |
$("#" + tdid).children().click(onclick).draggable({ | |
revert: true | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment