fix external links

This commit is contained in:
samaradel 2023-08-20 14:28:24 +03:00
parent 5f20d705cf
commit dfdcc8a4fc
6 changed files with 58 additions and 100 deletions

View File

@ -42,5 +42,4 @@ extra:
{% end %} {% end %}
- [Knowledge]("https://ourworldventures.github.io/info_ourworld/intro/intro.html") - [Knowledge]("https://ourworldventures.github.io/info_ourworld/intro/intro.html")
- [Contact]("mailto:info@ourworld.tf")

View File

@ -114,10 +114,24 @@ window.onload = function () {
}); });
}) })
var links = document.links;
var internal_hosts = [
'www.ourworld.tf',
'ourworld.tf',
'www2.ourworld.tf',
'localhost',
'127.0.0.1'
]
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (!internal_hosts.includes(links[i].hostname)) {
links[i].target = '_blank';
}
}
document.getElementById("filter-btn").addEventListener('click', toggleFilter); document.getElementById("filter-btn").addEventListener('click', toggleFilter);
document.getElementById("mobile-learn-btn").addEventListener('click', toggleMenu); document.getElementById("mobile-learn-btn").addEventListener('click', toggleMenu);
} }
function openInNewTab(url) { function openInNewTab(url) {
window.open(url, '_blank').focus() window.open(url, '_blank').focus()
} }

View File

@ -1,14 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" charset="utf-8"> <html lang="en" charset="utf-8">
{% include "partials/head.html" %}
<body>
{% include "partials/header.html" %}
<div id="content" class="py-4 sm:py-12 md:py-16 lg:py-18 overflow-hidden">
{% block content %}{% endblock %}
</div>
{% include "partials/footer.html" %}
<script type="text/javascript" src="{{ get_url(path='js/custom.js')}}"></script>
</body>
{% include "partials/head.html" %}
<body>
{% include "partials/header.html" %}
<div id="content" class="py-4 sm:py-12 md:py-16 lg:py-18 overflow-hidden">
{% block content %}{% endblock %}
</div>
{% include "partials/footer.html" %}
<script type="text/javascript" src="{{ get_url(path='js/custom.js')}}"></script>
</body>
</html> </html>

View File

@ -3,8 +3,8 @@
{% block content %} {% block content %}
<main> <main>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script> <!-- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script> -->
<script>mermaid.initialize({startOnLoad:true});</script> <!-- <script>mermaid.initialize({startOnLoad:true});</script> -->
<div> <div>
{% if page %} {% if page %}
{{page.content | safe}} {{page.content | safe}}

View File

