From 24c680e5c33ee3f8cf41f3e92b6a1ec94cca0974 Mon Sep 17 00:00:00 2001 From: Anna Tsolakou Date: Mon, 18 Dec 2023 17:32:38 +0100 Subject: [PATCH] update scripts --- overrides/main.html | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/overrides/main.html b/overrides/main.html index b7f195f4..47d591b7 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -12,11 +12,35 @@ const redirectUrl = path.replace(redirectPattern, 'https://developers.amadeus.com/self-service/apis-docs/guides/$1'); document.write(``); } + + // Event listener for link clicks + window.addEventListener('DOMContentLoaded', (event) => { + document.body.addEventListener('click', function (event) { + var target = event.target; + console.log('we are in the second script'); + if (target.tagName === 'A') { + console.log('we are in the first if from second script'); + var href = target.getAttribute('href'); + if (href.startsWith('https://developers.amadeus.com')) { + console.log('we are in the second if from second script'); + event.preventDefault(); + window.location.href = href; + } + } + }); + }); {% endblock %} {% block scripts %} -{% endblock %} \ No newline at end of file +{% endblock %}