blob: 56aea395ffd2f44cb585cd6a73710f85cbea5a60 (
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
|
import delegate from 'delegate-it';
import * as pageDetect from 'github-url-detection';
import features from '.';
let previousSubmission = 0;
function preventSubmit(event: delegate.Event<MouseEvent, HTMLButtonElement>): void {
if (Date.now() - previousSubmission < 1000) {
event.preventDefault();
}
previousSubmission = Date.now();
}
function init(): void {
delegate(document, '#new_pull_request', 'submit', preventSubmit);
}
void features.add({
id: __filebasename,
description: 'Avoids creating duplicate PRs when mistakenly clicking "Create pull request" more than once.',
screenshot: 'https://user-images.githubusercontent.com/16872793/89589967-e029c200-d814-11ea-962b-3ff1f6236781.gif'
}, {
include: [
pageDetect.isCompare
],
init
});
|