mirror of
https://github.com/EndPwnArchive/EndPwn3Plugins.git
synced 2024-08-14 23:57:06 +00:00
31 lines
1 KiB
JavaScript
31 lines
1 KiB
JavaScript
exports = {
|
|
manifest: {
|
|
author: "Cynosphere, janeptrv",
|
|
name: "osu! Typing",
|
|
description: "Adds typing sounds from osu!."
|
|
},
|
|
start: function(){
|
|
var sounds = [];
|
|
for (var i = 1; i < 4; i++) {
|
|
sounds.push(new Audio(`https://raw.githubusercontent.com/janeptrv/sounds/master/osu_typing_click${i}.wav`));
|
|
}
|
|
const backspace = new Audio("https://raw.githubusercontent.com/janeptrv/sounds/master/osu_typing_erase.wav");
|
|
|
|
var keys = {};
|
|
function typingSound(ev) {
|
|
for (const sound of sounds) {
|
|
sound.pause();
|
|
sound.currentTime = 0;
|
|
}
|
|
backspace.pause();
|
|
backspace.currentTime = 0;
|
|
if (ev.key == "Backspace" || ev.key == "Delete") {
|
|
backspace.play();
|
|
} else {
|
|
sounds[Math.floor(sounds.length * Math.random())].play();
|
|
}
|
|
return false;
|
|
}
|
|
document.addEventListener("keydown", typingSound);
|
|
}
|
|
} |