-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (30 loc) · 1.47 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var last_selected = [null,null];
function changePokemon(element){
last_selected = [last_selected[1], element.selectedIndex]
let textarea = document.getElementById("textarea-2");
let name_last = element.children[last_selected[0]].text.split(" ")[1].split(".")[0].replace(/♀|♂/g,"");
let name_curr = element.children[last_selected[1]].text.split(" ")[1].split(".")[0].replace(/♀|♂/g,"");
if(textarea.value.includes(name_last)){
textarea.value = textarea.value.replace(name_last, name_curr);
changeText("text2",2);
}
}
function startRecording() {
resetAll();
resetTime();
document.getElementById("modal-body").innerHTML = "<div id='ba' class='bar'></div>";
document.getElementById("modal-title").innerHTML = "Generating gif...";
recorder = new GIF({
workers: 2,
quality: 10
});
recording = true;
recorder.on('finished',(blob) =>{
document.getElementById("modal-title").innerHTML = "Gif ready!";
document.getElementById("modal-body").innerHTML = "<a download='pokemon-encounter' id='download-image'><img id='gif'></a> <a class='btn btn-default' download='pokemon-encounter' id='download-button'>Download</a>";
document.getElementById("download-button").href = URL.createObjectURL(blob);
document.getElementById("download-image").href = URL.createObjectURL(blob);
document.getElementById("gif").src = URL.createObjectURL(blob);
restartAnimation();
});
}