blob: 9e0ea62ca527cc30342f4324c827ea878f9c4c32 (
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
|
import onetime from 'onetime';
import {observe} from 'selector-observer';
import {applyToLink} from 'shorten-repo-url';
import * as pageDetect from 'github-url-detection';
import features from '.';
import {linkifiedURLClass} from '../github-helpers/dom-formatters';
function init(): void {
observe(`a[href]:not(.${linkifiedURLClass})`, {
constructor: HTMLAnchorElement,
add(link) {
applyToLink(link, location.href);
}
});
}
void features.add({
id: __filebasename,
description: 'Shortens URLs and repo URLs to readable references like "_user/repo/.file@`d71718d`".',
screenshot: 'https://user-images.githubusercontent.com/1402241/27252232-8fdf8ed0-538b-11e7-8f19-12d317c9cd32.png'
}, {
exclude: [
// Due to GitHub’s bug: #2828
pageDetect.isGlobalSearchResults
],
init: onetime(init)
});
|