mirror of https://github.com/docker/docs.git
Fix for glossary
This commit is contained in:
parent
7b7cf3e229
commit
a36d37dae6
|
@ -217,6 +217,18 @@ else %}{% assign edit_url = "" %}{% endif %} {% break %} {% endif %} {% endfor %
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
<script src="/js/stickyfill.min.js"></script>
|
<script src="/js/stickyfill.min.js"></script>
|
||||||
<script defer src="/js/docs.js"></script>
|
<script defer src="/js/docs.js"></script>
|
||||||
|
<script language="javascript">
|
||||||
|
jQuery(document).ready(function(){
|
||||||
|
$.getJSON( "/metadata.txt", function( data ) {
|
||||||
|
metadata = data;
|
||||||
|
hookupTOCEvents();
|
||||||
|
$.getJSON( "/glossary.txt", function( data ) {
|
||||||
|
glossary = data;
|
||||||
|
renderTagsPage();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
67
js/docs.js
67
js/docs.js
|
@ -16,42 +16,45 @@ if (current[0]) {
|
||||||
|
|
||||||
function highlightRightNav(heading)
|
function highlightRightNav(heading)
|
||||||
{
|
{
|
||||||
if (heading == "title")
|
if (document.location.pathname.indexOf("/glossary/")<0){
|
||||||
{
|
console.log("highlightRightNav called on",document.location.pathname)
|
||||||
history.replaceState({},"Top of page on " + document.location.pathname,document.location.protocol +"//"+ document.location.hostname + (location.port ? ':'+location.port: '') + document.location.pathname);
|
if (heading == "title")
|
||||||
$("#my_toc a").each(function(){
|
|
||||||
$(this).removeClass("active");
|
|
||||||
});
|
|
||||||
$("#sidebar-wrapper").animate({
|
|
||||||
scrollTop: 0
|
|
||||||
},800);
|
|
||||||
} else {
|
|
||||||
var targetAnchorHREF = document.location.protocol +"//"+ document.location.hostname + (location.port ? ':'+location.port: '') + document.location.pathname + "#" + heading;
|
|
||||||
// make sure we aren't filtering out that heading level
|
|
||||||
var noFilterFound = false;
|
|
||||||
$("#my_toc a").each(function(){
|
|
||||||
if (this.href==targetAnchorHREF) {
|
|
||||||
noFilterFound = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// now, highlight that heading
|
|
||||||
if (noFilterFound)
|
|
||||||
{
|
{
|
||||||
|
history.replaceState({},"Top of page on " + document.location.pathname,document.location.protocol +"//"+ document.location.hostname + (location.port ? ':'+location.port: '') + document.location.pathname);
|
||||||
$("#my_toc a").each(function(){
|
$("#my_toc a").each(function(){
|
||||||
//console.log("right-nav",this.href);
|
$(this).removeClass("active");
|
||||||
if (this.href==targetAnchorHREF)
|
});
|
||||||
{
|
$("#sidebar-wrapper").animate({
|
||||||
history.replaceState({},this.innerText,targetAnchorHREF);
|
scrollTop: 0
|
||||||
$(this).addClass("active");
|
},800);
|
||||||
var sidebarOffset = (sidebarBottom > 200) ? 200 : headerOffset - 20;
|
} else {
|
||||||
$("#sidebar-wrapper").animate({
|
var targetAnchorHREF = document.location.protocol +"//"+ document.location.hostname + (location.port ? ':'+location.port: '') + document.location.pathname + "#" + heading;
|
||||||
scrollTop: $("#sidebar-wrapper").scrollTop() + $(this).position().top - sidebarOffset
|
// make sure we aren't filtering out that heading level
|
||||||
},100);
|
var noFilterFound = false;
|
||||||
//document.getElementById("sidebar-wrapper").scrollTop = this.getBoundingClientRect().top - 200;
|
$("#my_toc a").each(function(){
|
||||||
} else {
|
if (this.href==targetAnchorHREF) {
|
||||||
$(this).removeClass("active");
|
noFilterFound = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// now, highlight that heading
|
||||||
|
if (noFilterFound)
|
||||||
|
{
|
||||||
|
$("#my_toc a").each(function(){
|
||||||
|
//console.log("right-nav",this.href);
|
||||||
|
if (this.href==targetAnchorHREF)
|
||||||
|
{
|
||||||
|
history.replaceState({},this.innerText,targetAnchorHREF);
|
||||||
|
$(this).addClass("active");
|
||||||
|
var sidebarOffset = (sidebarBottom > 200) ? 200 : headerOffset - 20;
|
||||||
|
$("#sidebar-wrapper").animate({
|
||||||
|
scrollTop: $("#sidebar-wrapper").scrollTop() + $(this).position().top - sidebarOffset
|
||||||
|
},100);
|
||||||
|
//document.getElementById("sidebar-wrapper").scrollTop = this.getBoundingClientRect().top - 200;
|
||||||
|
} else {
|
||||||
|
$(this).removeClass("active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
js/menu.js
15
js/menu.js
|
@ -261,18 +261,9 @@ function renderTagsPage()
|
||||||
var glossaryOutput = glossary.terms[i].def;
|
var glossaryOutput = glossary.terms[i].def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glossaryOutput) $("#glossaryMatch").html("<h2>Definition of: " + tagToLookup + "</h2>" + glossaryOutput);
|
if (glossaryOutput) {
|
||||||
|
$("#glossaryMatch").html("<h2>Definition of: " + tagToLookup + "</h2>" + glossaryOutput);
|
||||||
|
}
|
||||||
renderTopicsByTagTable(tagToLookup,"topicMatch",true);
|
renderTopicsByTagTable(tagToLookup,"topicMatch",true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(document).ready(function(){
|
|
||||||
$.getJSON( "/metadata.txt", function( data ) {
|
|
||||||
metadata = data;
|
|
||||||
hookupTOCEvents();
|
|
||||||
$.getJSON( "/glossary.txt", function( data ) {
|
|
||||||
glossary = data;
|
|
||||||
renderTagsPage();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue