diff options
Diffstat (limited to 'source/javascripts')
-rw-r--r-- | source/javascripts/external.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/javascripts/external.js b/source/javascripts/external.js new file mode 100644 index 0000000..2501d9b --- /dev/null +++ b/source/javascripts/external.js @@ -0,0 +1,13 @@ +(function($){ + var host = location.host; + + $('a').on('click', function(e){ + var href = $(this).attr('href'), + link = href.replace(/(https?:\/\/)(.*)\/(.*)/, '$2'); + + if (href.match('https?') && link != host){ + window.open(href); + e.preventDefault(); + } + }); +})(jQuery);
\ No newline at end of file |