Replace this loop with a nice map.

This commit is contained in:
voussoir 2020-09-29 10:54:58 -07:00
parent 16dc6066df
commit ede7eab80b

View file

@ -458,7 +458,7 @@ function action_button_passthrough(event, action_function, action_argument)
if (this_card.classList.contains("video_card_selected")) if (this_card.classList.contains("video_card_selected"))
{ {
// The clicked card is indeed part of the current selected group. // The clicked card is indeed part of the current selected group.
elements = video_card_selections; elements = Array.from(video_card_selections);
} }
else else
{ {
@ -466,12 +466,8 @@ function action_button_passthrough(event, action_function, action_argument)
// action it by itself. // action it by itself.
elements = [this_card]; elements = [this_card];
} }
let video_ids = [];
for (const element of elements) const video_ids = elements.map(element => element.dataset["ytid"]).join(",");
{
video_ids.push(element.dataset["ytid"]);
}
video_ids = video_ids.join(",");
if (action_argument === undefined) if (action_argument === undefined)
{ {