summaryrefslogtreecommitdiffstats
path: root/source/javascripts/external.js
diff options
context:
space:
mode:
authorSkyArrow <tommy351@gmail.com>2012-01-24 18:05:55 +0100
committerSkyArrow <tommy351@gmail.com>2012-01-24 18:05:55 +0100
commitb6b1bb5d2ab5247780116091f9bc864990e46699 (patch)
tree0c79e2a8ab3512583db280ec09b208ae79703309 /source/javascripts/external.js
parentd3b064cf56fa934073ad071ede4ec1ab312348f6 (diff)
downloadoctopress-theme-jeyzu-b6b1bb5d2ab5247780116091f9bc864990e46699.zip
octopress-theme-jeyzu-b6b1bb5d2ab5247780116091f9bc864990e46699.tar.gz
open external link in new window
Diffstat (limited to 'source/javascripts/external.js')
-rw-r--r--source/javascripts/external.js13
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