Skip to content

Commit

Permalink
feat: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Aug 15, 2024
1 parent 193f20a commit 8e3d836
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 2 additions & 3 deletions js/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ export const audio = (() => {
const init = () => {
music = document.getElementById('button-music');

audio = new Audio();
audio.src = music.getAttribute('data-url');
audio.load();
audio = new Audio(music.getAttribute('data-url'));
audio.currentTime = 0;
audio.autoplay = true;
audio.muted = false;
audio.loop = true;
audio.volume = 1;
audio.load();
};

const button = async (button) => {
Expand Down
11 changes: 10 additions & 1 deletion js/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ export const comment = (() => {
return;
}

if (!id && name) {
name.disabled = true;
}

const presence = document.getElementById('form-presence');
if (!id && presence && presence.value == "0") {
alert('Please select presence');
return;
}

if (presence) {
if (presence && presence.value != "0") {
presence.disabled = true;
}

Expand All @@ -142,6 +146,10 @@ export const comment = (() => {
})
.then();

if (name) {
name.disabled = false;
}

form.disabled = false;
if (cancel) {
cancel.disabled = false;
Expand All @@ -156,6 +164,7 @@ export const comment = (() => {
if (response?.code === 201) {
owns.set(response.data.uuid, response.data.own);
form.value = null;

if (presence) {
presence.value = "0";
}
Expand Down

0 comments on commit 8e3d836

Please sign in to comment.