mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-08-19 19:05:22 +02:00
Add base app.js, opening external links in new tabs
This commit is contained in:
15
app.js
Normal file
15
app.js
Normal 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);
|
Reference in New Issue
Block a user