From 63dafcd4f81311d13628d8fa41e0fddc2a367140 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 9 Feb 2016 01:36:57 +0100 Subject: [PATCH] open all external links in new window, closes #29 --- _src/_assets/javascripts/bigchain.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/_src/_assets/javascripts/bigchain.js b/_src/_assets/javascripts/bigchain.js index cf460e2..c158224 100644 --- a/_src/_assets/javascripts/bigchain.js +++ b/_src/_assets/javascripts/bigchain.js @@ -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 //