Skip to content

Commit

Permalink
Updates header with a handy language toggle.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-lemon authored Sep 27, 2023
1 parent 034b8a4 commit 2481baa
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions docs/header.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@

<script type="text/javascript" src="_static/prism/prism.js"></script>

<form class="sidebar-search-container top" method="get" action="search.html" role="search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div style="display:flex;justify-content:flex-start;align-items: flex-end;">
<form class="sidebar-search-container top" method="get" action="search.html" role="search" style="width:75%">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div style="width:25%;margin:0px 10px;"><span style="font-size:11px;">Language: </span><span><a id="printableLang" href="javascript:changeLanguage()"></a></span></div>
</div>

<div style="display:flex;justify-content:space-between;align-items:center;margin-top:20px;">
<div class="discordLink" style="display:flex;align-items:center;margin-top: -5px;">
Expand All @@ -49,9 +52,27 @@

<script>
var url_string = window.location.href;
var a = document.getElementById('feedbackLinkTop');
a.setAttribute("href", "https://artifex.com/contributor/feedback.php?utm_source=rtd-pymupdf&utm_medium=rtd&utm_content=header-link&url="+url_string);
if (document.getElementsByTagName('html')[0].getAttribute('lang')=="ja") {
document.getElementById("printableLang").innerHTML = "日本語";
} else {
document.getElementById("printableLang").innerHTML = "English";
}
var url_string = window.location.href;
var a = document.getElementById('feedbackLinkTop');
a.setAttribute("href", "https://artifex.com/contributor/feedback.php?utm_source=rtd-pymupdf&utm_medium=rtd&utm_content=header-link&url="+url_string);
function changeLanguage() {
var new_url;
if (document.getElementsByTagName('html')[0].getAttribute('lang')=="ja") {
new_url = url_string.replace("/ja/", "/en/");
} else {
new_url = url_string.replace("/en/", "/ja/");
}
window.location.replace(new_url);
}
</script>

0 comments on commit 2481baa

Please sign in to comment.