Make external links open in new tabs
This commit is contained in:
parent
0410065d5d
commit
9c1985e01e
|
@ -1,6 +1,16 @@
|
||||||
// Hamburger menu script for mobile.
|
// Hamburger menu script for mobile.
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
|
// Make all off-site hyperlinks open in a new tab.
|
||||||
|
(document.querySelectorAll("a") || []).forEach(node => {
|
||||||
|
let href = node.attributes.href;
|
||||||
|
if (href === undefined) return;
|
||||||
|
href = href.textContent;
|
||||||
|
if (href.indexOf("http:") === 0 || href.indexOf("https:") === 0) {
|
||||||
|
node.target = "_blank";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Hamburger menu script.
|
// Hamburger menu script.
|
||||||
(function() {
|
(function() {
|
||||||
// Get all "navbar-burger" elements
|
// Get all "navbar-burger" elements
|
||||||
|
|
|
@ -145,16 +145,4 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
|
||||||
let $file = document.querySelector("#file"),
|
|
||||||
$fileName = document.querySelector("#fileName");
|
|
||||||
|
|
||||||
$file.addEventListener("change", function() {
|
|
||||||
let file = this.files[0];
|
|
||||||
$fileName.innerHTML = file.name;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{end}}
|
{{end}}
|
Loading…
Reference in New Issue
Block a user