Episode Panels

This commit is contained in:
Luis Fernando Molina committed 2020-07-29 11:16:43 +02:00
1 parent 02cd6b70fd
commit 53a82c19c4
92 files changed
+22951 -22948

No files matched your search

@@ -1,67 +1,67 @@
function newNodeChildren () {
thisObject = {
childrenCount: childrenCount
}
return thisObject
function childrenCount (parentNode, childNode) {
return countChildrenUiObject(parentNode, childNode)
}
function countChildrenUiObject (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
function newNodeChildren() {
thisObject = {
childrenCount: childrenCount
}
let parentNodeDefinition = getNodeDefinition (parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < parentNodeDefinition.properties.length; i++) {
let property = parentNodeDefinition.properties[i]
if (parentNode[property.name] !== undefined) {
switch (property.type) {
case 'node': {
if (property.name !== previousPropertyName) {
response.childrenCount++
if (parentNode[property.name].id === childNode.id) {
response.childIndex = response.childrenCount
}
previousPropertyName = property.name
}
}
break
case 'array': {
let nodeDefinition = getNodeDefinition (childNode)
if (nodeDefinition !== undefined) {
let nodePropertyArray = parentNode[property.name]
for (let j = 0; j < nodePropertyArray.length; j++) {
let child = nodePropertyArray[j]
if (nodeDefinition.chainedToSameType === true) {
if (j < 1) {
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
} else {
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
}
}
break
}
}
return thisObject
function childrenCount(parentNode, childNode) {
return countChildrenUiObject(parentNode, childNode)
}
function countChildrenUiObject(parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
}
}
let parentNodeDefinition = getNodeDefinition(parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
return response
}
for (let i = 0; i < parentNodeDefinition.properties.length; i++) {
let property = parentNodeDefinition.properties[i]
if (parentNode[property.name] !== undefined) {
switch (property.type) {
case 'node': {
if (property.name !== previousPropertyName) {
response.childrenCount++
if (parentNode[property.name].id === childNode.id) {
response.childIndex = response.childrenCount
}
previousPropertyName = property.name
}
}
break
case 'array': {
let nodeDefinition = getNodeDefinition(childNode)
if (nodeDefinition !== undefined) {
let nodePropertyArray = parentNode[property.name]
for (let j = 0; j < nodePropertyArray.length; j++) {
let child = nodePropertyArray[j]
if (nodeDefinition.chainedToSameType === true) {
if (j < 1) {
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
} else {
response.childrenCount++
if (child.id === childNode.id) {
response.childIndex = response.childrenCount
}
}
}
}
}
break
}
}
}
}
}
return response
}
}