Concatenate strings in /addvar
This commit is contained in:
parent
389c2b5435
commit
06ade803fa
|
@ -264,7 +264,8 @@ async function delayCallback(_, amount) {
|
||||||
async function inputCallback(_, prompt) {
|
async function inputCallback(_, prompt) {
|
||||||
// Do not remove this delay, otherwise the prompt will not show up
|
// Do not remove this delay, otherwise the prompt will not show up
|
||||||
await delay(1);
|
await delay(1);
|
||||||
const result = await callPopup(prompt || '', 'input');
|
const safeValue = DOMPurify.sanitize(prompt || '');
|
||||||
|
const result = await callPopup(safeValue, 'input');
|
||||||
await delay(1);
|
await delay(1);
|
||||||
return result || '';
|
return result || '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,9 @@ function addLocalVariable(name, value) {
|
||||||
const increment = Number(value);
|
const increment = Number(value);
|
||||||
|
|
||||||
if (isNaN(increment)) {
|
if (isNaN(increment)) {
|
||||||
return '';
|
const stringValue = String(currentValue || '') + value;
|
||||||
|
setLocalVariable(name, stringValue);
|
||||||
|
return stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newValue = Number(currentValue) + increment;
|
const newValue = Number(currentValue) + increment;
|
||||||
|
@ -56,7 +58,9 @@ function addGlobalVariable(name, value) {
|
||||||
const increment = Number(value);
|
const increment = Number(value);
|
||||||
|
|
||||||
if (isNaN(increment)) {
|
if (isNaN(increment)) {
|
||||||
return '';
|
const stringValue = String(currentValue || '') + value;
|
||||||
|
setGlobalVariable(name, stringValue);
|
||||||
|
return stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newValue = Number(currentValue) + increment;
|
const newValue = Number(currentValue) + increment;
|
||||||
|
|
Loading…
Reference in New Issue