diff --git a/js/admin.js b/js/admin.js
index 7d006d9..6e6fec6 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -41,7 +41,7 @@ export const admin = (() => {
};
const changeFilterBadWord = async (checkbox) => {
- const label = util.addLoadingCheckbox(checkbox);
+ const label = util.disableCheckbox(checkbox);
await request(HTTP_PATCH, '/api/user').
token(session.getToken()).
@@ -54,7 +54,7 @@ export const admin = (() => {
};
const replyComment = async (checkbox) => {
- const label = util.addLoadingCheckbox(checkbox);
+ const label = util.disableCheckbox(checkbox);
await request(HTTP_PATCH, '/api/user').
token(session.getToken()).
@@ -67,7 +67,7 @@ export const admin = (() => {
};
const editComment = async (checkbox) => {
- const label = util.addLoadingCheckbox(checkbox);
+ const label = util.disableCheckbox(checkbox);
await request(HTTP_PATCH, '/api/user').
token(session.getToken()).
@@ -80,7 +80,7 @@ export const admin = (() => {
};
const deleteComment = async (checkbox) => {
- const label = util.addLoadingCheckbox(checkbox);
+ const label = util.disableCheckbox(checkbox);
await request(HTTP_PATCH, '/api/user').
token(session.getToken()).
diff --git a/js/guest.js b/js/guest.js
index f8a786c..8edbeb7 100644
--- a/js/guest.js
+++ b/js/guest.js
@@ -175,6 +175,14 @@ export const guest = (() => {
*/
const closeInformation = () => information.set('info', true);
+ /**
+ * @param {HTMLElement} svg
+ * @param {number} timeout
+ * @param {string} classes
+ * @returns {void}
+ */
+ const animate = (svg, timeout, classes) => util.timeOut(() => svg.classList.add(classes), timeout);
+
/**
* @returns {void}
*/
@@ -239,6 +247,7 @@ export const guest = (() => {
open,
name,
modal,
+ animate,
closeInformation,
};
})();
\ No newline at end of file
diff --git a/js/util.js b/js/util.js
index 092ca76..e2f5dd4 100644
--- a/js/util.js
+++ b/js/util.js
@@ -31,11 +31,12 @@ export const util = (() => {
/**
* @param {HTMLElement} button
- * @param {string} [message='Loading..']
+ * @param {string} [message='Loading']
* @returns {object}
*/
const disableButton = (button, message = 'Loading') => {
button.disabled = true;
+
const tmp = button.innerHTML;
button.innerHTML = `
${message}`;
@@ -51,7 +52,7 @@ export const util = (() => {
* @param {HTMLElement} checkbox
* @returns {object}
*/
- const addLoadingCheckbox = (checkbox) => {
+ const disableCheckbox = (checkbox) => {
checkbox.disabled = true;
const label = document.querySelector(`label[for="${checkbox.id}"]`);
@@ -66,14 +67,6 @@ export const util = (() => {
};
};
- /**
- * @param {HTMLElement} svg
- * @param {number} timeout
- * @param {string} classes
- * @returns {void}
- */
- const animate = (svg, timeout, classes) => timeOut(() => svg.classList.add(classes), timeout);
-
/**
* @param {HTMLElement} button
* @param {string} [message=null]
@@ -128,14 +121,12 @@ export const util = (() => {
};
return {
- open,
copy,
timeOut,
- animate,
escapeHtml,
base64Encode,
base64Decode,
disableButton,
- addLoadingCheckbox,
+ disableCheckbox,
};
})();
\ No newline at end of file