Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onload = Initialize;
- var Input;
- var Output;
- function Initialize()
- {
- Input = document.getElementById("Input");
- Output = document.getElementById("Output");
- Input.oninput = GetEmotes;
- }
- function GetEmotes()
- {
- var TempResults = [];
- for (var i = Output.children.length - 1; i >= 0; i--)
- {
- if (!Output.children[i].value.includes(Input.value) || Input.value == "")
- {
- console.log(Output.children[i]);
- console.log(Output.children.length);
- Output.remove(Output.children[i]);
- }
- else
- {
- TempResults.push(Output.children[i].value);
- }
- }
- if (Input.value != "")
- {
- for (var key in emotes)
- {
- if (key.includes(Input.value.toLowerCase()) && TempResults.indexOf(key) === -1)
- {
- var NewButton = document.createElement("button");
- NewButton.value = key;
- NewButton.innerText = emotes[key];
- NewButton.onclick = Paste;
- Output.appendChild(NewButton);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement