summaryrefslogtreecommitdiff
path: root/source/features/select-all-notifications-shortcut.tsx
blob: 9fc46687c155ea87b8f66288f49b9682f2953b17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {$} from 'select-dom';
import * as pageDetect from 'github-url-detection';

import features from '../feature-manager.js';
import {registerHotkey} from '../github-helpers/hotkey.js';

function selectAllNotifications(): void {
	$('.js-notifications-mark-all-prompt')!.click();
}

function init(signal: AbortSignal): void {
	registerHotkey('a', selectAllNotifications, {signal});
}

void features.add(import.meta.url, {
	shortcuts: {
		a: 'Select all notifications',
	},
	include: [
		pageDetect.isNotifications,
	],
	exclude: [
		pageDetect.isBlank,
	],
	init,
});

/*

Test URLs:

https://github.com/notifications

*/