NeoGriever

Untitled

Jun 30th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. class PetNameBox {
  2. constructor () {
  3. this.petNameBox = null;
  4. this.petNameButton = null;
  5. this.tempBox3 = null;
  6. this.renamingList = [];
  7. this.petNameBox = document.createElement("div");
  8. this.petNameBox.appendChild(document.createTextNode("Auto-Namensgebung"));
  9. this.petNameBox.style = "font-size:16px;margin:0px 8px 4px 8px;padding:4px;border:1px solid rgba(0, 0, 0, 0.7);text-align:center;background:rgba(255, 255, 255, 0.65);";
  10. this.petNameButton = userInterface.createButton("Start", this.namePets);
  11. this.petNameBox.appendChild(this.petNameButton);
  12. this.tempBox3 = document.createElement("div");
  13. this.tempBox3.innerHTML = "---- > ----";
  14. this.petNameBox.appendChild(this.tempBox3);
  15. userInterface.obj.appendChild(this.petNameBox);
  16. }
  17. petRenamingResult (rsl) {
  18. this.tempBox3.innerHTML = petID + " > " + newName + " " + ((rsl===true)?"✓":"✗");
  19. setTimeout(this.renameNextPet, userInterface.selectorParam("turboSpeed"));
  20. }
  21. renameNextPet () {
  22. if (this.petNameButton.value !== "Start") {
  23. if (this.renamingList.length > 0) {
  24. var petID = this.renamingList.shift();
  25. var newName = nameGen.next();
  26. this.tempBox3.innerHTML = petID + " > " + newName;
  27. this.renamePet(this.petRenamingResult, petID, newName);
  28. } else {
  29. this.petNameButton.value = "Start";
  30. this.tempBox3.innerHTML = "---- > ----";
  31. }
  32. } else {
  33. this.tempBox3.innerHTML = "---- > ----";
  34. }
  35. }
  36. setRandomNameOfPet (rsl) {
  37. this.renamingList = rsl;
  38. setTimeout(this.renameNextPet, 5);
  39. }
  40. namePets () {
  41. if (this.petNameButton.value !== "Start") {
  42. this.petNameButton.value = "Start";
  43. } else {
  44. this.petNameButton.value = "Stop";
  45. users.getUnnamed(this.setRandomNameOfPet);
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment