Fix syntax error in showPresets function

Fixed nested template literal syntax error by escaping properly and using string concatenation instead of nested template literals to avoid interpolation conflicts.
This commit is contained in:
DiTus
2026-02-25 22:36:43 +01:00
parent a45d09ef6f
commit a6ed93ddbf

View File

@ -590,16 +590,22 @@ window.showPresets = function(indicatorName) {
} }
const menu = window.open('', '_blank', 'width=400,height=500'); const menu = window.open('', '_blank', 'width=400,height=500');
menu.document.write(`
<html><head><title>Presets - ${indicatorName}</title><style> let htmlContent =
body { font-family: sans-serif; padding: 20px; background: #1e222d; color: #d1d4dc; } '<html><head><title>Presets - ' + indicatorName + '</title><style>' +
.preset { padding: 10px; margin: 5px; background: #131722; border-radius: 4px; } 'body { font-family: sans-serif; padding: 20px; background: #1e222d; color: #d1d4dc; }' +
.preset:hover { background: #2a2e39; cursor: pointer; } '.preset { padding: 10px; margin: 5px; background: #131722; border-radius: 4px; }' +
</style></head><body> '.preset:hover { background: #2a2e39; cursor: pointer; }' +
<h3>${indicatorName} Presets</h3> '</style></head><body>' +
${presets.map(p => `<div class="preset" onclick="opener.applyPresetFromWindow('${p.id}')">${p.name}</div>`).join('')} '<h3>' + indicatorName + ' Presets</h3>';
</body></html>
`; presets.forEach(p => {
htmlContent += '<div class="preset" onclick="opener.applyPresetFromWindow(' + "'" + p.id + "'" + ')">' + p.name + '</div>';
});
htmlContent += '</body></html>';
menu.document.write(htmlContent);
}; };
window.applyPresetFromWindow = function(presetId) { window.applyPresetFromWindow = function(presetId) {