mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 15:25:01 -04:00
optimise addSelectedClass func
This commit is contained in:
parent
8ece85127a
commit
8649b90a04
1 changed files with 1 additions and 8 deletions
|
@ -611,14 +611,7 @@ class RecipeWaiter {
|
||||||
* @param {string} opDataName the data-name of the target operation
|
* @param {string} opDataName the data-name of the target operation
|
||||||
*/
|
*/
|
||||||
addSelectedClass(opDataName) {
|
addSelectedClass(opDataName) {
|
||||||
const list = document.querySelectorAll(".operation");
|
document.querySelector(`.operation[data-name="${opDataName}"]`).classList.add("selected");
|
||||||
const item = Array.from(list).filter((item) => item.getAttribute("data-name") === opDataName);
|
|
||||||
|
|
||||||
// when an item is listed in favourites, there are 2 of
|
|
||||||
// them and both need the 'selected' class ( checkmark )
|
|
||||||
item.forEach((op) => {
|
|
||||||
op.classList.add("selected");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue