only _blank links while downloading. fixed safari link after download

This commit is contained in:
Danny Coates 2017-08-05 09:40:57 -07:00
parent 432a39d313
commit 859554ce21
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
8 changed files with 74 additions and 60 deletions

19
frontend/src/links.js Normal file
View file

@ -0,0 +1,19 @@
let links = []
document.addEventListener('DOMContentLoaded', function () {
links = document.querySelectorAll('a:not([target])')
})
function setOpenInNewTab(bool) {
if (bool === false) {
links.forEach(l => l.removeAttribute('target'));
}
else {
links.forEach(l => l.setAttribute('target', '_blank'));
}
}
module.exports = {
setOpenInNewTab
}