Skip to content

Commit b8e88c6

Browse files
Add initial music toggle
1 parent c227cfa commit b8e88c6

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

local/start.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,24 @@
206206
}
207207
});
208208

209+
209210

211+
function toggleMusic() {
212+
const musicBtn = document.getElementById('music-btn');
213+
if (musicBtn.classList.contains('crossed-out')) {
214+
musicBtn.classList.remove('crossed-out');
215+
// Unmute music logic here
216+
if (window.electronAPI && window.electronAPI.setMusicMuted) {
217+
window.electronAPI.setMusicMuted(false);
218+
}
219+
} else {
220+
musicBtn.classList.add('crossed-out');
221+
// Mute music logic here
222+
if (window.electronAPI && window.electronAPI.setMusicMuted) {
223+
window.electronAPI.setMusicMuted(true);
224+
}
225+
}
226+
}
210227

211228

212229
</script>
@@ -262,6 +279,36 @@
262279
-webkit-user-select: none;
263280
-webkit-app-region: drag;
264281
}
282+
.music-btn {
283+
position: relative;
284+
}
285+
.music-btn svg {
286+
margin-top: 1px;
287+
margin-left: -1px;
288+
width: 17px; /* Adjust size as needed, e.g., 70% of the button's width */
289+
height: 17px;
290+
/* If using fill="currentColor", you can change the icon's color here */
291+
color: #fff;
292+
}
293+
/* Upon clicking, darken the SVG */
294+
.music-btn:active svg {
295+
color: #b6b6b6; /* Darken the color on click */
296+
}
297+
#music-btn.crossed-out::after {
298+
content: '';
299+
position: absolute;
300+
top: 50%;
301+
left: 50%;
302+
width: 100%;
303+
height: 2px; /* Thickness of the cross line */
304+
background-color: #fff; /* Color of the cross line */
305+
transform: translate(-50%, -50%) rotate(45deg);
306+
pointer-events: none; /* Allows clicks to pass through to the button */
307+
}
308+
/* Upon clicking, darken crossed-out */
309+
#music-btn.crossed-out:active::after {
310+
background-color: #b6b6b6; /* Darken the cross line on click */
311+
}
265312
</style>
266313
<body>
267314

@@ -271,6 +318,11 @@
271318
<div class="title-bar-text">Sploder</div>
272319
<div class="titlebar-movable" onmouseup="setTimeout(checkmax, 50)" onmousedown="setTimeout(checkmax, 500)"></div>
273320
<div class="title-bar-controls">
321+
<button aria-label="Minimize" id="music-btn" class="music-btn" onclick="toggleMusic()" aria-label="Toggle Music">
322+
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0,0,256,256">
323+
<g fill="currentColor" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(5.33333,5.33333)"><path d="M25,4c-2.209,0 -4,1.791 -4,4v19.36914l0.01758,0.02148c-0.8148,-0.25595 -1.66353,-0.38764 -2.51758,-0.39062c-4.69442,0 -8.5,3.80558 -8.5,8.5c0,4.69442 3.80558,8.5 8.5,8.5c2.2855,-0.00104 4.47428,-0.92243 6.07245,-2.55624c1.59817,-1.63382 2.47106,-3.84239 2.42169,-6.12735c0.00158,0.06211 0.00586,0.12416 0.00586,0.18359v-31.5zM30,6.39063v8.03906c0.07,0.06 0.12945,0.11969 0.18945,0.17969c3.06,3.01 4.98,4.91148 3,9.27148c-0.82,1.8 -0.23984,3.92953 1.41016,5.01953l1.90039,1.25977c7.12,-10.73 1.79039,-15.98031 -2.09961,-19.82031c-1.44,-1.43 -3.06039,-2.82922 -4.40039,-3.94922zM26.98828,35.1582l0.00195,0.00195c0.0008,0.00884 -0.00068,0.01838 0,0.02734c-0.00063,-0.00977 -0.00129,-0.01953 -0.00195,-0.0293z"></path></g></g>
324+
</svg>
325+
</button>
274326
<button id="min-btn" onclick="window.electronAPI.minimizeWindow()" aria-label="Minimize"></button>
275327
<button id="max-btn" onclick="toggleMaximize()" aria-label="Maximize"></button>
276328
<button id="close-btn" onclick="window.electronAPI.closeWindow()" aria-label="Close"></button>

0 commit comments

Comments
 (0)