Hide DAB html until selected.

This commit is contained in:
Edward Betts 2022-08-18 20:48:38 +01:00
parent 4d175c8733
commit 5b0b720a45

View file

@ -70,7 +70,7 @@ a.new { color: red; }
<a href="#" onclick="return cancel_selection({{ dab.num }})">cancel selection</a> <a href="#" onclick="return cancel_selection({{ dab.num }})">cancel selection</a>
</span> </span>
</div> </div>
<div class="dab-article" id="dab-article-{{ dab.num }}">{{ dab.html | safe }}</div> <div class="dab-article d-none" id="dab-article-{{ dab.num }}">{{ dab.html | safe }}</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
@ -90,6 +90,14 @@ a.new { color: red; }
function jump_to(dab_num) { function jump_to(dab_num) {
var highlight_title = "text-bg-primary"; var highlight_title = "text-bg-primary";
var dab_articles = document.getElementsByClassName("dab-article");
for(var i=0; i<dab_articles.length; i++) {
dab_articles[i].classList.add("d-none");
}
var dab_article = document.getElementById("dab-article-" + dab_num);
dab_article.classList.remove("d-none");
var links = document.getElementsByTagName("a"); var links = document.getElementsByTagName("a");
for(var i=0; i<links.length; i++) { for(var i=0; i<links.length; i++) {
links[i].classList.remove("disambig-highlight"); links[i].classList.remove("disambig-highlight");