[CHANGE] JS updated to ES8+ standard where ever possible

This commit is contained in:
Peter Pfeufer
2023-12-10 14:56:15 +01:00
parent 021b7b2edb
commit de12b49527
13 changed files with 231 additions and 208 deletions

View File

@@ -163,7 +163,8 @@ ESC to cancel{% endblocktranslate %}" id="blah"></i></th>
<script>
const clipboard = new ClipboardJS('.copy-text-fa-icon');
clipboard.on('success', function (e) {
clipboard.on('success', (e) => {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
@@ -171,12 +172,12 @@ ESC to cancel{% endblocktranslate %}" id="blah"></i></th>
e.clearSelection();
});
clipboard.on('error', function (e) {
clipboard.on('error', (e) => {
console.error('Action:', e.action);
console.error('Trigger:', e.trigger);
});
$(document).ready(function() {
$(document).ready(() => {
const elementEditableSrpAmount = $('.srp');
const elementTableSrpList = $('table.srplist');
@@ -202,12 +203,12 @@ ESC to cancel{% endblocktranslate %}" id="blah"></i></th>
$.fn.dataTable.moment('YYYY-MMM-D, HH:mm');
elementEditableSrpAmount.editable({
display: function(value, response) {
display: (value, response) => {
return false;
},
success: function(response, newValue) {
newValue = parseInt(newValue);
const newValueOutput = newValue.toLocaleString() + " ISK";
const newValueOutput = `${newValue.toLocaleString()} ISK`;
$(this).html(`<b>${newValueOutput}</b>`);
},
@@ -218,11 +219,11 @@ ESC to cancel{% endblocktranslate %}" id="blah"></i></th>
}
});
elementEditableSrpAmount.on('hidden', function(e, reason){
if(reason === 'save' || reason === 'nochange') {
elementEditableSrpAmount.on('hidden', function(e, reason) {
if (reason === 'save' || reason === 'nochange') {
const next_editable_element = $(this).closest('tr').next().find('.editable');
setTimeout(function() {
setTimeout(() => {
next_editable_element.editable('show');
}, 400);
}