open all external links in new window, closes #29

This commit is contained in:
Matthias Kretschmann 2016-02-09 01:36:57 +01:00
parent ec65a32f5c
commit 63dafcd4f8
1 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,17 @@ jQuery(function($) {
);
//
// Open all external links in new window
//
$('a').not('[href*="mailto:"]').each(function () {
var isInternalLink = new RegExp('/' + window.location.host + '/');
if ( !isInternalLink.test(this.href) ) {
$(this).attr('target', '_blank');
}
});
//
// Automatically add header links to all Markdown headings
//