aboutsummaryrefslogtreecommitdiff
path: root/docs/js/open-in-new-tab.js
blob: 667de75e1f5a0a2edb15062d286d45b67dd23773 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
document$.subscribe(function() {
    const IGNORED_PATHS = []

    for (const ignoredPath of IGNORED_PATHS) {
        if (window.location.pathname.match(`(\/${ignoredPath}[\/?].*)`)) {
            return;
        }
    }

    let links = document.getElementsByTagName("a");

    for (const link of links) {
        if (link.hostname !== window.location.hostname) {
            link.target = "_blank";
        }
    }
})