Skip to content

Commit

Permalink
Footnote: support Japanese
Browse files Browse the repository at this point in the history
  • Loading branch information
remibetin committed Feb 13, 2024
1 parent 7a109ea commit d5e45ec
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions assets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,21 @@ if (document.querySelector('main')) {
element.setAttribute('title', t('to footnote') + ' ' + element.textContent);
});

let pageLang = document.documentElement.lang || document.getElementsByTagName('html')[0].getAttribute('xml:lang');

var footnoteBackLinks = footnoteBox.querySelectorAll('a.reversefootnote');

Array.prototype.forEach.call(footnoteBackLinks, function(element, i){
element.setAttribute('aria-label', t('back to footnote') + ' ' + element.getAttribute('href').replace('#fnref:','') + ' ' + t('in text'));
element.setAttribute('title', t('back to footnote') + ' ' + element.getAttribute('href').replace('#fnref:','') + ' ' + t('in text'));
if (pageLang === "ja") {
element.setAttribute('aria-label', t('in text') + ' ' + element.getAttribute('href').replace('#fnref:', '') + ' ' + t('back to footnote'));
element.setAttribute('title', t('in text') + ' ' + element.getAttribute('href').replace('#fnref:','') + ' ' + t('back to footnote'));
}
else {
element.setAttribute('aria-label', t('back to footnote') + ' ' + element.getAttribute('href').replace('#fnref:', '') + ' ' + t('in text'));
element.setAttribute('title', t('back to footnote') + ' ' + element.getAttribute('href').replace('#fnref:','') + ' ' + t('in text'));
}
});

}

}());
}());

0 comments on commit d5e45ec

Please sign in to comment.