summaryrefslogtreecommitdiff
path: root/source/features/select-all-notifications-shortcut.tsx
blob: 96b2d4d822cd9f83cd814eebf0e6061b98f1738d (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
import select 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 {
	select('.js-notifications-mark-all-prompt')!.click();
}

function init(): Deinit {
	return registerHotkey('a', selectAllNotifications);
}

void features.add(import.meta.url, {
	shortcuts: {
		a: 'Select all notifications',
	},
	include: [
		pageDetect.isNotifications,
	],
	exclude: [
		pageDetect.isBlank, // Empty notification list
	],
	deduplicate: 'has-rgh',
	init,
});