Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 25, 2024
2 parents 035054c + f2a4861 commit 323cad4
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions Manual/contents/assets/scripts/main_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,7 @@ var listStyle = `float: right;
padding: 8px;
border-radius: 4px;`

var myParent = window.parent.document.body.getElementsByClassName("header")[0];
var myParent = window.parent.document.getElementsByClassName("header")[0];

// No context view style and parent elm
if (myParent == undefined) {
Expand All @@ -2609,25 +2609,25 @@ if (myParent == undefined) {
`;
}

//Create array of options to be added
var array = [
{ name: "English", code: "en" },
{ name: "Français", code: "fr" },
{ name: "Español", code: "es" },
{ name: "Deutsch", code: "de" },
{ name: "Русский", code: "ru" },
{ name: "Italiano", code: "it" },
{ name: "Polski", code: "pl" },
{ name: "Português Brasileiro", code: "br" },
{ name: "한국인", code: "ko" },
{ name: "中国人", code: "zh" },
{ name: "日本語", code: "ja" }
];

// Make sure it doesn't already exist
var existingSelectList = window.parent.document.getElementById("mySelect");

if (existingSelectList == undefined) {
//Create array of options to be added
var array = [
{ name: "English", code: "en" },
{ name: "Français", code: "fr" },
{ name: "Español", code: "es" },
{ name: "Deutsch", code: "de" },
{ name: "Русский", code: "ru" },
{ name: "Italiano", code: "it" },
{ name: "Polski", code: "pl" },
{ name: "Português Brasileiro", code: "br" },
{ name: "한국인", code: "ko" },
{ name: "中国人", code: "zh" },
{ name: "日本語", code: "ja" }
];

//Create and append select list
var selectList = document.createElement("select");
selectList.id = "mySelect";
Expand All @@ -2652,18 +2652,19 @@ if (existingSelectList == undefined) {
for( var i=0; i<array.length; ++i) {
if (array[i].code == language) {
// put the current language first in the list
var child = selectList.children[i];
selectList.removeChild(child);
selectList.insertBefore(child, selectList.firstChild);
//var child = selectList.children[i];
//selectList.removeChild(child);
//selectList.insertBefore(child, selectList.firstChild);
// select the first element
selectList.selectedIndex = 0;
//selectList.selectedIndex = 0;
selectList.selectedIndex = i;
break;
} // end if
} // end for
} // end if
} // end if

selectList.addEventListener( "change", function(e) {
selectList.addEventListener( "input", function(e) {
//var tg = selectList.target.value;
//console.log("Hello entry " + tg.name + " " + tg.code + ", " + JSON.stringify(selectList));
var index = selectList.selectedIndex;
Expand Down Expand Up @@ -2691,7 +2692,8 @@ if (existingSelectList == undefined) {
if (folders.length >= 3) {
folders[2] = entry.code;
} // end if
window.parent.location.pathname = `${folders.join('/')}`;
var newpath = `${folders.join('/')}`;
window.parent.location.pathname = newpath;
}

});
Expand Down

0 comments on commit 323cad4

Please sign in to comment.