diff --git a/src/app/app.component.css b/src/app/app.component.css
index bc83d2d..3c3ccd0 100644
--- a/src/app/app.component.css
+++ b/src/app/app.component.css
@@ -167,6 +167,15 @@ i{
text-decoration: none;
}
+.mute {
+ color: rgb(255, 255, 255);
+ cursor: pointer;
+}
+
+.mute:hover {
+ color: rgb(158, 158, 158);
+}
+
@media screen and (max-width:1010px) {
.range-control input{
width: 90px;
diff --git a/src/app/app.component.html b/src/app/app.component.html
index e6f8d19..9dc9698 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -32,6 +32,8 @@
{{ title }}
+
+ volume_up
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index af90352..f90270f 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -5,6 +5,7 @@ import { Bubble } from '../assets/algorithms/Bubble';
import { Insertion } from '../assets/algorithms/Insertion';
import { Selection } from '../assets/algorithms/Selection';
import { currentSpeed } from './array/Timmer';
+import { setMute } from 'src/assets/audio/Sound';
@Component({
selector: 'app-root',
@@ -85,4 +86,17 @@ export class AppComponent {
this.disable = false;
}
+ public onMute(){
+ let ele = document.getElementById('mute');
+
+ if (ele!.innerHTML == 'volume_up') {
+ setMute(true);
+ ele!.innerHTML = 'volume_off';
+ } else {
+ ele!.innerHTML = 'volume_up';
+ setMute(false);
+ }
+
+ }
+
}
diff --git a/src/assets/audio/Sound.ts b/src/assets/audio/Sound.ts
index 31683b1..f8f41a5 100644
--- a/src/assets/audio/Sound.ts
+++ b/src/assets/audio/Sound.ts
@@ -1,18 +1,26 @@
let audio = new Audio();
+let isMuted: boolean = false;
export async function playSucess(){
audio.src = "assets/audio/complete.mp3";
audio.load();
- audio.play();
+ if(!isMuted)
+ audio.play();
}
export async function playSwap() {
audio.src = "assets/audio/swap.mp3";
audio.load();
- audio.play();
+ if(!isMuted)
+ audio.play();
}
export async function playFind(){
audio.src = "assets/audio/find.mp3";
audio.load();
- audio.play();
+ if(!isMuted)
+ audio.play();
+}
+
+export function setMute(val: boolean) {
+ isMuted = val;
}
\ No newline at end of file
diff --git a/src/index.html b/src/index.html
index de1956f..36774f6 100644
--- a/src/index.html
+++ b/src/index.html
@@ -11,6 +11,7 @@
+