blob: f61484475abf9a9d7da8f62349cb91571b24fc9d (
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
|
import delegate from 'delegate-it';
import * as pageDetect from 'github-url-detection';
import features from '.';
import GitHubURL from '../github-helpers/github-url';
function followLocalLink(event: delegate.Event<MouseEvent, HTMLAnchorElement>): void {
if (new GitHubURL(event.delegateTarget.href).filePath === new GitHubURL(location.href).filePath) {
location.hash = event.delegateTarget.hash;
event.preventDefault();
}
}
function init(): void {
delegate(document, '.TagsearchPopover-item', 'click', followLocalLink);
}
void features.add(__filebasename, {
include: [
pageDetect.isSingleFile
],
init
});
|