lint: Require semicolons

This commit is contained in:
Cohee
2023-12-02 21:11:06 +02:00
parent 2ec14a59ee
commit c63cd87cc0
67 changed files with 1554 additions and 1552 deletions

View File

@ -27,7 +27,7 @@ const popupMessage = {
<span>Also delete the chat files</span>
</label><br></b>`;
},
}
};
/**
* Static object representing the actions of the
@ -42,7 +42,7 @@ class CharacterContextMenu {
*/
static tag = (selectedCharacters) => {
BulkTagPopupHandler.show(selectedCharacters);
}
};
/**
* Duplicate one or more characters
@ -58,7 +58,7 @@ class CharacterContextMenu {
headers: getRequestHeaders(),
body: JSON.stringify({ avatar_url: character.avatar }),
});
}
};
/**
* Favorite a character
@ -93,7 +93,7 @@ class CharacterContextMenu {
response.json().then(json => toastr.error('Character not saved. Error: ' + json.message + '. Field: ' + json.error));
}
});
}
};
/**
* Convert one or more characters to persona,
@ -139,12 +139,12 @@ class CharacterContextMenu {
}
});
}
})
});
}
eventSource.emit('characterDeleted', { id: this_chid, character: characters[this_chid] });
});
}
};
static #getCharacter = (characterId) => characters[characterId] ?? null;
@ -169,7 +169,7 @@ class CharacterContextMenu {
if (boundingRect.bottom > window.innerHeight) {
contextMenu.style.top = `${positionY - (boundingRect.bottom - window.innerHeight)}px`;
}
}
};
/**
* Hide the context menu
@ -190,7 +190,7 @@ class CharacterContextMenu {
{ id: 'character_context_menu_tag', callback: characterGroupOverlay.handleContextMenuTag }
];
contextMenuItems.forEach(contextMenuItem => document.getElementById(contextMenuItem.id).addEventListener('click', contextMenuItem.callback))
contextMenuItems.forEach(contextMenuItem => document.getElementById(contextMenuItem.id).addEventListener('click', contextMenuItem.callback));
}
}
@ -219,7 +219,7 @@ class BulkTagPopupHandler {
</div>
</div>
</div>
`
`;
};
/**
@ -329,7 +329,7 @@ class BulkEditOverlay {
eventSource.emit(event_types.CHARACTER_GROUP_OVERLAY_STATE_CHANGE_BEFORE, newState)
.then(() => {
this.#state = newState;
eventSource.emit(event_types.CHARACTER_GROUP_OVERLAY_STATE_CHANGE_AFTER, this.state)
eventSource.emit(event_types.CHARACTER_GROUP_OVERLAY_STATE_CHANGE_AFTER, this.state);
});
}
@ -355,7 +355,7 @@ class BulkEditOverlay {
constructor() {
if (bulkEditOverlayInstance instanceof BulkEditOverlay)
return bulkEditOverlayInstance
return bulkEditOverlayInstance;
this.container = document.getElementById(BulkEditOverlay.containerId);
@ -392,7 +392,7 @@ class BulkEditOverlay {
// Cohee: It only triggers when clicking on a margin between the elements?
// Feel free to fix or remove this, I'm not sure how to.
//this.container.addEventListener('click', this.handleCancelClick);
}
};
/**
* Handle state changes
@ -421,7 +421,7 @@ class BulkEditOverlay {
}
this.stateChangeCallbacks.forEach(callback => callback(this.state));
}
};
/**
* Block the browsers native context menu and
@ -430,7 +430,7 @@ class BulkEditOverlay {
enableContextMenu = () => {
this.container.addEventListener('contextmenu', this.handleContextMenuShow);
document.addEventListener('click', this.handleContextMenuHide);
}
};
/**
* Remove event listeners, allowing the native browser context
@ -439,7 +439,7 @@ class BulkEditOverlay {
disableContextMenu = () => {
this.container.removeEventListener('contextmenu', this.handleContextMenuShow);
document.removeEventListener('click', this.handleContextMenuHide);
}
};
handleDefaultContextMenu = (event) => {
if (this.isLongPress) {
@ -447,7 +447,7 @@ class BulkEditOverlay {
event.stopPropagation();
return false;
}
}
};
/**
* Opens menu on long-press.
@ -485,17 +485,17 @@ class BulkEditOverlay {
this.container.removeEventListener('touchend', cancelHold);
},
BulkEditOverlay.longPressDelay);
}
};
handleLongPressEnd = (event) => {
this.isLongPress = false;
if (this.#contextMenuOpen) event.stopPropagation();
}
};
handleCancelClick = () => {
if (false === this.#contextMenuOpen) this.state = BulkEditOverlayState.browse;
this.#contextMenuOpen = false;
}
};
/**
* Returns the position of the mouse/touch location
@ -513,7 +513,7 @@ class BulkEditOverlay {
this.handleContextMenuHide(event);
}
event.stopPropagation();
}
};
#enableClickEventsForGroups = () => this.#getDisabledElements().forEach((element) => element.removeEventListener('click', this.#stopEventPropagation));
@ -537,7 +537,7 @@ class BulkEditOverlay {
const character = event.currentTarget;
const characterId = character.getAttribute('chid');
const alreadySelected = this.selectedCharacters.includes(characterId)
const alreadySelected = this.selectedCharacters.includes(characterId);
const legacyBulkEditCheckbox = character.querySelector('.' + BulkEditOverlay.legacySelectedClass);
@ -548,26 +548,26 @@ class BulkEditOverlay {
if (legacyBulkEditCheckbox) legacyBulkEditCheckbox.checked = false;
this.dismissCharacter(characterId);
} else {
character.classList.add(BulkEditOverlay.selectedClass)
character.classList.add(BulkEditOverlay.selectedClass);
if (legacyBulkEditCheckbox) legacyBulkEditCheckbox.checked = true;
this.selectCharacter(characterId);
}
this.#cancelNextToggle = false;
}
};
handleContextMenuShow = (event) => {
event.preventDefault();
CharacterContextMenu.show(...this.#getContextMenuPosition(event));
this.#contextMenuOpen = true;
}
};
handleContextMenuHide = (event) => {
let contextMenu = document.getElementById(BulkEditOverlay.contextMenuId);
if (false === contextMenu.contains(event.target)) {
CharacterContextMenu.hide();
}
}
};
/**
* Concurrently handle character favorite requests.
@ -577,7 +577,7 @@ class BulkEditOverlay {
handleContextMenuFavorite = () => Promise.all(this.selectedCharacters.map(async characterId => CharacterContextMenu.favorite(characterId)))
.then(() => getCharacters())
.then(() => favsToHotswap())
.then(() => this.browseState())
.then(() => this.browseState());
/**
* Concurrently handle character duplicate requests.
@ -586,7 +586,7 @@ class BulkEditOverlay {
*/
handleContextMenuDuplicate = () => Promise.all(this.selectedCharacters.map(async characterId => CharacterContextMenu.duplicate(characterId)))
.then(() => getCharacters())
.then(() => this.browseState())
.then(() => this.browseState());
/**
* Sequentially handle all character-to-persona conversions.
@ -595,11 +595,11 @@ class BulkEditOverlay {
*/
handleContextMenuPersona = async () => {
for (const characterId of this.selectedCharacters) {
await CharacterContextMenu.persona(characterId)
await CharacterContextMenu.persona(characterId);
}
this.browseState();
}
};
/**
* Request user input before concurrently handle deletion
@ -623,14 +623,14 @@ class BulkEditOverlay {
.finally(() => hideLoader());
}
);
}
};
/**
* Attaches and opens the tag menu
*/
handleContextMenuTag = () => {
CharacterContextMenu.tag(this.selectedCharacters);
}
};
addStateChangeCallback = callback => this.stateChangeCallbacks.push(callback);
@ -646,7 +646,7 @@ class BulkEditOverlay {
document.querySelectorAll('#' + BulkEditOverlay.containerId + ' .' + BulkEditOverlay.selectedClass)
.forEach(element => element.classList.remove(BulkEditOverlay.selectedClass));
this.selectedCharacters.length = 0;
}
};
}
export { BulkEditOverlayState, CharacterContextMenu, BulkEditOverlay };