This should work once the Belarusian translation uploaded

Future maintenance will simply be adding new entries to the `versions` array.
This commit is contained in:
Jacob Heider 2022-09-12 18:32:41 -04:00
parent 941315f7a8
commit d535481a98
No known key found for this signature in database
GPG key ID: A98011B5713535BF
2 changed files with 22 additions and 15 deletions

View file

@ -10,4 +10,5 @@ exclude = [
"https://www.clarity.ms/tag/", "https://www.clarity.ms/tag/",
"https://www.googletagmanager.com/gtm.js", "https://www.googletagmanager.com/gtm.js",
".*/mailto:.*@.*", ".*/mailto:.*@.*",
"https://tea.xyz/tea.white-paper",
] ]

View file

@ -79,23 +79,29 @@
<button class="btn btn-secondary dropdown-toggle languages" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-secondary dropdown-toggle languages" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Choose a Language Choose a Language
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu" id="language-selector"></ul>
<li><a class="dropdown-item" onclick="go('')">English</a></li>
<li><a class="dropdown-item" onclick="go('')">Belarusian</a></li>
<li><a class="dropdown-item" onclick="go('')">German</a></li>
<li><a class="dropdown-item" onclick="go('')">Indonesian</a></li>
<li><a class="dropdown-item" onclick="go('')">Korean</a></li>
<li><a class="dropdown-item" onclick="go('')">Spanish</a></li>
</ul>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
function go(loc) { const versions = [
document.getElementById('wp-iframe').src = loc; ['English', ''],
document.getElementById('mobile-wp-download').href = loc; ['беларускі', '_be']
];
document.addEventListener('DOMContentLoaded', function () {
for (const lang of versions) {
$('#language-selector').append("<li><a class=\"dropdown-item\" onclick=\"go(\'" + lang[1] + "')\">" + lang[0] + "</a></li>");
}
}, false);
function go(suffix) {
const url = 'https://tea.xyz/tea.white-paper' + suffix + '.pdf';
document.getElementById('wp-iframe').setAttribute('src', url + '#toolbar=0&navpanes=0&view=fitH');
document.getElementById('mobile-wp-download').setAttribute('href', url);
} }
</script> </script>