From 641315537d9a0ba2efd7e1171cba424c0edbd508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 4 Mar 2023 08:24:54 +0800 Subject: [PATCH] Replaced the traditional function expressions with ES6 arrow function expressions in the JavaScript for the transaction order, account order, currency form, and the speed dial for the material floating action buttons. --- src/accounting/static/js/account-order.js | 4 ++-- src/accounting/static/js/currency-form.js | 2 +- src/accounting/static/js/material-fab-speed-dial.js | 4 ++-- src/accounting/static/js/transaction-order.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/accounting/static/js/account-order.js b/src/accounting/static/js/account-order.js index c2f8029..5ab38d9 100644 --- a/src/accounting/static/js/account-order.js +++ b/src/accounting/static/js/account-order.js @@ -22,10 +22,10 @@ */ // Initializes the page JavaScript. -document.addEventListener("DOMContentLoaded", function () { +document.addEventListener("DOMContentLoaded", () => { const list = document.getElementById("accounting-order-list"); if (list !== null) { - const onReorder = function () { + const onReorder = () => { const accounts = Array.from(list.children); for (let i = 0; i < accounts.length; i++) { const no = document.getElementById("accounting-order-" + accounts[i].dataset.id + "-no"); diff --git a/src/accounting/static/js/currency-form.js b/src/accounting/static/js/currency-form.js index c97e582..b87b342 100644 --- a/src/accounting/static/js/currency-form.js +++ b/src/accounting/static/js/currency-form.js @@ -22,7 +22,7 @@ */ // Initializes the page JavaScript. -document.addEventListener("DOMContentLoaded", function () { +document.addEventListener("DOMContentLoaded", () => { document.getElementById("accounting-code") .onchange = validateCode; document.getElementById("accounting-name") diff --git a/src/accounting/static/js/material-fab-speed-dial.js b/src/accounting/static/js/material-fab-speed-dial.js index 6b9b86b..0b3ebf7 100644 --- a/src/accounting/static/js/material-fab-speed-dial.js +++ b/src/accounting/static/js/material-fab-speed-dial.js @@ -22,7 +22,7 @@ */ // Initializes the page JavaScript. -document.addEventListener("DOMContentLoaded", function () { +document.addEventListener("DOMContentLoaded", () => { initializeMaterialFabSpeedDial(); }); @@ -34,7 +34,7 @@ document.addEventListener("DOMContentLoaded", function () { function initializeMaterialFabSpeedDial() { const btnFab = document.getElementById("accounting-btn-material-fab-speed-dial"); const fab = document.getElementById(btnFab.dataset.target); - btnFab.onclick = function () { + btnFab.onclick = () => { if (fab.classList.contains("show")) { fab.classList.remove("show"); } else { diff --git a/src/accounting/static/js/transaction-order.js b/src/accounting/static/js/transaction-order.js index 725b4f7..a92cb8c 100644 --- a/src/accounting/static/js/transaction-order.js +++ b/src/accounting/static/js/transaction-order.js @@ -22,10 +22,10 @@ */ // Initializes the page JavaScript. -document.addEventListener("DOMContentLoaded", function () { +document.addEventListener("DOMContentLoaded", () => { const list = document.getElementById("accounting-order-list"); if (list !== null) { - const onReorder = function () { + const onReorder = () => { const accounts = Array.from(list.children); for (let i = 0; i < accounts.length; i++) { const no = document.getElementById("accounting-order-" + accounts[i].dataset.id + "-no");