open external links in new tab

This commit is contained in:
Marco Biedermann 2015-11-10 11:15:37 +01:00
parent c1ac3ed9f0
commit 0cdca0e896

View File

@ -36,12 +36,12 @@
// requestAnimationFrame
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
var x;
var i;
var length = vendors.length;
for (x = 0; x < length && !requestAnimationFrame; ++x) {
requestAnimationFrame = [vendors[x] + 'RequestAnimationFrame'];
cancelAnimationFrame = [vendors[x] + 'CancelAnimationFrame'] || [vendors[x] + 'CancelRequestAnimationFrame'];
for (i = 0; i < length && !requestAnimationFrame; ++i) {
requestAnimationFrame = [vendors[i] + 'RequestAnimationFrame'];
cancelAnimationFrame = [vendors[i] + 'CancelAnimationFrame'] || [vendors[i] + 'CancelRequestAnimationFrame'];
}
if (!requestAnimationFrame)
@ -99,4 +99,14 @@
scrollTo(document.getElementById(this.href.split('#')[1]).offsetTop, 800, easing.easeInOutQuad);
});
// Links
var links = document.links;
length = links.length;
for (i = 0; i < length; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
}(window, document));