diff options
-rw-r--r-- | source/_includes/custom/after_footer.html | 1 | ||||
-rw-r--r-- | source/javascripts/external.js | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source/_includes/custom/after_footer.html b/source/_includes/custom/after_footer.html index 5e3eaa8..7796caf 100644 --- a/source/_includes/custom/after_footer.html +++ b/source/_includes/custom/after_footer.html @@ -1,2 +1,3 @@ <script src="{{ root_url }}/javascripts/jquery.easing.1.3.js"></script> +<script src="{{ root_url }}/javascripts/external.js"></script> <script src="{{ root_url }}/javascripts/twitter.js"></script>
\ No newline at end of file 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 |