diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
index 30da657bd..13fe41e75 100644
--- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
+++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
@@ -9,6 +9,7 @@ function newSuperalgosDocSpace() {
searchResultsPage: undefined,
footer: undefined,
documentPage: undefined,
+ language: undefined,
changeLanguage: changeLanguage,
openSpaceAreaAndNavigateTo: openSpaceAreaAndNavigateTo,
navigateTo: navigateTo,
@@ -52,7 +53,6 @@ function newSuperalgosDocSpace() {
let docsSchemaDocument
let menuLabelsMap = new Map()
let command
- let language
return thisObject
@@ -82,10 +82,10 @@ function newSuperalgosDocSpace() {
Getting the used preferred languague
*/
if (window.localStorage.getItem('Docs Language') !== null && window.localStorage.getItem('Docs Language') !== undefined && window.localStorage.getItem('Docs Language') !== 'undefined') {
- language = window.localStorage.getItem('Docs Language')
+ UI.projects.superalgos.spaces.docsSpace.language = window.localStorage.getItem('Docs Language')
} else {
window.localStorage.setItem('Docs Language', DEFAULT_LANGUAGE)
- language = DEFAULT_LANGUAGE
+ UI.projects.superalgos.spaces.docsSpace.language = DEFAULT_LANGUAGE
}
}
@@ -436,9 +436,9 @@ function newSuperalgosDocSpace() {
}
function changeLanguage(pLanguage) {
- language = pLanguage
- window.localStorage.setItem('Docs Language', language)
- let languageLabel = UI.projects.superalgos.utilities.languages.getLaguageLabel(language)
+ UI.projects.superalgos.spaces.docsSpace.language = pLanguage
+ window.localStorage.setItem('Docs Language', UI.projects.superalgos.spaces.docsSpace.language)
+ let languageLabel = UI.projects.superalgos.utilities.languages.getLaguageLabel(UI.projects.superalgos.spaces.docsSpace.language)
navigateTo('Superalgos', 'Topic', 'Docs In ' + languageLabel)
}
@@ -507,7 +507,7 @@ function newSuperalgosDocSpace() {
/*
Deleting paragarphs is only possible in the default language.
*/
- if (language === DEFAULT_LANGUAGE) {
+ if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) {
docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex, 1)
if (docsSchemaDocument.paragraphs.length === 0) {
let newParagraph = {
@@ -522,7 +522,7 @@ function newSuperalgosDocSpace() {
/*
Adding paragarphs is only possible in the default language.
*/
- if (language === DEFAULT_LANGUAGE) {
+ if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) {
/*
We will update the one paragraph we have and we will add the rest.
*/
@@ -762,7 +762,9 @@ function newSuperalgosDocSpace() {
function onOpening() {
thisObject.isVisible = true
if (objectBeingRendered === undefined) {
- renderSearchPage()
+ thisObject.mainSearchPage.render()
+ detectEnterOnSearchBox()
+ setFocusOnSearchBox()
} else {
navigateTo(objectBeingRendered.project, objectBeingRendered.category, objectBeingRendered.type)
}
@@ -840,18 +842,6 @@ function newSuperalgosDocSpace() {
thisObject.isVisible = false
}
- function renderSearchPage() {
- let HTML = ''
- HTML = HTML + '
'
- HTML = HTML + '
'
- HTML = HTML + '
'
- HTML = HTML + '
'
- let docsContentDiv = document.getElementById('docs-content-div')
- docsContentDiv.innerHTML = HTML + addFooter()
- detectEnterOnSearchBox()
- setFocusOnSearchBox()
- }
-
function detectCommands() {
if (checkHelpCommand() === undefined) { return }
@@ -933,7 +923,7 @@ function newSuperalgosDocSpace() {
}
if (command.indexOf('Docs.Add') !== 0 && command.indexOf('docs.add') !== 0) { return 'Not Add Command' }
- if (language !== DEFAULT_LANGUAGE) {
+ if (UI.projects.superalgos.spaces.docsSpace.language !== DEFAULT_LANGUAGE) {
navigateTo('Superalgos', 'Topic', 'Docs Error Only In English', 'Anchor Only In English')
return
}
@@ -998,7 +988,7 @@ function newSuperalgosDocSpace() {
}
if (command.indexOf('Docs.Delete') !== 0 && command.indexOf('docs.delete') !== 0) { return 'Not Delete Command' }
- if (language !== DEFAULT_LANGUAGE) {
+ if (UI.projects.superalgos.spaces.docsSpace.language !== DEFAULT_LANGUAGE) {
navigateTo('Superalgos', 'Topic', 'Docs Error Only In English', 'Anchor Only In English')
return
}
@@ -1295,7 +1285,7 @@ function newSuperalgosDocSpace() {
HTML = HTML + ''
let docsContentDiv = document.getElementById('docs-content-div')
- docsContentDiv.innerHTML = HTML + addFooter()
+ docsContentDiv.innerHTML = HTML + UI.projects.superalgos.spaces.docsSpace.footer.addFooter()
detectEnterOnSearchBox()
setFocusOnSearchBox()
@@ -1565,7 +1555,7 @@ function newSuperalgosDocSpace() {
}
let docsContentDiv = document.getElementById('docs-content-div')
- docsContentDiv.innerHTML = HTML + addFooter()
+ docsContentDiv.innerHTML = HTML + UI.projects.superalgos.spaces.docsSpace.footer.addFooter()
detectEnterOnSearchBox()
setFocusOnSearchBox()
@@ -1789,7 +1779,7 @@ function newSuperalgosDocSpace() {
Here we inject the HTML we built into the DOM at the Docs Space Div.
*/
let docsContentDiv = document.getElementById('docs-content-div')
- docsContentDiv.innerHTML = HTML + addFooter()
+ docsContentDiv.innerHTML = HTML + UI.projects.superalgos.spaces.docsSpace.footer.addFooter()
console.log(docsContentDiv.innerHTML)
@@ -3178,51 +3168,6 @@ function newSuperalgosDocSpace() {
return HTML
}
- function addFooter() {
- let languageLabel = UI.projects.superalgos.utilities.languages.getLaguageLabel(language)
-
- let HTML = ''
-
- HTML = HTML + '' // Container Ends
-
- return HTML
- }
-
function addWarningIfTranslationIsOutdated(paragraph) {
if (paragraph === undefined) { return '' }
if (paragraph.updated === undefined) { return '' }
@@ -3231,7 +3176,7 @@ function newSuperalgosDocSpace() {
for (let i = 0; i < paragraph.translations.length; i++) {
let translation = paragraph.translations[i]
if (translation.updated === undefined) { continue }
- if (translation.language === language) {
+ if (translation.language === UI.projects.superalgos.spaces.docsSpace.language) {
if (paragraph.updated < translation.updated) {
return ''
} else {
@@ -3248,13 +3193,13 @@ function newSuperalgosDocSpace() {
if (paragraph.translations.length === 0) { return paragraph.text }
for (let i = 0; i < paragraph.translations.length; i++) {
let translation = paragraph.translations[i]
- if (translation.language === language) { return translation.text }
+ if (translation.language === UI.projects.superalgos.spaces.docsSpace.language) { return translation.text }
}
return paragraph.text
}
function setTextBasedOnLanguage(paragraph, text) {
- if (language === DEFAULT_LANGUAGE) {
+ if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) {
if (paragraph.text !== text) {
paragraph.text = text
paragraph.updated = (new Date()).valueOf()
@@ -3274,7 +3219,7 @@ function newSuperalgosDocSpace() {
}
for (let i = 0; i < paragraph.translations.length; i++) {
let translation = paragraph.translations[i]
- if (translation.language === language) {
+ if (translation.language === UI.projects.superalgos.spaces.docsSpace.language) {
if (translation.text !== text) {
translation.text = text
translation.updated = (new Date()).valueOf()
@@ -3283,7 +3228,7 @@ function newSuperalgosDocSpace() {
}
}
let translation = {
- language: language,
+ language: UI.projects.superalgos.spaces.docsSpace.language,
text: text,
updated: (new Date()).valueOf()
}
diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js b/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js
index ae1a15040..8c9626d2b 100644
--- a/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js
+++ b/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js
@@ -1,5 +1,6 @@
function newSuperalgosDocsFooter() {
let thisObject = {
+ addFooter: addFooter,
initialize: initialize,
finalize: finalize
}
@@ -13,4 +14,49 @@ function newSuperalgosDocsFooter() {
function finalize() {
}
+
+ function addFooter() {
+ let languageLabel = UI.projects.superalgos.utilities.languages.getLaguageLabel(UI.projects.superalgos.spaces.docsSpace.language)
+
+ let HTML = ''
+
+ HTML = HTML + '' // Container Ends
+
+ return HTML
+ }
}
\ No newline at end of file
diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js b/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js
index e4fa00871..4f895631a 100644
--- a/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js
+++ b/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js
@@ -1,5 +1,6 @@
function newSuperalgosDocsMainSearchPage() {
let thisObject = {
+ render: render,
initialize: initialize,
finalize: finalize
}
@@ -13,4 +14,14 @@ function newSuperalgosDocsMainSearchPage() {
function finalize() {
}
+
+ function render() {
+ let HTML = ''
+ HTML = HTML + '
'
+ HTML = HTML + '
'
+ HTML = HTML + '
'
+ HTML = HTML + '
'
+ let docsContentDiv = document.getElementById('docs-content-div')
+ docsContentDiv.innerHTML = HTML + UI.projects.superalgos.spaces.docsSpace.footer.addFooter()
+ }
}
\ No newline at end of file