Neaten comment header. Copied merged changes through to example code. Updated example code to demonstrate new functionality.
parent
d92c649909
commit
9763085df2
|
@ -47,7 +47,7 @@
|
|||
<li>
|
||||
Food
|
||||
<ul>
|
||||
<li>Beer</li>
|
||||
<li id="beer">Beer</li>
|
||||
<li>Vegetables
|
||||
<ul>
|
||||
<li>Pumpkin</li>
|
||||
|
@ -57,7 +57,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Fruit
|
||||
<li class="fruit">Fruit
|
||||
<ul>
|
||||
<li>Apple
|
||||
<ul>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Based on the work of Mark Lee
|
||||
* http://www.capricasoftware.co.uk
|
||||
*
|
||||
* ID implementation fixed by Adrian Hinz
|
||||
*
|
||||
* This software is licensed under the Creative Commons Attribution-ShareAlike
|
||||
* 3.0 License.
|
||||
*
|
||||
|
@ -81,8 +83,14 @@
|
|||
.children("ul,li")
|
||||
.remove()
|
||||
.end();
|
||||
|
||||
var attr = li.attr('id');
|
||||
if (typeof attr !== 'undefined' && attr !== false) {
|
||||
return li.attr("id") == targetNode.attr("id");
|
||||
}
|
||||
else {
|
||||
return li.html() == targetNode.html();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var sourceLi = $('li').filter(function(){
|
||||
|
@ -91,8 +99,14 @@
|
|||
.children("ul,li")
|
||||
.remove()
|
||||
.end();
|
||||
|
||||
var attr = li.attr('id');
|
||||
if (typeof attr !== 'undefined' && attr !== false) {
|
||||
return li.attr("id") == sourceNode.attr("id");
|
||||
}
|
||||
else {
|
||||
return li.html() == sourceNode.html();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var sourceliClone = sourceLi.clone();
|
||||
|
@ -104,11 +118,21 @@
|
|||
sourceUl.remove();
|
||||
}
|
||||
|
||||
var id = sourceLi.attr("id");
|
||||
|
||||
if(targetLi.children('ul').size() >0){
|
||||
if (typeof id !== 'undefined' && id !== false) {
|
||||
targetLi.children('ul').append('<li id="'+id+'">'+sourceliClone.html()+'</li>');
|
||||
}else{
|
||||
targetLi.children('ul').append('<li>'+sourceliClone.html()+'</li>');
|
||||
}
|
||||
}else{
|
||||
if (typeof id !== 'undefined' && id !== false) {
|
||||
targetLi.append('<ul><li id="'+id+'">'+sourceliClone.html()+'</li></ul>');
|
||||
}else{
|
||||
targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');
|
||||
}
|
||||
}
|
||||
|
||||
}); // handleDropEvent
|
||||
|
||||
|
@ -146,7 +170,12 @@
|
|||
.end()
|
||||
.html();
|
||||
|
||||
var new_node_id = $node.attr("id")
|
||||
if (typeof new_node_id !== 'undefined' && new_node_id !== false) {
|
||||
$nodeDiv = $("<div>").addClass("node").attr("id", $node.attr("id")).append($nodeContent);
|
||||
}else{
|
||||
$nodeDiv = $("<div>").addClass("node").append($nodeContent);
|
||||
}
|
||||
|
||||
// Expand and contract nodes
|
||||
if ($childNodes.length > 0) {
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
* Based on the work of Mark Lee
|
||||
* http://www.capricasoftware.co.uk
|
||||
*
|
||||
* ID implementation by Aleks Drevenšek
|
||||
*
|
||||
* ID implementation fixed(changed) by Adrian Hinz
|
||||
* ID implementation fixed by Adrian Hinz
|
||||
*
|
||||
* This software is licensed under the Creative Commons Attribution-ShareAlike
|
||||
* 3.0 License.
|
||||
|
|
Loading…
Reference in New Issue