summaryrefslogtreecommitdiff
path: root/source/features/fix-squash-and-merge-title.tsx
blob: 86187388ecb4be49c153dfc6c77fc29e7593bfe0 (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
import select from 'select-dom';
import features from '../libs/features';

function init() {
	const btn = select('.merge-message .btn-group-squash [type=button]');
	if (!btn) {
		return false;
	}

	btn.addEventListener('click', () => {
		const title = select('.js-issue-title').textContent;
		const number = select('.gh-header-number').textContent;
		select<HTMLTextAreaElement>('#merge_title_field').value = `${title.trim()} (${number})`;
	});
}

features.add({
	id: 'fix-squash-and-merge-title',
	include: [
		features.isPR
	],
	load: features.onAjaxedPages,
	init
});