Tool Tips

This commit is contained in:
Luis Fernando Molina committed 2020-09-22 18:20:13 +02:00
1 parent 41f322f471
commit 67e28af912
8 files changed
+15097 -35

No files matched your search

+1
View File
@@ -39,6 +39,7 @@ PATH_TO_FILES_COMPONENT=./Files-Component/src
PATH_TO_WEB_SERVER=./BackendServers/
APP_SCHEMA_PATH=./
DOC_SCHEMA_PATH=./
DEFAULT_WORKSPACE_PATH=./Includes/Workspaces
MY_WORKSPACES_PATH=./My-Workspaces
PATH_TO_FONTS=./BackendServers/WebServer/Fonts
+3 -3
View File
@@ -14646,7 +14646,7 @@
"config": true
},
"initialValues": {
"config": "{ \n\"title\": \"\",\n \"summary\": \"\",\n \"subTitle\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"documentationURL\": \"\" \n}"
"config": "{ \n\"title\": \"\",\n \"summary\": \"\",\n \"subTitle\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"documentationURL\": \"\" \n}"
},
"isTitleAllwaysVisible": true,
"isHierarchyHead": true,
@@ -14716,7 +14716,7 @@
"config": true
},
"initialValues": {
"config": "{ \n\"title\": \"\",\n \"summary\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"documentationURL\": \"\" \n}"
"config": "{ \n\"title\": \"\",\n \"summary\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"documentationURL\": \"\" \n}"
},
"referenceAttachesTo": {
"compatibleTypes": "->*Any Node*->",
@@ -14779,7 +14779,7 @@
"config": true
},
"initialValues": {
"config": "{ \n \"subTitle\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"documentationURL\": \"\" \n}"
"config": "{ \n \"subTitle\": \"\",\n \"gif\": \"\",\n \"image\": \"\",\n \"definition\": \"\",\n \"bulletListIntro\": \"\",\n \"bulletArray\": \n[\n [\"\", \"\"], \n[\"\", \"\"], \n[\"\", \"\"] \n],\n \"paragraph1\": \"\",\n \"callOut\": \"\",\n \"externalLink\": [\"\", \"\"],\n \"paragraph2\": \"\",\n \"note\": \"\",\n \"tip\": \"\",\n \"important\": \"\",\n \"warning\": \"\", \n \"position\": \"\",\n \"slider\": \"toTop\",\n \"pressButton\": \"\",\n \"documentationURL\": \"\" \n}"
},
"referenceAttachesTo": {
"compatibleTypes": "->*Any Node*->",
+1
View File
@@ -28,6 +28,7 @@ function newAppLoader() {
'Globals.js',
'AppSchema.js',
'DocSchema.js',
'Workspace.js',
'ChartingSpace/EdgeEditor.js',
+48
View File
@@ -243,4 +243,52 @@
width: 95%;
margin-left: auto;
margin-right: auto;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 240px;
background-color: #0295aa;
color: #fff;
text-align: center;
padding: 5px 10;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -120px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
}
/* Tooltip arrow */
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #0295aa transparent transparent transparent;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
+26 -16
View File
@@ -493,23 +493,13 @@ exports.newWebServer = function newWebServer(EVENTS_SERVER) {
case 'AppSchema.js':
{
let fs = require('fs')
sendSchema(process.env.APP_SCHEMA_PATH, 'AppSchema', 'getAppSchema')
}
break
try {
let filePath = process.env.APP_SCHEMA_PATH + 'AppSchema.json'
fs.readFile(filePath, onFileRead)
} catch (e) {
console.log('[ERROR] Error reading the App Schema.', e)
}
function onFileRead(err, appSchema) {
if (err) {
respondWithContent(undefined, response)
} else {
let responseContent = 'function getAppSchema(){ return ' + appSchema + '}'
respondWithContent(responseContent, response)
}
}
case 'DocSchema.js':
{
sendSchema(process.env.DOC_SCHEMA_PATH, 'DocSchema', 'getDocSchema')
}
break
@@ -708,6 +698,26 @@ exports.newWebServer = function newWebServer(EVENTS_SERVER) {
}
}
function sendSchema(filePath, fileName, functionName) {
let fs = require('fs')
try {
filePath = filePath + fileName + '.json'
fs.readFile(filePath, onFileRead)
} catch (e) {
console.log('[ERROR] Error reading the ' + fileName, e)
}
function onFileRead(err, schema) {
if (err) {
respondWithContent(undefined, response)
} else {
let responseContent = 'function ' + functionName + '(){ return ' + schema + '}'
respondWithContent(responseContent, response)
}
}
}
function sendStyleSheet(fileName) {
let fs = require('fs')
try {
+10 -2
View File
@@ -3,6 +3,8 @@ let markets
let APP_SCHEMA_MAP = new Map()
let APP_SCHEMA_ARRAY = []
let DOC_SCHEMA_MAP = new Map()
let DOC_SCHEMA_ARRAY = []
function newDashboard() {
const MODULE_NAME = 'Dashboard'
@@ -22,15 +24,21 @@ function newDashboard() {
function start() {
try {
setBrowserEvents()
setUpAppSchema()
setUpSchemas()
function setUpAppSchema() {
function setUpSchemas() {
APP_SCHEMA_ARRAY = getAppSchema()
for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) {
let nodeDefinition = APP_SCHEMA_ARRAY[i]
let key = nodeDefinition.type
APP_SCHEMA_MAP.set(key, nodeDefinition)
}
DOC_SCHEMA_ARRAY = getDocSchema()
for (let i = 0; i < DOC_SCHEMA_ARRAY.length; i++) {
let nodeDefinition = DOC_SCHEMA_ARRAY[i]
let key = nodeDefinition.type
DOC_SCHEMA_MAP.set(key, nodeDefinition)
}
startCanvas()
}
+69 -14
View File
@@ -111,6 +111,7 @@ function newTutorialSpace() {
}
}
checkPressButton()
checkGif()
checkImage()
checkDocumentation()
@@ -118,6 +119,34 @@ function newTutorialSpace() {
checkReference()
return
function checkPressButton() {
if (currentNode === undefined) { return }
let config = JSON.parse(currentNode.config)
if (config.pressButton === undefined || config.pressButton ==="") {
return
}
/* Remove this item from the navigation stack. */
navigationStack.splice(navigationStack.length - 1)
switch (config.pressButton) {
case "Stop": {
stop()
return
}
case "Skip": {
skip()
return
}
case "Previous": {
previous()
return
}
case "Next": {
next()
return
}
}
}
function checkGif() {
let tutorialGifDiv = document.getElementById('tutorialGifDiv')
if (tutorialGifDiv !== null && tutorialGifDiv !== undefined) {
@@ -324,21 +353,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 +626,7 @@ function newTutorialSpace() {
}
html = html + '<div>'
if (nodeConfig.summary !== undefined && nodeConfig.summary !== '') {
html = html + '<div class="tutorial-font-small tutorial-summary">' + nodeConfig.summary + '</div>'
html = html + '<div class="tutorial-font-small tutorial-summary">' + addToolTips(nodeConfig.summary) + '</div>'
}
if (nodeConfig.subTitle !== undefined && nodeConfig.subTitle !== '') {
html = html + '<h2 class="tutorial-font-medium">' + nodeConfig.subTitle + '</h2>'
@@ -606,6 +635,7 @@ function newTutorialSpace() {
html = html + '<div id="tutorialGifDiv" width="400"/>'
newGifName = nodeConfig.gif
}
if (nodeConfig.definition !== undefined && nodeConfig.definition !== '') {
html = html + '<table class="tutorial-definitionTable">'
html = html + '<tr>'
@@ -616,52 +646,77 @@ function newTutorialSpace() {
}
html = html + '</td>'
html = html + '<td>'
html = html + '<strong class="tutorial-font-bold-small">' + nodeConfig.definition + '</strong>'
html = html + '<strong class="tutorial-font-bold-small">' + addToolTips(nodeConfig.definition) + '</strong>'
html = html + '</td>'
html = html + '</tr>'
html = html + '</table>'
}
if (nodeConfig.bulletListIntro !== undefined && nodeConfig.bulletListIntro !== '') {
html = html + '<p class="tutorial-font-small">' + nodeConfig.bulletListIntro + '</p>'
html = html + '<p class="tutorial-font-small">' + addToolTips(nodeConfig.bulletListIntro) + '</p>'
}
if (nodeConfig.bulletArray !== undefined) {
html = html + '<ul>'
for (let i = 0; i < nodeConfig.bulletArray.length; i++) {
let bullet = nodeConfig.bulletArray[i]
html = html + '<li>'
html = html + '<p class="tutorial-font-small"><strong class="tutorial-font-bold-small">' + bullet[0] + '</strong> ' + bullet[1] + '</p>'
html = html + '<p class="tutorial-font-small"><strong class="tutorial-font-bold-small">' + addToolTips(bullet[0]) + '</strong> ' + addToolTips(bullet[1]) + '</p>'
html = html + '</li>'
}
html = html + '</ul>'
}
if (nodeConfig.paragraph1 !== undefined && nodeConfig.paragraph1 !== '') {
html = html + '<p class="tutorial-font-small">' + nodeConfig.paragraph1 + '</p>'
html = html + '<p class="tutorial-font-small">' + addToolTips(nodeConfig.paragraph1) + '</p>'
}
if (nodeConfig.callOut !== undefined && nodeConfig.callOut !== '') {
html = html + '<div class="tutorial-font-bold-small tutorial-callout" > ' + nodeConfig.callOut + ''
html = html + '<div class="tutorial-font-bold-small tutorial-callout" > ' + addToolTips(nodeConfig.callOut) + ''
if (nodeConfig.externalLink !== undefined) {
html = html + '<a href="' + nodeConfig.externalLink[1] + '" target="_blank">' + nodeConfig.externalLink[0] + '</a>'
}
html = html + '</div>'
}
if (nodeConfig.paragraph2 !== undefined && nodeConfig.paragraph2 !== '') {
html = html + '<p class="tutorial-font-small">' + nodeConfig.paragraph2 + '</p>'
html = html + '<p class="tutorial-font-small">' + addToolTips(nodeConfig.paragraph2) + '</p>'
}
if (nodeConfig.note !== undefined && nodeConfig.note !== '') {
html = html + '<div class="tutorial-font-small tutorial-alert-info" role="alert"><i class="tutorial-fa tutorial-info-circle"></i> <b>Note:</b> ' + nodeConfig.note + '</div>'
html = html + '<div class="tutorial-font-small tutorial-alert-info" role="alert"><i class="tutorial-fa tutorial-info-circle"></i> <b>Note:</b> ' + addToolTips(nodeConfig.note) + '</div>'
}
if (nodeConfig.tip !== undefined && nodeConfig.tip !== '') {
html = html + '<div class="tutorial-font-small tutorial-alert-success" role="alert"><i class="tutorial-fa tutorial-check-square-o"></i> <b>Tip:</b> ' + nodeConfig.tip + '</div>'
html = html + '<div class="tutorial-font-small tutorial-alert-success" role="alert"><i class="tutorial-fa tutorial-check-square-o"></i> <b>Tip:</b> ' + addToolTips(nodeConfig.tip) + '</div>'
}
if (nodeConfig.important !== undefined && nodeConfig.important !== '') {
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + nodeConfig.important + '</div>'
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + addToolTips(nodeConfig.important) + '</div>'
}
if (nodeConfig.warning !== undefined && nodeConfig.warning !== '') {
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + nodeConfig.warning + '</div>'
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + addToolTips(nodeConfig.warning) + '</div>'
}
html = html + '</div>'
tutorialDiv.innerHTML = html
function addToolTips(text) {
const TOOL_TIP_HTML = '<div class="tooltip"><I>NODE_TYPE</I><span class="tooltiptext">NODE_DEFINITION</span></div>'
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 definitionNode = DOC_SCHEMA_MAP.get(nodeType)
if (definitionNode === undefined) {
currentNode.setErrorMessage(nodeType + ' not found at Doc Schema.')
return
}
let definition = definitionNode.definition
if (definition === undefined || definition === "") {
resultingText = resultingText + firstPart + nodeType
} else {
let tooltip = TOOL_TIP_HTML.replace('NODE_TYPE', nodeType).replace('NODE_DEFINITION', definition)
resultingText = resultingText + firstPart + tooltip
}
}
return resultingText
}
}
function draw() {
+14939
View File
File diff suppressed because it is too large. Load diff