Add base app.js, opening external links in new tabs

This commit is contained in:
Donovan Glover 2017-12-01 23:06:32 -05:00
parent f328b8bfe8
commit 72d773c182
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D

15
app.js Normal file
View File

@ -0,0 +1,15 @@
;(function(window, document, undefined) {
"use strict";
// Open all external links in new tabs
var links = document.getElementsByTagName("a");
for(var i = 0; i < links.length; i++) {
var thisLink = links[i];
if(thisLink.getAttribute("href") && thisLink.hostName !== location.hostname) {
thisLink.target = "_blank";
}
}
})(window, document);