From 1874ed6c7441a5933c4e5cafb06878a5ee3d1444 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 22 Sep 2020 15:41:29 +0200 Subject: [PATCH] Update TutorialSpace.js --- Spaces/TutorialSpace.js | 44 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/Spaces/TutorialSpace.js b/Spaces/TutorialSpace.js index e9e2bdc8e..3ce4d4526 100644 --- a/Spaces/TutorialSpace.js +++ b/Spaces/TutorialSpace.js @@ -324,21 +324,21 @@ function newTutorialSpace() { currentNode = previousNode findTutorialNode(currentNode) currentStatus = 'Playing Tutorial' - navigationStack.splice(navigationStack.length - 1) + navigationStack.splice(navigationStack.length - 1) break } case 'Tutorial Topic': { currentNode = previousNode findTutorialNode(currentNode) currentStatus = 'Playing Topic' - navigationStack.splice(navigationStack.length - 1) + navigationStack.splice(navigationStack.length - 1) break } case 'Tutorial Step': { currentNode = previousNode findTutorialNode(currentNode) currentStatus = 'Playing Step' - navigationStack.splice(navigationStack.length - 1) + navigationStack.splice(navigationStack.length - 1) break } } @@ -597,7 +597,7 @@ function newTutorialSpace() { } html = html + '
' if (nodeConfig.summary !== undefined && nodeConfig.summary !== '') { - html = html + '
' + nodeConfig.summary + '
' + html = html + '
' + addToolTips(nodeConfig.summary) + '
' } if (nodeConfig.subTitle !== undefined && nodeConfig.subTitle !== '') { html = html + '

' + nodeConfig.subTitle + '

' @@ -606,6 +606,7 @@ function newTutorialSpace() { html = html + '
' newGifName = nodeConfig.gif } + if (nodeConfig.definition !== undefined && nodeConfig.definition !== '') { html = html + '' html = html + '' @@ -616,52 +617,67 @@ function newTutorialSpace() { } html = html + '' html = html + '' html = html + '' html = html + '
' - html = html + '' + nodeConfig.definition + '' + html = html + '' + addToolTips(nodeConfig.definition) + '' html = html + '
' } if (nodeConfig.bulletListIntro !== undefined && nodeConfig.bulletListIntro !== '') { - html = html + '

' + nodeConfig.bulletListIntro + '

' + html = html + '

' + addToolTips(nodeConfig.bulletListIntro) + '

' } if (nodeConfig.bulletArray !== undefined) { html = html + '
    ' for (let i = 0; i < nodeConfig.bulletArray.length; i++) { let bullet = nodeConfig.bulletArray[i] html = html + '
  • ' - html = html + '

    ' + bullet[0] + ' ' + bullet[1] + '

    ' + html = html + '

    ' + addToolTips(bullet[0]) + ' ' + addToolTips(bullet[1]) + '

    ' html = html + '
  • ' } html = html + '
' } if (nodeConfig.paragraph1 !== undefined && nodeConfig.paragraph1 !== '') { - html = html + '

' + nodeConfig.paragraph1 + '

' + html = html + '

' + addToolTips(nodeConfig.paragraph1) + '

' } if (nodeConfig.callOut !== undefined && nodeConfig.callOut !== '') { - html = html + '
' + nodeConfig.callOut + '' + html = html + '
' + addToolTips(nodeConfig.callOut) + '' if (nodeConfig.externalLink !== undefined) { html = html + '' + nodeConfig.externalLink[0] + '' } html = html + '
' } if (nodeConfig.paragraph2 !== undefined && nodeConfig.paragraph2 !== '') { - html = html + '

' + nodeConfig.paragraph2 + '

' + html = html + '

' + addToolTips(nodeConfig.paragraph2) + '

' } if (nodeConfig.note !== undefined && nodeConfig.note !== '') { - html = html + '' + html = html + '' } if (nodeConfig.tip !== undefined && nodeConfig.tip !== '') { - html = html + '' + html = html + '' } if (nodeConfig.important !== undefined && nodeConfig.important !== '') { - html = html + '' + html = html + '' } if (nodeConfig.warning !== undefined && nodeConfig.warning !== '') { - html = html + '' + html = html + '' } html = html + '
' tutorialDiv.innerHTML = html + + function addToolTips(text) { + const TOOL_TIP_HTML = '
NODE_TYPENODE_DEFINITION
' + let resultingText = '' + let splittedText = text.split('->') + + for (let i = 0; i < splittedText.length; i = i + 2) { + let firstPart = splittedText[i] + let nodeType = splittedText[i + 1] + if (nodeType === undefined ) {return resultingText + firstPart} + let tooltip = TOOL_TIP_HTML.replace('NODE_TYPE', nodeType).replace('NODE_DEFINITION', 'La concha del mono, lo logre!') + resultingText = resultingText + firstPart + tooltip + } + return resultingText + } } function draw() {