diff --git a/theme/static/js/script.js b/theme/static/js/script.js index 750611052c4c3b7efca5b2f8f35f0961eef01279..b5670f48501f4702371b0b1904f53e30fb52dfd1 100644 --- a/theme/static/js/script.js +++ b/theme/static/js/script.js @@ -76,4 +76,18 @@ } }).change(); } -})("form") +})("form"); + + + + +/* Make all external links open in new tab. + * Adapted from http://mitchbarry.com/handling-external-links/ + */ +(function() { + for (var links = document.links, i = 0, link; link = links[i]; i++) { + if (link.hostname !== window.location.host.split('.').slice(-2).join('.')) { + link.target = '_blank'; + } + } +})();