This commit is contained in:
James Cole
2020-10-26 06:10:10 +01:00
parent f6ce49b586
commit 276de8a470
6 changed files with 54 additions and 14 deletions

View File

@@ -124,10 +124,6 @@ export default {
types = this.defaultAccountTypeFilters.join(',');
}
this.updateACURI(types);
},
name() {
// console.log('Watch: name()');
// console.log(this.name);
}
},
methods:
@@ -141,7 +137,7 @@ export default {
for (const key in res.data) {
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
current = res.data[key];
current.description = this.escapeHtml(res.data[key].description)
current.name_with_balance = this.escapeHtml(res.data[key].name_with_balance)
escapedData.push(current);
}
}
@@ -151,6 +147,25 @@ export default {
// any error handler
})
},
escapeHtml: function (string) {
let entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) {
return entityMap[s];
});
},
updateACURI: function (types) {
this.accountAutoCompleteURI =
document.getElementsByTagName('base')[0].href +

View File

@@ -100,7 +100,7 @@ export default {
for (const key in res.data) {
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
current = res.data[key];
current.description = this.escapeHtml(res.data[key].description)
current.name = this.escapeHtml(res.data[key].name)
escapedData.push(current);
}
}
@@ -110,6 +110,25 @@ export default {
// any error handler
})
},
escapeHtml: function (string) {
let entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) {
return entityMap[s];
});
},
handleInput(e) {
if (typeof this.$refs.input.value === 'string') {
this.$emit('input', this.$refs.input.value);