Skip to content

Commit f731869

Browse files
committed
updated JavaScript to remove JQuery
1 parent 029e7dc commit f731869

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

P5/Utilities/guidelines.xsl.model

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -621,23 +621,51 @@
621621
<script type="text/javascript" src="popupFootnotes.js"/>
622622
<xsl:comment>CAMPAIGN JS</xsl:comment>
623623
<script type="text/javascript">
624-
$(function() {
625-
$(".displayRelaxButton").click(function() {
626-
$(this).parent().find('.RNG_XML').toggle();
627-
$(this).parent().find('.RNG_Compact').toggle();
628-
});
629-
$(".tocTree .showhide").click(function() {
630-
$(this).find(".tocShow,.tocHide").toggle();
631-
$(this).parent().find("ul.continuedtoc").toggle();
632-
});
624+
document.addEventListener("DOMContentLoaded", function() {
625+
var relaxBtns = document.querySelectorAll(".displayRelaxButton");
626+
if (relaxBtns) {
627+
relaxBtns.forEach(function(btn) {
628+
btn.onclick = function() {
629+
var rngs = btn.parentElement.querySelectorAll('.RNG_XML');
630+
var rncs = btn.parentElement.querySelectorAll('.RNG_Compact');
631+
if (rngs) {
632+
rngs.forEach(function(rng) {
633+
rng.style.display = getComputedStyle(rng).display === "none" ? "block" : "none";
634+
})
635+
}
636+
if (rncs) {
637+
rncs.forEach(function(rnc) {
638+
rnc.style.display = getComputedStyle(rnc).display === "none" ? "block" : "none";
639+
})
640+
}
641+
}
633642
})
643+
}
644+
var showHides = document.querySelectorAll(".tocTree .showhide");
645+
if (showHides) {
646+
showHides.forEach(function(btn) {
647+
btn.onclick = function() {
648+
btn.querySelectorAll(".tocShow,.tocHide").forEach(function(toc) {
649+
toc.style.display = getComputedStyle(toc).display === "none" ? "inline" : "none";
650+
})
651+
btn.parentElement.querySelectorAll("ul.continuedtoc").forEach(function(ul) {
652+
ul.style.display = getComputedStyle(ul).display === "none" ? "block" : "none";
653+
})
654+
}
655+
})
656+
}
657+
})
634658
</script>
635659
<script type="text/javascript">
636-
$(function() {
660+
document.addEventListener("DOMContentLoaded", function() {
637661
const location = window.location.pathname.replace(/.*\/ref-(.*).html/, '$1.xml');
638-
$('.outOfDateTranslation').append('<a href="https://translate.tei-c.org/translate.html?edit=' + location + '"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" aria-label="{tei:i18n('translationOutOfDate')}" viewBox="0 0 16 16" style="position:absolute; top:2px; right:2px; color:red"><title><xsl:sequence select="tei:i18n('translationOutOfDate')"/></title>' +
639-
`<path d="M6.146 7.146a.5.5 0 0 1 .708 0L8 8.293l1.146-1.147a.5.5 0 1 1 .708.708L8.707 9l1.147 1.146a.5.5 0 0 1-.708.708L8 9.707l-1.146 1.147a.5.5 0 0 1-.708-.708L7.293 9 6.146 7.854a.5.5 0 0 1 0-.708z"/>
640-
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg></a>`);
662+
const outDateTr = document.querySelector('.outOfDateTranslation')
663+
if (outDateTr) {
664+
outDateTr.append('<a href="https://translate.tei-c.org/translate.html?edit=' + location + '"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" aria-label="Translation out of date." viewBox="0 0 16 16" style="position:absolute; top:2px; right:2px; color:red"><title>Translation out of date.</title>' +
665+
`
666+
<path d="M6.146 7.146a.5.5 0 0 1 .708 0L8 8.293l1.146-1.147a.5.5 0 1 1 .708.708L8.707 9l1.147 1.146a.5.5 0 0 1-.708.708L8 9.707l-1.146 1.147a.5.5 0 0 1-.708-.708L7.293 9 6.146 7.854a.5.5 0 0 1 0-.708z"></path>
667+
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"></path></svg></a>`);
668+
}
641669
});
642670
</script>
643671
<script src="https://tei-c.org/js/main.js"></script>

0 commit comments

Comments
 (0)