|
@@ -422,7 +422,7 @@ var idTree = {
|
|
|
}
|
|
|
})();
|
|
|
Tree.prototype.newNodeID = function () {
|
|
|
- if (this.rangeNodeID() === -1) {
|
|
|
+ if (this.rangeNodeID() == -1) {
|
|
|
return this.maxNodeID() + 1;
|
|
|
} else {
|
|
|
if (this.maxNodeID() < this.rangeNodeID()) {
|
|
@@ -460,7 +460,7 @@ var idTree = {
|
|
|
// set parent by pid, set nextSibling by nid
|
|
|
datas.forEach(function (data) {
|
|
|
node = that.nodes[prefix + data[that.setting.id]];
|
|
|
- if (data[that.setting.pid] === that.setting.rootId) {
|
|
|
+ if (data[that.setting.pid] == that.setting.rootId) {
|
|
|
that.roots.push(node);
|
|
|
} else {
|
|
|
parent = that.nodes[prefix + data[that.setting.pid]];
|
|
@@ -500,8 +500,8 @@ var idTree = {
|
|
|
|
|
|
Tree.prototype.insert = function (parentID, nextSiblingID) {
|
|
|
var newID = this.newNodeID(), node = null, data = {};
|
|
|
- var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
- var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
|
|
|
+ var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
+ var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
|
|
|
if (newID !== -1) {
|
|
|
data = {};
|
|
|
data[this.setting.id] = newID;
|
|
@@ -522,8 +522,8 @@ var idTree = {
|
|
|
Tree.prototype.getInsertData = function (parentID, nextSiblingID) {
|
|
|
var data = [];
|
|
|
var newID = this.newNodeID();
|
|
|
- var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
- var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
|
|
|
+ var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
+ var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
|
|
|
if (newID !== -1) {
|
|
|
data.push({type: 'new', data: this.getDataTemplate(newID, parent ? parent.getID() : this.setting.rootId, nextSibling ? nextSibling.getID() : this.setting.rootId)});
|
|
|
|
|
@@ -538,8 +538,8 @@ var idTree = {
|
|
|
return data;
|
|
|
};
|
|
|
Tree.prototype.insertByData = function (data, parentID, nextSiblingID) {
|
|
|
- var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
- var nextSibling = nextSiblingID === -1 ? null : this.nodes[this.prefix + nextSiblingID];
|
|
|
+ var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
+ var nextSibling = nextSiblingID == -1 ? null : this.nodes[this.prefix + nextSiblingID];
|
|
|
var node = this.nodes[this.prefix + data[this.setting.id]];
|
|
|
if (node) {
|
|
|
return node;
|