Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PetNameBox {
- constructor () {
- this.petNameBox = null;
- this.petNameButton = null;
- this.tempBox3 = null;
- this.renamingList = [];
- this.petNameBox = document.createElement("div");
- this.petNameBox.appendChild(document.createTextNode("Auto-Namensgebung"));
- 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);";
- this.petNameButton = userInterface.createButton("Start", this.namePets);
- this.petNameBox.appendChild(this.petNameButton);
- this.tempBox3 = document.createElement("div");
- this.tempBox3.innerHTML = "---- > ----";
- this.petNameBox.appendChild(this.tempBox3);
- userInterface.obj.appendChild(this.petNameBox);
- }
- petRenamingResult (rsl) {
- this.tempBox3.innerHTML = petID + " > " + newName + " " + ((rsl===true)?"✓":"✗");
- setTimeout(this.renameNextPet, userInterface.selectorParam("turboSpeed"));
- }
- renameNextPet () {
- if (this.petNameButton.value !== "Start") {
- if (this.renamingList.length > 0) {
- var petID = this.renamingList.shift();
- var newName = nameGen.next();
- this.tempBox3.innerHTML = petID + " > " + newName;
- this.renamePet(this.petRenamingResult, petID, newName);
- } else {
- this.petNameButton.value = "Start";
- this.tempBox3.innerHTML = "---- > ----";
- }
- } else {
- this.tempBox3.innerHTML = "---- > ----";
- }
- }
- setRandomNameOfPet (rsl) {
- this.renamingList = rsl;
- setTimeout(this.renameNextPet, 5);
- }
- namePets () {
- if (this.petNameButton.value !== "Start") {
- this.petNameButton.value = "Start";
- } else {
- this.petNameButton.value = "Stop";
- users.getUnnamed(this.setRandomNameOfPet);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment