Skip to content

Commit

Permalink
add again dom loaded listener
Browse files Browse the repository at this point in the history
  • Loading branch information
tsolakoua committed Dec 18, 2023
1 parent c9bfc55 commit 6086e1d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
{% block scripts %}
<script>
// Event listener for link clicks
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');
var href = target.getAttribute('href');
if (href.includes('developers.amadeus.com')) {
console.log('we are in the second if');
event.preventDefault();
console.log('href:', href);
window.location.href = href;
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.includes('developers.amadeus.com')) {
console.log('we are in the second if from second script');
event.preventDefault();
window.location.href = href;
}
}
}
});
});
</script>
{% endblock %}

0 comments on commit 6086e1d

Please sign in to comment.