ui: avoid html insertion for settings fragment
This commit is contained in:
@@ -196,11 +196,14 @@ function injectLanguageSwitcher() {
|
|||||||
fetch('html/fragments/lang-switcher.html')
|
fetch('html/fragments/lang-switcher.html')
|
||||||
.then(function(response) { return response.text(); })
|
.then(function(response) { return response.text(); })
|
||||||
.then(function(html) {
|
.then(function(html) {
|
||||||
|
var template = document.createElement('template');
|
||||||
|
template.innerHTML = html;
|
||||||
|
var fragment = template.content.cloneNode(true);
|
||||||
var saveRow = cardBody.querySelector('div[style*="justify-content:flex-end"]');
|
var saveRow = cardBody.querySelector('div[style*="justify-content:flex-end"]');
|
||||||
if (saveRow) {
|
if (saveRow) {
|
||||||
saveRow.insertAdjacentHTML('beforebegin', html);
|
saveRow.parentNode.insertBefore(fragment, saveRow);
|
||||||
} else {
|
} else {
|
||||||
cardBody.insertAdjacentHTML('beforeend', html);
|
cardBody.appendChild(fragment);
|
||||||
}
|
}
|
||||||
if (typeof applyLang === 'function') {
|
if (typeof applyLang === 'function') {
|
||||||
applyLang();
|
applyLang();
|
||||||
|
|||||||
Reference in New Issue
Block a user