blob: 76cca95b4bc8e1cb516197b81023c2a9a1b2acb4 (
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 React from 'dom-chef';
import select from 'select-dom';
import features from '../libs/features';
import {isPRCommit} from '../libs/page-detect';
function init() {
let commitUrl = location.pathname.replace(/\/$/, '');
if (isPRCommit()) {
commitUrl = commitUrl.replace(/\/pull\/\d+\/commits/, '/commit');
}
select('.commit-meta > :last-child').append(
<span class="sha-block patch-diff-links">
<a href={`${commitUrl}.patch`} class="sha">patch</a>
{ ' ' /* Workaround for: JSX eats whitespace between elements */ }
<a href={`${commitUrl}.diff`} class="sha">diff</a>
</span>
);
}
features.add({
id: 'patch-diff-links',
include: [
features.isCommit
],
load: features.onAjaxedPages,
init
});
|