From 6d064ae70ccb0712fc38c3b8d2e407b5b0ccd9a5 Mon Sep 17 00:00:00 2001 From: MinjiK Date: Mon, 18 Dec 2023 14:51:16 +0100 Subject: [PATCH 1/2] with another block --- overrides/main.html | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/overrides/main.html b/overrides/main.html index dd2cc69c..cf869449 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -13,16 +13,36 @@ document.write(``); } - //event - document.addEventListener('click', function (event) { + // Event listener for link clicks + window.addEventListener('DOMContentLoaded', (event) => { + document.body.addEventListener('click', function(event) { var target = event.target; if (target.tagName === 'A') { - var href = target.getAttribute('href'); - if (href.startsWith('https://developers.amadeus.com')) { - event.preventDefault(); - window.location.href = href; - } + var href = target.getAttribute('href'); + if (href.startsWith('https://developers.amadeus.com')) { + event.preventDefault(); + window.location.href = href; + } } + }); + }); + +{% endblock %} + +{% block scripts %} + {% endblock %} \ No newline at end of file From 37eb2188626cc2566c73d7676e64ffd98f7aef19 Mon Sep 17 00:00:00 2001 From: MinjiK Date: Mon, 18 Dec 2023 14:52:27 +0100 Subject: [PATCH 2/2] format --- overrides/main.html | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/overrides/main.html b/overrides/main.html index cf869449..3c2a0e29 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -15,16 +15,16 @@ // Event listener for link clicks window.addEventListener('DOMContentLoaded', (event) => { - document.body.addEventListener('click', function(event) { - var target = event.target; - if (target.tagName === 'A') { - var href = target.getAttribute('href'); - if (href.startsWith('https://developers.amadeus.com')) { - event.preventDefault(); - window.location.href = href; - } - } - }); + document.body.addEventListener('click', function (event) { + var target = event.target; + if (target.tagName === 'A') { + var href = target.getAttribute('href'); + if (href.startsWith('https://developers.amadeus.com')) { + event.preventDefault(); + window.location.href = href; + } + } + }); }); {% endblock %} @@ -33,16 +33,16 @@ {% endblock %} \ No newline at end of file