mirror of
https://github.com/timvisee/send.git
synced 2026-04-28 23:16:19 -04:00
formatting / links rel
This commit is contained in:
+14
-10
@@ -1,19 +1,23 @@
|
||||
let links = [];
|
||||
|
||||
let links = []
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
links = document.querySelectorAll('a:not([target])')
|
||||
})
|
||||
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'));
|
||||
links.forEach(l => {
|
||||
l.removeAttribute('target');
|
||||
l.removeAttribute('rel');
|
||||
});
|
||||
} else {
|
||||
links.forEach(l => {
|
||||
l.setAttribute('target', '_blank');
|
||||
l.setAttribute('rel', 'noopener noreferrer');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setOpenInNewTab
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user