Code Format
parent
9e13aaf342
commit
610b9696ba
|
@ -161,13 +161,13 @@ function switchTheme(currentTheme, newTheme, linkElementId, callback) {
|
|||
const linkElement = document.getElementById(linkElementId);
|
||||
const cloneLinkElement = linkElement.cloneNode(true);
|
||||
const newThemeUrl = linkElement.getAttribute('href').replace(currentTheme, newTheme);
|
||||
|
||||
|
||||
cloneLinkElement.setAttribute('id', linkElementId + '-clone');
|
||||
cloneLinkElement.setAttribute('href', newThemeUrl);
|
||||
cloneLinkElement.addEventListener('load', () => {
|
||||
linkElement.remove();
|
||||
cloneLinkElement.setAttribute('id', linkElementId);
|
||||
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue