2021-03-11 05:43:45 +01:00
|
|
|
import $ from "jquery";
|
|
|
|
|
2023-05-15 14:47:12 +02:00
|
|
|
const list_selectors = [
|
|
|
|
"#stream_filters",
|
2023-10-10 21:00:28 +02:00
|
|
|
"#left-sidebar-navigation-list",
|
2023-08-23 07:54:50 +02:00
|
|
|
"#buddy-list-users-matching-view",
|
2023-08-23 02:18:53 +02:00
|
|
|
"#buddy-list-other-users",
|
2023-05-15 14:47:12 +02:00
|
|
|
"#send_later_options",
|
|
|
|
];
|
2017-04-04 18:14:27 +02:00
|
|
|
|
2021-06-14 01:44:41 +02:00
|
|
|
export function inside_list(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): boolean {
|
2019-11-02 00:06:25 +01:00
|
|
|
const $target = $(e.target);
|
|
|
|
const in_list = $target.closest(list_selectors.join(", ")).length > 0;
|
2017-04-04 18:14:27 +02:00
|
|
|
return in_list;
|
2021-02-28 01:05:44 +01:00
|
|
|
}
|
2017-04-04 18:14:27 +02:00
|
|
|
|
2021-06-14 01:44:41 +02:00
|
|
|
export function go_down(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void {
|
2019-11-02 00:06:25 +01:00
|
|
|
const $target = $(e.target);
|
2020-07-20 21:24:26 +02:00
|
|
|
$target.closest("li").next().find("a").trigger("focus");
|
2021-02-28 01:05:44 +01:00
|
|
|
}
|
2017-04-04 18:14:27 +02:00
|
|
|
|
2021-06-14 01:44:41 +02:00
|
|
|
export function go_up(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void {
|
2019-11-02 00:06:25 +01:00
|
|
|
const $target = $(e.target);
|
2020-07-20 21:24:26 +02:00
|
|
|
$target.closest("li").prev().find("a").trigger("focus");
|
2021-02-28 01:05:44 +01:00
|
|
|
}
|