Skip to content

Commit

Permalink
Open external links in new tab (gstamatelat#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
gstamatelat committed Jul 4, 2018
1 parent 8525ef8 commit 23fe8b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ wrapper {
javadoc {
doLast {
new File(destinationDir, 'stylesheet.css').append(file('src/javadoc/stylesheet.css').text)
new File(destinationDir, 'script.js').append(file('src/javadoc/script.js').text)
}
options.overview('src/javadoc/overview.html')
}
Expand Down
9 changes: 9 additions & 0 deletions src/javadoc/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
document.addEventListener('DOMContentLoaded', function () {
var anchors = document.getElementsByTagName('a');
var length = anchors.length;
for (var i = 0; i < length; i++) {
if (anchors[i].href.indexOf('http://') === 0 || anchors[i].href.indexOf('https://') === 0) {
anchors[i].target = '_blank';
}
}
}, false);

0 comments on commit 23fe8b5

Please sign in to comment.