@ -52,50 +52,7 @@
cookieconsent.run({ "notice_banner_type": "headline", "consent_type": "express", "palette": "light", "language": "en", "page_load_consent_levels": ["strictly-necessary"], "notice_banner_reject_button_hide": false, "preferences_center_close_button_hide": false, "website_name": "https://ourworld.tf/", "website_privacy_policy_url": "https://library.threefold.me/info/legal/#/legal__privacypolicy" }); cookieconsent.run({ "notice_banner_type": "headline", "consent_type": "express", "palette": "light", "language": "en", "page_load_consent_levels": ["strictly-necessary"], "notice_banner_reject_button_hide": false, "preferences_center_close_button_hide": false, "website_name": "https://ourworld.tf/", "website_privacy_policy_url": "https://library.threefold.me/info/legal/#/legal__privacypolicy" });
}); });
</script> </script>
<!-- Google Tag Manager -->
<script>(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-N7PNMFH');</script>
<!-- End Google Tag Manager -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-100065546-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-100065546-1');
</script>
<!-- Matomo Tag Manager -->
<script>
var _mtm = window._mtm = window._mtm || [];
_mtm.push({ 'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start' });
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.async = true; g.src = 'https://analytics.ourworld.tf/js/container_KIcuIdn4.js'; s.parentNode.insertBefore(g, s);
</script>
<!-- End Matomo Tag Manager -->
<!-- Crisp -->
<script type="text/plain" cookie-consent="tracking">
window.$crisp = [];
window.CRISP_WEBSITE_ID = "1a5a5241-91cb-4a41-8323-5ba5ec574da0";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
</script>
<!-- Crisp without cookies -->
<!-- <script type="text/javascript" cookie-consent="tracking"> <!-- <script type="text/javascript" cookie-consent="tracking">
window.$crisp = []; window.$crisp = [];
window.CRISP_WEBSITE_ID = "1a5a5241-91cb-4a41-8323-5ba5ec574da0"; window.CRISP_WEBSITE_ID = "1a5a5241-91cb-4a41-8323-5ba5ec574da0";
@ -158,19 +115,4 @@
<script type='text/javascript' <script type='text/javascript'
src='https://platform-api.sharethis.com/js/sharethis.js#property=62556aac80366d0019fc1af2&product=sop' src='https://platform-api.sharethis.com/js/sharethis.js#property=62556aac80366d0019fc1af2&product=sop'
async='async'></script> async='async'></script>
<!-- MailerLite Universal -->
<script>
(function (m, a, i, l, e, r) {
m['MailerLiteObject'] = e; function f() {
var c = { a: arguments, q: [] }; var r = this.push(c); return "number" != typeof r ? r : f.bind(c.q);
}
f.q = f.q || []; m[e] = m[e] || f.bind(f.q); m[e].q = m[e].q || f.q; r = a.createElement(i);
var _ = a.getElementsByTagName(i)[0]; r.async = 1; r.src = l + '?v' + (~~(new Date().getTime() / 1000000));
_.parentNode.insertBefore(r, _);
})(window, document, 'script', 'https://static.mailerlite.com/js/universal.js', 'ml');
var ml_account = ml('accounts', '1778010', 'x2d3d9f8n1', 'load');
</script>
<!-- End MailerLite Universal -->
</head> </head>

View File

@ -31,38 +31,40 @@
</div> </div>
<div class="hidden lg:flex-1 lg:flex lg:items-center lg:justify-end lg:space-x-12"> <div class="hidden lg:flex-1 lg:flex lg:items-center lg:justify-end lg:space-x-12">
<nav class="flex space-x-10"> <nav class="flex space-x-10">
{% for header_item in header_items %} {% for header_item in header_items %}
{% if not loop.first %} {% if not loop.first %}
{% set header_arr = header_item | split(pat="</li>") %} {% set header_arr = header_item | split(pat="</li>") %}
{% set header_label = header_arr[0] %} {% set header_label = header_arr[0] %}
{% if '<a' in header_label %} {% if '<a' in header_label %}
{% set link_label = header_label | striptags %} {% set link_label = header_label | striptags %}
{% set link_path = header_label | split(pat="%22") | safe%} {% set link_path = header_label | split(pat="%22") | safe%}
{% if header_label is containing("http") %} {% if header_label is containing("http") %}
<a href="{{link_path[1]}}" target="_blank" class="text-lg leading-6 font-medium text-gray-900 hover:text-gray-500 focus:outline-none focus:text-gray-900 transition ease-in-out duration-150 mt-0"> {% if header_label is not containing("ourworld.tf") %}
<a href="{{link_path[1]}}" target="_blank" class="text-lg leading-6 font-medium text-gray-900 hover:text-gray-500 focus:outline-none focus:text-gray-900 transition ease-in-out duration-150 mt-0">
{{link_label}}
</a>
{% endif %}
{% else %}
<a href="{{ get_url(path=link_path[1])}}" class="text-lg leading-6 font-medium text-gray-900 hover:text-gray-500 focus:outline-none focus:text-gray-900 transition ease-in-out duration-150 mt-0">
{{link_label}} {{link_label}}
</a> </a>
{% endif %}
{% else %} {% else %}
<a href="{{ get_url(path=link_path[1])}}" class="text-lg leading-6 font-medium text-gray-900 hover:text-gray-500 focus:outline-none focus:text-gray-900 transition ease-in-out duration-150 mt-0"> <div class="relative">
{{link_label}} {% set button_id = header_label ~ "-menu-btn" | slugify %}
</a> <button type="button" id="{{button_id}}" class="nav_btn font-medium text-gray-900 hover:text-gray-500 group inline-flex items-center space-x-2 text-lg leading-6 font-normal hover:text-gray-500 focus:outline-none transition ease-in-out duration-150">
{% endif %} <span>{{ header_label }}</span>
{% else %} <div class="-rotate-90 transition-transform"><svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg></div>
<div class="relative"> </button>
{% set button_id = header_label ~ "-menu-btn" | slugify %} </div>
<button type="button" id="{{button_id}}" class="nav_btn font-medium text-gray-900 hover:text-gray-500 group inline-flex items-center space-x-2 text-lg leading-6 font-normal hover:text-gray-500 focus:outline-none transition ease-in-out duration-150">
<span>{{ header_label }}</span> {% endif %}
<div class="-rotate-90 transition-transform"><svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg></div> {% endif %}
</button>
</div>
{% endif %}
{% endif %}
{% endfor %} {% endfor %}
</nav> <a href="mailto:info@ourworld.tf" target="_blank" class="text-lg leading-6 font-medium text-gray-900 hover:text-gray-500 focus:outline-none focus:text-gray-900 transition ease-in-out duration-150 mt-0">
Contact
</a>
</nav>
</div> </div>
</div> </div>
</div> </div>