mirror of
https://github.com/System-End/site.git
synced 2026-04-20 00:25:19 +00:00
awawawa
This commit is contained in:
parent
ea455cfa81
commit
5e157010fd
35 changed files with 90 additions and 1 deletions
|
|
@ -1,6 +1,49 @@
|
|||
var fetchedParts;
|
||||
var selectedParts = []
|
||||
var rolled = false;
|
||||
|
||||
|
||||
let yap_sounds = {
|
||||
// ty caleb!
|
||||
thinking: [
|
||||
new Howl({ src: '/bin/yapping/thonk1.wav' }),
|
||||
new Howl({ src: '/bin/yapping/thonk2.wav' }),
|
||||
new Howl({ src: '/bin/yapping/thonk3.wav' }),
|
||||
],
|
||||
talking: {
|
||||
// these sounds and most of the yapping code are adapted from https://github.com/equalo-official/animalese-generator
|
||||
a: new Howl({ src: '/bin/yapping/a.wav' }),
|
||||
b: new Howl({ src: '/bin/yapping/b.wav' }),
|
||||
c: new Howl({ src: '/bin/yapping/c.wav' }),
|
||||
d: new Howl({ src: '/bin/yapping/d.wav' }),
|
||||
e: new Howl({ src: '/bin/yapping/e.wav' }),
|
||||
f: new Howl({ src: '/bin/yapping/f.wav' }),
|
||||
g: new Howl({ src: '/bin/yapping/g.wav' }),
|
||||
h: new Howl({ src: '/bin/yapping/h.wav' }),
|
||||
i: new Howl({ src: '/bin/yapping/i.wav' }),
|
||||
j: new Howl({ src: '/bin/yapping/j.wav' }),
|
||||
k: new Howl({ src: '/bin/yapping/k.wav' }),
|
||||
l: new Howl({ src: '/bin/yapping/l.wav' }),
|
||||
m: new Howl({ src: '/bin/yapping/m.wav' }),
|
||||
n: new Howl({ src: '/bin/yapping/n.wav' }),
|
||||
o: new Howl({ src: '/bin/yapping/o.wav' }),
|
||||
p: new Howl({ src: '/bin/yapping/p.wav' }),
|
||||
q: new Howl({ src: '/bin/yapping/q.wav' }),
|
||||
r: new Howl({ src: '/bin/yapping/r.wav' }),
|
||||
s: new Howl({ src: '/bin/yapping/s.wav' }),
|
||||
t: new Howl({ src: '/bin/yapping/t.wav' }),
|
||||
u: new Howl({ src: '/bin/yapping/u.wav' }),
|
||||
v: new Howl({ src: '/bin/yapping/v.wav' }),
|
||||
w: new Howl({ src: '/bin/yapping/w.wav' }),
|
||||
x: new Howl({ src: '/bin/yapping/x.wav' }),
|
||||
y: new Howl({ src: '/bin/yapping/y.wav' }),
|
||||
z: new Howl({ src: '/bin/yapping/z.wav' }),
|
||||
th: new Howl({ src: '/bin/yapping/th.wav' }),
|
||||
sh: new Howl({ src: '/bin/yapping/sh.wav' }),
|
||||
_: new Howl({ src: '/bin/yapping/_.wav' })
|
||||
}
|
||||
};
|
||||
|
||||
async function fetchParts() {
|
||||
const response = await fetch('https://hackclub.com/api/bin/wokwi/parts/');
|
||||
if (!response.ok) {
|
||||
|
|
@ -144,6 +187,7 @@ window.addEventListener("load", (e) => {
|
|||
|
||||
document.querySelector("#generate-project-idea").addEventListener("click", async (e) => {
|
||||
document.querySelector('#project-idea').innerText = "Thinking..."
|
||||
yap_sounds.thinking[getRandomInt(yap_sounds.thinking.length)].play();
|
||||
const res = await fetch('/api/bin/openai/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
@ -153,5 +197,48 @@ window.addEventListener("load", (e) => {
|
|||
})
|
||||
const json = await res.json()
|
||||
document.querySelector('#project-idea').innerText = json.recommendation
|
||||
yap(json.recommendation)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
async function yap(text) {
|
||||
text = text.toLowerCase();
|
||||
const yap_queue = [];
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const char = text[i];
|
||||
try {
|
||||
if (char === 's' && text[i + 1] === 'h') { // test for 'sh' sound
|
||||
yap_queue.push(yap_sounds.talking['sh']);
|
||||
continue;
|
||||
} else if (char === 't' && text[i + 1] === 'h') { // test for 'th' sound
|
||||
yap_queue.push(yap_sounds.talking['th']);
|
||||
continue;
|
||||
} else if (char === 'h' && (text[i - 1] === 's' || text[i - 1] === 't')) { // test if previous letter was 's' or 't' and current letter is 'h'
|
||||
continue;
|
||||
} else if (char === ',' || char === '?' || char === '.') {
|
||||
yap_queue.push(yap_sounds.talking['_']);
|
||||
continue;
|
||||
} else if (char === text[i - 1]) { // skip repeat letters
|
||||
continue;
|
||||
}
|
||||
} catch (e) {
|
||||
// who cares. pick up a foot ball
|
||||
}
|
||||
if (!char.match(/[a-zA-Z.]/)) {
|
||||
continue; // skip characters that are not letters or periods
|
||||
}
|
||||
yap_queue.push(yap_sounds.talking[char]);
|
||||
}
|
||||
|
||||
function next_yap() {
|
||||
if (yap_queue.length === 0) return;
|
||||
let noise = yap_queue.shift();
|
||||
noise.rate(2 * (Math.random() * .50 + 1.9));
|
||||
noise.once('end', next_yap)
|
||||
console.log(noise)
|
||||
noise.play();
|
||||
}
|
||||
|
||||
next_yap();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<link rel="icon" type="image/png" sizes="16x16" href="https://assets.hackclub.com/favicons/favicon-16x16.png">
|
||||
<script src="https://awdev.codes/utils/smoothScroll.js"></script>
|
||||
<script src="https://awdev.codes/utils/hackclub/orph.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.4/howler.core.min.js" integrity="sha512-d00Brs/+XQUUaO0Y9Uo8Vw63o7kS6ZcLM2P++17kALrI8oihAfL4pl1jQObeRBgv06j7xG0GHOhudAW0BdrycA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="./script.js"></script>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
BIN
public/bin/yapping/_.wav
Normal file
BIN
public/bin/yapping/_.wav
Normal file
Binary file not shown.
1
public/bin/yapping/__attribution.txt
Normal file
1
public/bin/yapping/__attribution.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
these are from https://github.com/equalo-official/animalese-generator!
|
||||
BIN
public/bin/yapping/a.wav
Normal file
BIN
public/bin/yapping/a.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/b.wav
Normal file
BIN
public/bin/yapping/b.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/c.wav
Normal file
BIN
public/bin/yapping/c.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/d.wav
Normal file
BIN
public/bin/yapping/d.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/e.wav
Normal file
BIN
public/bin/yapping/e.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/f.wav
Normal file
BIN
public/bin/yapping/f.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/g.wav
Normal file
BIN
public/bin/yapping/g.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/h.wav
Normal file
BIN
public/bin/yapping/h.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/i.wav
Normal file
BIN
public/bin/yapping/i.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/j.wav
Normal file
BIN
public/bin/yapping/j.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/k.wav
Normal file
BIN
public/bin/yapping/k.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/l.wav
Normal file
BIN
public/bin/yapping/l.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/m.wav
Normal file
BIN
public/bin/yapping/m.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/n.wav
Normal file
BIN
public/bin/yapping/n.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/o.wav
Normal file
BIN
public/bin/yapping/o.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/p.wav
Normal file
BIN
public/bin/yapping/p.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/q.wav
Normal file
BIN
public/bin/yapping/q.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/r.wav
Normal file
BIN
public/bin/yapping/r.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/s.wav
Normal file
BIN
public/bin/yapping/s.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/sh.wav
Normal file
BIN
public/bin/yapping/sh.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/t.wav
Normal file
BIN
public/bin/yapping/t.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/th.wav
Normal file
BIN
public/bin/yapping/th.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/thonk1.wav
Normal file
BIN
public/bin/yapping/thonk1.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/thonk2.wav
Normal file
BIN
public/bin/yapping/thonk2.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/thonk3.wav
Normal file
BIN
public/bin/yapping/thonk3.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/u.wav
Normal file
BIN
public/bin/yapping/u.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/v.wav
Normal file
BIN
public/bin/yapping/v.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/w.wav
Normal file
BIN
public/bin/yapping/w.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/x.wav
Normal file
BIN
public/bin/yapping/x.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/y.wav
Normal file
BIN
public/bin/yapping/y.wav
Normal file
Binary file not shown.
BIN
public/bin/yapping/z.wav
Normal file
BIN
public/bin/yapping/z.wav
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue