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:
@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user