I'm looking to replace document.write() in this code but can't seem to figure out the best alternative. I'm trying to optimize my site and document.write() is causing some optimization problems. Thanks in advance! You can check it out live here Gaming Forum
Here's my code:
initAutodetect: function() {
if (!thstyleswitchConfig.autodetectEnabled) {
return;
}
if (themehouse.styleSwitch.autodetectInitialized) {
return;
}
themehouse.styleSwitch.autodetectInitialized = true;
var preferred = themehouse.styleSwitch.getPreferredStyleType();
var write = '';
if (preferred === null) {
var defaultStyleKey = thstyleswitchConfig.currentStyleType + 'Style';
var styleOpts = thstyleswitchConfig[defaultStyleKey];
write = themehouse.styleSwitch.buildStyleLinkTag(styleOpts.primaryCssUrl) + themehouse.styleSwitch.buildStyleLinkTag(styleOpts.additionalCssUrl);
} else {
write = themehouse.styleSwitch.buildStyleLinkTag(thstyleswitchConfig.lightStyle.primaryCssUrl, 'light') +
themehouse.styleSwitch.buildStyleLinkTag(thstyleswitchConfig.lightStyle.additionalCssUrl, 'light') +
themehouse.styleSwitch.buildStyleLinkTag(thstyleswitchConfig.darkStyle.primaryCssUrl, 'dark') +
themehouse.styleSwitch.buildStyleLinkTag(thstyleswitchConfig.darkStyle.additionalCssUrl, 'dark');
}
document.write(write);
},