Skip to content

Commit

Permalink
Merge pull request #209 from amadeus4dev/1218
Browse files Browse the repository at this point in the history
create click event for portal url links
  • Loading branch information
minjikarin authored Dec 18, 2023
2 parents 546a6f4 + fb7bd8d commit 7b1094c
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions overrides/main.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{#-
This file was automatically generated - do not edit
-#}
This file was automatically generated - do not edit
-#}

{% extends "base.html" %}
{% block extrahead %}
<script>
if (window.location.hostname === 'amadeus4dev.github.io') {
console.log(window.location.hostname);
const path = window.location.pathname;
const redirectPattern = /^\/([^/]+)/;
const redirectUrl = path.replace(redirectPattern, 'https://developers.amadeus.com/self-service/apis-docs/guides/$1');
document.write(`<meta http-equiv="refresh" content="0;url=${redirectUrl}" />
<link rel="canonical" href="${redirectUrl}" />`);
}
</script>
{% endblock %}
{% block extrahead %}
<script>
if (window.location.hostname === 'amadeus4dev.github.io') {
console.log(window.location.hostname);
const path = window.location.pathname;
const redirectPattern = /^\/([^/]+)/;
const redirectUrl = path.replace(redirectPattern, 'https://developers.amadeus.com/self-service/apis-docs/guides/$1');
document.write(`<meta http-equiv="refresh" content="0;url=${redirectUrl}" />`);
}

//event
document.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.open(href, '_blank');
}
}
});
</script>
{% endblock %}

0 comments on commit 7b1094c

Please sign in to comment.